Detail::Server Class Reference

Server represents one server object. More...

#include <server.h>

List of all members.


Public Member Functions

 DECLARE_EVENT_TABLE (Server *, int)
 Server (IPV4Address addr)
 Construct using IP and port.
 Server (std::istream &i)
 Construct by reading data from stream.
Getters
IPV4Address getAddr () const
std::string getName () const
std::string getDesc () const
std::string getDynIp () const
std::string getVersion () const
uint32_t getFailedCount () const
uint32_t getPreference () const
uint32_t getPing () const
uint32_t getLastPing () const
uint32_t getMaxUsers () const
uint32_t getSoftLimit () const
uint32_t getHardLimit () const
uint32_t getUdpFlags () const
uint32_t getTcpFlags () const
uint32_t getUsers () const
uint32_t getFiles () const
uint32_t getLowIdUsers () const
std::vector< uint16_t > getAuxPorts () const
uint64_t getLastUdpQuery () const
bool pingInProgress () const
uint32_t getChallenge () const
uint16_t getUdpPort () const
 ED2K Server UDP port is always TCP + 4.
bool supportsGetSources () const
bool supportsGetFiles () const
Setters
void setAddr (IPV4Address addr)
void setName (const std::string &name)
void setDesc (const std::string &desc)
void setDynIp (const std::string &dyndip)
void setVersion (uint32_t ver)
void setFailedCount (uint32_t count)
void addFailedCount ()
void setPing (uint32_t ping)
void setLastPing (uint32_t ping)
void setMaxUsers (uint32_t users)
void setSoftLimit (uint32_t limit)
void setHardLimit (uint32_t limit)
void setUdpFlags (uint32_t flags)
void setTcpFlags (uint32_t flags)
void addAuxPort (uint16_t port)
void setUsers (uint32_t users)
void setFiles (uint32_t files)
void setLowIdUsers (uint32_t num)
void setLastUdpQuery (uint64_t time)
void setPingInProgress (bool v)
void setChallenge (uint32_t c)

Private Types

enum  ED2K_ServerUdpFlags {
  FL_GETSOURCES = 0x01, FL_GETFILES = 0x02, FL_NEWTAGS = 0x08, FL_UNICODE = 0x10,
  FL_GETSOURCES2 = 0x20
}
 Values found in m_udpFlags bitfield. More...

Private Member Functions

 Server ()
 Forbidden.
 ~Server ()
 Allowed by ServerList.
void addAuxPorts (const std::string &ports)
 Parses comma-separated list of ports and adds them.

Private Attributes

Data
IPV4Address m_addr
 Address of the server.
std::string m_name
 Name of the server.
std::string m_desc
 Description.
std::string m_dynip
 Dynamic ip address.
std::string m_version
 Version number.
uint32_t m_failedCount
 Number of times it has failed.
uint32_t m_preference
 Priority.
uint32_t m_ping
 Ping.
uint32_t m_lastPing
 Last ping.
uint32_t m_maxUsers
 Max allowed users.
uint32_t m_softLimit
 Soft files limit.
uint32_t m_hardLimit
 Hard files limit.
uint32_t m_udpFlags
 UDP flags.
uint32_t m_tcpFlags
 TCP flags.
uint32_t m_users
 Current online users.
uint32_t m_files
 Current online files.
uint32_t m_lowIdUsers
 Current online lowId users.
std::vector< uint16_t > m_auxPorts
 Auxiliary ports.
uint64_t m_lastUdpQuery
 Time of last UDP query.
bool m_pingInProgress
 UDP Ping is in progress.
uint32_t m_challenge
 Last UDP query challenge.

Friends

class ::ServerList
std::ostream & operator<< (std::ostream &o, const Server &s)
 Write the object to stream.
bool operator< (const Server &x, const Server &y)

Detailed Description

Server represents one server object.

A server in eDonkey2000 network has a set of properties, however internally only the address of the server is used - the remainder of properties are used only for showing to user.

Server object is owned by ServerList object, the destructor has been protected to enforce that relationship.

Note: TCP flags are not stored in server.met according to eMule.

Definition at line 45 of file server.h.


Member Enumeration Documentation

enum Detail::Server::ED2K_ServerUdpFlags [private]
 

Values found in m_udpFlags bitfield.

Enumeration values:
FL_GETSOURCES  Supports UDP GetSources.
FL_GETFILES  Supports UDP GetFiles/Search.
FL_NEWTAGS  Supports NewTags.
FL_UNICODE  Supports Unicode.
FL_GETSOURCES2  Supports extended GetSources.

Definition at line 125 of file server.h.


Constructor & Destructor Documentation

Detail::Server::Server IPV4Address  addr  ) 
 

Construct using IP and port.

Definition at line 35 of file server.cpp.

References m_addr, and setName().

Detail::Server::Server std::istream &  i  ) 
 

Construct by reading data from stream.

Definition at line 50 of file server.cpp.

References addAuxPorts(), Tag::getInt(), getName(), Tag::getName(), Tag::getOpcode(), Tag::getStr(), m_addr, m_desc, m_dynip, m_failedCount, m_files, m_hardLimit, m_lastPing, m_lowIdUsers, m_maxUsers, m_ping, m_preference, m_softLimit, m_udpFlags, m_users, m_version, setName(), ST_AUXPORTLIST, ST_DESC, ST_DYNIP, ST_FAIL, ST_HARDLIMIT, ST_LASTPING, ST_LOWIDUSRS, ST_MAXUSERS, ST_NAME, ST_PING, ST_PREFERENCE, ST_SOFTLIMIT, ST_UDPFLAGS, ST_VERSION, and warnUnHandled().

Detail::Server::Server  )  [private]
 

Forbidden.

Detail::Server::~Server  )  [private]
 

Allowed by ServerList.

Definition at line 47 of file server.cpp.


Member Function Documentation

Detail::Server::DECLARE_EVENT_TABLE Server ,
int 
 

IPV4Address Detail::Server::getAddr  )  const [inline]
 

Definition at line 62 of file server.h.

References m_addr.

Referenced by ServerList::connect(), ServerList::getCurServerAddr(), ServerList::load(), and ServerList::onPacket().

std::string Detail::Server::getName  )  const [inline]
 

Definition at line 63 of file server.h.

References m_name.

Referenced by ServerList::onPacket(), and Server().

std::string Detail::Server::getDesc  )  const [inline]
 

Definition at line 64 of file server.h.

References m_desc.

std::string Detail::Server::getDynIp  )  const [inline]
 

Definition at line 65 of file server.h.

References m_dynip.

std::string Detail::Server::getVersion  )  const [inline]
 

Definition at line 66 of file server.h.

References m_version.

uint32_t Detail::Server::getFailedCount  )  const [inline]
 

Definition at line 67 of file server.h.

References m_failedCount.

uint32_t Detail::Server::getPreference  )  const [inline]
 

Definition at line 68 of file server.h.

References m_preference.

uint32_t Detail::Server::getPing  )  const [inline]
 

Definition at line 69 of file server.h.

References m_ping.

uint32_t Detail::Server::getLastPing  )  const [inline]
 

Definition at line 70 of file server.h.

References m_lastPing.

uint32_t Detail::Server::getMaxUsers  )  const [inline]
 

Definition at line 71 of file server.h.

References m_maxUsers.

uint32_t Detail::Server::getSoftLimit  )  const [inline]
 

Definition at line 72 of file server.h.

References m_softLimit.

uint32_t Detail::Server::getHardLimit  )  const [inline]
 

Definition at line 73 of file server.h.

References m_hardLimit.

uint32_t Detail::Server::getUdpFlags  )  const [inline]
 

Definition at line 74 of file server.h.

References m_udpFlags.

uint32_t Detail::Server::getTcpFlags  )  const [inline]
 

Definition at line 75 of file server.h.

References m_tcpFlags.

Referenced by ServerList::onPacket(), and ServerList::publishFile().

uint32_t Detail::Server::getUsers  )  const [inline]
 

Definition at line 76 of file server.h.

References m_users.

uint32_t Detail::Server::getFiles  )  const [inline]
 

Definition at line 77 of file server.h.

References m_files.

uint32_t Detail::Server::getLowIdUsers  )  const [inline]
 

Definition at line 78 of file server.h.

References m_lowIdUsers.

std::vector<uint16_t> Detail::Server::getAuxPorts  )  const [inline]
 

Definition at line 79 of file server.h.

References m_auxPorts.

uint64_t Detail::Server::getLastUdpQuery  )  const [inline]
 

Definition at line 80 of file server.h.

References m_lastUdpQuery.

bool Detail::Server::pingInProgress  )  const [inline]
 

Definition at line 81 of file server.h.

References m_pingInProgress.

uint32_t Detail::Server::getChallenge  )  const [inline]
 

Definition at line 82 of file server.h.

References m_challenge.

uint16_t Detail::Server::getUdpPort  )  const [inline]
 

ED2K Server UDP port is always TCP + 4.

Definition at line 85 of file server.h.

References m_addr.

bool Detail::Server::supportsGetSources  )  const [inline]
 

Definition at line 86 of file server.h.

References FL_GETSOURCES, and m_udpFlags.

bool Detail::Server::supportsGetFiles  )  const [inline]
 

Definition at line 87 of file server.h.

References FL_GETFILES, and m_udpFlags.

void Detail::Server::setAddr IPV4Address  addr  )  [inline]
 

Definition at line 92 of file server.h.

References m_addr.

void Detail::Server::setName const std::string &  name  )  [inline]
 

Definition at line 93 of file server.h.

References m_name.

Referenced by Server().

void Detail::Server::setDesc const std::string &  desc  )  [inline]
 

Definition at line 97 of file server.h.

References m_desc.

void Detail::Server::setDynIp const std::string &  dyndip  )  [inline]
 

Definition at line 98 of file server.h.

References m_dynip.

void Detail::Server::setVersion uint32_t  ver  )  [inline]
 

Definition at line 99 of file server.h.

References m_version.

void Detail::Server::setFailedCount uint32_t  count  )  [inline]
 

Definition at line 100 of file server.h.

References m_failedCount.

Referenced by ServerList::sendLoginRequest().

void Detail::Server::addFailedCount  )  [inline]
 

Definition at line 101 of file server.h.

References m_failedCount.

Referenced by ServerList::onServerListEvent(), and ServerList::onServerSocketEvent().

void Detail::Server::setPing uint32_t  ping  )  [inline]
 

Definition at line 102 of file server.h.

References m_ping.

void Detail::Server::setLastPing uint32_t  ping  )  [inline]
 

Definition at line 103 of file server.h.

References m_lastPing.

void Detail::Server::setMaxUsers uint32_t  users  )  [inline]
 

Definition at line 104 of file server.h.

References m_maxUsers.

void Detail::Server::setSoftLimit uint32_t  limit  )  [inline]
 

Definition at line 105 of file server.h.

References m_softLimit.

void Detail::Server::setHardLimit uint32_t  limit  )  [inline]
 

Definition at line 106 of file server.h.

References m_hardLimit.

void Detail::Server::setUdpFlags uint32_t  flags  )  [inline]
 

Definition at line 107 of file server.h.

References m_udpFlags.

void Detail::Server::setTcpFlags uint32_t  flags  )  [inline]
 

Definition at line 108 of file server.h.

References m_tcpFlags.

Referenced by ServerList::onPacket().

void Detail::Server::addAuxPort uint16_t  port  )  [inline]
 

Definition at line 109 of file server.h.

References m_auxPorts.

void Detail::Server::setUsers uint32_t  users  )  [inline]
 

Definition at line 110 of file server.h.

References m_users.

Referenced by ServerList::onPacket().

void Detail::Server::setFiles uint32_t  files  )  [inline]
 

Definition at line 111 of file server.h.

References m_files.

Referenced by ServerList::onPacket().

void Detail::Server::setLowIdUsers uint32_t  num  )  [inline]
 

Definition at line 112 of file server.h.

References m_lowIdUsers.

void Detail::Server::setLastUdpQuery uint64_t  time  )  [inline]
 

Definition at line 114 of file server.h.

References m_lastUdpQuery.

void Detail::Server::setPingInProgress bool  v  )  [inline]
 

Definition at line 115 of file server.h.

References m_pingInProgress.

void Detail::Server::setChallenge uint32_t  c  )  [inline]
 

Definition at line 116 of file server.h.

References m_challenge.

void Detail::Server::addAuxPorts const std::string &  ports  )  [private]
 

Parses comma-separated list of ports and adds them.

Definition at line 225 of file server.cpp.

References m_auxPorts.

Referenced by Server().


Friends And Related Function Documentation

friend class ::ServerList [friend]
 

Definition at line 119 of file server.h.

std::ostream& operator<< std::ostream &  o,
const Server s
[friend]
 

Write the object to stream.

Definition at line 140 of file server.cpp.

bool operator< const Server x,
const Server y
[friend]
 

Definition at line 120 of file server.h.


Member Data Documentation

IPV4Address Detail::Server::m_addr [private]
 

Address of the server.

Definition at line 138 of file server.h.

Referenced by getAddr(), getUdpPort(), Server(), and setAddr().

std::string Detail::Server::m_name [private]
 

Name of the server.

Definition at line 139 of file server.h.

Referenced by getName(), and setName().

std::string Detail::Server::m_desc [private]
 

Description.

Definition at line 140 of file server.h.

Referenced by getDesc(), Server(), and setDesc().

std::string Detail::Server::m_dynip [private]
 

Dynamic ip address.

Definition at line 141 of file server.h.

Referenced by getDynIp(), Server(), and setDynIp().

std::string Detail::Server::m_version [private]
 

Version number.

Definition at line 142 of file server.h.

Referenced by getVersion(), Server(), and setVersion().

uint32_t Detail::Server::m_failedCount [private]
 

Number of times it has failed.

Definition at line 143 of file server.h.

Referenced by addFailedCount(), getFailedCount(), Server(), and setFailedCount().

uint32_t Detail::Server::m_preference [private]
 

Priority.

Definition at line 144 of file server.h.

Referenced by getPreference(), and Server().

uint32_t Detail::Server::m_ping [private]
 

Ping.

Definition at line 145 of file server.h.

Referenced by getPing(), Server(), and setPing().

uint32_t Detail::Server::m_lastPing [private]
 

Last ping.

Definition at line 146 of file server.h.

Referenced by getLastPing(), Server(), and setLastPing().

uint32_t Detail::Server::m_maxUsers [private]
 

Max allowed users.

Definition at line 147 of file server.h.

Referenced by getMaxUsers(), Server(), and setMaxUsers().

uint32_t Detail::Server::m_softLimit [private]
 

Soft files limit.

Definition at line 148 of file server.h.

Referenced by getSoftLimit(), Server(), and setSoftLimit().

uint32_t Detail::Server::m_hardLimit [private]
 

Hard files limit.

Definition at line 149 of file server.h.

Referenced by getHardLimit(), Server(), and setHardLimit().

uint32_t Detail::Server::m_udpFlags [private]
 

UDP flags.

Definition at line 150 of file server.h.

Referenced by getUdpFlags(), Server(), setUdpFlags(), supportsGetFiles(), and supportsGetSources().

uint32_t Detail::Server::m_tcpFlags [private]
 

TCP flags.

Definition at line 151 of file server.h.

Referenced by getTcpFlags(), and setTcpFlags().

uint32_t Detail::Server::m_users [private]
 

Current online users.

Definition at line 152 of file server.h.

Referenced by getUsers(), Server(), and setUsers().

uint32_t Detail::Server::m_files [private]
 

Current online files.

Definition at line 153 of file server.h.

Referenced by getFiles(), Server(), and setFiles().

uint32_t Detail::Server::m_lowIdUsers [private]
 

Current online lowId users.

Definition at line 154 of file server.h.

Referenced by getLowIdUsers(), Server(), and setLowIdUsers().

std::vector<uint16_t> Detail::Server::m_auxPorts [private]
 

Auxiliary ports.

Definition at line 155 of file server.h.

Referenced by addAuxPort(), addAuxPorts(), and getAuxPorts().

uint64_t Detail::Server::m_lastUdpQuery [private]
 

Time of last UDP query.

Definition at line 157 of file server.h.

Referenced by getLastUdpQuery(), and setLastUdpQuery().

bool Detail::Server::m_pingInProgress [private]
 

UDP Ping is in progress.

Definition at line 158 of file server.h.

Referenced by pingInProgress(), and setPingInProgress().

uint32_t Detail::Server::m_challenge [private]
 

Last UDP query challenge.

Definition at line 159 of file server.h.

Referenced by getChallenge(), and setChallenge().


The documentation for this class was generated from the following files: