forest-net
an overlay networks for large-scale virtual worlds
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator
forest::RouterCore Class Reference
Collaboration diagram for forest::RouterCore:

Classes

struct  ControlInfo
 
struct  CpInfo
 
struct  nuClient
 structure for tracking pending clients More...
 

Public Member Functions

 RouterCore (bool, const RouterInfo &)
 Constructor for RouterCore, initializes key parameters and allocates space. More...
 
bool readTables (const RouterInfo &)
 Read router configuration tables from files. More...
 
bool setup ()
 Setup router after tables and interfaces have been configured. More...
 
bool setBooting (bool state)
 
void run (uint64_t)
 Main router processing loop. More...
 
void dump (ostream &os)
 Write the contents of all router tables to an output stream. More...
 
 RouterCore (bool, const RouterInfo &)
 
bool readTables (const RouterInfo &)
 
bool setup ()
 
bool setBooting (bool state)
 
void run (uint64_t)
 
void dump (ostream &os)
 
 RouterCore (bool, const RouterInfo &)
 
bool readTables (const RouterInfo &)
 
bool setup ()
 
bool setBooting (bool state)
 
void run (uint64_t)
 
void dump (ostream &os)
 

Private Member Functions

bool setupIfaces ()
 Setup interfaces specified in the interface table. More...
 
bool setupLeafAddresses ()
 Allocate addresses to peers specified in the initial link table. More...
 
bool setupQueues ()
 Setup queues as needed to support initial comtree configuration. More...
 
bool checkTables ()
 Check all router tables for mutual consistency. More...
 
bool setAvailRates ()
 Set available rates for interfaces and links. More...
 
void addLocalRoutes ()
 Add routes to neighboring leaf nodes and to routers in foreign zip codes. More...
 
fAdr_t allocLeafAdr ()
 Allocate a new leaf address. More...
 
bool allocLeafAdr (fAdr_t)
 Allocate a specified leaf address. More...
 
void freeLeafAdr (fAdr_t)
 De-allocate a leaf address. More...
 
bool validLeafAdr (fAdr_t) const
 Determine if a given address is currently assigned. More...
 
bool isFreeLeafAdr (fAdr_t) const
 Determine if a given address is currently unassigned. More...
 
void forward (pktx, int)
 Lookup routing entry and forward packet accordingly. More...
 
bool pktCheck (pktx, int)
 Perform error checks on forest packet. More...
 
void multiSend (pktx, int, int)
 Forward multiple copies of a packet. More...
 
void handleConnDisc (pktx)
 Handle a CONNECT or DISCONNECT packet. More...
 
void handleRteReply (pktx, int)
 Handle a route reply packet. More...
 
void sendRteReply (pktx, int)
 Send route reply back towards p's source. More...
 
void subUnsub (pktx, int)
 Perform subscription processing on a packet. More...
 
void handleCtlPkt (pktx)
 Handle all signalling packets addressed to the router. More...
 
bool addIface (CtlPkt &, CtlPkt &)
 Handle an ADD_IFACE control packet. More...
 
bool dropIface (CtlPkt &, CtlPkt &)
 
bool getIface (CtlPkt &, CtlPkt &)
 
bool modIface (CtlPkt &, CtlPkt &)
 
bool getIfaceSet (CtlPkt &, CtlPkt &)
 Respond to a get iface set control packet. More...
 
bool addLink (CtlPkt &, CtlPkt &)
 
bool dropLink (CtlPkt &, CtlPkt &)
 
void dropLink (int, fAdr_t=0)
 Drop a specified link at this router. More...
 
bool getLink (CtlPkt &, CtlPkt &)
 
bool modLink (CtlPkt &, CtlPkt &)
 
bool getLinkSet (CtlPkt &, CtlPkt &)
 Respond to a get link set control packet. More...
 
bool addComtree (CtlPkt &, CtlPkt &)
 
bool dropComtree (CtlPkt &, CtlPkt &)
 
bool getComtree (CtlPkt &, CtlPkt &)
 
bool modComtree (CtlPkt &, CtlPkt &)
 
bool getComtreeSet (CtlPkt &, CtlPkt &)
 Respond to a get comtree set control packet. More...
 
bool addComtreeLink (CtlPkt &, CtlPkt &)
 
bool dropComtreeLink (CtlPkt &, CtlPkt &)
 
void dropComtreeLink (int, int, int)
 
bool modComtreeLink (CtlPkt &, CtlPkt &)
 
bool getComtreeLink (CtlPkt &, CtlPkt &)
 
bool addRoute (CtlPkt &, CtlPkt &)
 
bool dropRoute (CtlPkt &, CtlPkt &)
 
bool getRoute (CtlPkt &, CtlPkt &)
 
bool modRoute (CtlPkt &, CtlPkt &)
 
bool getRouteSet (CtlPkt &, CtlPkt &)
 Respond to a get route set control packet. More...
 
bool addFilter (CtlPkt &, CtlPkt &)
 Handle an add filter control packet. More...
 
bool dropFilter (CtlPkt &, CtlPkt &)
 
bool getFilter (CtlPkt &, CtlPkt &)
 
bool modFilter (CtlPkt &, CtlPkt &)
 
bool getFilterSet (CtlPkt &, CtlPkt &)
 Respond to a get filter set control packet. More...
 
bool getLoggedPackets (CtlPkt &, CtlPkt &)
 Respond to a get logged packets control packet. More...
 
bool enablePacketLog (CtlPkt &, CtlPkt &)
 Enable local packet logging. More...
 
bool setLeafRange (CtlPkt &, CtlPkt &)
 Set leaf address range. More...
 
void sendConnDisc (int, Forest::ptyp_t)
 Send a connect packet to a peer router. More...
 
bool sendCpReq (CtlPkt &, fAdr_t)
 Send control packet request. More...
 
bool sendControl (pktx, uint64_t, int)
 Send a control packet.
 
void resendControl ()
 Retransmit any pending control packets that have timed out. More...
 
void handleControlReply (pktx)
 Handle incoming replies to control packets. More...
 
void returnToSender (pktx, CtlPkt &)
 Send packet back to sender. More...
 
bool setupIfaces ()
 
bool setupLeafAddresses ()
 
bool setupQueues ()
 
bool checkTables ()
 
bool setAvailRates ()
 
void addLocalRoutes ()
 
fAdr_t allocLeafAdr ()
 
bool allocLeafAdr (fAdr_t)
 
void freeLeafAdr (fAdr_t)
 
bool validLeafAdr (fAdr_t) const
 
bool isFreeLeafAdr (fAdr_t) const
 
void forward (pktx, int)
 
bool pktCheck (pktx, int)
 
void multiSend (pktx, int, int)
 
void handleConnDisc (pktx)
 
void handleRteReply (pktx, int)
 
void sendRteReply (pktx, int)
 
void subUnsub (pktx, int)
 
void handleCtlPkt (pktx)
 
bool addIface (CtlPkt &, CtlPkt &)
 
bool dropIface (CtlPkt &, CtlPkt &)
 
bool getIface (CtlPkt &, CtlPkt &)
 
bool modIface (CtlPkt &, CtlPkt &)
 
bool addLink (CtlPkt &, CtlPkt &)
 
bool dropLink (CtlPkt &, CtlPkt &)
 
void dropLink (int, fAdr_t=0)
 
bool getLink (CtlPkt &, CtlPkt &)
 
bool modLink (CtlPkt &, CtlPkt &)
 
bool addComtree (CtlPkt &, CtlPkt &)
 
bool dropComtree (CtlPkt &, CtlPkt &)
 
bool getComtree (CtlPkt &, CtlPkt &)
 
bool modComtree (CtlPkt &, CtlPkt &)
 
bool addComtreeLink (CtlPkt &, CtlPkt &)
 
bool dropComtreeLink (CtlPkt &, CtlPkt &)
 
void dropComtreeLink (int, int, int)
 
bool modComtreeLink (CtlPkt &, CtlPkt &)
 
bool getComtreeLink (CtlPkt &, CtlPkt &)
 
bool addRoute (CtlPkt &, CtlPkt &)
 
bool dropRoute (CtlPkt &, CtlPkt &)
 
bool getRoute (CtlPkt &, CtlPkt &)
 
bool modRoute (CtlPkt &, CtlPkt &)
 
bool getLinkSet (CtlPkt &, CtlPkt &)
 
bool setLeafRange (CtlPkt &, CtlPkt &)
 
void sendConnDisc (int, Forest::ptyp_t)
 
bool sendCpReq (CtlPkt &, fAdr_t)
 
void resendCpReq ()
 Retransmit any pending control packets that have timed out. More...
 
void handleCpReply (pktx, CtlPkt &)
 Handle incoming replies to control packets. More...
 
void returnToSender (pktx, CtlPkt &)
 
bool setupIfaces ()
 
bool setupLeafAddresses ()
 
bool setupQueues ()
 
bool checkTables ()
 
bool setAvailRates ()
 
void addLocalRoutes ()
 
fAdr_t allocLeafAdr ()
 
bool allocLeafAdr (fAdr_t)
 
void freeLeafAdr (fAdr_t)
 
bool validLeafAdr (fAdr_t) const
 
bool isFreeLeafAdr (fAdr_t) const
 
void forward (pktx, int)
 
bool pktCheck (pktx, int)
 
void multiSend (pktx, int, int)
 
void handleConnDisc (pktx)
 
void handleRteReply (pktx, int)
 
void sendRteReply (pktx, int)
 
void subUnsub (pktx, int)
 
void handleCtlPkt (pktx)
 
bool addIface (CtlPkt &, CtlPkt &)
 
bool dropIface (CtlPkt &, CtlPkt &)
 
bool getIface (CtlPkt &, CtlPkt &)
 
bool modIface (CtlPkt &, CtlPkt &)
 
bool addLink (CtlPkt &, CtlPkt &)
 
bool dropLink (CtlPkt &, CtlPkt &)
 
void dropLink (int, fAdr_t=0)
 
bool getLink (CtlPkt &, CtlPkt &)
 
bool getLinkSet (CtlPkt &, CtlPkt &)
 
bool getComtreeSet (CtlPkt &, CtlPkt &)
 
bool getIfaceSet (CtlPkt &, CtlPkt &)
 
bool getRouteSet (CtlPkt &, CtlPkt &)
 
bool modLink (CtlPkt &, CtlPkt &)
 
bool addComtree (CtlPkt &, CtlPkt &)
 
bool dropComtree (CtlPkt &, CtlPkt &)
 
bool dropComtree (comt_t)
 
bool getComtree (CtlPkt &, CtlPkt &)
 
bool modComtree (CtlPkt &, CtlPkt &)
 
bool modComtree (comt_t, int, CtlPkt &)
 
bool addComtreeLink (CtlPkt &, CtlPkt &)
 
bool addComtreeLink (comt_t, int, CtlPkt &)
 
bool dropComtreeLink (CtlPkt &, CtlPkt &)
 
void dropComtreeLink (int, int, int)
 
bool modComtreeLink (CtlPkt &, CtlPkt &)
 
bool modComtreeLink (comt_t, int, RateSpec, CtlPkt &)
 
bool getComtreeLink (CtlPkt &, CtlPkt &)
 
void handleClientJoinComtree (pktx, CtlPkt &, CtlPkt &)
 
void handleClientLeaveComtree (pktx, CtlPkt &, CtlPkt &)
 
void handleComtPath (pktx, CtlPkt &)
 
void handleComtAddBranch (pktx, CtlPkt &, CtlPkt &)
 
void handleComtPrune (pktx, CtlPkt &, CtlPkt &)
 
void handleAllPending (vector< pktx > &, CtlPkt &)
 
void handleComtPruneReply (pktx, CtlPkt &)
 
void handleComtNewLeafReply (pktx, CtlPkt &)
 
void handleAddBranchConfirm (pktx, CtlPkt &, CtlPkt &)
 
void handleAddBranchReply (pktx, CtlPkt &)
 
void handleConfirmReply (pktx, CtlPkt &)
 
bool addRoute (CtlPkt &, CtlPkt &)
 
bool dropRoute (CtlPkt &, CtlPkt &)
 
bool getRoute (CtlPkt &, CtlPkt &)
 
bool modRoute (CtlPkt &, CtlPkt &)
 
bool addFilter (CtlPkt &, CtlPkt &)
 
bool dropFilter (CtlPkt &, CtlPkt &)
 
bool getFilter (CtlPkt &, CtlPkt &)
 
bool modFilter (CtlPkt &, CtlPkt &)
 
bool getFilterSet (CtlPkt &, CtlPkt &)
 
bool getLoggedPackets (CtlPkt &, CtlPkt &)
 
bool enablePacketLog (CtlPkt &, CtlPkt &)
 
bool setLeafRange (CtlPkt &, CtlPkt &)
 
void sendConnDisc (int, Forest::ptyp_t)
 
bool sendCpReq (CtlPkt &, fAdr_t)
 
bool sendControl (pktx, uint64_t, int)
 
void resendControl ()
 
void handleControlReply (pktx)
 
void returnToSender (pktx, CtlPkt &)
 

Private Attributes

ipa_t bootIp
 IP address used during booting.
 
fAdr_t myAdr
 forest address of this router
 
ipa_t nmIp
 IP address of the netMgr.
 
fAdr_t nmAdr
 forest address of the netMgr
 
fAdr_t ccAdr
 address of comtree controller
 
bool booting
 true when booting remotely
 
uint64_t now
 current time in 64 bit form
 
uint64_t seqNum
 seq # for outgoing control packets
 
fAdr_t firstLeafAdr
 first leaf address
 
UiSetPair * leafAdr
 offsets for in-use and free leaf More...
 
map< uint64_t, ControlInfo > * pending
 map of pending requests
 
int nIfaces
 max number of interfaces
 
int nLnks
 max number of links
 
int nComts
 max number of comtrees
 
int nRts
 max number of routes
 
int nPkts
 number of packets
 
int nBufs
 number of packet buffers
 
int nQus
 number of queues
 
IfaceTableift
 table defining interfaces
 
LinkTablelt
 table defining links
 
ComtreeTablectt
 table of comtrees
 
RouteTablert
 table of routes
 
PacketStoreps
 packet buffers and headers
 
QuManagerqm
 collection of queues for all links
 
IoProcessoriop
 class for handling io
 
StatsModulesm
 class for recording statistics
 
PacketLogpktLog
 log for recording sample of packets
 
list< nuClient > * pendingClients
 list of clients that have not More...
 
map< uint64_t, CpInfo > * pending
 map of pending requests, indexed
 

Detailed Description

Definition at line 53 of file RouterCore.h.

Constructor & Destructor Documentation

forest::RouterCore::RouterCore ( bool  booting1,
const RouterInfo config 
)

Constructor for RouterCore, initializes key parameters and allocates space.

Parameters
configis a RouterInfo structure which has been initialized to specify various router parameters

Definition at line 117 of file RouterCore-sav.cpp.

Member Function Documentation

bool forest::RouterCore::addFilter ( CtlPkt cp,
CtlPkt reply 
)
private

Handle an add filter control packet.

Adds the specified interface and prepares a reply packet.

Parameters
cpis the control packet structure (already unpacked)
replyis a control packet structure for the reply, which the cpType has been set to match cp, the rrType is POS_REPLY and the seqNum has been set to match cp.
returntrue on success, false on failure; on a successful return, all appropriate attributes in reply are set; on a failure return, the errMsg field of reply is set.

Definition at line 2029 of file RouterCore-sav.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::RouterCore::addIface ( CtlPkt cp,
CtlPkt reply 
)
private

Handle an ADD_IFACE control packet.

Adds the specified interface and prepares a reply packet.

Parameters
pxis a packet number
cpis the control packet structure for p (already unpacked)
replyis a control packet structure for the reply, which the cpType has been set to match cp, the rrType is POS_REPLY and the seqNum has been set to match cp.
returntrue on success, false on failure; on a successful return, all appropriate attributes in reply are set; on a failure return, the errMsg field of reply is set.

Definition at line 1203 of file RouterCore-sav.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void forest::RouterCore::addLocalRoutes ( )
private

Add routes to neighboring leaf nodes and to routers in foreign zip codes.

Routes are added in all comtrees.

Definition at line 486 of file RouterCore-sav.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

fAdr_t forest::RouterCore::allocLeafAdr ( )
inlineprivate

Allocate a new leaf address.

Returns
a previously unused address in the range of assignable leaf addresses for this router, or 0 if all addresses are in use

Definition at line 198 of file RouterCore.h.

Here is the caller graph for this function:

bool forest::RouterCore::allocLeafAdr ( fAdr_t  adr)
inlineprivate

Allocate a specified leaf address.

Parameters
adris an address in the range of assignable addresses
Returns
true of the adr is available for use and was successfully allocated, else false

Definition at line 210 of file RouterCore.h.

bool forest::RouterCore::checkTables ( )
private

Check all router tables for mutual consistency.

Sends error messages to cerr if inconsistencies are found. This does not verify the consistency of interface, link and comtree rates. That is left to the setAvailRates() method.

Returns
true on success, false on failure

Definition at line 296 of file RouterCore-sav.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void forest::RouterCore::dropLink ( int  lnk,
fAdr_t  peerAdr = 0 
)
private

Drop a specified link at this router.

First, remove all comtree links associated with this link. This also removes the comtree link from all multicast routes.

Parameters
lnkis the link number of the link to be dropped
peerAdris the address of the peer of the remote end of the link, if lnk == 0; in this case, the link number is looked up using the peerAdr value

Definition at line 1413 of file RouterCore-sav.cpp.

Here is the call graph for this function:

void forest::RouterCore::dump ( ostream &  out)

Write the contents of all router tables to an output stream.

Parameters
outis an open output stream

Definition at line 509 of file RouterCore-sav.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::RouterCore::enablePacketLog ( CtlPkt cp,
CtlPkt reply 
)
private

Enable local packet logging.

Parameters
cpis a reference to a received get logged packets control packet
replyis a reference to the reply packet with fields to be filled in
Returns
true on success, false on failure

Definition at line 2052 of file RouterCore.cpp.

Here is the call graph for this function:

void forest::RouterCore::forward ( pktx  px,
int  ctx 
)
private

Lookup routing entry and forward packet accordingly.

There are two contexts in which this method is called. The most common case is to forward a CLIENT_DATA packet. The other case is to forward a control packet that originates from this router. In this case the inLink field of the packet's header should be zero.

Parameters
pxis a packet number for a CLIENT_DATA packet
ctxis the comtree table index for the comtree in p's header

There are two contexts in which this method is called. The most common case is to forward a CLIENT_DATA packet. The other case is to forward a control packet that originates from this router. In this case the inLink field of the packet's header should be zero.

Parameters
pis a packet number for a CLIENT_DATA packet
ctxis the comtree table index for the comtree in p's header

Definition at line 712 of file RouterCore-sav.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void forest::RouterCore::freeLeafAdr ( fAdr_t  adr)
inlineprivate

De-allocate a leaf address.

Parameters
adris a previously allocated address.

Definition at line 220 of file RouterCore.h.

Here is the caller graph for this function:

bool forest::RouterCore::getComtreeSet ( CtlPkt cp,
CtlPkt reply 
)
private

Respond to a get comtree set control packet.

Control packet includes the first comtree in the set to be retrieved plus a count of the number of comtree to be returned; reply includes the first comtree in the set, the count of the number of comtrees returned and the next comtree in the table, following the last one in the returned set.

Parameters
cpis a reference to a received get comtree set control packet
replyis a reference to the reply packet with fields to be filled in
Returns
true on success, false on failure

Definition at line 1576 of file RouterCore-sav.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::RouterCore::getFilterSet ( CtlPkt cp,
CtlPkt reply 
)
private

Respond to a get filter set control packet.

Control packet includes the first filter in the set to be retrieved plus a count of the number of filters to be returned; reply includes the first filters in the set, the count of the number of filters returned and the next filters in the table, following the last one in the returned set.

Parameters
cpis a reference to a received get filter set control packet
replyis a reference to the reply packet with fields to be filled in
Returns
true on success, false on failure

Definition at line 2079 of file RouterCore-sav.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::RouterCore::getIfaceSet ( CtlPkt cp,
CtlPkt reply 
)
private

Respond to a get iface set control packet.

Control packet includes the first iface in the set to be retrieved plus a count of the number of iface to be returned; reply includes the first iface in the set, the count of the number of ifaces returned and the next iface in the table, following the last one in the returned set.

Parameters
cpis a reference to a received get iface set control packet
replyis a reference to the reply packet with fields to be filled in
Returns
true on success, false on failure

Definition at line 1280 of file RouterCore-sav.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::RouterCore::getLinkSet ( CtlPkt cp,
CtlPkt reply 
)
private

Respond to a get link set control packet.

Get a LinkTable by Feng and Doowon.

Control packet includes the first link in the set to be retrieved plus a count of the number of links to be returned; reply includes the first link in the set, the count of the number of links returned and the next link in the table, following the last one in the returned set.

Parameters
cpis a reference to a received get link set control packet
replyis a reference to the reply packet with fields to be filled in
Returns
true on success, false on failure

Definition at line 1458 of file RouterCore-sav.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::RouterCore::getLoggedPackets ( CtlPkt cp,
CtlPkt reply 
)
private

Respond to a get logged packets control packet.

Parameters
cpis a reference to a received get logged packets control packet
replyis a reference to the reply packet with fields to be filled in
Returns
true on success, false on failure

Definition at line 2115 of file RouterCore-sav.cpp.

Here is the caller graph for this function:

bool forest::RouterCore::getRouteSet ( CtlPkt cp,
CtlPkt reply 
)
private

Respond to a get route set control packet.

Control packet includes the first route in the set to be retrieved plus a count of the number of route to be returned; reply includes the first route in the set, the count of the number of routes returned and the next route in the table, following the last one in the returned set.

Parameters
cpis a reference to a received get route set control packet
replyis a reference to the reply packet with fields to be filled in
Returns
true on success, false on failure

Definition at line 1992 of file RouterCore-sav.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void forest::RouterCore::handleConnDisc ( pktx  px)
private

Handle a CONNECT or DISCONNECT packet.

Parameters
pxis the packet number of the packet to be handled.
pis the packet number of the packet to be handled.

Definition at line 1057 of file RouterCore-sav.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void forest::RouterCore::handleControlReply ( pktx  rx)
private

Handle incoming replies to control packets.

The reply is checked against the map of pending control packets, and if a match is found, the entry is removed from the map and the storage for the original control packet is freed. Currently, the only action on a reply is to print an error message to the log if we receive a negative reply.

Parameters
rxis the packet index of the reply packet

Definition at line 2232 of file RouterCore.cpp.

Here is the call graph for this function:

void forest::RouterCore::handleCpReply ( pktx  reply,
CtlPkt cpr 
)
private

Handle incoming replies to control packets.

The reply is checked against the map of pending request packets, and if a match is found, the entry is removed from the map and the storage for the request packet is freed. Currently, the only action on a reply is to print an error message to the log if we receive a negative reply.

Parameters
replyis the packet number of the reply packet
cpris a reference to an unpacked control packet for reply

Definition at line 2287 of file RouterCore-sav.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void forest::RouterCore::handleCtlPkt ( pktx  px)
private

Handle all signalling packets addressed to the router.

Handle all control packets addressed to the router.

Assumes packet has passed all basic checks.

Parameters
pxis the index of some packet

with the exception of SUB_UNSUB and RTE_REPLY which are handled "inline". Assumes packet has passed all basic checks. Return 0 if the packet should be forwarded, else 1.

Still need to add error checking for modify messages. This requires extensions to ioProc and lnkTbl to track available bandwidth.

Parameters
pis a packet number

Definition at line 1108 of file RouterCore-sav.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void forest::RouterCore::handleRteReply ( pktx  px,
int  ctx 
)
private

Handle a route reply packet.

Adds a route to the destination of the original packet that triggered the route reply, if no route is currently defined. If there is no route to the destination address in the packet, the packet is flooded to neighboring routers. If there is a route to the destination, it is forwarded along that route, so long as the next hop is another router.

Definition at line 849 of file RouterCore-sav.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::RouterCore::isFreeLeafAdr ( fAdr_t  adr) const
inlineprivate

Determine if a given address is currently unassigned.

Parameters
adris a forest unicast address
Returns
true if adr is not currently assigned.

Definition at line 240 of file RouterCore.h.

void forest::RouterCore::multiSend ( pktx  px,
int  ctx,
int  rtx 
)
private

Forward multiple copies of a packet.

There are two contexts in which this method is called. The most common case is to forward a CLIENT_DATA packet. The other case is to forward a control packet that originates from this router. In this case the inLink field of the packet's header should be zero.

Parameters
pxis the number of a multi-destination packet
ctxis the comtree index for the comtree in p's header
rtxis the route index for p, or 0 if there is no route

There are two contexts in which this method is called. The most common case is to forward a CLIENT_DATA packet. The other case is to forward a control packet that originates from this router. In this case the inLink field of the packet's header should be zero.

Parameters
pis the number of a multi-destination packet
ctxis the comtree index for the comtree in p's header
rtxis the route index for p, or 0 if there is no route

Definition at line 756 of file RouterCore-sav.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::RouterCore::pktCheck ( pktx  px,
int  ctx 
)
private

Perform error checks on forest packet.

Parameters
pxis a packet index
ctxis the comtree index for p's comtree
Returns
true if all checks pass, else false
Parameters
pis a packet number
ctxis the comtree index for p's comtree
Returns
true if all checks pass, else false

Definition at line 647 of file RouterCore-sav.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::RouterCore::readTables ( const RouterInfo config)

Read router configuration tables from files.

This method reads initial router configuration files (if present) and configures router tables as specified.

Parameters
configis a RouterInfo structure which has been initialized to specify various router parameters

Definition at line 159 of file RouterCore-sav.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void forest::RouterCore::resendControl ( )
private

Retransmit any pending control packets that have timed out.

This method checks the map of pending requests and whenever it finds a packet that has been waiting for an acknowledgement for more than a second, it retransmits it or gives up, if it has already made three attempts.

Definition at line 2183 of file RouterCore.cpp.

Here is the call graph for this function:

void forest::RouterCore::resendCpReq ( )
private

Retransmit any pending control packets that have timed out.

This method checks the map of pending requests and whenever it finds a packet that has been waiting for an acknowledgement for more than a second, it retransmits it or gives up, if it has already made three attempts.

Definition at line 2240 of file RouterCore-sav.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void forest::RouterCore::returnToSender ( pktx  px,
CtlPkt cp 
)
private

Send packet back to sender.

Update the length, flip the addresses and pack the buffer.

Parameters
pxis the packet number
cpis a control packet to be packed

Definition at line 2341 of file RouterCore-sav.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void forest::RouterCore::run ( uint64_t  finishTime)

Main router processing loop.

This method executes a loop that does three primary things:

  • checks to see if a packet has arrived and if so, processes it; this typically results in the packet being placed in one or more queues
  • checks to see if any of the links is ready to send a packet, and if so, retrieves and sends all packets whose time has come
  • checks to see if any control packets are waiting to be processed, and if so, processes one

In addition, the main loop periodically writes taffic statistics to an external statistics file. It also maintains copies of a limited number of packets received and sent. These are printed to cout after the main loop exits, to facilitate debugging.

Time is managed through a free-running clock, derived from the time value returned by gettimeofday. The clock is updated on each iteration of the loop.

Note, that since the loop processes only one input packet per iteration, and possibly multiple output packets, excessive input traffic will cause packets to be discarded from socket buffers before they ever reach this program. This is intended to keep the system productive, even during overload. However, it is still best to limit input traffic rates where that is possible.

Parameters
finishTimeis the number of microseconds to run before stopping; if it is zero, the router runs without stopping (until killed)

Definition at line 546 of file RouterCore-sav.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void forest::RouterCore::sendConnDisc ( int  lnk,
Forest::ptyp_t  type 
)
private

Send a connect packet to a peer router.

Parameters
lnkis link number of the link on which we want to connect.
lnkis link number of the link on which we want to connect.
typeis CONNECT or DISCONNECT

Definition at line 2149 of file RouterCore-sav.cpp.

Here is the call graph for this function:

bool forest::RouterCore::sendCpReq ( CtlPkt cp,
fAdr_t  dest 
)
private

Send control packet request.

Builds a packet containing the specified control packet and stores its packet number and a timestamp in the map of pending control packet requests. Then, makes a copy, which is sent to the destination.

Parameters
cpis a reference to the control packet to be sent
destis the destination address to which the packet is to be sent
Returns
true on success, false on failure

Definition at line 2187 of file RouterCore-sav.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void forest::RouterCore::sendRteReply ( pktx  px,
int  ctx 
)
private

Send route reply back towards p's source.

The reply is sent on the link on which p was received and is addressed to p's original sender.

Parameters
pxis a packet number
ctxis the comtree index for p's comtree

The reply is sent on the link on which p was received and is addressed to p's original sender.

Parameters
pis a packet number
ctxis the comtree index for p's comtree

Definition at line 821 of file RouterCore-sav.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::RouterCore::setAvailRates ( )
private

Set available rates for interfaces and links.

Sends error messages to cerr if specified rates lead to over-subscription.

Returns
true on success, false if specified rates oversubscribe an interface or link

Definition at line 424 of file RouterCore-sav.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::RouterCore::setLeafRange ( CtlPkt cp,
CtlPkt reply 
)
private

Set leaf address range.

Parameters
pxis the number of the boot complete request packet
cpis an unpacked control packet for p
replyis a reference to a pre-formatted positive reply packet that will be returned to the sender; it may be modified to indicate a negative reply.
Returns
true on success, false on failure

Definition at line 2128 of file RouterCore-sav.cpp.

Here is the caller graph for this function:

bool forest::RouterCore::setup ( )

Setup router after tables and interfaces have been configured.

Invokes several setup and verification methods to ensure that the initial configuration is fully consistent.

Definition at line 212 of file RouterCore-sav.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::RouterCore::setupIfaces ( )
private

Setup interfaces specified in the interface table.

This involves opening a separate UDP socket for each interface.

Returns
true on success, false on failure

Definition at line 228 of file RouterCore-sav.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::RouterCore::setupLeafAddresses ( )
private

Allocate addresses to peers specified in the initial link table.

Verifies that the initial peer addresses are in the range of assignable leaf addresses, and allocates them if they are.

Returns
true on success, false on failure

Definition at line 247 of file RouterCore-sav.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::RouterCore::setupQueues ( )
private

Setup queues as needed to support initial comtree configuration.

For each defined comtree, a queue is allocated to each of its links. For each comtree link, initial rates are the minimum bit rate and packet rate allowed.

Returns
true on success, false on failure

Definition at line 262 of file RouterCore-sav.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void forest::RouterCore::subUnsub ( pktx  px,
int  ctx 
)
private

Perform subscription processing on a packet.

The packet contains two lists of multicast addresses, each preceded by its length. The combined list lengths is limited to 350.

Parameters
pxis a packet number
ctxis the comtree index for p's comtree

The packet contains two lists of multicast addresses, each preceded by its length. The combined list lengths is limited to 350.

Parameters
pis a packet number
ctxis the comtree index for p's comtree

Definition at line 949 of file RouterCore-sav.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::RouterCore::validLeafAdr ( fAdr_t  adr) const
inlineprivate

Determine if a given address is currently assigned.

Parameters
adris a forest unicast address
Returns
true if adr is one that had been previously assigned

Definition at line 231 of file RouterCore.h.

Member Data Documentation

UiSetPair * forest::RouterCore::leafAdr
private

offsets for in-use and free leaf

addresses

Definition at line 77 of file RouterCore.h.

list< nuClient > * forest::RouterCore::pendingClients
private

list of clients that have not

yet connected

Definition at line 113 of file RouterCore.h.


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