Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

BTClients.h

Go to the documentation of this file.
00001 //
00002 // BTClients.h
00003 //
00004 // Copyright (c) Shareaza Development Team, 2002-2005.
00005 // This file is part of SHAREAZA (www.shareaza.com)
00006 //
00007 // Shareaza is free software; you can redistribute it
00008 // and/or modify it under the terms of the GNU General Public License
00009 // as published by the Free Software Foundation; either version 2 of
00010 // the License, or (at your option) any later version.
00011 //
00012 // Shareaza is distributed in the hope that it will be useful,
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 // GNU General Public License for more details.
00016 //
00017 // You should have received a copy of the GNU General Public License
00018 // along with Shareaza; if not, write to the Free Software
00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020 //
00021 
00022 #if !defined(AFX_BTCLIENTS_H__A52C25F0_7D86_40A2_BBF6_DB452DED7A1E__INCLUDED_)
00023 #define AFX_BTCLIENTS_H__A52C25F0_7D86_40A2_BBF6_DB452DED7A1E__INCLUDED_
00024 
00025 #pragma once
00026 
00027 class CConnection;
00028 class CBTClient;
00029 class CBTTrackerRequest;
00030 
00031 
00032 class CBTClients
00033 {
00034 // Construction
00035 public:
00036         CBTClients();
00037         virtual ~CBTClients();
00038 
00039 // Attributes
00040 protected:
00041         CPtrList        m_pList;
00042         //SHA1          m_pGUID;
00043 protected:
00044         CCriticalSection        m_pSection;
00045         CEvent                          m_pShutdown;
00046         BOOL                            m_bShutdown;
00047         CPtrList                        m_pRequests;
00048 
00049 // Operations
00050 public:
00051         void            Clear();
00052         //SHA1*         GetGUID();
00053         BOOL            OnAccept(CConnection* pConnection);
00054         void            ShutdownRequests();
00055 protected:
00056         void            Add(CBTClient* pClient);
00057         void            Remove(CBTClient* pClient);
00058         void            Add(CBTTrackerRequest* pRequest);
00059         void            Remove(CBTTrackerRequest* pRequest);
00060 
00061 // List Access
00062 public:
00063         inline POSITION GetIterator() const
00064         {
00065                 return m_pList.GetHeadPosition();
00066         }
00067 
00068         inline CBTClient* GetNext(POSITION& pos) const
00069         {
00070                 return (CBTClient*)m_pList.GetNext( pos );
00071         }
00072 
00073         inline int GetCount() const
00074         {
00075                 return m_pList.GetCount();
00076         }
00077 
00078         friend class CBTClient;
00079         friend class CBTTrackerRequest;
00080 
00081 };
00082 
00083 extern CBTClients BTClients;
00084 
00085 #define BT_PROTOCOL_HEADER                      "\023BitTorrent protocol"
00086 #define BT_PROTOCOL_HEADER_LEN          20
00087 
00088 #endif // !defined(AFX_BTCLIENTS_H__A52C25F0_7D86_40A2_BBF6_DB452DED7A1E__INCLUDED_)

Generated on Thu Dec 15 10:39:33 2005 for Shareaza 2.2.1.0 by  doxygen 1.4.2