47 TclObject*
create(
int,
const char*
const*) {
60 cout <<
"Initialization (from constructor) of n_bits for the UWUDP packer " << endl;
75 cout <<
"Re-initialization of n_bits for the UWUDP packer " << endl;
94 printf(
"\033[1;37;44m TX UDP packer hdr \033[0m \n");
108 memset(&(hudp->
sport()), 0, sizeof ( hudp->
sport_));
111 memset(&(hudp->
dport()), 0, sizeof ( hudp->
dport_));
115 printf(
"\033[1;37;44m RX UDP packer hdr \033[0m \n");
123 std::cout <<
"\033[1;37;44m" <<
" Packer Name " <<
"\033[0m" <<
" UWUDP" << std::endl;
124 std::cout <<
"\033[1;37;44m 1st field " <<
"\033[0m" <<
" sport: " <<
SPort_Bits <<
" bits" << std::endl;
125 std::cout <<
"\033[1;37;44m 2nd field " <<
"\033[0m" <<
" dport: " <<
DPort_Bits <<
" bits" << std::endl;
132 std::cout <<
"\033[1;37;44m sport:\033[0m " <<
static_cast<uint32_t
> (hudp->
sport()) <<
" " <<
hex_bytes(hudp->
sport(),
n_bits[0]) << std::endl;
135 std::cout <<
"\033[1;37;44m dport:\033[0m " <<
static_cast<uint32_t
> (hudp->
dport()) <<
" " <<
hex_bytes(hudp->
dport(),
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.
packerUWUDP()
Class constructor.
void init()
Init the Packer.
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...
size_t DPort_Bits
Bit length of the sport_ field to be put in the header stream of bits.
void printMyHdrMap()
Method used for debug purposes.
void printMyHdrFields(Packet *)
Method used for debug purposes.
~packerUWUDP()
Class destructor.
size_t packMyHdr(Packet *, unsigned char *, size_t)
Method to transform the headers of Uwpolling into a stream of bits.
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.
PackerUWUDPClass class_module_packerUWUDP
hdr_uwudp describes UWUDP packets.
uint8_t dport_
Destination port number.
uint8_t & sport()
Reference to the sport_ variable.
uint8_t sport_
Source port number.
uint8_t & dport()
Reference to the dport_ variable.