LanLink captures the functionality of the three lowest layers in the network stack:
Figure illustrates the extended network stack that makes simulations of local area network possible in ns. A packet sent down the stack flows through the link layer (Queue and LL), the MAC layer (Mac), and the physical layer (Channel to Classifier/Mac). The packet then makes its way up the stack through the Mac, and the LL.
At the bottom of the stack, the physical layer is composed of two simulation objects: the Channel and Classifier/Mac. The Channel object simulates the shared medium and supports the medium access mechanisms of the MAC objects on the sending side of the transmission. On the receiving side, the Classifier/Mac is responsible for delivering and optionally replicating packets to the receiving MAC objects.
Depending on the type of physical layer, the MAC layer must contain a certain set of functionalities such as: carrier sense, collision detection, collision avoidance, etc. Since these functionalities affect both the sending and receiving sides, they are implemented in a single Mac object. For sending, the Mac object must follow a certain medium access protocol before transmitting the packet on the channel. For receiving, the MAC layer is responsible for delivering the packet to the link layer.
Above the MAC layer, the link layer can potentially have many functionalities such as queuing and link-level retransmission. The need of having a wide variety of link-level schemes leads to the division of functionality into two components: Queue and LL (link-layer). The Queue object, simulating the interface queue, belongs to the same Queue class that is described in Chapter 7. The LL object implements a particular data link protocol, such as ARQ. By combining both the sending and receiving functionalities into one module, the LL object can also support other mechanisms such as piggybacking.
Tom Henderson 2014-12-17