If necessary, the topology file is first preprocessed by the C-preprocessor, enabling the use of #include, #define and conditional ``compilation'' directives if required. Simple /* C and C++ style comments */ are also supported.
|
Global attributes may be defined in each topology file and affect the execution of the whole simulation. They may not be redefined on a per-node or per-link basis. In the above topology, the global attributes of bgimage and drawframes are defined.
Node attributes and link attributes declared before any nodes are also considered as global attributes - these will be the defaults unless redefined locally within a node or link definition. Local attributes are declared in a new ``block'', by opening a curly bracket (as in C). In the above topology, the default messagerate (the rate at which the Application Layer will generate a new message for delivery) is 500ms. This becomes the default messagerate for all nodes, but node Perth later declares its own (local) messagerate as 1000ms.
Strings are used to declare the location (filenames) of the source and shared object codes for the Application, ``Central'' and Physical layers used in each simulation. These strings may be provided on the command line, via the -A, -C, and -P options. The compilation string to compile the ``Central'' layers may also be specified with the compile node attribute in the topology file.
In their simplest form, compilation strings may present just a single C sourcefile name, such as "protocol.c". If necessary, cnet, will compile the file protocol.c into the object file protocol.o and then link this file to form the final shared object protocol.cnet. This final shared object file will then be used to provide the code for each node's relevant layer(s).
In its more complex form, a compilation string may also include compilation switches, a number of sourcefile names, and linker switches. For example, the compilation string
includes an embedded (actually preprocessor) switch which is passed onto the compilation process, two sourcefile names and a linker switch (in this case to link with the mathematics library). Each source file is compiled (if necessary) to create its object file, and all object files are then linked together to form a single shared object. The shared object's name is derived from the first sourcefile found, in this case it will be ftp.cnet. The embedded switches -l and -L are recognized as (assumed to be) linker switches; all other switches are assumed to be preprocessor and compiler switches.
cnet was written and is maintained by Chris McDonald (chris@cs.uwa.edu.au) | ![]() |