20.2 The diffusion model in ns

The directed diffusion model consists of a core diffusion layer, a diffusion library provides an application programming interface for overlying diffusion applications and finally the application layer which includes both diffusion applications and filters. The core diffusion layer is used to receive/send out packets from/into the network. The library provides a interface for the overlying application classes for publishing/subscribing etc. These APIs have been described in details in a document called Network Routing API 8.0 and can be found at http://www.isi.edu/scadds/publications.html under APIs section. In the following paragraphs we are going to describe how the diffusion model looks like in .

First we start with a brief description of the diffusion3 directory structure. If the reader wishes to examine the C++ code related to NS Diffusion that underpins the OTcl script commands, it may be found in ns/diffustion3. Here is a summary by subdirectory:

apps
contains sample source and sink apps; as well as gradient filter.
lib
DiffusionRouting class definitions. Derived from NR, it is the ISI API to diffusion.
main
DiffusionCoreAgent class definitions. Core diffusion code and other misc/utility code.
ns
contains ns wrappers for diffusion code. These wrapper classes allow the core diffusion code and the diffusion API to be seamlessly incorporated into the NS class hierarchy.  The DiffRoutingAgent is a wrapper for the Core Diffusion code, and DiffAppAgent is a wrapper for the DiffusionRouting (API) code.
nr
attribute definition and the class NR which is an abstract factory for the API (so that either ISI or MIT implementations may derive from it.

Figure 20.1: Message flow in directed diffusion
filter

The above Figure 20.1 is from SCADDS' network routing API document available from their homepage (URL given earlier). The document describes attribute factories, matching rules for attributes, how applications interface with the core diffusion layer, and filter/timer APIs. All messages coming from/going out in the network is received at/sent out from the core diffusion layer. Messages can also come to core-diffusion layer from local applications and/or filters that might be connected to the node. The applications use the publish/subscribe/send interface to send interest and data messages to the network.

The above Figure [*] shows the internals of directed diffusion implementation in . The core diffusion agent and diffusion application agent are attached to two well-known ports defined in /tcl/lib/ns-default.tcl. Diffusion applications attached to the node call the underlying diffusion application agent for publishing/subscribing/sending data.

Paul Kroon 2008-03-16