forest-net
an overlay networks for large-scale virtual worlds
|
This class handles incoming and outgoing control packets on behalf of a router core. More...
#include <RouterControl.h>
Public Member Functions | |
RouterControl (Router *, int, Quu< int >, Quu< pair< int, int >>) | |
void | run () |
void | handleRequest (pktx, CtlPkt &) |
Handle incoming signalling requests addressed to the router. More... | |
void | returnToSender (pktx, CtlPkt &) |
Send packet back to sender. More... | |
void | addIface (CtlPkt &) |
Handle an ADD_IFACE control packet. More... | |
void | dropIface (CtlPkt &) |
Handle a DROP_IFACE control packet. More... | |
void | getIface (CtlPkt &) |
Handle an GET_IFACE control packet. More... | |
void | modIface (CtlPkt &) |
Handle a MOD_IFACE control packet. More... | |
void | getIfaceSet (CtlPkt &) |
Respond to a get iface set control packet. More... | |
void | addLink (CtlPkt &) |
void | dropLink (CtlPkt &) |
Drop a link at this router. More... | |
void | dropLink (int, fAdr_t=0) |
void | getLink (CtlPkt &) |
void | modLink (CtlPkt &) |
void | getLinkSet (CtlPkt &) |
Respond to a get link set control packet. More... | |
void | addComtree (CtlPkt &) |
void | dropComtree (CtlPkt &) |
void | getComtree (CtlPkt &) |
void | modComtree (CtlPkt &) |
void | getComtreeSet (CtlPkt &) |
Respond to a get comtree set control packet. More... | |
void | addComtreeLink (CtlPkt &) |
void | dropComtreeLink (CtlPkt &) |
void | dropComtreeLink (int, int, int) |
void | modComtreeLink (CtlPkt &) |
void | getComtreeLink (CtlPkt &) |
void | addRoute (CtlPkt &) |
void | dropRoute (CtlPkt &) |
void | getRoute (CtlPkt &) |
void | modRoute (CtlPkt &) |
void | getRouteSet (CtlPkt &) |
Respond to a get route set control packet. More... | |
void | addFilter (CtlPkt &) |
Handle an add filter control packet. More... | |
void | dropFilter (CtlPkt &) |
void | getFilter (CtlPkt &) |
void | modFilter (CtlPkt &) |
void | getFilterSet (CtlPkt &) |
Respond to a get filter set control packet. More... | |
void | getLoggedPackets (CtlPkt &) |
Respond to a get logged packets control packet. More... | |
void | enablePacketLog (CtlPkt &) |
void | joinComtree (CtkPkt &) |
Handle an incoming join request from a client. More... | |
void | leaveComtree (CtkPkt &) |
Handle an incoming leave request from a client. More... | |
void | addBranch (CtkPkt &) |
Handle an incoming addBranch request from a router. More... | |
void | prune (CtkPkt &) |
Handle an incoming prune request from a router. More... | |
void | confirm (CtkPkt &) |
Handle an incoming confirm request from a router. More... | |
bool | sendAddBranch (..) |
bool | sendPrune (..) |
bool | sendConfirm (..) |
bool | sendAbort (..) |
bool | sendAddNode (..) |
bool | sendDropNode (..) |
Public Attributes | |
int | inQ |
input queue for this thread | |
int | outQ |
output queue, shared with other threads | |
Static Public Attributes | |
static void start(RouterControl *) private in | myThx ) |
my thread index | |
This class handles incoming and outgoing control packets on behalf of a router core.
It is a friend of the RouterCore, giving it access to private data.
Definition at line 28 of file RouterControl.h.
void RouterControl::addBranch | ( | CtkPkt & | ) |
Handle an incoming addBranch request from a router.
cp | is a reference to the received request packet |
rcp | is a reference to the reply packet with fields to be filled in |
Definition at line 1131 of file RouterControl.cpp.
void RouterControl::addFilter | ( | CtlPkt & | cp) |
Handle an add filter control packet.
Adds the specified interface and prepares a reply packet.
cp | is the control packet structure (already unpacked) |
rcp | is 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. |
return | on success, false on failure; on a successful return, all appropriate attributes in rcp are set; on a failure return, the errMsg field of rcp is set. |
Definition at line 988 of file RouterControl.cpp.
void RouterControl::addIface | ( | CtlPkt & | cp) |
Handle an ADD_IFACE control packet.
Adds interface specified in the control packet.
cp | is the control packet structure for some received packet; on return, it is modified to form the reply |
Definition at line 126 of file RouterControl.cpp.
void RouterControl::confirm | ( | CtkPkt & | ) |
Handle an incoming confirm request from a router.
cp | is a reference to the received request packet |
rcp | is a reference to the reply packet with fields to be filled in |
Definition at line 1149 of file RouterControl.cpp.
void RouterControl::dropIface | ( | CtlPkt & | cp) |
Handle a DROP_IFACE control packet.
Drops a specified interface.
cp | is the control packet structure for some packet; on return, it is modified to form the reply |
Definition at line 161 of file RouterControl.cpp.
void RouterControl::dropLink | ( | CtlPkt & | cp) |
Drop a link at this router.
First, remove all routes and comtree links associated with this link.
lnk | is the link number of the link to be dropped |
peerAdr | is 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 347 of file RouterControl.cpp.
void RouterControl::getComtreeSet | ( | CtlPkt & | cp) |
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.
cp | is a reference to a received get comtree set control packet |
rcp | is a reference to the reply packet with fields to be filled in |
Definition at line 587 of file RouterControl.cpp.
void RouterControl::getFilterSet | ( | CtlPkt & | cp) |
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.
cp | is a reference to a received get filter set control packet |
rcp | is a reference to the reply packet with fields to be filled in |
Definition at line 1052 of file RouterControl.cpp.
void RouterControl::getIface | ( | CtlPkt & | cp) |
Handle an GET_IFACE control packet.
Gets the information describing a specified interface.
cp | is the control packet structure for some received packet; on return, it is modified to form the reply |
Definition at line 175 of file RouterControl.cpp.
void RouterControl::getIfaceSet | ( | CtlPkt & | cp) |
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 ifaces to be returned; reply includes the the count of the number of ifaces returned, the index of the next iface in the table, following the last one in the returned set (or 0, if no more), plus a string listing the returned interfaces
cp | is the control packet structure for some received packet; on return, it is modified to form the reply |
Definition at line 218 of file RouterControl.cpp.
void RouterControl::getLinkSet | ( | CtlPkt & | cp) |
Respond to a get link set control packet.
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.
cp | is a reference to a received get link set control packet |
rcp | is a reference to the reply packet with fields to be filled in |
Definition at line 408 of file RouterControl.cpp.
void RouterControl::getLoggedPackets | ( | CtlPkt & | cp) |
Respond to a get logged packets control packet.
cp | is a reference to a received get logged packets control packet |
rcp | is a reference to the reply packet with fields to be filled in |
Definition at line 1088 of file RouterControl.cpp.
void RouterControl::getRouteSet | ( | CtlPkt & | cp) |
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.
cp | is a reference to a received get route set control packet |
rcp | is a reference to the reply packet with fields to be filled in |
Definition at line 949 of file RouterControl.cpp.
void RouterControl::handleRequest | ( | pktx | px, |
CtlPkt & | cp | ||
) |
Handle incoming signalling requests addressed to the router.
Assumes packet has passed all basic checks.
px | is the index of some packet |
cp | is a reference to a control packet unpacked from the payload |
Definition at line 36 of file RouterControl.cpp.
void RouterControl::joinComtree | ( | CtkPkt & | ) |
Handle an incoming join request from a client.
cp | is a reference to the received request packet |
rcp | is a reference to the reply packet with fields to be filled in |
Definition at line 1104 of file RouterControl.cpp.
void RouterControl::leaveComtree | ( | CtkPkt & | ) |
Handle an incoming leave request from a client.
cp | is a reference to the received request packet |
rcp | is a reference to the reply packet with fields to be filled in |
Definition at line 1122 of file RouterControl.cpp.
void RouterControl::modIface | ( | CtlPkt & | cp) |
Handle a MOD_IFACE control packet.
Modifies an interface as specified in the control packet; only the rate spec for the interface can be changed.
cp | is the control packet structure for some received packet; on return, it is modified to form the reply |
Definition at line 195 of file RouterControl.cpp.
void RouterControl::prune | ( | CtkPkt & | ) |
Handle an incoming prune request from a router.
cp | is a reference to the received request packet |
rcp | is a reference to the reply packet with fields to be filled in |
Definition at line 1140 of file RouterControl.cpp.
void RouterControl::returnToSender | ( | pktx | px, |
CtlPkt & | cp | ||
) |
Send packet back to sender.
Update the length, flip the addresses and pack the buffer.
px | is the packet number |
cp | is a control packet to be packed |
Definition at line 110 of file RouterControl.cpp.