cnet v4.0.4 | |
home topology files command‑line options the core API FAQ download and install |
The cnet simulation modelcnet supports a model of networking in which nodes are either hosts, routers, mobiles, or accessspoints. The different types of nodes have different properties. For example, host and mobile nodes have an Application Layer that generates messages for delivery to the Application Layers of other hosts or mobiles. While hosts and mobiles never generate messages for themselves, routers and accesspoints cannot generate messages at all. The nodes are connected by a variety of network links, using wide-area-networking (WAN), local-area-networking (LAN), or wireless-local-area-networking (WLAN) links. Introductory protocols will typically employ only hosts and WAN links. The cnet simulation model appears in the following diagram:
cnet itself provides all nodes with a Physical Layer and each host and mobile with an Application Layer. In addition, a hidden Error Layer lurks above each Physical Layer, and randomly introduces frame loss or corruption according to specified probabilities. Note that the standard OSI/ISO model does not provide an Error Layer! Perhaps surprisingly, the nodes initially have very little knowledge of the rest of the network. Nodes do not know how many other nodes there are, what the other nodes are called, nor the attributes of any nodes or links other than their own. All inter-node communication necessary to learn this information must traverse the Physical Layer. Nodes occupy positions on a large simulation 'map'; hosts, routers, and accesspoints are stationary, but mobile nodes may move around the map under their own programmatic control. A few obvious restrictions apply to the possible combination of nodes and their links - while hosts, routers, and accesspoints may have any number and type of network links (including wireless WLAN links), mobile nodes may only have a single WLAN link.
Links are numbered within each node
from Protocol layerscnet protocols are written from the point of view of each node. We imagine that we are writing our protocols inside the operating system's kernel of each node. We have the ability to write all of the interior protocols between the Application and Physical Layers. The protocols may be as simple or as complex as desired, and should follow a layered approach to isolate distinct responsibilities. For example:
Of course, these ideas and the responsibilities of each layer are not peculiar to the cnet simulator, and are very well motivated and described in many undergraduate textbooks on data communications and computer networking. However, cnet supports these ideas by not getting in the way, and by not imposing particular methodologies or data structures on your protocols. Protocols are written using an event-driven programming style, as if we were writing the protocols as part of an operating system's kernel. As well as handling network-related events, a traditional operating system must handle other events for its file-system, devices, and to let user-level processes execute. For this reason, our protocols must execute as quickly as possible, and then relinquish control to cnet (as if an operating system) for it to schedule other activities. cnet is unaware of your using one or ten interior layers - cnet only provides the highest and lowest layers, and an application programming interface (API) to interact with these layers. The lifetime of a message
It is instructive to consider the lifetime of a message in cnet.
A message is first generated in the Application Layer of, say,
As stated, the above sequence assumes that nothing goes wrong - and if
nothing went wrong, writing network protocols would be no fun!
We must obviously call the functions in
cnet's API correctly but,
more importantly,
our interior protocols must detect and manage errors in the network itself,
because cnet's Error Layer randomly corrupts and loses frames.
If we wish to only develop higher-layer protocols,
we can bypass cnet's Error Layer entirely by calling
|