forest-net
an overlay networks for large-scale virtual worlds
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator
forest::Packet Class Reference

Class that defines fields in Forest packets. More...

#include <Packet.h>

Public Member Functions

bool unpack ()
 Unpack the packet from the buffer. More...
 
bool pack ()
 Pack the packet into the buffer. More...
 
uint32_t * payload () const
 
bool hdrErrCheck () const
 buffer error checking More...
 
bool payErrCheck () const
 Verify the payload error check. More...
 
void hdrErrUpdate ()
 Update the header error check based on buffer contents. More...
 
void payErrUpdate ()
 Update the payload error check based on buffer contents. More...
 
bool read (istream &)
 input/output More...
 
string toString () const
 Create a string representing packet contents. More...
 

Static Public Member Functions

static string pktTyp2string (Forest::ptyp_t)
 
static bool string2pktTyp (string &, Forest::ptyp_t &)
 

Public Attributes

int version
 version number field
 
int length
 length field
 
Forest::ptyp_t type
 packet type field
 
flgs_t flags
 flags
 
comt_t comtree
 comtree field
 
fAdr_t srcAdr
 source address
 
fAdr_t dstAdr
 destination address
 
int inLink
 link on which packet arrived
 
int outLink
 outgoing link for packet
 
ipa_t tunIp
 peer IP addr from substrate header
 
ipp_t tunPort
 peer port # from substrate header
 
int64_t rcvSeqNum
 used by router to identify packets
 
int bufferLen
 number of valid bytes in buffer
 
buffer_t * buffer
 pointer to packet buffer
 

Static Public Attributes

static int const HDRLEN = 5*sizeof(uint32_t)
 
static int const OVERHEAD = HDRLEN + sizeof(uint32_t)
 

Detailed Description

Class that defines fields in Forest packets.

Note, packet fields and buffer are directly accessible. Use with care.

Definition at line 20 of file Packet.h.

Member Function Documentation

bool forest::Packet::hdrErrCheck ( ) const

buffer error checking

Verify the header error check.

Returns
true on success

Definition at line 59 of file Packet.cpp.

Here is the caller graph for this function:

void forest::Packet::hdrErrUpdate ( )

Update the header error check based on buffer contents.

Returns
true on success

Definition at line 73 of file Packet.cpp.

Here is the caller graph for this function:

bool forest::Packet::pack ( )

Pack the packet into the buffer.

Returns
true on success

Definition at line 42 of file Packet.cpp.

Here is the caller graph for this function:

bool forest::Packet::payErrCheck ( ) const

Verify the payload error check.

Returns
true on success

Definition at line 66 of file Packet.cpp.

void forest::Packet::payErrUpdate ( )

Update the payload error check based on buffer contents.

Returns
true on success

Definition at line 79 of file Packet.cpp.

Here is the caller graph for this function:

bool forest::Packet::read ( istream &  )

input/output

Read an input packet and pack fields into buffer.

Returns
true on success

Definition at line 85 of file Packet.cpp.

Here is the call graph for this function:

string forest::Packet::toString ( ) const

Create a string representing packet contents.

Parameters
bis a reference to a buffer containing the packet
Returns
the string

Definition at line 152 of file Packet.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::Packet::unpack ( )

Unpack the packet from the buffer.

Returns
true on success

Definition at line 23 of file Packet.cpp.

Here is the caller graph for this function:


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