an enhanced greedy routing with anti

Upload: sangesh-nattamai

Post on 05-Apr-2018

222 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    1/45

    ENHANCED GREEDY ROUTING WITH

    ANTI-VOID TRAVERSAL FOR WIRELESS

    SENSOR NETWORKS

    A PROJECT REPORT

    Submitted by

    KEERTHI T.KAROTTUNALANKAL

    in partial fulfilment for the award of the degree

    of

    BACHELOR OF TECHNOLOGY

    IN

    INFORMATION TECHNOLOGY

    ST.MICHAEL COLLEGE OF ENGINEERING AND

    TECHNOLOGY

    ANNA UNIVERSITY, CHENNAI 600 025

    APRIL 2012

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    2/45

    BONAFIED

    Certified that this project report titled ENHANCED GREEDY ROUTING WITH

    ANTI VOID TRAVERSAL FOR WIRELESS SENSOR NETWORKS, is a

    bonafide work of Ms. Keerthi T.Karottunalankal (91908134021), who carried

    out the work under my supervision, for the partial fulfilment of the requirements

    for the award of the degree ofBachelor of Technology inInformation Technology.

    SIGNATURE SIGNATURE

    Mrs. S.KARPAGAM Ms.P.THAMARAI CHELVI

    HEAD OF THE DEPARTMENT SUPERVISOR

    Assist. Professor

    Department of Information Department of Information

    Technology Technology

    St.Michael College of St.Michael College of

    Engineering and Technology Engineering and Technology

    Kalayakoil Kalayarkoil

    Submitted to Project and Viva-voce Examination held on ..

    INTERNAL EXAMINER EXTERNAL EXAMINER

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    3/45

    ACKNOWLEDGEMENT

    This project Application for Simulating Traffic Congestion Scenarios at

    Traffic Signals has been completed with the help and co-ordination of many

    people to whom I express my gratitude. Deep sense of gratitude well from my heart

    to the chairman Dr. M. Stalin Arockiaraj B.E., M.S. and Mrs. S. Bridget

    Nirmala M.C.A, M.E.,(PhD), CEO, St. Michael College of Engineering and

    Technology, Kalayarkoil, for this incessant intersession and earnest

    encouragement.

    I am deeply indebted in thanking Dr. V.G. Gopinath M.E., (PhD),

    Principal, St. Michael College of Engineering and Technology, Kalayarkoil,

    who has been the backbone of all our endeavors, Prof. S. Kannan, M.E., (PhD),

    Coordinator for his grateful encouragement to do the project, Prof. S. Karpagam

    M.C.A., M.Phil., M.E., (PhD) and Head of the Department of Information

    Technology for her impeccable support during the tenure of the project work and to

    Ms. P. Thamarai chelvi,B.Tech, Lecturer and Project Guide, for her guidance

    throughout this project.

    I express my sincere thanks to Pleiad Technologies for providing all

    facilities to undergo the project, and also I thankMs. Neena J.M. for her guidance

    and support to complete project successfully.

    Finally, I record my deep sense of indebtedness to My Parents for their

    blessings and support to do the project successfully.

    (i)

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    4/45

    ABSTRACT

    The unreachability problem (i.e. the so called void problem) that exists

    in the greedy routing algorithms has been studied for the wireless sensor networks.Some of the current research work cannot fully resolve the void problem, while

    there exists other schemes that can guarantee the delivery of packets with the

    excessive consumption of control overheads. Moreover, the hop count

    reduction(HCR) scheme is utilized as a short-cutting technique to reduce the

    routing hops by listening to the neighbours traffic, while the intersection

    navigation (IN) mechanism is proposed to obtain the best rolling direction for

    boundary traversal with the adoption of shortest path criterion. In order to

    maintain the network requirement of the proposed RUT scheme under the non

    UDG networks, the partial UDG construction (PUC) mechanism is proposed to

    transform the non-UDG into UDG setting for a portion of nodes that facilitate

    boundary traversal.These three schemes are incorporated within the GAR protocol

    to further enhance the routing performance with reduced communication

    overhead.The proofs of correctness for the GAR scheme are also given in this

    paper.

    (ii)

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    5/45

    TABLE OF CONTENTS

    CHAPTER NO ABSTRACT PAGE NO

    LIST OF ABBRIVATIONS

    LIST OF FIGURES

    1. INTRODUCTION

    1.1 COMPUTER NETWORKS

    1.1.1 Wired Technologies

    1.1.2 Wireless Technologies

    1.2 ROUTING

    1.2.1 Shortest Path Routing

    1.2.2 Myths Of Shortest Path Routing

    1.2.3 Existing Algorithms

    1.2.4 Advantages Of Shortest Path Routing

    1.3 PROBLEM STATEMENT

    2. PROJECT DESCRIPTION

    2.1 INTRODUCTION

    2.2 SYSTEM ANAYSIS

    2.2.1 Existing System

    2.2.2 Proposed System

    2.2.3 Module Description

    2.3 SYSTEM SPECIFICATION

    2.3.1 Hardware Requirements

    2.3.2 Software Requirements

    (iii)

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    6/45

    2.4 SYSTEM DESIGN

    2.4.1 PROCESS MODEL

    2.4.1.1 Use case diagram

    2.4.1.2 Data flow diagram

    3. ARCHITECTURAL DESIGN

    3.1 Programming Language

    4. SYSTEM IMPLEMENTATION4.1 Class design

    4.2 Form design

    5. TESTING

    5.1 SOFTWARE TESTING

    5.1.1 Unit testing

    5.1.2 Intergration testing

    5.1.3 System Intergration Testing

    5.1.4 Regression Testing

    6. CONCLUSION

    (iv)

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    7/45

    7. APPENDICES7.1 Capturing Router Information And

    Forwarding

    7.2 LAN Log Information

    7.3 Packet Port Channel

    8. REFERENCES

    (v)

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    8/45

    LIST OF ABBREVATIONS

    GAR Greedy Anti-Void Routing GF Greedy Forwarding RUT Routing Unit Transfer HCR Hop Count Reduction IN Intersection Navigation NS Network Source ND Network Destination PUC Partial UDG Constrution

    (vi)

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    9/45

    LIST OF FIGURESFIG NO TITLE PAGE NO

    1. Voronoi Cell and Shortest PathRouting Algorithm

    2. Node Participation In Routing3. GPRS and WiFi Interface4. PUC Mechanism

    (vii)

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    10/45

    CHAPTER 1

    INTRODUCTION

    1.1 COMPUTER NETWORKSA computer network allows sharing of resources and information

    among devices connected to the network. The Advanced Research Projects

    Agency (ARPA) funded the design of the Advanced Research Projects Agency

    Network (ARPANET) for the United States Department of Defense. It was the

    first operational computer network in the world. Development of the network

    began in 1969, based on designs developed during the 1960s. For a history see

    ARPANET, the first network.

    1.1.1 WIRED TECHNOLOGIES

    Twisted-pair wire is the most widely used medium for telecommunication.Twisted-pair wires are ordinary telephone wires which consist of two

    insulated copper wires twisted into pairs and are used for both voice and

    data transmission. The use of two wires twisted together helps to reduce

    crosstalk and electromagnetic induction. The transmission speed ranges

    from 2 million bits per second to 100 million bits per second.

    Coaxial cable is widely used for cable television systems, office buildings,and other worksites for local area networks. The cables consist of copper or

    aluminum wire wrapped with insulating layer typically of a flexible material

    with a high dielectric constant, all of which are surrounded by a conductive

    layer. The layers of insulation help minimize interference and distortion.

    Transmission speed range from 200 million to more than 500 million bits

    per second.

    (1)

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    11/45

    above the equator. These Earth-orbiting systems are capable of receiving

    and relaying voice, data, and TV signals.

    1.1.2 WIRELESS TECHNOLOGIES

    Terrestrial MicrowaveTerrestrial microwaves use Earth-based transmitterand receiver. The equipment look similar to satellite dishes. Terrestrial

    microwaves use low-gigahertz range, which limits all communications to

    line-of-sight. Path between relay stations spaced approx. 30 miles apart.

    Microwave antennas are usually placed on top of buildings, towers, hills,

    and mountain peaks.

    Communications Satellites The satellites use microwave radio as theirtelecommunications medium which are not deflected by the Earth's

    atmosphere. The satellites are stationed in space, typically 22,000 miles

    above the equator. These Earth-orbiting systems are capable of receiving

    and relaying voice, data, and TV signals.

    Cellular and PCS Systems Use several radio communicationstechnologies. The systems are divided to different geographic area. Each

    area has low-power transmitter or radio relay antenna device to relay calls

    from one area to the next area.

    Wireless LANs Wireless local area network use a high-frequency radio

    technology similar to digital cellular and a low-frequency radio technology.Wireless LANs use spread spectrum technology to enable communication

    between multiple devices in a limited area. An example of open-standards

    wireless radio-wave technology is IEEE 802.11b.

    (2)

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    12/45

    1.2 ROUTING

    Routing is the process of selecting paths in a network along which to send

    network traffic. Routing is performed for many kinds of networks, including

    the telephone network, electronic data networks (such as the Internet), and

    transportation networks. This article is concerned primarily with routing in

    electronic data networks using packet switching technology.

    In packet switching networks, routing directs packet forwarding, the transit of

    logically addressed packets from their source toward their ultimate destination

    through intermediate nodes; typically hardware devices called routers,

    bridges, gateways, firewalls, or switches. General-purpose computers with

    multiple network cards can also forward packets and perform routing, though

    they are not specialized hardware and may suffer from limited performance.

    The routing process usually directs forwarding on the basis of routing tables

    which maintain a record of the routes to various network destinations. Thus,

    constructing routing tables, which are held in the routers' memory, is very

    important for efficient routing. Most routing algorithms use only one network

    path at a time, but multipath routing techniques enable the use of multiple

    alternative paths.

    (3)

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    13/45

    1.2.1 SHORTEST PATH ROUTING

    Shortest path routing (or straight line routing) is a form of routing which

    attempts to send packets of data over a network in such a way that the pathtaken from the sending computer to the recipient computer is minimized. .

    Fig.1.Voronoi cells and a shortest path routing algorithm in a two-dimensional space.

    (4)

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    14/45

    1.2.2 MYTHS OF SHORTEST PATH ROUTING

    There have been three traditionally believed myths about shortest path (or

    straight line) routing for multi-hop wireless networks. These are as follows.

    1) Straight line routing results in congested areas, and load balancing is needed to

    alleviate it.

    2) A congested area induced by straight line routing is located at the centre of the

    network.

    1.2.3 EXISTING ALGORITHMS

    Distance vector algorithms

    Distance vector algorithms use the Bellman-Ford algorithm. This approach assigns

    a number, the cost, to each of the links between each node in the network. Nodes

    will send information from point A to point B via the path that results in the

    lowest total cost(i.e. the sum of the costs of the links between the nodes used).The

    algorithm operates in a very simple manner. When a node first starts, it only

    knows of its immediate neighbours, and the direct cost involved in reaching them.

    Link-state algorithms

    When applying link-state algorithms, each node uses as its fundamental data a

    map of the network in the form of a graph. To produce this, each node floods the

    entire network with information about what other nodes it can connect to, and

    each node then independently assembles this information into a map. Using this

    map, each router then independently determines the least-cost path from itself to

    every other node using a standard shortest paths algorithm such as Dijkstra's

    algorithm.

    (5)

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    15/45

    Dijkstra's algorithm

    It is conceived by Dutch computer scientist Edsger Dijkstra in 1959, is a graph

    search algorithm that solves the single-source shortest path problem for a graph

    with nonnegative edge path costs, producing a shortest path tree. This algorithm is

    often used in routing.

    Edge disjoint shortest pair algorithm

    It is an algorithm in computer network routing. The algorithm is used for

    generating the shortest pair of edge disjoint paths between a given pair of vertices

    1.2.4 ADVANTAGES OF SHORTEST PATH ROUTING

    Correctness, each packet is delivered Efficiency, routing though best paths. Choice of good paths, small

    delay, high bandwidth.

    Robustness. Table computation. Changes in topology. Tables are updatedwhen a channel/node is added/removed.

    Adaptiveness, load balancing of channels and nodes (choosing those withlight load).

    Fairness in delivery of packets.PROBLEM STATEMENT A. Assumption We model a multi-hop wireless network as a directed graph, where

    represents the set of nodes and the set of edges in the network. that For

    simplicity, we let the radius of the disk be one, i.e., a unit disk. Each node

    can control its transmission range.

    (6)

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    16/45

    We assume that the number of nodes is large enough and that theirmaximum coverage areas are overlapped in a way in which the unit disk is

    entirely covered by the nodes maximum transmission coverage. Further,

    we assume that the nodes are totally connected. For a given deployment of

    nodes on a disk, we define a logical Voronoi tessellation over the unit disk.

    There is a unique one-to-one mapping between a Voronoi cell and a node in

    the network. The definition is as follows. Let be a set of locations of nodes

    in. The Voronoi cell is the set of all points that are closer to than to any

    other for, i.e. where represents a Euclidean distance between points.

    Therefore, each node has its Voronoi cell, which is encircled by a perimeter,

    as in Fig. We assume that the probabilities that a node becomes a source and

    a destination are identical, and circularly symmetrical. For simplicity, we

    use the perimeter of node as a perimeter of nodes Voronoi cell throughout

    this paper.

    B. Routing In multi-hop wireless networks, packets are transferred through routes that

    could be composed of multiple relay nodes between sources and destination.

    In this paper, we will focus on straight line routing for delivering packets

    from sources to destinations. Straight line routingis defined as a sequence

    of nodes whose Voronoi cell is cut by a straight line segment between a

    source and destination. When a packet arrives at the network, node in the

    network participates in routing the packet when the straight line segment

    between the source and the destination cuts the perimeter of node. If two

    cells are simultaneously chosen as the next cell, either can be arbitrarily

    selected. For example, in Fig.1 , a packet arriving at node is destined for

    node. Nodes, and whose perimeters cut by a line segment between and will

    participate in routing the packet.

    (7)

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    17/45

    Nodal Load and Problem Formulation

    We define the nodal loadas the expected number of packets that traverse the

    node. For a given total offered load on the network, the nodal load at node can beexpressed as where represents the probability that a packet goes through node. We

    say that loads are balancedwhen all the nodal loads are identical, i.e., there exists

    such that To find in, recall that is the Voronoi cell of node, which is encircled by

    perimeter.Node will participate in routing a packet when the line segment between

    the source and destination cuts its perimeter, and there are three cases depending

    on the locations of the source and destination, as shown the probability density

    function of a random variable is circularly symmetrical if it depends only on the

    Euclidean distance from the origin.

    Fig:2. Node will participate in routing when a line segment between a source and

    destination cuts its perimeter.

    In Fig.2, In the case of a relay (Case 1 in Fig.2), a line segment cuts at exactly two

    points. Otherwise, the perimeter is cut by a line segment at one point, i.e., Cases 2

    and 3 in Fig.2 (the probability of the set of outcomes with a line touching a corner

    or lying congruent with a side of the polygon is zero.

    (8)

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    18/45

    We can interpret as the relaying load that a packet arriving to the network is

    relayed at using straight line routing. When a node is a pure relay node that does

    not generate or drain packets, is exactly the probability that node becomes a relay.

    (9)

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    19/45

    CHAPTER 2

    PROJECT DESCRIPTION

    2.1 INTRODUCTION

    The greedy routing algorithm has been studied for the unreachability

    problem in the wireless sensor networks. Some of the current research work

    cannot fully resolve the void problem; while there exit other schemes that can

    guarantee the delivery of packets with the excessive consumption of the control

    overheads. In this project, a greedy anti void problem with increased routing

    efficiency by exploiting the boundary finding techniques for the unit disk graph

    (UDG). The proposed rolling-ball UDG boundary traversal (RUT) is employed to

    completely guarantee the delivery of packets from the source to the destination

    node under UDG network. The boundary map (BM) and the indirect map

    searching 9IMS) schemes are proposed as efficient algorithm for the realization of

    the RUT technique. Moreover, the hopcount reduction (HCR) scheme is utilized

    as a short-cutting technique to reduce the routing hops by listening to the

    neighbors traffic, while the intersection navigation (IN) mechanism is proposed to

    obtain the best rolling direction for boundary traversal with the adaptation of

    shortest path criteration. In order to maintain the network requirement of the

    proposed RUT scheme under the non-UDG network, the partial UDG construction

    (PUC) mechanism is proposed to transform the non-UDG into UDG setting for a

    portion of nodes that facilitate boundary traversal. These three schemes are

    incorporated within the GAR protocol further enhance the routing performance

    with reduced communication overhead. The proofs are given in this project. When

    compare to other algorithms this simulation provides proposed GAR-based

    protocol can provide better routing efficiency.

    (10)

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    20/45

    2.2 SYSTEM ANALYSIS

    Systems analysis is the interdisciplinary part of science, dealing with

    analysis of sets of interacting entities, the systems, often prior to their automation

    as computer systems and the interactions within those systems. This field is

    closely related to as operations research. It is also an explicit formal inquiry

    carried out to help someone, referred to as the decision maker, identify a better

    decision than he might have otherwise made.

    2.2.1 EXISTING SYSTEM

    As mobile computing requires more consumption as well as

    communication activities, energy efficiency becomes the most criticalissue for the

    battery operated mobile devices. Specifically, in ad hoc networks where each node

    is responsible for forwarding neighbor nodes data packets, care has been taken

    not only to reduce the overall energy consumption for all relevant notes but also to

    balance individual battery levels. Unbalanced energy usage will result in earlier

    node failure in overloaded nodes, and in turn may lead to network portioning and

    reduced network lifetime. Localized routing algorithms which achieves a trade-off

    between balanced energy consumption and shortest routing delay, and at the same

    time avoids the blocking and route cache problems.

    2.2.2 PROPOSED SYSTEM

    In this project, a greedy anti-void routing (GAR) protocol is proposed to

    solve the void problem with increased routing efficiency by exploiting the

    boundary finding technique for the unit disk graph (UDG).

    (11)

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    21/45

    The proposed rolling ball UDG boundary traversal (RUT) is employed to

    completely guarantee the delivery of packets from the source of the destination

    node under the UDG network. The boundary map(BM) and the indirect map

    searching(IMS) scheme are proposed as efficient algorithms for the realization of

    the RUT technique.

    2.2.3 MODULE DESCRIPTION

    There includes 5 modules,

    1) Networking Module2) Boundary Evaluation Module3) Greedy Anti-void Traversal Module4) Partial UDG Construction(PUC) Mechanism5) Performance Evaluation Module1) Networking Module :

    Client-server computing or networking is a distributed application

    architecture that partitions tasks or workloads between service providers(servers)

    and service requesters,called clients.Often clients and servers operate over a

    computer network on separate hardware.A server machines a high-performance

    host that is running one or more server programs which share its resources with

    clients.A client also shares any of its resources.Clients therefore initiate

    communication sessions with servers which await(listen to) incoming request.

    2) Boundary Evaluation Module :

    The RUT scheme is adopted to solve the boundary finding

    problem and the combination of the GF and the RUT scheme (i.e. the GAR

    protocol) can resolve the void problem,leading to the guaranteed packet delivery.

    (12)

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    22/45

    The definition of the boundary and the problem statement are described as

    follows:

    Definition : Boundary

    If there exists a set B such that;

    The nodes in B form a simple unidirectional ring and The nodeslocated on and inside the ring are disconnected with those outside

    the ring,B is denoted as the boundary set and the unidirectional ring is

    called a boundary.

    3) Greedy Anti-Void Traversal Module :

    The objective of the GAR protocol is to resolve the void problem such

    that the packet delivery from NS to ND can be guaranteed. Before diving into the

    detail formulation of the proposed GAR algorithm, an introductory example is

    described in order to facilitate the understanding of the GAR protocol, the data

    packets initiated from the source node NS to the destination node ND

    will arrive in NV based on the GF algorithm. The void problem occurs

    as NV receives the packets, which leads to the adoption of the RUT scheme as the

    forwarding strategy of the GAR protocol.

    4) Partial UDG Construction (PUC) Mechanism :

    The PUC mechanism is targeted to recover the UDG linkage of the

    boundary node Ni within a non-UDG network. The boundary nodes within the

    proposed GAR protocol are defined as the SNs that are utilized to handle the

    packet delivery after encountering the void problem .Therefore, conducting the

    PUC mechanism only by the boundary nodes can conserve network resources than

    most. The PUC mechanism of the existing flooding-based schemes that require

    information from all the network nodes.

    (13)

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    23/45

    5) Performance Evaluation Module :

    The performance of the proposed GAR algorithm is evaluated

    and compared wi th o t he r ex i s t i ng l o ca l i ze d sc he me s v i a

    s i m u l a t i o n s , i n c l u d i n g t h e r e f e r e n c e G F a l g o r i t h m , t h e p l a n a r

    graph-based GPSR and GOAFR++schemes, and the UDG-based

    BOUNDHOLE algorithm. It is noted that the GPSR and GOAFR++ schemes that

    adopt the GG planarization technique to planarize the network graph are

    represented as the GPSR(GG) and GOAFR++(GG) algorithms, while the

    variants of these two schemes with the CLDP planarization algorithm are

    denoted as the GPSR(CLDP) and GOAFR++(CLDP) protocols.

    (14)

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    24/45

    2.3. SYSTEM SPECIFICATION

    2.3.1 Hardware Specification

    Processor : Intel Pentium4 on or above

    Memory : 256 MB DDRRAM

    Hard disk : 10 GB or above

    Monitor : 14 inch VGA Monochrome

    Keyboard : 101 Keys

    Ethernet card

    LAN connectivity

    2.3.2 Software Specification

    Front End : Microsoft Visual studio 2010

    Platform : Windows

    TOOL

    C#.NET

    (15)

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    25/45

    2.4 SYSTEM DESIGN

    2.4.1 PROCESS MODEL

    2.4.1.1 USE CASE DIAGRAM

    (16)

    USER

    ACCESS

    ROUTER

    PACKET

    SEQUENCE

    ROUTING

    TRANSFER TO

    DEFAULT

    GATEWAY

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    26/45

    2.4.1.2 DATA FLOW DIAGRAM

    LEVEL ZERO

    REQUEST REQUEST

    (17)

    USER GREEDY USER

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    27/45

    LEVEL ONE (ADMIN)

    (18)

    ADMINGREEDY

    S/W

    VIEW LAN

    SYS INFO

    ACCESS

    PACKET

    PING

    CHECKER

    PACKET

    LOG

    NETWORK

    PACKET

    FORWARDING

    GATEWAY

    NETWORK

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    28/45

    LEVEL TWO (PACKET FORWARDING)

    (19)

    PACKET

    FORWARDING

    ACCESS

    PACKET

    ACCESS

    PACKET

    ROUTING

    STATUS

    APPLY

    ROUTING

    STRATERGY

    PACKET

    FORWARD

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    29/45

    LEVEL TWO (PING)

    (20)

    USER PINGCHECKER

    PINGCOMPLETED

    PINGRESPONSE

    USER

    PING

    SENDER

    PING

    REPLY

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    30/45

    CHAPTER 3

    ARCHITECTURAL DESIGN

    3.1 PROGRAMMING LANGUAGE

    ABOUT .NET

    Visual Studio .NET is a complete set of development tools for building ASP

    Web applications, XML Web services, desktop applications, and mobile

    applications. Visual Basic .NET, Visual C++ .NET, and Visual C# .NET all use

    the same integrated development environment (IDE),which allows them to share

    tools and facilitates in the creation of mixed language solutions. In addition, these

    languages leverage functionality of the .NET Framework, which provides access

    to key technologies that simplify the development of ASP Web applications and

    XML Web services.

    A key feature of the .NET Framework is the base class library. For more

    information about the common language runtime, the class library, the common

    language specification (CLS), and other features of the .NET Framework, see

    inside the .NET Framework.

    NET is also the collective name given to various software

    components built upon the .NET platform. These will be both products (Visual

    Studio.NET and Windows.NET Server, for instance) and services (like Passport,

    .NET My Services, and so on).

    The .NET Framework has two main parts:

    1. The Common Language Runtime (CLR).

    2. A hierarchical set of class libraries.

    (21)

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    31/45

    NET FRAMEWORK CLASS LIBRARY

    .NET Framework provides many classes that help developers to re-use

    codes. The .NET Class Libraries contain code for programming topics such as

    threading, file I/O, database support ,XML parsing and data structures such as

    stacks and queues. This entire class library is available to any programming

    languages that support the .NET Framework. Because all languages now support

    the same runtime, they can re-use any class that works with the .NET Framework.

    This means that any functionality available to one language will also be available

    to any other .NET language.

    C# .NET

    C# is an object-oriented programming language developed by Microsoft as

    a part of the .NET initiative. C# is intended to be a simple, modern, general-

    purpose, object-oriented programming language. Because software robustness,

    durability and programmer productivity are important, the language should

    include strong type checking, array bounds checking, detection of attempts to useuninitiated variables, source code portability, and automatic garbage collection.

    Features of C# .NET

    The Visual Studio .Net is a tool rich programming environmentcontaining all the functionality of handling C# projects.

    The .NET integrated development environment provides enormousadvantages for the programmers.

    C# is directly related to C, C++ and Java. C# is a case sensitive languageand it is designed to produce portable code.

    Polymorphism is the quality that allows one interface to access a generalclass of action ,components such as properties, methods and events.

    (22)

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    32/45

    CHAPTER 4

    4.1 CLASS DESIGN

    using System;

    using System.Collections.Generic;

    using System.ComponentModel;

    using System.Data;

    using System.Drawing;using System.Linq;

    using System.Text;

    using System.Windows.Forms;using System.Net;

    using System.Management;

    using Microsoft.Win32;using System.Diagnostics;

    using System.Net;

    using System.Net.Sockets;

    using System.Threading;

    using System.Drawing;

    using System.Drawing.Drawing2D;using System.Drawing.Design;

    using System.Net.NetworkInformation;

    using System.Diagnostics;

    using System.IO;

    using System.Net.NetworkInformation;using System.Runtime.InteropServices;

    using System.Security;

    using System.Collections;

    using System.Collections.Generic;

    using System.Windows.Forms;using System.Globalization;

    using System.Media;

    namespace WindowsFormsApplication1

    {

    publicpartialclassForm1 : Form

    {publicstring myip;

    (23)

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    33/45

    privateSocket mainSocket; //The socket which captures all

    incoming packets

    privatebyte[] byteData = newbyte[4096];

    privatebool bContinueCapturing = false; //A flag to check if packets

    are to be captured or not

    privatedelegatevoidAddTreeNode(TreeNode node);

    publicstring packdata;

    publicstring prevpackdata;

    AutoResetEvent resetEvent = newAutoResetEvent(false);

    publicint pingreplyflag;

    public Form1()

    {

    InitializeComponent();}

    privatevoid button2_Click(object sender, EventArgs e)

    {

    packdata = textBox1.Text;SendPing(textBox2.Text);

    Ping ping = newPing();

    try

    {

    string url = txtURL.Text.ToString();PingReply reply = ping.Send(url, 2000);

    if(reply == null)

    {

    MessageBox.Show("Maybe U r crossing the PING limit in the

    server");

    }

    else

    {

    pb()

    \listBox4.Items.Add(reply.Status.ToString());

    (24)

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    34/45

    listBox4.Items.Add("Round Trip Time " +

    reply.RoundtripTime.ToString());

    }

    //return (reply.Status == IPStatus.Success);

    }

    catch (PingException ex)

    {

    // return false;

    MessageBox.Show(ex.Message);

    }

    }

    //####!!->192.168.25.199->192.168.25.171!!@@enter your data

    here@@####//myips();

    ///packdata = textBox1.Text;

    //= "192.168.10.1!!@@'"+ textBox3.Text +"'@@####";

    //10kdata = "####!!->192.168.10.171->192.168.10.219!!@@'"+textBox3.Text +"'@@####";

    // SendPing(textBox2.Text);

    // SendPing(comboBox2.SelectedItem.ToString());

    privatevoid SendPing(string ip)

    {System.Net.NetworkInformation.Ping pingSender = new

    System.Net.NetworkInformation.Ping();

    // Create an event handler for ping complete

    pingSender.PingCompleted += new

    PingCompletedEventHandler(pingSender_Complete);

    // Create a buffer of 32 bytes of data to be transmitted.prevpackdata = packdata;

    byte[] packetData = Encoding.ASCII.GetBytes(packdata);

    // Jump though 50 routing nodes tops, and don't fragment the packet

    PingOptions packetOptions = newPingOptions(50, true);

    // Send the ping asynchronouslypingSender.SendAsync(ip, 5000, packetData, packetOptions, resetEvent);

    }

    privatevoid pingSender_Complete(object sender, PingCompletedEventArgs

    (25)

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    35/45

    {

    // If the operation was canceled, display a message to the user.

    if(e.Cancelled)

    {

    listBox3.Text += "Ping was canceled...\r\n";// The main thread can resume

    ((AutoResetEvent)e.UserState).Set();

    }

    elseif(e.Error != null)

    {

    listBox3.Text += "An error occured: " + e.Error + "\r\n";

    // The main thread can resume

    ((AutoResetEvent)e.UserState).Set();

    }

    else{

    pingreplyflag = 1;

    PingReply pingResponse = e.Reply;

    // Call the method that displays the ping results, and pass the information

    with itShowPingResults(pingResponse);

    }

    }

    publicvoid ShowPingResults(PingReply pingResponse)

    {

    }

    privatevoid button1_Click(object sender, EventArgs e)

    {

    }

    privatevoid Form1_Load(object sender, EventArgs e)

    {

    UseRegistry();}

    publicvoid unicast()

    {

    (26)

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    36/45

    foreach (NetworkInterface netifinNetworkInterface.GetAllNetworkInterfaces())

    {

    IPInterfaceProperties properties = netif.GetIPProperties();

    foreach (IPAddressInformation unicast in properties.UnicastAddresses)

    {

    listBox1.Items.Add(unicast.Address);

    // Console.Writeline(unicast.Address);

    }

    }

    }Thread searchip;

    publicvoid findclients()

    {

    searchip = newThread(newThreadStart(Serche));

    try{

    IPAddress from = IPAddress.Parse(textBox1.Text);

    IPAddress to = IPAddress.Parse(textBox2.Text);

    }

    catch (FormatException ex){

    MessageBox.Show(ex.Message);

    return;

    }

    searchip.Name = "Finding Router Congestion";searchip.Start();

    listBox1.Items.Add("Please wait while processing is done");

    Thread.Sleep(1);

    }publicvoid UseRegistry()

    {

    (27)

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    37/45

    //RegistryKey locals = Registry.LocalMachine;

    //RegistryKey ser_name=locals.OpenSubKey(

    // string dev = Registry.LocalMachine;

    //label10.Text = dev.ToString();string network_card_key = "SOFTWARE\\Microsoft\\Windows NT\\"

    + "CurrentVersion\\NetworkCards";

    string service_key = "SYSTEM\\CurrentControlSet\\Services\\";

    RegistryKey local_machine = Registry.LocalMachine;

    RegistryKey service_names =

    local_machine.OpenSubKey(network_card_key);

    if(service_names == null) return;// Invalid Registry

    string[] network_cards = service_names.GetSubKeyNames();

    service_names.Close();foreach (string key_name in network_cards)

    {

    string network_card_key_name = network_card_key + "\\" + key_name;

    //label8.Text = network_card_key_name.ToString();

    RegistryKey card_service_name =local_machine.OpenSubKey(network_card_key_name);

    if(card_service_name == null) return;// Invalid Registry

    string device_service_name = (string)card_service_name.GetValue(

    "ServiceName");

    string device_name = (string)card_service_name.GetValue("Description");

    label11.Text = device_name.ToString();

    Console.WriteLine("Network Card = " + device_name);

    string service_name = service_key + device_service_name +

    "\\Parameters\\Tcpip";

    RegistryKey network_key =

    local_machine.OpenSubKey(service_name);

    // if(

    if(network_key != null){

    (28)

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    38/45

    // IPAddresses

    string[] ipaddresses = (string[])network_key.GetValue("IPAddress");

    foreach (string ipaddress in ipaddresses)

    {// Console.WriteLine("IPAddress = " + ipaddress);

    }

    // Subnets

    string[] subnets = (string[])network_key.GetValue("SubnetMask");

    foreach (string subnet in subnets)

    {

    label10.Text = subnet;

    Console.WriteLine("SubnetMask = " + subnet);

    }

    //DefaultGateway

    string[] defaultgateways =

    (string[])network_key.GetValue("DefaultGateway");

    foreach (string defaultgateway in defaultgateways)

    {label14.Text = defaultgateway.ToString();

    Console.WriteLine("DefaultGateway = " + defaultgateway);

    }

    network_key.Close();

    }}

    local_machine.Close();

    // System.m

    }

    void Serche()

    {int lastF = textBox1.Text.LastIndexOf(".");

    int lastT = textBox2.Text.LastIndexOf(".");

    string frm = textBox1.Text.Substring(lastF + 1);

    string tto =textBox2.Text.Substring(lastT + 1);

    int result = 0;}

    }

    }

    (29)

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    39/45

    4.2 FORM DESIGNS

    FORM 1

    publicpartialclassForm2 : Form{

    public Form2(){

    InitializeComponent();}

    privatevoid Form2_Load(object sender, EventArgs e)

    {

    }}

    }

    (30)

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    40/45

    FORM 2

    publicenumProtocol

    {TCP = 6,

    UDP = 17,

    Unknown = -1

    };

    publicpartialclassMJsnifferForm : Form

    {

    privateSocket mainSocket; //The socket which captures all

    incoming packets

    privatebyte[] byteData = newbyte[4096];

    privatebool bContinueCapturing = false; //A flag to check if packetsare to be captured or not

    privatedelegatevoidAddTreeNode(TreeNode node);

    public MJsnifferForm(){

    InitializeComponent();

    }

    privatevoid btnStart_Click(object sender, EventArgs e)

    {if(cmbInterfaces.Text == "")

    {

    MessageBox.Show("Select an Interface to capture the packets.",

    "MJsniffer",

    MessageBoxButtons.OK, MessageBoxIcon.Error);

    return;}

    try

    {

    if(!bContinueCapturing)

    {//Start capturing the packets...

    (31)

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    41/45

    btnStart.Text = "&Stop";

    bContinueCapturing = true;

    //For sniffing the socket to capture the packets has to be a raw socket,with the

    //address family being of type internetwork, and protocol being IP

    mainSocket = newSocket(AddressFamily.InterNetwork,

    SocketType.Raw, ProtocolType.IP);

    //Bind the socket to the selected IP address

    mainSocket.Bind(new

    IPEndPoint(IPAddress.Parse(cmbInterfaces.Text), 0));

    //Set the socket options

    mainSocket.SetSocketOption(SocketOptionLevel.IP, //Appliesonly to IP packets

    SocketOptionName.HeaderIncluded,//Set the

    include the header

    true); //option to true

    byte[] byTrue = newbyte[4] {1, 0, 0, 0};

    byte[] byOut = newbyte[4]{1, 0, 0, 0};//Capture outgoing packets

    //Socket.IOControl is analogous to the WSAIoctl method of Winsoc2

    mainSocket.IOControl(IOControlCode.ReceiveAll,

    //Equivalent to SIO_RCVALL constant//of Winsock 2

    byTrue,

    byOut);

    //Start receiving the packets asynchronously

    mainSocket.BeginReceive(byteData, 0, byteData.Length,SocketFlags.None,

    newAsyncCallback(OnReceive), null);

    }

    else

    {btnStart.Text = "&Start";

    bContinueCapturing = false;

    (32)

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    42/45

    //To stop capturing the packets close the socket

    mainSocket.Close ();

    }

    }

    catch (Exception ex){

    MessageBox.Show(ex.Message, "MJsniffer", MessageBoxButtons.OK,

    MessageBoxIcon.Error);

    }

    }

    (33)

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    43/45

    CHAPTER 5

    TESTING

    The process of performing a variety of tests on a system to explore

    functionality or to identify problems. System testing is usually required before and

    after a system is put in place. A series of systematic procedure are referred to,

    while testing is performed

    These procedures tell the tester how the system should perform and

    where common mistakes may be found. Testers usually try to break the system

    by entering data that may cause the system to malfunctioning or return incorrect

    information. For example, a tester may put in a city in a search engine designed to

    only accept states, to see how the system will respond to the incorrect input.

    5.1. Software testing

    Software testing is an investigation conducted to provide state holders

    with information about the quality of the product or service under test. Software

    testing also provides an objective, independent view of the software to allow the

    business to appreciate and understand the risk at implementation of the software.

    Test techniques include, but are not limited to, the process of executing a program

    or application with intent of finding software bugs.

    Software testing can also be stated as the process of validating and verifying

    that a software program/application/products.:

    1. Meets the business and technical requirements that guided its design anddevelopment;

    2. Works and expected; and3. Can be implemented with the same characteristics.

    (34)

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    44/45

    5.1.1 Unit Testing

    Unit Testing refers to tests that verify the functionality of a specific session

    of code, usually at the function level. In an object-oriented environment, this is

    usually at the class level, and the minimal unit tests include the constructors and

    destructors.

    These types of tests are usually written by developers as they work on code

    (white-box style), to ensure that the specific function is working as expected. One

    function might have multiple tests, to catch corner cases or other branches in the

    code. Unit testing alone cannot verify the functionality of a piece of software, but

    rather is used to assure that the building blocks the software uses work

    independently of each other.

    5.1.2 Integration Testing

    Integration testing is any type of software testing that seeks to verify the

    interfaces between components against a software design. Software components

    may be integrated in an iterative way or all together (big bang). Normally the

    former is considered a better practice since it allows interface issues to be

    localized more quickly and fixed.

    Integration testing works to expose defects in the interface and interaction

    between integrated components (modules). Progressively larger group of tested

    software components corresponding to elements of the architectural design and

    integrated and tested until the software works as a system.

    (35)

  • 8/2/2019 An Enhanced Greedy Routing With Anti

    45/45

    5.1.3 System Integration Testing

    System Integration Testing verifies that a system is integrated to any

    external or third party systems defined in the system requirements.

    5.1.4 Regression Testing

    Regression Testing focuses on finding defects after a major code change

    has occurred. Specifically, it seeks to uncover software regressions, or old bugs

    that have come back. Such regressions occur whenever software functionality that

    was previously working correctly stops working as intended. Typically, common

    methods of regression testing include re-running previously run tests and checking

    whether previously fixed faults have re-emerged. They can either be complete, for

    changes added late in the release or deemed to be risky to very shallow, consisting

    of positive tests on each feature, if the changes are early in the release or deemedto be of low risk.

    (36)