It is my privilege to undertake the project “Benefit-based Data Caching in
Ad Hoc Network”. in Bits & Bytes technologies (India).
I am thankful to our principal Dr.Venkateshwarlu garu principal SR
Engineering college, for encouraging doing this project.
I am deeply indebted to Mr.R.Vijayaprakash garu Head of the Department,
whose motivation in the field of software development was they made me overcome all
the hardships during the course of study.
I am heartily thankful to our internal guide Mr.R.Vijayaprakash garu for his
moral support who was always there to comforting and solacing me at the times of
frustration. Our philosophical debates, exchanges of knowledge, skills and venting of
infrastructure and his insightful comments during our project work program helped me to
enrich our experience.
Although a leaflet title “Acknowledgement” can’t represents my true feelings for
all these persons. I feel very much thankful to all them and also to our PARENTS and
FRIENDS for encouragements and giving me all the moral support required and to all
the people who helped me in making this endeavor a reality.
Benefit-Based Data Caching in Ad Hoc Networks 1
CHAPTER 1: 2
S/W DEVELOPMENT METHODOLOGY
CHAPTER 2: 14
PURPOSE OF PROJECT
SCOPE OF PROJECT
CHAPTER 3: 18
CHAPTER 4: 26
DATA FLOW DIAGRAM
STATE CHART DIAGRAM
Benefit-Based Data Caching in Ad Hoc Networks 2
CHAPTER 5: 50
CHAPTER 6: 63
CHAPTER 7: 72
CHAPTER 8: 81
CHAPTER 9: 83
Benefit-Based Data Caching in Ad Hoc Networks 3
Benefit-Based Data Caching in Ad Hoc Networks 4
Abstract—Data caching can significantly improve the efficiency of information
access in a wireless ad hoc network by reducing the access latency and bandwidth usage.
We ever, designing efficient distributed caching algorithms is on trivial when network
nodes have limited memory. In this article, we consider the cache placement problem of
minimizing total data access cost in ad hoc networks with multiple data items and nodes
with limited memory paucity. The above optimization problem is known to be NP-hard.
Defining benefit as the reduction in total access cost, we present a polynomial-
time centralized approximation algorithm that provably delivers a solution whose benefit
is at least 1/4 (1/2 for uniform-size data items) of the optimal benefit. The approximation
algorithm is amenable to localized distributed implementation, which is shown via
simulations to perform close to the approximation algorithm. Our distributed algorithm
naturally extends to networks with mobile nodes. We simulate our distributed algorithm
using a network simulator (ns2) and demonstrate that it significantly outperforms another
existing caching technique (by Yin and Cao ) in all important performance metrics.
The performance differential is particularly large in more challenging scenarios such as
higher access frequency and smaller bandwidth.
Benefit-Based Data Caching in Ad Hoc Networks 5
Benefit-Based Data Caching in Ad Hoc Networks 6
After analyzing the requirements of the task to be performed, the next step is to
analyze the problem and understand its context. The first activity in the phase is studying
the existing system and other is to understand the requirements and domain of the new
system. Both the activities are equally important, but the first activity serves as a basis of
giving the functional specifications and then successful design of the proposed system.
Understanding the properties and requirements of a new system is more difficult and
requires creative thinking and understanding of existing running system is also difficult,
improper understanding of present system can lead diversion from solution.
This document play a vital role in the development of life cycle (SDLC) as it describes
the complete requirement of the system. It means for use by developers and will be the
basic during testing phase. Any changes made to the requirements in the future will have
to go through formal change approval process.
It was defined by Barry Boehm in his 1988 article, “A spiral Model of Software
Development and Enhancement. This model was not the first model to discuss iterative
development, but it was the first model to explain why the iteration models.
As originally envisioned, the iterations were typically 6 months to 2 years long. Each
phase starts with a design goal and ends with a client reviewing the progress thus far.
Benefit-Based Data Caching in Ad Hoc Networks 7
Analysis and engineering efforts are applied at each phase of the project, with an eye
toward the end goal of the project.
The steps for Spiral Model can be generalized as follows:
The new system requirements are defined in as much details as possible. This
usually involves interviewing a number of users representing all the external
or internal users and other aspects of the existing system.
A preliminary design is created for the new system.
A first prototype of the new system is constructed from the preliminary
design. This is usually a scaled-down system, and represents an
approximation of the characteristics of the final product.
A second prototype is evolved by a fourfold procedure:
1. Evaluating the first prototype in terms of its strengths, weakness, and
2. Defining the requirements of the second prototype.
3. Planning a designing the second prototype.
4. Constructing and testing the second prototype.
At the customer option, the entire project can be aborted if the risk is deemed
too great. Risk factors might involve development cost overruns, operating-
cost miscalculation, or any other factor that could, in the customer’s judgment,
result in a less-than-satisfactory final product.
The existing prototype is evaluated in the same manner as was the previous
prototype, and if necessary, another prototype is developed from it according
to the fourfold procedure outlined above.
Benefit-Based Data Caching in Ad Hoc Networks 8
The preceding steps are iterated until the customer is satisfied that the refined
prototype represents the final product desired.
The final system is constructed, based on the refined prototype.
The final system is thoroughly evaluated and tested
Benefit-Based Data Caching in Ad Hoc Networks 9
The following diagram shows how a spiral model acts like:
Fig 2.1 Spiral Model
Benefit-Based Data Caching in Ad Hoc Networks 10
STUDY OF THE SYSTEM:
In the flexibility of the uses the interface has been developed a graphics concept
in mind, associated through a browser interface. The GUI’S at the top level have been
Administrative user interface
1.The operational or generic user interface
The administrative user interface concentrates on the consistent information that is
practically, part of the organizational activities and which needs proper authentication for
the data collection. The interfaces help the administrations with all the transactional states
like Data insertion, Data deletion and Data updating along with the extensive data search
The operational or generic user interface helps the users upon the system in
transactions through the existing data and required services. The operational user
interface also helps the ordinary users in managing their own information helps the
ordinary users in managing their own information in a customized manner as per the
Benefit-Based Data Caching in Ad Hoc Networks 11
Benefit-Based Data Caching in Ad Hoc Networks 12
AD hoc networks are multi hop wireless networks of small computing devices
with wireless interfaces. The computing devices could be conventional computers (for
example, PDA, laptop, or PC) or backbone routing platforms or even embedded
processors such as sensor nodes. The problem of optimal placement of caches to reduce
overall cost of accessing data is motivated by the following two defining characteristics
of ad hoc networks. First, the ad hoc networks are multi hop networks without a central
base station. Thus, remote access of information typically occurs via multi hop routing,
which can greatly benefit from caching to reduce access latency. Second, the network in
generally resource constrained in terms of channel bandwidth or battery power in the
nodes. Caching helps in reducing communication. This results in savings in bandwidth\
as well as battery energy. The problem of cache placement is particularly challenging
when each network node has a limited memory to cache data items.
In this paper, our focus is on developing efficient caching techniques in ad hoc
networks with memory limitations. Research into data storage, access, and dissemination
techniques in ad hoc networks is not new. In particular, these mechanisms have been
investigated in connection with sensor networking , , peer-to-peer networks
[1, mesh networks , world wide web , and even more general ad hoc
networks , . However, the presented approaches have so far been somewhat “ad
hoc” and empirically based, without any strong analytical foundation. In contrast, the
theory literature abounds in analytical studies into the optimality properties of caching
and replica allocation problems (see, for example, ). However, distributed
implementations of these techniques and their performances in complex network settings
have not been investigated. It is even unclear whether these techniques are amenable to
efficient distributed implementations. Our goal in this paper is to develop an approach
that is both analytically tractable with a provable performance bound in a centralized
setting and is also amenable to a natural distributed implementation.
Benefit-Based Data Caching in Ad Hoc Networks 13
In our network model, there are multiple data items; each data item has a server, and a
set of clients that wish to access the data item at a given frequency. Each node carefully
chooses data items to cache in its limited memory to minimize the overall access cost.
Essentially, in this article, we develop efficient strategies to select data items to cache at
each node. In particular, we develop two algorithms—a centralized approximation
algorithm, which delivers a 4-approximation (2-approximation for uniform size data
items) solution, and a localized distributed algorithm, which is based on the
approximation algorithm and can handle mobility of nodes and dynamic traffic
conditions. Using simulations, we show that the distributed algorithm performs very
close to the approximation algorithm. Finally, we show through extensive experiments on
ns2  that our proposed distributed algorithm performs much better than a prior
approach over a broad range of parameter values. Ours is the first work to present a
distributed based on an approximation algorithm for the general problem of cache
placement of multiple data items under memory constraint.
Benefit-Based Data Caching in Ad Hoc Networks 14
Each node cache the items most frequently accessed by itself.
Eliminate replications among neighboring nodes
Creation of stable groups to gather neighborhood inform and determine caching
Each node act as a server
Server maintains nearest cache node and
Server nearest cache node by using routing protocol
First save data item on local space
IF any other items are exist that will be replace.
Benefit-Based Data Caching in Ad Hoc Networks 15
Benefit-Based Data Caching in Ad Hoc Networks 16
Cache Placement Problem:
In this section, we formally define the cache placement problem addressed in
our article, and discuss related work. A multi-hop ad hoc network can be represented as
an undirected graph G (V; E) where the set of vertices V represents the nodes in the
network, and E is the set of weighted edges in the graph. Two network nodes that can
communicate directly with each other are connected by an edge in the graph. The edge
weight may represent a link metric such as loss rate, delay, or transmission power. For
the cache placement problem addressed in this article, there are multiple data items and
each data item is served by its server (a network node may act as a server for more than
one data items). Each network node has limited memory and can cache multiple data
items subject to its memory capacity limitation. The objective of our cache placement
problem is to minimize the overall access cost.
Cache Placement Algorithms:
In this section, we first present our centralized approximation algorithm. Then,
we design its localized distributed implementation that performs very close to the
approximation algorithm in our simulations.
Benefit-Based Data Caching in Ad Hoc Networks 17
A. Centralized Greedy Algorithm (CGA):
The designed centralized algorithm is essentially a greedy approach, and we
refer to it as CGA (Centralized Greedy Algorithm). CGA starts with all network nodes
having all empty memory pages, and then, iteratively caches data items into memory
pages maximizing the benefit in a greedy manner at each step. Thus, at each step, the
algorithm picks a data item Dj to cache into an empty memory page r of a network node
such that the benefit of caching Dj at r is the maximum among all possible choices of Dj
and r at that step. The algorithm terminates when all memory pages have been cached
with data items. For formal analysis of CGA, we first define a set of variables Aijk, where
selection of a variable Aijk indicates that the kth memory page of node i has been selected
for storage of data item Dj and reformulate the cache placement problem in terms of
selection of Aijk variables. Recall that for simplicity have assumed that each data item is
of unit size, and occupies one memory page of a node.
Benefit-Based Data Caching in Ad Hoc Networks 18
B. Distributed Greedy Algorithm (DGA):
In this subsection, we describe a localized distributed implementation of CGA. We
refer to the designed distributed implementation as DGA (Distributed Greedy
Algorithm). The advantage of DGA is that it adapts to dynamic traffic conditions, and
can be easily implemented in an operational (possibly, mobile) network with low
communication overheads. While we cannot prove any bound on the quality of the
solution produced by DGA, we show through extensive simulations that the performance
(in terms of the quality of the solution delivered) of the DGA is very close to that of the
CGA. The DGA is formed of two important components – nearest-cache tables and
localized caching policy – as described below.
For each network node, we maintain the nearest node (including itself) that has a
copy of the data item Dj for each data item Dj in the network. More specifically, each
node i in the network maintains a nearest-cache table, where an entry in the nearest-
cache table is of the form (Dj; Nj) where Nj is the closest node that has a copy of Dj .
Note that if i is the server of Dj or has cached Dj, then Nj is i. In addition, if a node i has
cached Dj, then it also maintains an entry (Dj; N2 j), where N2 j is the second-nearest
cache, i.e., the closest node (other than i itself) that has a copy of Dj . The second-nearest
cache information is helpful when node i decide to remove the cached item Dj. Note that
if I is the server of Dj, then Nj is i. The above information is in addition to any
information (such as routing tables) maintained by the underlying routing protocol. The
nearest-cache tables at network nodes in the network are maintained as follows in
response to cache placement changes.
Benefit-Based Data Caching in Ad Hoc Networks 19
Addition of a Cache:
When a node i caches a data item Dj, it broadcasts an AddCache message to all of
its neighbors. The AddCache message contains the tuple (i; Dj) signifying the ID of the
originating node and the ID of the newly cached data item. Consider a node l that
receives the AddCache message (i; Dj). Let (Dj; Nj) be the nearest-cache table entry at
node l signifying that Nj is the cache node currently closest to l that has the data item Dj.
If dli < dlj,5 then the nearest-cache table entry (Dj; Nj) is updated to (Dj ; i), and the
AddCache message is forwarded by l to all of its neighbors. Otherwise, the node l sends
the AddCache message to the single node Nj (which could be itself) so that Nj can
possibly update information about its second-nearest cache.
The above process maintains correctness of nearest-cache entries in a static
network with bounded communication delays because of the following fact. Any node
whose nearest-cache table entry needs to change in response to addition of a cache at
node i is guaranteed to have a path P to i such that every intermediate node on P will
need to change its nearest-cache table entry (and hence, forward the AddCache message).
In addition, the second-nearest cache entries are also correctly maintained because of the
following observation. If node i1 has cached the data item Dj and the second-nearest
cache to i1 is i2, then there exist two neighboring nodes i3 and i4 (not necessarily
different from i1 or i2) on the shortest path from i1 to i2 such that the nearest-cache node
of i3 is i1 and of i4 is i2.
Benefit-Based Data Caching in Ad Hoc Networks 20
Deletion of a Cache:
To efficiently maintain the nearest-cache tables in response to deletion of a
cache, we maintain a cache list Cj for each data item Dj at its server Sj. The cache list Cj
contains the set of nodes (including Sj) that have cached Dj. To keep the cache list Cj up
to date, the server Sj is informed whenever the data time Dj is cached at or removed from
a node. Note that the cache list Cj is almost essential for the server Sj to efficiently update
Dj at the cache nodes. Now, when a node i removes a data item Dj from its local cache, it
first requests Cj from the server Sj. Then, the node i broadcasts a DeleteCache message
with the information (i; Dj ;Cj) to all of its neighbors.
Consider a node l that receives the DeleteCache message and let (Dj ;Nj) be its
nearest-cache table entry. If Nj = i, then the node l updates its nearest-cache entry using
Cj and forwards the DeleteCache message to all its neighbors. Otherwise, the node l
sends the DeleteCache message to the node Nj based on the argument similar to the case
of AddCache. An alternate strategy that does not require cache lists is to assume that Cj =
fSjg; however, such a strategy will definitely lead to more access cost
Benefit-Based Data Caching in Ad Hoc Networks 21
Benefit-Based Data Caching in Ad Hoc Networks 22
DATA FLOW DIAGRAMS
Benefit-Based Data Caching in Ad Hoc Networks 23
Data Flow Diagrams (DFD);
The data flow diagram (DFD) is one of the most important modeling tools. It is
used to model the system components. These components are the system process, the
data used by the process, an external entity that interacts with the system and the
information flows in the system.
DFD shows how the information moves through the system and how it is
modified by a series of transformations. It is a graphical technique that depicts
information flow and the transformations that are applied as data moves from input to
DFD is also known as bubble chart. A DFD may be used to represent a system at
any level of abstraction. DFD maybe partitioned into levels that represent increasing
information flow and functional detail.
A level 0 DFD, also called as the context level diagram, represents the entire
system as a single module with input and output data indicated by incoming outgoing
arrows respectively. Additional process and information flow paths are represented as the
level 0 DFD is portioned to reveal more details. The context level diagram for the
proposed system is shown in the fig.
A level 1 DFD, also called as top-level DFD, represent the system with major
modules and data stores. The other levels will show each module in the top-level DFD in
more detailed fashion. The top-level and other level DFD s for the proposed systems are
shown next. To context data flow diagram four basic symbols are used. They are given
Benefit-Based Data Caching in Ad Hoc Networks 24
Source or destination of data:
External sources or destinations, which may be people or organizations or other entities.
Here the data referenced by a process is stored and retrieved.
People, procedures or devices that produce data. The physical component is not
Benefit-Based Data Caching in Ad Hoc Networks 25
Data Flow: Data specific direction from an origin to a destination. The data flow is a
“packet” of data.
There are several common modeling rules when creating DFDs:
1. All processes must have at least one data flow in and one data flow out.
2. All processes should modify the incoming data, producing new forms of outgoing
3. Each data store must be involved with at least one data flow.
4. Each external entity must be involved with at least one data flow.
5. A data flow must be attached to at
6. moves in a least one process.
Benefit-Based Data Caching in Ad Hoc Networks 26
Context Level or level-0 Data Flow Diagram:
Benefit-Based Data Caching in Ad Hoc Networks 27
Data Flow Diagram : Level 1
Benefit-Based Data Caching in Ad Hoc Networks 28
Data Flow Diagram : Level 2
Benefit-Based Data Caching in Ad Hoc Networks 29
Data Flow Diagram :Level 3
Benefit-Based Data Caching in Ad Hoc Networks 30
Unified Modeling Language (UML):
UML is a method for describing the system architecture in detail using the
blueprint. UML represents a collection of best engineering practices that have proven
successful in the modeling of large and complex systems. The UML is a very important
part of developing objects oriented software and the software development process. The
UML uses mostly graphical notations to express the design of software projects. Using
the UML helps project teams communicate, explore potential designs, and validate the
architectural design of the software
UML is a general-purpose visual modeling language that is used to specify,
visualize, construct, and document the artifacts of the software system.
UML is a language:
It will provide vocabulary and rules for communications and function on
conceptual and physical representation. So it is modeling language.
Specifying means building models that are precise, unambiguous and complete. In
particular, the UML address the specification of all the important analysis, design and
Benefit-Based Data Caching in Ad Hoc Networks 31
implementation decisions that must be made in developing and displaying a software
The UML includes both graphical and textual representation. It makes easy to
visualize the system and for better understanding.
UML models can be directly connected to a variety of programming languages
and it is sufficiently expressive and free from any ambiguity to permit the direct
execution of models.
UML provides variety of documents in addition raw executable codes.
Goal of UML:
The primary goals in the design of the UML were:
Provide users with a ready-to-use, expressive visual modeling language so they
can develop and exchange meaningful models.
Provide extensibility and specialization mechanisms to extend the core concepts.
Be independent of particular programming languages and development processes.
Provide a formal basis for understanding the modeling language.
Encourage the growth of the OO tools market.
Support higher-level development concepts such as collaborations, frameworks,
patterns and components.
Integrate best practices.
Benefit-Based Data Caching in Ad Hoc Networks 32
Uses of UML
The UML is intended primarily for software intensive systems. It has been used
effectively for such domain as
Enterprise Information System
Banking and Financial Services
Rules of UML
The UML has semantic rules for
NAMES: It will call things, relationships and diagrams.
SCOPE: The content that gives specific meaning to a name.
VISIBILITY: How those names can be seen and used by others.
INTEGRITY: How things properly and consistently relate to another.
EXECUTION: What it means is to run or simulate a dynamic model.
Building blocks of UML
Benefit-Based Data Caching in Ad Hoc Networks 33
The vocabulary of the UML encompasses 3 kinds of building blocks
Things are the data abstractions that are first class citizens in a model. Things
are of 4 types
An notational Things
Relationships tie the things together. Relationships in the UML are
Benefit-Based Data Caching in Ad Hoc Networks 34
A diagram is the graphical presentation of a set of elements, most often rendered
as a connected graph of vertices (things) and arcs (relationships).
There are two types of diagrams, they are:
The UML‘s four structural diagrams exist to visualize, specify, construct and
document the static aspects of a system. We can View the static parts of a system using
one of the following diagrams.
Structural diagrams consists of
Benefit-Based Data Caching in Ad Hoc Networks 35
The UML’s five behavioral diagrams are used to visualize, specify, construct, and
document the dynamic aspects of a system. The UML’s behavioral diagrams are roughly
organized around the major ways which can model the dynamics of a system.
Behavioral diagrams consists of
Use case Diagram
State chart Diagram
Benefit-Based Data Caching in Ad Hoc Networks 36
Benefit-Based Data Caching in Ad Hoc Networks 37
Class Diagram: A class diagram is a type of static structure diagram that describes the
structure of a system by showing the system's classes, their attributes, and the
relationships between the classes.
Class: Class is a description of a set of objects that share the same attributes,
operations, relationships and semantics. A class implements one or more
Interface: Interface is a collection of operations that specify a service of a class
or component. An interface describes the externally visible behavior of that
element. An interface might represent the complete behavior of a class or
Collaboration: Collaboration defines an interaction and is a society of roles and
other elements that work together to provide some cooperative behavior. So
collaborations have structural as well as behavioral, dimensions. These
collaborations represent the implementation of patterns that make up a system.
Relationships such as
Dependency: Dependency is a semantic relationship between two things in which
a change to one thing may affect the semantics of the other thing.
Generalization: A generalization is a specialization / generalization relationship
in which objects of the specialized element (child) are substitutable for objects of
the generalized element (parent).
Association: An association is a structural relationship that describes a set of
links, a link being a connection among objects. Aggregation is a special kind of
association, representing a structural relationship between a whole and its parts.
Benefit-Based Data Caching in Ad Hoc Networks 38
Use Case Diagram:
Use case Diagram:
A Use case diagram shows a set of use cases and actors and their relationships. Use
case diagrams address the static Use case view of a system. These diagrams are
especially important in organizing and modeling the behaviors of a system. Use case
diagram consists of Use case, actors, and the relationships between them.
Use case: Use case is a description of set of sequence of actions that a system
performs that yields an observable result of value to a particular actor. A use case
is used to structure the behavioral things in a model. A use case is realized by
Actor: Actor is the user of the system, who performs action on the system and to
whom the system yields an observable result of value.
Benefit-Based Data Caching in Ad Hoc Networks 39
New node Netw ork Parent
: : :
Enter the network
Find the parent
Attach as child node
Reorganize the network
Calculate new address
and routing table
Benefit-Based Data Caching in Ad Hoc Networks 40
The sequence diagram is an interaction diagram that emphasizes the time
ordering of messages for modeling a real time system. Graphically, a sequence diagram is
a table that shows objects arranged along the X axis and messages, ordered in increasing
time, along the Y axis. Sequence Diagram consists of objects, links, lifeline, focus of
control, and messages.
Object: Objects are typically named or anonymous instances of class. But may
also represent instances of other things such as components, collaboration and
Link: A link is a semantic connection among objects i.e., an object of an
association is called as a link.
Lifeline: A lifeline is vertical dashed line that represents the lifetime of an object.
Focus of Control: A Focus of Control is tall, thin rectangle that shows the period
of time during which an object is performing an action.
Messages: A message is a specification of a communication between objects that
conveys the information with the expectation that the activity will ensue.
Benefit-Based Data Caching in Ad Hoc Networks 41
Benefit-Based Data Caching in Ad Hoc Networks 42
An activity diagram shows the flow from activity to activity. The activity diagram
emphasizes the dynamic view of a system. It consists of activity states, action states,
transition, and object.
Activity State: An activity states is a kind of states in activity diagram; it shows
an ongoing non-atomic execution within a state machine. An activity states can be
Action State: An action states are states of the system, each representing the
execution of an action. An action states can’t be further decomposed.
Transition: A transition specifies the path from one action or activity state to the
next action or activity state. The transition is rendered as a simple directed line.
Object: An object is a concrete manifestation of an abstraction; an entity with a
well defined boundary and identity that encapsulates state and behavior; an
instance of a class. Objects may be involved in the flow of control associated with
an activity diagram.
Benefit-Based Data Caching in Ad Hoc Networks 43
State Chart Diagram:
Benefit-Based Data Caching in Ad Hoc Networks 44
State chart Diagram:
A state chart diagram shows a state machine, consisting of states, transitions, events, and
activities. The state chart diagram emphasizes the dynamic view of a system. It consists
of states, transitions, events, and actions.
State: A state is a condition or situation in the life of an object during which it
satisfies some condition, performs some activity, or waits for some event.
Transition: A transition is a relationship between two states indicating that an
object in the first state will perform certain actions and enter the second state
when a specified event occurs and specified conditions are satisfied.
Event: An event is the specification of a significant occurrence that has a location
in time and space.
Action: An action an executable atomic computation that results in a change in
state of the model or the return of a value.
Benefit-Based Data Caching in Ad Hoc Networks 45
Benefit-Based Data Caching in Ad Hoc Networks 46
Front End : Java, Swing
Back End : MS Access
Tools Used : JFrame Builder
Operating System: windows XP
Processor: Pentium IV
RAM : 512MB
Hard Disk: 20GB
Benefit-Based Data Caching in Ad Hoc Networks 47
ABOUT THE SOFTWARE
Java was designed to meet all the real world requirements with its key features,
which are explained in the following paragraph.
SIMPLE AND POWERFUL
Java was designed to be easy for the professional programmer to learn and use
efficiently. Java makes itself simple by not having surprising features. Since it exposes
the inner working of a machine, the programmer can perform his desired actions without
fear. Unlike other programming systems that provide dozens of complicated ways to
perform a simple task, Java provides a small number of clear ways to achieve a given
Today everyone is worried about safety and security. People feel that conducting
commerce over the Internet is a safe as printing the credit card number on the first page
of a Newspaper. Threatening of viruses and system hackers also exists. To overcome all
these fears java has safety and security as its key design principle.
Benefit-Based Data Caching in Ad Hoc Networks 48
Using Java Compatible Browser, anyone can safely download java applets
without the fear of viral infection or malicious intent. Java achieves this protection by
confining a java program to the java execution environment and by making it
inaccessible to other parts of the computer. We can download applets with confidence
that no harm will be done and no security will be breached.
In java, the same mechanism that gives security also helps in portability. Many types
of computers and operating systems are in use throughout the world and are connected to
the internet. For downloading programs through different platforms connected to the
internet, some portable, executable code is needed. Java’s answer to these problems is its
well designed architecture.
Java was designed to be source-code compatible with any other language. Java team
gave a clean, usable, realistic approach to objects. The object model in java is simple and
easy to extend, while simple types, such as integers, are kept as high-performance non -
Java programs carry with them extensive amounts of run-time information that is
used to verify and resolve accesses to objects at run-time. Using this concept it is possible
to dynamically link code. Dynamic property of java adds strength to the applet
Benefit-Based Data Caching in Ad Hoc Networks 49
environment, in which small fragments of byte code may be dynamically updated on a
NEWLY ADDDED FEATURES IN JAVA 2:
SWING is a set of user interface components that is entirely implemented in java
the user can use a look and feel that is either specific to a particular operating
system or uniform across operating systems.
Collections are a group of objects. Java provides several types of collection, such
as linked lists, dynamic arrays, and hash tables, for our use. Collections offer a
new way to solve several common programming problems.
Various tools such as javac, java and javadoc have been enhanced. Debugger and
profiler interfaces for the JVM are available.
Performance improvements have been made in several areas. A JUST-IN-TIME
(JIT) compiler is included in the JDK.
Digital certificates provide a mechanism to establish the identity of a user, which
can be referred as electronic passports.
Benefit-Based Data Caching in Ad Hoc Networks 50
Various security tools are available that enable the user to create the user to
create and store cryptographic keys and digital certificates, sign Java
Archive(JAR) files, and check the signature of a JAR file.
Benefit-Based Data Caching in Ad Hoc Networks 51
Swing components facilitate efficient graphical user interface (GUI)
development. These components are a collection of lightweight visual components.
Swing components contain a replacement for the heavyweight AWT components as
well as complex user interface components such as Trees and Tables.
Swing components contain a pluggable look and feel (PL & F). This
allows all applications to run with the native look and feel on different platforms. PL
& F allows applications to have the same behaviour on various platforms. JFC
contains operating system neutral look and feel. Swing components do not contain
peers. Swing components allow mixing AWT heavyweight and Swing lightweight
components in an application.
The major difference between lightweight and heavyweight components is
that lightweight components can have transparent pixels while heavyweight
components are always opaque. Lightweight components can be non-rectangular
while heavyweight components are always rectangular.
Benefit-Based Data Caching in Ad Hoc Networks 52
Swing components are Java Bean compliant. This allows components to be used
easily in a Bean aware application building program. The root of the majority of the
Swing hierarchy is the JComponent class. This class is an extension of the AWT
Swing components comprise of a large percentage of the JFC release. The Swing
component toolkit consists of over 250 pure Java classes and 75 Interfaces contained
in about 10 Packages. They are used to build lightweight user interfaces. Swing
consists of User Interface (UI) classes and non- User Interface classes. The non-User
Interface classes provide services and other operations for the UI classes.
Benefit-Based Data Caching in Ad Hoc Networks 53
Swing offers a number of advantages, which include
Wide variety of Components
Pluggable Look and Feel
Standard Dialog Classes
Structured Table and Tree Components
Powerful Text Manipulation
Generic Undo Capabilities
Benefit-Based Data Caching in Ad Hoc Networks 54
Benefit-Based Data Caching in Ad Hoc Networks 55
According to the analysis three modules has been traced out in the design of
work. The modules are as follows.
delete the path update table in each node
Benefit-Based Data Caching in Ad Hoc Networks 56
Flow charts of new node joins in the network:
a) A new node joins in the network
Benefit-Based Data Caching in Ad Hoc Networks 57
(b)Neighbors response to address assign
Benefit-Based Data Caching in Ad Hoc Networks 58
Benefit-Based Data Caching in Ad Hoc Networks 59
Benefit-Based Data Caching in Ad Hoc Networks 60
Benefit-Based Data Caching in Ad Hoc Networks 61
Benefit-Based Data Caching in Ad Hoc Networks 62
Benefit-Based Data Caching in Ad Hoc Networks 63
Benefit-Based Data Caching in Ad Hoc Networks 64
Benefit-Based Data Caching in Ad Hoc Networks 65
Benefit-Based Data Caching in Ad Hoc Networks 66
Benefit-Based Data Caching in Ad Hoc Networks 67
Testing is an activity in which a system or component is executed under specified
conditions, whose results are observed or recorded, and an evaluation is made about some
aspect of the system or component. A successful testing uncovers errors in the software.
So in general testing demonstrates that the system is working according to the
specifications, and that it meets the performance requirements. This is the final stage of
any project. Testing is a process of executing the program with the intent of finding an
error, it is a set of activities that can be planned in advance and conducted systematically.
The purpose of System testing is to correct the errors in the system. Nothing is completed
without the testing, as it is vital to the success of the system.
6.1 Testing Phases:
Software testing phases include the following:
Test activities are determined and Test data is selected. The test is conducted and
test results are compared with the expected results.
There are various types of Testing:
Unit testing is a procedure used to validate that individual units of source code are
working properly. A unit is the smallest testable part of an application. In procedural
programming a unit may be an individual program, function, procedure etc, while in
object-oriented programming, the smallest unit is always a Class; which may be a
base/super class, abstract class or derived/child class. Units are distinguished from
modules in that modules are typically made up of units
Benefit-Based Data Caching in Ad Hoc Networks 68
Integration Testing is the phase of software testing in which individual software
modules are combined and tested as a group. It follows unit testing and precedes system
testing. The goal is to see if the modules are properly integrated and the emphasis being
on the testing interfaces among modules.
System testing is testing conducted on a complete, integrated system to evaluate
the system's compliance with its specified requirements. System testing is actually done
to the entire system against the Functional Requirement Specification(s) (FRS) and/or the
System Requirement Specification (SRS). It is also intended to test up to and beyond the
bounds defined in the software/hardware requirements specification(s).
Acceptance testing generally involves running a suite of tests on the completed
system. The acceptance test suite is run against the supplied input data or using an
acceptance test script to direct the testers. Then the results obtained are compared with
the expected results. If there is a correct match for every case, the test suite is said to
pass. If not, the system may either be rejected or accepted on conditions previously
agreed between the sponsor and the manufacturer.
6.2 Testing Methods:
Testing is a process of executing a program to find out errors. Any testing can be
done in two ways:
Benefit-Based Data Caching in Ad Hoc Networks 69
White Box Testing:
White Box testing uses an internal perspective of the system to design test cases
based on internal structure. It requires programming skills to identify all paths through
the software. The tester chooses test case inputs to exercise paths through the code and
determines the appropriate outputs. Using the testing a software engineer can derive the
Exercise all the logical decisions on either true or false sides. Execute
all loops at their boundaries and within their operational boundaries. Exercise the internal
data structures to assure their validity.
Black Box Testing:
Black box testing takes an external perspective of the test object to derive test
cases. These tests can be functional or non-functional, though usually functional. The test
designer selects valid and invalid input and determines the correct output. There is no
knowledge of the test object's internal structure.
Black Box testing attempts to find errors in the following categories:
Incorrect or missing functions
Errors in data structures
Initialization and termination errors
Benefit-Based Data Caching in Ad Hoc Networks 70
6.3 Test Approach:
Testing can be done in two ways:
o Bottom-up approach
o Top-down approach
In a bottom-up approach the individual base elements of the system are first
specified in great detail. These elements are then linked together to form larger
subsystems, which then in turn are linked, sometimes in many levels, until a complete
top-level system is formed. This strategy often resembles a "seed" model, whereby the
beginnings are small, but eventually grow in complexity and completeness. However,
"organic strategies", may result in a tangle of elements and subsystems, developed in
isolation, and subject to local optimization as opposed to meeting a global purpose.
In a top-down approach an overview of the system is first formulated, specifying
but not detailing any first-level subsystems. Each subsystem is then detailed enough to
realistically validate the model.
Benefit-Based Data Caching in Ad Hoc Networks 71
Setting up the java environment
Our project has been coded using the JAVA version 1.5.0 so before getting on to
running the project we need to install the java environment. Here is how we do it.
1. Java installation file is included in the CD accompanying this document. You
can find in the requirements folder in the CD.
2. Go to the requirements folder and run jdk-1_5_0_04-windows-i586-p.exe file
3. You will be greeted by the java setup wizard. It will guide through the rest of
4. This above file should install both JAVA runtime libraries as well as JAVA
5. Now to set up the path, right click on my computer and click properties.
6. Click on the advanced tab on open environment variables.
7. There add the path were java’s bin folder is located. Default is C:\Program
8. Now the environment is up and ready to be used.
Benefit-Based Data Caching in Ad Hoc Networks 72
Extracting the source files
The source files have been zipped so you will need some utility like winrar to
extract its content
1. To install winrar go to requirements folder in the CD and click on winrar.exe
2. A wizard will pop up and will guide through the setup.
3. Now copy steganography.rar file on to the local drive.
4. Right click on the copied file and click extract here.
5. This will extract all the source files on to the local disk
6. Now the files are ready to be complied and executed
Compiling the code
1. . Using command “cd manet1”
2. Type javac –classpath <path of the source files>\javac *.java
3. That should compile the manet1
4. Type javac –classpath<path of the source files>\java Split
Running the application
1. To run the program make sure you are in the application root folder.
2. Type “java –classpath <path of the source files>\javac *.java;<path of the
source files>; java Split”
Benefit-Based Data Caching in Ad Hoc Networks 73
3. The application window pops up. The details on how to operate the program is
described in the next section
How to Operate:
1. The execution begins with the interaction of GUI window which is called as the
front end of the program.
2. You can see buttons containing “File”, “View database”.
3. First you have to enter the mobile nodes into the network.
4. What ever the mobile nodes joined in the network it will be form in a “Binary
5. The tree will be updating when the new node joining in the network.
6. You have to add any file to the particular “Host”, first have to click the “File”
menu then “Add File” have to select from that the file will be placed in the
7. You have to search any file in the “Host” have to click the “File” menu then
“Search” button there it will be displayed the “Host” have to search in that.
8. You have to see the “Database” have to click the “View Database” in that it will
displays the “Database” of the Hosts what you added the files in the “Hosts”.
Benefit-Based Data Caching in Ad Hoc Networks 74
Benefit-Based Data Caching in Ad Hoc Networks 75
We have developed a paradigm of data caching techniques to support effective
data access in ad hoc networks. In particular, we have considered memory capacity
constraint of the network nodes, and developed efficient algorithms to determine near
optimal cache placements to maximize reduction in overall access cost.
Reduction in access cost leads to communication cost savings and hence, better
bandwidth usage and energy savings. Our later simulation experience with ns2 also
shows that better bandwidth usage also in turn leads to less message losses and thus,
better query success ratio.
The novel contribution in our work is the development of a 4-approximation
centralized algorithm, which is naturally amenable to a localized distributed
implementation. The distributed implementation uses only local knowledge of traffic.
However, our simulations over a wide range of network and application parameters show
that the performance of the two algorithms is quite close. We note that ours is the first
work that presents a distributed implementation based on an approximation algorithm for
the problem of cache placement of multiple data items under memory constraint.
Benefit-Based Data Caching in Ad Hoc Networks 76
Benefit-Based Data Caching in Ad Hoc Networks 77
1. S.Deering and R.Hinden, “Internet protocol version 6 (IPv6) specifications”, IETF
RFC 2460, December 1998.
2. Hinden, R.Hinden, and S. Deering, “Internet Protocol Version 6 (IPv6) Addressing
Architecture”, RFC 3513, April 2003.
3. T.Narten, E.Nordmark, and W.Simpson, “Neighbor Discovery for IPv6”, RFC 2461,
4. S.Thomson and T.Narten, “IPv6 Stateless Address AutoConfiguration”, RFC 2462,
5. C.Perkins, J.Malinen, R.Wakikawa, E.Belding-Royer, and Y.Sun, “IP Address
AutoConfiguration for Ad Hoc Networks”, IETF Internet Draft, Draft-ietf-manet-
autoconf-01.txt, November 2001.
6. R.Wakikawa, J.Malinen, C.Perkins, A.Nilsson and A. Tuominen, “Global Connectivity
for IPv6 Mobile Ad Hoc Networks”, IETF Internet Draft, draft-wakikawa-manet-
globalv6-03.txt, October 2003.
7. I.K. Park, Y.H Kim and S.S.Lee, “IPv6 Address Allocation in Hybrid Mobile Ad Hoc
Networks”, The 2nd IEEE workshop on Software Technologies for Embedded and
Ubiquitous Computing Systems, May 2004, pp.58-62.
8. C.E.Perkins, E.M.Belding-Royer and S.Das, “Ad Hoc On-Demand Distance Vector
(AODV) Routing”, Routing RFC 3561, July 2003.
9. T.Clausen and P.Jacquet, “Optimized Link State Routing Protocol”, RFC 3626,
Internet Engineering Task Force, October 2003.
10. Z.J. Hass and M.R. Perlmn,“The Zone Routing Protocol (ZRP) for Ad-Hoc
Networks”, IETF Internet Draft, draft-ietf-manet-zone-zrp-04.txt, July 2002.
Benefit-Based Data Caching in Ad Hoc Networks 78
Benefit-Based Data Caching in Ad Hoc Networks 79
Benefit-Based Data Caching in Ad Hoc Networks 80