54 hdr_cmn *cmh = hdr_cmn::access(p);
55 hdr_mac *mach = HDR_MAC(p);
60 std::cout << NOW <<
" uwUFetch_AUV (" << addr
61 <<
") ::Mac2PhyStartTx() ---->MAC layer of the AUV "
63 <<
" packet to his physical layer." << std::endl;
65 if (mach->macDA() == -1) {
68 <<
")::Mac2PhyStartTx()______________________"
69 "Start_tx_of_TRIGGER_pck_in_BROADCAST."
74 <<
")::Mac2PhyStartTx()______________________"
75 "Start_tx_of_TRIGGER_pck_to_HN("
76 << mach->macDA() <<
")." << std::endl;
84 MMac::Mac2PhyStartTx(p);
92 hdr_cmn *cmh = hdr_cmn::access(p);
93 hdr_mac *mach = HDR_MAC(p);
98 std::cout << NOW <<
" uwUFetch_AUV (" << addr
99 <<
") ::Phy2MacEndTx() ---->Physical layer of AUV has "
101 <<
" to transmit a TRIGGER packet to the HN ("
102 << mach->macDA() <<
"), now the AUV is waiting for"
103 <<
" the reception of DATA packets from that HN."
106 if (mach->macDA() == -1) {
109 <<
")::Phy2MacEndTx()________________________"
110 "End_tx_of_TRIGGER_pck_in_BROADCAST."
115 <<
")::Phy2MacEndTx()________________________"
116 "End_tx_of_TRIGGER_pck_to_the_HN("
117 << mach->macDA() <<
")." << std::endl;
135 hdr_cmn *cmh = hdr_cmn::access(p);
136 hdr_mac *mach = HDR_MAC(p);
137 int src_mac_addr = mach->macSA();
143 << NOW <<
" uwUFetch_AUV (" << addr
144 <<
") ::Phy2MacStartRx() ---->AUV is starting to receive a"
145 <<
" BEACON packet from the HN with MAC address: "
146 << src_mac_addr << std::endl;
152 << NOW <<
" uwUFetch_AUV (" << addr
153 <<
") ::Phy2MacStartRx() ---->AUV is starting to receive a"
154 <<
" POLL packet from the HN with MAC address: "
155 << src_mac_addr << std::endl;
161 << NOW <<
" uwUFetch_AUV (" << addr
162 <<
") ::Phy2MacStartRx() ---->AUV is starting to receive a"
163 <<
" CBEACON packet from the HN with MAC address: "
164 << src_mac_addr << std::endl;
170 << NOW <<
" uwUFetch_AUV (" << addr
171 <<
") ::Phy2MacStartRx() ---->AUV is starting to receive a"
172 <<
" PROBE packet from the NODE with MAC address: "
173 << src_mac_addr << std::endl;
179 << NOW <<
" uwUFetch_AUV (" << addr
180 <<
") ::Phy2MacStartRx() ---->AUV is starting to receive a"
181 <<
" TRIGGER packet from the AUV with MAC address: "
182 << src_mac_addr << std::endl;
188 << NOW <<
" uwUFetch_AUV (" << addr
189 <<
") ::Phy2MacStartRx() ---->AUV is starting to receive a"
190 <<
" DATA packet from the HN with MAC address: "
191 << src_mac_addr << std::endl;
195 <<
")::Phy2MacStartRx()______________________"
196 "Start_to_rx_DATA_pck"
197 <<
"_from_HN(" << src_mac_addr <<
")."
207 hdr_cmn *cmh = hdr_cmn::access(p);
208 hdr_mac *mach = HDR_MAC(p);
209 int src_mac_addr = mach->macSA();
210 int dest_mac_addr = mach->macDA();
214 if ((dest_mac_addr == addr) || (dest_mac_addr == MAC_BROADCAST)) {
219 std::cout << NOW <<
" uwUFetch_AUV (" << addr
220 <<
") ::Phy2MacEndRx() ---->AUV has finished to "
222 <<
" BEACON packet from the HN with MAC address: "
223 << src_mac_addr <<
" .IGNORE IT" << std::endl;
227 std::cout << NOW <<
" uwUFetch_AUV (" << addr
228 <<
") ::Phy2MacEndRx() ---->AUV reset the DATA "
233 << NOW <<
"uwUFetch_AUV(" << addr
234 <<
")::Phy2MacEndRx()_________________________"
235 "RESET_DATA_timeout:BEACON_rx_from_triggered_HN."
263 std::cout << NOW <<
" uwUFetch_AUV (" << addr
264 <<
") ::Phy2MacEndRx() ---->AUV has finished to "
266 <<
" POLL packet from the HN with MAC address: "
267 << src_mac_addr <<
" .IGNORE IT" << std::endl;
271 std::cout << NOW <<
" uwUFetch_AUV (" << addr
272 <<
") ::Phy2MacEndRx() ---->AUV reset the DATA "
277 << NOW <<
"uwUFetch_AUV(" << addr
278 <<
")::Phy2MacEndRx()_________________________"
279 "RESET_DATA_timeout:POLL_rx_from_triggered_HN."
307 std::cout << NOW <<
" uwUFetch_AUV (" << addr
308 <<
") ::Phy2MacEndRx() ---->AUV has finished to "
310 <<
" CBEACON packet from the HN with MAC address: "
311 << src_mac_addr <<
" .IGNORE IT." << std::endl;
314 <<
")::Phy2MacEndRx()_________________________"
315 "Finished to rx CBEACON pck"
316 <<
" from HN(" << src_mac_addr
317 <<
"): IGNORE IT." << std::endl;
321 std::cout << NOW <<
" uwUFetch_AUV (" << addr
322 <<
") ::Phy2MacEndRx() ---->AUV reset the DATA "
327 <<
")::Phy2MacEndRx()_____________________"
328 "____RESET_DATA_timeout:CBEACON_rx_"
356 std::cout << NOW <<
" uwUFetch_AUV (" << addr
357 <<
") ::Phy2MacEndRx() ---->AUV has finished to "
359 <<
" PROBE packet from the NODE with MAC address: "
360 << src_mac_addr <<
" .IGNORE IT." << std::endl;
365 std::cout << NOW <<
" uwUFetch_AUV (" << addr
366 <<
") ::Phy2MacEndRx() ---->AUV has finished to "
368 <<
" TRIGGER packet from the AUV with MAC address: "
369 << src_mac_addr <<
" .IGNORE IT." << std::endl;
375 << NOW <<
" uwUFetch_AUV (" << addr
376 <<
") ::Phy2MacEndRx() ---->AUV has finished to "
378 <<
" DATA packet from the HEAD NODE with MAC address: "
379 << src_mac_addr << std::endl;
383 <<
")::Phy2MacEndRx()________________________"
384 "Finished_to_rx_DATA_pck"
385 <<
"_from_HN(" << src_mac_addr <<
")."
396 std::cout << NOW <<
" uwUFetch_AUV (" << addr
397 <<
") ::Phy2MacEndRx() ---->DATA packet "
398 "received by the AUV"
399 <<
" is corrupted: DROP IT and continue with "
400 "the actual processing."
412 <<
")::Phy2MacEndRx()_________________"
413 "_______DATA_pck_rx_by_AUV("
414 << addr <<
")_from_HN("
416 <<
")_id_pck:" << cbrh->
sn() <<
""
417 <<
"_It_s_in_ERROR." << std::endl;
426 << NOW <<
"uwUFetch_AUV(" << addr
427 <<
")::Phy2MacEndRx()_________________________"
428 "Reset_FIRST_DATA_PACKET_TIMEOUT."
436 std::cout << NOW <<
" uwUFetch_AUV (" << addr
437 <<
") ::Phy2MacEndRx() ---->AUV is not "
438 "enabled to receive the DATA"
439 <<
" packet: DROP IT." << std::endl;
447 << NOW <<
"uwUFetch_AUV(" << addr
448 <<
")::Phy2MacEndRx()________________________"
449 "DATA_pck_rx_by_AUV("
450 << addr <<
")_from_HN(" << mach->macSA()
451 <<
")_id_pck:" << cbrh->
sn() <<
""
452 <<
"_NOT_ENABLED_TO_RX_IT." << std::endl;
459 std::cout << NOW <<
" uwUFetch_AUV (" << addr
460 <<
") ::Phy2MacEndRx() ---->Physical layer of "
462 <<
" address: " << dest_mac_addr
463 <<
" has finished to receive a DATA packet"
465 <<
" from the HEAD NODE with MAC address: "
466 << src_mac_addr << std::endl;
474 <<
")::Phy2MacEndRx()_____________________"
475 "____Reset FIRST DATA PACKET TIMEOUT."
485 <<
")::Phy2MacEndRx()_____________________"
486 "___DATA_pck_rx_by_AUV("
487 << addr <<
")_from_HN(" << mach->macSA()
488 <<
")_id_pck:" << cbrh->
sn() <<
""
489 <<
"_IT_S_CORRECT." << std::endl;
501 std::cout << NOW <<
" uwUFetch_AUV (" << addr
502 <<
") ::Phy2MacEndRx() ---->The packet received is not "
504 <<
" DROP IT" << std::endl;
513 <<
")::Phy2MacEndRx()_________________________"
514 "POLL not addressed to me: IGNORE IT."
522 std::cout << NOW <<
" uwUFetch_AUV (" << addr
523 <<
") ::Phy2MacEndRx() ---->AUV reset the DATA "
528 << NOW <<
"uwUFetch_AUV(" << addr
529 <<
")::Phy2MacEndRx()_________________________"
530 "RESET_DATA_timeout:POLL_rx_from_triggered_HN."
562 std::cout << NOW <<
" uwUFetch_AUV (" << addr
563 <<
") ::Phy2MacEndRx() ---->AUV reset the DATA "
568 <<
")::Phy2MacEndRx()_____________________"
569 "____RESET_DATA_timeout:CBEACON_rx_"
620 Packet *p = Packet::alloc();
621 hdr_cmn *cmh = hdr_cmn::access(p);
622 hdr_mac *mach = HDR_MAC(p);
629 std::cout << NOW <<
" uwUFetch_AUV (" << addr
630 <<
") ::state_TRIGGER_tx() ---->Initialization TRIGGER "
636 <<
")::state_TRIGGER_tx()_____________________"
637 "Initialize_TRIGGER_pck_that"
646 mach->macSA() = addr;
654 }
else if (
index == 1) {
657 std::cout << NOW <<
" uwUFetch_AUV (" << addr
658 <<
") ::state_TRIGGER_tx() ---->Initialization TRIGGER "
664 <<
")::state_TRIGGER_tx()_____________________"
665 "Initialize_TRIGGER_pck_that"
674 mach->macSA() = addr;
684 }
else if (
index == 2) {
687 std::cout << NOW <<
" uwUFetch_AUV (" << addr
688 <<
") ::state_TRIGGER_tx() ---->Initialization TRIGGER "
694 <<
")::state_TRIGGER_tx()_____________________"
695 "Initialize_TRIGGER_pck_that"
703 mach->macSA() = addr;
713 }
else if (
index == 3) {
716 std::cout << NOW <<
" uwUFetch_AUV (" << addr
717 <<
") ::state_TRIGGER_tx() ---->Initialization TRIGGER "
723 <<
")::state_TRIGGER_tx()_____________________"
724 "Initialize_TRIGGER_pck_that"
732 mach->macSA() = addr;
744 std::cout << NOW <<
" uwUFetch_AUV (" << addr
745 <<
") ::state_TRIGGER_tx() ---->Initialization TRIGGER "
751 <<
")::state_TRIGGER_tx()_____________________"
752 "Initialize_TRIGGER_pck_that"
761 mach->macSA() = addr;
783 <<
")::state_TRIGGER_tx()_____________________"
784 "PARAMETERS_of_TRIGGER_PACKET."
788 << NOW <<
"uwUFetch_AUV(" << addr
789 <<
")::state_TRIGGER_tx()_____________________Source_address:_"
790 << mach->macSA() << std::endl;
791 if (mach->macDA() == -1) {
794 <<
")::state_TRIGGER_tx()_____________________"
795 "Destination_Address:_BROADCAST."
800 <<
")::state_TRIGGER_tx()_____________________"
801 "Destination_Address:_"
802 << mach->macDA() << std::endl;
806 <<
")::state_TRIGGER_tx()_____________________MIN_"
807 "backoff_time_DATA_pck:_"
811 <<
")::state_TRIGGER_tx()_____________________MAX_"
812 "backoff_time_DATA_pck:_"
816 <<
")::state_TRIGGER_tx()_____________________MAX_"
817 "DATA_pck_want_rx_from_HN:_"
822 <<
")::state_TRIGGER_tx()_____________________Size_of_"
824 << cmh->size() <<
"[byte]." << std::endl;
843 << NOW <<
"uwUFetch_AUV(" << addr
844 <<
")::state_wait_first_DATA()_________________Waiting_DATA"
855 std::cout << NOW <<
" uwUFetch_AUV (" << addr
856 <<
") ::state_wait_first_DATA() ---->AUV want to receive all "
859 <<
") within an interval time: " <<
data_timeout <<
" [s]."
864 <<
")::state_wait_first_DATA()_______________Timeout_"
870 <<
")::state_wait_first_DATA()_______________......."
875 <<
")::state_wait_first_DATA()_______________......."
880 <<
")::state_wait_first_DATA()_______________......."
virtual void schedule(double val)
Schedule a timer.
@ UWUFETCH_AUV_PACKET_TYPE_TRIGGER
virtual double getDataTimerValue()
Compute the length of time interval within AUV want to receive all DATA packet from specifical HN.
int n_DATA_rx_by_AUV
Counter of the number of DATA packets transmitted by AUV during a single cycle of simulation.
uwUFetch_FIRST_DATA_timer DATA_timer_first_pck
Interval time in which the AUV want to receive the first DATA packet from the HN.
int HEAD_NODE_4
Id number of HN 4.
virtual void state_TRIGGER_tx_without()
Initialization of TRIGGER packet that will be forwarded in broadcast to the HNs.
double data_timeout
Interval time within AUV want to receive all DATA packets from the HN.
void incrData_Rx_by_AUV()
Increase of 1 the number of DATA packets received by AUV.
double tx_TRIGGER_finish_time
Indicates when AUV end the transmission of TRIGGER packet.
int HEAD_NODE_2
Id number of HN 2.
int NUM_MAX_DATA_AUV_WANT_RX
Maximum number of data packet that AUV want to receive from the HN in a single cycle of TRIGGER-RTS-C...
bool txTRIGGEREnabled
true if AUV is enabled to transmit a TRIGGER packet
int debugMio_
Used if we want to create the logging file.
std::ofstream out_file_logging
Variable that handle the file in which the protocol write the statistics.
int n_TRIGGER_tx_by_AUV
Counter of the number of TRIGGER packets transmitted by AUV during a single cycle of simulation.
void incrTotal_Data_Rx_by_AUV()
Increase of 1 the number of DATA packets received by AUV.
int NUM_HN_NET
Number of Head Nodes in the network.
virtual void refreshReason(UWUFETCH_AUV_STATUS_CHANGE reason)
Refresh the reason for the changing of the state.
int HEAD_NODE_1
Id number of HN 1.
@ UWUFETCH_AUV_STATUS_CHANGE_PACKET_FOR_ANOTHER_NODE
@ UWUFETCH_AUV_STATUS_CHANGE_TRIGGER_INITIALIZE_TX_TRIGGER
@ UWUFETCH_AUV_STATUS_CHANGE_TRIGGER_TX_WAIT_RTS
@ UWUFETCH_AUV_STATUS_CHANGE_DATA_PCK_FINISHED_TO_RX
@ UWUFETCH_AUV_STATUS_CHANGE_TO_WAIT_DATA_EXPIRED
virtual void Phy2MacStartRx_without(const Packet *p)
Handle the detected-start-of-PHY-reception event in the case protocol doesn't use RTS and CTS packets...
virtual void computeTxTime(UWUFETCH_AUV_PACKET_TYPE tp)
Compute the transmission time for a specifical type of packet.
int HEAD_NODE_3
Id number of HN 3.
double T_MAX_RTS
Upper bound of the interval in which HN choice the back-off time to tx RTS pck.
double T_MIN_RTS
Lower bound of the interval in which HN choice the back-off time to tx RTS pck.
double tx_TRIGGER_start_time
Indicates when AUV start a transmission of TRIGGER packet.
virtual void another_DATA_received()
Verify whether AUV must to receive another DATA packet from the HN to whome It has transmitted the TR...
void incrTotalTrigger_Tx_by_AUV()
Increase of 1 the number of TRIGGER packets transmitted by AUV.
int mac_addr_hn_triggered
MAC address of the HN triggered by the AUV.
virtual void Mac2PhyStartTx_without(Packet *p)
This method must be called by the MAC to instruct the PHY to start the transmission of a packet in th...
virtual void state_wait_first_DATA_without()
AUV is waiting the FIRST DATA packet from the HN to whom It has sent only RTS packet.
void incrTrigger_Tx_by_AUV()
Increment by 1 the number of TRIGGER packets transmitted by AUV during a single cycle TRIGGER-RTS-CTS...
Packet * curr_DATA_pck_rx
Pointer to the DATA packet that is being received by AUV.
@ UWUFETCH_AUV_STATUS_WAIT_DATA_HN
@ UWUFETCH_AUV_STATUS_TRANSMIT_TRIGGER
int getData_Rx_by_AUV()
Number of DATA packets received by AUV after the transmission of TRIGGER-RTS-CTS packets from a speci...
uwUFetch_DATA_timer DATA_timer
Interval time in which the AUV want to receive all DATA packets from the HN.
virtual void Phy2MacEndRx_without(Packet *p)
Handle the end-of-PHY-reception event in the case protocol doesn't use RTS and CTS packets.
virtual void Phy2MacEndTx_without(const Packet *p)
Handle the end-of-PHY-transmission event in the case protocol doesn't use RTS and CTS packets.
bool rxDATAEnabled
true if AUV is enabled to receive a DATA packet
double rx_DATA_finish_time
Indicates when AUV end the reception of DATA packet.
virtual void DATA_rx()
AUV has received a DATA packet from HN.
virtual void refreshState(UWUFETCH_AUV_STATUS state)
Refresh the state of the protocol.
double rx_DATA_start_time
Indicates when AUV start the reception of DATA packet.
virtual void state_wait_first_DATA()
AUV is waiting the FIRST DATA packet from the HN to whom It has sent a RTS and CTS packet.
virtual void printStateInfo(double delay=0)
Prints a file with every state change for debug purposes.
virtual void stateIdle_AUV()
Idle state.
void incrTotal_Data_Rx_corrupted_by_AUV()
Increase of 1 the number of corrupted DATA packets received by AUV.
Packet * curr_TRIGGER_pck_tx
Pointer to the TRIGGER packet that is being transmitted by AUV.
virtual void TRIGGER_tx()
Trasmission of TRIGGER packet.
bool print_transitions
true if the writing of state transitions in the file is enabled.
Content header of TRIGGER packet.
int & t_min()
Reference to the t_min variable.
int & t_max()
Reference to the t_max variable.
int & max_pck_want_rx()
Reference to the max_pck_want_rx variable.
hdr_uwcbr describes UWCBR packets.
uint16_t & sn()
Reference to the sn_ variable.
Declaration of class that implement AUV for UFetch protocol.
packet_t PT_POLL_UFETCH
POLL packet type for UFetch protocol.
packet_t PT_CBEACON_UFETCH
CBEACON packet type for UFetch protocol.
#define UWFETCH_AUV_DROP_REASON_ERROR
Packet dropped: Packet corrupted.
#define UWFETCH_AUV_DROP_REASON_WRONG_RECEIVER
Packet dropped: Packet is addressed to another node of the.
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.
#define UUFETCH_AUV_DROP_REASON_NOT_ENABLE
Packet dropped: AUV is not enabled to transmit or receive this \ type of packet.
Common structures and variables in the protocol.
#define HDR_TRIGGER_UFETCH(p)
alias defined to access the TRIGGER HEADER
Provides the UWCBR packets header description and the definition of the class UWCBR.