DESERT 4.0.0
packerMAC Class Reference

#include <packer-mac.h>

Inheritance diagram for packerMAC:
Inheritance graph
Collaboration diagram for packerMAC:
Collaboration graph

Public Member Functions

 packerMAC ()
 
 ~packerMAC ()
 
- 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 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 Ftype_Bits
 
size_t SRC_Bits
 
size_t DST_Bits
 
size_t Htype_Bits
 
size_t TXtime_Bits
 
size_t SStime_Bits
 
size_t Padding_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.

Constructor & Destructor Documentation

◆ packerMAC()

packerMAC::packerMAC ( )

◆ ~packerMAC()

packerMAC::~packerMAC ( )

Class destructor.

Member Function Documentation

◆ init()

void packerMAC::init ( )
privatevirtual

Init the Packer

Reimplemented from packer.

References packer::debug_, DST_Bits, Ftype_Bits, Htype_Bits, packer::n_bits, Padding_Bits, SRC_Bits, SStime_Bits, and TXtime_Bits.

◆ packMyHdr()

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

Method to transform the headers of Uwpolling 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.

References packer::debug_, packer::n_bits, printMyHdrFields(), and packer::put().

Here is the call graph for this function:

◆ printMyHdrFields()

void packerMAC::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.

References packer::hex_bytes(), and packer::n_bits.

Referenced by packMyHdr(), and unpackMyHdr().

Here is the call graph for this function:

◆ printMyHdrMap()

void packerMAC::printMyHdrMap ( )
privatevirtual

Method used for debug purposes. It prints the number of bits for each header serialized

Reimplemented from packer.

References DST_Bits, Ftype_Bits, Htype_Bits, Padding_Bits, SRC_Bits, SStime_Bits, and TXtime_Bits.

◆ unpackMyHdr()

size_t packerMAC::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.

References packer::debug_, packer::get(), packer::n_bits, printMyHdrFields(), and packer::restoreSignedValue().

Here is the call graph for this function:

Member Data Documentation

◆ DST_Bits

size_t packerMAC::DST_Bits
private

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

Referenced by init(), packerMAC(), and printMyHdrMap().

◆ Ftype_Bits

size_t packerMAC::Ftype_Bits
private

Referenced by init(), packerMAC(), and printMyHdrMap().

◆ Htype_Bits

size_t packerMAC::Htype_Bits
private

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

Referenced by init(), packerMAC(), and printMyHdrMap().

◆ Padding_Bits

size_t packerMAC::Padding_Bits
private

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

Referenced by init(), packerMAC(), and printMyHdrMap().

◆ SRC_Bits

size_t packerMAC::SRC_Bits
private

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

Referenced by init(), packerMAC(), and printMyHdrMap().

◆ SStime_Bits

size_t packerMAC::SStime_Bits
private

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

Referenced by init(), packerMAC(), and printMyHdrMap().

◆ TXtime_Bits

size_t packerMAC::TXtime_Bits
private

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

Referenced by init(), packerMAC(), and printMyHdrMap().


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