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

Maintains information about an entire Forest network. More...

#include <NetInfo.h>

Collaboration diagram for forest::NetInfo:

Classes

struct  IfInfo
 
struct  LeafNodeInfo
 structure holding information used by leaf nodes More...
 
struct  LinkDesc
 
struct  LinkInfo
 
struct  RtrNodeInfo
 structure holding information used by router nodes More...
 

Public Types

enum  statusType { UP, DOWN, BOOTING }
 

Public Member Functions

 NetInfo (int, int, int, int)
 Constructor for NetInfo, allocates space and initializes private data. More...
 
 ~NetInfo ()
 Destructor for NetInfo class. More...
 
bool validNode (int) const
 Check to see that a node number is valid. More...
 
int firstNode () const
 Get the number of the "first" node in the Forest network. More...
 
int nextNode (int) const
 Get the node number of the "next" node in the Forest network. More...
 
int getMaxNode () const
 Get the maximum node number for the network. More...
 
string & getNodeName (int, string &) const
 Get the name for a specified node. More...
 
int getNodeNum (string &) const
 Get the node number corresponding to a give node name. More...
 
int getNodeNum (fAdr_t) const
 Get the node number corresponding to a give forest address. More...
 
Forest::ntyp_t getNodeType (int) const
 Get the type of a specified node. More...
 
fAdr_t getNodeAdr (int) const
 Get the Forest address of a node. More...
 
bool getNodeLocation (int, pair< double, double > &) const
 Get the location of a node in the Forest network. More...
 
statusType getStatus (int) const
 Get the status of a node. More...
 
bool setNodeName (int, string &)
 Set the name of a node. More...
 
bool setNodeAdr (int, fAdr_t)
 Set the forest address of a node. More...
 
bool setNodeLocation (int, pair< double, double > &)
 Set the location of a node in the Forest network. More...
 
void setStatus (int, statusType)
 Set the status of a node. More...
 
bool isLeaf (int) const
 Determine if a given node number identifies a leaf. More...
 
int firstLeaf () const
 Get the node number of the first leaf node in the Forest network. More...
 
int nextLeaf (int) const
 Get the node number of the "next" leaf node in the Forest network. More...
 
int firstController () const
 Get the node number of the first controller in the Forest network. More...
 
int nextController (int) const
 Get the node number of the next controller in the Forest network. More...
 
ipa_t getLeafIpAdr (int) const
 Get the IP address of a leaf node. More...
 
int addLeaf (const string &, Forest::ntyp_t)
 Add a leaf node to a Forest network. More...
 
bool setLeafType (int, Forest::ntyp_t)
 Set the node type of a leaf node. More...
 
bool setLeafIpAdr (int, ipa_t)
 Set the IP address of a leaf node. More...
 
bool isRouter (int) const
 Determine if a given node number identifies a router. More...
 
bool validIf (int, int) const
 Check to see if a given router interface is valid. More...
 
int firstRouter () const
 Get the node number of the first router in the Forest network. More...
 
int nextRouter (int) const
 Get the node number of the "next" router in the Forest network. More...
 
int getMaxRouter () const
 Get the maximum router number for the network. More...
 
int getNumRouters () const
 Get the number of routers in this network. More...
 
int getIface (int, int) const
 Get the interface associated with a given local link number. More...
 
int getNumIf (int) const
 Get the number of interfaces defined for a router. More...
 
bool getLeafRange (int, pair< fAdr_t, fAdr_t > &) const
 Get the range of leaf addresses for a router. More...
 
ipa_t getIfIpAdr (int, int) const
 Get the IP address of a specified router interface. More...
 
ipp_t getIfPort (int, int) const
 Get the IP port of a specified router interface. More...
 
RateSpecgetIfRates (int, int) const
 Get the RateSpec for a router interface. More...
 
bool getIfLinks (int, int, pair< int, int > &) const
 Get the range of link numbers assigned to an interface. More...
 
int addRouter (const string &)
 Add a new router to the NetInfo object. More...
 
bool addInterfaces (int, int)
 Add interfaces to a router. More...
 
bool setLeafRange (int, pair< int, int > &)
 Set the range of assignable client addresses for this router. More...
 
bool setIfIpAdr (int, int, ipa_t)
 Set the IP address of a router interface. More...
 
bool setIfPort (int, int, ipp_t)
 Set the IP address of a router interface. More...
 
bool setIfLinks (int, int, pair< int, int > &)
 Set the RateSpec for a router interface. More...
 
bool validLink (int) const
 Check to see if a given link number is valid. More...
 
int firstLink () const
 Get the number of the first link in the Forest network. More...
 
int nextLink (int) const
 Get the number of the next link in the Forest network. More...
 
int firstLinkAt (int) const
 Get the number of the first link incident to a specified node. More...
 
int nextLinkAt (int, int) const
 Get the number of the next link incident to a specified node. More...
 
int getMaxLink () const
 Get the maximum link number for the network. More...
 
int getLeft (int) const
 Get the node number for the "left" endpoint of a given link. More...
 
int getRight (int) const
 Get the node number for the "right" endpoint of a given link. More...
 
int getPeer (int, int) const
 Get the node number for the "other" endpoint of a given link. More...
 
RateSpecgetLinkRates (int) const
 Get the RateSpec of a link in the Forest network. More...
 
RateSpecgetAvailRates (int) const
 Get the available rates of a link in the Forest network. More...
 
RateSpecgetDefLeafRates ()
 Get the default rates for leaf nodes in a Forest network. More...
 
int getLinkLength (int) const
 Get the length of a link in the Forest network. More...
 
int getLinkNum (int, int) const
 Get the global link number of a link incident to a node. More...
 
int getLLnum (int, int) const
 Get the local link number used by one of the endpoints of a link. More...
 
int getLeftLLnum (int) const
 Get the local link number used by the left endpoint of a link. More...
 
int getRightLLnum (int) const
 Get the local link number used by the right endpoint of a link. More...
 
uint64_t getNonce (int) const
 Get the nonce for a link. More...
 
int addLink (int, int, int, int)
 Add a link to a forest network. More...
 
bool setLeftLLnum (int, int)
 Set the local link number used by the left endpoint of a link. More...
 
bool setRightLLnum (int, int)
 Set the local link number used by the right endpoint of a link. More...
 
bool setLinkLength (int, int)
 Set the RateSpec for a link. More...
 
bool setNonce (int, uint64_t)
 Set the nonce for a link. More...
 
bool read (istream &)
 Reads a network topology file and initializes the NetInfo data structure. More...
 
string link2string (int) const
 Create a string representation of a link. More...
 
string linkProps2string (int) const
 Create a string representation of a link and its properties. More...
 
string linkState2string (int) const
 Create a string representation of a link and its current state. More...
 
string toString () const
 Create a string representation of the NetInfo object. More...
 
void lock ()
 Lock the data structure. More...
 
void unlock ()
 Unlock the data structure.
 

Private Member Functions

uint64_t ll2l_key (int, int) const
 returns key used with locLnk2lnk More...
 
bool readRouter (istream &, RtrNodeInfo &, IfInfo *, string &)
 Read a router description from an input stream. More...
 
bool readLocation (istream &, pair< double, double > &)
 Read a (latitude,longitude) pair. More...
 
bool readAdrRange (istream &, pair< fAdr_t, fAdr_t > &)
 Read an address range pair. More...
 
bool readRateSpec (istream &, RateSpec &)
 Read a rate specification. More...
 
int readIface (istream &, IfInfo *, string &)
 Read a router interface description from an input stream. More...
 
bool readLeaf (istream &, LeafNodeInfo &, string &)
 Read a leaf node description from an input stream. More...
 
bool readLink (istream &, LinkDesc &, string &)
 Read a link description from an input stream. More...
 
bool readLinkEndpoint (istream &, string &, int &)
 Read a link endpoint. More...
 
bool check () const
 Perform a series of consistency checks. More...
 
bool checkLocalLinks () const
 Check that the local link numbers at all routers are consistent. More...
 
bool checkBackBone () const
 Check that the routers are all connected. More...
 
bool checkAddresses () const
 Check that no two nodes have the same Forest address. More...
 
bool checkLeafRange () const
 Check leaf address ranges of all routers. More...
 
bool checkLeafNodes () const
 Check consistency of leaf nodes. More...
 
bool checkLinkRates () const
 Check that link rates are consistent with Forest requirements. More...
 
bool checkRtrRates () const
 Check interface and link rates at all routers for consistency. More...
 
string & rtr2string (int, string &) const
 Create a string representation of a router. More...
 
string & leaf2string (int, string &) const
 Create a string representation of a leaf node. More...
 

Private Attributes

int maxRtr
 max node number for a router; More...
 
int maxNode
 max node number in netTopo graph
 
int maxLink
 max link number in netTopo graph
 
int maxLeaf
 max number of leafs
 
int maxCtl
 maximum number of controllers
 
Wgraph * netTopo
 NetTopo is a weighted graph defining the network topology. More...
 
LeafNodeInfoleaf
 
UiSetPair * leaves
 in-use and free leaf numbers
 
set< int > * controllers
 set of controllers (by node #)
 
RtrNodeInfortr
 
UiSetPair * routers
 tracks routers and unused router numbers
 
map< string, int > * nameNodeMap
 maps a node name back to corresponding node number
 
map< fAdr_t, int > * adrNodeMap
 maps a forest address to a node number
 
HashMap * locLnk2lnk
 maps router/local link# to global link#
 
LinkInfolink
 
RateSpec defaultLeafRates
 default link rates
 
pthread_mutex_t glock
 for locking in multi-threaded contexts
 

Static Private Attributes

static int const UNDEF_LAT = 91
 
static int const UNDEF_LONG = 361
 

Detailed Description

Maintains information about an entire Forest network.

The NetInfo data structure is intended for use by network control elements that require a global view of the network. Currently, this includes the NetMgr and the ComtreeController components.

Internally, a NetInfo object uses a Wgraph to represent the network topology. It also has tables of attributes for all nodes and links. It provides a large number of methods for accessing the internal representation in a convenient way, It also has a read() method to read in a network description from a file and build the corresponding internal data structure. And it has a toString() method that can be used in an output stream.

Definition at line 41 of file NetInfo.h.

Constructor & Destructor Documentation

forest::NetInfo::NetInfo ( int  maxNode1,
int  maxLink1,
int  maxRtr1,
int  maxCtl1 
)

Constructor for NetInfo, allocates space and initializes private data.

Parameters
maxNode1is the maximum number of nodes in this NetInfo object
maxLink1is the maximum number of links in this NetInfo object
maxRtr1is the maximum number of routers in this NetInfo object
maxCtl1is the maximum number of controllers in this NetInfo object

Definition at line 20 of file NetInfo.cpp.

Here is the call graph for this function:

forest::NetInfo::~NetInfo ( )

Destructor for NetInfo class.

Deallocates all dynamic storage

Definition at line 46 of file NetInfo.cpp.

Member Function Documentation

bool forest::NetInfo::addInterfaces ( int  r,
int  numIf 
)

Add interfaces to a router.

Currently this operation can only be done once for a router, typically during its initial initiialization.

Parameters
ris the node number of the router
numIfis the number of interfaces that are to allocated to the router
Returns
true on success, 0 on failure (the operation fails if r is not a valid router number or if interfaces have already been allocated to r)

Definition at line 106 of file NetInfo.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int forest::NetInfo::addLeaf ( const string &  name,
Forest::ntyp_t  nTyp 
)

Add a leaf node to a Forest network.

Parameters
nameis the name of the new leaf
nTypis the desired node type (CLIENT or CONTROLLER)
Returns
the node number for the new leaf or 0 on failure (the method fails if there are no available leaf records to allocate to this leaf, or if the requested name is in use)

Definition at line 120 of file NetInfo.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int forest::NetInfo::addLink ( int  u,
int  v,
int  uln,
int  vln 
)

Add a link to a forest network.

Parameters
uis a node number of some node in the network
vis a node number of some node in the network
ulnif u is a ROUTER, then uln is a local link number used by u to identify the link - for leaf nodes, this argument is ignored
vlnif v is a ROUTER, then vln is a local link number used by v to identify the link - for leaf nodes, this argument is ignored
Returns
the link number for the new link or 0 if the operation fails (the operation fails if it is unable to associate a given local link number with a specified router)

Definition at line 149 of file NetInfo.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int forest::NetInfo::addRouter ( const string &  name)

Add a new router to the NetInfo object.

A new router object is allocated and assigned a name.

Parameters
nameis the name of the new router
Returns
the node number of the new router, or 0 if there are no more available router numbers, or the given name is already used by some other node.

Definition at line 78 of file NetInfo.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::NetInfo::check ( ) const
private

Perform a series of consistency checks.

Print error message for each detected problem.

Returns
true if all checks passed, else false

Definition at line 598 of file NetInfo.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::NetInfo::checkAddresses ( ) const
private

Check that no two nodes have the same Forest address.

Write message to stderr for every error detected.

Returns
true if all addresses are unique, else false

Definition at line 697 of file NetInfo.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::NetInfo::checkBackBone ( ) const
private

Check that the routers are all connected.

Write message to stderr for every error detected.

Returns
true if the routers form a connected network, else false

Definition at line 674 of file NetInfo.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::NetInfo::checkLeafNodes ( ) const
private

Check consistency of leaf nodes.

Write message to stderr for every error detected.

Returns
true if leaf nodes all pass consistency checks, else false

Definition at line 764 of file NetInfo.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::NetInfo::checkLeafRange ( ) const
private

Check leaf address ranges of all routers.

Write message to stderr for every error detected.

Returns
true if each router's leaf address range is consistent with its address (must all lie in its zip code) and no two routers have overlapping leaf address ranges, otherwise return false

Definition at line 720 of file NetInfo.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::NetInfo::checkLinkRates ( ) const
private

Check that link rates are consistent with Forest requirements.

Returns
true if all link rates are consistent, else false

Definition at line 804 of file NetInfo.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::NetInfo::checkLocalLinks ( ) const
private

Check that the local link numbers at all routers are consistent.

Write message to stderr for every error detected.

Returns
true if all local link numbers are consistent, else false

Definition at line 636 of file NetInfo.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::NetInfo::checkRtrRates ( ) const
private

Check interface and link rates at all routers for consistency.

Write an error message to stderr for each error detected

Returns
true if all check pass, else false

Definition at line 827 of file NetInfo.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int forest::NetInfo::firstController ( ) const
inline

Get the node number of the first controller in the Forest network.

Used for iterating through all the controllers

Returns
the node number of the first controller, or 0 if no controllers have been defined.

Definition at line 294 of file NetInfo.h.

Here is the caller graph for this function:

int forest::NetInfo::firstLeaf ( ) const
inline

Get the node number of the first leaf node in the Forest network.

Used for iterating through all the leaf nodes.

Returns
the node number of the nominal first leaf, or 0 if no leaves have been defined.

Definition at line 428 of file NetInfo.h.

Here is the caller graph for this function:

int forest::NetInfo::firstLink ( ) const
inline

Get the number of the first link in the Forest network.

Returns
the number of the first link or 0 if no links have been defined.

Definition at line 694 of file NetInfo.h.

Here is the caller graph for this function:

int forest::NetInfo::firstLinkAt ( int  n) const
inline

Get the number of the first link incident to a specified node.

Parameters
nis the node number of a node in the network
Returns
the number of the first link incident to n or 0 if there are no links incident to n

Definition at line 708 of file NetInfo.h.

Here is the call graph for this function:

Here is the caller graph for this function:

int forest::NetInfo::firstNode ( ) const
inline

Get the number of the "first" node in the Forest network.

This method is used when iterating through all the nodes.

Returns
the node number of a nominal first node.

Definition at line 272 of file NetInfo.h.

Here is the call graph for this function:

Here is the caller graph for this function:

int forest::NetInfo::firstRouter ( ) const
inline

Get the node number of the first router in the Forest network.

Used for iterating through all the routers.

Returns
the node number of the nominal first router, or 0 if no routers have been defined.

Definition at line 490 of file NetInfo.h.

Here is the caller graph for this function:

RateSpec & forest::NetInfo::getAvailRates ( int  lnk) const
inline

Get the available rates of a link in the Forest network.

Parameters
lnkis a link number
Returns
a reference to the available rate spec

Definition at line 812 of file NetInfo.h.

Here is the caller graph for this function:

RateSpec & forest::NetInfo::getDefLeafRates ( )
inline

Get the default rates for leaf nodes in a Forest network.

Returns
a reference to RateSpec for leaf rates

Definition at line 819 of file NetInfo.h.

int forest::NetInfo::getIface ( int  llnk,
int  rtr 
) const

Get the interface associated with a given local link number.

Parameters
llnkis a local link number
rtris a router
Returns
the number of the interface that hosts llnk

Definition at line 62 of file NetInfo.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

ipa_t forest::NetInfo::getIfIpAdr ( int  n,
int  iface 
) const
inline

Get the IP address of a specified router interface.

Parameters
ris the node number of a router in the network
ifaceis an interface number for r
Returns
the IP address of the specified interface or 0 if there is no such interface

Definition at line 581 of file NetInfo.h.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::NetInfo::getIfLinks ( int  r,
int  iface,
pair< int, int > &  links 
) const
inline

Get the range of link numbers assigned to an interface.

Each router interface is assigned a consecutive range of link numbers.

Parameters
ris the node number of a router in the network
ifaceis an interface number for r
Returns
true on success, else false

Definition at line 610 of file NetInfo.h.

Here is the call graph for this function:

Here is the caller graph for this function:

ipp_t forest::NetInfo::getIfPort ( int  n,
int  iface 
) const
inline

Get the IP port of a specified router interface.

Parameters
ris the node number of a router in the network
ifaceis an interface number for r
Returns
the port number of the specified interface or 0 if there is no such interface

Definition at line 591 of file NetInfo.h.

Here is the call graph for this function:

Here is the caller graph for this function:

RateSpec & forest::NetInfo::getIfRates ( int  r,
int  iface 
) const
inline

Get the RateSpec for a router interface.

Parameters
ris the node number of a router in the network
ifaceis an interface number for r
Returns
a reference to the RateSpec for the specified router interface

Definition at line 600 of file NetInfo.h.

Here is the caller graph for this function:

ipa_t forest::NetInfo::getLeafIpAdr ( int  n) const
inline

Get the IP address of a leaf node.

Parameters
nis a leaf node number
Returns
the IP address of n or 0 if n is not a valid leaf

Definition at line 536 of file NetInfo.h.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::NetInfo::getLeafRange ( int  r,
pair< fAdr_t, fAdr_t > &  range 
) const
inline

Get the range of leaf addresses for a router.

Parameters
ris the node number of the router
adris the forest address that defines the start of the range
Returns
true if the operation succeeds, else false

Definition at line 516 of file NetInfo.h.

Here is the call graph for this function:

Here is the caller graph for this function:

int forest::NetInfo::getLeft ( int  lnk) const
inline

Get the node number for the "left" endpoint of a given link.

The endpoints of a link are arbitrarily designated "left" and "right".

Parameters
lnkis a link number
Returns
the node number of the left endpoint of lnk, or 0 if lnk is not a valid link number.

Definition at line 733 of file NetInfo.h.

Here is the call graph for this function:

Here is the caller graph for this function:

int forest::NetInfo::getLeftLLnum ( int  lnk) const
inline

Get the local link number used by the left endpoint of a link.

Each router in a Forest network refers to links using local link numbers.

Parameters
lnkis a "global" link number
Returns
the local link number used by the left endpoint, or 0 if the link number is invalid or the left endpoint is not a router.

Definition at line 776 of file NetInfo.h.

Here is the call graph for this function:

Here is the caller graph for this function:

int forest::NetInfo::getLinkLength ( int  lnk) const
inline

Get the length of a link in the Forest network.

Parameters
lnkis a link number
Returns
the assigned link length in kilometers, or 0 if lnk is not a valid link number

Definition at line 828 of file NetInfo.h.

Here is the call graph for this function:

Here is the caller graph for this function:

int forest::NetInfo::getLinkNum ( int  nn,
int  llnk 
) const
inline

Get the global link number of a link incident to a node.

Parameters
nnis a valid node number
llnkis an optional local link number
Returns
the link number of the node; if the node is a router, the link is the one with the specified local link number; return 0 on error

Definition at line 838 of file NetInfo.h.

Here is the call graph for this function:

Here is the caller graph for this function:

RateSpec & forest::NetInfo::getLinkRates ( int  lnk) const
inline

Get the RateSpec of a link in the Forest network.

Parameters
lnkis a link number
Returns
a reference to the link rate spec

Definition at line 804 of file NetInfo.h.

Here is the caller graph for this function:

int forest::NetInfo::getLLnum ( int  lnk,
int  r 
) const
inline

Get the local link number used by one of the endpoints of a link.

Each router in a Forest network refers to links using local link numbers.

Parameters
lnkis a "global" link number
ris the node number of router
Returns
the local link number used by r or 0 if r is not a router or is not incident to lnk

Definition at line 764 of file NetInfo.h.

Here is the call graph for this function:

Here is the caller graph for this function:

int forest::NetInfo::getMaxLink ( ) const
inline

Get the maximum link number for the network.

Returns
the largest link number for links in this network

Definition at line 725 of file NetInfo.h.

int forest::NetInfo::getMaxNode ( ) const
inline

Get the maximum node number for the network.

Returns
the largest node number for nodes in this network

Definition at line 315 of file NetInfo.h.

Here is the caller graph for this function:

int forest::NetInfo::getMaxRouter ( ) const
inline

Get the maximum router number for the network.

Returns
the largest router number for this network

Definition at line 503 of file NetInfo.h.

fAdr_t forest::NetInfo::getNodeAdr ( int  n) const
inline

Get the Forest address of a node.

Parameters
nis a node number
Returns
the Forest address of n or 0 if n is not a valid node

Definition at line 544 of file NetInfo.h.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::NetInfo::getNodeLocation ( int  n,
pair< double, double > &  loc 
) const
inline

Get the location of a node in the Forest network.

Parameters
nis a node number
locis a reference to a pair of doubles in which the latitude and longitude are returned
Returns
true on success, false on failure

Definition at line 555 of file NetInfo.h.

Here is the call graph for this function:

Here is the caller graph for this function:

string & forest::NetInfo::getNodeName ( int  n,
string &  s 
) const
inline

Get the name for a specified node.

Parameters
nis a node number
sis a provided string in which the result is to be returned
Returns
a reference to s

Definition at line 322 of file NetInfo.h.

Here is the call graph for this function:

Here is the caller graph for this function:

int forest::NetInfo::getNodeNum ( string &  s) const
inline

Get the node number corresponding to a give node name.

Parameters
sis the name of a node
Returns
an integer node number or 0 if the given string does not the name of any node

Definition at line 334 of file NetInfo.h.

Here is the caller graph for this function:

int forest::NetInfo::getNodeNum ( fAdr_t  adr) const
inline

Get the node number corresponding to a give forest address.

Parameters
adris the forest address of a node
Returns
an integer node number or 0 if the given forest address is not used by any node

Definition at line 344 of file NetInfo.h.

Forest::ntyp_t forest::NetInfo::getNodeType ( int  n) const
inline

Get the type of a specified node.

Parameters
nis a node number
Returns
the node type of n or UNDEF_NODE if n is not a valid node number

Definition at line 353 of file NetInfo.h.

Here is the call graph for this function:

Here is the caller graph for this function:

uint64_t forest::NetInfo::getNonce ( int  lnk) const
inline

Get the nonce for a link.

Parameters
lnkis the number of a link.
Returns
the nonce used to identify an endpoint when connecting a link

Definition at line 796 of file NetInfo.h.

Here is the call graph for this function:

Here is the caller graph for this function:

int forest::NetInfo::getNumIf ( int  r) const
inline

Get the number of interfaces defined for a router.

Parameters
ris the node number of a router
Returns
the number of interfaces defined for router r or 0 if r is not a valid router

Definition at line 528 of file NetInfo.h.

Here is the call graph for this function:

Here is the caller graph for this function:

int forest::NetInfo::getNumRouters ( ) const
inline

Get the number of routers in this network.

Returns
the largest router number for this network

Definition at line 508 of file NetInfo.h.

Here is the caller graph for this function:

int forest::NetInfo::getPeer ( int  n,
int  lnk 
) const
inline

Get the node number for the "other" endpoint of a given link.

Parameters
nis a node number
lnkis a link number
Returns
the node number of the endpoint of lnk that is not n, or 0 if lnk is not a valid link number or n is not an endpoint of lnk

Definition at line 753 of file NetInfo.h.

Here is the call graph for this function:

Here is the caller graph for this function:

int forest::NetInfo::getRight ( int  lnk) const
inline

Get the node number for the "right" endpoint of a given link.

The endpoints of a link are arbitrarily designated "left" and "right".

Parameters
lnkis a link number
Returns
the node number of the right endpoint of lnk, or 0 if lnk is not a valid link number.

Definition at line 743 of file NetInfo.h.

Here is the call graph for this function:

Here is the caller graph for this function:

int forest::NetInfo::getRightLLnum ( int  lnk) const
inline

Get the local link number used by the right endpoint of a link.

Each router in a Forest network refers to links using local link numbers.

Parameters
lnkis a "global" link number
Returns
the local link number used by the right endpoint, or 0 if the link number is invalid or the left endpoint is not a router.

Definition at line 787 of file NetInfo.h.

Here is the call graph for this function:

Here is the caller graph for this function:

NetInfo::statusType forest::NetInfo::getStatus ( int  n) const
inline

Get the status of a node.

Parameters
nis a node number
Returns
true on success, false on failure

Definition at line 570 of file NetInfo.h.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::NetInfo::isLeaf ( int  n) const
inline

Determine if a given node number identifies a leaf.

Parameters
nis an integer node number
Returns
true if n corresponds to a leaf in the network, else false

Definition at line 419 of file NetInfo.h.

Here is the caller graph for this function:

bool forest::NetInfo::isRouter ( int  n) const
inline

Determine if a given node number identifies a router.

Parameters
nis an integer node number
Returns
true if n corresponds to a router in the network, else false

Definition at line 472 of file NetInfo.h.

Here is the caller graph for this function:

string & forest::NetInfo::leaf2string ( int  leaf,
string &  s 
) const
private

Create a string representation of a leaf node.

Parameters
leafis a node number for a leaf node
sis a reference to a string in which result is returned
Returns
a reference to s

Definition at line 999 of file NetInfo.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

string & forest::NetInfo::link2string ( int  ) const

Create a string representation of a link.

Parameters
lnkis a link number
sis a reference to a string in which result is returned
Returns
a reference to s

Definition at line 876 of file NetInfo.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

string & forest::NetInfo::linkProps2string ( int  ) const

Create a string representation of a link and its properties.

Parameters
linkis a link number
sis a reference to a string in which result is returned
Returns
a reference to s

Definition at line 894 of file NetInfo.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

string & forest::NetInfo::linkState2string ( int  ) const

Create a string representation of a link and its current state.

Parameters
linkis a link number
sis a reference to a string in which result is returned
Returns
a reference to s

Definition at line 913 of file NetInfo.cpp.

Here is the call graph for this function:

uint64_t forest::NetInfo::ll2l_key ( int  r,
int  llnk 
) const
inlineprivate

returns key used with locLnk2lnk

Helper method used to define keys for internal locLnk2lnk HashMap.

Parameters
ris the node number of a router
llnkis a local link number at r
Returns
a hash key appropriate for use with locLnk2lnk

Definition at line 916 of file NetInfo.h.

Here is the caller graph for this function:

void forest::NetInfo::lock ( )
inline

Lock the data structure.

Use in multi-threaded applications that dynamically modify the data structure. For now, just a single global lock.

Definition at line 924 of file NetInfo.h.

int forest::NetInfo::nextController ( int  n) const
inline

Get the node number of the next controller in the Forest network.

Used for iterating through all the controllers

Parameters
nis the node number for a controller
Returns
the node number of the next controller, or 0 if there is no next controller.

Definition at line 305 of file NetInfo.h.

Here is the caller graph for this function:

int forest::NetInfo::nextLeaf ( int  n) const
inline

Get the node number of the "next" leaf node in the Forest network.

Used for iterating through all the leaves.

Parameters
nis the number of a leaf in the network
Returns
the node number of the leaf following n, or 0 if there is no such leaf

Definition at line 438 of file NetInfo.h.

Here is the caller graph for this function:

int forest::NetInfo::nextLink ( int  lnk) const
inline

Get the number of the next link in the Forest network.

is the number of a link in the network

Returns
the number of the link following lnk or 0 if there is no such link

Definition at line 701 of file NetInfo.h.

Here is the caller graph for this function:

int forest::NetInfo::nextLinkAt ( int  n,
int  lnk 
) const
inline

Get the number of the next link incident to a specified node.

Parameters
nis the node number of a node in the network
lnkis a link incident to n
Returns
the number of the next link incident to n or 0 if there is no such link

Definition at line 718 of file NetInfo.h.

Here is the call graph for this function:

Here is the caller graph for this function:

int forest::NetInfo::nextNode ( int  n) const
inline

Get the node number of the "next" node in the Forest network.

Used for iterating through all the nodes.

Parameters
nis the number of a node in the network
Returns
the node number of the node following n, or 0 if there is no such node

Definition at line 282 of file NetInfo.h.

Here is the call graph for this function:

Here is the caller graph for this function:

int forest::NetInfo::nextRouter ( int  r) const
inline

Get the node number of the "next" router in the Forest network.

Used for iterating through all the routers.

Parameters
ris the number of a router in the network
Returns
the node number of the router following r, or 0 if there is no such router

Definition at line 498 of file NetInfo.h.

Here is the caller graph for this function:

bool forest::NetInfo::read ( istream &  in)

Reads a network topology file and initializes the NetInfo data structure.

Example of NetInfo file format.

define salt router

router(salt,1.1000,(40,-50),(1.1-1.200),

num, ipAdr, links, rate spec

[ 1, 193.168.3.4, 1, (50000,30000,25000,15000) ], [ 2, 193.168.3.5, 2-30, (50000,30000,25000,15000) ] )

leaf(netMgr,controller,192.168.1.3,2.900,(40,-50))

link(netMgr,salt.2,1000,(3000,3000,5000,5000)) ; # semicolon to terminate

Parameters
inis an open input stream from which topology file is read
Returns
true if the operation is successful, false if it fails (failures are typically accompanied by error messages on cerr)

Definition at line 195 of file NetInfo.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::NetInfo::readAdrRange ( istream &  in,
pair< fAdr_t, fAdr_t > &  range 
)
private

Read an address range pair.

Parameters
inis an open input stream
rangeis a reference to a pair of Forest addresses in which result is returned
Returns
true on success, false on failure

Definition at line 382 of file NetInfo.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int forest::NetInfo::readIface ( istream &  in,
IfInfo ifaces,
string &  errMsg 
)
private

Read a router interface description from an input stream.

Parameters
inis an open input stream
ifacespoints to an array of IfInfo structs used to return the interface definition; this interface is written at the position specified by its interface number
errMsgis a reference to a string used for returning an error message
Returns
the number of the interface on success, else 0

Definition at line 419 of file NetInfo.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::NetInfo::readLeaf ( istream &  in,
LeafNodeInfo leaf,
string &  errMsg 
)
private

Read a leaf node description from an input stream.

Expects the next nonblank input character to be the opening parentheis of the leaf node description.

Parameters
inis an open input stream
leafis a reference to a LeafNodeInfo struct used to return result
errMsgis a reference to a string used for returning an error message
Returns
true on success, false on failure

Definition at line 495 of file NetInfo.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::NetInfo::readLink ( istream &  in,
LinkDesc link,
string &  errMsg 
)
private

Read a link description from an input stream.

Expects the next nonblank input character to be the opening parentheis of the link description.

Parameters
inis an open input stream
linkis a reference to a LinkDesc struct used to return the result
errMsgis a reference to a string used for returning an error message
Returns
true on success, false on failure

Definition at line 542 of file NetInfo.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::NetInfo::readLinkEndpoint ( istream &  in,
string &  name,
int &  num 
)
private

Read a link endpoint.

Parameters
inis an open input stream
nameis a reference to a string used to return the endpoint name
numis a reference to an int used to return the local link number
Returns
true on success, false on failure

Definition at line 584 of file NetInfo.cpp.

Here is the caller graph for this function:

bool forest::NetInfo::readLocation ( istream &  in,
pair< double, double > &  loc 
)
private

Read a (latitude,longitude) pair.

Parameters
inis an open input stream
locis a reference to a pair of ints in which result is returned
Returns
true on success, false on failure

Definition at line 367 of file NetInfo.cpp.

Here is the caller graph for this function:

bool forest::NetInfo::readRateSpec ( istream &  in,
RateSpec rs 
)
private

Read a rate specification.

Parameters
inis an open input stream
rsis a reference to a RateSpec in which result is returned
Returns
true on success, false on failure

Definition at line 395 of file NetInfo.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::NetInfo::readRouter ( istream &  in,
RtrNodeInfo rtr,
IfInfo ifaces,
string &  errMsg 
)
private

Read a router description from an input stream.

Expects the next nonblank input character to be the opening parentheis of the router description.

Parameters
inis an open input stream
rtris a reference to a RtrNodeInfo struct used to return the result
ifacespoints to an array of IfInfo structs used to return the interface definitions
errMsgis a reference to a string used for returning an error message
Returns
true on success, false on failure

Definition at line 319 of file NetInfo.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

string & forest::NetInfo::rtr2string ( int  rtr,
string &  s 
) const
private

Create a string representation of a router.

Parameters
rtris a node number for a router
sis a reference to a string in which result is returned
Returns
a reference to s

Definition at line 965 of file NetInfo.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::NetInfo::setIfIpAdr ( int  r,
int  iface,
ipa_t  ip 
)
inline

Set the IP address of a router interface.

Parameters
ris the node number of a router
ifaceis the interface number
ipis the new ip address for the interface
Returns
true if the operation succeeds, else false

Definition at line 661 of file NetInfo.h.

Here is the call graph for this function:

bool forest::NetInfo::setIfLinks ( int  r,
int  iface,
pair< int, int > &  links 
)
inline

Set the RateSpec for a router interface.

Parameters
ris the node number of a router in the network
ifaceis an interface number for r
rsis a reference to a RateSpec
Returns
true on success, else false inline bool NetInfo::setIfRates(int r, int iface, RateSpec& rs) { if (!validIf(r,iface)) return false; rtr[r].iface[iface].rates = rs; return true; }Set the range of links defined for a router interface. Each router interface is assigned a consecutive range of link numbers
Parameters
ris the node number of the router
ifaceis the interface number
linksis a reference to a pair of link numbers that define range
Returns
true if the operation succeeds, else false

Definition at line 648 of file NetInfo.h.

Here is the call graph for this function:

bool forest::NetInfo::setIfPort ( int  r,
int  iface,
ipp_t  port 
)
inline

Set the IP address of a router interface.

Parameters
ris the node number of a router
ifaceis the interface number
portis the port number for the interface
Returns
true if the operation succeeds, else false

Definition at line 673 of file NetInfo.h.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::NetInfo::setLeafIpAdr ( int  n,
ipa_t  ip 
)
inline

Set the IP address of a leaf node.

Parameters
nis the node number of the leaf
ipis its new IP address
Returns
true if the operation succeeds, else false

Definition at line 459 of file NetInfo.h.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::NetInfo::setLeafRange ( int  ,
pair< int, int > &   
)
inline

Set the range of assignable client addresses for this router.

Parameters
ris the node number of the router
adris the forest address that defines the start of the range
Returns
true if the operation succeeds, else false

Definition at line 622 of file NetInfo.h.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::NetInfo::setLeafType ( int  n,
Forest::ntyp_t  typ 
)
inline

Set the node type of a leaf node.

Parameters
nis the node number of the leaf
typis its new node type
Returns
true if the operation succeeds, else false

Definition at line 448 of file NetInfo.h.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::NetInfo::setLeftLLnum ( int  lnk,
int  loc 
)
inline

Set the local link number used by the left endpoint of a link.

Each router in a Forest network refers to links using local link numbers.

Parameters
lnkis a "global" link number
locis the local link number to be used by the left endpoint of lnk
Returns
true on success, else false

Definition at line 850 of file NetInfo.h.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::NetInfo::setLinkLength ( int  lnk,
int  len 
)
inline

Set the RateSpec for a link.

Parameters
lnkis a link number
rsis the new RateSpec for the link
Returns
true on success, false on failure inline bool NetInfo::setLinkRates(int lnk, RateSpec& rs) { if (!validLink(lnk)) return false; link[lnk].rates = rs; return true; } Set the available capacity of a link.
Parameters
lnkis a link number
rsis a RateSpec inline bool NetInfo::setAvailRates(int lnk, RateSpec& rs) { if (!validLink(lnk)) return false; link[lnk].availRates = rs; return true; }Set the length of a link.
lnkis a "global" link number
lenis the new length
Returns
true on success, else false

Definition at line 905 of file NetInfo.h.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::NetInfo::setNodeAdr ( int  n,
fAdr_t  adr 
)
inline

Set the forest address of a node.

Parameters
nis the node number for the node
adris its new forest address
Returns
true if the operation succeeds, else false

Definition at line 378 of file NetInfo.h.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::NetInfo::setNodeLocation ( int  n,
pair< double, double > &  loc 
)
inline

Set the location of a node in the Forest network.

Parameters
nis a node number
locis a reference to a pair of doubles which defines the new latitude and longitude
Returns
true on success, false on failure

Definition at line 392 of file NetInfo.h.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::NetInfo::setNodeName ( int  n,
string &  nam 
)
inline

Set the name of a node.

Parameters
nis the node number for the node
namis its new name
Returns
true if the operation succeeds, else false

Definition at line 363 of file NetInfo.h.

Here is the call graph for this function:

bool forest::NetInfo::setNonce ( int  lnk,
uint64_t  nonce 
)
inline

Set the nonce for a link.

Parameters
lnkis the number of a link.
nonceis a nonce used to identify an endpoint when connecting a link
Returns
true on success, else false

Definition at line 873 of file NetInfo.h.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::NetInfo::setRightLLnum ( int  lnk,
int  loc 
)
inline

Set the local link number used by the right endpoint of a link.

Each router in a Forest network refers to links using local link numbers.

Parameters
lnkis a "global" link number
locis the local link number to be used by the right endpoint of lnk
Returns
true on success, else false

Definition at line 862 of file NetInfo.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void forest::NetInfo::setStatus ( int  n,
statusType  status 
)
inline

Set the status of a node.

Parameters
nis a node number
statusis the node status

Definition at line 407 of file NetInfo.h.

Here is the call graph for this function:

Here is the caller graph for this function:

string & forest::NetInfo::toString ( ) const

Create a string representation of the NetInfo object.

Parameters
sis a reference to a string in which result is returned
Returns
a reference to s

Definition at line 932 of file NetInfo.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::NetInfo::validIf ( int  r,
int  iface 
) const
inline

Check to see if a given router interface is valid.

Parameters
ris the node number of a router
ifaceis an integer interface n umber
Returns
true if iface is a falid interface for r, else false

Definition at line 480 of file NetInfo.h.

Here is the call graph for this function:

Here is the caller graph for this function:

bool forest::NetInfo::validLink ( int  lnk) const
inline

Check to see if a given link number is valid.

Parameters
nis an integer link number
Returns
true if n corresponds to a link in the network, else false

Definition at line 686 of file NetInfo.h.

Here is the caller graph for this function:

bool forest::NetInfo::validNode ( int  n) const
inline

Check to see that a node number is valid.

Parameters
nis an integer node number
Returns
true if n represents a valid node in the network, else false

Definition at line 264 of file NetInfo.h.

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

int forest::NetInfo::maxRtr
private

max node number for a router;

leaf nodes all have larger node numbers

Definition at line 157 of file NetInfo.h.

Wgraph* forest::NetInfo::netTopo
private

NetTopo is a weighted graph defining the network topology.

Weights represent link costs

Definition at line 166 of file NetInfo.h.


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