cnet v2.0.10

home
introduction
simulation model

topology files
cmdline options
the API

FAQ

download

cnet's layers and functions - the API

Descriptions of cnet's core functions are available from here. In each section functions are presented as ANSI-C prototypes, often with an example of their use.

Most library functions return the integer 0 on success and the integer -1 on failure. The most recent error status is reflected in the global variable cnet_errno. All values of cnet_errno will be instances of the enumerated type CnetError. Errors may be reported to stderr with CNET_perror() and their error message string accessed from cnet_errstr[(int)cnet_errno].

line

Function restrictions

Note that calls to the functions

    CNET_write_application,
    CNET_read_application,
    CNET_enable_application,
    CNET_disable_application and
    CNET_set_handler(EV_APPLICATIONLAYER,...) and
    CNET_set_handler(EV_KEYBOARDREADY,...)
are only valid if called from a node of node type NT_HOST. Function calls to either the Application or Physical Layers are invalid when cnet is not running (this can occur when the simulation is running under a windowing system, is paused, and a node's debug button is selected).

Calls to the functions

    CNET_set_promiscuous, and
    CNET_set_nicaddr
cannot set the attributes of link 0, the LOOPBACK link, nor set a NIC address to either the zero address, 00:00:00:00:00:00, or the broadcast address, ff:ff:ff:ff:ff:ff.
cnet was written and is maintained by Chris McDonald (chris@csse.uwa.edu.au)