47 TclObject*
create(
int,
const char*
const*) {
53 SN_Bits = 8 *
sizeof (u_int32_t);
58 bind(
"SN_Bits", (
int*) &
SN_Bits);
64 cout <<
"Initialization (from constructor) of n_bits for the UWCBR packer " << endl;
82 cout <<
"Re-initialization of n_bits for the UWCBR packer " << endl;
95 hdr_cmn* ch = HDR_CMN(p);
101 offset +=
put(buf, offset, &(uch->
sn_),
n_bits[field_idx++]);
110 printf(
"\033[0;46;30m TX CBR packer hdr \033[0m \n");
121 hdr_cmn* ch = HDR_CMN(p);
127 memset(&(uch->
sn_), 0, sizeof (uch->
sn_));
128 offset +=
get(buf, offset, &(uch->
sn_),
n_bits[field_idx++]);
130 memset(&(uch->
rftt_), 0, sizeof (uch->
rftt_));
140 printf(
"\033[0;46;30m RX CBR packer hdr \033[0m \n");
149 std::cout <<
"\033[0;46;30m Packer Name \033[0m: UWCBR \n";
150 std::cout <<
"\033[0;46;30m sn: \033[0m" <<
SN_Bits <<
" bits \n";
151 std::cout <<
"\033[0;46;30m rftt: \033[0m" <<
RFTT_Bits <<
" bits \n";
152 std::cout <<
"\033[0;46;30m rftt valid: \033[0m" <<
RFTT_VALID_Bits <<
" bits" << std::endl;
153 std::cout <<
"\033[0;46;30m traffic type: \033[0m" <<
TRAFFIC_TYPE_Bits <<
" bits" << std::endl;
160 if (
n_bits[0] != 0) std::cout <<
"\033[0;46;30m sn: \033[0m" << uch->
sn() << std::endl;
161 if (
n_bits[1] != 0) std::cout <<
"\033[0;46;30m rftt: \033[0m" << uch->
rftt() << std::endl;
162 if (
n_bits[2] != 0) std::cout <<
"\033[0;46;30m rftt_valid: \033[0m" << uch->
rftt_valid() << std::endl;
163 if (
n_bits[3] != 0) std::cout <<
"\033[0;46;30m traffic_type: \033[0m" << uch->
traffic_type() << 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.
void init()
Init the Packer.
void printMyHdrFields(Packet *)
Method used for debug purposes.
size_t RFTT_VALID_Bits
Bit length of the rftt_ field to be put in the header stream of bits.
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...
size_t RFTT_Bits
Bit length of the sn_ field to be put in the header stream of bits.
size_t TRAFFIC_TYPE_Bits
Bit length of the rftt_valid_ field to be put in the header stream of bits.
void printMyHdrMap()
Method used for debug purposes.
packerUWCBR()
Class constructor.
~packerUWCBR()
Class destructor.
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.
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.
PackerUWCBRClass class_module_packerUWCBR
Header of the class responsible to map the NS-Miracle packet of uw-cbr into a bit stream,...
hdr_uwcbr describes UWCBR packets.
float & rftt()
Reference to the rftt_ variable.
uint16_t traffic_type_
Traffic type: (video, audio, image, etc..) meaning left to the user.
bool rftt_valid_
Flag used to set the validity of the fft field.
uint16_t & traffic_type()
Reference to the rftt_ variable.
bool & rftt_valid()
Reference to the rftt_valid_ variable.
float rftt_
Forward Trip Time of the packet.
uint16_t sn_
Serial number of the packet.
uint16_t & sn()
Reference to the sn_ variable.