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
30 #include "OtherStructs.h"
32 #include <protocol/ed2k/Client2Server/TCP.h>
33 #include <protocol/ed2k/Client2Server/UDP.h>
36 #include <ec/cpp/ECSpecialTags.h>
43 #define SRV_PR_NORMAL 0
45 // Server priority max and min values
53 CServer(ServerMet_Struct
* in_data
);
54 CServer(uint16 in_port
, const wxString i_addr
);
55 CServer(CServer
* pOld
);
58 CServer(CEC_Server_Tag
*);
62 void AddTag(CTag
* in_tag
) {m_taglist
.push_back(in_tag
);}
63 const wxString
&GetListName() const {return listname
;}
64 const wxString
&GetFullIP() const {return ipfull
;}
66 const wxString
&GetAddress() const {
67 if (!dynip
.IsEmpty()) {
75 uint16
GetPort() const {return realport
? realport
: port
;}
76 // the connection port
77 uint16
GetConnPort() const {return port
;}
78 void SetPort(uint32 val
) {realport
= val
;}
79 bool AddTagFromFile(CFileDataIO
* servermet
);
80 void SetListName(const wxString
& newname
);
81 void SetDescription(const wxString
& newdescription
);
82 uint32
GetIP() const {return ip
;}
83 uint32
GetFiles() const {return files
;}
84 uint32
GetUsers() const {return users
;}
85 const wxString
&GetDescription() const {return description
;}
86 uint32
GetPing() const {return ping
;}
87 uint32
GetPreferences() const {return preferences
;}
88 uint32
GetMaxUsers() const {return maxusers
;}
89 void SetMaxUsers(uint32 in_maxusers
) {maxusers
= in_maxusers
;}
90 void SetUserCount(uint32 in_users
) {users
= in_users
;}
91 void SetFileCount(uint32 in_files
) {files
= in_files
;}
92 void ResetFailedCount() {failedcount
= 0;}
93 void AddFailedCount() {failedcount
++;}
94 uint32
GetFailedCount() const {return failedcount
;}
95 void SetID(uint32 newip
);
96 const wxString
&GetDynIP() const {return dynip
;}
97 bool HasDynIP() const {return !dynip
.IsEmpty() ;}
98 void SetDynIP(const wxString
& newdynip
);
100 uint32
GetLastPingedTime() const {return lastpingedtime
;}
101 void SetLastPingedTime(uint32 in_lastpingedtime
) {lastpingedtime
= in_lastpingedtime
;}
103 uint32
GetRealLastPingedTime() const {return m_dwRealLastPingedTime
;} // last pinged time without any random modificator
104 void SetRealLastPingedTime(uint32 in_lastpingedtime
) {m_dwRealLastPingedTime
= in_lastpingedtime
;}
106 uint32
GetLastPinged() const {return lastpinged
;}
107 void SetLastPinged(uint32 in_lastpinged
) {lastpinged
= in_lastpinged
;}
109 void SetPing(uint32 in_ping
) {ping
= in_ping
;}
110 void SetPreference(uint32 in_preferences
) {preferences
= in_preferences
;}
111 void SetIsStaticMember(bool in
) {staticservermember
=in
;}
112 bool IsStaticMember() const {return staticservermember
;}
113 uint32
GetChallenge() const {return challenge
;}
114 void SetChallenge(uint32 in_challenge
) {challenge
= in_challenge
;}
115 uint32
GetSoftFiles() const {return softfiles
;}
116 void SetSoftFiles(uint32 in_softfiles
) {softfiles
= in_softfiles
;}
117 uint32
GetHardFiles() const {return hardfiles
;}
118 void SetHardFiles(uint32 in_hardfiles
) {hardfiles
= in_hardfiles
;}
119 const wxString
&GetVersion() const {return m_strVersion
;}
120 void SetVersion(const wxString
&pszVersion
) {m_strVersion
= pszVersion
;}
121 void SetTCPFlags(uint32 uFlags
) {m_uTCPFlags
= uFlags
;}
122 uint32
GetTCPFlags() const {return m_uTCPFlags
;}
123 void SetUDPFlags(uint32 uFlags
) {m_uUDPFlags
= uFlags
;}
124 uint32
GetUDPFlags() const {return m_uUDPFlags
;}
125 uint32
GetLowIDUsers() const {return m_uLowIDUsers
;}
126 void SetLowIDUsers(uint32 uLowIDUsers
) {m_uLowIDUsers
= uLowIDUsers
;}
127 uint32
GetDescReqChallenge() const {return m_uDescReqChallenge
;}
128 void SetDescReqChallenge(uint32 uDescReqChallenge
) {m_uDescReqChallenge
= uDescReqChallenge
;}
129 uint8
GetLastDescPingedCount() const {return lastdescpingedcout
;}
130 void SetLastDescPingedCount(bool reset
);
132 uint16
GetObfuscationPortTCP() const {return m_nObfuscationPortTCP
;}
133 void SetObfuscationPortTCP(uint16 nPort
) {m_nObfuscationPortTCP
= nPort
;}
135 uint16
GetObfuscationPortUDP() const {return m_nObfuscationPortUDP
;}
136 void SetObfuscationPortUDP(uint16 nPort
) {m_nObfuscationPortUDP
= nPort
;}
138 uint32
GetServerKeyUDP(bool bForce
= false) const;
139 void SetServerKeyUDP(uint32 dwServerKeyUDP
);
141 bool GetCryptPingReplyPending() const {return m_bCryptPingReplyPending
;}
142 void SetCryptPingReplyPending(bool bVal
) {m_bCryptPingReplyPending
= bVal
;}
144 uint32
GetServerKeyUDPIP() const {return m_dwIPServerKeyUDP
;}
146 bool GetUnicodeSupport() const {return (GetTCPFlags() & SRV_TCPFLG_UNICODE
) != 0;}
147 bool GetRelatedSearchSupport() const {return (GetTCPFlags() & SRV_TCPFLG_RELATEDSEARCH
) != 0;}
148 bool SupportsLargeFilesTCP() const {return (GetTCPFlags() & SRV_TCPFLG_LARGEFILES
) != 0;}
149 bool SupportsLargeFilesUDP() const {return (GetUDPFlags() & SRV_UDPFLG_LARGEFILES
) != 0;}
150 bool SupportsObfuscationUDP() const {return (GetUDPFlags() & SRV_UDPFLG_UDPOBFUSCATION
) != 0;}
151 bool SupportsObfuscationTCP() const {return (GetObfuscationPortTCP() != 0) && (((GetUDPFlags() & SRV_UDPFLG_TCPOBFUSCATION
) != 0) || ((GetTCPFlags() & SRV_TCPFLG_TCPOBFUSCATION
) != 0));}
152 bool SupportsGetSourcesObfuscation() const {return (GetTCPFlags() & SRV_TCPFLG_TCPOBFUSCATION
) != 0;} // mapped to TCPFLAG_TCPOBFU
154 const wxString
& GetAuxPortsList() const {return m_auxPorts
;}
155 void SetAuxPortsList(const wxString
& val
) {m_auxPorts
= val
;}
157 uint64
GetLastDNSSolve() const { return m_lastdnssolve
; }
158 void SetLastDNSSolve(uint64 value
) { m_lastdnssolve
= value
; }
160 bool GetDNSError() const { return m_dnsfailure
; }
161 void SetDNSError(bool value
) { m_dnsfailure
= value
; }
165 uint32 lastpinged
; //This is to get the ping delay.
166 uint32 lastpingedtime
; //This is to decided when we retry the ping.
174 wxString description
;
183 uint32 m_uDescReqChallenge
;
184 uint8 lastdescpingedcout
;
185 TagPtrList m_taglist
;
186 bool staticservermember
;
187 wxString m_strVersion
;
190 uint32 m_uLowIDUsers
;
193 uint64 m_lastdnssolve
;
196 bool m_bCryptPingReplyPending
;
197 uint32 m_dwServerKeyUDP
;
198 uint32 m_dwIPServerKeyUDP
;
199 uint16 m_nObfuscationPortTCP
;
200 uint16 m_nObfuscationPortUDP
;
202 uint32 m_dwRealLastPingedTime
;
208 // File_checked_for_headers