Professional Documents
Culture Documents
End of Studies Project Report: Ecole Nationale Des Sciences de L'informatique Laboratoire Cristal - P Ole RIM
End of Studies Project Report: Ecole Nationale Des Sciences de L'informatique Laboratoire Cristal - P Ole RIM
Theme :
Design and Implementation of a Wireless
Communication Networks Simulation Environment
Author :
Safaà Hachana
Supervisors :
Pedagogic advisors :
Résumé
De nos jours, les réseaux sans fils marquent une popularité croissante grâce
aux nombreux avantages et apports qu’ils offrent. De ce fait, les chercheurs
en réseaux s’intéressent de plus en plus au monde des réseaux sans fils, en
développant de nouveaux protocoles et en essayant d’optimiser les protocoles
déjà existant. Naturellement, les défis techniques ne manquent pas, vu la com-
plexité considérable que présentent souvent les protocoles sans fil.
Généralement, les nouveaux protocoles doivent passer par une phase de test,
d’évaluation, et d’ajustement itératif avant de devenir opérationnel. Dans la plu-
part des cas, les tentatives de prédire le comportement et la performance d’un
protocole en se contentant d’une plateforme réelle à faible échelle n’aboutissent
pas, dans la mesure où elles peuvent donner des résultats incomplets, voir
même incohérents et contradictoires. L’application des méthodes analytiques
et mathématiques ne suffit pas non plus à éliminer les fautes des protocoles.
En conséquence, la simulation est considérée aujourd’hui comme un outil
d’importance égale et complémentaire aux études expérimentales et analytiques
dans l’analyse et la compréhension des comportements de plusieurs systèmes
complexes, y inclus les réseaux sans fil et mobiles.
Malheureusement, et malgré la submersion des réseaux de communication
sans fil, la grande majorité des outils de simulation disponibles actuellement,
ont été développés dans le contexte des réseaux filaires. De ce fait, ils s’adaptent
mal aux besoins de la simulation des réseaux sans fil.
Nous avons pu constater ce manque imminent de simulateurs spécialisés
dans les réseaux sans fils et les aspects de mobilités au cours de notre recherche
d’un simulateur pour y intégrer des méthodes de pré authentification rapides
dans les réseaux locaux sans fil sécurisés IEEE802.11i avec infrastructure. Ces
méthodes de pré authentification ont été développées dans le cadre d’un mastère
de recherche réalisé au laboratoire CRISTAL pôle RIM à l’ENSI en collaboration
avec le laboratoire ENST-Bretagne. Elles ont été évaluées sur une plateforme
réelle, mais une évaluation plus poussée par des outils de simulation s’est avérée
indispensable.
La solution proposée est le développement d’un nouvel environnement de
simulation à évènements discrets. Les dites méthodes y seront implémentées
ultérieurement en vu de l’évaluation de leur performances et leurs apports.
Etant une tache laborieuse et nécessitant la collaboration de plusieurs personnes
à long terme, le développement du nouveau simulateur s’intitule dans le cadre
d’un projet collaboratif et en progression continue dont le présent projet de fin
d’étude constitue la première étape. Le projet est destiné à être publié sous
licence OpenGL.
Dans ce rapport de projet de fin d’étude, nous exposons notre participation
dans le développement de ce simulateur de réseaux de télécommunication sans
fil. En effet, nous commençons par donner la terminologie de la simulation à
évènements discrets pour fournir au lecteur le bagage technique nécessaire à
fin de lui permettre de mieux assimiler le reste du rapport. Par la suite, nous
présentons une étude comparative entre trois simulateurs qui se trouvent être
des plus utilisés de nos jours. Cette étude permet de montrer les spécificités de
2
Design and Implementation of a Wireless Networks Simulator 0.0
3
Design and Implementation of a Wireless Networks Simulator 0.0
Dedication
To my parents: words are not expressive
To Salam : my sister and best friend
To MedAli et Touha: hoping that it will be a source of inspiration for them
1
Design and Implementation of a Wireless Networks Simulator 0.0
Greeting
First, I want to thank Dr. Nicolas Montavont for his faith in me and his sug-
gestions. He was really a continual source of learning during all our discussion
and meeting.
I would like to express my deepest gratitude to Mohamed Kassab, my friend
and supervisor for his good suggestions, his support, and his good mood.
I really appreciated the critical comments and beneficial suggestions from
my great Professor Abdelfattah Belghith.
A particular acknowledgement is for all my professors and teachers during
these latter three years during my studies within the ENSI. They were an inex-
haustible source of learning.
I would like to thank Amine Dhraief for his precious help at the starting of
this project, and particularly in NS-2 discovery and study.
I would like to thank all those who works in the ENST-Bretagne for the
cordial reception they reserved to us.
All my thankfulness is for my friends at Rennes. They provided me with a
great comfort with their kindness, favour, generosity and humour. My thoughts
go to Neila, Rayène, Meriem, Anis and all others.
For all my good friends in the ENSI: Sofien, Hamdi, Med, Youssef, Dina,
Zied, Fadi, Walid, Ramsis and all others: I’ll never forget you.
My thoughts go to all those who have been a real help for me, my best
friends: Emeni, Baha, Sana, Amine, Faten, . . .
Finally, my special thank goes to Attoufa and Mabrouk, for their continuous
support, to aunt Fawzia and uncle Rachid, and to all my big family’s members.
I love you.
Safaà Hachana
2
Contents
Introduction 8
3
Design and Implementation of a Wireless Networks Simulator 0.0
2.4.5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . 35
2.5 SimulX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
2.5.1 Presentation . . . . . . . . . . . . . . . . . . . . . . . . . 35
2.5.2 SimulX monitoring support . . . . . . . . . . . . . . . . . 36
2.5.3 SimulX internal architecture . . . . . . . . . . . . . . . . 37
2.5.4 Evaluation and summary of SimulX features . . . . . . . 40
2.5.5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . 41
2.6 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
II Simulator Kernel 42
3 Specification of requirements 43
3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
3.2 Functional requirements . . . . . . . . . . . . . . . . . . . . . . . 44
3.3 Non functional requirements . . . . . . . . . . . . . . . . . . . . . 46
3.4 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
4 Simulator Design 50
4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
4.2 Classes diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
4.2.1 Simulation kernel classes . . . . . . . . . . . . . . . . . . . 52
4.2.2 Topology devices classes . . . . . . . . . . . . . . . . . . . 57
4.2.3 Protocols and services library . . . . . . . . . . . . . . . . 63
4.3 Sequence diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . 64
4.3.1 Sending a packet from one node to another node . . . . . 64
4.3.2 Running a timer in a protocol . . . . . . . . . . . . . . . . 65
4.4 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
4
Design and Implementation of a Wireless Networks Simulator 0.0
5
List of Figures
6
Design and Implementation of a Wireless Networks Simulator 0.0
7
Design and Implementation of a Wireless Networks Simulator 0.0
Introduction
Nowadays, the trend is toward the use of wireless and mobile networks as re-
quired by some submerging applications and services. Several forms of mobile
computing are becoming more and more popular,such as WLAN802.11 with
infrastructure, Ad-hoc networks, WMAN802.116, etc.
Indeed, the multiple advantages and facilities offered by wireless networks
favor their increasing popularity. For instance, they provide mobility and in-
dependency from location and infrastructures. Moreover, a wireless device can
dynamically move within multiple locations while maintaining moving trans-
parency from application point of view, instead of being hardwired to a single
location (or IP address). Likewise, communication among a set of mobile units
can be established spontaneously, without using any existing network infras-
tructure. So, wireless networks are more resistant and allow fast recovery in
case of disasters.
Thus, identified as one of the most important technologies of the 21st cen-
tury, and considered as a key technology for the future, wireless networks are
widely motivating researchers to develop new protocols, and optimize existing
ones. For example, Mobile-IP is a protocol that have been suggested to handle
message routing via internet in mobility scenarios.
Of course, technical challenges do not lack. As a matter of fact, wireless net-
works pose considerable problems since they may operate in hostile and varying
environment. They also present complications of medium access as wireless
channel is a shared resource. Furthermore, wireless networks may connect to
Internet whereas Internet was not designed to support mobility features. For all
these raisons, protocols designed for this kind of environment are often complex.
Generally, newly developed protocols need to be tested, evaluated and read-
justed before becoming operative. However, in front of their rapid proliferation,
and the reduced time to market, predicting network performance and eliminat-
ing protocol faults have become an extremely difficult task. Moreover, this task
is made harder with regard to the fusion of communication technologies and
their interference leading to the rapid growth of networks.
In most cases, attempts to predict and extrapolate the network performance
in small-scale experimental test beds may yield incomplete or contradictory out-
comes. In a similar manner, application of analytical methods is also not feasible
due to factors such as complex channel access protocols, node mobility, channel
propagation properties, radio characteristics, and multitude of interactions.
Accordingly, simulation is now considered as a tool of equal importance and
complementary to the analytical and experimental studies for investigating and
understanding the behaviour of various complex systems, notably wireless and
mobile networks.
Unfortunately, despite of the perceptible growth of wireless communications,
most of the existing simulation tools have been developed in the context of wired
networks that include LAN, TCP, IP and ATM simulators. Research in wire-
less network simulation has come relatively late. Henceforth, most of famous
network simulators have added modules for simulating wireless topologies. Nev-
8
Design and Implementation of a Wireless Networks Simulator 0.0
ertheless, wireless and wired networks differ in fundamental ways such as the
signal interference and attenuation, and also broadcast nature of wireless ra-
dio transmission. In addition, wireless and wired networks have not the same
interests (e.g. Handoff for wireless and mobile communications).
Besides, we had the occasion to experiment this lack of simulators specialized
in, or at least which implement suitably wireless network protocols and espe-
cially WLAN with infrastructure protocols. That is to say, at the beginning
of this project, the aim was the evaluation of fast pre-authentication methods
in IEEE 802.11 LAN with infrastructure, by simulation mean. These methods
were developed within the framework of the research works in the collabora-
tion between the pole RIM of the laboratory CRYSTAL in the ENSI and RSM
department in ENST-Bretagne’s laboratory.
The pre-authentication methods[11] were tested in small-scale actual test
bed[12]. However, their implementation in a simulation tool remains imperative
to establish exact evaluation of their contribution in the improvement of the
standard protocol. Through our quest of a well established available simulation
tool, which provides the necessary protocols library, and that enables a good
extensibility, we realized that such a software is not available among free and
open source simulation tools.
Consequently, we were constrained to modify the purposes of the project.
Henceforth, the aim of the project described in this report is the development
of a new wireless networks simulation environment. The evaluation of the men-
tioned pre-authentication methods is to be completed within the extension of
the project, using the new developed simulator described here.
However, the development of a wireless networks simulation environment is a
laborious task that requires a lot of time and the collaboration of many persons.
This is why; it will be a collaborative project in progress. The work achieved
in the framework of this end of studies project, and described in this document
concerns only the development of the core of simulation and the integration
of IEEE802.11i protocol into the newly developed simulator. We give a brief
overview of the tasks of other collaborators and the continuity of the project.
From this analysis, it arises that a new wireless simulation tool is widely
welcomed. The second part describes the kernel of simulation development
steps. In the second chapter, we fix and determine the objectives of the simulator
we are planning to develop regarding to the previous analysis and the initial
requirements The third chapter explains the basics of our solution’s conception,
and shows in details the class diagram. It concludes with some simple sequence
diagrams that show more clearly how does the tool work. We give a brief glance
at the realization and implementation steps for the core of network simulator
in the following chapter. We conclude the fourth chapter by discussing further
work and next steps of the project.
This makes the transition with the next and last part which describes the
implementation of the IEEE 802.11i security protocol for wireless LAN. This
part is made of two chapters. The first one is consecrated to the IEEE 802.11i
standard protocol description, whereas the second chapter presents the concep-
tion and integration of the protocol into the simulator. This will constitute an
example of exploitation of the core of simulation newly developed.
9
Design and Implementation of a Wireless Networks Simulator 0.0
10
Part I
11
Chapter 1
Terminology of
discrete-event simulation
1.1 Introduction
This section aims at introducing discrete-event simulation concept in order to
provide the reader with basic notions and necessary technical background to
understand in more details next chapters. This introductive part begins with
defining the simulation, before explaining its structural components, function-
ality, and generated data.
1.2 Definition
In general concept, simulation can be defined as ”the process of designing a
model of a real system and conducting experiments with this model for the
purpose either of understanding the behavior of the system or of evaluating
various strategies, within the limits imposed by a set of criteria, for the operation
of the system”[15].
12
Design and Implementation of a Wireless Networks Simulator 1.3
Entities :
Entities are requisite components since they are the ones who cause the changes
in the state of the system by generating events, and eventually handling them.
Indeed, if there are no active entities in the system, the simulation will be
stopped. Entities are characterized by attributes, determinant to understand
the behavior of the entity. Referring to communication networks as example of
modeled systems, an entity may be a node, a link or any other entity that is
likely to influence the system state. We may also have a hierarchy of entities
(e.g. node and protocolar layers which constitute part of the node).
Activities :
Entities run the simulation by their activities. In fact, interacting with activities,
entities create events. So activities are process and logic in the simulation. We
can distinguish three major types of activities in simulation: delays, queues and
logic. The delay is when we postpone an entity for a definite period of time.
The period may be a constant or a randomly generated value. For instance, in
network simulation, a node that has to wait for a timer to expire is considered
as a delayed entity. Queues are places were entities wait for unspecified period
of time, which depends on other parameters. As a matter of fact, entity may
be waiting for a resource to be liberated or for given system condition to occur.
In our example, one of the several queues we may need is a queue as buffer for
packets on a level with some protocol layers, and also queues in routers. This
latter kind of queue may be managed with different policies. Logic activities
allow the entity to affect the state of the system through the manipulation of
state variables. For example, treatments made in a protocol layer are logic
activities related to the entity which is the layer it self.
Events :
Events are conditions that occur at a point of time witch causes changes in the
state of the system. The definition of what will be an event is a crucial choice
when modeling a system. An entity interacts with activity to create events. For
instance, when an entity starts a delay, an event is scheduled in the calendar to
occur.
13
Design and Implementation of a Wireless Networks Simulator 1.4
Calendar :
It is an overriding component for the discrete-event simulation. The calendar is a
list of events that are scheduled to occur in the future. In every simulation there
is only one calendar of future events and it’s generally ordered by the earliest
scheduled time first. It may have different structure, more or less optimized
structure that influences over simulator performance and execution time. Still,
in all cases, at any given point in time, every event that has already been
scheduled to occur in the future is held on the calendar.
Resources :
As we showed above, entities may be waiting for resources. These latter repre-
sent anything that has a restricted capacity. Common examples in communica-
tion networks include traffic intersections, links, etc In the course of simulation,
we can track the key statistics of each of these resources including utilization
and costs.
Global variables :
A global variable is a variable that is available to the entire model at all times.
It can track just about anything that is of interest to the entire simulation. We
distinguish two kind of global variables: those which help as to configure the
problem as a schedule, and those which collect revenue information as a trace
file can be.
Statistics collectors :
The purpose of a simulation is to get statistics that will be indicators about
the performance of the studied system. Statistic collectors are the part of the
simulation that collects statistics, such as state of resources, or the value of
global variable, or certain performance statistics based on attributes of the en-
tity. There are three different types of statistics we can collect: counts (e.g.
the number of lost packets on a link), time-persistent (e.g. resource utilization),
and tallies (e.g. queue residence time of a packet). Generally, we rely on these
statistics to optimize the modeled system.
14
Design and Implementation of a Wireless Networks Simulator 1.4
1.4 Conclusion
Simulation is a powerful tool if understood and properly used. Regardless of
how complex a system may be, it is possible to create a model that will evaluate
it. However, the most complex a system is, the longer it takes to model, run and
evaluate. In the next chapter, we will present and compare three commonly used
network simulation tools of different levels of complexity and different purposes.
15
Chapter 2
2.1 Introduction
There are numerous network simulation tools on the market today, both com-
mercial and non-commercial ones. This chapter gives a brief overview by picking
three of the most important or most representative ones. Among them, NS and
OMNeT++ deserve the most attention, as they are the most widely accepted
and most mature packages. The third one, ’SimulX’, is a wireless communica-
tion simulator under development, not published yet. In this section, we keep
a glance at the general features of the studied simulators, but we are especially
interested in the simulation core of each of them trying to underline its advan-
tages and drawbacks. The ultimate purpose of this section is to identify the
properties of simulation environment that allows it to be the most appropriate
to study performance and behaviour of new protocols of mobility and wireless
networks.
16
Design and Implementation of a Wireless Networks Simulator 2.2
17
Design and Implementation of a Wireless Networks Simulator 2.3
2.3 NS-2
1
2.3.1 Presentation
The NS network simulator, from U.C. Berkeley/LBNL, is an object-oriented dis-
crete event simulator targeted at networking research and available in the public
domain. Its first version (NS-1) began in 1989 as a variant of the REAL network
simulator and was developed by the Network Research Group at the Lawrence
Berkeley National Laboratory (LBNL), USA. Its development was then part of
the VINT project, supported by DARPA, at LBNL, Xerox PARC, and UCB,
under which NS version 2.0 (NS-2) was released, evolving substantially from the
first version. The aim of the VINT was not to design a new network simulator,
but to unify the effort of all people working in the research field of network
simulation. The result is that NS-2 is widely used in the networking research
community and has found large acceptance as a tool to experiment new ideas,
protocols and distributed algorithms. Currently NS-2 development is still sup-
ported through DARPA. NS has always included substantial contributions from
other researchers, including wireless code for both mobile ad hoc networks and
wireless LANs from the UCB Daedelus and CMU Monarch projects and Sun
Microsystems.
1 The Network Simulator - ns-2 Official web site, http://www.isi.edu/nsnam/ns/
18
Design and Implementation of a Wireless Networks Simulator 2.3
Input
The user creates a topology through writing an OTcl file, in which he can define
arbitrary network topologies. The topology is composed of routers, links and
shared media by listing the network nodes and edges. OTcl is the object oriented
extension of Tcl (Tool Command Language), which is an interpreted language.
So, it is obvious that the user of NS-2 must master the OTcl language. Another
alternative is possible but seldom used: that is to specify the simulator entry
using some network generators developed for NS-2 (Tiers and GT-ITM).
Output
For collecting output or trace data on a simulation, NS-2 uses both traces and
monitors. Traces are records of each individual packet as it arrives, departs, or
is dropped at a link or queue. Whereas monitors are record counts of various
interesting quantities that can be associated to both packets and flows such as
packet and byte arrivals, departures, etc.
The Network Animator (NAM), is a Tcl/TK based animation tool that can be
used for viewing NS-2 trace files for post-processing, analysis and replay of sim-
ulations (actually NAM can be used with any simulator, as long as data formats
are respected). Still in terms of graphical tools to describe simulation scenarios
and analyze or visualize simulation trace files, NS-2 cannot score positively.
NS-2’s code source is split between C++ for its core engine and OTcl, the object
extension to Tcl, for both the core engine and configuration and simulation
scripts. The combination of the two languages is supposed to offer a sort of
compromise between performance and ease of use as the first one (C++) is
compiled whereas the second (OTcl) is an interpreted language. The package
provides a compiled class hierarchy of objects written in C++ and an interpreted
class hierarchy of objects written in OTcl related to the compiled ones. The
user creates new objects through the OTcl interpreter. New objects are closely
mirrored by a corresponding object in the compiled hierarchy. Tcl procedures
are used to provide flexible and powerful control over the simulation (start and
stop events, network failure, statistic gathering and network configuration). The
OTcl interpreter provides commands to create the networks topology of links
and nodes and the agents associated with nodes.
In the next tow paragraphs, we’ll show in more details successively the struc-
ture of the compiled and interpreted class hierarchies.
19
Design and Implementation of a Wireless Networks Simulator 2.3
Simulator kernel
2
From the description of the most important C++ classes in the hierarchy of
NS-2, we will reconstitute an obvious view of how the simulation core operates.
Simulator
A simulation script begins by creating an instance of the OTcl class Sim-
ulator. It will be the unique instance of this class during the whole sim-
ulation. The simulation is configured, controlled and operated through
the use of interfaces provided by this class. The class provides procedures
to create and manage the topology, to initialize the packet format and to
choose the scheduler. It stores internally references to each element of the
topology. The user creates the topology using OTcl through the use of
the stand alone class node and link that provide a few simple primitives.
Scheduler
Being an event driven-simulator, NS-2 needs a scheduler (Calendar) for
the events’ management. Scheduler is a C++ class. The scheduler man-
ages a data structure of Events (insert, drop, remove, handle...). It runs by
selecting the earliest event, giving it to its handler, and advancing the sim-
ulation time. After the handler has executed the event to completion (no
partial exec, no pre-emption), the scheduler returns to dispatch the next
event. The scheduler is the only object in the simulation that can advance
the time. There is only one event in execution at any given time. Simul-
taneous events are executed on a first scheduled-first dispatched manner.
That means the tow events are executed successively, but at the same
simulation time. There is only one instance of Scheduler in one instance
of Simulator. So that event’s scheduling is managed in a centralised way
in NS-2. All other objects of the simulation which are likely to generate
events have a reference to the scheduler instance. The choice of the data
structure is quite important for the simulator performance. NS-2 defines
four scheduler types using four different data structures which are: List
(a simple linked list), Calendar[9], Heap, and RealTime (borrowed from
MaRS-2.0 simulator). All schedulers should give the same order of dis-
patching given the same in put. However, only Calendar works correctly.
It is set as the scheduler by default. The calendar queue is a special in-
dexed list that assures an optimistic management of event. It uses a data
structure analogous to a one-year desk calendar, in which events on the
same month/day of multiple years can be recorded in one day.
Event
Defining what will be the considered as an ”event” is a crucial choice
in a discrete-event simulator. In NS-2 ”Event” is a C++ class. Among
the attributes of this class we find a pointer on the next event, a pointer
on an instance of the class ”Handler”, and ”time”. The next event is
used to chain the list of events managed by the scheduler. The handler
is the object that will handle the event when it will be removed from the
scheduler’s list. The time represents the date in time of simulation, in
2 ns Notes and Documentation, http://www.isi.edu/nsnam/ns/doc/index.html
20
Design and Implementation of a Wireless Networks Simulator 2.3
which the event must be consumed. Many types of events are defined
such as:
– Packet is a C++ class. It’s the fundamental unit of exchange between
objects in simulation and also the most frequently used event.
– AtEvent is a C++ class. It represents a Tcl procedure execution
scheduled to occur at a particular time. The procedure may be de-
fined in an input Tcl script, or in NS core code.
– ChannelDelayEvent: is a C++ class. It is used to schedule the re-
ception of affected mobile nodes (physical layer) of a packet within a
wireless channel.
Handler
Handler is the parent class of all objects that are likely to handle an event
in the simulator. As we showed above, an event has a pointer to the han-
dler to call when it is ready to be consumed. When an event’s scheduled
time arrives, it is passed to handle() method of the handler which must
consume it. There are several kinds of event handlers such as NsObject,
TimerHandler, AtHandler, MacTimer, etc.For instance NsObjects such as
Mac (class that represents the MAC layer), LL, Agent, Classifier, etc, ma-
nipulate event of type ”packet”. Another example of handlers is that of
AtHandler. They are specialized in Atevent handling. The last example
of Handler we will see is TimerHandler. Those objects represent timers
in a network and execute neither Atevent, nor Packets. They only block
21
Design and Implementation of a Wireless Networks Simulator 2.3
an object for a period of time, and advance time of simulation. Figure 2.3
shows a portion of the class hierarchy that inherits from Handler.
Topology
3
The network model represents the interconnection of network elements. It
consists of nodes and links. In the next paragraphs we’ll see how does NS-2
models its network elements.
22
Design and Implementation of a Wireless Networks Simulator 2.3
1. a link layer
2. an address resolution protocol (ARP) module connected to the link
layer
3. interface priority queue which gives priority to routing protocol pack-
ets and supports running a filter over all packets in the queue
23
Design and Implementation of a Wireless Networks Simulator 2.3
The radio propagation model uses a shadowing model, and Two Ray
Ground model. Antennas used by the mobile nodes are assumed to be
omni-directional and with unity gain. Four ad-hoc routing protocols are
currently supported. Concerning the simulation core, there are no great
changes excepting the creation of a new class MoveEvent that inherits
from event. Here we have a schematic representation of the MobileNode
by NS-2. Notice that the NS-2 architecture tends to get closer to the OSI
model. Figure 2.4 is a schematic representation of the MobileNode by
NS-2. Notice that the NS-2 architecture tends to get closer to the OSI
model45 .
24
Design and Implementation of a Wireless Networks Simulator 2.3
At the time being, NS-2 has a large number of protocol models, mostly centered
on TCP/IP. It is well-suited for packets switched networks and wireless ad-
hoc networks, and is used mostly for small scale simulations of queuing and
routing algorithms, transport protocols, congestion control, and some multicast
related work. It provides substantial support for simulation of TCP, routing,
and multicast protocols over wired networks. Various types of applications can
be simulated. Among them are FTP, Telnet, and HTTP, which use TCP as
the underlying transport protocol, and applications requiring a constant bit
rate (CBR) traffic pattern, which use the UDP transport protocol. For the
purpose of traffic generation NS-2 provides an exponential on/off distribution
and it allows also generating traffic according to a trace file. Packet losses
are simulated by buffer overflows in routers, which is also the dominant way
packets get lost in the Internet. Other packet losses are related to error models
where the unit could be packet, bit or time based. Supported routing features
include asymmetric routing, multi-path routing, link-state and distance vector
algorithms, multicast routing, and several ad hoc algorithms.
Extensibility
From the short description of its architecture given above, it is quite clear that
NS-2 is rather complex software. Adding new components and/or modifying
existing ones necessarily involve writing several software modules (in both C++
and OTcl), taking into account several parameters and multi-step data flows.
As a net result, NS-2 is not so easy to use in the perspective of contributing new
models, protocols, and studying different scenarios at different levels of detail.
In fact, implementing a new protocol in NS-2 requires adding C++ code for the
protocol’s functionality, as well as updating key NS-2 OTcl configuration files
in order for NS2 to recognize the new protocol and its default parameters. The
C++ code also describes which parameters and methods are to be made avail-
able for OTcl scripting. Unfortunately, the software architecture of NS-2 is such
that adding new components and/or modifying existing ones is not a straight-
forward process. That is, in terms of ease to implement/test new algorithms or
scenarios, NS-2 scores poorly with respect to other simulators. Moreover, the
simulator has difficulties to stabilize. In deed, between two successive versions
of the simulator, there are always fundamental changes. This makes the task of
adding new protocols absurd to a certain extend. In fact, one can never be sure
that changes he makes will keep compatible with next versions.
NS-2 does not scale well in term of number of nodes and it is reported to be
in general quite slow from a computational point of view. Because of its large
memory footprint as soon as simulations of a few hundred to a few thousand
25
Design and Implementation of a Wireless Networks Simulator 2.3
of nodes are undertaken, and its lack of scalability, NS is used mostly for small
scale simulations
Documentation availability
In addition to the lack of graphical tools that could greatly help code develop-
ment, the provided documentation, unfortunately, does not help from this point
of view. In fact, it is often limited and out of date with the current release
of the simulator. Most problems must be solved by consulting the highly dy-
namic newsgroups and browsing the source code. In general, it is admitted that
the learning curve for NS-2 is steep and debugging is difficult due to the dual
C++/OTcl nature of the simulator.
26
Design and Implementation of a Wireless Networks Simulator 2.4
NS-2 plays an important role in the network research field community, being a
sort of reference simulator. In fact, it is the most used simulator for studies on
transport protocols. Furthermore, it is becoming popular in the research field
of mobile ad hoc networks too. Therefore, in terms of scientific acceptance NS-2
would be an ideal choice.
2.3.5 Conclusion
NS-2 comes fully equipped with protocols, models, algorithms and accessory
tools, and furthermore it is under GPL license. Being started since 1989, it is
expected that it be a mature package. However, the simulator has difficulties
to stabilize. This is due to the continuous changes in the trends of network
community requirements and the submersion of new technologies. In addition,
being the result of such a long process of development, which has incorporated
contributions from several different sources, the software design of NS-2 is quite
poor with respect to current standards. If it is rather easy to use the simulator,
it is not that easy to learn how to add new components or modify existing ones.
A more troublesome limitation of NS-2 is its large memory footprint and its
lack of scalability as soon as simulations of a few hundred to a few thousand of
nodes are undertaken. This is a major impediment according to the objectives
of researchers. Only small sized, but at the same time fine-grained simulations
can be undertaken.
2.4 OMNeT++
2.4.1 Presentation
The ”Objective Modular Network Testbed in C++” known as OMNeT++6 is
an open-source, free, for academic and non-profit use discrete-event simulation
package. It is component-based, modular and open-architecture tool. It is de-
veloped by Anderas Vagra within its PhD work at University of Budapest. This
tool offers a C++ simulation class library and GUI support (graphical network
editing, animation). The simulator can be used for: traffic modeling of telecom-
munication networks, protocol modeling, modeling queuing networks, modeling
multiprocessors and other distributed hardware systems. It is also used for
validating hardware architectures, evaluating performance aspects of complex
software systems. More in general, OMNeT ++ allows modeling any other sys-
tem which can be mapped to active components that communicate by passing
messages. In some sense, and differently from the other simulators discussed
within this chapter, OMNeT++ is not specifically designed for telecommunica-
tion networks, but it is far more general.
6 OMNeT++ Community Site, http://www.omnetpp.org
27
Design and Implementation of a Wireless Networks Simulator 2.4
In put
28
Design and Implementation of a Wireless Networks Simulator 2.4
Out put
We can asset that it’s the strong part of OMNeT++. User can choose be-
tween two user interfaces selectable as opp makemake parameters, to run an
OMNeT++ program: command-line and graphical interface. Though the com-
mand line interface is rather uncomfortable and used only to run the program
with maximum speed, the graphical user interface is nice and well -planned. The
GUI makes the inside of the model visible to the user including the hierarchy of
modules and their connections. Messages travelling along connections are ani-
mated. It is very useful for simple debugging and can also be used to pedagogic
issues. It offers inspectors for most objects (e.g. double-click on modules shows
submodules and parameters, see figures 2.5 and 2.6 respectively). Moreover, it
allows to single-step from event to event or fast forward the program with dif-
ferent animation speed. Furthermore, it allows the user to start/stop simulation
execution and to intervene by changing variables/objects inside the model. The
GUI library is linked with the debugging/tracing capability into the simulation
executable. This choice enables every user-created object being visible (and
modifiable) in the GUI via inspector windows. Output files are text files in a
format which, after some simple processing, can be read into standard math-
ematical and statistical packages. In this sense, OMNeT++ does not provide
any duplicate of such standard packages. Briefly, the nice graphical interface
offers good potentialities for monitoring and analysis of the simulations. The
following components are given within the OMNeT++ package, and responsible
of output generation:
29
Design and Implementation of a Wireless Networks Simulator 2.4
Actually, modules are C++ objects, using support functions from a simula-
tion library. There are two principle parent classes for modules in OMNeT++
design: cCompoundModule and cSimpleModule.
Compound modules are C++ classes, derived from OMNeT++ base class
cCompoundModule, and simple modules are subclassed from cSimpleModule
[17]. This later is an abstract base class; which’s interface specifies everything
the simulation kernel must know about a module. Modules with user specified
behavior must be simple modules. A compound module is glued together from
a number of simple modules of different types and possibly of other compound
modules. This leads to a hierarchical structure of modules. From outside a
compound module looks like a simple module; it reacts on messages, and send
messages to other modules. However, a compound module does not have any
own behavior; it just combines and connects its constituent modules. There are
also module types in the simulator.
Let’s take an example for illustration: Suppose we want to simulate the
progress of ARP (address resolution protocol). An ARPclient, an ARPserver,
and a router are represented as compound modules, whereas the channel is
a simple module. For instance the ARPclient is made of the following sub
modules:
Some of those sub modules are simple modules such as TCP and UDP module,
while other are in their turn compound modules. For instance the Ethernet
interface consists on three simple sub modules, namely: ARP-cache module,
encapsulation module, and MAClayer module. Figures 2.5 and 2.6respectively
are bought from an OMNeT++ demonstration and illustrate these compound
and simple modules.Note that a simple or a compound module can have an
arbitrary number of input and output connections.
Simulation kernel
The classes described here are used internally by the simulation kernel. They
are normally of very little interest to the simulation programmer, but for great
interest for us since we intend to design a simulation kernel. However, it is not
30
Design and Implementation of a Wireless Networks Simulator 2.4
31
Design and Implementation of a Wireless Networks Simulator 2.4
quite different from NS-2 kernel. In fact, the two simulators answer discrete-
event’s requirements. So, we will not tarry on kernel description. The most
pertinent classes associated with simulation execution are:
Note that these internal classes may change more often than other classes, sim-
ply because they aren’t used in simulation models and thus backwards compat-
ibility is less important. There is another important family of classes in the
simulator, that is Registration classes. They play the role of a central registry
in OMNeT++. Registration objects play an important role at network build
time: they store information about available module, channel, etc types and
can instantiate them. They are also overriding for inspectors in graphical user
interfaces. As example of Registration classes we cite cModuleInterface which
stores the list of gates and parameters declared for a module type and cModule-
Type which can instantiate a module type. Some other classes, closely related
to the above ones are not listed here. Major part of event handling is part of
simulation kernel, especially the FES management. Modules are entities that
generate and handle events. A simple module is invoked from simulation kernel
by the call of handleMessage (cMessage * msg). It is a virtual method in cSim-
pleModule interface, so all derived modules must implement it. In response, the
event handler modifies the module’s state and eventually generate new messages
destined to other modules or even to it self.
32
Design and Implementation of a Wireless Networks Simulator 2.4
The INET Framework contains models for IP, TCP, UDP, PPP, Ethernet,
MPLS with LDP and RSVP-TE signaling, and other protocols. Since
summer 2005, the INET Framework also includes some support for mobile
and wireless simulations.
IPv6Suite is developed at CTIE, Monash University, Melbourne. Sup-
ports IPv6 (Mobile IPv6 and Hierarchical Mobile IPv6 models are being
developed), and contains PPP, Ethernet and 802.11 models. Meanwhile,
an effort is underway to add IPv6/MIPv6 support into the INET Frame-
work, using a new IPv6 codebase.
OppBSD (Roland Bless, University Karlsruhe) is basically the FreeBSD
kernel’s networking stack ported into OMNeT++ as a TCP/IP simulation
model. It allows for accurate yet very scalable TCP simulations; suitable
for network emulation as well.
Wireless models The most important mobility, ad-hoc and wireless protocols
supported in OMNeT++ are developed within the following projects:
The Consensus project (TU Delft and Univ.of Twente, the Netherlands)
released the packages Positif and MAC Simulator, which were used in their
wireless sensor networks and MAC layer publications.
A 802.11 model has also been developed for the IPv6Suite.
Two Hiperlan/2 models have been written. The more detailed and pow-
erful model has been written at TU Berlin but the code has never been
released.
33
Design and Implementation of a Wireless Networks Simulator 2.4
Extensibility
Being highly modular and well structured is a big advantage for OMNeT++
when it comes to implementing new protocols to be used in the simulator. The
process of implementing new protocols for wireless as for wired networks in
OMNeT++ is quite straightforward and convenient especially thanks to the
NED language. Extensibility can even be confused with usability since user is
required to define its own modules and classes in C++ language. Furthermore,
OMNeT++ comes with an extensive set of container classes for data structures
(e.g., queues, arrays), data collection classes, probability and statistics classes
(e.g., histograms, exponential distributions) transient detection and result ac-
curacy detection classes. The definition of new custom models and protocols is
quite easy when compared in comparison to the other simulators and to NS-2
in particular.However, unfortunately, the problem of incompatibility between
modules developed by different developers’ sets oneself.
34
Design and Implementation of a Wireless Networks Simulator 2.5
Documentation availability
2.4.5 Conclusion
OMNeT++ has been carefully designed from the software point of view, result-
ing in a product which is much better organized, flexible and easy to use than
the other simulators, which are all based on older software products and design
concepts and specially compared with NS-2. The overall design of OMNeT++
is pretty nice and fully based on the driving ideas of object-oriented design.
In this respect, OMNeT++ is probably the best software product among the
available ones. Unfortunately, some important network-specific models and pro-
tocols are missing or incompatible with other modules. This fact, together with
the fact that OMNeT++ is not specially designed for telecommunication net-
work simulation and even less for wireless ones limits the use of OMNeT++ in
spite of some interest that OMNeT++ is widely attracting. Moreover, writing
an OMNeT++ program is not a simple task and might discourage more then
one.
2.5 SimulX
2.5.1 Presentation
SimulX is a wireless network simulator project started in 2003. It is the result of
the contribution of about ten people; all of them are students from Louis PAS-
TEUR University in Strasbourg, and members of Networks and Protocols team
in the LSiiT. The project is not open source yet. Nevertheless, it is expected
to be an open source, free for academic and non-profit use simulation package.
The simulator targets to be used in both research and teaching areas. It offers
a C++ simulation class library and uses GTK/OpenGL for the graphical user
7 OMNeT++ Community Site, http://www.omnetpp.org
35
Design and Implementation of a Wireless Networks Simulator 2.5
Input
Output
In the one hand, the simulator offers a graphical visualization of the simulated
scenario with an animated map, on which we can see nodes moving, making
handoffs etc. On the other hand, the simulator generates multitude of trace
files, in text format. Following, we find some of the trace files:
We underline that the trace is tunable: the user can choose which files he wants
to obtain to avoid undesirable information and save processing resources. In
36
Design and Implementation of a Wireless Networks Simulator 2.5
fact, this can have a great influence on execution time, and constitutes another
mean of selection of level of details.
Topology representation
[10] SimulX topology is made of equipments (nodes) and links. All those com-
ponents are located on a map. To create a topology instance, one should first
create the map which limits the spatial frontiers of the simulation. Further, it
becomes possible to create equipments and links.
Equipments:
The simulator defines panoply of pre established equipment’s types which
are the following:
– Router: only router, home agent, GPS server
– AP : Access Point
– MN : Mobile Nodes, Mobile IPv6 compatible, can visit other IPv6
networks
– CN : Correspondent Node, compatible Mobile
37
Design and Implementation of a Wireless Networks Simulator 2.5
38
Design and Implementation of a Wireless Networks Simulator 2.5
Mobility management
Event management
SimulX has no calendar, and does not define an event as a substantial entity.
Nevertheless, it keeps a global variable which represents simulation time. To
manage events generated by elements of the topology, the simulator acts in
iterative way. In every iteration, the simulator probes all equipments created
within the simulation instance. If the examined equipment has an event to
consume and which is likely to advance simulation time, he checks NextEvent
value and compares it to its own event delay. If the delay is smaller then
NextEvent is set to the event delay. At the end of an iteration, the simulation
time is up dated (time = time + NextEvent), and the equipment that has the
nearest event is served.
This method guaranties that events are generated and dispatched in the
right rank. In addition, there will be no processing in calendar sort, and no
memory footprint due to excessive number of events. However, it has a major
problem; that is to do more much processing. All equipments are probed in
every iteration, including inactive equipments. This may affect noticeably the
scalability of the simulator.
In spite of being in a primitive stage, SimulX has acquired yet a rich mobility
protocols library. Support for mobile networks is essential but of high-quality
and sufficient to carry out serious studies. Nevertheless, though it has been de-
signed for wireless and wired networks systems, the simulator currently supports
only protocols for purely wireless networks.
Layer 2 protocols
39
Design and Implementation of a Wireless Networks Simulator 2.5
– IPv6 routing:
* Dijikstra to build the shortest path between routers.
* Router Advertisement: sent by Router, periodical retransmis-
sion.
– Mobile IPv6:
* Mobile Node mobility (BU / BA with Home Agent).
* Reverse Tunneling.
* Route Optimization (BU / BA with CN).
* Security issues (TBD).
– Layer 3 handover optimization mechanisms:
* RFC2461 (Neighbor DiscoveryL2 triggers (RS upon Link Up).
* L2 triggers (RS upon Link Up): Solicit a RA when a new link is
established.
* RA beaconing: RAs are introduced in the beacons.
* Anticipated handover.
* Nearest AP: Usage of GPS information.
* Fast location-based handover: Mobile initiated handover based
on GPS information.
Extensibility
40
Design and Implementation of a Wireless Networks Simulator 2.6
Documentation availability
Being not published yet, there are not enough data in the current literature to
make a more precise idea about SimulX. Nevertheless, the simulator is men-
tioned in some articles. In addition, we can consult the collaborative web site of
SimulX to have more obvious idea of the simulator evolution8 . The official web
site is under construction 9 . Furthermore, Simulx is referenced in some publi-
cations that used it to evaluate some protocols[13]. On the other hand, we get
in touch with the simulator dvelopers. They provided as with some interesting
informations ans documents such as the code and the classes’diagram [10].
2.5.5 Conclusion
SimulX is an ambitious project. It provides a highly detailed wireless network
protocols’ implementation. However, it is not a mature package. In other terms,
it is young software, and it lacks experience to some extend. Consequently, the
simulator does not score positively in term of extensibility and scalability.
2.6 Conclusion
This chapter discussed the characteristics of simulation environments for com-
munications networks, and, more specifically, for mobile and wireless networks.
Three available network simulators were discussed and compared according to a
number of criteria ranging from the reliability of the provided simulation mod-
els, to the degree of usability of software and graphical interfaces. The aim
of the chapter is to evaluate tease simulation environments in order to identify
their advantages and drawbacks, to bring out the need of a new simulator which
will be more appropriate to run experiments to test and validate the design of
new mobility protocols.
41
Part II
Simulator Kernel
42
Chapter 3
Specification of
requirements
3.1 Introduction
Further to the two precedent chapters, we can consider that we acquired now
enough knowledge about some of the most important available simulation envi-
ronment; we evaluated their advantages and their drawbacks, and we isolated
the needs of different kind of users. We also looked further into the properties
of discreet event simulation. Thus we are capable of defining with precision the
needs of our project.
Furthermore, the range of this project exceeds the frame of the present
project of end of study. In fact, it is a project marked by its open, continuous,
and evolutionary character. In other terms, it is only about the development
of the kernel of wireless network simulation environment within the context
of the present document, but we expect that the project will be continued,
and consequently, we must foresee both present and future functionalities since
the beginning, in order to avoid dead-end situations, and for not to commit
irreparable mistakes.
Where from the specification of needs set some more of importance. In fact,
this task has become increasingly recognized as being one of the most vital parts
of the process; given that the failure to properly identify requirements makes it
virtually impossible for the finished piece of software to meet the needs of the
user or be finished on time. Thus, a good set of requirements is needed for any
project, especially computer system projects, to be successful. This is where
many projects fail, in that they do not specify correctly what the system should
do. So we deal in this chapter with three sections: functional requirements, and
non functional requirements.
43
Design and Implementation of a Wireless Networks Simulator 3.2
44
Design and Implementation of a Wireless Networks Simulator 3.2
The user can create multiple similar devices at the same time.
45
Design and Implementation of a Wireless Networks Simulator 3.3
Use cases are a widespread practice for capturing functional requirements. This
is especially true in the object-oriented community where they originated. Thus,
we summarize all functional requirements in three use cases. The first one Fig.
3.1 is about researcher requirements.
Student requirements
The educational aspect imposes methodical steps at the level of the seizure
of the parameters of the scenario to be feigned, as well as at the level of
the clarity of the code source of the simulation tool.
The graphical use interface must ask the user to provide with the right
detail at the opportune time, in such way that he understand what is
needed to specify when simulating this or that network technology.
The code of the simulator and specifically the implementation of protocols
must show a clearly how this protocol proceeds.
Developer requirements
The success or the fail of this project bases on the interest which the developers
carry there. We remind that it is about a free and open source tool, and it
has no chance to be continued unless developers extend it by adding protocols
implementations. Our task is to make this the as easy as possible.
46
Design and Implementation of a Wireless Networks Simulator 3.3
47
48
Design and Implementation of a Wireless Networks Simulator 3.4
3.4 Conclusion
Specification of requirements has important implications for software architec-
ture. In particular, it is not just the functional requirements of the present
project that must be supported by the architecture. The functional require-
ments of similar and near releases need to be explicitly taken into account too.
Later releases are accommodated through architectural qualities such as exten-
sibility, flexibility, etc. The latter are expressed as non-functional requirements.
The strategy for quickly starting is to produce the core, basic product, and
adding features to variants of the product to be released shortly thereafter.
Already, we can distinguish the global architecture features. The product is
constituted of three big modules, namely: the kernel of simulation, the topol-
ogy entities, and the protocols and applications libraries. In the next chapter,
we will see the detailed solution conception.
49
Chapter 4
Simulator Design
4.1 Introduction
Further to the detailed specification of requirements, we are henceforth capable
of elaborating the complete design of the adopted solution for the environment
of simulation that we plan to develop. We clarify in this chapter the adopted
abstract conceptual structure by beginning with a global sight of the classes
diagram, followed by a detailed description of the different modules and sub
modules of the software. To give a better visibility of the operating mode of
the product, we finish this chapter by unrolling two sequence diagrams showing
the execution of two very simple scenarios, and the communication between the
different modules and objects.
50
Design and Implementation of a Wireless Networks Simulator 4.2
51
Design and Implementation of a Wireless Networks Simulator 4.2
Class event
The first thing to think about when creating a simulator is the event definition.
Events are conditions that occur at a point of simulated time witch causes
changes in the state of the system. The C++ class event represents the parent
class of all events in the program. Events may be: scheduled (to arrive back
at the same module at a later time), reported (e.g. backoff timer), cancelled,
or sent directly to another handler (fast run). All manipulations on events are
made via methods of handler s and scheduler. Events are generated by entities
interacting with their activities, and exchanged between them via the scheduler.
We inspect the most pertinent attributes and methods of the class and their
function in the following:
uid : every created instance of event has its unique identifier in the whole
simulation instance. This uid allows tracking the event instance and even-
tually canceling or reporting it, even after it has been scheduled.
time: it represents the date of execution (completion) of the event.
ev type: the type of the event refers in fact to a class that inherits from
Event. This attribute is used when cast is needed, it means when a specific
processing is to be made according the type of the event. This attributes
can have only one of the predefined values.
h: it is a reference to the entity in charge to handle (consume) the event
when its date is reached by the simulation time. Of course, the handling
of an event may lead to generation of other events. An instance of event
52
Design and Implementation of a Wireless Networks Simulator 4.2
It is obvious that the class event is to be derived in a set of specific types. Next
we have the description of different types of events. Notice that here we are
the defined events until now. Still, we expect the creation of new classes that
inherits from event, to satisfy other future requirements.
53
Design and Implementation of a Wireless Networks Simulator 4.2
with references to source and destination nodes and applications. The message
holds also a direction attribute. This field is likely to take one of two values:
’-1’ which means that the message is in while transmission; whereas a value of
’1’ means that the message is in reception from the node point of view. In fact,
a message may be handled by a sub entity of a node. This sub entity needs
to know whether the local node is sending or receiving the message. Finally,
we notice that a message has another attribute: that is stack hdr or stack of
headers. As its name indicates, this field represents the stack of headers that
encapsulate the virtual data carried by the message. We will linger in header
description next.
54
Design and Implementation of a Wireless Networks Simulator 4.2
Being an event driven simulator, our program needs an entity to keep in charge
events scheduling and dispatching. scheduler is the class that encapsulates the
calendar and event scheduling. We explain the different attributes and methods
of this class showed in the Fig. 4.5.
The scheduler is the entity that holds the most important global variable in
a simulation: the simulated time represented by simul time field. It is also the
only object that can advance time. Naturally, time never moves back. The other
objects of the simulation may consult the time by calling the scheduler’s method:
get simul time. The calendar is represented by a list of events that are scheduled
to occur in the future sched list. It is ordered by the earliest scheduled time first,
basing on time field of event class. To be more precise, it is not a list of events,
it is rather a list of pointer on event for efficiency and memory saving issues.
Therefore, we can insert any object that inherits from event in this list. As
mentioned in the first chapter, an observed in the second one, the calendar may
take one of different data structures, more or less optimized, which influences
noticeably the simulator performance and execution time. Unfortunately, until
the moment of redaction of this document, the adopted structure is the Standard
Template Library (STL)sequential container List. In fact, the optimization of
the calendar structure is not the main purpose of this project, at this level
of advancement. The pre established STL’s List allowed starting tests on the
general conception of the simulator in the briefest delay.
Nevertheless our choice was taken with regard to the structure efficiency.
List is the most appropriate structure between those proposed by the STL. In
fact, insertion and removal are the most frequent operations dealing with the
calendar. Being doubly-chained, List provides insertion and removal methods
with a complexity of O(1). Alternatively, the most important drawback of the
List is the complexity of direct access to an element, but obviously, we don’t
need this functionality in our program. Thus, we can assert that we made the
most optimized choice between the containers provided by the STL.
Nevertheless, we plan to reconsider the structure of the calendar as soon as
55
Design and Implementation of a Wireless Networks Simulator 4.2
Until now, we dealt with events and with scheduler. Entities in charge of gener-
ating and consuming events are absent from roll-call. For this issue, we define
the abstract class handler. It is the parent class of all entities that are likely to
consume an event. It has only one member function: handle. It takes a refer-
ence to an event in parameter. In fact, all classes that inherit from this class
are supposed to treat events. They can be referred by h attribute of any event,
and so, the scheduler calls the handle function of the appropriate handler when
dispatching the event. In addition, the handler keeps a pointer on the scheduler
instance of the simulation. Thus, each handler can accede to scheduler mem-
bers such as schedule function, to schedule an event, and get simulation time to
consult current time of simulation.
We saw above that the class message has a stack of headers as attribute. header
is a class representative of headers added by protocols to a data packet. In the
56
Design and Implementation of a Wireless Networks Simulator 4.2
This class inherits from the class handler, and represents all kinds of nodes, in-
cluding mobile nodes, access points, authentication servers, web servers, routers,
etc. In fact, equipment can be modeled as a protocol’s stack, and a set of appli-
cations or services, in addition to an address or identifier. The nature of these
services and these protocols, with regard to their arrangement defines the type
57
Design and Implementation of a Wireless Networks Simulator 4.2
of the equipment. Thus, the class equipment has tow vectors: a protocols’ vec-
tor and a services’ vector. The member functions add protocol, remove protocol,
add service and remove service allow the management of these vectors. proto-
col and service are two classes in our design. We will deal with them next. All
we need to know at this level is that protocols and services are interconnected,
and can be arranged in different manners.
However, equipment must have at least one protocol of type physical inter-
face unless we can not attach it to a link. This latter functionality is insured by
attachtoSlink, attachtoMlink and attachtoWlink member functions, according
to whereas we want to attach the equipment to a simple link, a multipoint link,
or a wireless channel.
Moreover, equipment is characterized by its unique identifier eq uid that
can be considered as an address while routing. In addition, it has three spatial
coordinates to locate it on the topology’s map, and define which equipments
are in range of which ones. The member function send allows setting off a
service of the equipment at a given simulation point of time, with the necessary
characteristics according the type of service. For this issue, many forms of send
are defined.
58
Design and Implementation of a Wireless Networks Simulator 4.2
59
Design and Implementation of a Wireless Networks Simulator 4.2
60
Design and Implementation of a Wireless Networks Simulator 4.2
We showed above that equipment has a set of protocols, but also a set of services.
service is the class that models applications in a node. services are different from
protocol s in some sense that generate and consume data flows. gen and consume
member functions are defined to provide respectively these two functionalities.
In addition, services have no upper level, and have only one down target,
which must be a protocol. A service is characterized by a unique identifier
srv id. This attribute is the equivalent of a port number used to reach the
service when it is the destination of a message.
Links are the entities that insure equipment interconnections, and messages
propagation. There are several types of links. For instance, they can be wire
links, or radio channels. However, all links has some common properties. For
this reason, we define a parent class link that gathers common properties of all
links, namely a vector that refers to all attached physical interfaces of equip-
ments (attached interfaces). We remind that a physical interface is an instance
of class phy derived from protocol.
link is a handler. messages are passed from equipment’s physical interfaces
to link trough the scheduler, after the transmission time is added. The link sim-
ply looks for the destination interface within its attached interfaces, by making
the correspondence of eqdest field of the received message and the eq uid of the
equipment that holds the physical interface.
Further, the link schedules the message to be received by the destination
node after propagation delay.
61
Design and Implementation of a Wireless Networks Simulator 4.2
62
Design and Implementation of a Wireless Networks Simulator 4.3
63
Design and Implementation of a Wireless Networks Simulator 4.3
64
Design and Implementation of a Wireless Networks Simulator 4.3
no interactions with event other than the sending of this packet, so things are
extremely simplified.
65
Design and Implementation of a Wireless Networks Simulator 4.4
sage, but also events of type timer. Fig.4.16 presents the topology defined to
run unroll the sequence diagram shown in Fig.4.17.
4.4 Conclusion
In this chapter, we detailed the simulator’s object oriented design. For this
purpose, we described the most important classes. And finally, we unrolled two
sequence diagrams demonstrating the interactions between objects via two of
the most frequent use cases of the simulator, namely messages exchanging and
timer setting. Reader may notice that we relied on simplicity in the solution
exposition in this chapter as well as in the solution design.
66
Chapter 5
5.1 Introduction
Introduction : This chapter has two main purposes. First of all, it aims to give
a glance at the actual work conditions of the project. In different words, we will
deal with the hardware and software environments of development. Moreover,
since it is about a collaborative project in progress, it is interesting to precise
the advancement state of the software until the time of redaction of the present
document.
RAM: 512 MB
Storage Capacity: 80 GB
Wireless: 802.11a/g
67
Design and Implementation of a Wireless Networks Simulator 5.3
Operating system :
Ubuntu1 : it is a complete Linux-based operating system, freely available with
both community and professional support. We used the version 6.06.
Program language :
The kernel of the simulator is fully programmed in C++. We implemented the
classes diagram referred in Fig. 4.1. We use the GNU 2 Compiler Collection3
(GCC) version 4.1.1, released on May 24th 2006. GCC was used to stand for
the ”GNU C Compiler”, but since the compiler supports several other languages
aside from C, it now stands for the GNU Compiler Collection. GCC includes
front ends for C, C++, Objective-C, Fortran, Java, and Ada, as well as libraries
for these languages (libstdc++, libgcj,...). Nevertheless, hitherto we interest
only on C++.
Text editor :
Emacs4 : it is a class of text editors, possessing an extensive set of features,
that are popular with computer programmers and other technically proficient
computer users. GNU Emacs, a part of the GNU project, is under active de-
velopment and is the most popular version. Weused the version 21.4 of GNU
Emacs.
68
Design and Implementation of a Wireless Networks Simulator 5.4
69
Design and Implementation of a Wireless Networks Simulator 5.4
Until this moment, available protocols are those we can see in the global
classes diagram Fig.4.1. We notice the presence of a set of subclasses of proto-
col and service classes. As mentioned above, subclasses of the parent classes’
protocol and service form the models library of our simulator. Unfortunately,
most of them, such as TCP and IP, are not suitably implemented. They are
here only for test issues. On the other set, some other protocols are well defined.
For instance, protocols that get in touch with IEEE802.11i are properly defined.
We will focus on them on the next part of this document. The OSI modules
that are really interesting for us are primarily those relative to mobility and
wireless protocols. The physical and link layer, if considered in the perspective
of the radio emission/reception are also important. It is also very important to
have a reliable implementation of the MAC layer. At the application level it is
enough to have simple CBR modules for tests on the simulator kernel purposes.
The next step of scenario specification is defining up targets and down targets
of each protocol, and we precising the down target of each service too. Now,
the protocolar stack of every equipment is ready. We attach it to the concerned
equipment.
This process allows the creation of personalized equipments. We can create
simple equipment as in Fig 5.2, or more elaborated equipments like in Fig 5.3.
This latter represents an access point that supports the protocol IAPP 8 Wereas
the simple equipment only generates traffic and introduces a statistical delay.
Further, we interconnect equipments by attaching them to links. Now we can
schedule flows to begin at precise time of simulation. Flows are the activity of
pre created services (or applications) in equipments. Mobility is not functional
8 IAPP: inter access point protocol
70
Design and Implementation of a Wireless Networks Simulator 5.4
71
Design and Implementation of a Wireless Networks Simulator 5.5
yet. But it will be possible to schedule mobility scenarios at short notice since
it is under work at the time of redaction of the present document.
We remind that the project remains in progress, and is likely to evolve
rapidly, as far as new protocols and applications are upgraded. Moreover, we
recall that it is a collaborative project of development which means that other
persons are working on it. For instance, at the time being, Nicolas Montavont
is implementing the IEEE Protocol 802.11, in addition to the wireless channel.
Thus we can expect that the simulator will support mobility soon. And so we
foresee a rapid implementation of the graphical interface especially when we
take in count that it will take inspiration from the GUI of SimulX.
5.5 Conclusion
This chapter gave an overview of work conditions but also of the current level
of advancement of the project. All this second part is devoted to the kernel
of simulation description. It underlines in particular the modularity and the
independency of protocols library from the simulation kernel. In the next part
we give an example that illustrates how to add a new protocol to the simulator.
72
Part III
Implementation of
IEEE802.11i in the
simulator
73
Design and Implementation of a Wireless Networks Simulator 5.5
Introduction :
Previous chapters explain the parameters taken into account and the purposes
that was determinant in our work of design and realization of the simulation
kernel. The next step is the validation (and debugging) of this architecture
by implementing a protocol from the world of wireless networks standards. To
begin, we elect the IEEE 802.11i standard, protocol dedicated to security in
the local area wireless networks (WLAN IEEE 802.11). This choice is based on
the following reasons. First, it is a standard protocol of the IEEE for wireless
communication networks which is in concordance with our purpose. Second, it
is such a complicated protocol. Its range extends on several layers and levels,
and puts in interaction a set of protocols. Thus, it makes it possible to evaluate
the modularity of our simulation architecture. Finally, we need to implement
this protocol for our near future work: ”implementation and evaluation of fast
re-authentication methods”.
This part is divided into two chapters: in the first one, we describe the
standard IEEE 802.11i in addition to all the protocols that interact with it,
while trying to focus on the aspects which interest us in most for our modeling.
In the second chapter, we present our conception of the protocol in order to
implement it on the simulator. We conclude by an evaluation of this modeling
and its realization.
74
Chapter 6
IEEE802.11i standard
description
6.1 Introduction
As it is widely known today, the security problems of the early 802.11 spec-
ifications resulted in insecure implementations and thus low adoption of the
technology by enterprises. Therefore, in 2000 the IEEE initiated a work group,
”Task Group I” in order to provide enhanced security services and mechanisms
for the IEEE 802.11 medium access control (MAC). The IEEE standards com-
munity completed the revision of the security-related components of 802.11 in
2004 and proposed the IEEE 802.11i standard. This chapter aims to provide a
roadmap for readers seeking a deeper understanding of the security aspects of
802.11 WLAN. The discussion sometimes goes into considerable level of details.
This is needed because we want to be as exact as possible in our modeling of
the protocol.
As it is widely known today, the security problems of the early 802.11 spec-
ifications resulted in insecure implementations and thus low adoption of the
technology by enterprises. Therefore, in 2000 the IEEE initiated a work group,
”Task Group I” in order to provide enhanced security services and mechanisms
for the IEEE 802.11 medium access control (MAC). The IEEE standards com-
munity completed the revision of the security-related components of 802.11 in
2004 and proposed the IEEE 802.11i standard. This chapter aims to provide a
roadmap for readers seeking a deeper understanding of the security aspects of
802.11 WLAN. The discussion sometimes goes into considerable level of details.
This is needed because we want to be as exact as possible in our modeling of
the protocol.
IEEE 802.11i is such a complicated protocol because it makes use of panoply
75
Design and Implementation of a Wireless Networks Simulator 6.2
1. Supplicant: this is the port that wishes to requests access to the services
offered by the authenticator’s system. Typically, the supplicant would be
the client system, such as a laptop.
2. Authenticator: this is the port that enforces authentication before allowing
access to services that are accessible via the port. In the basic WLAN
configuration, the AP would typically be the authenticator.
3. Authentication server: this is the entity that performs the authentication
function necessary to check the credentials of the supplicant, on behalf of
the authenticator. The resulting decision consists of whether or not the
supplicant is authorized to access the authenticator’s services. The most
oft-quoted server is RADIUS, though other types of servers could also be
used.
76
Design and Implementation of a Wireless Networks Simulator 6.2
From the basic description of the entities above, we can get a basic understand-
ing of the behaviour of each entity. Thus, for example, a laptop (supplicant)
seeking to gain access to LAN behind an 802.11 AP (authenticator) must first
execute an authentication protocol against the AS sitting behind the AP. If the
authentication process succeeds, the AS signals the AP to open the relevant
port on the AP to allow the client access.
77
Design and Implementation of a Wireless Networks Simulator 6.2
EAP
The 802.1X protocol makes use of the Extensible Authentication Protocol (EAP)[3]
as a way of communicating authentication information between the supplicant
and the AS, passing through the authenticator. EAP is a general protocol
that supports multiple authentication mechanisms. It is interesting that in this
mode of usage, EAP essentially becomes a lowest denomination of ”transport”
between the supplicant and the AS. A summary of the EAP packet format is
shown in the Fig. 6.2 shows EAP packet format.
Code field identifies the type of EAP packet. Four types are supported ,
namely Request, Response, Success and Failure. Request packets have a type
field to indicate what is being requested (e.g. identity, MD5-challenge).
Identifier field allows matching of responses with requests. Identifier field and
System Port together uniquely identify an authentication exchange. The Au-
78
Design and Implementation of a Wireless Networks Simulator 6.2
EAPOL
[6] 802.1X defines the encapsulation format, known as EAP over LAN or EAPOL,
which allows EAP messages to be carried directly by a LAN MAC service. The
EAPOL encapsulation is used for all communication between the supplicant and
the authenticator. EAPOL PDUs (protocol data unit) are encapsulated into an
IEEE 802 MAC frame. Fig.6.3 shows a summary of EAPOL frame format.
Packet type field’s value determines the type of packet being transmitted.
Five types are defined. For example, EAP-Packet indicates that the frame
carries an EAP packet. EAPOL-Start means that the frame is an EAOL-Start
frame. EAPOL-Key shows that the frame is an EAPOL-Key frame, used to
transmit key information between the Authenticator and the Supplicant.
The value of Packet Body length field defines the length in octets of the
Packet Body field; a value of 0 indicates that there is no Packet Body field
present.
Packet Body field is present or not according to Packet Type value. In a
frame carrying a Packet Type of EAP-Packet, this field contains exactly one
EAP packet as described the previous paragraph. In a frame carrying a Packet
Type of EAPOL-Key, this field contains exactly one Key Descriptor.
Key Descriptor frames are used to exchange encryption keys between the
supplicant and the authenticator. A summary of the Key Descriptor format is
shown in Fig.6.4.
79
Design and Implementation of a Wireless Networks Simulator 6.2
RADIUS
80
Design and Implementation of a Wireless Networks Simulator 6.2
81
Design and Implementation of a Wireless Networks Simulator 6.3
solution as all transactions between the client and the server are based on the
3-tuple attribute-value-length. As such, a given implementation of RADIUS can
introduce its own domain-relevant extensions without affecting other implemen-
tations.
For instance, the IEEE 802.1X RADIUS Usage Guidelines [14] provides sug-
gestions on Remote Authentication Dial In User Service usage by IEEE 802.1X
Authenticators. In a similar manner, the RFC [1] defines some new attributes
like the EAP-Message attribute which is used to encapsulate EAP packets for
transmission from the IEEE 802.1X Authenticator to the Authentication Server,
likewise Message-Authenticator attribute.
In fact, since an authentication exchange occurs between the supplicant and
the AS which is the decision maker, during such an exchange, the authenticator
provides a ”pass-through” or ”relay” function. This means that the authenti-
cator needs to repackage the EAP packets for suitable delivery to the AS. This
repackaging must be done by high level function in the authenticator. Since RA-
DIUS is used for this purpose, we need a mean to encapsulate EAP messages
within RADIUS packets. EAP-Message attribute is defined for this purpose.
The AP places EAP messages received from the authenticating peer into
one or more EAP-Message attributes and forwards them to the RADIUS server
within an Access-Request message. Multiple EAP-Message attributes may be
contained within an Access-Request or Access-Challenge packet. The RADIUS
server can return EAP-Message attributes in Access-Challenge, Access-Accept
and Access-Reject packets. Multiple EAP packets must not be encoded within
EAP-Message attributes contained within a single Access-Challenge, Access-
Accept, Access-Reject or Access-Request packet.
The field value of EAP-Message attribute contains an EAP packet. If mul-
tiple EAP-Message attributes are present in a packet their values should be
concatenated; this allows EAP packets longer than 253 octets to be transported
by RADIUS.
82
Design and Implementation of a Wireless Networks Simulator 6.3
6.3 802.11i
IEEE 802.11i [7], is designed to provide enhanced security in the Medium Ac-
cess Control (MAC) layer for 802.11 networks. The 802.11i specification de-
fines two classes of security algorithms; Robust Security Network Association
(RSNA), and Pre-RSNA. Pre-RSNA security consists of Wired Equivalent Pri-
vacy (WEP) and 802.11 entity authentication.
RSNA provides two data confidentiality protocols, called the Temporal Key
Integrity Protocol (TKIP) and the Counter-mode/CBC-MAC Protocol (CCMP),
and the RSNA establishment procedure, including 802.1X authentication and
key management protocols.
83
Design and Implementation of a Wireless Networks Simulator 6.3
84
85
Design and Implementation of a Wireless Networks Simulator 6.4
6.4 Conclusion
In this chapter we described the standard IEEE protocol 802.11i. We explained
that it involves a set of protocols from IEEE and other standardisation orga-
nizations such as the IETF. We presented the specifications of each protocol
of them, including packet format, and fragmentation and retransmission policy.
We gone into an advanced level of details because it as required for a faithful
modelling of the protocol into the simulator. In the next chapter, we detail the
conception and the integration of 802.11i into our software.
86
Chapter 7
7.1 Introduction
We asserted in the precedent chapters that the addition of a new protocol in
our simulator requires only two manipulations. First, we may subclass the
class header to create the corresponding header to the new protocol if requisite.
Second, we must subclass the class ”protocol” to create our proper protocol.
Thus, the new protocol can be integrated to any equipment in the topology.
However, the IEEE 802.11i security protocol for IEEE802.11 WLAN makes
use of several protocols from the IEEE and other standardization organization
such as the IETF. It is in reality a set of protocolar layers and not only one layer.
Thus, we are constrained to create a subclass of ”protocol” for each protocol
that interacts within 802.11i.
In addition, 802.11i involves three devices, namely; the supplicant, the au-
thenticator server, and the authenticator. Therefore, we need also to establish
the conception of these three entities.
In this chapter, we give an overview of the three entities structure adopted
to model the supplicant, the authenticator, and the authentication server within
our simulator. Further, we describe in details classes created to simulate each
protocol invocated by the IEEE 802.11i authentication procedure.
87
Design and Implementation of a Wireless Networks Simulator 7.3
88
Design and Implementation of a Wireless Networks Simulator 7.3
Figure 7.2: EAP modeling in the simulator: eap and eap hdr classes
89
Design and Implementation of a Wireless Networks Simulator 7.3
Figure 7.3: EAPOL modeling in the simulator: eapol and eapol hdr classes
recv, recv from down, and recv from up: They are over loadings of the
functions inherited from protocol. recv checks while the EAP layer is in
bridging mode. In this case it calls repackaging function. Otherwise, it
checks the direction of the message. And according to the subtype, and
subsubtype of the EAP hdr of the message, recovered from the EAP hdr,
the function either sends the suitable response, deletes the message silently,
remove EAP header and deliver to up target or notifies the EAP TLS
to start EAP TLS exchanges by calling start auth function of EAP TLS
class.
repackaging(message *m): This method is called by the AP when EAP
layer is in bridging mode. In fact, the AP checks either the packet is re-
ceived from the 802.11 interface or from the DS (distribution system),
and removes accordingly the old header to replace it by the new one
( EAPOL hdr/RADIUS hdr). Moreover, it changes addresses to relay
EAP messages between the MS and the RADIUS. Then it sets the right
handler for the message and sends it.
In a simular manner Fig.7.3 shows EAP over LAN modeling in the simulator.
7.3.2 radius, radius hdr, eap tls and eap tls hdr classes
In this project, RADIUS design is minimal. In other terms, we plan to imple-
ment a version of RADIUS that is operational only in 802.11i authentication
framework. Still, it is possible to extend easily RADIUS in order to adapt it
with other authentication process.
Consequently, the class RADIUS does not define new methods, but only
overload some methods inherited from its parent class protocol as we can see in
Fig. 7.4.
90
Design and Implementation of a Wireless Networks Simulator 7.3
Figure 7.4: RADIUS modeling in the simulator: radius and radius hdr classes
Figure 7.5: EAP TLS modeling in the simulator: eap tls and eap tls hdr classes
91
Design and Implementation of a Wireless Networks Simulator 7.5
mobile station (MS) and the access point (AP). In spite of not being really a
protocolar layer, it is represented as if, because of the similarity of behaviour.
This is why it inherits from protocol class. PAE checks the access to controlled
port. Before authentication, it allows only authentication messages to access
to the uncontrolled port. open port and block port member functions, allow or
block the access to controlled port to traffic coming from a specific node.
Moreover, since it is only an adaptation that we imagined to model the port
access entity defined in IEEE802.1X and not really a protocol, it does not tally
with a specific header, but with the parent class header.
IEEE802.1X defines two different types of PAE: the first one acts in the
Mobile Station that wants to be authenticated, whereas the second type is for
Authenticator. Likewise, we define two classes PAE client and PAE auth. Both
inherit from a root class PAE.
For instance, the mobile station has an attribute myAP id which represents
the identifier of the Access point to which the node is associated at this time,
whereas Access point has a list of authenticated mobile station (MS authenticated ),
as the same AP may be authenticated with several MSs at the same time.
7.4 Realization
We implemented all protocols and headers mentioned in the previous section.
We can find these protocols and headers in two separated files. 802.11i hdr.h,
.cpp contains the definition of the headers that are specific to IEEE 802.11i pro-
tocol and other protocols used by the 802.11i authentication procedure. These
protocols are defined in their turn in an isolated file which is 801.11i ptcl.h,.cpp.
The protocols MAC802.11, Phy802.11a in addition to MAC 802.3 are in
course of implementation by other collaborators.
7.5 Conclusion
In this chapter, we presented in details the protocol 802.11i integration into our
simulator process. First, we explained the adopted design to model equipments
involved in 802.11i authentication procedure, namely, the mobile station, the
Access point, and the authentication server. Further, we gave the detailed
description of classes allowing creating such equipments. We underlined the
extensibility of our software, and we introduced how to upgrade the protocol
library in a simple manner.
92
Chapter 8
93
Design and Implementation of a Wireless Networks Simulator 8.0
94
Bibliography
[1] B. Aboba and P. Calhoun. Radius (remote authentication dial in user ser-
vice) support for extensible authentication protocol (eap). Technical Re-
port RFC 3579, Internet Engineering Task Force. Network Working Group,
2003.
[2] B. Aboba and D. Simon. Ppp eap tls authentication protocol. Techni-
cal Report RFC 2716, Internet Engineering Task Force. Network Working
Group, 1999.
95
Design and Implementation of a Wireless Networks Simulator 8.0
96