|
DESERT 4.0.0
|
#include <uw-csma-ca.h>


Classes | |
| class | CsmaCaTimer |
Public Member Functions | |
| CsmaCa () | |
| virtual | ~CsmaCa () |
| virtual int | command (int argc, const char *const *argv) |
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 | dropPacket (Packet *p, csma_ca_pkt_type_t type, char *reason) |
| csma_ca_states_t | getState () |
| void | updateState (csma_ca_states_t s) |
| csma_ca_log_level_t | getLogLevel () |
| int | getQueueSize () |
| time_t | getEpoch () |
| string | getLogFile () |
| virtual void | state_Wait_CTS () |
| virtual void | state_Wait_Data () |
| virtual void | state_Idle () |
| virtual void | state_Backoff (int tx_time) |
| virtual int | stateRxData (Packet *p) |
| virtual int | stateRxRTS (hdr_ca_RTS *rts, int mac_src, int mac_dst) |
| virtual int | stateRxCTS (hdr_ca_CTS *cts, int mac_src, int mac_dst) |
| virtual int | stateRxACK (Packet *ack) |
| virtual void | stateTxCTS () |
| virtual int | stateTxData () |
| virtual void | state_Wait_ACK () |
| virtual void | stateTxAck (int mac_dst) |
| virtual void | initializeLog () |
Protected Attributes | |
| CsmaCaTimer | backoff_timer |
| CsmaCaTimer | cts_timer |
| CsmaCaTimer | data_timer |
| CsmaCaTimer | ack_timer |
Private Member Functions | |
| void | printonLog (csma_ca_log_level_t level, string log) |
| void | extractDataPacket () |
| int | txData () |
| int | txRTS (int mac_dest) |
| int | txCTS (int mac_dest) |
| int | txAck () |
| void | data_timer_fired () |
| void | backoff_timer_fired () |
| void | cts_timer_fired () |
| void | ack_timer_fired () |
| int | computeTxTime () |
| void | buildRTShdr (hdr_ca_RTS **rts, uint8_t tx_time) |
| void | buildCTShdr (hdr_ca_CTS **cts, uint8_t tx_time) |
| Packet * | buildPacket (int mac_dest, csma_ca_pkt_type_t type, uint8_t tx_time) |
Private Attributes | |
| int | max_queue_size |
| int | data_size |
| int | bitrate |
| int | backoff_delta |
| int | backoff_max |
| int | cts_wait_val |
| int | data_wait_val |
| int | ack_wait_val |
| int | actual_mac_data_src |
| int | actual_expected_tx_time |
| Packet * | actual_data_packet |
| std::queue< Packet * > | data_q |
| ack_modes_t | ack_mode |
| csma_ca_states_t | state |
| csma_ca_states_t | previous_state |
| std::ofstream | outLog |
| csma_ca_log_level_t | log_level |
| string | logfile |
| int | n_rts_rx |
| int | n_cts_rx |
| int | data_pkt_dropped |
| int | cts_pkt_dropped |
| int | rts_pkt_dropped |
| int | ack_pkt_dropped |
Class that describes a CsmaAloha module
| CsmaCa::CsmaCa | ( | ) |
References ack_wait_val, backoff_delta, backoff_max, bitrate, cts_wait_val, data_size, data_wait_val, and max_queue_size.
|
virtual |
|
private |
ACK timer is expired
References CSMA_CA_WAIT_ACK, state, and state_Idle().

|
private |
backoff timer is expired
References CSMA_CA_BACKOFF, getState(), and state_Idle().

|
private |
Build an CTS header
| hdr_ca_CTS** | pointer to CTS header to be built |
| uint8_t | expected tx time of DATA packet |
Referenced by buildPacket().
|
private |
Build a generic packet
| int | MAC destination |
| csma_ca_pkt_type_t | type of packet to build |
| uint8_t | expected tx time of DATA packet |
References buildCTShdr(), buildRTShdr(), CSMA_CA_ACK, CSMA_CA_CTS, CSMA_CA_RTS, PT_CA_ACK, PT_CA_CTS, and PT_CA_RTS.
Referenced by stateTxAck(), txCTS(), and txRTS().

|
private |
Build an RTS header
| hdr_ca_RTS** | pointer to RTS header to be built |
| uint8_t | expected tx time of DATA packet |
Referenced by buildPacket().
|
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 ack_mode, CSMA_CA_ACK_MODE, CSMA_CA_NO_ACK_MODE, cts_pkt_dropped, data_pkt_dropped, getQueueSize(), initializeLog(), n_cts_rx, n_rts_rx, and rts_pkt_dropped.

|
inlineprivate |
|
private |
CTS timer is expired
References CSMA_CA_WAIT_CTS, getState(), and state_Backoff().

|
private |
data timer is expired
References CSMA_CA_WAIT_DATA, getState(), and state_Idle().

|
protectedvirtual |
Drop the packet logging the reason and incrementing the counters
| Packet* | Pointer to packet to be ack_pkt_dropped |
| csma_ca_pkt_type_t | type of the packet dropped |
| char* | Reason for drop |
References ack_pkt_dropped, CSMA_CA_ACK, CSMA_CA_CTS, CSMA_CA_DATA, CSMA_CA_RTS, cts_pkt_dropped, data_pkt_dropped, and rts_pkt_dropped.
Referenced by Phy2MacEndRx(), and recvFromUpperLayers().
|
private |
Extract data packet from queue
References actual_data_packet, data_q, and txRTS().
Referenced by state_Idle().

|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
Return the current log level of the protocol
References log_level.
Referenced by printonLog().
|
inlineprotected |
Return the size of the data packet queue
References data_q.
Referenced by command(), and recvFromUpperLayers().
|
inlineprotected |
Get the state of the protocol
References state.
Referenced by backoff_timer_fired(), cts_timer_fired(), data_timer_fired(), stateRxCTS(), stateRxData(), and stateRxRTS().
|
protectedvirtual |
|
protectedvirtual |
Pass the packet to the PHY layer
| Packet* | Pointer to an object of type Packet that represent the Packet to transmit |
Referenced by stateTxAck(), txCTS(), txData(), and txRTS().
|
protectedvirtual |
Method called when the Phy Layer finish to receive a Packet
| Packet* | Pointer to an object of type Packet that represent the Packet received |
References CSMA_CA_ACK, CSMA_CA_CTS, CSMA_CA_DATA, CSMA_CA_RTS, dropPacket(), n_cts_rx, n_rts_rx, PT_CA_ACK, PT_CA_CTS, PT_CA_RTS, stateRxACK(), stateRxCTS(), stateRxData(), and stateRxRTS().

|
protectedvirtual |
Method called when the PHY layer finish to transmit the packet.
| Packet* | Pointer to an object of type Packet that represent the Packet transmitted |
References ack_mode, actual_data_packet, CSMA_CA_ACK_MODE, PT_CA_ACK, PT_CA_CTS, PT_CA_RTS, state_Idle(), state_Wait_ACK(), state_Wait_CTS(), and state_Wait_Data().

|
protectedvirtual |
Method called when the Phy Layer start to receive a Packet
| const | Packet* Pointer to an object of type Packet that represent the Packet that is in reception |
|
private |
Print a message on log file
| csma_ca_log_level_t | log level of the message |
| string | Actual message |
References getEpoch(), getLogFile(), getLogLevel(), log_level_string, and outLog.

|
protectedvirtual |
Receives the packet from the upper layer (e.g. IP)
| Packet* | pointer to the packet received |
References CSMA_CA_DATA, CSMA_CA_IDLE, data_q, dropPacket(), getQueueSize(), max_queue_size, state, and state_Idle().

|
protectedvirtual |
Backoff state
| int | Transmission time sent on over-heared RTS |
References backoff_delta, backoff_max, backoff_timer, CSMA_CA_BACKOFF, and updateState().
Referenced by cts_timer_fired(), and stateRxCTS().

|
protectedvirtual |
Protocol in IDLE state
References CSMA_CA_IDLE, data_q, extractDataPacket(), and updateState().
Referenced by ack_timer_fired(), backoff_timer_fired(), data_timer_fired(), Phy2MacEndTx(), recvFromUpperLayers(), stateRxACK(), stateRxData(), and stateTxCTS().

|
protectedvirtual |
Wait for an ACK after a data transmission
References ack_timer, ack_wait_val, CSMA_CA_WAIT_ACK, and updateState().
Referenced by Phy2MacEndTx().

|
protectedvirtual |
Waiting for CTS packet
References CSMA_CA_WAIT_CTS, cts_timer, cts_wait_val, and updateState().
Referenced by Phy2MacEndTx().

|
protectedvirtual |
Waiting for DATA packet
References CSMA_CA_WAIT_DATA, data_timer, data_wait_val, and updateState().
Referenced by Phy2MacEndTx().

|
protectedvirtual |
Reception of an ACK packet
| hdr_ca_ACK* | pointer to RTS header in packet |
| int | source MAC of packet |
| int | destination MAC of the packet |
References ack_timer, CSMA_CA_WAIT_ACK, state, and state_Idle().
Referenced by Phy2MacEndRx().

|
protectedvirtual |
Reception of an CTS packet
| hdr_ca_CTS* | pointer to RTS header in packet |
| int | source MAC of packet |
| int | destination MAC of the packet |
References CSMA_CA_IDLE, CSMA_CA_WAIT_CTS, cts_timer, hdr_ca_CTS::get_tx_time(), getState(), state_Backoff(), and stateTxData().
Referenced by Phy2MacEndRx().

|
protectedvirtual |
Transmit a data packet
| Packet* | Pointer to data packet to be transmitted |
References ack_mode, CSMA_CA_ACK_MODE, CSMA_CA_WAIT_DATA, data_timer, getState(), state_Idle(), and stateTxAck().
Referenced by Phy2MacEndRx().

|
protectedvirtual |
Reception of an RTS packet
| hdr_ca_RTS* | pointer to RTS header in packet |
| int | source MAC of packet |
| int | destination MAC of the packet |
References actual_expected_tx_time, actual_mac_data_src, backoff_timer, CSMA_CA_BACKOFF, CSMA_CA_IDLE, hdr_ca_RTS::get_tx_time(), getState(), and stateTxCTS().
Referenced by Phy2MacEndRx().

|
protectedvirtual |
Tranmission of an ACK
| int | destination MAC address |
References buildPacket(), CSMA_CA_ACK, CSMA_CA_TX_ACK, Mac2PhyStartTx(), and updateState().
Referenced by stateRxData().

|
protectedvirtual |
Transmission of a CTS packet
References actual_mac_data_src, CSMA_CA_TX_CTS, state_Idle(), txCTS(), and updateState().
Referenced by stateRxRTS().

|
protectedvirtual |
Transmission of a DATA packet
References CSMA_CA_TX_DATA, txData(), and updateState().
Referenced by stateRxCTS().

|
private |
Actually transmit an ACK
|
private |
Actually transmit a CTS packet
| int | destination MAC |
References actual_expected_tx_time, buildPacket(), CSMA_CA_CTS, and Mac2PhyStartTx().
Referenced by stateTxCTS().

|
private |
Actually transmit a DATA packet
References actual_data_packet, and Mac2PhyStartTx().
Referenced by stateTxData().

|
private |
Actually transmit a RTS packet
| int | destination MAC |
References buildPacket(), computeTxTime(), CSMA_CA_RTS, and Mac2PhyStartTx().
Referenced by extractDataPacket().

|
inlineprotected |
Update the state of the protocol
| csma_ca_state_t | new state |
References previous_state, and state.
Referenced by state_Backoff(), state_Idle(), state_Wait_ACK(), state_Wait_CTS(), state_Wait_Data(), stateTxAck(), stateTxCTS(), and stateTxData().
|
private |
ACK mode (configurable
Referenced by command(), Phy2MacEndTx(), and stateRxData().
|
private |
ACK packet dropped
Referenced by dropPacket().
|
protected |
ACK timer
Referenced by state_Wait_ACK(), and stateRxACK().
|
private |
Timer duration of ACK
Referenced by CsmaCa(), and state_Wait_ACK().
|
private |
Pointer to DATA packet we are handling
Referenced by extractDataPacket(), Phy2MacEndTx(), and txData().
|
private |
Tx time of DATA packet we are handling
Referenced by stateRxRTS(), and txCTS().
|
private |
Source MAC of DATA packet we are handling
Referenced by stateRxRTS(), and stateTxCTS().
|
private |
Delta value (configurable) to be added to backoff
Referenced by CsmaCa(), and state_Backoff().
|
private |
Maximum value in range of backoff
Referenced by CsmaCa(), and state_Backoff().
|
protected |
Backoff timer
Referenced by state_Backoff(), and stateRxRTS().
|
private |
Bit rate adopted
Referenced by computeTxTime(), and CsmaCa().
|
private |
CTS packet dropped
Referenced by command(), and dropPacket().
|
protected |
CTS timer
Referenced by state_Wait_CTS(), and stateRxCTS().
|
private |
Timer duration of CTS
Referenced by CsmaCa(), and state_Wait_CTS().
|
private |
DATA packet dropped
Referenced by command(), and dropPacket().
|
private |
Size of DATA packet
Referenced by extractDataPacket(), getQueueSize(), recvFromUpperLayers(), and state_Idle().
|
private |
Size of DATA packet
Referenced by computeTxTime(), and CsmaCa().
|
protected |
Data timer
Referenced by state_Wait_Data(), and stateRxData().
|
private |
Timer duration of DATA
Referenced by CsmaCa(), and state_Wait_Data().
|
private |
Current log level chosen for protocol
Referenced by getLogLevel().
|
private |
File name of log
Referenced by getLogFile(), and initializeLog().
|
private |
Maximum dimension of Queue
Referenced by CsmaCa(), and recvFromUpperLayers().
|
private |
CTS received
Referenced by command(), and Phy2MacEndRx().
|
private |
RTS received
Referenced by command(), and Phy2MacEndRx().
|
private |
Stdout stream of log
Referenced by initializeLog(), and printonLog().
|
private |
Previous state of the protocol
Referenced by updateState().
|
private |
RTS packet dropped
Referenced by command(), and dropPacket().
|
private |
Current state of the protocol
Referenced by ack_timer_fired(), getState(), recvFromUpperLayers(), stateRxACK(), and updateState().