The SWANS network entity receives upcalls from the link entity and passes
them to the appropriate packet handler, based on the packet protocol
information. The SWANS network entity also receives downcalls from the
routing and transport entities, which it enqueues and eventually passes to the
link entity. Thus, the network entity is the nexus of multiple network
interfaces and multiple network packet handlers. The network interfaces are
indexed sequentially from zero. The packet handlers are associated with IETF
standard protocol numbers, but are mapped onto a smaller index space, to
conserve memory, through a dynamic protocol mapper that is shared across the
entire simulation. Each network interface is associated with a packet queue,
which can handle packet priorities and perform RED. The packets are dequeued
and sent to the appropriate link entity using a token protocol to ensure that
only one packet is transmitted at a time per interface. The network layer
sends packets to the routing entity to receive next hop information and
allows the routing entity to peek at all incoming packets. It also
encapsulates message with the appropriate IP packet header. The network layer
uses an IPv4 implementation. Loopback and broadcast are implemented.