52#define DROP_REASON_SNR "SNR"
53#define DROP_REASON_NOTFORME "NFM"
54#define DROP_REASON_NOTRIGHTSTATE "NRS"
55#define DROP_REASON_GENERICERROR "ERR"
110 virtual void expire(Event *e);
127 virtual int command(
int argc,
const char *
const *argv);
296#define LOGERR(log) printonLog(CSMA_CA_ERROR, log);
297#define LOGDBG(log) printonLog(CSMA_CA_DEBUG, log);
298#define LOGWRN(log) printonLog(CSMA_CA_WARN, log);
299#define LOGINFO(log) printonLog(CSMA_CA_INFO, log);
320 int txRTS(
int mac_dest);
325 int txCTS(
int mac_dest);
CsmaCa *csma_ca_timers_t timer_type
virtual void expire(Event *e)
CsmaCaTimer(CsmaCa *m, csma_ca_timers_t tt)
Class that describes a CsmaAloha module.
string logfile
File name of log.
int cts_wait_val
Timer duration of CTS.
int max_queue_size
Maximum dimension of Queue.
void extractDataPacket()
Extract data packet from queue.
int cts_pkt_dropped
CTS packet dropped.
Packet * buildPacket(int mac_dest, csma_ca_pkt_type_t type, uint8_t tx_time)
Build a generic packet.
virtual void state_Wait_ACK()
Wait for an ACK after a data transmission.
time_t getEpoch()
Return the system epoch.
virtual int stateTxData()
Transmission of a DATA packet.
csma_ca_states_t state
Current state of the protocol.
int n_rts_rx
RTS received.
int n_cts_rx
CTS received.
virtual int stateRxACK(Packet *ack)
Reception of an ACK packet.
int data_pkt_dropped
DATA packet dropped.
virtual void initializeLog()
Initializes the protocol at the beginning of the simulation.
int data_wait_val
Timer duration of DATA.
void ack_timer_fired()
ACK timer is expired.
int txData()
Actually transmit a DATA packet.
void data_timer_fired()
data timer is expired
virtual void Phy2MacStartRx(const Packet *p)
Method called when the Phy Layer start to receive a Packet.
CsmaCaTimer ack_timer
ACK timer.
std::queue< Packet * > data_q
Size of DATA packet.
virtual void state_Backoff(int tx_time)
Backoff state.
string getLogFile()
Return name of the log file.
int actual_mac_data_src
Source MAC of DATA packet we are handling.
virtual int stateRxCTS(hdr_ca_CTS *cts, int mac_src, int mac_dst)
Reception of an CTS packet.
virtual void state_Idle()
Protocol in IDLE state.
void buildRTShdr(hdr_ca_RTS **rts, uint8_t tx_time)
Build an RTS header.
void backoff_timer_fired()
backoff timer is expired
void buildCTShdr(hdr_ca_CTS **cts, uint8_t tx_time)
Build an CTS header.
void printonLog(csma_ca_log_level_t level, string log)
Print a message on log file.
virtual void dropPacket(Packet *p, csma_ca_pkt_type_t type, char *reason)
Drop the packet logging the reason and incrementing the counters.
virtual void state_Wait_CTS()
Waiting for CTS packet.
virtual int stateRxData(Packet *p)
Transmit a data packet.
int getQueueSize()
Return the size of the data packet queue.
virtual void stateTxCTS()
Transmission of a CTS packet.
int data_size
Size of DATA packet.
CsmaCaTimer backoff_timer
Backoff timer.
int txRTS(int mac_dest)
Actually transmit a RTS packet.
Packet * actual_data_packet
Pointer to DATA packet we are handling.
int ack_pkt_dropped
ACK packet dropped.
int backoff_max
Maximum value in range of backoff.
virtual int stateRxRTS(hdr_ca_RTS *rts, int mac_src, int mac_dst)
Reception of an RTS packet.
int actual_expected_tx_time
Tx time of DATA packet we are handling.
csma_ca_log_level_t getLogLevel()
Return the current log level of the protocol.
virtual void stateTxAck(int mac_dst)
Tranmission of an ACK.
int computeTxTime()
Compute transmission time of a packet using known bitrate.
int ack_wait_val
Timer duration of ACK.
CsmaCaTimer data_timer
Data timer.
virtual void Mac2PhyStartTx(Packet *p)
Pass the packet to the PHY layer.
csma_ca_log_level_t log_level
Current log level chosen for protocol.
virtual int command(int argc, const char *const *argv)
TCL command interpreter.
virtual void state_Wait_Data()
Waiting for DATA packet.
int bitrate
Bit rate adopted.
int txCTS(int mac_dest)
Actually transmit a CTS packet.
virtual void Phy2MacEndRx(Packet *p)
Method called when the Phy Layer finish to receive a Packet.
virtual void Phy2MacEndTx(const Packet *p)
Method called when the PHY layer finish to transmit the packet.
std::ofstream outLog
Stdout stream of log.
int backoff_delta
Delta value (configurable) to be added to backoff.
void cts_timer_fired()
CTS timer is expired.
csma_ca_states_t previous_state
Previous state of the protocol.
CsmaCaTimer cts_timer
CTS timer.
virtual void recvFromUpperLayers(Packet *p)
Receives the packet from the upper layer (e.g.
void updateState(csma_ca_states_t s)
Update the state of the protocol.
int txAck()
Actually transmit an ACK.
ack_modes_t ack_mode
ACK mode (configurable.
csma_ca_states_t getState()
Get the state of the protocol.
int rts_pkt_dropped
RTS packet dropped.
Provides the headers of ctrl packets of uw-csma-ca module.
enum CSMA_CA_PKT_TYPE csma_ca_pkt_type_t
enum log_level csma_ca_log_level_t
enum CSMA_CA_TIMERS csma_ca_timers_t
enum CSMA_CA_STATES csma_ca_states_t
enum CSMA_CA_ACK_MODES ack_modes_t
string log_level_string[]