A. Abstraction Layer
The primary purpose of the abstraction layer is to provide
a simplified, OO and multi-threaded wrapper around the pcap
API which hides the complexity of accessing multiple network
interfaces simultaneously. The design of the API ensures that
the abstraction layer can be used standalone as an interface to
the network hardware or within Sttyciar’s layered architecture.
1) Packets: The abstraction layer uses the OO hierarchy of
packets outlined in section III. A further implementation detail
is that packets store a pointer to the interface on which they
arrived and a list of interfaces to which they are destined. This
information is used by the abstraction layer to direct the packet
to the correct output interfaces and by the network logic layer
when packet processing logic is applied to each packet.
2) Devices: The core of the abstraction layer is composed
of Device objects. Each Device contains all the necessary
information to address network interfaces in order to receive
and transmit packets on the network, as well as for users
to identify which Device corresponds to which physical
interface. A Device object, which wraps the pcap interface,
exists for each network interface attached to the host and
contains two separate threads - one for sending packets to
and one for receiving packets from the network.
The use of threading is necessary as the pcap libraries are
implemented in a single-threaded fashion. The use of threading
also allows packets to be received, processed, and transmitted
asynchronously, allowing the software to scale more easily
to a multi-core system, where large performance benefits
can be realised [9]. By allowing packets to be processed
asynchronously, fine control over Quality of Service (QoS)
can also be achieved.