ED2KPacket::Packet Class Reference

Abstract base Packet class defines a virtual destructor, and few convenience methods for usage by derived classes. More...

#include <packets.h>

Inheritance diagram for ED2KPacket::Packet:

ED2KPacket::AcceptUploadReq ED2KPacket::AnswerSources ED2KPacket::CallbackReq ED2KPacket::CancelTransfer ED2KPacket::ChangeId ED2KPacket::DataChunk ED2KPacket::FileDesc ED2KPacket::FileName ED2KPacket::FileNotFound ED2KPacket::FileStatus ED2KPacket::FoundSources ED2KPacket::GetServerList ED2KPacket::GlobFoundSources ED2KPacket::GlobGetSources ED2KPacket::GlobStatReq ED2KPacket::GlobStatRes ED2KPacket::HashSet ED2KPacket::Hello ED2KPacket::IdChange ED2KPacket::LoginRequest ED2KPacket::Message ED2KPacket::MuleInfo ED2KPacket::MuleQueueRank ED2KPacket::NoFile ED2KPacket::OfferFiles ED2KPacket::PackedChunk ED2KPacket::PortTest ED2KPacket::PublicKey ED2KPacket::QueueFull ED2KPacket::QueueRanking ED2KPacket::ReaskAck ED2KPacket::ReaskFilePing ED2KPacket::ReqCallback ED2KPacket::ReqChunks ED2KPacket::ReqFile ED2KPacket::ReqHashSet ED2KPacket::ReqSources ED2KPacket::Search ED2KPacket::SearchResult ED2KPacket::SecIdentState ED2KPacket::ServerIdent ED2KPacket::ServerList ED2KPacket::ServerMessage ED2KPacket::ServerStatus ED2KPacket::SetReqFileId ED2KPacket::Signature ED2KPacket::SourceExchReq ED2KPacket::StartUploadReq List of all members.

Protected Member Functions

 Packet (uint8_t proto=PR_ED2K)
 The only allowed constructor.
virtual ~Packet ()=0
 Pure virtual destructor.
std::string makePacket (const std::string &data, bool hexDump=false)
 Makes packet, finalizing the packet generation.

Protected Attributes

uint8_t m_proto
 Keeps the protocol opcode passed to the constructor for later outputting (see makePacket method).

Detailed Description

Abstract base Packet class defines a virtual destructor, and few convenience methods for usage by derived classes.

This class is never used directly, instead one of the concrete derived classes are used.

Definition at line 101 of file packets.h.


Constructor & Destructor Documentation

ED2KPacket::Packet::Packet uint8_t  proto = PR_ED2K  )  [protected]
 

The only allowed constructor.

Parameters:
proto Protocol based on which to create the packet. currently supports PR_ED2K, PR_EMULE and PR_ZLIB

Definition at line 127 of file packets.cpp.

ED2KPacket::Packet::~Packet  )  [protected, pure virtual]
 

Pure virtual destructor.

Definition at line 128 of file packets.cpp.


Member Function Documentation

std::string ED2KPacket::Packet::makePacket const std::string &  data,
bool  hexDump = false
[protected]
 

Makes packet, finalizing the packet generation.

This function writes the packet header, and (optionally) compresses the packet data if m_proto == PR_ZLIB

Parameters:
data Data to make packet of. Assumes data[0] is opcode
hexDump If set to true, the packet data is printed to stdout
Returns:
Packet ready for sending to target

Definition at line 143 of file packets.cpp.

References COL_COMP, COL_SEND, Zlib::compress(), Zlib::decompress(), m_proto, OP_PACKEDCHUNK, OP_SENDINGCHUNK, PR_ED2K, PR_ZLIB, and ED2KPacket::s_overheadUpSize.

Referenced by ED2KPacket::Signature::operator std::string(), ED2KPacket::PublicKey::operator std::string(), ED2KPacket::SecIdentState::operator std::string(), ED2KPacket::ChangeId::operator std::string(), ED2KPacket::Message::operator std::string(), ED2KPacket::AnswerSources::operator std::string(), ED2KPacket::SourceExchReq::operator std::string(), ED2KPacket::CancelTransfer::operator std::string(), ED2KPacket::PackedChunk::operator std::string(), ED2KPacket::DataChunk::operator std::string(), ED2KPacket::ReqChunks::operator std::string(), ED2KPacket::MuleQueueRank::operator std::string(), ED2KPacket::QueueRanking::operator std::string(), ED2KPacket::AcceptUploadReq::operator std::string(), ED2KPacket::StartUploadReq::operator std::string(), ED2KPacket::HashSet::operator std::string(), ED2KPacket::ReqHashSet::operator std::string(), ED2KPacket::FileStatus::operator std::string(), ED2KPacket::NoFile::operator std::string(), ED2KPacket::SetReqFileId::operator std::string(), ED2KPacket::FileDesc::operator std::string(), ED2KPacket::FileName::operator std::string(), ED2KPacket::ReqFile::operator std::string(), ED2KPacket::MuleInfo::operator std::string(), ED2KPacket::ReqSources::operator std::string(), ED2KPacket::ReqCallback::operator std::string(), ED2KPacket::Search::operator std::string(), ED2KPacket::OfferFiles::operator std::string(), ED2KPacket::GetServerList::operator std::string(), ED2KPacket::LoginRequest::operator std::string(), and ED2KPacket::Hello::save().


Member Data Documentation

uint8_t ED2KPacket::Packet::m_proto [protected]
 

Keeps the protocol opcode passed to the constructor for later outputting (see makePacket method).

Definition at line 118 of file packets.h.

Referenced by makePacket().


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