cnet v4.0.4  

home topology files command‑line options the core API FAQ download and install

cnet's core data structures

cnet's provides a number of core data structures, each defined in the <cnet.h> header file. Each node has access to its own instance of these data structures. The data structures are:

The nodeinfo data structure

Each node's attributes may be accessed with, for example, if(nodeinfo.nlinks > 1) ...

datatype fieldname meaning
CnetNodeType nodetype one of NT_HOST, NT_ROUTER, NT_MOBILE, or NT_ACCESSPOINT
int nodenumber this node's unique number, from 0 .. number_of_nodes-1
CnetAddr address this node's unique address
char array nodename this node's unique name, a nul-byte terminated string such as host3 or Perth
int nlinks this node's number of physical links, ≥ 1
CnetTime time_in_usec the number of microseconds since this node last rebooted
structure of 2 ints time_of_day this node's "wall clock" time, with subfields time_of_day.secs and time_of_day.usec
CnetTime messagerate the rate (in microseconds) at which this node's Application Layer generates new messages
int minmessagesize the minimum sized message to be generated by this node's Application Layer
int maxmessagesize the maximum sized message to be generated by this node's Application Layer

The linkinfo data structure

The attributes of each node's links may be accessed via fields in the linkinfo data structure. linkinfo is an array, of type LinkInfo, indexed by the required link number. Link numbers commence at 0 (for the LT_LOOPBACK link); the first "true", physical link has the index 1.

Each link's attributes may be accessed with, for example, if(linkinfo[1].linkup) ...

datatype fieldname meaning
CnetLinkType linktype one of LT_LOOPBACK, LT_WAN, LT_LAN, or LT_WLAN
char array linkname this link's unique name, a nul-byte terminated string such as lan1 or wlan0
bool linkup true iff this link is up and functioning correctly
CnetNICaddr nicaddr this link's network interface card's (NIC's) address
int bandwidth this link's bandwidth, in bits per second
int mtu this link's maximum transmission unit (MTU) in bytes
CnetTime propagationdelay the propagation delay (in microseconds) along this link, iff a LT_WAN or LT_LAN link
int costperbyte the (unitless) cost of transmitting each byte on this link
int costperframe the (unitless) cost of transmitting each frame on this link

cnet v4.0.4 - [email protected]