ArNetPacket Class Reference

#include <ArNetPacket.h>

Inheritance diagram for ArNetPacket:

ArBasePacket ArNetCameraRequest List of all members.

Detailed Description

our packet for the network stuff
Examples:

drawingsExample.cpp, drawingsExampleWithRobot.cpp, getVideoExample.cpp, and ptzCameraClientExample.cpp.


Public Types

enum  {
  SIZE_OF_LENGTH = 2, MAX_LENGTH = 32000, HEADER_LENGTH = 6, FOOTER_LENGTH = 2,
  MAX_DATA_LENGTH = MAX_LENGTH - HEADER_LENGTH - FOOTER_LENGTH - SIZE_OF_LENGTH
}
 FOOTER_LENGTH = 2
 Byset of packet data used for footer.
 HEADER_LENGTH = 6
 Bytes of packet data used for header.
 MAX_DATA_LENGTH = MAX_LENGTH - HEADER_LENGTH - FOOTER_LENGTH - SIZE_OF_LENGTH
 Suggested maximum size for data payload (this is the total suggested packet size minus headers and footers).
 MAX_LENGTH = 32000
 Suggested maximum total size of a packet (bytes).
enum  PacketSource { TCP, UDP }
 an enum for where the packet came from More...
 SIZE_OF_LENGTH = 2
 Number of bytes needed to store packet length value.
 TCP
 Came in over tcp.
 UDP
 Came in over udp.

Public Member Functions

 ArNetPacket (const ArNetPacket &other)
 Copy constructor.
 ArNetPacket (ArTypes::UByte2 bufferSize=ArNetPacket::MAX_LENGTH+5)
 Constructor.
virtual double bufToDouble (void)
 Gets a double from the packet buffer.
ArTypes::Byte2 calcCheckSum (void)
 returns the checksum, probably used only internally
virtual void doubleToBuf (double val)
 Puts a double into the packet buffer.
virtual void duplicatePacket (ArNetPacket *packet)
virtual void empty (void)
virtual void finalizePacket (void)
bool getAddedFooter (void)
 Iternal function that sets if we already added the footer(for forwarding).
const char * getArbitraryString (void)
ArTypes::UByte2 getCommand (void)
 Gets the command this packet is.
PacketSource getPacketSource (void)
ArNetPacketoperator= (const ArNetPacket &other)
 Assignment operator.
virtual void resetRead (void)
void setAddedFooter (bool addedFooter)
 Iternal function that sets if we already added the footer(for forwarding).
void setArbitraryString (const char *string)
void setCommand (ArTypes::UByte2 command)
 Sets the command this packet is.
void setPacketSource (PacketSource source)
bool verifyCheckSum (void)
 returns true if the checksum matches what it should be
virtual ~ArNetPacket ()
 Destructor.

Protected Attributes

bool myAddedFooter
std::string myArbitraryString
ArTypes::UByte2 myCommand
PacketSource myPacketSource


Member Enumeration Documentation

anonymous enum

Enumerator:
SIZE_OF_LENGTH  Number of bytes needed to store packet length value.
MAX_LENGTH  Suggested maximum total size of a packet (bytes).
HEADER_LENGTH  Bytes of packet data used for header.
FOOTER_LENGTH  Byset of packet data used for footer.
MAX_DATA_LENGTH  Suggested maximum size for data payload (this is the total suggested packet size minus headers and footers).

enum ArNetPacket::PacketSource

an enum for where the packet came from

Enumerator:
TCP  Came in over tcp.
UDP  Came in over udp.


Constructor & Destructor Documentation

ArNetPacket::ArNetPacket ( ArTypes::UByte2  bufferSize = ArNetPacket::MAX_LENGTH+5  ) 

Constructor.

ArNetPacket::ArNetPacket ( const ArNetPacket other  ) 

Copy constructor.

ArNetPacket::~ArNetPacket (  )  [virtual]

Destructor.


Member Function Documentation

double ArNetPacket::bufToDouble ( void   )  [virtual]

Gets a double from the packet buffer.

ArTypes::Byte2 ArNetPacket::calcCheckSum ( void   ) 

returns the checksum, probably used only internally

void ArNetPacket::doubleToBuf ( double  val  )  [virtual]

Puts a double into the packet buffer.

void ArNetPacket::duplicatePacket ( ArNetPacket packet  )  [virtual]

void ArNetPacket::empty ( void   )  [virtual]

Reimplemented from ArBasePacket.

Examples:
ptzCameraClientExample.cpp.

void ArNetPacket::finalizePacket ( void   )  [virtual]

Reimplemented from ArBasePacket.

Examples:
ptzCameraClientExample.cpp.

bool ArNetPacket::getAddedFooter ( void   )  [inline]

Iternal function that sets if we already added the footer(for forwarding).

const char* ArNetPacket::getArbitraryString ( void   )  [inline]

ArTypes::UByte2 ArNetPacket::getCommand ( void   ) 

Gets the command this packet is.

PacketSource ArNetPacket::getPacketSource ( void   )  [inline]

ArNetPacket & ArNetPacket::operator= ( const ArNetPacket other  ) 

Assignment operator.

void ArNetPacket::resetRead ( void   )  [virtual]

Reimplemented from ArBasePacket.

void ArNetPacket::setAddedFooter ( bool  addedFooter  )  [inline]

Iternal function that sets if we already added the footer(for forwarding).

void ArNetPacket::setArbitraryString ( const char *  string  )  [inline]

void ArNetPacket::setCommand ( ArTypes::UByte2  command  ) 

Sets the command this packet is.

void ArNetPacket::setPacketSource ( PacketSource  source  )  [inline]

bool ArNetPacket::verifyCheckSum ( void   ) 

returns true if the checksum matches what it should be


Member Data Documentation

bool ArNetPacket::myAddedFooter [protected]

std::string ArNetPacket::myArbitraryString [protected]

ArTypes::UByte2 ArNetPacket::myCommand [protected]

PacketSource ArNetPacket::myPacketSource [protected]


The documentation for this class was generated from the following files:
Generated on Fri Jul 31 12:37:29 2009 for ArNetworking by  doxygen 1.4.7