44 TclObject*
create(
int,
const char*
const*) {
50t_bck_max_probe_Bits(0),
51t_bck_min_probe_Bits(0),
53t_bck_choice_sensor_Bits(0),
54n_pck_sensor_want_tx_Bits(0),
55mac_addr_sensor_polled_Bits(0),
56n_pck_hn_want_tx_Bits(0),
57max_cbeacon_tx_hn_Bits(0),
60max_pck_want_rx_Bits(0),
62backoff_time_RTS_Bits(0),
63num_DATA_pcks_MAX_rx_Bits(0),
64mac_addr_HN_ctsed_Bits(0) {
103 std::cout <<
"Re-initialization of n_bits for the uwUFETCH packer " << std::endl;
134 hdr_cmn* hcmn = HDR_CMN(p);
145 std::cout <<
"\033[1;37;45m (TX) UWUFETCH::BEACON packer hdr \033[0m" << std::endl;
157 std::cout <<
"\033[1;37;45m (TX) UWUFETCH::PROBE packer hdr \033[0m" << std::endl;
169 std::cout <<
"\033[1;37;45m (TX) UWUFETCH::POLL packer hdr \033[0m" << std::endl;
182 std::cout <<
"\033[1;37;45m (TX) UWUFETCH::CBEACON packer hdr \033[0m" << std::endl;
194 std::cout <<
"\033[1;37;45m (TX) UWUFETCH::TRIGGER packer hdr \033[0m" << std::endl;
205 std::cout <<
"\033[1;37;45m (TX) UWUFETCH::RTS packer hdr \033[0m" << std::endl;
216 std::cout <<
"\033[1;37;45m (TX) UWUFETCH::CTS packer hdr \033[0m" << std::endl;
226 hdr_cmn* hcmn = HDR_CMN(p);
242 std::cout <<
"\033[1;32;40m (RX) UWUFETCH::BEACON packer hdr \033[0m" << std::endl;
257 std::cout <<
"\033[1;32;40m (RX) UWUFETCH::PROBE packer hdr \033[0m" << std::endl;
272 std::cout <<
"\033[1;32;40m (RX) UWUFETCH::POLL packer hdr \033[0m" << std::endl;
290 std::cout <<
"\033[1;32;40m (RX) UWUFETCH::CBEACON packer hdr \033[0m" << std::endl;
297 memset(&(triggerh->
t_max_), 0, sizeof (triggerh->
t_max_));
300 memset(&(triggerh->
t_min_), 0, sizeof (triggerh->
t_min_));
307 std::cout <<
"\033[1;32;40m (RX) UWUFETCH::TRIGGER packer hdr \033[0m" << std::endl;
321 std::cout <<
"\033[1;32;40m (RX) UWUFETCH::RTS packer hdr \033[0m" << std::endl;
335 std::cout <<
"\033[1;32;40m (RX) UWUFETCH::CTS packer hdr \033[0m" << std::endl;
343 std::cout <<
"\033[1;37;45m Packer Name \033[0m: UWUFETCH \n";
344 std::cout <<
"** BEACON fields:\n";
345 std::cout <<
"\033[1;37;45m Field: T_BCK_MAX_PROBE: \033[0m:" <<
n_bits[
T_BCK_MAX_PROBE] <<
" bits\n";
346 std::cout <<
"\033[1;37;45m Field: T_BCK_MIN_PROBE: \033[0m:" <<
n_bits[
T_BCK_MIN_PROBE] <<
" bits\n";
347 std::cout <<
"\033[1;37;45m Field: N_CBEACON_TX: \033[0m:" <<
n_bits[
N_CBEACON_TX] <<
" bits\n";
349 std::cout <<
"** PROBE fields:\n";
353 std::cout <<
"** POLL fields:\n";
357 std::cout <<
"** CBEACON fields:\n";
359 std::cout <<
"\033[1;37;45m Field: T_BCK_MAX_PROBE: \033[0m:" <<
n_bits[
T_BCK_MAX_PROBE] <<
" bits\n";
360 std::cout <<
"\033[1;37;45m Field: T_BCK_MIN_PROBE: \033[0m:" <<
n_bits[
T_BCK_MIN_PROBE] <<
" bits\n";
362 std::cout <<
"** TRIGGER fields:\n";
363 std::cout <<
"\033[1;37;45m Field: T_BCK_MAX_RTS: \033[0m:" <<
n_bits[
T_BCK_MAX_RTS] <<
" bits\n";
364 std::cout <<
"\033[1;37;45m Field: T_BCK_MIN_RTS: \033[0m:" <<
n_bits[
T_BCK_MIN_RTS] <<
" bits\n";
367 std::cout <<
"** RTS fields:\n";
369 std::cout <<
"\033[1;37;45m Field: NUM_DATA_PCKS: \033[0m:" <<
n_bits[
NUM_DATA_PCKS] <<
" bits\n";
371 std::cout <<
"** CTS fields:\n";
380 hdr_cmn* hcmn = HDR_CMN(p);
385 std::cout <<
"\033[1;37;45m 1st field \033[0m, T_BCK_MAX_PROBE: " << beaconh->
t_max_bc_ << std::endl;
386 std::cout <<
"\033[1;37;45m 2nd field \033[0m, T_BCK_MIN_PROBE: " << beaconh->
t_min_bc_ << std::endl;
392 std::cout <<
"\033[1;37;45m 1st field \033[0m, T_BCK_CHOICE_SENSOR: " << probeh->
backoff_time_PROBE_ << std::endl;
393 std::cout <<
"\033[1;37;45m 2nd field \033[0m, N_PCK_SENSOR_WANT_TX: " << probeh->
n_DATA_pcks_Node_tx_ << std::endl;
398 std::cout <<
"\033[1;37;45m 1st field \033[0m, MAC_ADDR_SENSOR_POLLED: " << pollh->
mac_addr_Node_polled_ << std::endl;
399 std::cout <<
"\033[1;37;45m 2nd field \033[0m, N_PCK_HN_WANT_RX: " << pollh->
num_DATA_pcks_MAX_rx_ << std::endl;
405 std::cout <<
"\033[1;37;45m 2st field \033[0m, T_BCK_MAX_PROBE: " << cbeaconh->
t_max_bc_ << std::endl;
406 std::cout <<
"\033[1;37;45m 3st field \033[0m, T_BCK_MIN_PROBE: " << cbeaconh->
t_min_bc_ << std::endl;
411 std::cout <<
"\033[1;37;45m 1st field \033[0m, T_BCK_MAX_RTS: " << triggerh->
t_max_ << std::endl;
412 std::cout <<
"\033[1;37;45m 2nd field \033[0m, T_BCK_MIN_RTS: " << triggerh->
t_min_ << std::endl;
413 std::cout <<
"\033[1;37;45m 3nd field \033[0m, N_PCK_AUV_WANT_RX: " << triggerh->
max_pck_want_rx_ << std::endl;
418 std::cout <<
"\033[1;37;45m 1st field \033[0m, BACKOFF_TIME_RTS: " << rtsh->
backoff_time_RTS_ << std::endl;
419 std::cout <<
"\033[1;37;45m 2nd field \033[0m, NUM_DATA_PCKS: " << rtsh->
num_DATA_pcks_ << std::endl;
424 std::cout <<
"\033[1;37;45m 1st field \033[0m, MAC_ADDR_HN_CTSED: " << ctsh->
mac_addr_HN_ctsed_ << std::endl;
425 std::cout <<
"\033[1;37;45m 2nd field \033[0m, NUM_DATA_PCKS_MAX_RX: " << ctsh->
num_DATA_pcks_MAX_rx_ << std::endl;
packet_t PT_POLL_UFETCH
POLL packet type for UFetch protocol.
packet_t PT_CBEACON_UFETCH
CBEACON packet type for UFetch protocol.
packet_t PT_CTS_UFETCH
CTS packet type for UFetch protocol.
packet_t PT_TRIGGER_UFETCH
Trigger packet type for UFetch protocol.
packet_t PT_BEACON_UFETCH
BEACON packet type for UFetch protocol.
packet_t PT_PROBE_UFETCH
PROBE packet type for UFetch protocol.
packet_t PT_RTS_UFETCH
RTS packet type for UFetch protocol.
TclObject * create(int, const char *const *)
Class to map a ns2 mac header into a bit stream, and vice-versa.
size_t n_cbeacon_tx_Bits
number of bits used for n_cbeacon_tx_ field on BEACON header
@ N_PCK_AUV_WANT_RX
Maximum number of packets that AUV want receive from the HN.
@ T_BCK_MAX_RTS
Upper bound of the time interval from which the sensor node choice the backoff time before to transmi...
@ N_PCK_HN_WANT_RX
Maximum number of data packet that the head node want to receive from the sensor node polled.
@ NUM_DATA_PCKS_MAX_RX
Exact number of DATA packets that AUV want to receive from the HN.
@ T_BCK_MIN_PROBE
Lower bound of the time interval from which the sensor node choice the backoff time before to transmi...
@ BACKOFF_TIME_RTS
Backoff time choice by the HN before to transmit a RTS packet.
@ N_PCK_SENSOR_WANT_TX
Number of the packets that the sensor node would like to transmit to the head node.
@ T_BCK_MIN_RTS
Lower bound of the time interval from which the sensor node choice the backoff time before to transmi...
@ N_CBEACON_TX
Maximum number of CBEACON that the head node can transmit.
@ T_BCK_CHOICE_SENSOR
Backoff time choose by the sensor node before to transmit the probe packet.
@ MAC_ADDR_SENSOR_POLLED
Mac address of the sensor node from which the head node want to receive the data packet.
@ MAC_ADDR_HN_CTSED
MAC address of the HN from which AUV want to receive DATA packet.
@ NUM_DATA_PCKS
Number of DATA packets that HN would like to transmit to the AUV.
@ MAX_CBEACON_TX_HN
Maximum number of CBEACON that the head node can transmit.
@ T_BCK_MAX_PROBE
Upper bound of the time interval from which the sensor node choice the backoff time before to transmi...
size_t num_DATA_pcks_Bits
number of bits used for num_DATA_pcks_ field on TRIGGER header
size_t mac_addr_sensor_polled_Bits
number of bits used for mac_addr_sensor_polled_ field on POLL header
size_t t_bck_min_rts_Bits
number of bits used for t_bck_min_rts_ field on CBEACON header
size_t t_bck_min_probe_Bits
number of bits used for t_bck_min_probe_ field on BEACON header
size_t mac_addr_HN_ctsed_Bits
number of bits used for mac_addr_HN_ctsed_ field on CTS header
void init()
Init the packer for uwUFetch prototocol.
size_t t_bck_max_probe_Bits
number of bits used for t_bck_max_probe_ field on BEACON header
size_t backoff_time_RTS_Bits
number of bits used for backoff_time_RTS_ field on TRIGGER header
size_t t_bck_choice_sensor_Bits
number of bits used for t_bck_choice_sensor_ field on PROBE header
size_t n_pck_sensor_want_tx_Bits
number of bits used for n_pck_sensor_want_tx_ field on PROBE header
size_t max_pck_want_rx_Bits
number of bits used for max_pck_want_rx_ field on TRIGGER header
size_t num_DATA_pcks_MAX_rx_Bits
number of bits used for num_DATA_pcks_MAX_rx_ field on RTSheader
packer_uwUFetch()
Constructor packer_uwUFetch class.
void printMyHdrFields(Packet *)
Method used for debug purposes.
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 max_cbeacon_tx_hn_Bits
number of bits used for max_cbeacon_tx_hn_ field on CBEACON header
size_t t_bck_max_rts_Bits
number of bits used for t_bck_max_rts_ field on CBEACON header
~packer_uwUFetch()
Destructor packer_uwUFetch class.
size_t n_pck_hn_want_tx_Bits
number of bits used for n_pck_hn_want_tx_ field on POLL header
void printMyHdrMap()
Method used for debug purposes.
size_t packMyHdr(Packet *, unsigned char *, size_t)
Method to transform the headers of UFetch protocol 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.
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.
PackerUwUFetchClass class_module_packerUwUFetch
Content header of BEACON packet.
int t_max_bc_
maximum value in which the Node can choose his backoff time
int num_Max_CBEACON_tx_by_HN_
Maximum number of CBEACON that the HN can transmit after the BEACON packet.
int t_min_bc_
minimum value in which the Node can choose his backoff time
Content header of CBEACON packet.
int t_max_bc_
maximum value in which the Node can choose his backoff time
int num_Max_CBEACON_tx_by_HN_
Maximum number of CBEACON that the HN can transmit after the BEACON packet.
int t_min_bc_
minimum value in which the Node can choose his backoff time
Content header of CTS packet.
int mac_addr_HN_ctsed_
Mac address of the HN from which the AUV want to receive the DATA packets
int num_DATA_pcks_MAX_rx_
maximum number of packets that AUV want receive from HN
Content header of POLL packet.
int num_DATA_pcks_MAX_rx_
Maximum number of DATA packet that HN want to receive from the specific node that is being to poll.
int mac_addr_Node_polled_
Mac address of the NODE that the HN has polled and from which it want to receive a data packet.
Content header of PROBE packet.
int backoff_time_PROBE_
Backoff time chosen by the NODE for collision free.
int n_DATA_pcks_Node_tx_
number of packets that Node have to transmit at HN
Content header of RTS packet.
int num_DATA_pcks_
Number of packets that the HN want to transmit to the AUV.
int backoff_time_RTS_
Backoff time chosen by the HN for collision free.
Content header of TRIGGER packet.
int t_max_
maximum value in which the HN can choose his backoff time
int t_min_
minimum value in which the HN can choose his backoff time
int max_pck_want_rx_
Maximum number of pck that AUV want receive from sink.
#define HDR_BEACON_UFETCH(p)
alias defined to access the BEACON HEADER
#define HDR_POLL_UFETCH(p)
alias defined to access the POLL \ HEADER
#define HDR_CTS_UFETCH(p)
alias defined to access the CTS HEADER
#define HDR_CBEACON_UFETCH(p)
alias defined to access the CBEACON HEADER
#define HDR_TRIGGER_UFETCH(p)
alias defined to access the TRIGGER HEADER
#define HDR_PROBE_UFETCH(p)
alias defined to access the PROBE HEADER
#define HDR_RTS_UFETCH(p)
alias defined to access the RTS HEADER