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

Miscellaneous utility functions. More...

#include <Forest.h>

Public Types

enum  ntyp_t {
  UNDEF_NODE =0, CLIENT =1, SERVER =2, TRUSTED =100,
  ROUTER =101, CONTROLLER =102
}
 Forest node types. More...
 
enum  ptyp_t {
  UNDEF_PKT =0, CLIENT_DATA =1, SUB_UNSUB =2, CLIENT_SIG =10,
  CONNECT =11, DISCONNECT =12, UNKNOWN_DEST =13, NET_SIG =100,
  RTE_REPLY =101, RTR_CTL =200, VOQSTATUS =201
}
 Forest packet types. More...
 
enum  ComtConfigMode { NUL_CFG =0, STATIC =1, LEAFADJUST =2, STEPADJUST =3 }
 Comtree configuration modes. More...
 
enum  AccessMethod { NUL_AXS =0, OPEN =1, BYPERMISSION =2, BYPASSWORD =3 }
 Comtree access method. More...
 

Static Public Member Functions

static bool validUcastAdr (fAdr_t)
 Determine if given Forest address is a valid unicast address. More...
 
static bool mcastAdr (fAdr_t)
 Determine if given Forest address is a valid multicast address. More...
 
static int zipCode (fAdr_t)
 Get the zip code of a unicast address. More...
 
static int localAdr (fAdr_t)
 Get the local address part of a unicast address. More...
 
static fAdr_t forestAdr (int, int)
 Construct a forest address from a zip code and local address. More...
 
static fAdr_t forestAdr (const char *)
 Construct a forest address for the string pointed to by fas. More...
 
static string fAdr2string (fAdr_t)
 Create a string representation of a forest address. More...
 
static bool readForestAdr (istream &, fAdr_t &)
 Read a forest address. More...
 
static int truPktLeng (int)
 Compute link packet length for a given forest packet length. More...
 
static string nodeType2string (ntyp_t)
 
static ntyp_t getNodeType (string &)
 
static bool isSigComt (comt_t)
 

Static Public Attributes

static const uint8_t FOREST_VERSION = 1
 version of forest protocol
 
static const int HDR_LENG = 20
 header length in bytes
 
static const int MAX_PLENG = 1450
 max packet length in bytes
 
static const int OVERHEAD = 24
 total overhead
 
static const flgs_t RTE_REQ = 0x01
 route request
 
static const flgs_t ACK_FLAG = 0x02
 acknowledgment
 
static const flgs_t NACK_FLAG = 0x02
 negative acknowledgment
 
static const ipp_t NM_PORT = 30120
 port # used by netMgr
 
static const ipp_t CC_PORT = 30121
 port # used by comtCtl
 
static const ipp_t CM_PORT = 30122
 port # used by clientMgr
 
static const ipp_t ROUTER_PORT = 30123
 port # used by routers
 
static const short int MAXINTF = 20
 max # of interfaces
 
static const short int MAXLNK = 1000
 max # of links per router
 
static const int MINBITRATE = 1
 min link bit rate in Kb/s
 
static const int MAXBITRATE = 900000
 max link bit rate in Kb/s
 
static const int MINPKTRATE = 1
 min packet rate in p/s
 
static const int MAXPKTRATE = 450000
 max packet rate in p/s
 
static const uint32_t BUF_SIZ = 1600
 size of a packet buffer
 
static const comt_t NABOR_COMT = 1
 dummy comtree for neighbors
 
static const comt_t CLIENT_SIG_COMT = 2
 for client signaling
 
static const comt_t NET_SIG_COMT = 100
 for internal signaling
 

Detailed Description

Miscellaneous utility functions.

This class defines various constants and common functions useful within a Forest router and Forest hosts.

Definition at line 45 of file Forest.h.

Member Enumeration Documentation

Comtree access method.

This enumeration lists the distinct access methods for the joining a comtree.

Enumerator
OPEN 

Anyone can join.

BYPERMISSION 

requires permission of supervisor

BYPASSWORD 

client needs comtree password

Definition at line 111 of file Forest.h.

Comtree configuration modes.

This enumeration lists the distinct configuration modes for the backbone links in a comtree.

Enumerator
STATIC 

no automatic adjustment

LEAFADJUST 

adjust every time leaf joins/drops

STEPADJUST 

adjust in discrete steps

Definition at line 97 of file Forest.h.

Forest node types.

Nodes in a Forest network are assigned specific roles. Nodes with node type codes smaller than 100, are considered untrusted. All packets received from such hosts are subjected to extra checks. For example, they may only send packets with a source address equal to their assigned address.

Enumerator
CLIENT 

client component

SERVER 

server component

TRUSTED 

numeric separator

ROUTER 

router component

CONTROLLER 

network control element

Definition at line 55 of file Forest.h.

Forest packet types.

This enumeration lists the distinct packet types that are currently defined. These are the types that go in the type field of the first word of each Forest packet.

Enumerator
CLIENT_DATA 

normal data packet from a host

SUB_UNSUB 

subscribe to multicast groups

CLIENT_SIG 

client signalling packet

CONNECT 

connect to a link

DISCONNECT 

disconnect a link

UNKNOWN_DEST 

error indication

NET_SIG 

network signalling packet

RTE_REPLY 

route reply for route learning

Definition at line 71 of file Forest.h.

Member Function Documentation

string forest::Forest::fAdr2string ( fAdr_t  fAdr)
inlinestatic

Create a string representation of a forest address.

Parameters
fAdris a forest address
Returns
the string representation of fAdr

Definition at line 232 of file Forest.h.

Here is the caller graph for this function:

fAdr_t forest::Forest::forestAdr ( int  zip,
int  local 
)
inlinestatic

Construct a forest address from a zip code and local address.

Assumes that both arguments are >0.

Parameters
zipis the zip code part of the address
localis the local address part
Returns
the corresponding unicast address

Definition at line 202 of file Forest.h.

Here is the caller graph for this function:

fAdr_t forest::Forest::forestAdr ( const char *  fas)
inlinestatic

Construct a forest address for the string pointed to by fas.

A string representing a negative number is interpreted as a multicast address. Otherwise, we expect a unicast address with the form zip_code.local_addr.

Parameters
fasis the forest address string to be converted
Returns
the corresponding forest address, or 0 if the input is not a valid address

Definition at line 216 of file Forest.h.

int forest::Forest::localAdr ( fAdr_t  adr)
inlinestatic

Get the local address part of a unicast address.

Assumes that the address is valid.

Parameters
adris a Forest address
Returns
the local address part of the address

Definition at line 194 of file Forest.h.

bool forest::Forest::mcastAdr ( fAdr_t  adr)
inlinestatic

Determine if given Forest address is a valid multicast address.

Parameters
adris a Forest address
Returns
true if it is a valid multicast address (is <0)

Definition at line 180 of file Forest.h.

Here is the caller graph for this function:

bool forest::Forest::readForestAdr ( istream &  in,
fAdr_t fa 
)
static

Read a forest address.

Parameters
inis an open input stream
fais a reference to a forest address in which result is returned; a negative value on the input stream in interpreted as a multicast address; otherwise, we expect a unicast address in dotted decimal format; we require that either the zip code part is >0 or both parts are equal to zero; we allow 0.0 for null addresses and x.0 for unicast routes to foreign zip codes. The address is returned in host byte order.

Definition at line 22 of file Forest.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int forest::Forest::truPktLeng ( int  x)
inlinestatic

Compute link packet length for a given forest packet length.

Parameters
xis the number of bytes in the Forest packet
Returns
the number of bytes sent on the link, including the IP/UDP header and a presumed Ethernet header plus inter-frame gap.

Definition at line 245 of file Forest.h.

Here is the caller graph for this function:

bool forest::Forest::validUcastAdr ( fAdr_t  adr)
inlinestatic

Determine if given Forest address is a valid unicast address.

Parameters
adris a Forest address
Returns
true if it is a valid unicast address (is greater than zero and both the zip code and local part of the address are >0)

Definition at line 172 of file Forest.h.

Here is the caller graph for this function:

int forest::Forest::zipCode ( fAdr_t  adr)
inlinestatic

Get the zip code of a unicast address.

Assumes that the address is valid.

Parameters
adris a Forest address
Returns
the zip code part of the address

Definition at line 187 of file Forest.h.

Here is the caller graph for this function:


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