#include <uwtokenbus.h>
Class that represents a TokenBus Node.
Definition at line 51 of file uwtokenbus.h.
◆ UWTokenBus_STATUS
Enumerator |
---|
IDLE | |
TRANSMITTING | |
RECEIVING | |
Definition at line 120 of file uwtokenbus.h.
◆ UwTokenBus()
UwTokenBus::UwTokenBus |
( |
| ) |
|
Default constructor of the TokenBus class.
Definition at line 93 of file uwtokenbus.cpp.
◆ ~UwTokenBus()
UwTokenBus::~UwTokenBus |
( |
| ) |
|
|
virtual |
◆ command()
int UwTokenBus::command |
( |
int |
argc, |
|
|
const char *const * |
argv |
|
) |
| |
|
overrideprotectedvirtual |
TCL command interpreter.
It implements the following OTcl methods:
- Parameters
-
argc | Number of arguments in argv. |
argv | Array 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.
Reimplemented in UwRangingTokenBus.
Definition at line 469 of file uwtokenbus.cpp.
◆ expireBusIdle()
void UwTokenBus::expireBusIdle |
( |
| ) |
|
|
protectedvirtual |
◆ expireTokenPass()
void UwTokenBus::expireTokenPass |
( |
| ) |
|
|
protectedvirtual |
◆ initPkt()
void UwTokenBus::initPkt |
( |
Packet * |
p | ) |
|
|
protectedvirtual |
Method called to add the MAC header size.
- Parameters
-
p | pointer to a Packet object that rapresent the Packet in transmission |
Definition at line 439 of file uwtokenbus.cpp.
◆ initRing()
void UwTokenBus::initRing |
( |
| ) |
|
|
protectedvirtual |
Initialize the network and generates the first token.
Definition at line 192 of file uwtokenbus.cpp.
◆ Mac2PhyStartTx()
void UwTokenBus::Mac2PhyStartTx |
( |
Packet * |
p | ) |
|
|
protectedvirtual |
Method called when the Mac Layer start to transmit a Packet.
- Parameters
-
p | pointer to a packet object that rapresent the packet in transmission |
Definition at line 316 of file uwtokenbus.cpp.
◆ nextId()
int UwTokenBus::nextId |
( |
int |
id | ) |
const |
|
protectedvirtual |
◆ nextIdOwned()
int UwTokenBus::nextIdOwned |
( |
int |
id | ) |
const |
|
protectedvirtual |
- Returns
- next token id owned by this node
Definition at line 263 of file uwtokenbus.cpp.
◆ NMOD()
constexpr int UwTokenBus::NMOD |
( |
int |
n | ) |
|
|
inlineconstexprprotected |
given any int returns the corresponding node id via modulo operations
Definition at line 265 of file uwtokenbus.h.
◆ normId()
int UwTokenBus::normId |
( |
int |
id | ) |
const |
|
protectedvirtual |
◆ Phy2MacEndRx()
void UwTokenBus::Phy2MacEndRx |
( |
Packet * |
p | ) |
|
|
overrideprotectedvirtual |
Method called when the Phy Layer finish to receive a Packet.
- Parameters
-
p | pointer to a Packet object that rapresent the Packet in reception |
Reimplemented in UwRangingTokenBus.
Definition at line 365 of file uwtokenbus.cpp.
◆ Phy2MacEndTx()
void UwTokenBus::Phy2MacEndTx |
( |
const Packet * |
p | ) |
|
|
overrideprotectedvirtual |
Method called when the Mac Layer finish to transmit a Packet.
- Parameters
-
p | pointer to a Packet object that rapresent the Packet in transmission |
Definition at line 333 of file uwtokenbus.cpp.
◆ Phy2MacStartRx()
void UwTokenBus::Phy2MacStartRx |
( |
const Packet * |
p | ) |
|
|
overrideprotectedvirtual |
Method called when the Phy Layer start to receive a Packet.
- Parameters
-
p | pointer to a packet object that rapresent the Packet in reception |
Definition at line 342 of file uwtokenbus.cpp.
◆ recvFromUpperLayers()
void UwTokenBus::recvFromUpperLayers |
( |
Packet * |
p | ) |
|
|
overrideprotectedvirtual |
Receive the packet from the upper layer (e.g.
IP)
- Parameters
-
p | pointer to the packet received |
Definition at line 197 of file uwtokenbus.cpp.
◆ sendToken()
void UwTokenBus::sendToken |
( |
int |
next_id | ) |
|
|
protectedvirtual |
◆ txData()
void UwTokenBus::txData |
( |
| ) |
|
|
protectedvirtual |
Starts transmitting the packets from the queue.
Definition at line 271 of file uwtokenbus.cpp.
◆ validToken()
bool UwTokenBus::validToken |
( |
Packet * |
p | ) |
const |
|
protectedvirtual |
Assert if the received token id is valid, i.e it follows the monotonic progression taking in account uint16 overflow.
- Parameters
-
Reimplemented in UwRangingTokenBus.
Definition at line 353 of file uwtokenbus.cpp.
◆ buffer
std::deque<Packet *> UwTokenBus::buffer |
|
protected |
◆ bus_idle_timeout
double UwTokenBus::bus_idle_timeout |
|
protected |
base timeout for the namesake timer should be (slot_time+max_token_hold_time)
Definition at line 243 of file uwtokenbus.h.
◆ bus_idle_timer
token_pass_timer is scheduled when a node pass the token, it's cancelled when activity from the following node is heard and when it expires it resends the token.
Definition at line 247 of file uwtokenbus.h.
◆ checkPriority
int UwTokenBus::checkPriority |
|
protected |
flag to set to 1 if UWCBR module uses packets with priority, set to 0 otherwise.
Priority can be used only with UWCBR module
Definition at line 259 of file uwtokenbus.h.
◆ count_bus_idle_exp
int UwTokenBus::count_bus_idle_exp = -1 |
|
staticprotected |
count bus idle timer expirations
Definition at line 264 of file uwtokenbus.h.
◆ count_nodes
int UwTokenBus::count_nodes = 0 |
|
staticprotected |
counter of the instantiated nodes, used for assigning node ids in default contructor
Definition at line 262 of file uwtokenbus.h.
◆ count_token_invalid
int UwTokenBus::count_token_invalid |
|
protected |
node count of invalid received token
Definition at line 254 of file uwtokenbus.h.
◆ count_token_pass_exp
int UwTokenBus::count_token_pass_exp = 0 |
|
staticprotected |
count token pass timer expirations
Definition at line 263 of file uwtokenbus.h.
◆ count_token_regen
int UwTokenBus::count_token_regen |
|
protected |
node count of token regeneration
Definition at line 253 of file uwtokenbus.h.
◆ count_token_resend
int UwTokenBus::count_token_resend |
|
protected |
bus_idle_timer is rescheduled everytime a new token_id is heard on the bus: the first time node n hears a token_id meant to node k, it sets the timeout to (3*(n-k+1)*bus_idle_timeout) in order to allow all the previous nodes to regenerate the token first When it expires, it regenerates the token and starts transmitting.
node count of token retransmissions
Definition at line 252 of file uwtokenbus.h.
◆ debug
Debug variable: 0 for no info.
Definition at line 256 of file uwtokenbus.h.
◆ drop_old_
int UwTokenBus::drop_old_ |
|
protected |
flag to set the drop packet policy in case of buffer overflow: if 0 (default) drops the new packet, if 1 the oldest
Definition at line 257 of file uwtokenbus.h.
◆ got_token
bool UwTokenBus::got_token |
|
protected |
set if node is currently holding the token
Definition at line 240 of file uwtokenbus.h.
◆ last_token_id_heard
int UwTokenBus::last_token_id_heard = 0 |
|
protected |
last token id heard on the bus
Definition at line 231 of file uwtokenbus.h.
◆ last_token_id_owned
int UwTokenBus::last_token_id_owned = 0 |
|
protected |
◆ max_queue_size
int UwTokenBus::max_queue_size |
|
protected |
◆ max_token_hold_time
double UwTokenBus::max_token_hold_time |
|
protected |
◆ min_token_hold_time
double UwTokenBus::min_token_hold_time |
|
protected |
if the node has en empty queue when it receive the token, it waits this time before passing the token
Definition at line 235 of file uwtokenbus.h.
◆ n_nodes
◆ node_id
id of the node (0 to n_nodes-1)
Definition at line 229 of file uwtokenbus.h.
◆ rtx_status
◆ slot_time
double UwTokenBus::slot_time |
|
protected |
max travel time between any pair of nodes, used as time unit for some of the timers timeouts
Definition at line 241 of file uwtokenbus.h.
◆ token_pass_timeout
double UwTokenBus::token_pass_timeout |
|
protected |
timeout for the namesake timer for token retransmission attempt, should be 2*slot_time+min_token_hold_time
Definition at line 242 of file uwtokenbus.h.
◆ token_pass_timer
◆ token_rx_time
double UwTokenBus::token_rx_time |
|
protected |
The documentation for this class was generated from the following files: