Java Adhoc Network Environment
Java Adhoc Network Environment
Java Adhoc Network Environment
Daniel Grgen
University of Trier
goergen@uni-trier.de
Hannes Frey
University of Southern Denmark
frey@imada.sdu.dk
Abstract
This work describes a Java based development platform
which is intended to support ad hoc network researchers
in application and protocol design. Software development
within this environment is expected to follow a bottom up
approach. Basic functionality is implemented in elementary components which can be combined to more complex
ones by using well defined interfaces. With dynamically
changing network links being rather the common case than
a failure situation, asynchronous communication has been
selected as the main communication paradigm within this
platform. Reusability of components in different execution
contexts by providing an appropriate machine abstraction
is a further important design decision which drove the platform development. Code written once can be executed in a
pure simulation mode, in a hybrid setting with real devices
being attached to a running simulation and, finally, in a setting using real devices only. Software development following this three-tier development process paired with the platforms rich visualization features emerged to significantly
ease the burden of debugging and parameterizing in such
highly dynamic and inherently distributed environments. In
conjunction with a core middleware platform a rich set of
generic services has been implemented with the most important ones being described in this work. Several application programs have already been implemented on top of
these services. These applications which are described in
this work as well serve as a proof of concept for both the
platform itself and the utilized set of generic services.
Introduction
Future paradigms as ubiquitous and pervasive computing rely on countless mobile devices interacting among one
another using wireless communication. Groups of these devices may form ad hoc networks at any time. These networks can be divided into three general classes. (1) Pure
infrastructureless networks which totally rely on other mobile devices using multi-hop routing for distant interactions,
(2) single-hop ad hoc infrastructure using wireless communication as the last hop into a more reliable backbone net-
Christian Hiedels
Universit du Luxembourg
christian.hiedels@uni.lu
work and (3) hybrid networks mixing these two types. Hybrid networks integrate infrastructure to improve reliability
of mobile multi-hop ad hoc networks. Beside traditional
infrastructure such as WLAN access points or 3G networks,
it is also possible to think of mesh networks or even single installed mobile devices to provide infrastructural duties
selforganized.
In all the described scenarios the mobile and wireless
network parts are characterized by limited energy resources,
a broadcast based communication media, and a dynamically changing network topology due to device mobility or
energy conserving sleep cycles. Software development in
such an environment requires new tools and programming
paradigms which address the special needs under these
harsh conditions. In addition, implementing and evaluating
applications and algorithms in a mobile ad hoc environment
is an extensive task when using real mobile devices in field
trials. A large amount of devices are needed and of course
enough people to handle them. Thus, it is very hard to obtain reproducible scientific results. Using network simulators for testing and evaluating network protocols for multihop ad hoc networks is state of the art. Most of these simulators are not intended to implement applications on top of the
simulated network. Moreover, testing applications solely in
a simulated and thus idealized environment may produce
misleading results or interpretations. A promising approach
is the three step development process originally proposed in
[25]. Applications are implemented, tested and evaluated
in a simulated environment first. Second, the application is
tested with real user behavior but still in a simulated environment. Finally, dedicated field trials are used as proof of
concept.
The JANE development environment described in this
work can be used to implement and test protocols and
applications by following the described three-tier design
paradigm. Component based design and asynchronous
communication among components are forming the key ingredients of the JANE development environment. The approach is motivated by the observation that realizing a traditional view of the network stack and stream oriented synchronous communication does not cope well with the extreme dynamics of an ad hoc environment. For instance, a
process blocked at a stream in order to obtain data from another mobile device might frequently be tied up with error
handling due to stream disconnection. Error handling, however, should be an exception and not the general case. Event
based programming perfectly fits in a frequently changing environment since applications and protocols can adapt
immediately when the surrounding of a device changes.
Blocking in contrast requires a timeout to occur before the
blocked entity can be transferred into the next state (e.g. to
realize that the stream sender is no more available).
For ad hoc networks it is a well established fact that
ISO/OSI protocol layers require cross layer communication
which contrasts the original idea of hiding all protocol peculiarities. For instance, in an ad hoc scenario neighborhood information maintained at the MAC layer should be
provided to upper layers as well. This avoids unnecessary
message exchange in order to build up the same view at a
higher layer. The component based design followed by the
JANE environment takes the idea of cross layering one step
further. Communication among components is possible by
using any handler method which has been published at the
device. Components themselves are not explicitly layered.
This follows implicitly from the components functional dependencies.
The rest of this paper is organized as follows: The first
section introduces the JANE architecture. Section 3 introduces JANEs network abstraction and the implementations,
Section 4 introduces a generic routing framework, and Section 5 a generic neighbor discovery service The three JANE
execution modes, simulation, hybrid, and platform, are described in Section 6, 7 and 8 respectively. Some application
examples which have been realized using JANE are shortly
sketched in Section 9. Related work is given in Section 10
and the paper is concluded with Section 11.
In JANE, everything is a service. This includes application components, basic middleware services, network layers, routing algorithms, and even hardware such as GPS
receivers are represented as a JANE service. Services are
strict components and cannot be accessed directly. Communication with other services is only allowed using an event
based communication mechanism provided by an operating system abstraction. Thus, each device runs a couple of
services, locally interacting using asynchronous signals and
events. Also the ad hoc network is modeled using eventdriven services. JANE networks provide asynchronous message oriented communication with other devices. Message
sending and receiving is mapped to the local event based interaction primitives. This model perfectly fits to the extreme
event-driven environment of mobile ad hoc networks.
Simulation
Device
Runtime
Service
Device
Runtime
Service
Runtime
Service
Device
Runtime
Service
Runtime
Service
Runtime
Service
Operating System
Operating System
Operating System
Simulation OS
Simulation OS
Simulation OS
Simulation
Service
Simulation
Service
Simulation
Service
Simulation
Service
Simulation
Service
Simulation
Service
Global
Service
Global
Service
2.1
JANE Services
Services
Service
Interaction
Platform Core
Timer
Local
Event
Queue
Timer
System
Execution
Manager
Hybrid Core
Simulation
Knowledge
Simulation Core
2.3
Global
Event
Queue
JANE provides two types of asynchronous service interaction: (1)Signaling and (2) event firing and catching.
A service signal addresses an event handler object using
a known receiver identification and calls asynchronously a
public method of the receiving object. By default a service
can be addressed by signals using its service ID. Additionally, every service is able to register objects for signal receiving. The signal receiving event is executed in the context of the receiving service (also in the case of registered
handler objects). To keep things simple, it is possible to export interfaces for the service and its event handler objects.
Other services can request signal proxies automatically generated by the operating system using the exported interfaces.
Thus, a service can send signals to another service and asynchronously execute a signal handler method by calling exactly the same method on the generated signal proxy. To
reply to an asynchronous call, the sender can pass callback
objects. The receiver gets a signal proxy as a method argument, which also generates asynchronous signals that are
send back again. Thus, also more complex interactions can
easily be implemented. An example is a message status handler for network communication where the current status of
a message propagation task is signaled asynchronously.
A service can also interact with others by firing a service
event. These events are not addressed to a specific receiver
as a signal. Instead, other services can register event handlers which are called when such an event occurs. To specify the events which are of interest event templates are used.
A fired event is matched to all registered templates implementing the same class or one of its superclasses. Registering a superclass template can be used to receive all derived
events. An event object is matched using its attributes. A
template attribute with a null value matches all possible values. Initialized attributes must be equal to the corresponding event attribute. In case of a Java Class attribute, the
instanceof relationship is used instead. By default, an event
contains the unique identification of the sender and its Java
class. Thus, a receiver is able to specify the sender by providing one of the interfaces the sender implements. It is
possible to enable template matching also for every event
attribute given as Java object. The template matching is restricted by a given reflection depth, which is one (only service event attributes are matched) by default. Using a higher
reflection depth causes additional computational load. But
a fired event is only reflected to the maximum depth of
all registered templates of the same event type. The regis-
Device
Movement
2.2
Service Interaction
JANE Networks
In JANE, also a network is implemented as a set of services and event handling objects. The main purpose of
JANE is to simulate mobile ad hoc networks but it is also
possible to simulate hybrid settings by starting multiple network services. In a hybrid setting, a wireless ad hoc network
is combined with a wireless infrastructure network. Also
multiple wireless ad hoc networks are possible and devices
can be connected with fixed wired network links. Due to
the open service architecture it is possible and also simple
to realize additional networks beside the ones presented in
this paper.
A JANE network is represented at the link layer. Basically, it provides asynchronous message oriented unicast
and broadcast communication which addresses direct neighbors in a wireless ad hoc setting. Other services can communicate over the network by signaling a message communication task to one of the running network services. To
retrieve message status events, the client is able to provide a
callback handler which can be signaled by the network service. At minimum, a network signals success, failure and
timeout for reliable communication and at least it signals
when a message has been completely processed locally, e.g.
completely put on the media.
Networks can also provide an extended network interface
which is mainly intended for wireless networks. It provides
additional communication paradigms addressing the broadcast property of the wireless media. In most wireless networks, unicast communication is much more reliable than
broadcasts since the link layer uses acknowledgments to increase reliability. Thus, there is a tradeoff between using
the medias broadcast property and message reliability. To
cope with this problem, the extended link layer provides reliable communication paradigms which also use the broadcast property: (1) An addressed multicast sends a message
to a known receiver set in the direct neighborhood and waits
for acknowledge messages from all receivers. In the best
case, the message is transmitted only once. (2) An addressed broadcast is an addressed multicast and addresses
also a known receiver set but the message is also received
and processed by all other devices within the senders broadcast region. When a subset of the neighboring devices is
known, a broadcast to all neighbors is therefore much more
reliable. A special case addresses only one device. This is a
unicast while all receiving neighbors are implicitly set into
3.1
Linkcalculator
3.2
Collisionfree Network
The simplest network implementation models the wireless ad hoc network as spontaneous but reliable unidirectional links between neighboring devices with arbitrary but
circular communication ranges. Thus, a message is only lost
when a link breaks down due to device mobility. Moreover,
this network does not simulate a shared media. Unicasts
are also delivered over unidirectional links but are only signaled as successful, if the receiver has a link to the sender
for virtual" acknowledgement. The network is realized as
global service and is based on the exact linkcalculator links.
Devices that like to take part within the network must start a
local service that registers themselves within the global service. To simulate packet losses when devices are mutually
within their communication ranges, the network additionally asks an exchangeable component which can base the
packet loss decision on the positions and communication
ranges of the two devices, as well as on arbitrary random
distributions.
This network is mainly intended for simulations where
device mobility patterns or spontaneous network structures
are the main focus. Moreover it provides fast simulation
runs since the overhead for network simulation is very low.
For instance, a usage scenario for this type of network is
measuring the hop count of a message needed from sender
to receiver using a geographic routing protocol [17]. No
detailed network simulation is needed in this case.
3.3
Shared Network
3.4
802.11 MAC
3.5
Wireless Infrastructure
3.6
Fixed Infrastructure
Neighbor Discovery
Simulation Core
JANEs primary duty is to simulate a mobile ad hoc environment. As most ad hoc network simulators, also JANEs
simulation core contains a discrete simulation kernel with
a central event queue. On top of this kernel all other simulation components have been build. For each simulated
device, the simulation internals are hidden by a simulated
operating system. It maps the operating system components
to the simulation specifics. A device manager is responsible
for the device mobility provided by a mobility source which
will be discussed in section 6.2. It might additionally own a
linkcalculator component as described in section 3.1 in order to speed up the simulation of wireless networks. Moreover, the device manager is responsible for the visualization
of a device into a decoupled visualization component.
6.1
6.2
Device Mobility
ting. There, the devices can also be moved by user interaction with the simulation GUI at runtime. The device
movement is restricted by the underlying mobility models.
Using the pathnet model, the user can only move devices
between pathnet endpoints. This setting is used for interactively playing with the mobility scenario during testing or
debugging and also for application demonstration.
At startup, devices can be grouped together. Each device
group is assigned to a mobility source, so that it is possible to model different device behavior. Each group can be
started with a different set of services. This feature is used
to set up simulation with heterogeneous functionality and
behavior very simple. Device can be stuck to fixed positions providing selforganized ad hoc infrastructure features
while the rest randomly moves on the plane. Other scenarios are used to analyze applications only on a small subset
of devices while the rest only act as transparent multi-hop
communication routers. Different mobility patterns can also
be used in combination with different simulated user behavior patterns implemented as services on a device. Besides
grouping, it is of course possible to assign each device its
own service set.
visualization GUI.
6.3
Visualization
For testing, debugging and demonstration JANE provides extensive visualization possibilities. Every service is
able to visualize its state by providing arbitrary shapes like
lines, rectangles, ellipses or collection of shapes. Shapes
can be defined using simulation positions or by using device addresses as points. Thus, the network for example is
able to simply paint network links or a message progress of
a transmission between two devices. The shape rendering is
decoupled from the simulation so that it does not influence
the simulation behavior. The rendering unit can use a GUI
canvas (e.g. Java2D and OpenGL [28]) for drawing and, if
desired, the unit can also render to file e.g. as Postscript,
PNG or XML.
Using the visualization is computational expensive and
slows the simulation down. But it gives sometimes better
insights as it can be achieved by evaluating trace files. For
long running statistic evaluation, the visualization can completely be deactivated. This causes no additional computation load if the service shape generation is implemented
appropriately by providing the shapes only on demand.
The visualization GUI can be extended to pass user interaction to a running simulation. This causes, of course, non
determinism and thus non reproducible simulation runs. But
for testing and also for presentation this is a very helpful
feature. Such user interaction can use the same operating
service abstractions like a global service. A user interaction is therefore able to generate arbitrary events for each
running service on each simulated device. In combination
with a mobility source which also supports user interaction,
it is also possible to influence the device mobility using the
Simulation
Remote Device
Runtime
Service
Simulation Device
Runtime
Service
Runtime
Service
Remote
Operating System
Operating System
RMI
Device
Runtime
Service
Simulation OS
Simulation
Service
Simulation
Service
Figure 4. JANE merges services on extern device with the services on a simulated device
on a virtual device with a virtual OS. This is
achieved using Java RMI.
Hybrid Setting
Platform Core
JANE in Action
Figure 5. Visualization of geographical cluster based routing and neighbor discovery seen from the perspective of node
136.199.54.252.
9.1
En-passant Communication
The en-passant communication pattern [19] is used to efficiently synchronize data objects when devices passes one
another. It is possible that not only two devices are involved in this process, e.g. when two groups pass one another. The data exchange protocol handles this by using
the extended link layer features of JANE. Data objects and
protocol messages are propagated as addressed broadcast.
Thus, all neighboring devices receive and store data objects.
When an object is not needed locally it is stored and provided altruistically to others. If possible, it wont be transmitted any more when it is needed locally.
The en-passant communication has also been evaluated
in field trials using JANEs platform mode (fig.8). Field
trials are very extensive and thus only smaller scenarios with
up to six devices were realized. Although the addressed
broadcast has been realized using only UDP unicasts and
broadcasts, the advantage of this communication paradigm
has been observed.
9.2
UbiSettlers
9.3
UbiBay
9.4
NetNibbles
9.5
HyMN
HyMN (Hybrid Multimedia Network system [5]) is designed for users interested in live multimedia news from
certain events like e.g. Football Championships, Olympic
Games etc. For instance mobile devices from football fans
create an interest group in a local ad hoc network partition. Multitudes of such groups co-exist e.g. football fans
in pubs, those watching another match, traveling ones, and
more. In each of these cases, a considerable number of devices have shared interests and might join forces in a local setting. The devices in the ad hoc network running
HyMN organize themselves in clusters, where the clusterheads maintain uplinks to a backbone network in order to
receive multimedia news related to the interests of the ad
hoc members. Thus, the football fans will receive information such as small videos, pictures or text messages each
time something interesting is happening during the match.
The received multimedia files remain stored on the mobile
devices and will be provided to devices joining the group at
a later time. For optimization, the HyMN backbone splits
the files into chunks, which are sent concurrently to different clusterheads within a single ad hoc network partition.
Until everyone received the complete file, the chunks are
exchanged via Wi-Fi among interested devices.
9.6
Distributed Script
10
Related Work
This section gives an overview over other popular simulating environments. While comparing them with JANE,
especially the power to build arbitrary working applications
using the vast set of available services emphasizes JANEs
ability to serve as a middleware.
GloMoSim [8] is a network simulator which focuses on
scalability. It uses the capabilities of the parallel discreteevent simulation language Parsec [7]. Implemented protocols are build to use a layered approach and standard APIs
are used between different layers, which enables users to
integrate new models easily. Simulation scenarios are described via text files. It has various applications, transport
and routing protocols, as well as miscellaneous mobility
schemes. Because of the parallel approach, GloMoSim allows to run simulations with thousands of devices, which
can be visualized either during runtime or later.
QualNet [4] was developed by Scalable Network Technologies based on GloMoSim. It has a lot more network
Figure 8. Screenshot of JANE in hybrid mode running the Distributed Script application. The two
Application GUIs on the right are connected to devices visualized within JANEs simulation GUI on
the left.
11
Acknowledgements
This work is funded in part by DFG, priority programme
SPP1140 Selforganized infrastructures for networked mobile systems.
References
[1] Ieee
802.11
support
for
http://yans.inria.fr/ns-2-80211/.
ns/2.
[2] Opnet
technologies
inc.:
Opnet
modeler.
http://www.opnet.com/products/modeler
/home.html.
[3] Otcl.
http://otcl-tclcl.sourceforge.net/
otcl/.
[4] Scalable network technologies:
Qualnet family
of products.
http://www.qualnet.com/
products/qualnet.php.
[5] A. Andronache, M. R. Brust, and S. Rothkugel. Multimedia content distribution in hybrid wireless networks using weighted clustering. In 2nd ACM Workshop on Wireless Multimedia Networking and Performance Modeling,
WMuNeP 2006, Torremolinos, Malaga, Spain, October
2006, 2006.
[6] J. Antoniou, V. Vassiliou, A. Pitsillides, G. Hadjipollas, and
N. Jacovides. A discrete event based simulation environment
for enhanced umts 3rd generation networks. In SAC 04:
Proceedings of the 2004 ACM symposium on Applied computing, pages 369370, New York, NY, USA, 2004. ACM
Press.
[7] R. Bagrodia, R. Meyer, M. Takai, Y. Chen, X. Zeng, J. Martin, B. Park, and H. Song. Parsec: A parallel simulation environment for complex systems. IEEE Computer, 31(10):77
85, 1998.
[8] L. Bajaj, M. Takai, R. Ahuja, R. Bagrodia, and M. Gerla.
Glomosim: A scalable network simulation environment.
Technical Report 990027, 13, 1999.
[9] J. Broch, D. Maltz, D. Johnson, Y.-C. Hu, and J. Jetcheva.
A performance comparison of multi-hop wireless ad hoc
network routing protocols. In Proceedings of the 4th
ACM/IEEE International Conference on Mobile Computing
and Networking (MOBICOM) 98, pages 8597, Dallas, TX,
USA, 1998.
[10] T. Camp, J. Boleng, and V. Davies. A survey of mobility
models for ad hoc network research. Wireless Communications and Mobile Computing, 2(5):483502, sep 2002.
[11] D. Cavin, Y. Sasson, and A. Schiper. On the accuracy of
manet simulators. In POMC 02: Proceedings of the second ACM international workshop on Principles of mobile
computing, pages 3843, New York, NY, USA, 2002. ACM
Press.
[12] J. Cowie, A. Ogielski, and D. Nicol.
Modeling the global internet.
Computing in Science
and Engineering, 1:4250, January/February 1999.
http://www.ssfnet.org/homePage.html.
[13] D. Estrin, M. Handley, J. Heidemann, S. McCanne, Y. Xu,
and H. Yu. Network visualization with nam, the vint network
animator. IEEE Computer, 33(11):6368, Nov. 2000.
[14] K. Fall and K. Varadhan.
The ns Manual. The
VINT Project A collaboration between researchers
at UC Berkeley, LBL, USC/ISI, and Xerox PARC.
http://www.isi.edu/nsnam/, 1989-2006.
[15] T. I. for Wireless and M. Communications.
Eurane enhanced umts radio access network for ns/2.
http://www.ti-wmc.nl/eurane/.
[16] H. Frey. Scalable geographic routing algorithms for wireless ad-hoc networks. IEEE Network: Special issue on Ad
Hoc Networking: Data Communications & Topology Control, July 2004.
[17] H. Frey and D. Grgen. Planar graph routing on geographical clusters. Ad Hoc Networks, Special issue on Data
Communication and Topology Control in Ad Hoc Networks,
3(5):560574, Sept. 2005.
[18] H. Frey, D. Grgen, J. K. Lehnert, and P. Sturm. Auctions in
mobile multihop ad-hoc networks following the marketplace
communication pattern. In 6th International Conference on
Enterprise Information Systems ICEIS04, Porto, Portugal,
2004.
[19] D. Grgen, H. Frey, and C. Hutter. Information dissemination based on the en-passant communication pattern.
In Fachtagung Kommunikation in Verteilten Systemen
(KiVS), Kaiserslautern, Germany, 2005.
[20] D. Grgen, M. Transier, P. Sturm, and W. Effelsberg. Distributed script prototyping a mobile application for multihop ad-hoc networks. Technical Report TR-06-02, Universitt Trier, Trier, Germany, Mar. 2006.
[21] H. Hellbrck and S. Fischer. Basic analysis and simulation
of ad-hoc networks. Technical report, 2001.
[22] C. Hiedels, C. Hoff, S. Rothkugel, and U. Wehling.
Ubisettlers-a dynamically adapting mobile p2p multiplayer
game for hybrid networks. Submitted to 4th IEEE International Workshop on Mobile Peer-to-Peer Computing
(MP2P07), White Plains, NY, USA, March, 2007.
[23] D. B. Johnson, J. Broch, Y.-C. Hu, J. Jetcheva, and D. A.
Maltz. The cmu monarch projects wireless and mobility
extensions to ns. In E. Tang (Publisher): Proceedings of
the forty-second internet engineering task force, Chicago,
IL, USA, 1998.
[24] D. B. Johnson and D. A. Maltz. Dynamic source routing in
ad hoc wireless networks. In Imielinski and Korth, editors,
Mobile Computing, volume 353. Kluwer Academic Publishers, 1996.
[25] J. K. Lehnert, D. Grgen, H. Frey, and P. Sturm. A Scalable
Workbench for Implementing and Evaluating Distributed
Applications in Mobile Ad Hoc Networks. In Western Simulation MultiConference WMC04, San Diego, California,
USA, 2004.
[26] J. Liu and D. M. Nicol.
Dartmouth scalable simulation framework (dassf),
version 3.1. users
manual.
http://www.crhc.uiuc.edu/
~jasonliu/projects/ssf/.
[27] G. F. Riley. The Georgia Tech Network Simulator. In Proceedings of the workshop on Models, methods and tools for
reproducible network research MoMeTools03, pages 512,
2003.
[28] M. Segal and K. Akeley.
The OpenGL graphics
system:
A
specification
(version
2.0).
http://www.opengl.org/documentation
/specs/version2.0/glspec20.pdf, 2004.
[29] M. Transier, H. Fssler, J. Widmer, M. Mauve, and W. Effelsberg. A Hierarchical Approach to Position-Based Multicast for Mobile Ad-hoc Networks. Wireless Networks - The
Journal of Mobile Communication, Computation and Information, 2006.
[30] K. Walsh and E. G. Sirer. Staged simulation: A general technique for improving simulation scale and performance. volume 14, pages 170195, New York, NY, USA, 2004. ACM
Press.