|
DESERT 4.0.0
|
#include <packer-common.h>


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_ |
Class to map a ns2 mac header into a bit stream, and vice-versa.
|
private |
| packerCOMMON::packerCOMMON | ( | ) |
Class constructor.
References ADDR_TYPE, ADDR_TYPE_Bits, aomdv_salvage_count_, aomdv_salvage_count_Bits, packer::debug_, DIRECTION, DIRECTION_Bits, errbitcnt_, errbitcnt_Bits, ERROR, ERROR_Bits, fecsize_, fecsize_Bits, iface_, iface_Bits, LAST_HOP, LAST_HOP_Bits, packer::n_bits, NEXT_HOP, NEXT_HOP_Bits, num_forwards_, num_forwards_Bits, opt_num_forwards_, opt_num_forwards_Bits, PREV_HOP, PREV_HOP_Bits, PTYPE, PTYPE_Bits, SIZE, SIZE_Bits, src_rt_valid, src_rt_valid_Bits, TIMESTAMP, TIMESTAMP_Bits, ts_arr_, ts_arr_Bits, TXTIME, TXTIME_Bits, UID, UID_Bits, xmit_failure_, xmit_failure_Bits, xmit_failure_data_, xmit_failure_data_Bits, xmit_reason_, and xmit_reason_Bits.
| packerCOMMON::~packerCOMMON | ( | ) |
Class destructor.
|
privatevirtual |
Init the Packer
Reimplemented from packer.
References ADDR_TYPE, ADDR_TYPE_Bits, aomdv_salvage_count_, aomdv_salvage_count_Bits, packer::debug_, DIRECTION, DIRECTION_Bits, errbitcnt_, errbitcnt_Bits, ERROR, ERROR_Bits, fecsize_, fecsize_Bits, iface_, iface_Bits, LAST_HOP, LAST_HOP_Bits, packer::n_bits, NEXT_HOP, NEXT_HOP_Bits, num_forwards_, num_forwards_Bits, opt_num_forwards_, opt_num_forwards_Bits, PREV_HOP, PREV_HOP_Bits, PTYPE, PTYPE_Bits, SIZE, SIZE_Bits, src_rt_valid, src_rt_valid_Bits, TIMESTAMP, TIMESTAMP_Bits, ts_arr_, ts_arr_Bits, TXTIME, TXTIME_Bits, UID, UID_Bits, xmit_failure_, xmit_failure_Bits, xmit_failure_data_, xmit_failure_data_Bits, xmit_reason_, and xmit_reason_Bits.
|
privatevirtual |
Method to transform the headers into a stream of bits
| Pointer | to the packet to serialize |
| Pointer | to the buffer |
| Offset | from the begin of the buffer |
Reimplemented from packer.
References ADDR_TYPE, aomdv_salvage_count_, packer::debug_, DIRECTION, errbitcnt_, ERROR, fecsize_, iface_, LAST_HOP, packer::n_bits, NEXT_HOP, num_forwards_, opt_num_forwards_, PREV_HOP, printMyHdrFields(), PTYPE, packer::put(), SIZE, src_rt_valid, TIMESTAMP, ts_arr_, TXTIME, UID, xmit_failure_, xmit_failure_data_, and xmit_reason_.

|
privatevirtual |
Method used for debug purposes. It prints the value of the headers of a packet
| Pointer | of the packet |
Reimplemented from packer.
References ERROR, packer::hex_bytes(), packer::n_bits, PTYPE, SIZE, and UID.
Referenced by packMyHdr(), and unpackMyHdr().

|
privatevirtual |
Method used for debug purposes. It prints the number of bits for each header serialized
Reimplemented from packer.
References ADDR_TYPE_Bits, aomdv_salvage_count_Bits, DIRECTION_Bits, errbitcnt_Bits, ERROR_Bits, fecsize_Bits, iface_Bits, LAST_HOP_Bits, NEXT_HOP_Bits, num_forwards_Bits, opt_num_forwards_Bits, PREV_HOP_Bits, PTYPE_Bits, SIZE_Bits, src_rt_valid_Bits, TIMESTAMP_Bits, ts_arr_Bits, TXTIME_Bits, UID_Bits, xmit_failure_Bits, xmit_failure_data_Bits, and xmit_reason_Bits.
|
privatevirtual |
Method responsible to take the informations from the received buffer and store it into the headers of the packet
| Pointer | to the buffer received |
| Offset | from the begin of the buffer |
| Pointer | to the new packet |
Reimplemented from packer.
References ADDR_TYPE, aomdv_salvage_count_, packer::debug_, DIRECTION, errbitcnt_, ERROR, fecsize_, packer::get(), iface_, LAST_HOP, packer::n_bits, NEXT_HOP, num_forwards_, opt_num_forwards_, PREV_HOP, printMyHdrFields(), PTYPE, packer::restoreSignedValue(), SIZE, src_rt_valid, TIMESTAMP, ts_arr_, TXTIME, UID, xmit_failure_, xmit_failure_data_, and xmit_reason_.

|
private |
Bit length of the next_hop_ field to be put in the header stream of bits.
Referenced by init(), packerCOMMON(), and printMyHdrMap().
|
private |
Bit length of the ts_arr_ field to be put in the header stream of bits.
Referenced by init(), packerCOMMON(), and printMyHdrMap().
|
private |
Bit length of the ts_ field to be put in the header stream of bits.
Referenced by init(), packerCOMMON(), and printMyHdrMap().
|
private |
Bit length of the txtime_ field to be put in the header stream of bits.
Referenced by init(), packerCOMMON(), and printMyHdrMap().
|
private |
Bit length of the uid_ field to be put in the header stream of bits.
Referenced by init(), packerCOMMON(), and printMyHdrMap().
|
private |
Bit length of the errbitcnt_ field to be put in the header stream of bits.
Referenced by init(), packerCOMMON(), and printMyHdrMap().
|
private |
Bit length of the fecsize_ field to be put in the header stream of bits.
Referenced by init(), packerCOMMON(), and printMyHdrMap().
|
private |
Bit length of the addr_type_ field to be put in the header stream of bits.
Referenced by init(), packerCOMMON(), and printMyHdrMap().
|
private |
Bit length of the prev_hop_ field to be put in the header stream of bits.
Referenced by init(), packerCOMMON(), and printMyHdrMap().
|
private |
Bit length of the xmit_reason_ field to be put in the header stream of bits.
Referenced by init(), packerCOMMON(), and printMyHdrMap().
|
private |
Bit length of the num_forwards_ field to be put in the header stream of bits.
Referenced by init(), packerCOMMON(), and printMyHdrMap().
|
private |
Bit length of the direction_ field to be put in the header stream of bits.
Referenced by init(), packerCOMMON(), and printMyHdrMap().
|
private |
Referenced by init(), packerCOMMON(), and printMyHdrMap().
|
private |
Bit length of the ptype_ field to be put in the header stream of bits.
Referenced by init(), packerCOMMON(), and printMyHdrMap().
|
private |
Bit length of the iface_ field to be put in the header stream of bits.
Referenced by init(), packerCOMMON(), and printMyHdrMap().
|
private |
Bit length of the error_ field to be put in the header stream of bits.
Referenced by init(), packerCOMMON(), and printMyHdrMap().
|
private |
Bit length of the src_rt_valid_ field to be put in the header stream of bits.
Referenced by init(), packerCOMMON(), and printMyHdrMap().
|
private |
Bit length of the last_hop_ field to be put in the header stream of bits.
Referenced by init(), packerCOMMON(), and printMyHdrMap().
|
private |
Bit length of the size_ field to be put in the header stream of bits.
Referenced by init(), packerCOMMON(), and printMyHdrMap().
|
private |
Bit length of the aomdv_salvage_count_ field to be put in the header stream of bits.
Referenced by init(), packerCOMMON(), and printMyHdrMap().
|
private |
Bit length of the xmit_failure_ field to be put in the header stream of bits.
Referenced by init(), packerCOMMON(), and printMyHdrMap().
|
private |
Bit length of the xmit_failure_data_ field to be put in the header stream of bits.
Referenced by init(), packerCOMMON(), and printMyHdrMap().