DESERT 3.5.1
Loading...
Searching...
No Matches
packerCOMMON Class Reference

#include <packer-common.h>

Inheritance diagram for packerCOMMON:
Collaboration diagram for packerCOMMON:

Public Member Functions

 packerCOMMON ()
 
 ~packerCOMMON ()
 
- Public Member Functions inherited from packer
 packer (bool)
 
 ~packer ()
 
int command (int, const char *const *)
 
size_t getPayloadBytesLength ()
 
size_t getHdrBytesLength ()
 
size_t getPayloadBinLength ()
 
size_t getHdrBinLength ()
 
std::string packPayload (Packet *)
 
std::string packHdr (Packet *)
 
Packet * unpackPayload (Packet *)
 
Packet * unpackHdr (Packet *)
 
void printMap ()
 

Private Types

enum  nbits_index {
  PTYPE = 0 , SIZE , UID , ERROR ,
  TIMESTAMP , DIRECTION , PREV_HOP , NEXT_HOP ,
  ADDR_TYPE , LAST_HOP , TXTIME , errbitcnt_ ,
  fecsize_ , iface_ , src_rt_valid , ts_arr_ ,
  aomdv_salvage_count_ , xmit_failure_ , xmit_failure_data_ , xmit_reason_ ,
  num_forwards_ , opt_num_forwards_
}
 

Private Member Functions

void init ()
 
size_t packMyHdr (Packet *, unsigned char *, size_t)
 
size_t unpackMyHdr (unsigned char *, size_t, Packet *)
 
void printMyHdrMap ()
 
void printMyHdrFields (Packet *)
 

Private Attributes

size_t PTYPE_Bits
 
size_t SIZE_Bits
 
size_t UID_Bits
 
size_t ERROR_Bits
 
size_t TIMESTAMP_Bits
 
size_t DIRECTION_Bits
 
size_t PREV_HOP_Bits
 
size_t NEXT_HOP_Bits
 
size_t ADDR_TYPE_Bits
 
size_t LAST_HOP_Bits
 
size_t TXTIME_Bits
 
size_t errbitcnt_Bits
 
size_t fecsize_Bits
 
size_t iface_Bits
 
size_t src_rt_valid_Bits
 
size_t ts_arr_Bits
 
size_t aomdv_salvage_count_Bits
 
size_t xmit_failure_Bits
 
size_t xmit_failure_data_Bits
 
size_t xmit_reason_Bits
 
size_t num_forwards_Bits
 
size_t opt_num_forwards_Bits
 

Additional Inherited Members

- Static Public Member Functions inherited from packer
template<typename T >
static T restoreSignedValue (T _header_field, const uint32_t &_num_compressed_bits)
 
static std::string hexdump_nice (std::string)
 
static std::string hexdump_nice (const char *, size_t)
 
static std::string hexdump (std::string)
 
static std::string hex_bytes (float)
 
static std::string hex_bytes (double)
 
static std::string hex_bytes (const char &, const uint32_t &)
 
static std::string hex_bytes (const int8_t &, const uint32_t &)
 
static std::string hex_bytes (const int16_t &, const uint32_t &)
 
static std::string hex_bytes (const int32_t &, const uint32_t &)
 
static std::string hex_bytes (const int64_t &, const uint32_t &)
 
static std::string hex_bytes (const uint8_t &, const uint32_t &)
 
static std::string hex_bytes (const uint16_t &, const uint32_t &)
 
static std::string hex_bytes (const uint32_t &, const uint32_t &)
 
static std::string hex_bytes (const uint64_t &, const uint32_t &)
 
static std::string hexdump (const char *, size_t)
 
static std::string bindump (std::string)
 
static std::string bindump (const char *, size_t)
 
- Protected Member Functions inherited from packer
virtual void printMyHdrField (Packet *, int)
 
size_t getMyHdrBinLength ()
 
size_t get (unsigned char *buffer, size_t offset, void *val, size_t h)
 
size_t put (unsigned char *buffer, size_t offset, void *val, size_t h)
 
- Protected Attributes inherited from packer
std::vector< size_t > n_bits
 
int debug_
 

Detailed Description

Class to map a ns2 mac header into a bit stream, and vice-versa.

Definition at line 52 of file packer-common.h.

Member Enumeration Documentation

◆ nbits_index

Enumerator
PTYPE 
SIZE 
UID 
ERROR 
TIMESTAMP 
DIRECTION 
PREV_HOP 
NEXT_HOP 
ADDR_TYPE 
LAST_HOP 
TXTIME 
errbitcnt_ 
fecsize_ 
iface_ 
src_rt_valid 
ts_arr_ 
aomdv_salvage_count_ 
xmit_failure_ 
xmit_failure_data_ 
xmit_reason_ 
num_forwards_ 
opt_num_forwards_ 

Definition at line 68 of file packer-common.h.

Constructor & Destructor Documentation

◆ packerCOMMON()

packerCOMMON::packerCOMMON ( )

Class constructor.

Definition at line 60 of file packer-common.cpp.

◆ ~packerCOMMON()

packerCOMMON::~packerCOMMON ( )

Class destructor.

Definition at line 145 of file packer-common.cpp.

Member Function Documentation

◆ init()

void packerCOMMON::init ( )
privatevirtual

Init the Packer.

Reimplemented from packer.

Definition at line 150 of file packer-common.cpp.

◆ packMyHdr()

size_t packerCOMMON::packMyHdr ( Packet *  p,
unsigned char *  buf,
size_t  offset 
)
privatevirtual

Method to transform the headers into a stream of bits.

Parameters
Pointerto the packet to serialize
Pointerto the buffer
Offsetfrom the begin of the buffer
Returns
New offset after packing the headers of the packets

Reimplemented from packer.

Definition at line 185 of file packer-common.cpp.

◆ printMyHdrFields()

void packerCOMMON::printMyHdrFields ( Packet *  p)
privatevirtual

Method used for debug purposes.

It prints the value of the headers of a packet

Parameters
Pointerof the packet

Reimplemented from packer.

Definition at line 454 of file packer-common.cpp.

◆ printMyHdrMap()

void packerCOMMON::printMyHdrMap ( )
privatevirtual

Method used for debug purposes.

It prints the number of bits for each header serialized

Reimplemented from packer.

Definition at line 375 of file packer-common.cpp.

◆ unpackMyHdr()

size_t packerCOMMON::unpackMyHdr ( unsigned char *  buf,
size_t  offset,
Packet *  p 
)
privatevirtual

Method responsible to take the informations from the received buffer and store it into the headers of the packet.

Parameters
Pointerto the buffer received
Offsetfrom the begin of the buffer
Pointerto the new packet
Returns
New offset after unpacking the headers

Reimplemented from packer.

Definition at line 251 of file packer-common.cpp.

Member Data Documentation

◆ ADDR_TYPE_Bits

size_t packerCOMMON::ADDR_TYPE_Bits
private

Bit length of the next_hop_ field to be put in the header stream of bits.

Definition at line 144 of file packer-common.h.

◆ aomdv_salvage_count_Bits

size_t packerCOMMON::aomdv_salvage_count_Bits
private

Bit length of the ts_arr_ field to be put in the header stream of bits.

Definition at line 163 of file packer-common.h.

◆ DIRECTION_Bits

size_t packerCOMMON::DIRECTION_Bits
private

Bit length of the ts_ field to be put in the header stream of bits.

Definition at line 136 of file packer-common.h.

◆ errbitcnt_Bits

size_t packerCOMMON::errbitcnt_Bits
private

Bit length of the txtime_ field to be put in the header stream of bits.

Definition at line 153 of file packer-common.h.

◆ ERROR_Bits

size_t packerCOMMON::ERROR_Bits
private

Bit length of the uid_ field to be put in the header stream of bits.

Definition at line 132 of file packer-common.h.

◆ fecsize_Bits

size_t packerCOMMON::fecsize_Bits
private

Bit length of the errbitcnt_ field to be put in the header stream of bits.

Definition at line 155 of file packer-common.h.

◆ iface_Bits

size_t packerCOMMON::iface_Bits
private

Bit length of the fecsize_ field to be put in the header stream of bits.

Definition at line 157 of file packer-common.h.

◆ LAST_HOP_Bits

size_t packerCOMMON::LAST_HOP_Bits
private

Bit length of the addr_type_ field to be put in the header stream of bits.

Definition at line 147 of file packer-common.h.

◆ NEXT_HOP_Bits

size_t packerCOMMON::NEXT_HOP_Bits
private

Bit length of the prev_hop_ field to be put in the header stream of bits.

Definition at line 142 of file packer-common.h.

◆ num_forwards_Bits

size_t packerCOMMON::num_forwards_Bits
private

Bit length of the xmit_reason_ field to be put in the header stream of bits.

Definition at line 173 of file packer-common.h.

◆ opt_num_forwards_Bits

size_t packerCOMMON::opt_num_forwards_Bits
private

Bit length of the num_forwards_ field to be put in the header stream of bits.

Definition at line 175 of file packer-common.h.

◆ PREV_HOP_Bits

size_t packerCOMMON::PREV_HOP_Bits
private

Bit length of the direction_ field to be put in the header stream of bits.

Definition at line 139 of file packer-common.h.

◆ PTYPE_Bits

size_t packerCOMMON::PTYPE_Bits
private

Definition at line 126 of file packer-common.h.

◆ SIZE_Bits

size_t packerCOMMON::SIZE_Bits
private

Bit length of the ptype_ field to be put in the header stream of bits.

Definition at line 128 of file packer-common.h.

◆ src_rt_valid_Bits

size_t packerCOMMON::src_rt_valid_Bits
private

Bit length of the iface_ field to be put in the header stream of bits.

Definition at line 159 of file packer-common.h.

◆ TIMESTAMP_Bits

size_t packerCOMMON::TIMESTAMP_Bits
private

Bit length of the error_ field to be put in the header stream of bits.

Definition at line 134 of file packer-common.h.

◆ ts_arr_Bits

size_t packerCOMMON::ts_arr_Bits
private

Bit length of the src_rt_valid_ field to be put in the header stream of bits.

Definition at line 161 of file packer-common.h.

◆ TXTIME_Bits

size_t packerCOMMON::TXTIME_Bits
private

Bit length of the last_hop_ field to be put in the header stream of bits.

Definition at line 149 of file packer-common.h.

◆ UID_Bits

size_t packerCOMMON::UID_Bits
private

Bit length of the size_ field to be put in the header stream of bits.

Definition at line 130 of file packer-common.h.

◆ xmit_failure_Bits

size_t packerCOMMON::xmit_failure_Bits
private

Bit length of the aomdv_salvage_count_ field to be put in the header stream of bits.

Definition at line 166 of file packer-common.h.

◆ xmit_failure_data_Bits

size_t packerCOMMON::xmit_failure_data_Bits
private

Bit length of the xmit_failure_ field to be put in the header stream of bits.

Definition at line 168 of file packer-common.h.

◆ xmit_reason_Bits

size_t packerCOMMON::xmit_reason_Bits
private

Bit length of the xmit_failure_data_ field to be put in the header stream of bits.

Definition at line 171 of file packer-common.h.


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