ED2KPacket Namespace Reference

ED2KPacket namespace contains all packet objects supported by the parser. More...


Classes

class  InvalidPacket
 Exception class, thrown when invalid packets are found during parsing. More...
class  Packet
 Abstract base Packet class defines a virtual destructor, and few convenience methods for usage by derived classes. More...
class  LoginRequest
 LoginRequest packet is sent to server after establishing the connection to let the server know we are there. More...
class  ServerMessage
 ServerMessage is a free-form string message sent by servers after successful login. More...
class  ServerStatus
 ServerStatus is a packet sent by servers after establishing a connection, containing number of users and files currently on the server. More...
class  IdChange
 IdChange packet is sent by servers after establishing a connection with the server to notify the client of their new ID. More...
class  GetServerList
 Sent to server, this requests the server to send us its current known servers list. More...
class  ServerIdent
 ServerIdent is a response from server to GetServerList packet, and includes information about the server. More...
class  ServerList
 ServerList packet is sent by servers in response to GetServerList packet, and contains a list of known servers to the source. More...
class  OfferFiles
 OfferFiles packet is used in eDonkey2000 network to publish shared files to currently connected server. More...
class  Search
 Search packet is used in client<->server communication to perform a search on one or more servers. More...
class  SearchResult
 SearchResult packet is sent by server, and contains one or more search results. More...
class  ReqCallback
 Request the callback from a LowID client. More...
class  CallbackReq
 This packet indicates that a remote client wishes us to "call back" to it. More...
class  ReqSources
 Request sources for a hash from server. More...
class  FoundSources
 This is server's response to ReqSources packet, and contains the list of sources for the given hash. More...
class  GlobGetSources
 Global source aquisition; sent via UDP, and contains one or more file hashes, for which we wish to get sources for. More...
class  GlobFoundSources
 Response to UDP GlobGetSources, this packet includes hash and list of sources corresponding to that hash. More...
class  GlobStatReq
 Global stats request; requests server to respond it's current users/files counts. More...
class  GlobStatRes
 Global stats response - includes the servers current users/files counts. More...
class  Hello
 Hello packet is used to initialize a communication with another client. More...
class  HelloAnswer
 HelloAnswer packet is the expected response to Hello packet. More...
class  MuleInfo
class  MuleInfoAnswer
 MuleInfoAnswer packet is the response to MuleInfo packet, and contains the exact same data as MuleInfo packet. More...
class  ReqFile
 ReqFile indicates that the sender wishes us to to upload the file to him. More...
class  FileName
 FileName is the expected response to ReqFile, and contains the hash, and the file name corresponding to that hash. More...
class  FileDesc
 FileDesc packet contains the rating and the comment of the file. More...
class  SetReqFileId
 SetReqFileId is the last request from the client, binding the requested file to the hash sent in this packet. More...
class  NoFile
 Answer to SetReqFileId packet, this indicates that we are not sharing the file currently. More...
class  FileStatus
 Finalizing the upload request sequence, this packet is sent by the uploading client to indicate that the file is ready to be uploaded. More...
class  ReqHashSet
 ReqHashSet packet is used to request a hashset from remote client. More...
class  HashSet
 HashSet packet is answer to ReqHashSet packet, and contains the hashset corresponding to the requested filehash. More...
class  StartUploadReq
 StartUploadReq finalizes the upload request sequence. More...
class  AcceptUploadReq
 Empty packet, indicating an accepted upload request (e.g. More...
class  QueueRanking
 Indicates the queue ranking of a queued client. More...
class  MuleQueueRank
 MuleQueueRank packet is different from QueueRanking packet only from implementation point of view. More...
class  ReqChunks
 Requests (up to) three parts, indicated by the three ranges. More...
class  DataChunk
 DataChunk packet indicates a single data chunk send from one client to another. More...
class  PackedChunk
 Emule extended packet, this contains packed data chunk. More...
class  CancelTransfer
 CancelTransfer packet indicates that the receiver of this packet should stop sending data. More...
class  SourceExchReq
 SourceExchReq packet is sent from one client to another in order to request all sources the remote client knows for a hash. More...
class  AnswerSources
 AnswerSources packet is the expected answer to SourceExchReq packet, and contains the list of sources corresponding to a file hash. More...
class  Message
 A text message sent from one client to another client. More...
class  ChangeId
 ChangeId packet indicates the sending client changed it's ID on the net from oldId to newId. More...
class  SecIdentState
 Initiate Secure Identification with remote client; requests the remote client to send us signature (and if needed) also publickey. More...
class  PublicKey
 PublicKey packet is the expected response to SecIdentState packet which requested PublicKey; it contains - the remote client's public key ofcourse. More...
class  Signature
 Signature packet is the expected response to SecIdentState packet which requested Signature; it contains - the remote client's signature ofcourse. More...
class  ReaskFilePing
 Used to ping sources every 20 minutes to verify that we are still queued for our requested file. More...
class  QueueFull
 QueueFull indicates that the remote client's queue is ... More...
class  ReaskAck
 ReaskAck is an expected response to ReaskFilePing packet, ant includes the remote queue ranking. More...
class  FileNotFound
 Indicates that the requested file (via last ReaskFilePing) was not found. More...
class  PortTest
 PortTest isn't exactly part of eDonkey2000 nor eMule extended protocol; it is instead used to verify correct firewall configurations, for example, by a website with an appropriate button. More...

Typedefs

typedef AnswerSources AnswerSources2
 This packet can occasionally be sent compressed, however our parser then resets the opcode to PR_ED2K (since compressed packets from Servers should be done so).

Functions

uint64_t getOverheadUp ()
uint64_t getOverheadDn ()
void addOverheadDn (uint32_t amount)
std::vector< bool > makePartMap (const PartData *pd)
 Generates chunk map, as specified by eDonkey2000 protocol.
void writePartMap (std::ostream &o, const std::vector< bool > &partMap)
void readPartMap (std::istream &i, std::vector< bool > *partMap)

Variables

boost::mt19937 getRandom
uint64_t s_overheadUpSize = 0
uint64_t s_overheadDnSize = 0

Detailed Description

ED2KPacket namespace contains all packet objects supported by the parser.

Typedef Documentation

typedef AnswerSources ED2KPacket::AnswerSources2
 

This packet can occasionally be sent compressed, however our parser then resets the opcode to PR_ED2K (since compressed packets from Servers should be done so).

However, in this case, the packet is supposed to be PR_EMULE instead, which leads to the problem, solved by this typedef and duplicate DECLARE_PACKET_FACTORY() macro in factories.h.

Definition at line 910 of file packets.h.


Function Documentation

uint64_t ED2KPacket::getOverheadUp  ) 
 

Definition at line 55 of file packets.cpp.

References s_overheadUpSize.

Referenced by ClientList::checkOpenMoreSlots().

uint64_t ED2KPacket::getOverheadDn  ) 
 

Definition at line 56 of file packets.cpp.

References s_overheadDnSize.

Referenced by ClientList::checkOpenMoreSlots().

void ED2KPacket::addOverheadDn uint32_t  amount  ) 
 

Definition at line 57 of file packets.cpp.

References s_overheadDnSize.

Referenced by ED2KParser< Parent >::readPacket().

std::vector<bool> makePartMap const PartData *  pd  ) 
 

Generates chunk map, as specified by eDonkey2000 protocol.

This means the vector is filled with bitfields, where each 'true' bit indicates we have the 9.28MB part, and each 'false' bit indicates we do not have that part. Empty partmap indicates the entire file is available. Leftover bits are padded with zeros.

Note that PartData API now supports this internally, so when possible, we attempt to aquire this data from PartData. However, if that fails, we still generate it ourselves here.

Definition at line 70 of file packets.cpp.

Referenced by ED2KPacket::FileStatus::FileStatus(), ED2KPacket::ReaskAck::ReaskAck(), ED2KPacket::ReaskFilePing::ReaskFilePing(), and ED2KPacket::ReqFile::ReqFile().

void writePartMap std::ostream &  o,
const std::vector< bool > &  partMap
 

Definition at line 90 of file packets.cpp.

Referenced by ED2KPacket::ReaskAck::operator std::string(), ED2KPacket::ReaskFilePing::operator std::string(), ED2KPacket::FileStatus::operator std::string(), and ED2KPacket::ReqFile::operator std::string().

void readPartMap std::istream &  i,
std::vector< bool > *  partMap
 

Definition at line 108 of file packets.cpp.

Referenced by ED2KPacket::FileStatus::FileStatus(), ED2KPacket::ReaskAck::ReaskAck(), ED2KPacket::ReaskFilePing::ReaskFilePing(), and ED2KPacket::ReqFile::ReqFile().


Variable Documentation

boost::mt19937 ED2KPacket::getRandom
 

Definition at line 51 of file packets.cpp.

Referenced by ED2KPacket::GlobStatReq::GlobStatReq(), and ED2KPacket::SecIdentState::SecIdentState().

uint64_t ED2KPacket::s_overheadUpSize = 0
 

Definition at line 53 of file packets.cpp.

Referenced by getOverheadUp(), and ED2KPacket::Packet::makePacket().

uint64_t ED2KPacket::s_overheadDnSize = 0
 

Definition at line 54 of file packets.cpp.

Referenced by addOverheadDn(), and getOverheadDn().