Orxonox  0.0.5 Codename: Arcturus
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | Static Private Attributes | List of all members
orxonox::packet::Packet Class Referenceabstract

#include </home/jenkins/workspace/orxonox_doxygen_trunk/src/libraries/network/packet/Packet.h>

Inheritance diagram for orxonox::packet::Packet:
orxonox::packet::Acknowledgement orxonox::packet::Chat orxonox::packet::ClassID orxonox::packet::DeleteObjects orxonox::packet::FunctionCalls orxonox::packet::FunctionIDs orxonox::packet::Gamestate orxonox::packet::Welcome

Public Member Functions

 Packet (const Packet &p)
 
virtual ~Packet ()
 Destroys a packet completely. More...
 
virtual unsigned char * getData ()
 
uint32_t getFlags ()
 
int getPeerID ()
 
uint32_t getRequiredGamestateID ()
 
virtual unsigned int getSize () const =0
 
bool isReliable ()
 
virtual bool process (orxonox::Host *host)=0
 
virtual bool send (orxonox::Host *host)
 Send the Packet. More...
 
void setPeerID (int id)
 

Static Public Member Functions

static PacketcreatePacket (ENetPacket *packet, uint32_t peerID)
 Given an ENetPacket, create an Orxonox packet. More...
 
static void deletePacket (ENetPacket *packet)
 ENet calls this method whenever it wants to destroy a packet that contains data we allocated ourselves. More...
 

Protected Member Functions

 Packet ()
 
 Packet (uint8_t *data, unsigned int peerID)
 
bool isDataENetAllocated () const
 

Protected Attributes

bool bDataENetAllocated_
 Tells whether data_ was allocated by ENet or ourselves. More...
 
uint8_t * data_
 Pointer to the data. More...
 
uint32_t flags_
 
Direction packetDirection_
 
unsigned int peerID_
 
uint32_t requiredGamestateID_
 

Private Attributes

ENetPacketenetPacket_
 

Static Private Attributes

static std::map< size_t, Packet * > packetMap_
 
static boost::mutex packetMapMutex_
 

Detailed Description

Author
Oliver Scheuss <scheusso [at] ee.ethz.ch>

Constructor & Destructor Documentation

orxonox::packet::Packet::Packet ( const Packet p)
orxonox::packet::Packet::~Packet ( )
virtual

Destroys a packet completely.

That also means destroying the ENetPacket if one exists. There

orxonox::packet::Packet::Packet ( )
protected
orxonox::packet::Packet::Packet ( uint8_t *  data,
unsigned int  peerID 
)
protected

Member Function Documentation

Packet * orxonox::packet::Packet::createPacket ( ENetPacket packet,
uint32_t  peerID 
)
static

Given an ENetPacket, create an Orxonox packet.

Parameters
packetThe ENetPacket
peerIDThe sender
void orxonox::packet::Packet::deletePacket ( ENetPacket packet)
static

ENet calls this method whenever it wants to destroy a packet that contains data we allocated ourselves.

virtual unsigned char* orxonox::packet::Packet::getData ( )
inlinevirtual

Reimplemented in orxonox::packet::Welcome.

uint32_t orxonox::packet::Packet::getFlags ( )
inline
int orxonox::packet::Packet::getPeerID ( )
inline
uint32_t orxonox::packet::Packet::getRequiredGamestateID ( )
inline
virtual unsigned int orxonox::packet::Packet::getSize ( ) const
pure virtual
bool orxonox::packet::Packet::isDataENetAllocated ( ) const
inlineprotected
bool orxonox::packet::Packet::isReliable ( )
inline
virtual bool orxonox::packet::Packet::process ( orxonox::Host host)
pure virtual
bool orxonox::packet::Packet::send ( orxonox::Host host)
virtual

Send the Packet.

Parameters
hostThe host which sends the packet

Reimplemented in orxonox::packet::FunctionCalls.

void orxonox::packet::Packet::setPeerID ( int  id)
inline

Member Data Documentation

bool orxonox::packet::Packet::bDataENetAllocated_
protected

Tells whether data_ was allocated by ENet or ourselves.

data_ might no correlate with enetPacket_->data.

uint8_t* orxonox::packet::Packet::data_
protected

Pointer to the data.

Be careful when deleting it because it might point to a location that was allocated by ENet. See bDataENetAllocated_

ENetPacket* orxonox::packet::Packet::enetPacket_
private
uint32_t orxonox::packet::Packet::flags_
protected
Direction orxonox::packet::Packet::packetDirection_
protected
std::map< size_t, Packet * > orxonox::packet::Packet::packetMap_
staticprivate
boost::mutex orxonox::packet::Packet::packetMapMutex_
staticprivate
unsigned int orxonox::packet::Packet::peerID_
protected
uint32_t orxonox::packet::Packet::requiredGamestateID_
protected

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