Command-line options

cnet supports a number of command-line options which should be presented before the name of the topology file or a request for a random topology. If the name of the topology file is "-", then the topology will be read from standard input.

There are three ways to invoke cnet, where items in [square-brackets] are optional:

  • cnet [command-line-options] TOPOLOGYFILE [args-to-reboot-function]
  • cnet [command-line-options] - [args-to-reboot-function]
  • cnet [command-line-options] -r NNODES [args-to-reboot-function]

option description
-A string Specify a compilation string which declares a new application layer to be used. If -A is not provided, a default (internal) application layer is used. The eventual application layer is used as the source and sink of all messages.
-B By default, each link's NIC will buffer(queue) all frames/packets until they can be transmitted over the link. Specifying -B disables this buffering, and any attempt to write to a link while it is currently transmitting will result in the attempt failing by returning -1 and setting cnet_errno to ER_TOOBUSY.
-c Initially the value of nodeinfo.time_of_day in each node is different (and protocols may be developed to synchronize the clocks). If -c is specified, all clocks are initially synchronized.
-C string Specify a compilation string which declares each node's "internal" layers to be used. Any value provided by -C becomes the default, unless over-ridden in the topology file. If neither is provided, the string "protocol.c" is assumed.
-d Print diagnostic information while cnet is running (to stderr).
-Dcpptoken Define a C-preprocessor token that is passed to the preprocessor when the topology file is parsed, and passed to the C compiler whenever C protocol files are compiled.
-e period Request that the simulation only run for the indicated period. Representative periods are 100usec, 200ms 3s, 4min, 5hr, or 6000events.
-E Normally, corruption errors on links are not reported by the Physical Layer and must be detected by the receiver. If -E is specified, function CNET_read_physical will detect and report corruption errors by returning -1 and setting cnet_errno to ER_CORRUPTFRAME.
-f period Set a global frequency (period) with which a few things occur. If -d is provided, some diagnostics are periodically written to stderr. If -i or -s is provided, statistical summaries are periodically written to stdout. If any node sets an event handler for EV_PERIODIC, the handler is invoked periodically. Representative periods are 100usec, 200ms 3s, 4min, 5hr, or 6000events.
-F filenm If cnet has been compiled for Tcl/Tk, the indicated file will be sourced by the Tcl interpreter. If the file cannot be found directly, CNETPATH will be searched to locate the file.
-g Go. Commence execution as soon as the main window appears (under Tcl/Tk); implied by -W.
-i Report instantaneous statistics to standard output. The frequency of reporting must also be set with the -f option.
-Idirectory Provide a directory name that is passed to the C compiler whenever C protocol files are compiled.
-J Cfiles Just compile the indicated C files into object files, so that libraries (black-boxes) of cnet code may be distributed. The value of files may actually be any valid compilation string.
-m minutes To prevent (very) badly written simulations from locking an X-window server, a 5 minute time limit is silently imposed on cnet execution. The -m option overrides this limit.
-n Simply parse the topology file, compile and link all necessary C source files, and then exit.
-N Provide the number of nodes in the network in the C variable NNODES. Surprisingly, the default is that each node does not know how many nodes the network contains (NNODES = 0).
-o filename Mirror, to the indicated file, the output of each node's calls to printf(), puts() and putchar().
The following formatting substitutions may be requested:

%anode's address as an integer
%dnode's number
%I node's address in IPv4 dotted-decimal notation
%nnode's name

-O Open all node windows on startup (unless overridden by the winopen attribute).
-p After building and checking the network topology, simply print the topology to stdout and exit.
-q Execute quietly (and more quickly) - all output requested with printf(), puts() and putchar() will not appear in the output windows. All output produced during an EV_DEBUG? event (a button press) will still appear, as will all output "mirrored" in logging files.
-Q Ignore Application Layer message sequencing errors.
-r nnodes Request that a random network be generated, consisting of nnodes. The topology is guaranteed to be connected. The -r option may be used instead of providing a topology file, and must be the last option before the appearance of each node's optional reboot arguments.
-R function_name Use function_name() as the function to first invoke when rebooting each node. By default, the function reboot_node() will be invoked.
-s Print cumulative statistics to standard output just before cnet exits. If the -f option is also provided, then the cumulative statistics will also be printed with the indicated frequency. See also the -z option.
-S seed Provide the seed for random number generation (for message generation and frame corruption and loss). Specifying -s enables a simulation to be replayed.
-t Trace all events delivered to each network node. An annotation of all cnet function calls, arguments and return and cnet_errno values is reported via cnet's tracing stream. Any output requested with CNET_trace will also appear.
-T By default, cnet runs in "wall-clock" time, that is, the simulation performs one second of network-work in one second of "wall-clock" time. This works well for up to about 20 nodes beyond which cnet "gets behind". Using -T forces cnet to ignore the "wall-clock" time and to execute as a true discrete-event simulator.
-u period Specify the period (frequency) of updates to the statistics window under the Tcl/Tk GUI. Representative periods are 100usec, 200ms 3s, 4min, 5hr, or 6000events.
-Ucpptoken "Undefine" a C-preprocessor token that is passed to the preprocessor when the topology file is parsed, and passed to the C compiler whenever C protocol files are compiled.
-v Be very verbose about cnet's actions (to stderr).
-W Disable GUI windowing support with Tcl/Tk (the default when executing on ASCII terminals!).
-x module Provide the name of an extension module whose code and data will be shared amongst all nodes. The module is first sought by name using environment variables CNETPATH and CNETFILEEXT. If not found, the string is assumed to be a compilation string providing the code for the extension module. Option -x may be provided multiple times.
-z Display statistics and event summaries even if they are zero. See also the -i and -s options.


 cnet v3.3.1, written by Chris.McDonald@uwa.edu.au
 Last modified: Thu Apr 10 4:35PM 2014