Escolar Documentos
Profissional Documentos
Cultura Documentos
Rhia Trogo-Oblena
Faculty Adviser
College of Computer Studies
De La Salle University
Manila, Philippines
rhia.trogo@delasalle.ph
Abstract—This paper presents an Application Programming the World Wide Web and do as much as computers at home
Interface (API) architecture for peer-to-peer file transfer over a can do – stream videos, download files, and surf the net – in
mobile ad hoc network written in Java. The underlying any place and time with a Wi-Fi enabled area. Adapting to the
technologies behind the API are: (1) Wi-Fi to establish the internet phenomenon Wi-Fi, mobile phones have been
network and transfer files, and (2) a routing protocol that uses
expanded to accommodate easily the functions and services of
Ad hoc On-demand Vector (AODV) protocol as a base, married
with concepts from the Delay Tolerant Network (DTN) the Wi-Fi. Advantages of this can be the faster speed, more
architecture and Conditional Max-Min Battery Capacity Routing range, and the ability to implement multi hop approach. With
(CMMBCR) protocol [1]. This API is designed to handle one file the fast pace of growing hot spots and technology made-easy
transfer at a time between Wi-Fi enabled mobile devices. access to Wi-Fi, the need for features incorporating this
technology increases. A particular area of interest is the ability
Ad hoc Networking, Peer-to-Peer (P2P) File Transfer, Wi-Fi, of file transferring between mobile devices via an ad hoc
Multi-hop Networks, Application Programming Interface (API) network set up through Wi-Fi. The lack of a direct route
I. INTRODUCTION between two mobile devices creates a need to employ a multi-
hop approach.
Over the past few years, mobile devices such as laptops and
mobile phones have a steady-growing number of users. These The objective of this research is to abstract the basic file
gadgets possess greater potential of improvement than before. sharing functions amongst mobile devices employing a multi-
Laptops now have the capacity that only desktops could have hop approach through Wi-Fi in the form of an application
before. Mobile phones today include a wide variety of features programming interface (API). This API is designed to handle
and functionalities apart from the usual calling and messaging. one-file transfer at a time between Wi-Fi enabled mobile
The need for mobility is evident. Even the internet that just devices within a multi-hop ad hoc network. It is assumed that
started a few decades ago is now on the palm of each one’s both parties – the sender and receiver – are familiar with each
hand with the use of Wi-Fi. Before the Wi-Fi, mobile phones other in any circumstance.
make use of file transfer protocols such as the Bluetooth and
the Infrared but both have different concerns and limitations.
Through Wi-Fi, mobile phones and laptops may now access
II. THEORETICAL FRAMEWORK messages, they first verify its integrity. These storage devices
are called persistent storage.
A. Wi-Fi
Wi-Fi is the popular name for the wireless Ethernet According to [4], DTN routers need persistent storage for one
802.11b standard for wireless local area networks. The current or more of the following reasons:
generation of WLANs support up to eleven (11) Mbps data 1. A communication link to the next hop may not be
rates within 100m of the base station [2]. Wi-Fi enabled available for a long time.
devices include personal computers (PC), laptops, mobile 2. One node in a communicating pair may send or receive
phones, game consoles, MP3 players, and personal digital data much faster of more reliably than the other node
assistants (PDA). Anyone can avail of Wi-Fi services provided 3. A message, once transmitted, may need to be
that they are within a Wi-Fi hotspot—an area that provides retransmitted if an error occurs at an upstream (toward the
Internet access via a Wi-Fi network. Wi-Fi can be free of destination) node or link, or if an upstream node declines
charge or not depending on the network security. Secure or acceptance of a forwarded message.
password-enabled networks require a user to subscribe to the
network before it can be accessed. E. Ad hoc On-Demand Vector (AODV) Routing Protocol
AODV is an on-demand routing protocol specifically made
B. Mobile Ad hoc Networks (MANETs) for mobile ad hoc networks by C. Perkins, E. Belding-Royer
The term “ad hoc” literally means “for this” or “done for a and S. Das in the Nokia Research Center [5]. Using AODV,
particular purpose.” An ad hoc network is, therefore, a nodes can send messages to other remote nodes by making use
network created for a particular purpose. For instance, a set of of neighboring nodes as passageways. Within the network, the
students that have laptops capable of Wi-Fi transmission may algorithm attempts to determine the shortest possible loop-free
create an ad hoc network among themselves for easy file route down on nodes in which messages could pass.
transfer. They are temporal, created only if a need arises.
Due to limited range of communication, nodes can only
A mobile ad hoc network (MANET) is a pool of mobile communicate with nodes within their range called neighbor
hosts forming an ad hoc network. Because its nodes are nodes [6]. HELLO messages are used to perceive and check
mobile, MANETs rely on wireless connectivity such as Wi-Fi connection to neighbors. A node periodically broadcasts a
and Bluetooth. It is self-configuring, easy to deploy, and HELLO message that all its neighbors accept. A link break is
decreases dependence on an infrastructure. In this type of detected whenever a node fails to receive several HELLO
network, the nodes act as both hosts and routers, able to accept messages [7].
and transmit packets throughout the network. When a node is
within the range of another node, these nodes will be able to When a source node needs to communicate with an
connect to each other. The quality of connection will depend unknown destination, it transmits a RREQ or a Route Request
the distance between nodes. message to all of its neighbors [6]. An RREQ packet contains
the source and destination address, lifespan of the message,
and sequence ID. If a node that obtains a RREQ message has a
C. Delay Tolerant Networks (DTNs) current route to the destination node or is the destination, it
Delay tolerant networking was originally designed for easy unicasts a RREP or a Route Reply message back to the source
interplanetary networking—an interplanetary Internet. node. After receiving the RREP, the source then records the
According to [3], it is “a communication system envisioned to route to its routing table and starts communicating with the
provide Internet-like services across interplanetary distances destination using the newly found path. On the other hand, if
in support of deep space exploration.” Interplanetary the node that obtains a RREQ message is not the destination or
networking is an example of a challenged network—the type of has no current path to the destination, the node rebroadcasts
network DTNs are designed for (e.g. DTNs should be able to the RREQ to its own neighbors. In case a link break is
operate given extreme distances like connecting routers on detected or a node stops functioning, a RRER or a Route Error
Earth and Mars, or hold packets until the next hop is available). message is sent to the nodes. Nodes that receive RRER check
Delay tolerant networks may be comprised of multiple routers their routing tables and erase routes that contain the
as well as multiple networks. unreachable nodes [6].
D. Store-and-Forwarding F. JNetDev
The store-and-forward approach dictates that when packets JNetDev is an open source library in Java that enables
are passed to a node, that node must first store copies whole developers in handling low level packet manipulations. It
messages or fragments of these messages within themselves supports the user in developing objects significant to
before passing on the data to another node. This way, messages programming networks which comprises NIC’s (Network
are stored indefinitely within the nodes in the route so that in Interface Cards), IPv4 Addresses, Ethernet Addresses, packet
case of node failure, there will still be a way to recover the captures and injections and header formats. Essential classes in
message to be sent. Furthermore, before nodes forward the the package include jND_NIC Class, which injects packets into
the network and forms a NIC that has its system name, FIGURE I. AD HOC P2P API LEVELS
description, IP Address, MAC Address, gateway and netmask,
jND_IPv4Address and jND_EthernetAddress, whose job is to
wrap and construct addresses from strings, byte arrays and
integers, jND_CaptureSession, which is used to capture
incoming packets and stores them in a packet queue. jNetDev
will be one of the alternatives to UDP socket programming and
would be next to ideal in implementing networking functions
required in the application, especially in the employment of
AODV Protocol algorithm and file transferring [8].
G. JAdHoc
JAdHoc is a implementation of the AODV Protocol in Java.
It complies with RFC3561, and supports both IPv4 and IPv6.
It is employed using Java libraries for networking, graphical
user interfaces, multi-threading, and operating system function
calls. It also makes use of Jpcap, a Java-based class library for
capturing network packets. It has been tested on Linux,
Windows (XP and 2K), and Sharp Zaurus [9].
The Application Level contains modules that are very
particular to a certain application. These modules may be not
JAdhoc’s application architecture consists of a class library
that provides the AODV operations. This component usable to other developers. This level is reliant on the
cooperates with the Java class library, Jpcap class library and implementation of the application developer. It includes the
the user defined route manipulation class. On the other hand, user interface of the application and method calls to the Ad
JAdHoc’s class architecture assumes a hybrid design pattern hoc P2P API.
architecture, which includes the Gang of Four Design Patterns
and J2EE Pattern Catalog. In a nutshell, there are objects which The Service Level offers peer-to-peer services that are used
are related to handling the tasks of the AODV Protocol Handler by most applications. This includes peer discovery, file
and Informational Objects which are objects that relate to sending and receiving, files handling and representation and
holding information. It also uses objects in the Java Collections instant messaging for use by numerous applications and
class library to handle packet queues, route lists and precursor devices. It is here that a common data representation, in the
lists. form of string and raw bytes, is used to help in the sharing and
retrieval of information. It is also in this level that forwarding
of files is included to increase the availability of information.
III. DESIGN AND IMPLEMENTATION OF AD HOC P2P API Lastly, this level has basic monitoring capabilities
implemented through the File Log and Network Log classes.
A. Architectural Overview The File and Network Log classes log messages and the files
Ad hoc P2P API was designed to follow a simple structure that were sent and received by a peer.
based on the general peer-to-peer Architecture coupled with
JAdhoc, which in turn were based on the leveled approach The final level is the Networking Level. This layer is, to
used by more common protocols such as UDP. Applications some extent, handled by JAdhoc, and was based on the basic
built under Ad hoc P2P API have three (3) levels, namely: (1) peer-to-peer architecture. This is the backbone of the Service
the Application, (2) Services, and (3) Networking Levels. The Level, as its methods depend on the Networking Level to carry
API holds the latter into two (2) layers, leaving the out certain tasks. It is here that actual connections are created
Application layer to be created by the user. between peers, allowing the exchange of data. The
Networking Level provides two types of connectivity, by
using the Standard Classes in the Ad hoc P2P API which
offers simple peer discovery and interaction and by JAdhoc
which offers the AODV routing implementation in Java.
Note however, that some parts of the application may not
be used by certain Mobile Devices due to the limitations to
their physical capabilities and different platforms.
B. Ad hoc P2P API Components Below is a pseudo-code of how CMMBCR with AODV
This section discusses the API components used by the and Store-and-Forwarding works:
Application Level, the Service Level and the Networking
Level. Step 1: Prompt to send data from the source to the
destination;
FIGURE II. AD HOC P2P API COMPONENTS Step 2: AODV protocol generates RREQ’s to find the
destination; /* this generates multiple routes to the
destination */
Step 3A: When RREQ reaches a node with a route to the
destination node
Node performs CMMBCR
/* CMMBCR checks: */
if (The battery power of all nodes within the route/s
created) > threshold)
{/*Pl = summation of the total battery consumed
while routing of all nodes of a particular route
Select the route with the smallest Pl*/
The Application Level will contain modules that handle selected_route = where A is a set containing
all possible routes;}
the user interface methods. This level calls the methods used
else
in the Service Level and Networking Level components, this
Step 3B: {/* Select the route with the maximum collective
pertains to the function calls in the lower two levels. The
battery capacity */
Application level also handles the output and appearance of
data and processes used in the certain application. selected_route = where A is a set
containing all possible routes;}
The Service Level concerns itself with the peer discovery Step 4: AODV protocol generates RREP’s following the
and interaction process, establishing routes and maintaining a route chosen by CMMBCR;
connection with them. In this level, the store and forward Step 5A: if(RREP reaches destination)
messaging of DTNs (Delay Tolerant Networks) is also Step 5A1:{/* Store-and-Forward approach */
implemented through file replication and forwarding. Note while(next_hop is not the destination AND next_hop
that the algorithms mentioned will be incorporated for mobile is not missing)
devices. { send DataPackets to next_hop;
current_node = next_hop;
The Networking Level Components execute the basic current_node keeps a copy of DataPackets
operations used by the Service Level and Application Level to until time t;}
send and receive files to and from peers. Step 5A2:
if(next_hop is not the destination AND next_hop is
C. Algorithm missing)
{repeat Step 2 with current_node treated as
The proponents used the Conditional Max-Min Battery
the source node;}
Capacity Routing (CMMBCR) Protocol and plugged it into
else if(next_hop is destination)
AODV to address the issue of battery efficiency. This
{send DataPackets to destination;
algorithm uses the load distribution approach. The goal of this
current_node = destination;
approach is to “balance the energy usage of all mobile nodes
/* destination received the file */}
by selecting a route with underutilized nodes rather than the
Step 5B: else
shortest route,” [7]. The study of [7] further states that this
AODV protocol generates RERR;
approach does not necessarily provide the lowest energy route;
rather, it ensures a longer network lifetime because the nodes
will not be constantly bombarded by routing messages that
deplete battery life.
D. Use Case Diagram
Following are the main features of JNA:
This section provides an overview of how the API will be
1. Automatic Mapping with simple mappings for all
used by the developer in implementing peer-to-peer
primitive data types from Java to native functions
applications such as the File Sharing applications. End users
2. Runs on any platform that support Java
will only be able to access the application level functions, but
3. Automatic conversion between C and Java strings with
these functions will depend on functions developed using the
customizable encoding/decoding
API by the application developer. The API will also provide
4. Customizable mapping from Java method to native
the backbone for creating the peer-to-peer network along with
function name, and customizable invocation to simulate C
the basic information sharing functions.
preprocessor function macros
FIGURE III. AD HOC P2P API USE CASE DIAGRAM 5. Support for automatic Windows ASCII/UNICODE
function mappings
D. Standard P2P Classes After fixing and implementing all the issues, the proponents
successfully transferred files over the network. The size of the
Certain port numbers were used by different applications or file didn’t matter since the application pieced the file into
some operating system processes on a machine. Since the
smaller parts which was then sent over the network.
developers tested the API in different laptop devices in which
also have different sets of applications, some of the port
numbers were already in use. The Multicast Sender or V. PERFORMANCE
Receiver fails to execute that result into malfunctioning of the
peer discovery system where some peers are visible and some A. Test Cases
are not. The proponents have decided into port numbers that This section discusses the results of the simulations of the
are less likely to be used in order to solve the issue. thesis. To recap, there are three (3) parameters for testing:
1. Number of Nodes: The number of nodes in a network.
2. Mortality Rate: The rate in which nodes are removed
E. Ad hoc P2P Classes from the network due to individual circumstances. Nodes
Determining the exact network card range of a mobile may be exhausted of energy, turned off, or move out of
device is problematical. The developers used black box testing the network. This leads to the possibility of network
to check and approximate the range of the mobile devices partitions.
installed with the API. They placed the devices in different 3. Size of the Data: The size of the file being sent from
locations with precisely the same distance between them. To source to destination.
solve this, the distance between the devices is set to a standard
2-3 meters so that to ensure the flow of network packets. Each of these factors measure how many successful file
transfers there were per test.
Another issue is about the network traffic and signals.
Even though running actively, there are periods when the
mobile devices do not receive routing packets making some
nodes invisible thus, making the internal routing table
B. Results C. Additional Observations
This section discusses the results of the simulations of the When nodes are static, the mortality rate dramatically
thesis. To recap, there are three (3) parameters for testing: affects the network stability in a negative way. As nodes die,
possible routes also disappear with them. However, the file
size is not a problem at all. It doesn’t matter how big the data
to be sent is, since the nodes are not moving, the route from
source to destination does not get destroyed unless if a node in
the given route dies.