cnet v4.0.4  

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

cnet Changelog

cnet's version number changes when a change to its source code affects cnet's execution semantics. The version number does not change if (only) cosmetic changes are made to the source code or GUI, or if the documentation changes.

Version 4.0 - from March 2023

  • v4.0.4 - Shellscript provided to download and install pre-built binaries and resources.
    Yet more refactoring.
  • 4.0.3 - Protocols may be written in either, or a mixture of, C11 or C++11.
    Added -P command-line option to provide CNETPATH.
    Simplified searching of $CNETPATH.
    Corrected display of map legend and WLAN signals.
    Added ability to generate and execute random WAN-connected topologies.
    Added ability to single-step through execution.
    Added ability to annotate transmissions on timeline with CNET_annotate_timeline().
  • v4.0.2 - Node windows no longer (randomly) crash application on start-up.
    Tabs correctly expanded; tabstops may be specified in toploogy file.
  • v4.0.1 - Added basic support for dark-mode on macOS.
    System-fonts used by default; font size and name may be specified in toploogy file.
    Fixed a problem where closing the timeline window crashed the application.
  • v4.0.0 - All rewritten in C++ (all previous versions in C), using wxWidgets (all previous versions used Tcl/Tk).



Version 3.5 - from February 2022 (no longer supported)

  • v3.5.3 - small fix to src/tclfunctions.c required for macOS.
  • v3.5.2 - small fixes to compile cleanly on Linux and macOS.
  • v3.5.1 - fix to prototype fdopen().
  • v3.5.0 - support for macOS on Apple Silicon
    Improved isolation of platform dependencies in Makefiles

Version 3.4 - from March 2020 (no longer supported)

  • v3.4.2 - Added a menu item to check latest version.
  • v3.4.1 - Added instructions for installing on Windows Subsystem for Linux (WSL), under Windows-10.
    Added support for macOS's DarkMode (Mojave, 10.4 onwards).
    Corrected a bug in which output filenames requested by the -o command-line option, were not unique for each node.
  • v3.4.0 - Lots of refactoring.
    Corrected a bug on some Linux distributions in which the symbol "_end" was not being defined in shared objects (thanks to Peter Elliott, Univ. of Alberta).
    Under macOS we now use Tck/Tk provided by Homebrew, (rather than the outdated version packaged with XCode), and no longer require XQuartz.
    Implementation of per-node functions for C99's srand and rand.
    Improved implementation of internal Poisson distribution function.
    Documentation changed from basic HTML to basic PHP.
    Removed - CNET_srand, CNET_rand, CNET_newrand, and CNET_nextrand, and internal use of Mersenne Twister functions.
    Removed - removed support for execution on iPods. Ahhh, jailbreaking was fun.

Version 3.3 - from June 2013 (no longer supported)

  • v3.3.4 - Cleaned up code to address 'new' warnings from an updated gcc on Linux.
  • v3.3.3 - Corrected a bug in compile.c which prevented correct parsing of compilation string.
    Changed calls to abs() to fabs(), in lan.c
  • v3.3.2 - Corrected a bug in which AL errors were not updated on the GUI.
    Added -G command-line option, equivalent to -WTgqz.
  • v3.3.1 - Added compile-time support for XQuartz under macOS.
    Corrected use of Tcl_SetObjResult() to report errors.
  • v3.3.0 - The x,y,z fields of CnetPosition are now of type double to better support mapping.
    Added the functions CNET_Wflag(), CNET_vflag(), CNET_get_mapmargin(), and TCLTK_interp().
    Support added for global- and per-node variables in topology files, accessed from protocols using the new CNET_getvar() function.
    Added the CNET_unused_timer_event() and CNET_unused_debug_event() functions.
    Changes made to Tcl/Tk code to correctly use Tcl_GetStringResult() and Tcl_EvalEx().

Version 3.2 - from September 2009 (no longer supported)

  • v3.2.4 - Removed the ability (gimmick) to set a node's operating system type and icon. Added -Q command-line option to (silently) ignore out-of-sequence errors in the Application Layer. Changed code to enable clean compilations on Ubuntu Linux, where -Wunused-but-set-variable is set by default.
  • v3.2.3 - wish I'd kept this up-to-date
  • v3.2.2 - wish I'd kept this up-to-date
  • v3.2.1 - Correction made to gathering of LAN statistics. The -S command-line option now correctly replaces (overrides) the seed parameter to CNET_srand() and CNET_newrand().
  • v3.2.0 - Support added for 64-bit macOS. Support added for Tcl/Tk v8.5 (now preferred). Support added for Ubuntu Linux (return value of write() captured). Documentation rewritten, providing Unix-manual-like pages for each function.

Version 3.1 - from October 2007 (no longer supported)

  • v3.1.4 - Added the CNET_shmem2() function.
  • v3.1.3 - Corrected memory allocation for WLAN nodes. Refactored some Tcl/Tk for event and statistics updates. Corrected the information provided by CNET_get_wlanstate. New documentation for core data structures nodeinfo and linkinfo.
  • v3.1.2 - Corrected a bug processing the -D, -U, and -I command-line options. Corrected a bug in CNET_write_physical which caused a crash when scheduling frame collisions. The -z command-line option now implies -s. The buffer and message parameters of CNET_read_physical, CNET_write_physical, CNET_write_physical_reliable, CNET_write_direct, CNET_read_application, and CNET_write_application are now of type void * or const void * (were char * or const char *). The icons of mobile nodes are now always raised on the map. Simplified handling of fonts in Tc/Tk. Corrected some of the map layout to correctly honour map-scaling.
  • v3.1.1 - Added the CNET_get_mapscale function. Modified the calculation of distance between two (mobile) nodes. Included memory alignment in the calculation of per-node data segment size for macOS. Corrected Makefile for make uninstall.

Version 3.0 - from November 2004 (no longer supported)

  • v3.0.20 - Supported on 64-bit Linux distributions. Signal-strength "bars" added to the popup windows of nodes with WLANs. The CnetColour type is now just a C string. Random number generation functions renamed to CNET_srand, CNET_rand, CNET_newrand, and CNET_nextrand.
  • v3.0.19 - Corrections made to link bandwidth calculations.
  • v3.0.18 - Support for vectors of data added to the support API.
  • v3.0.17 - Correction to calculation of frame collision statistics. Correction to a rare problem where sleeping LT_WLAN links could receive frames.
  • v3.0.16 - <cnet.h> now includes <math.h>, and the standard C mathematics library (-lm) is now linked in by default. Added simple macros to convert between dBm and mW. Corrected a bug in the hashtable_new() support function. Added one-button support for macOS (thanks to Michael Rogers, Tennessee Tech.Univ.).
  • v3.0.15 - Improved collision handling for LT_WLAN links.
  • v3.0.14 - Added the positionerror global attribute. Corrected image scaling and node positioning on the simulation map.
  • v3.0.13 - Added the <cnetsupport.h> header file, the support source directory, automatic linking against the libcnetsupport.a library, and its associated documentation. Each node's outputfile attribute may now be formatted like the icontitle attribute. Corrected a bug causing events to be lost when the simulation was paused from the GUI.
  • v3.0.12 - Added the EVENT_HANDLER macro to <cnet.h>. Changed the data type of many function paramters describing length from int or unsigned int to size_t. New functions CNET_printf, CNET_puts, and CNET_putchar introduced to overcome Darwin's prebinding of shared libraries. These functions are not traced.
  • v3.0.11 - The dataframes on any number of LT_WAN links may are now drawn on their own canvas. You may view a LT_WAN link's frames by clicking the right mouse button (control-click on Macintoshes) on the link. An internal default event handler for the EV_DRAWFRAME is provided. Added the jitter attribute to all linktypes.
  • v3.0.10 - Datatypes WLANRESULT and WLANSIGNAL, and the function CNET_set_wlan_model, introduced. Datatype CnetPosition introduced, and functions CNET_get_position and CNET_get_position modified to receive their parameters of this type. ER_CORRUPTDATA renamed to ER_CORRUPTFRAME. Two new events - EV_PERIODIC and EV_UPDATEGUI. Introduced the -x option and support for extension modules. Corrected handling of -N option.
  • v3.0.9 - Two new error values introduced: ER_DUPLICATEMSG and ER_MISSINGMSG. These replace ER_OUTOFSEQ. New enumerated type CnetColour introduced. Function CNET_set_LED added. Tracing of Application and Physical Layer functions improved. Scheduling of EV_DEBUG events corrected.
  • v3.0.8 - Each WLAN's signal strength "circle" expands so as to reach all nodes that hear its signal. Tcl/Tk scripting improved for macOS.
  • v3.0.7 - New files scheduler.h and queuing.c support Calendar queuing of pending events, supporting much faster simulations with several hundred, or several thousand, pending events. Uses the POSIX getopt function to parse arguments, so we can now use:
    cnet -gsT -u100s FLOODING
    Event tracing now appears in an additional popup window, and highlights API calls that fail.
  • v3.0.6 - Transmissions with CNET_write_physical on LT_WLAN links now 'cause' collisions at the destination(s) if two or more overlapping-in-time signals arrive. Transmissions with CNET_write_physical_reliable on LT_WLAN links do not 'cause' collisions. New function CNET_carrier_sense indicates if a LT_LAN or LT_WLAN link can sense any arriving signal. Nodes and NICs that are sleeping "remember" that a signal is passing them, so that when they awaken they may not immediately be able to transmit successfully. The new -B command-line option disables buffering on LT_LAN or LT_WLAN links - you cannot transmit a new frame while one is still being sent. Each link type accepts a new Boolean attribute in the topology file, such as wlan-buffered = false to indicate if it's buffering. The new -i command-line option now reports instantaneous statistics (existing -s option reports cumulative statistics). The new -J command-line option permits you to just compile the indicated *.c files to their *.o files (to support pre-compiled libraries/layers for students). If the topology file name is "-", it will be read from standard input. The scheduler now detects/warns if there are no more (non-interactive) events scheduled. The first parameter passed to CNET_read_physical may be NULL if you don't require the link number of the arriving frame. New topology file attributes: bgcolour, bghex, drawnodes, and drawlinks.

  • major changes:
  • cnet's own code, and the protocols that cnet executes are now written in ISO-C99 (no longer just ANSI-C89). This provides native 64-bit integers and the bool data type.
  • First attempt at working under macOS (v10.3 onwards), still using Tcl/Tk.
  • Much rewriting of cnet's own code to support mobile and wireless network simulations.
  • The MT19937 (Mersenne Twister) pseudo-random number generator is now used internally in place of the slower and less portable rand48 family of functions.

  • new and changed datatypes and constants (via cnet.h):
  • All times are measured in microseconds and use the new CnetTime datatype, which is the 64-bit integer type int64_t in ISO-C99.
  • The CnetData type is now guaranteed long enough to hold integer and pointer values.
  • The new CnetRandom type introduced.
  • The CnetTimer type is renamed to CnetTimerID.
  • The transmitbufsize field of the CnetLinkinfo datatype, has been renamed mtu (maximum transmit unit).
  • The constant LT_POINT2POINT has been renamed LT_WAN, the constant LT_ETHERNET has been renamed LT_LAN, and the new constant LT_WLAN introduced.
  • Timer events now range from EV_TIMER0..EV_TIMER9 (no longer 1..10), and debug events now range from EV_DEBUG0..EV_DEBUG4 (no longer 1..5).
  • Two new nodetypes, NT_MOBILE and NT_ACCESSPOINT have been added to support mobile and wireless network simulations.

  • new and changed APIs:
  • All functions accepting lengths (e.g. number of bytes in a frame) are now of type size_t.
  • Several new functions make multiple MT19937 sequences available in each node: CNET_srand, CNET_rand, CNET_newrand, and CNET_nextrand.
  • Several new functions supporting wireless LANs introduced: CNET_get_position, CNET_set_position, CNET_wlan_arrival, CNET_get_wlaninfo, and CNET_set_wlaninfo.
  • The functions CNET_shmem and CNET_check_version introduced.
  • Checksum and CRC functions have been renamed: checksum_crc16 -> CNET_crc16, checksum_crc32 -> CNET_crc32, checksum_ccitt -> CNET_ccitt, and checksum_internet -> CNET_IP_checksum.

  • changes to the Tcl/Tk windowing:
  • The speed of the simulation may now be controlled from the main window (under Tcl/Tk).
  • The single-step button now correctly increments the simulation time.
  • The main statistics window now displays instantaneous as well as total statistics.
  • The current simulation time is now displayed on the main window.
  • Deprecated:
  • Everything previously requiring the CnetInt64 datatype and the int64_* API has been replaced by the 64-bit integer type int64_t in ISO-C99.
  • The CNET_set_promiscuous function.
  • The -P option (which specified the source code files for a Physical Layer) is now longer supported.
  • The -k option (which compiled protocols with an "old" Kernighan and Ritchie (K&R) C compiler) is no longer supported.
  • Each of the very old CNET_set_cursor, CNET_get_cursor, CNET_clear_to_eos and CNET_clear_to_eoln functions are no longer recognized.

Version 2.0 - from February 2002 (no longer supported)

  • v2.0.10 - many modifications to source code to provide clean compilation of cnet and examples with new, more rigorous, versions of gcc.
  • v2.0.9 - another attempt to correct a bug which permitted events to be delivered after a node had crashed.
  • v2.0.8 - corrected a bug in the <cnet64bits.h> header file which permitted only constants to be passed as arguments to int64_INIT. Corrected a bug which permitted timer events to still expire after a node had crashed. Improved installation on FreeBSD (5.1-RELEASE) - thanks to Rohan Joyce <joycer01(at)tartarus.uwa.edu.au> for submitting a patch. Corrected the detection of PowerPC architectures.
  • v2.0.7 - corrected the detection of SPARC architectures and some compiler warnings when using gcc and ANSI-C - thanks to Peter Neubert <neubert(at)mcs.sci.kuniv.edu.kw> for reporting the problem.
  • v2.0.6 - fixed an off-by-one error in handling changing linkstates (re)reported by Donald Gordon.
  • v2.0.5 - added facility for a short string to be drawn on animated frames - thanks to Alex Feldman <alex(at)alexandrite.boisestate.edu> for the suggestion.
  • v2.0.4 - compilations with gcc now have the -Werror flag added by default. Improved the CHECK() macro in <cnet.h>. Improvements to installation scripts - thanks to John Murdie <john(at)cs.york.ac.uk> for these. Fixed an off-by-one error in handling changing linkstates - thanks to Donald Gordon <Donald.Gordon(at)mcs.vuw.ac.nz> for this.
  • v2.0.3 - small change to the scheduling of Ethernet segments - thanks to Klaus Doerrscheidt <kdoerrscheidt(at)web.de> for this.
  • v2.0.2 - small event scheduler problem corrected.
  • Support for 10Mbps IEEE 802.3 Ethernet segments has been added; physical links are now each of the new type CnetLinkType.
  • Network Interface Cards (NICs) connect nodes to Ethernet segments; the new datatype CnetNICaddr provides support for each NIC's hardware address. The address may be set with the new function CNET_set_nicaddr, and the new functions CNET_parse_nicaddr and CNET_format_nicaddr convert between character strings and the CnetNICaddr datatype.
    NICs may be set into promiscuous mode with the new function CNET_set_promiscuous.
  • 64-bit integers are now used to store all times (now in microseconds) and large statistics. A new datatype, CnetInt64, and a number of arithmetic, conversion, and I/O routines are defined in the new header file <cnet64bits.h>. The new header file is included by the standard header file <cnet.h>.
  • The values of nodeinfo.messagerate, nodeinfo.time_in_usec, and linkinfo[i].propagationdelay are now of type CnetInt64.
  • The 2nd argument of CNET_start_timer is now of type CnetInt64 and requests a time in microseconds, not milliseconds.
  • Three new constants, HAVE_LONG_LONG, SIZEOF_INT, and SIZEOF_LONG must now be specified in the config.h file.
  • Nodes are now provided with command-line arguments when they reboot.
  • The Application Layer is now consulted to check that user-requested message sizes are neither too big nor too small.
  • Documentation extended, including some much-requested protocol walkthroughs.
  • Tcl/Tk scripts corrected to capture WM_DELETE_WINDOW messages for all top-level windows.
  • Corrected the values displayed on each node's Tcl/Tk radiobuttons used to modify the node's attributes at run-time.
  • Output via stdio functions (to Tcl/Tk windows) simplified and improved so that scrollbars do not "jump back" to bottom of the window on every output.
  • All statistics are now "flushed" via a single Tcl/Tk periodic event, rather than via cnet's main scheduler.
  • Statistics windows are now only updated if they have changed values.
  • Improved documentation.

Version 1.7 - August 2001 (no longer supported)

  • The data-link frames of 2-node simulations may now be animated. A new EV_DRAWFRAME event provides the user's protocol code with the opportunity to specify how the each individual data-Link frame is to be drawn. The protocols themselves do not need to provide any special windowing/drawing code. Up to 6 fields of each frame may be drawn in colours specified in the standard header file <cnet.h>.
  • Event tracing now appears in a separate scrollable Tcl/Tk window under the main map window (rather than just to stderr). A separate file may also be specified via the new global attribute tracefile (specified in the topology file), to receive a full copy of the simulation's trace.
  • The link attributes of costperframe or costperbyte may now be drawn on each link on the topology map by setting the new Boolean attributes costperframe or costperbyte to true in the topology file. costperframe is shown in preference to costperbyte.
  • Added facility for protocol source and object files to be specified with full pathnames.
  • Physical Layer corruption now only modifies two bytes of a frame to guarantee detection by the provided checksum functions.
  • The Physical Layer may now to asked to corrupt frames by truncating them, by setting MAY_TRUNCATE_FRAMES in config.h.
  • A background image (GIF) may now be displayed on the toplogy map under Tcl/Tk by specifying the new bgimage attribute in the topology file.
  • Support added for the FreeBSD platform - thanks to Jordan Hubbard <jkh(at)freebsd.org> and Michael Haro <mharo(at)area51.fremont.ca.us>
  • Support added for the NetBSD platform - thanks to Mark Davies, <mark(at)mcs.vuw.ac.nz>
  • Corrected a bug where any output to a node's window produced by an EV_DEBUG? event handler did not appear if using the -q comand-line option.
  • Each node's statistics' window is now only updated if that window if displayed.
  • The values of CnetTimerID returned by CNET_start_timer, are now an independent property of each node.
  • A number of internal global variables consolidated into the gattr structure.
  • Each node's name, in nodeinfo.nodename, is now stored in a fixed sized array of MAX_NODENAME_LEN (=32) bytes, rather than via a character pointer.
  • Improved documentation.

Version 1.6 - May 2000 (no longer supported)

  • The cnet functions CNET_set_cursor, CNET_get_cursor, CNET_clear_to_eoln, and CNET_clear_to_eos are no longer supported.
  • When tracing events, arbitrary addresses/variables may now be traced by name (instead of their hexadecimal addresses) by calling CNET_trace_name at the top of an event's handler.
  • The link attributes of propagationdelay and bandwidth may no longer be changed at run-time via the windowing interface.
  • A new function, CNET_timer_data, enables a protocol to retrieve a timer's user-data before the timer expires. This permits a protocol to retrive and deallocate dynamically allocated storage before it calls CNET_stop_timer.
  • No "raw" X-window API functions called. All windowing, mouse tracking, fonts etc, are provided by Tcl/Tk. No special support provided for monochrome-only displays.
  • All windowing for statistics, etc, "pushed" into the Tck/Tk code.
  • Support added for Tcl/Tk v8.0 and beyond.
  • A warning message is porduced if a provided topology file is not connected. Random topologies, requested via the -r nnodes command-line option, are now guaranteed to be connected.
  • Node icons are now located in a directory via the value of CNETPATH, rather than as statically-compiled XPM structures. XPM operating system support is no longer required.
  • Both recieve and interupt now recognized spelling errors.
  • Improved documentation.

Version 1.5 - April 1999 (no longer supported)

  • Support for Linux a.out format dropped (now only ELF format).
  • Support for Motif and XView windowing dropped (now only Tcl/Tk).
  • Improved documentation.

Version 1.4 - February 1997 (no longer supported)

Version 1.3 - July 1996 (no longer supported)

Version 0.1 - June 1991 (no longer supported)


cnet v4.0.4 - [email protected]