cnet's layers and functions

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 by indexing *cnet_errstr[] with (int)cnet_errno.


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,...) or
    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 under X-windows when the simulation is paused and a node's debug button is selected).


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