|
DESERT 4.0.0
|
#include <uw-csma-aloha-trigger-node.h>


Classes | |
| class | Csma_Aloha_Triggered_Timer |
| class | ListenTimer |
| class | TransmissionTimer |
Public Member Functions | |
| UwCsmaAloha_Trigger_NODE () | |
| virtual | ~UwCsmaAloha_Trigger_NODE () |
| virtual int | command (int argc, const char *const *argv) |
| virtual int | crLayCommand (ClMessage *m) |
Protected Member Functions | |
| virtual void | recvFromUpperLayers (Packet *p) |
| virtual void | Mac2PhyStartTx (Packet *p) |
| virtual void | Phy2MacEndTx (const Packet *p) |
| virtual void | Phy2MacStartRx (const Packet *p) |
| virtual void | Phy2MacEndRx (Packet *p) |
| virtual void | initPkt (Packet *p) |
| virtual void | txData () |
| virtual void | stateIdle () |
| virtual void | stateRxIdle () |
| virtual void | stateTxData () |
| virtual void | stateListen () |
| virtual void | stateRxListen () |
| virtual void | stateRxTrigger (Packet *p) |
| virtual void | stateCheckListenExpired () |
| virtual void | stateCheckTxTimerExpired () |
| virtual void | stateRxData (Packet *p) |
| virtual void | stateRxPacketNotForMe (Packet *p) |
| virtual void | initInfo () |
| virtual void | refreshState (UW_CS_ALOHA_TRIG_NODE_STATUS state) |
| virtual void | refreshReason (UW_CS_ALOHA_TRIG_NODE_REASON_STATUS reason) |
| virtual void | updateLastDataIdRx (int id) |
| virtual void | queuePop (bool flag=true) |
| virtual void | waitForUser () |
| virtual int | getRemainingPkts () |
| virtual void | incrUpperDataRx () |
Protected Attributes | |
| ListenTimer | listen_timer |
| TransmissionTimer | tx_timer |
| double | wait_costant |
| int | max_payload |
| int | HDR_size |
| int | buffer_pkts |
| double | listen_time |
| int | tx_timer_duration |
| std::queue< Packet * > | Q |
| std::queue< int > | data_sn_queue |
| int | u_data_id |
| int | last_sent_data_id |
| Packet * | curr_data_pkt |
| int | last_data_id_rx |
| bool | has_buffer_queue |
| bool | can_transmit |
| UW_CS_ALOHA_TRIG_NODE_STATUS | curr_state |
| UW_CS_ALOHA_TRIG_NODE_STATUS | prev_state |
| UW_CS_ALOHA_TRIG_NODE_STATUS | prev_prev_state |
| UW_CS_ALOHA_TRIG_NODE_REASON_STATUS | last_reason |
| ofstream | fout |
Static Protected Attributes | |
| static const double | prop_speed = 1500.0 |
| static bool | initialized = false |
| static int | u_pkt_id |
| static map< UW_CS_ALOHA_TRIG_NODE_STATUS, string > | status_info |
| static map< UW_CS_ALOHA_TRIG_NODE_REASON_STATUS, string > | reason_info |
Class that describes a CsmaAloha_TRIGGERED module of the node
|
protected |
|
protected |
| UwCsmaAloha_Trigger_NODE::UwCsmaAloha_Trigger_NODE | ( | ) |
Constructor of the UwCsmaAloha_Trigger_NODE class
References buffer_pkts, has_buffer_queue, HDR_size, listen_time, max_payload, tx_timer_duration, and u_pkt_id.
Referenced by UwCsmaAloha_Trigger_NODE::ListenTimer::expire().
|
virtual |
Destructor of the UwCsmaAloha_Trigger_NODE class
|
virtual |
TCL command interpreter. It implements the following OTcl methods:
| argc | Number of arguments in argv. |
| argv | Array of strings which are the command parameters (Note that argv[0] is the name of the object). |
References initInfo(), and Q.

|
virtual |
Cross-Layer messages interpreter
| ClMessage* | an instance of ClMessage that represent the message received |
|
inlineprotectedvirtual |
Return the number of packets not transmitted (remained in the protocol queue) at the end of the simulation
References Q.
|
inlineprotectedvirtual |
Increase the number of Data packet Received from the Upper layers
Referenced by recvFromUpperLayers().
|
protectedvirtual |
Initializes the protocol at the beginning of the simulation. This method is called by a command in tcl.
| double | delay |
References initialized, reason_info, status_info, UW_CS_ALOHA_TRIG_NODE_REASON_DATA_EMPTY, UW_CS_ALOHA_TRIG_NODE_REASON_DATA_PENDING, UW_CS_ALOHA_TRIG_NODE_REASON_DATA_RX, UW_CS_ALOHA_TRIG_NODE_REASON_DATA_TX, UW_CS_ALOHA_TRIG_NODE_REASON_LISTEN, UW_CS_ALOHA_TRIG_NODE_REASON_LISTEN_AFTER_TRIGGER, UW_CS_ALOHA_TRIG_NODE_REASON_LISTEN_PENDING, UW_CS_ALOHA_TRIG_NODE_REASON_LISTEN_TIMEOUT, UW_CS_ALOHA_TRIG_NODE_REASON_PKT_ERROR, UW_CS_ALOHA_TRIG_NODE_REASON_PKT_NOT_FOR_ME, UW_CS_ALOHA_TRIG_NODE_REASON_START_RX, UW_CS_ALOHA_TRIG_NODE_REASON_TRIGGER_RX, UW_CS_ALOHA_TRIG_NODE_STATE_CHK_LISTEN_TIMEOUT, UW_CS_ALOHA_TRIG_NODE_STATE_DATA_RX, UW_CS_ALOHA_TRIG_NODE_STATE_IDLE, UW_CS_ALOHA_TRIG_NODE_STATE_LISTEN, UW_CS_ALOHA_TRIG_NODE_STATE_RX_IDLE, UW_CS_ALOHA_TRIG_NODE_STATE_RX_LISTEN, UW_CS_ALOHA_TRIG_NODE_STATE_RX_TRIGGER, UW_CS_ALOHA_TRIG_NODE_STATE_TX_DATA, and UW_CS_ALOHA_TRIG_NODE_STATE_WRONG_PKT_RX.
Referenced by command().
|
protectedvirtual |
Init the packet with the MAC address of the receiver and the sender, the size of the packet and the type
| UWPOLLING_PKT_TYPE | the type of the packet |
References data_sn_queue, HDR_size, and u_data_id.
Referenced by recvFromUpperLayers().
|
protectedvirtual |
Pass the packet to the PHY layer
| Packet* | Pointer to an object of type Packet that rapresent the Packet to transmit |
Referenced by txData().
|
protectedvirtual |
Method called when the Phy Layer finish to receive a Packet
| Packet* | Pointer to an object of type Packet that rapresent the Packet received |
References curr_state, prop_speed, PT_MMAC_TRIGGER, refreshReason(), stateRxPacketNotForMe(), stateRxTrigger(), status_info, UW_CS_ALOHA_TRIG_NODE_REASON_PKT_ERROR, UW_CS_ALOHA_TRIG_NODE_REASON_PKT_NOT_FOR_ME, and UW_CS_ALOHA_TRIG_NODE_REASON_TRIGGER_RX.

|
protectedvirtual |
Method called when the PHY layer finish to transmit the packet.
| Packet* | Pointer to an object of type Packet that rapresent the Packet transmitted |
References curr_state, refreshReason(), stateIdle(), status_info, UW_CS_ALOHA_TRIG_NODE_REASON_DATA_TX, UW_CS_ALOHA_TRIG_NODE_STATE_IDLE, and UW_CS_ALOHA_TRIG_NODE_STATE_TX_DATA.

|
protectedvirtual |
Method called when the Phy Layer start to receive a Packet
| const | Packet* Pointer to an object of type Packet that rapresent the Packet that is in reception |
References curr_state, refreshReason(), stateRxIdle(), stateRxListen(), status_info, UW_CS_ALOHA_TRIG_NODE_REASON_START_RX, UW_CS_ALOHA_TRIG_NODE_STATE_IDLE, and UW_CS_ALOHA_TRIG_NODE_STATE_LISTEN.

|
inlineprotectedvirtual |
Pop the first element of the data packet queue
References data_sn_queue, and Q.
Referenced by txData().
|
protectedvirtual |
Receives the packet from the upper layer (e.g. IP)
| Packet* | pointer to the packet received |
References buffer_pkts, curr_state, has_buffer_queue, incrUpperDataRx(), initPkt(), Q, refreshReason(), stateListen(), UW_CS_ALOHA_TRIG_NODE_REASON_DATA_PENDING, and UW_CS_ALOHA_TRIG_NODE_STATE_IDLE.

|
inlineprotectedvirtual |
Refresh the reason for the change of state
References last_reason.
Referenced by Phy2MacEndRx(), Phy2MacEndTx(), Phy2MacStartRx(), recvFromUpperLayers(), stateCheckListenExpired(), stateIdle(), stateRxData(), and stateRxTrigger().
|
inlineprotectedvirtual |
Refresh the State of the protocol
References curr_state, prev_prev_state, and prev_state.
Referenced by stateCheckListenExpired(), stateIdle(), stateListen(), stateRxData(), stateRxIdle(), stateRxListen(), stateRxPacketNotForMe(), stateRxTrigger(), and stateTxData().
|
protectedvirtual |
Checks if the Listen period is expired
References curr_state, UwCsmaAloha_Trigger_NODE::Csma_Aloha_Triggered_Timer::isActive(), UwCsmaAloha_Trigger_NODE::Csma_Aloha_Triggered_Timer::isExpired(), listen_timer, prev_state, refreshReason(), refreshState(), stateListen(), stateTxData(), status_info, UW_CS_ALOHA_TRIG_NODE_REASON_LISTEN_PENDING, UW_CS_ALOHA_TRIG_NODE_REASON_LISTEN_TIMEOUT, UW_CS_ALOHA_TRIG_NODE_STATE_CHK_LISTEN_TIMEOUT, UW_CS_ALOHA_TRIG_NODE_STATE_DATA_RX, UW_CS_ALOHA_TRIG_NODE_STATE_LISTEN, and UW_CS_ALOHA_TRIG_NODE_STATE_WRONG_PKT_RX.
Referenced by stateRxData(), and stateRxPacketNotForMe().

|
protectedvirtual |
Checks if the Time period is expired
|
protectedvirtual |
IDLE state. Each variable is resetted
References can_transmit, listen_timer, Q, refreshReason(), refreshState(), stateListen(), UwCsmaAloha_Trigger_NODE::Csma_Aloha_Triggered_Timer::stop(), UW_CS_ALOHA_TRIG_NODE_REASON_LISTEN, and UW_CS_ALOHA_TRIG_NODE_STATE_IDLE.
Referenced by Phy2MacEndTx(), stateRxData(), and stateRxPacketNotForMe().

|
protectedvirtual |
State in which the node is listening the channel
References UwCsmaAloha_Trigger_NODE::Csma_Aloha_Triggered_Timer::incrCounter(), listen_time, listen_timer, refreshState(), UwCsmaAloha_Trigger_NODE::Csma_Aloha_Triggered_Timer::schedule(), UwCsmaAloha_Trigger_NODE::Csma_Aloha_Triggered_Timer::stop(), UW_CS_ALOHA_TRIG_NODE_STATE_LISTEN, and wait_costant.
Referenced by recvFromUpperLayers(), stateCheckListenExpired(), stateIdle(), and stateRxTrigger().

|
protectedvirtual |
State in which a DATA packet is received
| p | pointer to the Packet received |
References HDR_size, prev_state, refreshReason(), refreshState(), stateCheckListenExpired(), stateIdle(), status_info, UW_CS_ALOHA_TRIG_NODE_REASON_DATA_RX, UW_CS_ALOHA_TRIG_NODE_STATE_DATA_RX, UW_CS_ALOHA_TRIG_NODE_STATE_RX_IDLE, and UW_CS_ALOHA_TRIG_NODE_STATE_RX_LISTEN.

|
protectedvirtual |
A reception is occuring while the protocol is in IDLE state
References refreshState(), and UW_CS_ALOHA_TRIG_NODE_STATE_RX_IDLE.
Referenced by Phy2MacStartRx().

|
protectedvirtual |
State in which a reception is occuring while the node is listening the channel
References refreshState(), and UW_CS_ALOHA_TRIG_NODE_STATE_RX_LISTEN.
Referenced by Phy2MacStartRx().

|
protectedvirtual |
state in which a wrong Packet is received
References prev_state, refreshState(), stateCheckListenExpired(), stateIdle(), status_info, UW_CS_ALOHA_TRIG_NODE_STATE_RX_IDLE, UW_CS_ALOHA_TRIG_NODE_STATE_RX_LISTEN, and UW_CS_ALOHA_TRIG_NODE_STATE_WRONG_PKT_RX.
Referenced by Phy2MacEndRx().

|
protectedvirtual |
State of the protocol in which a TRIGGER packet is received
| p | Pointer to the Packet received |
References can_transmit, Q, refreshReason(), refreshState(), UwCsmaAloha_Trigger_NODE::Csma_Aloha_Triggered_Timer::schedule(), stateListen(), tx_timer, tx_timer_duration, UW_CS_ALOHA_TRIG_NODE_REASON_LISTEN_AFTER_TRIGGER, and UW_CS_ALOHA_TRIG_NODE_STATE_RX_TRIGGER.
Referenced by Phy2MacEndRx().

|
protectedvirtual |
State in which the protocol allows the node to transmit a data packet
References can_transmit, curr_data_pkt, data_sn_queue, last_sent_data_id, listen_timer, Q, refreshState(), UwCsmaAloha_Trigger_NODE::Csma_Aloha_Triggered_Timer::resetCounter(), txData(), and UW_CS_ALOHA_TRIG_NODE_STATE_TX_DATA.
Referenced by stateCheckListenExpired().

|
protectedvirtual |
Transmits the DATA packet (calling Mac2PhyStartTx) and increment the counter of transmitted data packets
References curr_data_pkt, Mac2PhyStartTx(), and queuePop().
Referenced by stateTxData().

|
inlineprotectedvirtual |
Updates the ID of the last DATA packet received
| id | ID of the packet |
References last_data_id_rx.
|
protectedvirtual |
Used for debug purposes. (Permit to have a "step by step" behavior of the protocol)
|
protected |
Length of the data buffer in number of packets
Referenced by recvFromUpperLayers(), and UwCsmaAloha_Trigger_NODE().
|
protected |
Flag that indicates if the node can transmit data packets to the sink
Referenced by stateIdle(), stateRxTrigger(), and stateTxData().
|
protected |
Pointer to the current data packet
Referenced by stateTxData(), and txData().
|
protected |
Current state of the protocol
Referenced by Phy2MacEndRx(), Phy2MacEndTx(), Phy2MacStartRx(), recvFromUpperLayers(), refreshState(), and stateCheckListenExpired().
|
protected |
Queue of the sequence number of the packets
Referenced by initPkt(), queuePop(), and stateTxData().
|
protected |
Object that handles the output file where the protocol writes the state transistions
|
protected |
flag that indicates if a node has a buffer where store DATA packets
Referenced by recvFromUpperLayers(), and UwCsmaAloha_Trigger_NODE().
|
protected |
Size (in bytes) of the header added by the protocol
Referenced by initPkt(), stateRxData(), and UwCsmaAloha_Trigger_NODE().
|
staticprotected |
true if the protocol is initialized
Referenced by initInfo().
|
protected |
ID of the last DATA packet received
Referenced by updateLastDataIdRx().
|
protected |
Reason for the state transitions
Referenced by refreshReason().
|
protected |
ID of the last sent packet
Referenced by stateTxData().
|
protected |
Time in which the node sense the channel
Referenced by stateListen(), and UwCsmaAloha_Trigger_NODE().
|
protected |
Referenced by stateCheckListenExpired(), stateIdle(), stateListen(), and stateTxData().
|
protected |
Maximum dimension of the data payload in bytes
Referenced by UwCsmaAloha_Trigger_NODE().
|
protected |
Previous previous state of the protocol
Referenced by refreshState().
|
protected |
Previous state of the protocol
Referenced by refreshState(), stateCheckListenExpired(), stateRxData(), and stateRxPacketNotForMe().
|
staticprotected |
Typical sound propagation speed in underwater enviroment Variable that rapresent the status of the protocol machine state
Referenced by Phy2MacEndRx().
|
protected |
Packet queue
Referenced by command(), getRemainingPkts(), queuePop(), recvFromUpperLayers(), stateIdle(), stateRxTrigger(), and stateTxData().
|
staticprotected |
Textual description of the protocol reason for the change of the state
Referenced by initInfo().
|
staticprotected |
Textual description of the protocol states
Referenced by initInfo(), Phy2MacEndRx(), Phy2MacEndTx(), Phy2MacStartRx(), stateCheckListenExpired(), stateRxData(), and stateRxPacketNotForMe().
|
protected |
Referenced by stateRxTrigger().
|
protected |
Duration of the time in which the node is allowed to transmit
Referenced by stateRxTrigger(), and UwCsmaAloha_Trigger_NODE().
|
protected |
DATA packete ID
Referenced by initPkt().
|
staticprotected |
simulation-unique packet ID
Referenced by UwCsmaAloha_Trigger_NODE().
|
protected |
Adding factor in the calculation of the listen time
Referenced by stateListen().