cnet v2.0.10

home
introduction
simulation model

topology files
cmdline options
the API

FAQ

download

Global attributes

Global attributes affect the execution of the whole simulation, and may not be redefined on a per-node or per-link basis. The global attributes are not accessible to the protocol's C code at runtime.

Global attribute Datatype Meaning Examples
bgimage string provides the name of a GIF-format image file to be centered on the simulation's main window. The image file is sought via the CNETPATH environment variable if necessary bgimage = "australia1.gif"
drawframes Boolean The global drawframes attribute requests that frames traversing the Physcial Layer be drawn under certain conditions. By specifying a special event handler, Data Link Layer protocols in a 2-node network may request that their frames be drawn using different colours and lengths. drawframes = true
showcostperbyte Boolean requests that each link's costperbyte attribute value be displayed on the simulation's main window over each link. The use of showcostperframe overrides that of showcostperbyte. showcostperbyte = false
showcostperframe Boolean requests that each link's costperframe attribute value be displayed on the simulation's main window over each link. The use of showcostperframe overrides that of showcostperbyte. showcostperframe = true
tracefile string requests that the trace of execution be mirrored in the named file when the -t option is given. Warning - trace files can grow very large (to several megabytes), very quickly. tracefile = "appl-trace"

line

Node attributes

The initial values of node attributes (global or per-node) may be specified in cnet's topology files. Some node attributes may be modified while the simulation is running. Node attributes include the rate of new message generation, minimum and maximum message sizes, whether or not to trace all node activity, and the expected rates of node failure and repair.

Node attribute Datatype Meaning Examples
address integer the unique network address of each node address = 238
compile string a compilation string to declare the sourcefile names containing the protocols for each node (locally overrides the -C option) compile = "protocol.c stats.c -lm"
messagerate time the rate at which the Application Layer can generate new messages for delivery messagerate = 10000usecs
messagerate = 2s
minmessagesize bytes the minimum size of messages generated by the Application Layer minmessagesize = 100bytes
minmessagesize = 4KB
maxmessagesize bytes the maximum size of messages generated by the Application Layer (bounded by MAX_MESSAGE_SIZE maxmessagesize = 200bytes
maxmessagesize = 8KB
nodemtbf time the expected time between node hardware failures nodemtbf = 60000s
nodemtbf = 1000s
nodemttr time the expected time taken to repair a hardware failure nodemttr = 5000s
nodemttr = 100s
ostype string the name of the operating system that runs on the node (only used to set the node's icon). Possible values are bsd, hurd, irix, linux, macintosh, nextstep, os2, solaris, or winnt. Gimmick. ostype = "linux"
outputfile string the output file for each node. When used as a global attribute, outputfile is used as a filename prefix (as with the -o option). When used locally, outputfile indicates the complete filename outputfile = "output"
rebootargs string provide one or more white-space separated command-line arguments to be passed to the node's EV_REBOOT handler. (locally overrides any arguments passed on cnet's own command-line) rebootargs = "-fast -nostats"
rebootfunc string the ANSI-C function to call when the node reboots (locally overrides the -R option) rebootnode = "reboot_function"
trace Boolean a Boolean indicating if event tracing is required (overrides the -t option) trace = true
winopen Boolean Boolean attribute requesting that a node's window be opened on startup winopen = false
winx, winy integer screen coordinates of the node's window under Tcl/Tk winx = 100, winy = 200
x, y integer coordinates of either a node's icon, or the left-hand end of an Ethernet segment on the main window x = 80, y = 120

The compile attribute indicates which C source files are to be compiled and executed by cnet. In the example topology file, above, an instance of the source code in the single file stopandwait.c will be executed by each of Perth and Melbourne. Each node will have its own copy of all variables declared in the file stopandwait.c (globals, static globals, locals and static locals).

When executing, each node's protocol code (in C) has access to its own CnetNodeinfo structure describing the node's attributes. This structure is best considered read-only as its contents are ``refreshed'' as each node is scheduled for execution.


typedef struct {
  char          nodename[MAX_NODENAME_LEN];
  CnetNodetype  nodetype;       /* Either a NT_HOST or a NT_ROUTER */
  int           nodenumber;     /* Ranging from 0.._NNODES-1 */
  CnetAddr      address;        /* Possibly different to the nodenumber */
  int           nlinks;         /* Ranging from 0(=LOOPBACK) .. nlinks */
  int           minmessagesize; /* min size (in bytes) of msgs generated */ 
  int           maxmessagesize; /* max size (in bytes) of msgs generated */ 
  CnetInt64     messagerate;    /* rate of msg generation (in microseconds) */
  CnetInt64     time_in_usec;   /* time since this node's last reboot*/
  struct {
      long      sec;            /* seconds */
      long      usec;           /* microseconds */
  }             time_of_day;    /* a reflection of the wall-clock time */
} CnetNodeinfo;

CnetNodeinfo  nodeinfo;

line

Link attributes

The Physical Layer delivers frames between nodes on unreliable, bidirectional links. The initial values of link attributes (global or per-node) may be specified in cnet's topology files. Some link attributes may be modified while the simulation is running. Link attributes include the propagation delay between endpoints, the probabilities of frame loss and corruption, the link bandwidth, the expected rates of link failure and repair, the transmit buffer size, and relative costs of frame transmission (these last few only concern more detailed protocols).

Link attribute Datatype Meaning Examples
bandwidth datarate the bandwidth along a link bandwidth = 1000000bps
bandwidth = 56Kbps
costperbyte cents the cost per byte along this link costperbyte = 1c
costperframe cents the cost per frame along this link costperframe = 5c
linkmtbf time the expected time between link hardware failures linkmtbf = 60000s
linkmtbf = 1000s
linkmttr time the expected time taken to repair a link hardware failure linkmttr = 5000s
linkmttr = 100s
probframecorrupt probability the probability that a frame on this link will be corrupted probframecorrupt = 3 /* 1 in 8 */
probframeloss probability the probability that a frame on this link will be lost altogether probframecorrupt = 4 /* 1 in 16 */
propagationdelay time the propagation delay along a link propagationdelay = 200usecs
propagationdelay = 1s
transmitbufsize bytes the maximum number of bytes that may be written to a link in each call to CNET_write_physical transmitbufsize = 8KB
transmitbufsize = 200bytes

When executing, each node's protocol code (in C) has access to its own CnetLinkinfo structure describing the link's attributes. This structure is best considered read-only as its contents are ``refreshed'' as each node is scheduled for execution. The global variable linkinfo is a vector of CnetLinkinfo structures. linkinfo[0] maintains attributes of the pseudo LOOPBACK link, linkinfo[1] maintains attributes of the first true physical link, and so on.


typedef struct {
    CnetLinktype  linktype;          /* LT_LOOPBACK, LT_POINT2POINT, or LT_ETHERNET */
    CnetNicaddr   nicaddr;           /* NIC address for LT_ETHERNET links*/
    int           linkup;            /* TRUE if link not severed */
    int           promiscuous;       /* TRUE iff LT_ETHERNET sees all frames */

    int           bandwidth;         /* in bits per second */
    int           transmitbufsize;   /* in bytes */
    CnetInt64     propagationdelay;  /* in microseconds */
    int           costperbyte;       /* in cents(?) */
    int           costperframe;      /* in cents(?) */
} CnetLinkinfo;

CnetLinkinfo *linkinfo;    /* linkinfo[0]..linkinfo[nodeinfo.nlinks] */ 

To find the propagation delay of the first ``real'' link in a 2 node simulation, each node would simply access linkinfo[1].propagationdelay .

line

Units and their specification

All times are stored internally in microseconds though in the topology file their integral values may be followed by suffixes such as usec, msec and s.

All data sizes are stored internally in bytes though in the topology file their integral values may be followed by suffixes such as bytes, Kbytes, KB, and MB.

Link bandwidths are stored internally in bits-per-second though in the topology file their integral values may be followed by suffixes such as bps, Kbps, and Mbps.

Boolean attributes may take on the values true, false, and toggle.

Strings are enclosed within double quotes.

Probabilities specify a uniform distribution, with their value being the log-base-2 of the chance of failure (yes, this is ugly). In a typical topology file, the global probframecorrupt attribute may declare that a frame will be corrupted with probability of 1 in 8 (2 to the power 3) while the link from Melbourne to Perth will lose (on average) every fourth frame. A probability of 0 (the default) means that no errors will be introduced.

cnet was written and is maintained by Chris McDonald (chris@csse.uwa.edu.au)