#include <uw-csma-ca.h>
Class that describes a CsmaAloha module.
Definition at line 96 of file uw-csma-ca.h.
◆ CsmaCa()
◆ ~CsmaCa()
◆ ack_timer_fired()
void CsmaCa::ack_timer_fired |
( |
| ) |
|
|
private |
◆ backoff_timer_fired()
void CsmaCa::backoff_timer_fired |
( |
| ) |
|
|
private |
◆ buildCTShdr()
void CsmaCa::buildCTShdr |
( |
hdr_ca_CTS ** |
cts, |
|
|
uint8_t |
tx_time |
|
) |
| |
|
private |
Build an CTS header.
- Parameters
-
hdr_ca_CTS** | pointer to CTS header to be built |
uint8_t | expected tx time of DATA packet |
Definition at line 621 of file uw-csma-ca.cpp.
◆ buildPacket()
Build a generic packet.
- Parameters
-
int | MAC destination |
csma_ca_pkt_type_t | type of packet to build |
uint8_t | expected tx time of DATA packet |
Definition at line 627 of file uw-csma-ca.cpp.
◆ buildRTShdr()
void CsmaCa::buildRTShdr |
( |
hdr_ca_RTS ** |
rts, |
|
|
uint8_t |
tx_time |
|
) |
| |
|
private |
Build an RTS header.
- Parameters
-
hdr_ca_RTS** | pointer to RTS header to be built |
uint8_t | expected tx time of DATA packet |
Definition at line 615 of file uw-csma-ca.cpp.
◆ command()
int CsmaCa::command |
( |
int |
argc, |
|
|
const char *const * |
argv |
|
) |
| |
|
virtual |
TCL command interpreter.
It implements the following OTcl methods:
- Parameters
-
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). |
- Returns
- TCL_OK or TCL_ERROR whether the command has been dispatched successfully or not.
Definition at line 74 of file uw-csma-ca.cpp.
◆ computeTxTime()
int CsmaCa::computeTxTime |
( |
| ) |
|
|
inlineprivate |
Compute transmission time of a packet using known bitrate.
- Returns
- int tranmission time
Definition at line 351 of file uw-csma-ca.h.
◆ cts_timer_fired()
void CsmaCa::cts_timer_fired |
( |
| ) |
|
|
private |
◆ data_timer_fired()
void CsmaCa::data_timer_fired |
( |
| ) |
|
|
private |
◆ dropPacket()
Drop the packet logging the reason and incrementing the counters.
- Parameters
-
Packet* | Pointer to packet to be ack_pkt_dropped |
csma_ca_pkt_type_t | type of the packet dropped |
char* | Reason for drop |
Definition at line 537 of file uw-csma-ca.cpp.
◆ extractDataPacket()
void CsmaCa::extractDataPacket |
( |
| ) |
|
|
private |
◆ getEpoch()
time_t CsmaCa::getEpoch |
( |
| ) |
|
|
inlineprotected |
Return the system epoch.
- Returns
- time_t epoch
Definition at line 209 of file uw-csma-ca.h.
◆ getLogFile()
string CsmaCa::getLogFile |
( |
| ) |
|
|
inlineprotected |
Return name of the log file.
- Returns
- string file name
Definition at line 218 of file uw-csma-ca.h.
◆ getLogLevel()
Return the current log level of the protocol.
- Returns
- csma_ca_log_t log level
Definition at line 191 of file uw-csma-ca.h.
◆ getQueueSize()
int CsmaCa::getQueueSize |
( |
| ) |
|
|
inlineprotected |
Return the size of the data packet queue.
- Returns
- int queue size
Definition at line 200 of file uw-csma-ca.h.
◆ getState()
Get the state of the protocol.
- Returns
- csma_ca_state_t Current state
Definition at line 172 of file uw-csma-ca.h.
◆ initializeLog()
void CsmaCa::initializeLog |
( |
| ) |
|
|
protectedvirtual |
Initializes the protocol at the beginning of the simulation.
This method is called by a command in tcl.
Definition at line 228 of file uw-csma-ca.cpp.
◆ Mac2PhyStartTx()
void CsmaCa::Mac2PhyStartTx |
( |
Packet * |
p | ) |
|
|
protectedvirtual |
Pass the packet to the PHY layer.
- Parameters
-
Packet* | Pointer to an object of type Packet that represent the Packet to transmit |
Definition at line 241 of file uw-csma-ca.cpp.
◆ Phy2MacEndRx()
void CsmaCa::Phy2MacEndRx |
( |
Packet * |
p | ) |
|
|
protectedvirtual |
Method called when the Phy Layer finish to receive a Packet.
- Parameters
-
Packet* | Pointer to an object of type Packet that represent the Packet received |
Definition at line 247 of file uw-csma-ca.cpp.
◆ Phy2MacEndTx()
void CsmaCa::Phy2MacEndTx |
( |
const Packet * |
p | ) |
|
|
protectedvirtual |
Method called when the PHY layer finish to transmit the packet.
- Parameters
-
Packet* | Pointer to an object of type Packet that represent the Packet transmitted |
Definition at line 487 of file uw-csma-ca.cpp.
◆ Phy2MacStartRx()
void CsmaCa::Phy2MacStartRx |
( |
const Packet * |
p | ) |
|
|
protectedvirtual |
Method called when the Phy Layer start to receive a Packet.
- Parameters
-
const | Packet* Pointer to an object of type Packet that represent the Packet that is in reception |
Definition at line 472 of file uw-csma-ca.cpp.
◆ printonLog()
Print a message on log file.
- Parameters
-
csma_ca_log_level_t | log level of the message |
string | Actual message |
Definition at line 668 of file uw-csma-ca.cpp.
◆ recvFromUpperLayers()
void CsmaCa::recvFromUpperLayers |
( |
Packet * |
p | ) |
|
|
protectedvirtual |
Receives the packet from the upper layer (e.g.
IP)
- Parameters
-
Packet* | pointer to the packet received |
Definition at line 509 of file uw-csma-ca.cpp.
◆ state_Backoff()
void CsmaCa::state_Backoff |
( |
int |
tx_time | ) |
|
|
protectedvirtual |
Backoff state.
- Parameters
-
int | Transmission time sent on over-heared RTS |
Definition at line 463 of file uw-csma-ca.cpp.
◆ state_Idle()
void CsmaCa::state_Idle |
( |
| ) |
|
|
protectedvirtual |
◆ state_Wait_ACK()
void CsmaCa::state_Wait_ACK |
( |
| ) |
|
|
protectedvirtual |
Wait for an ACK after a data transmission.
Definition at line 479 of file uw-csma-ca.cpp.
◆ state_Wait_CTS()
void CsmaCa::state_Wait_CTS |
( |
| ) |
|
|
protectedvirtual |
◆ state_Wait_Data()
void CsmaCa::state_Wait_Data |
( |
| ) |
|
|
protectedvirtual |
◆ stateRxACK()
int CsmaCa::stateRxACK |
( |
Packet * |
ack | ) |
|
|
protectedvirtual |
Reception of an ACK packet.
- Parameters
-
hdr_ca_ACK* | pointer to RTS header in packet |
int | source MAC of packet |
int | destination MAC of the packet |
Definition at line 321 of file uw-csma-ca.cpp.
◆ stateRxCTS()
int CsmaCa::stateRxCTS |
( |
hdr_ca_CTS * |
cts, |
|
|
int |
mac_src, |
|
|
int |
mac_dst |
|
) |
| |
|
protectedvirtual |
Reception of an CTS packet.
- Parameters
-
hdr_ca_CTS* | pointer to RTS header in packet |
int | source MAC of packet |
int | destination MAC of the packet |
Definition at line 437 of file uw-csma-ca.cpp.
◆ stateRxData()
int CsmaCa::stateRxData |
( |
Packet * |
p | ) |
|
|
protectedvirtual |
Transmit a data packet.
- Parameters
-
Packet* | Pointer to data packet to be transmitted |
Definition at line 352 of file uw-csma-ca.cpp.
◆ stateRxRTS()
int CsmaCa::stateRxRTS |
( |
hdr_ca_RTS * |
rts, |
|
|
int |
mac_src, |
|
|
int |
mac_dst |
|
) |
| |
|
protectedvirtual |
Reception of an RTS packet.
- Parameters
-
hdr_ca_RTS* | pointer to RTS header in packet |
int | source MAC of packet |
int | destination MAC of the packet |
Definition at line 380 of file uw-csma-ca.cpp.
◆ stateTxAck()
void CsmaCa::stateTxAck |
( |
int |
mac_dst | ) |
|
|
protectedvirtual |
Tranmission of an ACK.
- Parameters
-
int | destination MAC address |
Definition at line 344 of file uw-csma-ca.cpp.
◆ stateTxCTS()
void CsmaCa::stateTxCTS |
( |
| ) |
|
|
protectedvirtual |
◆ stateTxData()
int CsmaCa::stateTxData |
( |
| ) |
|
|
protectedvirtual |
◆ txAck()
Actually transmit an ACK.
◆ txCTS()
int CsmaCa::txCTS |
( |
int |
mac_dest | ) |
|
|
private |
Actually transmit a CTS packet.
- Parameters
-
Definition at line 572 of file uw-csma-ca.cpp.
◆ txData()
◆ txRTS()
int CsmaCa::txRTS |
( |
int |
mac_dest | ) |
|
|
private |
Actually transmit a RTS packet.
- Parameters
-
Definition at line 559 of file uw-csma-ca.cpp.
◆ updateState()
Update the state of the protocol.
- Parameters
-
Definition at line 181 of file uw-csma-ca.h.
◆ ack_mode
◆ ack_pkt_dropped
int CsmaCa::ack_pkt_dropped |
|
private |
◆ ack_timer
◆ ack_wait_val
◆ actual_data_packet
Packet* CsmaCa::actual_data_packet |
|
private |
Pointer to DATA packet we are handling.
Definition at line 390 of file uw-csma-ca.h.
◆ actual_expected_tx_time
int CsmaCa::actual_expected_tx_time |
|
private |
Tx time of DATA packet we are handling.
Definition at line 389 of file uw-csma-ca.h.
◆ actual_mac_data_src
int CsmaCa::actual_mac_data_src |
|
private |
Source MAC of DATA packet we are handling.
Definition at line 388 of file uw-csma-ca.h.
◆ backoff_delta
int CsmaCa::backoff_delta |
|
private |
Delta value (configurable) to be added to backoff.
Definition at line 381 of file uw-csma-ca.h.
◆ backoff_max
Maximum value in range of backoff.
Definition at line 382 of file uw-csma-ca.h.
◆ backoff_timer
◆ bitrate
◆ cts_pkt_dropped
int CsmaCa::cts_pkt_dropped |
|
private |
◆ cts_timer
◆ cts_wait_val
◆ data_pkt_dropped
int CsmaCa::data_pkt_dropped |
|
private |
◆ data_q
std::queue<Packet *> CsmaCa::data_q |
|
private |
◆ data_size
◆ data_timer
◆ data_wait_val
int CsmaCa::data_wait_val |
|
private |
◆ log_level
Current log level chosen for protocol.
Definition at line 398 of file uw-csma-ca.h.
◆ logfile
◆ max_queue_size
int CsmaCa::max_queue_size |
|
private |
◆ n_cts_rx
◆ n_rts_rx
◆ outLog
std::ofstream CsmaCa::outLog |
|
private |
◆ previous_state
Previous state of the protocol.
Definition at line 394 of file uw-csma-ca.h.
◆ rts_pkt_dropped
int CsmaCa::rts_pkt_dropped |
|
private |
◆ state
Current state of the protocol.
Definition at line 393 of file uw-csma-ca.h.
The documentation for this class was generated from the following files: