forest-net
an overlay networks for large-scale virtual worlds
|
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 | |
Miscellaneous utility functions.
This class defines various constants and common functions useful within a Forest router and Forest hosts.
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 |
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.
|
inlinestatic |
|
inlinestatic |
Construct a forest address from a zip code and local address.
Assumes that both arguments are >0.
zip | is the zip code part of the address |
local | is the local address part |
Definition at line 202 of file Forest.h.
|
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.
fas | is the forest address string to be converted |
|
inlinestatic |
|
inlinestatic |
|
static |
Read a forest address.
in | is an open input stream |
fa | is 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.
|
inlinestatic |
Compute link packet length for a given forest packet length.
x | is the number of bytes in the Forest packet |
Definition at line 245 of file Forest.h.
|
inlinestatic |
Determine if given Forest address is a valid unicast address.
adr | is a Forest address |
Definition at line 172 of file Forest.h.
|
inlinestatic |