#include <LiveBroadcastTable.h>
Inheritance diagram for LiveBroadcastTable::
Public Methods | |
LiveBroadcastTable () | |
Creates a live broadcast table and starts the onTick thread. More... | |
virtual | ~LiveBroadcastTable () |
void | addId (unsigned int id, Node *from) |
Add the specified broadcast ID to the table. More... | |
bool | hasId (unsigned int id, Node **from) |
Return true if the ID is in the table. More... | |
bool | hasNode (Node *) |
Returns true if the Node exists in the table. More... | |
int | nodeCount (Node *) |
Returns the number of times the Node appears in the table. More... | |
virtual void | toStream (std::ostream &) |
Print the live broadcast table. More... | |
Static Public Methods | |
void * | onTick (void *) |
A thread that ticks through the entries in the live broadcast table. More... | |
Protected Types | |
typedef vector< NodeId > | TimeSlice |
Protected Attributes | |
vector< TimeSlice > | m_broadcastId |
int | m_curPos |
bool | m_dead |
pthread_t | m_liveBroadcastThreadId |
Mutex | m_lock |
Condition | m_cond |
When you receive any IMHERE packets, you then know who to send them back to.
It also keeps track of the discovery ID so that packets do not endlessly propogate. It keeps a list of broadcast IDs, and slowly expires them.
The table is a vector of vectors. Each position in the table is a "Timeslice". Within that timeslice are all the broadcasts we have received within that time period (which equals BROADCAST_LIFE).
Definition at line 27 of file LiveBroadcastTable.h.
|
Definition at line 40 of file LiveBroadcastTable.h. |
|
Creates a live broadcast table and starts the onTick thread.
Definition at line 21 of file LiveBroadcastTable.cpp. |
|
Definition at line 47 of file LiveBroadcastTable.cpp. |
|
Add the specified broadcast ID to the table.
Definition at line 60 of file LiveBroadcastTable.cpp. Referenced by NetworkLayer::handleDiscoveryPacket().
|
|
Return true if the ID is in the table. If the node is found in the table, a pointer to the node is returned in the second parameter. This is a linear search. Definition at line 72 of file LiveBroadcastTable.cpp. Referenced by NetworkLayer::handleDiscoveryPacket(), and NetworkLayer::handleImHerePacket().
|
|
Returns true if the Node exists in the table.
Definition at line 95 of file LiveBroadcastTable.cpp. |
|
Returns the number of times the Node appears in the table.
Definition at line 114 of file LiveBroadcastTable.cpp. Referenced by NetworkLayer::handleDiscoveryPacket().
|
|
A thread that ticks through the entries in the live broadcast table.
Definition at line 132 of file LiveBroadcastTable.cpp. |
|
Print the live broadcast table.
Reimplemented from BasicObject. Definition at line 157 of file LiveBroadcastTable.cpp. |
|
Definition at line 41 of file LiveBroadcastTable.h. |
|
Definition at line 46 of file LiveBroadcastTable.h. |
|
Definition at line 42 of file LiveBroadcastTable.h. |
|
Definition at line 43 of file LiveBroadcastTable.h. |
|
Definition at line 44 of file LiveBroadcastTable.h. |
|
Definition at line 45 of file LiveBroadcastTable.h. |