DESERT 3.5.1
|
#include <packer.h>
Public Member Functions | |
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 () |
Static Public Member Functions | |
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 | |
virtual void | init () |
virtual size_t | packMyHdr (Packet *, unsigned char *, size_t) |
virtual size_t | unpackMyHdr (unsigned char *, size_t, Packet *) |
virtual void | printMyHdrMap () |
virtual void | printMyHdrFields (Packet *) |
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 | |
std::vector< size_t > | n_bits |
int | debug_ |
Private Attributes | |
std::vector< packer * > | activePackers |
size_t | payload_length |
size_t | hdr_length |
bool | printAllFields |
size_t | SRC_ID_Bits |
size_t | PKT_ID_Bits |
size_t | FRAME_OFFSET_Bits |
size_t | M_BIT_Bits |
size_t | DUMMY_CONTENT_Bits |
Class exploited by the Uwal module to map an NS-Miracle packet into a bit stream, and vice-versa.
packer::packer | ( | bool | init_ | ) |
Class constructor.
Definition at line 121 of file packer.cpp.
packer::~packer | ( | ) |
Class destructor.
Definition at line 159 of file packer.cpp.
|
static |
Definition at line 1122 of file packer.cpp.
|
static |
Definition at line 1113 of file packer.cpp.
int packer::command | ( | int | argc, |
const char *const * | argv | ||
) |
Method to map tcl commands into c++ methods.
argc | number of arguments in argv |
argv | array of arguments where argv[3] is the tcl command name and argv[4, 5, ...] are the parameters for the corresponding c++ method. |
Definition at line 180 of file packer.cpp.
|
protected |
Method used to retrieve a given variable from a certain number of bits contained in a buffer of chars.
[in] | buffer | pointer to a buffer of characters. |
[in] | offset | position from which to start reading the buffer of characters. |
[in,out] | val | pointer to variable to retrieve (passed as reference). |
h | the number of bits to read. |
Definition at line 673 of file packer.cpp.
size_t packer::getHdrBinLength | ( | ) |
Definition at line 228 of file packer.cpp.
|
protected |
Definition at line 661 of file packer.cpp.
size_t packer::getPayloadBinLength | ( | ) |
Definition at line 216 of file packer.cpp.
|
static |
Definition at line 786 of file packer.cpp.
|
static |
Definition at line 840 of file packer.cpp.
|
static |
Definition at line 871 of file packer.cpp.
|
static |
Definition at line 909 of file packer.cpp.
|
static |
Definition at line 813 of file packer.cpp.
|
static |
Definition at line 990 of file packer.cpp.
|
static |
Definition at line 1021 of file packer.cpp.
|
static |
Definition at line 1059 of file packer.cpp.
|
static |
Definition at line 963 of file packer.cpp.
|
static |
Definition at line 769 of file packer.cpp.
|
static |
Definition at line 752 of file packer.cpp.
|
static |
Definition at line 735 of file packer.cpp.
|
static |
Definition at line 727 of file packer.cpp.
|
static |
Definition at line 706 of file packer.cpp.
|
static |
Function used for log and debug purposes (in order to print binary strings, even if they contain special characters)
str | the binary string to print |
Definition at line 697 of file packer.cpp.
|
protectedvirtual |
Reimplemented in packer_uwApplication, packerUWCBR, packerUwCsmaCa, PackerUwFlooding, packerUWIP, packerUwpolling, packerUWUDP, packer_uwUFetch, packerCOMMON, packerMAC, and packer_uwRangingTDOA.
Definition at line 164 of file packer.cpp.
std::string packer::packHdr | ( | Packet * | p | ) |
Definition at line 234 of file packer.cpp.
|
protectedvirtual |
Reimplemented in packerUWCBR, packerUwCsmaCa, PackerUwFlooding, packerUWIP, packerUwpolling, packerUWUDP, packer_uwUFetch, packerCOMMON, packerMAC, packer_uwApplication, and packer_uwRangingTDOA.
Definition at line 523 of file packer.cpp.
std::string packer::packPayload | ( | Packet * | p | ) |
Method to map an NS-Miracle packet into a legal modem payload (i.e., a string of binary characters) when one among the following protocol stack is in use (see UWMPhy_modem::stack):
NOTE: With the currently implemented map:
p | pointer to the NS-Miracle packet that must be mapped into a modem payload. |
Definition at line 292 of file packer.cpp.
void packer::printMap | ( | ) |
Definition at line 506 of file packer.cpp.
|
protectedvirtual |
Definition at line 617 of file packer.cpp.
|
protectedvirtual |
Reimplemented in packer_uwApplication, packerUWCBR, packerUwCsmaCa, PackerUwFlooding, packerUWIP, packerUwpolling, packerUWUDP, packer_uwUFetch, packerCOMMON, packerMAC, and packer_uwRangingTDOA.
Definition at line 608 of file packer.cpp.
|
protectedvirtual |
Reimplemented in packer_uwApplication, packerUWCBR, packerUwCsmaCa, PackerUwFlooding, packerUWIP, packerUwpolling, packerUWUDP, packer_uwUFetch, packerCOMMON, packerMAC, and packer_uwRangingTDOA.
Definition at line 582 of file packer.cpp.
|
protected |
Method used to map in a certain number of bits, contained in a buffer of chars, a given variable.
[in] | buffer | pointer to a buffer of characters. |
[in] | offset | position from which to start writing to the buffer of characters. |
[in,out] | val | pointer to the variable to map (passed as reference). |
h | the number of bits to use for the mapping. |
Definition at line 685 of file packer.cpp.
|
inlinestatic |
Packet * packer::unpackHdr | ( | Packet * | p | ) |
Definition at line 412 of file packer.cpp.
|
protectedvirtual |
Reimplemented in packerUWCBR, packerUwCsmaCa, PackerUwFlooding, packerUWIP, packerUwpolling, packerUWUDP, packer_uwUFetch, packerCOMMON, packerMAC, packer_uwApplication, and packer_uwRangingTDOA.
Definition at line 548 of file packer.cpp.
Packet * packer::unpackPayload | ( | Packet * | p | ) |
Method to de-map a legal modem payload (i.e., a string of binary characters) into an NS-Miracle packet, when one among the following protocol stack is in use (see UWMPhy_modem::stack):
s | the node ID from which the last received packet arrives. |
d | the node ID to which the last received packet is sent. |
src | the payload of the last packet received from the modem. |
Definition at line 433 of file packer.cpp.
|
private |
Vector of elements containing the pointers to the active packers (i.e., the derived classed of packer actually in charge of pack and unpack packets.
These are set by the tcl user through the command "addPacker". See packer::command).
|
protected |
|
private |
|
private |
|
private |
The minimum number of elements that a buffer of char must have in order to store the header fields of the AL.
|
private |
|
protected |
|
private |
|
private |