2 // This file is part of the aMule Project.
4 // Copyright (c) 2003-2011 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 CServer
* GetServerByECID(uint32 ecid
) const;
57 void GetStatus(uint32
&failed
, uint32
&user
, uint32
&file
, uint32
&tuser
, uint32
&tfile
, float &occ
);
58 void GetUserFileStatus( uint32
&user
, uint32
&file
);
59 bool IsInitialized() const { return m_initialized
; }
61 void UpdateServerMetFromURL(const wxString
& strURL
);
62 bool DownloadFinished(uint32 result
);
63 void AutoDownloadFinished(uint32 result
);
64 uint32
GetAvgFile() const;
66 std::vector
<const CServer
*> CopySnapshot() const;
68 /** Refilters all servers though the IPFilter. */
71 void CheckForExpiredUDPKeys();
74 * Marks the specified server as static or not.
76 * @param The server to be marked or unmarked as static.
77 * @param The new static state.
79 * Other than setting the static setting of the specified server, it
80 * also adds or removes the server from the static-list file.
82 void SetStaticServer(CServer
* server
, bool isStatic
);
83 void SetServerPrio(CServer
* server
, uint32 prio
);
86 virtual void ObserverAdded( ObserverType
* );
88 CServer
* GetNextStatServer();
90 wxString m_staticServersConfig
;
91 void LoadStaticServers();
92 void SaveStaticServers();
93 uint8 current_url_index
;
95 typedef std::list
<CServer
*> CInternalList
;
96 CInternalList m_servers
;
97 CInternalList::const_iterator m_serverpos
;
98 CInternalList::const_iterator m_statserverpos
;
100 uint32 m_nLastED2KServerLinkCheck
;// emanuelw(20030924) added
101 wxString m_URLUpdate
;
105 #endif // SERVERLIST_H
106 // File_checked_for_headers