88 virtual void expire(Event *e);
116 virtual void expire(Event *e);
166 virtual int normId(
int id)
const;
171 virtual int nextId(
int id)
const;
214 virtual void initPkt(Packet *p);
227 virtual int command(
int argc,
const char *
const *argv)
override;
TimerBusIdle when expires calls UwTokenBus::TxData() to start the transmission.
TimerBusIdle(UwTokenBus *m)
Costructor of the class TimerBusIdle.
virtual void expire(Event *e)
Method call when the timer expire.
TimerTokenPass when expires it resends the token.
TimerTokenPass(UwTokenBus *m)
Costructor of the class TimerTokenPass.
virtual void expire(Event *e)
Method call when the timer expire.
Class that represents a TokenBus Node.
UWTokenBus_STATUS rtx_status
int count_token_invalid
node count of invalid received token
double token_pass_timeout
timeout for the namesake timer for token retransmission attempt, should be 2*slot_time+min_token_hold...
double min_token_hold_time
if the node has en empty queue when it receive the token, it waits this time before passing the token
virtual void initRing()
Initialize the network and generates the first token.
virtual void expireBusIdle()
called when bus_idle_timer expires
int debug
Debug variable: 0 for no info.
double slot_time
max travel time between any pair of nodes, used as time unit for some of the timers timeouts
virtual void Phy2MacEndTx(const Packet *p) override
Method called when the Mac Layer finish to transmit a Packet.
virtual int nextIdOwned(int id) const
static int count_token_pass_exp
count token pass timer expirations
virtual ~UwTokenBus()
Destructor of the TokenBus class.
TimerBusIdle bus_idle_timer
token_pass_timer is scheduled when a node pass the token, it's cancelled when activity from the follo...
int n_nodes
number of nodes in the ring
virtual int normId(int id) const
virtual void recvFromUpperLayers(Packet *p) override
Receive the packet from the upper layer (e.g.
virtual void Mac2PhyStartTx(Packet *p)
Method called when the Mac Layer start to transmit a Packet.
virtual int nextId(int id) const
static int count_nodes
counter of the instantiated nodes, used for assigning node ids in default contructor
virtual int command(int argc, const char *const *argv) override
TCL command interpreter.
constexpr int NMOD(int n)
given any int returns the corresponding node id via modulo operations
double bus_idle_timeout
base timeout for the namesake timer should be (slot_time+max_token_hold_time)
double token_rx_time
time of token reception
virtual void Phy2MacStartRx(const Packet *p) override
Method called when the Phy Layer start to receive a Packet.
std::deque< Packet * > buffer
outgoing packets dequeue
TimerTokenPass token_pass_timer
int last_token_id_heard
last token id heard on the bus
int count_token_regen
node count of token regeneration
int drop_old_
flag to set the drop packet policy in case of buffer overflow: if 0 (default) drops the new packet,...
bool got_token
set if node is currently holding the token
virtual void Phy2MacEndRx(Packet *p) override
Method called when the Phy Layer finish to receive a Packet.
int last_token_id_owned
last token id owned
int max_queue_size
max packets in the queue
virtual void initPkt(Packet *p)
Method called to add the MAC header size.
virtual void sendToken(int next_id)
Passes the token to the next node.
int node_id
id of the node (0 to n_nodes-1)
int checkPriority
flag to set to 1 if UWCBR module uses packets with priority, set to 0 otherwise.
virtual void txData()
Starts transmitting the packets from the queue.
int count_token_resend
bus_idle_timer is rescheduled everytime a new token_id is heard on the bus: the first time node n hea...
virtual bool validToken(Packet *p) const
Assert if the received token id is valid, i.e it follows the monotonic progression taking in account ...
virtual void expireTokenPass()
called when token_pass_timer expires
static int count_bus_idle_exp
count bus idle timer expirations
UwTokenBus()
Default constructor of the TokenBus class.
double max_token_hold_time
max token holding time
Common structures and variables in the protocol.