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.
The following topology defines a single segment Ethernet-based network of 6 nodes. The segment is named Lab1 and will be drawn at the indicated co-ordinates on the topology map. Each node is connected to the segment by its Network Interface Card (NIC); each NIC's address, as a string of hexadecimal characters, introduces each node's connection to the segment. Although not shown in this example, each node could also define its own local node attributes between the { } characters.
|
These two topology examples define small networks, one a simple wide-area network, and the other a single segment Ethernet-based network. cnet permits any combination of wide-area networks and Ethernet segments to be defined in the same topology file. One or more nodes, typically routers of type NT_ROUTER, may have connections to a combination of wide-area networks and Ethernet segments.
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) | ![]() |