cnet v4.0.4  

home topology files command‑line options the core API FAQ download and install

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:

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

option description
-c Initially the value of OS->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 token 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 Execute for indicated period, e.g. 100usec, 200ms 3s, 4min, 5hr, 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 By default, cnet runs roughly in "wall-clock" time - 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 -F forces cnet to ignore the "wall-clock" time and to execute as fast-as-possible as a true discrete-event simulator.
-g Go. Commence execution as soon as the main window appears; implied by -W.
-G Equivalent to -WFgqz.
-i Report instantaneous statistics to standard output. The frequency of reporting must also be set with the -f option.
-I directory Provide a directory name that is passed to the C or C++ compiler whenever protocol files are compiled.
-n 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
%Inode's address in IPv4 dotted-decimal notation
%nnode's name
-O Open each node's window on startup.
-p After building and checking the network topology, simply print the topology to stdout and exit.
-P Specify the value of CNETPATH, overriding the shell's environment variable and the value compiled into the binary.
-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_DEBUGx 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 the same seed to -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 filenm Mirror the event-trace into indicated file.
-u period Specify the period (frequency) of updates to the statistics window. Representative periods are 100usec, 200ms 3s, 4min, 5hr, or 6000events.
-U token "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 (the default when executing on ASCII terminals!).
-z Display statistics and event summaries even if they are zero. See also the -i and -s options.

cnet v4.0.4 - [email protected]