with various data-link layer, network layer, routing and transport
layer networking protocols. It has been specifically developed for
TEXT ="black" LINK="blue" VLINK="purple">
cnet's Application LayerThe Application Layer (either the internal default version or one provided with the -A option) has the responsibility of generating messages to be delivered to other Application Layers. An Application Layer will not generate a message for its own node. The required destination node is identified by its network address and not node number. Each node's address and node number will in fact be the same, unless the address attribute is specified in the topology file.
When cnet informs your protocols that the Application Layer has a message for delivery, your protocols will read the message into a buffer supplied by you. You must first indicate the maximum message size that you are willing to receive. A successful read will then ``fill-in'' the address of the message's destination node and the actual length of the message. Your protocols are simply presented with ``a lump of bytes'', at least 32 bytes long, which they must deliver to other Application Layers. The message is to be considered as opaque data, its contents are immaterial, though suffice to say that there is sufficient information in the message for cnet to diagnose most protocol errors for you. A typical sequence is:
When the message reaches the correct destination node, it may be written to the Application Layer:
Enabling and disabling the Application LayerProtocols will typically need to restrict, or throttle, the generation of messages for certain destination nodes. This may be achieved using the functions CNET_enable_application and CNET_disable_application which each accept a single parameter indicating which destination address to throttle. For example, if the node whose address is busynode becomes busy or swamped, we can stop our Application Layer from generating messages for this node with:
result = CNET_disable_application(busynode);
Similarly, we can permit messages to be generated for all nodes (other than ourselves, of course) with:
result = CNET_enable_application(ALLNODES);This function would typically be called in each node's reboot_node() function.
The default Application Layer prefers to generate messages for ``close nodes'', with a message having twice the chance of being for an immediate neighbour as for a node two hops away (and so on).
The Application Layer functions