46#define UWJAMMER_DROP_REASON_BUFFER_FULL\
48#define UWJAMMER_DROP_REASON_JAMMER_PROTOCOL \
77 virtual int command(
int argc,
const char *
const *argv)
override;
106 virtual void txJam();
174 static const std::map<JammerStatus, std::string>
status_info;
Class that describes a Uwjammer module.
int getJamSent() const
Returns the number of packets sent during the simulation.
int getJamDiscarded() const
Returns the number of packets discarded during the simulation because the buffer is full.
size_t n_data_discarded
Number of packets received and discarded.
JammerStatus curr_state
Current state of the protocol.
virtual void txJam()
Transmits the jam packet (calling Mac2PhyStartTx) and increment the counter of transmitted jam packet...
size_t n_jam_sent
Number of packets sent.
JammerStatus
Enum that rapresents the status of the protocol machine state.
int buffer_data_pkts
Size of the buffer in number of packets.
std::queue< Packet * > Q_data
Queue of DATA in number of packets.
int getDataDiscarded() const
Returns the number of packets received and discarded during the simulation.
uint JAMMER_uid
JAMMER Unique ID.
virtual void Phy2MacEndRx(Packet *p) override
Method called when the Phy Layer finish to receive a Packet.
virtual int crLayCommand(ClMessage *m) override
Cross-Layer messages interpreter.
uint node_id
Unique Node ID.
virtual ~Uwjammer()=default
Destructor of the class.
virtual void stateIdle()
IDLE state, check if there is at least one more packet to transmit.
virtual int command(int argc, const char *const *argv) override
TCL command interpreter.
static constexpr const int MAX_BUFFER_SIZE
Maximum size of the queue in number of packets.
size_t n_jam_discarded
Number of packets discarded because the buffer is full.
virtual void recvFromUpperLayers(Packet *p) override
Receives the packet from the upper layer (e.g.
Packet * curr_data_pkt
Pointer to the current DATA packet.
static const std::map< JammerStatus, std::string > status_info
Textual info of the state.
virtual void Mac2PhyStartTx(Packet *p)
Pass the packet to the PHY layer.
Uwjammer()
Constructor of the class.
virtual void Phy2MacEndTx(const Packet *p) override
Method called when the PHY layer finish to transmit the packet.
virtual void refreshState(JammerStatus state)
Refresh the state of the protocol.