DESERT 3.5.1
Loading...
Searching...
No Matches
Uwjammer Class Reference

#include <uwjammer.h>

Inheritance diagram for Uwjammer:
Collaboration diagram for Uwjammer:

Public Member Functions

 Uwjammer ()
 
virtual ~Uwjammer ()=default
 
virtual int command (int argc, const char *const *argv) override
 
virtual int crLayCommand (ClMessage *m) override
 

Protected Types

enum class  JammerStatus { IDLE = 1 , BUSY }
 

Protected Member Functions

virtual void recvFromUpperLayers (Packet *p) override
 
virtual void txJam ()
 
virtual void Mac2PhyStartTx (Packet *p)
 
virtual void Phy2MacEndTx (const Packet *p) override
 
virtual void stateIdle ()
 
virtual void Phy2MacEndRx (Packet *p) override
 
int getJamSent () const
 
int getJamDiscarded () const
 
int getDataDiscarded () const
 
virtual void refreshState (JammerStatus state)
 

Protected Attributes

int buffer_data_pkts
 
uint node_id
 
uint JAMMER_uid
 
size_t n_jam_sent
 
size_t n_jam_discarded
 
size_t n_data_discarded
 
Packet * curr_data_pkt
 
std::queue< Packet * > Q_data
 
JammerStatus curr_state
 

Static Protected Attributes

static const std::map< JammerStatus, std::string > status_info
 
static constexpr const int MAX_BUFFER_SIZE = 100
 

Detailed Description

Class that describes a Uwjammer module.

Definition at line 54 of file uwjammer.h.

Member Enumeration Documentation

◆ JammerStatus

enum class Uwjammer::JammerStatus
strongprotected

Enum that rapresents the status of the protocol machine state.

Enumerator
IDLE 
BUSY 

Definition at line 93 of file uwjammer.h.

Constructor & Destructor Documentation

◆ Uwjammer()

Uwjammer::Uwjammer ( )

Constructor of the class.

Definition at line 73 of file uwjammer.cpp.

◆ ~Uwjammer()

virtual Uwjammer::~Uwjammer ( )
virtualdefault

Destructor of the class.

Member Function Documentation

◆ command()

int Uwjammer::command ( int  argc,
const char *const *  argv 
)
overridevirtual

TCL command interpreter.

It implements the following OTcl methods:

Parameters
argcNumber of arguments in argv.
argvArray 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 92 of file uwjammer.cpp.

◆ crLayCommand()

int Uwjammer::crLayCommand ( ClMessage *  m)
overridevirtual

Cross-Layer messages interpreter.

Parameters
ClMessage*an instance of ClMessage that represent the message received
Returns
0 if successful.

Definition at line 134 of file uwjammer.cpp.

◆ getDataDiscarded()

int Uwjammer::getDataDiscarded ( ) const
inlineprotected

Returns the number of packets received and discarded during the simulation.

Returns
int n_data_discarded the number of packets sent

Definition at line 154 of file uwjammer.h.

◆ getJamDiscarded()

int Uwjammer::getJamDiscarded ( ) const
inlineprotected

Returns the number of packets discarded during the simulation because the buffer is full.

Returns
int n_jam_discarded the number of packets discarded

Definition at line 147 of file uwjammer.h.

◆ getJamSent()

int Uwjammer::getJamSent ( ) const
inlineprotected

Returns the number of packets sent during the simulation.

Returns
int n_jam_sent the number of packets sent

Definition at line 140 of file uwjammer.h.

◆ Mac2PhyStartTx()

void Uwjammer::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 190 of file uwjammer.cpp.

◆ Phy2MacEndRx()

void Uwjammer::Phy2MacEndRx ( Packet *  p)
overrideprotectedvirtual

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 221 of file uwjammer.cpp.

◆ Phy2MacEndTx()

void Uwjammer::Phy2MacEndTx ( const Packet *  p)
overrideprotectedvirtual

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 201 of file uwjammer.cpp.

◆ recvFromUpperLayers()

void Uwjammer::recvFromUpperLayers ( Packet *  p)
overrideprotectedvirtual

Receives the packet from the upper layer (e.g.

IP)

Parameters
Packet*pointer to the packet received

Definition at line 143 of file uwjammer.cpp.

◆ refreshState()

virtual void Uwjammer::refreshState ( JammerStatus  state)
inlineprotectedvirtual

Refresh the state of the protocol.

Parameters
JammerStatuscurrent state of the protcol

Definition at line 161 of file uwjammer.h.

◆ stateIdle()

void Uwjammer::stateIdle ( )
protectedvirtual

IDLE state, check if there is at least one more packet to transmit.

Definition at line 214 of file uwjammer.cpp.

◆ txJam()

void Uwjammer::txJam ( )
protectedvirtual

Transmits the jam packet (calling Mac2PhyStartTx) and increment the counter of transmitted jam packets.

Definition at line 167 of file uwjammer.cpp.

Member Data Documentation

◆ buffer_data_pkts

int Uwjammer::buffer_data_pkts
protected

Size of the buffer in number of packets.

Definition at line 163 of file uwjammer.h.

◆ curr_data_pkt

Packet* Uwjammer::curr_data_pkt
protected

Pointer to the current DATA packet.

Definition at line 170 of file uwjammer.h.

◆ curr_state

JammerStatus Uwjammer::curr_state
protected

Current state of the protocol.

Definition at line 173 of file uwjammer.h.

◆ JAMMER_uid

uint Uwjammer::JAMMER_uid
protected

JAMMER Unique ID.

Definition at line 165 of file uwjammer.h.

◆ MAX_BUFFER_SIZE

constexpr const int Uwjammer::MAX_BUFFER_SIZE = 100
staticconstexprprotected

Maximum size of the queue in number of packets.

Definition at line 176 of file uwjammer.h.

◆ n_data_discarded

size_t Uwjammer::n_data_discarded
protected

Number of packets received and discarded.

Definition at line 168 of file uwjammer.h.

◆ n_jam_discarded

size_t Uwjammer::n_jam_discarded
protected

Number of packets discarded because the buffer is full.

Definition at line 167 of file uwjammer.h.

◆ n_jam_sent

size_t Uwjammer::n_jam_sent
protected

Number of packets sent.

Definition at line 166 of file uwjammer.h.

◆ node_id

uint Uwjammer::node_id
protected

Unique Node ID.

Definition at line 164 of file uwjammer.h.

◆ Q_data

std::queue<Packet *> Uwjammer::Q_data
protected

Queue of DATA in number of packets.

Definition at line 171 of file uwjammer.h.

◆ status_info

const std::map< Uwjammer::JammerStatus, std::string > Uwjammer::status_info
staticprotected
Initial value:

Textual info of the state.

Definition at line 44 of file uwjammer.h.


The documentation for this class was generated from the following files: