Google

with various data-link layer, network layer, routing and transport layer networking protocols. It has been specifically developed for undergraduate teaching."> undergraduate, teaching"> TEXT ="black" LINK="blue" VLINK="purple">

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 = 100ms
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 = 600000ms
nodemtbf = 1000s
nodemttr time the expected time taken to repair a hardware failure nodemttr = 5000ms
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"
rebootnode 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 the node's icon 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 */ 
  int           messagerate;    /* rate of msg generation (in ms) */
  long          time_in_ms;     /* a monotonically increasing clock */
  struct {
      long      sec;
      long      msec;
  }             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 = 600000ms
linkmtbf = 1000s
linkmttr time the expected time taken to repair a link hardware failure linkmttr = 5000ms
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 = 20ms
propagationdelay = 1s

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 {
    int       linkup;               /* TRUE if link not severed */
    int       bandwidth;            /* in bits per second */
    int       propagationdelay;     /* in ms */
    int       transmitbufsize;      /* in bytes */
    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 milliseconds though in the topology file their integral values may be followed by suffixes such as ms 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.

line

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