DESERT 4.0.0
packer_uwApplication Class Reference

#include <packer_uwApplication.h>

Inheritance diagram for packer_uwApplication:
Inheritance graph
Collaboration diagram for packer_uwApplication:
Collaboration graph

Public Member Functions

 packer_uwApplication ()
 
 ~packer_uwApplication ()
 
- 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 {
  SN_FIELD = 0 , RFFT_FIELD , RFFTVALID_FIELD , PRIORITY_FIELD ,
  PAYLOAD_SIZE_FIELD
}
 

Private Member Functions

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

Private Attributes

size_t sn_field_Bits
 
size_t rfft_field_Bits
 
size_t rfftvalid_field_Bits
 
size_t priority_filed_Bits
 
size_t payload_size_field_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.

Member Enumeration Documentation

◆ nbits_index

Enumerator
SN_FIELD 

Serial number of the packet.

RFFT_FIELD 

Forward Trip Time of the packet.

RFFTVALID_FIELD 

Flag used to set the validity of the fft field.

PRIORITY_FIELD 

Priority flag: 1 means high priority, 0 normal priority.

PAYLOAD_SIZE_FIELD 

Message payload

Constructor & Destructor Documentation

◆ packer_uwApplication()

packer_uwApplication::packer_uwApplication ( )

Constructor packer_uwApplication class

References init(), payload_size_field_Bits, priority_filed_Bits, rfft_field_Bits, rfftvalid_field_Bits, and sn_field_Bits.

Here is the call graph for this function:

◆ ~packer_uwApplication()

packer_uwApplication::~packer_uwApplication ( )

Destructor packer_uwApplication class

Member Function Documentation

◆ init()

void packer_uwApplication::init ( )
privatevirtual

◆ packMyHdr()

size_t packer_uwApplication::packMyHdr ( Packet *  p,
unsigned char *  buffer,
size_t  offset 
)
privatevirtual

Method to transform the headers of uwApplication protocol into a stream of bits

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

Reimplemented from packer.

References packer::debug_, packer::n_bits, hdr_DATA_APPLICATION::payload_msg, hdr_DATA_APPLICATION::payload_size(), hdr_DATA_APPLICATION::payload_size_, PAYLOAD_SIZE_FIELD, printMyHdrFields(), hdr_DATA_APPLICATION::priority_, PRIORITY_FIELD, PT_DATA_APPLICATION, packer::put(), RFFT_FIELD, RFFTVALID_FIELD, hdr_DATA_APPLICATION::rftt_, hdr_DATA_APPLICATION::rftt_valid_, hdr_DATA_APPLICATION::sn_, and SN_FIELD.

Here is the call graph for this function:

◆ printMyHdrFields()

void packer_uwApplication::printMyHdrFields ( Packet *  p)
privatevirtual

Method used for debug purposes. It prints the value of the headers of a packet

Parameters
Pointerof the packet Index bits

Reimplemented from packer.

References hdr_DATA_APPLICATION::payload_msg, hdr_DATA_APPLICATION::payload_size(), hdr_DATA_APPLICATION::payload_size_, hdr_DATA_APPLICATION::priority_, PT_DATA_APPLICATION, hdr_DATA_APPLICATION::rftt_, hdr_DATA_APPLICATION::rftt_valid_, and hdr_DATA_APPLICATION::sn_.

Referenced by packMyHdr(), and unpackMyHdr().

Here is the call graph for this function:

◆ printMyHdrMap()

void packer_uwApplication::printMyHdrMap ( )
privatevirtual

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

Reimplemented from packer.

References packer::n_bits, PAYLOAD_SIZE_FIELD, PRIORITY_FIELD, RFFT_FIELD, RFFTVALID_FIELD, and SN_FIELD.

◆ unpackMyHdr()

size_t packer_uwApplication::unpackMyHdr ( unsigned char *  buffer,
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
size_t New offset after unpacking the headers

Reimplemented from packer.

References packer::debug_, packer::get(), packer::n_bits, hdr_DATA_APPLICATION::payload_msg, hdr_DATA_APPLICATION::payload_size(), hdr_DATA_APPLICATION::payload_size_, PAYLOAD_SIZE_FIELD, printMyHdrFields(), hdr_DATA_APPLICATION::priority_, PRIORITY_FIELD, PT_DATA_APPLICATION, RFFT_FIELD, RFFTVALID_FIELD, hdr_DATA_APPLICATION::rftt_, hdr_DATA_APPLICATION::rftt_valid_, hdr_DATA_APPLICATION::sn_, and SN_FIELD.

Here is the call graph for this function:

Member Data Documentation

◆ payload_size_field_Bits

size_t packer_uwApplication::payload_size_field_Bits
private

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

Referenced by init(), and packer_uwApplication().

◆ priority_filed_Bits

size_t packer_uwApplication::priority_filed_Bits
private

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

Referenced by init(), and packer_uwApplication().

◆ rfft_field_Bits

size_t packer_uwApplication::rfft_field_Bits
private

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

Referenced by init(), and packer_uwApplication().

◆ rfftvalid_field_Bits

size_t packer_uwApplication::rfftvalid_field_Bits
private

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

Referenced by init(), and packer_uwApplication().

◆ sn_field_Bits

size_t packer_uwApplication::sn_field_Bits
private

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

Referenced by init(), and packer_uwApplication().


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