47 TclObject*
create(
int,
const char*
const*) {
62 cout <<
"Initialization (from constructor) of n_bits for the UWIP packer " << endl;
77 cout <<
"Re-initialization of n_bits for the UWIP packer " << endl;
96 printf(
"\033[0;42;30m TX IP packer hdr \033[0m \n");
121 printf(
"\033[0;42;30m RX IP packer hdr \033[0m \n");
129 std::cout <<
"\033[0;42;30m" <<
" Packer Name " <<
"\033[0m" <<
" UWIP" << std::endl;
130 std::cout <<
"\033[0;42;30m 1st field " <<
"\033[0m" <<
" saddr: " <<
SAddr_Bits <<
" bits" << std::endl;
131 std::cout <<
"\033[0;42;30m 2nd field " <<
"\033[0m" <<
" daddr: " <<
DAddr_Bits <<
" bits" << std::endl;
139 std::cout <<
"\033[0;42;30m saddr:\033[0m " <<
static_cast<uint32_t
> (hip->
saddr()) <<
" " <<
hex_bytes(hip->
saddr(),
n_bits[0]) << std::endl;
142 std::cout <<
"\033[0;42;30m daddr:\033[0m " <<
static_cast<uint32_t
> (hip->
daddr()) <<
" " <<
hex_bytes(hip->
daddr(),
n_bits[1]) << std::endl;
Class to create the Otcl shadow object for an object of the class packer.
TclObject * create(int, const char *const *)
Class exploited by the Uwal module to map an NS-Miracle packet into a bit stream, and vice-versa.
packerUWIP()
Class constructor.
size_t packMyHdr(Packet *, unsigned char *, size_t)
Method to transform the headers of Uwpolling into a stream of bits.
size_t unpackMyHdr(unsigned char *, size_t, Packet *)
Method responsible to take the informations from the received buffer and store it into the headers of...
void init()
Init the Packer.
~packerUWIP()
Class destructor.
void printMyHdrFields(Packet *)
Method used for debug purposes.
size_t DAddr_Bits
Bit length of the saddr_ field to be put in the header stream of bits.
void printMyHdrMap()
Method used for debug purposes.
Class exploited by the Uwal module to map an NS-Miracle packet into a bit stream, and vice-versa.
std::vector< size_t > n_bits
Vector of elements containing the indication of the number of bits to consider for each header field.
size_t put(unsigned char *buffer, size_t offset, void *val, size_t h)
Method used to map in a certain number of bits, contained in a buffer of chars, a given variable.
static std::string hex_bytes(float)
size_t get(unsigned char *buffer, size_t offset, void *val, size_t h)
Method used to retrieve a given variable from a certain number of bits contained in a buffer of chars...
int debug_
Flag to enable debug messages.
PackerUWIPClass class_module_packerUWIP
hdr_uwip describes UWIP packets.
uint8_t & daddr()
Reference to the daddr_ variable.
uint8_t daddr_
IP of the destination.
uint8_t & saddr()
Reference to the saddr_ variable.
uint8_t saddr_
IP of the source.