DESERT 4.0.0
Uwjammer Class Reference

#include <uwjammer.h>

Inheritance diagram for Uwjammer:
Inheritance graph
Collaboration diagram for Uwjammer:
Collaboration graph

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
 

Detailed Description

Class that describes a Uwjammer module

Member Enumeration Documentation

◆ JammerStatus

enum class Uwjammer::JammerStatus
strongprotected

Enum that rapresents the status of the protocol machine state.

Enumerator
IDLE 
BUSY 

Constructor & Destructor Documentation

◆ Uwjammer()

Uwjammer::Uwjammer ( )

Constructor of the class

References buffer_data_pkts, curr_state, IDLE, and MAX_BUFFER_SIZE.

◆ ~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.

References getDataDiscarded(), getJamDiscarded(), getJamSent(), and Q_data.

Here is the call graph for this function:

◆ 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.

◆ 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

References n_data_discarded.

Referenced by command().

◆ 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

References n_jam_discarded.

Referenced by command().

◆ 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

References n_jam_sent.

Referenced by command().

◆ 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

References BUSY, and refreshState().

Referenced by txJam().

Here is the call graph for this function:

◆ 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

References n_data_discarded.

◆ 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

References IDLE, refreshState(), and stateIdle().

Here is the call graph for this function:

◆ recvFromUpperLayers()

void Uwjammer::recvFromUpperLayers ( Packet *  p)
overrideprotectedvirtual

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

Parameters
Packet*pointer to the packet received

References buffer_data_pkts, curr_state, IDLE, n_jam_discarded, Q_data, and txJam().

Here is the call graph for this function:

◆ refreshState()

virtual void Uwjammer::refreshState ( JammerStatus  state)
inlineprotectedvirtual

Refresh the state of the protocol.

Parameters
JammerStatuscurrent state of the protcol

References curr_state.

Referenced by Mac2PhyStartTx(), and Phy2MacEndTx().

◆ stateIdle()

void Uwjammer::stateIdle ( )
protectedvirtual

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

References Q_data, and txJam().

Referenced by Phy2MacEndTx().

Here is the call graph for this function:

◆ txJam()

void Uwjammer::txJam ( )
protectedvirtual

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

References curr_data_pkt, hdr_JAMMER::id_node(), Mac2PhyStartTx(), n_jam_sent, node_id, PT_JAMMER, and Q_data.

Referenced by recvFromUpperLayers(), and stateIdle().

Here is the call graph for this function:

Member Data Documentation

◆ buffer_data_pkts

int Uwjammer::buffer_data_pkts
protected

Size of the buffer in number of packets.

Referenced by recvFromUpperLayers(), and Uwjammer().

◆ curr_data_pkt

Packet* Uwjammer::curr_data_pkt
protected

Pointer to the current DATA packet.

Referenced by txJam().

◆ curr_state

JammerStatus Uwjammer::curr_state
protected

Current state of the protocol.

Referenced by recvFromUpperLayers(), refreshState(), and Uwjammer().

◆ JAMMER_uid

uint Uwjammer::JAMMER_uid
protected

JAMMER Unique ID.

◆ MAX_BUFFER_SIZE

constexpr const int Uwjammer::MAX_BUFFER_SIZE
staticconstexprprotected
Initial value:
=
100

Maximum size of the queue in number of packets.

Referenced by Uwjammer().

◆ n_data_discarded

size_t Uwjammer::n_data_discarded
protected

Number of packets received and discarded.

Referenced by getDataDiscarded(), and Phy2MacEndRx().

◆ n_jam_discarded

size_t Uwjammer::n_jam_discarded
protected

Number of packets discarded because the buffer is full.

Referenced by getJamDiscarded(), and recvFromUpperLayers().

◆ n_jam_sent

size_t Uwjammer::n_jam_sent
protected

Number of packets sent.

Referenced by getJamSent(), and txJam().

◆ node_id

uint Uwjammer::node_id
protected

Unique Node ID.

Referenced by txJam().

◆ Q_data

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

Queue of DATA in number of packets.

Referenced by command(), recvFromUpperLayers(), stateIdle(), and txJam().

◆ status_info

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

Textual info of the state.


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