2 // This file is part of the aMule Project.
4 // Copyright (c) 2003-2008 aMule Team ( admin@amule.org / http://www.amule.org )
5 // Copyright (c) 2002 Merkur ( devs@emule-project.net / http://www.emule-project.net )
7 // Any parts of this program derived from the xMule, lMule or eMule project,
8 // or contributed by third-party developers are copyrighted by their
11 // This program is free software; you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation; either version 2 of the License, or
14 // (at your option) any later version.
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
21 // You should have received a copy of the GNU General Public License
22 // along with this program; if not, write to the Free Software
23 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
29 #include "ObservableQueue.h"
34 class CServerList
: public CObservableQueue
<CServer
*>
36 friend class CServerListCtrl
;
42 bool AddServer(CServer
* in_server
, bool fromUser
= false);
43 void RemoveServer(CServer
* in_server
);
44 void RemoveAllServers();
45 void RemoveDeadServers();
46 bool LoadServerMet(const CPath
& path
);
49 void ResetServerPos() {m_serverpos
= m_servers
.begin();}
50 CServer
* GetNextServer(bool bOnlyObfuscated
= false);
51 size_t GetServerCount() {return m_servers
.size();}
52 CServer
* GetServerByAddress(const wxString
& address
, uint16 port
) const;
53 CServer
* GetServerByIP(uint32 nIP
) const;
54 CServer
* GetServerByIPTCP(uint32 nIP
, uint16 nPort
) const;
55 CServer
* GetServerByIPUDP(uint32 nIP
, uint16 nUDPPort
, bool bObfuscationPorts
= true) const;
56 void GetStatus(uint32
&failed
, uint32
&user
, uint32
&file
, uint32
&tuser
, uint32
&tfile
, float &occ
);
57 void GetUserFileStatus( uint32
&user
, uint32
&file
);
59 void UpdateServerMetFromURL(const wxString
& strURL
);
60 void DownloadFinished(uint32 result
);
61 void AutoDownloadFinished(uint32 result
);
62 uint32
GetAvgFile() const;
64 std::vector
<const CServer
*> CopySnapshot() const;
66 /** Refilters all servers though the IPFilter. */
69 void CheckForExpiredUDPKeys();
72 virtual void ObserverAdded( ObserverType
* );
74 CServer
* GetNextStatServer();
76 void LoadStaticServers( const wxString
& filename
);
77 uint8 current_url_index
;
79 typedef std::list
<CServer
*> CInternalList
;
80 CInternalList m_servers
;
81 CInternalList::const_iterator m_serverpos
;
82 CInternalList::const_iterator m_statserverpos
;
84 uint32 m_nLastED2KServerLinkCheck
;// emanuelw(20030924) added
86 wxString URLAutoUpdate
;
89 #endif // SERVERLIST_H
90 // File_checked_for_headers