The figure 4 shows the inheritance diagram of the
P2PEmuDevice class. The
ns3::P2PEmuDevice
in-
Figure 3: Inheritance diagram of P2PEmuDevice class.
stance is contained in a
ns3::Node
object. The ns-3
static routing mechanisms help to forward data from
any other simulated device to the P2PEmuDeviceone.
This also needs an auxiliary queue with tail drop al-
gorithm, implemented by
ns3::DropTailQueue
.
The use of a real-time simulator is needed
to interact with the real world on regular
time basis so the simulation makes use of the
ns3::RealTimeSimulationImpl
, also included in
ns3.
The Figure 3 shows the relation between
P2PEmuDevice and several other ns-3 classes.
3.2 Hardware and Software Platform
Standard hardware based on x86 has been used to
build the sink node. A standard personal computer
can easily meet all the sink hardware requirements
with cheap components and the addition of a radio-
frequencynetwork deviceto allows it to communicate
with the rest of the WSN. Some previousgateway pro-
posals have chosen embedded ARM solutions (Song
et al., 2008), (Yang and Yan, 2010). Due to their
amount of resources, they have even the capacity of
running general purpose operating systems or adapted
versions such as embedded versions of GNU/Linux or
Windows. Moreover, choosing such hardware plat-
forms allows the use of a wide range of development
and debugging tools.
Thus, the prototype sink node hardware consid-
erably differs from the rest of the autonomous nodes
in terms of hardware, software, power consumption
and computing power. The sink node hosts both WSN
simulation and sink software.
The platform prototype has been built on Debian
GNU/Linux 6.0 Stable, which support ns-3 simula-
tor and it has all the required software dependen-
cies in its package repository. Other general purpose
GNU/Linux distributions are also suitable for running
ns-3, e.g.. Fedora or Ubuntu.
3.3 Emulated Communication Channel
A pseudo-terminal is defined as pseudo-device pair
which provides a text terminal interface without as-
sociated virtual console, computer terminal or serial
port hardware. Instead, a process acts as the under-
lying hardware for the pseudo terminal session. It is
present in some operating systems, including Unix-
like ones and there are several implementation ap-
proach and standards that regulate their nomenclature,
and programming API. Unix 98 standards define an
API to create and use pseudo terminals which are not
restricted in number by nomenclature, only by imple-
mentation. It proposes a master-slave design based on
two different types of pseudo-devices linked between
them: Pseudo Terminal Master (PSM) responds to
/dev/ptmx
device name in GNU/Linux systems; and
Pseudo Terminal Slave (PTS) have a name of the form
/dev/pts/X
in the GNU/Linux file system, being X a
natural number which automatically increases in one
unit for each new PTS. Each time a process opens the
PTM device, a new PTS is automatically created, ex-
isting a connection between the file descriptor of the
PTM and the slave pseudo terminal.
Basic Unix 98 API functions have been used to
interact with the PTM device:
•
int posix openpt(int oflag)
, opens the
/dev/ptmx
device and returns the associated file
descriptor.
•
int grantpt(int fd)
, grants access to the
slave pseudo-terminal.
•
int unlockpt(int fd)
, unlocks a pseudo-
terminal master/slave pair.
•
char *ptsname(inf fd)
, gets the name of the
pseudo-terminal.
4 CONCLUSIONS AND FUTURE
WORK
This work has defined and implemented the archi-
tecture of a WSN platform that integrates simulation
and real elements in a application-transparent way.
The main elements have been identified, their roles
have been defined and several technologies and tools
have been proposed to implement the testing plat-
form. The resulting proposal lays the groundwork for
future works to improve its features and determine its
scalability and range of application.
DCNET 2011 - International Conference on Data Communication Networking
96