SlideShare a Scribd company logo
Adding new routing protocols
    in GloMoSim - 2.03




          A.Kathirvel, AP/CSE
B. S. Abdur Rahman University, Chennai
Outline

    Introduction

    Compile simple c program using parsec

    Steps to adding new protocols

    Understanding the coding

    Discussion
Introduction

    Each node in GloMoSim runs a protocol stack.

    Each layer provides a service to the layer above it, by
    using the services of the layers below it.

    Protocols in GloMoSim essentially operate as a finite
    state machine. The occurrence of an event
    corresponds to a transition in the finite state machine.

    The interface between the layers is also event based.

    Each protocol can either create events that make it
    change its own state (or perform some event
    handling), or create events that are processed by
    another protocol.

    To pass data to, or request a service from, an adjacent
    layer, a protocol creates an event for that layer.
Introduction

    At the heart of a protocol model is an Event Dispatcher,
    which consists of a Wait For Event state and one or more
    Event Handler states.

    In the Wait For Event state, the protocol waits for an
    event to occur.

    When an event for the protocol occurs, the protocol
    transitions to the Event Handler state corresponding to
    that event (e.g., when Event 1 occurs, the protocol
    transitions to the Event 1 Handler state).

    In this Event Handler state, the protocol performs the
    actions corresponding to the event, and then returns to
    the Wait For Event state.

    Actions performed in the Event Handler state may include
    updating the protocol state, or scheduling other events, or
    both
Introduction
Introduction

    Besides the Event Dispatcher, the protocol finite state
    machine has two other states: the Initialization state
    and the Finalization state.

    In the Initialization state, the protocol reads external
    input to configure its initial state. The protocol then
    transitions to the Wait For Event state.

    The transition to the Finalization state occurs
    automatically at the end of simulation. In the
    Finalization state, protocol statistics collected during
    the simulation are printed.
Simple program in glomosim
/g lomosim-2.03/glomosim/main
Filename : hello.pc
#include <stdio.h>
int main(int argc, char **argv){
    parsec_main(argc,argv);
    printf("Simulation Endednn");
}
entity driver(int argc, char **argv){
    int i;
    printf("Hello World nn");
}
To Compile the program
[root@localhost main]# vi hello.pc

[root@localhost main]# pcc -clock longlong -lm -c
  hello.pc

[root@localhost main]# pcc -clock longlong
  -user_main hello.o -lm -o hello
Output
[root@localhost main]# ./hello
Hello World


Execution time : 0.0002 sec
Number of events (including timeouts) processed : 0
Number of messages processed : 0
Number of context switches occurred : 6
Number of Local NULL messages sent : 0
Number of Remote NULL messages sent : 0
Total Number of NULL messages sent : 0
Simulation Ended
Pre-Requisition

    Modify and store the protocol

    −   Myprotocol.pc
    −   Myprotocol.h


    In *.pc and *.h the following routines are very important

    −   void RoutingMyprotocolInit( )
    −   void RoutingMyprotocolFinalize( )
Steps to Add a New Routing Protocol

    The files that are to be modified are


    Makent.bat

    Application.pc

    Nwcommon.h

    Network.h

    Nwip.pc
Make file

    Makent.bat (windows)

    Makefile (Linux)


  Network Layer add the line
Makent.bat

  call pcc %parsecflags% -I..include -I..network
  -clock longlong -c ..networkmyprotocol.pc
Makefile

  SIM_HDRS = ../network/aodv.h

  PAR_FILES = ../network/myprotocol.pc
Application.pc file

    The initialisation function of application layer
    should include the code
void
GLOMO_AppInit(GlomoNode *node, const
  GlomoNodeInput *nodeInput)
{

...........
 else if (strcmp(buf, "MYPROTOCOL") == 0) {
..........
 }
Nwcommon.h file

    A protocol number is assigned to MYPROTOCOL by
    adding a #define statement to nwcommon.h.

    The protocol number is unique to each protocol

#define IPPROTO_MYPROTOCOL 501
Network.h file

   MYPROTOCOL should be included in the enumerated
   type NetworkRoutingProtcolType defined in network.h
typedef enum {
    ......
    ROUTING_PROTOCOL_AODV,
    ROUTING_PROTOCOL_DSR,
    ROUTING_PROTOCOL_LAR1,
    ROUTING_PROTOCOL_MYPROTOCOL
.........
} NetworkRoutingProtocolType;
Nwip.pc file

    Include Myprotocol.h as a header file and then
    add the code to the initialize function

    The following 5 changes to be made in the file

    −   #include "myprotocol.h"
    −   Void NetworkIpInitialize( )
    −   Void NetworkIpFinalize( )
    −   Void NetworkIpLayer( )
    −   Static void ProcessPacketForMeFromMac( )
Nwip.pc file

    void NetworkIpInit(GlomoNode* node, const
    GlomoNodeInput* nodeInput)
{
...............
else if (strcmp(protocolString, "MYPROTOCOL") == 0) {
      ipLayer->routingProtocolChoice =
   ROUTING_PROTOCOL_MYPROTOCOL;
      RoutingMyprocotolInit(
         node, (GlomoRoutingMyprotocol**)&ipLayer-
   >routingProtocol, nodeInput);
.....
   }
Nwip.pc file
void NetworkIpFinalize(GlomoNode *node)
{
  GlomoNetworkIp* ipLayer = (GlomoNetworkIp*)node-
  >networkData.networkVar;

   switch (ipLayer->routingProtocolChoice) {
   case ROUTING_PROTOCOL_MYPROTOCOL:
      RoutingMyprotocolFinalize(node);
      break;
.....
}
Nwip.pc file
void NetworkIpLayer(GlomoNode *node, Message *msg)
   {
   switch (msg->protocolType) {
............
   case ROUTING_PROTOCOL_MYPROTOCOL: {
      RoutingMyprotocolHandleProtocolEvent(node, msg);
      break;

.........
   }
Nwip.pc file
static
void ProcessPacketForMeFromMac(GlomoNode *node,
   Message *msg)
{
   GlomoNetworkIp* ipLayer = (GlomoNetworkIp *)node-
   >networkData.networkVar;
   NODE_ADDR sourceAddress;
   NODE_ADDR destinationAddress;
..............
Nwip.pc file
case IPPROTO_MYPROTOCOL: {
      RoutingMyprotocolHandleProtocolPacket(node, msg,
   sourceAddress,
          destinationAddress, ttl);
      break;
   }
...........

}
compile

 Windows
Makent clean
Makent


    Linux

# make clean
# make
Questions
   ?
Ad

More Related Content

What's hot (20)

LinuxCon 2015 Linux Kernel Networking Walkthrough
LinuxCon 2015 Linux Kernel Networking WalkthroughLinuxCon 2015 Linux Kernel Networking Walkthrough
LinuxCon 2015 Linux Kernel Networking Walkthrough
Thomas Graf
 
introduction to linux kernel tcp/ip ptocotol stack
introduction to linux kernel tcp/ip ptocotol stack introduction to linux kernel tcp/ip ptocotol stack
introduction to linux kernel tcp/ip ptocotol stack
monad bobo
 
Linux Networking Explained
Linux Networking ExplainedLinux Networking Explained
Linux Networking Explained
Thomas Graf
 
Staging driver sins
Staging driver sinsStaging driver sins
Staging driver sins
Stephen Hemminger
 
DevConf 2014 Kernel Networking Walkthrough
DevConf 2014   Kernel Networking WalkthroughDevConf 2014   Kernel Networking Walkthrough
DevConf 2014 Kernel Networking Walkthrough
Thomas Graf
 
Chapter 03 configuring link aggregation and bridging
Chapter 03   configuring link aggregation and bridgingChapter 03   configuring link aggregation and bridging
Chapter 03 configuring link aggregation and bridging
dimuthur
 
Sdnds tw-meetup-2
Sdnds tw-meetup-2Sdnds tw-meetup-2
Sdnds tw-meetup-2
Fei Ji Siao
 
Byte blower basic setting full_v2
Byte blower basic setting full_v2Byte blower basic setting full_v2
Byte blower basic setting full_v2
Chen-Chih Lee
 
He Pi Xii2003
He Pi Xii2003He Pi Xii2003
He Pi Xii2003
FNian
 
Memory Barriers in the Linux Kernel
Memory Barriers in the Linux KernelMemory Barriers in the Linux Kernel
Memory Barriers in the Linux Kernel
Davidlohr Bueso
 
Virtualized network with openvswitch
Virtualized network with openvswitchVirtualized network with openvswitch
Virtualized network with openvswitch
Sim Janghoon
 
Syslog
SyslogSyslog
Syslog
SangJung Woo
 
QUIC
QUICQUIC
QUIC
Apache Traffic Server
 
Hunt For Blue Leader
Hunt For Blue LeaderHunt For Blue Leader
Hunt For Blue Leader
Angelbo
 
Automating linux network performance testing
Automating linux network performance testingAutomating linux network performance testing
Automating linux network performance testing
Antonio Ojea Garcia
 
Linux Network Stack
Linux Network StackLinux Network Stack
Linux Network Stack
Adrien Mahieux
 
SPDY & HTTP2.0 & QUIC - #bpstudy 2013-08-28
SPDY & HTTP2.0 & QUIC - #bpstudy 2013-08-28SPDY & HTTP2.0 & QUIC - #bpstudy 2013-08-28
SPDY & HTTP2.0 & QUIC - #bpstudy 2013-08-28
Jxck Jxck
 
Geneve
GeneveGeneve
Geneve
Madhu c
 
Taking Security Groups to Ludicrous Speed with OVS (OpenStack Summit 2015)
Taking Security Groups to Ludicrous Speed with OVS (OpenStack Summit 2015)Taking Security Groups to Ludicrous Speed with OVS (OpenStack Summit 2015)
Taking Security Groups to Ludicrous Speed with OVS (OpenStack Summit 2015)
Thomas Graf
 
Introduction to QUIC
Introduction to QUICIntroduction to QUIC
Introduction to QUIC
Shuya Osaki
 
LinuxCon 2015 Linux Kernel Networking Walkthrough
LinuxCon 2015 Linux Kernel Networking WalkthroughLinuxCon 2015 Linux Kernel Networking Walkthrough
LinuxCon 2015 Linux Kernel Networking Walkthrough
Thomas Graf
 
introduction to linux kernel tcp/ip ptocotol stack
introduction to linux kernel tcp/ip ptocotol stack introduction to linux kernel tcp/ip ptocotol stack
introduction to linux kernel tcp/ip ptocotol stack
monad bobo
 
Linux Networking Explained
Linux Networking ExplainedLinux Networking Explained
Linux Networking Explained
Thomas Graf
 
DevConf 2014 Kernel Networking Walkthrough
DevConf 2014   Kernel Networking WalkthroughDevConf 2014   Kernel Networking Walkthrough
DevConf 2014 Kernel Networking Walkthrough
Thomas Graf
 
Chapter 03 configuring link aggregation and bridging
Chapter 03   configuring link aggregation and bridgingChapter 03   configuring link aggregation and bridging
Chapter 03 configuring link aggregation and bridging
dimuthur
 
Sdnds tw-meetup-2
Sdnds tw-meetup-2Sdnds tw-meetup-2
Sdnds tw-meetup-2
Fei Ji Siao
 
Byte blower basic setting full_v2
Byte blower basic setting full_v2Byte blower basic setting full_v2
Byte blower basic setting full_v2
Chen-Chih Lee
 
He Pi Xii2003
He Pi Xii2003He Pi Xii2003
He Pi Xii2003
FNian
 
Memory Barriers in the Linux Kernel
Memory Barriers in the Linux KernelMemory Barriers in the Linux Kernel
Memory Barriers in the Linux Kernel
Davidlohr Bueso
 
Virtualized network with openvswitch
Virtualized network with openvswitchVirtualized network with openvswitch
Virtualized network with openvswitch
Sim Janghoon
 
Hunt For Blue Leader
Hunt For Blue LeaderHunt For Blue Leader
Hunt For Blue Leader
Angelbo
 
Automating linux network performance testing
Automating linux network performance testingAutomating linux network performance testing
Automating linux network performance testing
Antonio Ojea Garcia
 
SPDY & HTTP2.0 & QUIC - #bpstudy 2013-08-28
SPDY & HTTP2.0 & QUIC - #bpstudy 2013-08-28SPDY & HTTP2.0 & QUIC - #bpstudy 2013-08-28
SPDY & HTTP2.0 & QUIC - #bpstudy 2013-08-28
Jxck Jxck
 
Taking Security Groups to Ludicrous Speed with OVS (OpenStack Summit 2015)
Taking Security Groups to Ludicrous Speed with OVS (OpenStack Summit 2015)Taking Security Groups to Ludicrous Speed with OVS (OpenStack Summit 2015)
Taking Security Groups to Ludicrous Speed with OVS (OpenStack Summit 2015)
Thomas Graf
 
Introduction to QUIC
Introduction to QUICIntroduction to QUIC
Introduction to QUIC
Shuya Osaki
 

Similar to Glomosim adding routing protocol (20)

Contiki introduction II-from what to how
Contiki introduction II-from what to howContiki introduction II-from what to how
Contiki introduction II-from what to how
Dingxin Xu
 
RTOS implementation
RTOS implementationRTOS implementation
RTOS implementation
Rajan Kumar
 
Parallel programming using MPI
Parallel programming using MPIParallel programming using MPI
Parallel programming using MPI
Ajit Nayak
 
Tornado Web Server Internals
Tornado Web Server InternalsTornado Web Server Internals
Tornado Web Server Internals
Praveen Gollakota
 
Virtual platform
Virtual platformVirtual platform
Virtual platform
sean chen
 
project_docs
project_docsproject_docs
project_docs
Andrey Lavrinovic
 
Lab report 201001067_201001104
Lab report 201001067_201001104Lab report 201001067_201001104
Lab report 201001067_201001104
swena_gupta
 
Lab report 201001067_201001104
Lab report 201001067_201001104Lab report 201001067_201001104
Lab report 201001067_201001104
swena_gupta
 
Lab report 201001067_201001104
Lab report 201001067_201001104Lab report 201001067_201001104
Lab report 201001067_201001104
swena_gupta
 
Process management
Process managementProcess management
Process management
Akshay Ithape
 
Os2 2
Os2 2Os2 2
Os2 2
issbp
 
nullcon 2010 - Intelligent debugging and in memory fuzzing
nullcon 2010 - Intelligent debugging and in memory fuzzingnullcon 2010 - Intelligent debugging and in memory fuzzing
nullcon 2010 - Intelligent debugging and in memory fuzzing
n|u - The Open Security Community
 
Unix Shell and System Boot Process
Unix Shell and System Boot ProcessUnix Shell and System Boot Process
Unix Shell and System Boot Process
Arvind Krishnaa
 
Pascal script maxbox_ekon_14_2
Pascal script maxbox_ekon_14_2Pascal script maxbox_ekon_14_2
Pascal script maxbox_ekon_14_2
Max Kleiner
 
Introduction to MPI
Introduction to MPIIntroduction to MPI
Introduction to MPI
yaman dua
 
Embedded C - Lecture 1
Embedded C - Lecture 1Embedded C - Lecture 1
Embedded C - Lecture 1
Mohamed Abdallah
 
embeddedc-lecture1-160404055102.pptx
embeddedc-lecture1-160404055102.pptxembeddedc-lecture1-160404055102.pptx
embeddedc-lecture1-160404055102.pptx
sangeetaSS
 
Buffer overflow tutorial
Buffer overflow tutorialBuffer overflow tutorial
Buffer overflow tutorial
hughpearse
 
Toby
Toby Toby
Toby
TinouTest
 
Toby6
Toby6Toby6
Toby6
TinouTest
 
Contiki introduction II-from what to how
Contiki introduction II-from what to howContiki introduction II-from what to how
Contiki introduction II-from what to how
Dingxin Xu
 
RTOS implementation
RTOS implementationRTOS implementation
RTOS implementation
Rajan Kumar
 
Parallel programming using MPI
Parallel programming using MPIParallel programming using MPI
Parallel programming using MPI
Ajit Nayak
 
Tornado Web Server Internals
Tornado Web Server InternalsTornado Web Server Internals
Tornado Web Server Internals
Praveen Gollakota
 
Virtual platform
Virtual platformVirtual platform
Virtual platform
sean chen
 
Lab report 201001067_201001104
Lab report 201001067_201001104Lab report 201001067_201001104
Lab report 201001067_201001104
swena_gupta
 
Lab report 201001067_201001104
Lab report 201001067_201001104Lab report 201001067_201001104
Lab report 201001067_201001104
swena_gupta
 
Lab report 201001067_201001104
Lab report 201001067_201001104Lab report 201001067_201001104
Lab report 201001067_201001104
swena_gupta
 
Os2 2
Os2 2Os2 2
Os2 2
issbp
 
Unix Shell and System Boot Process
Unix Shell and System Boot ProcessUnix Shell and System Boot Process
Unix Shell and System Boot Process
Arvind Krishnaa
 
Pascal script maxbox_ekon_14_2
Pascal script maxbox_ekon_14_2Pascal script maxbox_ekon_14_2
Pascal script maxbox_ekon_14_2
Max Kleiner
 
Introduction to MPI
Introduction to MPIIntroduction to MPI
Introduction to MPI
yaman dua
 
embeddedc-lecture1-160404055102.pptx
embeddedc-lecture1-160404055102.pptxembeddedc-lecture1-160404055102.pptx
embeddedc-lecture1-160404055102.pptx
sangeetaSS
 
Buffer overflow tutorial
Buffer overflow tutorialBuffer overflow tutorial
Buffer overflow tutorial
hughpearse
 
Ad

More from Kathirvel Ayyaswamy (20)

22CS201 COA
22CS201 COA22CS201 COA
22CS201 COA
Kathirvel Ayyaswamy
 
22cs201 COMPUTER ORGANIZATION AND ARCHITECTURE
22cs201 COMPUTER ORGANIZATION AND ARCHITECTURE22cs201 COMPUTER ORGANIZATION AND ARCHITECTURE
22cs201 COMPUTER ORGANIZATION AND ARCHITECTURE
Kathirvel Ayyaswamy
 
22CS201 COA
22CS201 COA22CS201 COA
22CS201 COA
Kathirvel Ayyaswamy
 
18CS3040_Distributed Systems
18CS3040_Distributed Systems18CS3040_Distributed Systems
18CS3040_Distributed Systems
Kathirvel Ayyaswamy
 
20CS2021-Distributed Computing module 2
20CS2021-Distributed Computing module 220CS2021-Distributed Computing module 2
20CS2021-Distributed Computing module 2
Kathirvel Ayyaswamy
 
18CS3040 Distributed System
18CS3040 Distributed System	18CS3040 Distributed System
18CS3040 Distributed System
Kathirvel Ayyaswamy
 
20CS2021 Distributed Computing
20CS2021 Distributed Computing 20CS2021 Distributed Computing
20CS2021 Distributed Computing
Kathirvel Ayyaswamy
 
20CS2021 DISTRIBUTED COMPUTING
20CS2021 DISTRIBUTED COMPUTING20CS2021 DISTRIBUTED COMPUTING
20CS2021 DISTRIBUTED COMPUTING
Kathirvel Ayyaswamy
 
18CS3040 DISTRIBUTED SYSTEMS
18CS3040 DISTRIBUTED SYSTEMS18CS3040 DISTRIBUTED SYSTEMS
18CS3040 DISTRIBUTED SYSTEMS
Kathirvel Ayyaswamy
 
Recent Trends in IoT and Sustainability
Recent Trends in IoT and SustainabilityRecent Trends in IoT and Sustainability
Recent Trends in IoT and Sustainability
Kathirvel Ayyaswamy
 
20CS2008 Computer Networks
20CS2008 Computer Networks 20CS2008 Computer Networks
20CS2008 Computer Networks
Kathirvel Ayyaswamy
 
18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network Security18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network Security
Kathirvel Ayyaswamy
 
18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network Security18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network Security
Kathirvel Ayyaswamy
 
18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network Security18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network Security
Kathirvel Ayyaswamy
 
18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network Security 18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network Security
Kathirvel Ayyaswamy
 
18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network Security18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network Security
Kathirvel Ayyaswamy
 
18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network Security18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network Security
Kathirvel Ayyaswamy
 
20CS2008 Computer Networks
20CS2008 Computer Networks20CS2008 Computer Networks
20CS2008 Computer Networks
Kathirvel Ayyaswamy
 
20CS2008 Computer Networks
20CS2008 Computer Networks 20CS2008 Computer Networks
20CS2008 Computer Networks
Kathirvel Ayyaswamy
 
20CS024 Ethics in Information Technology
20CS024 Ethics in Information Technology20CS024 Ethics in Information Technology
20CS024 Ethics in Information Technology
Kathirvel Ayyaswamy
 
22cs201 COMPUTER ORGANIZATION AND ARCHITECTURE
22cs201 COMPUTER ORGANIZATION AND ARCHITECTURE22cs201 COMPUTER ORGANIZATION AND ARCHITECTURE
22cs201 COMPUTER ORGANIZATION AND ARCHITECTURE
Kathirvel Ayyaswamy
 
20CS2021-Distributed Computing module 2
20CS2021-Distributed Computing module 220CS2021-Distributed Computing module 2
20CS2021-Distributed Computing module 2
Kathirvel Ayyaswamy
 
Recent Trends in IoT and Sustainability
Recent Trends in IoT and SustainabilityRecent Trends in IoT and Sustainability
Recent Trends in IoT and Sustainability
Kathirvel Ayyaswamy
 
18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network Security18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network Security
Kathirvel Ayyaswamy
 
18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network Security18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network Security
Kathirvel Ayyaswamy
 
18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network Security18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network Security
Kathirvel Ayyaswamy
 
18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network Security 18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network Security
Kathirvel Ayyaswamy
 
18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network Security18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network Security
Kathirvel Ayyaswamy
 
18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network Security18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network Security
Kathirvel Ayyaswamy
 
20CS024 Ethics in Information Technology
20CS024 Ethics in Information Technology20CS024 Ethics in Information Technology
20CS024 Ethics in Information Technology
Kathirvel Ayyaswamy
 
Ad

Recently uploaded (20)

Kumushini_Thennakoon_CAPWIC_slides_.pptx
Kumushini_Thennakoon_CAPWIC_slides_.pptxKumushini_Thennakoon_CAPWIC_slides_.pptx
Kumushini_Thennakoon_CAPWIC_slides_.pptx
kumushiniodu
 
CNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscessCNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscess
Mohamed Rizk Khodair
 
How to Manage Upselling in Odoo 18 Sales
How to Manage Upselling in Odoo 18 SalesHow to Manage Upselling in Odoo 18 Sales
How to Manage Upselling in Odoo 18 Sales
Celine George
 
How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18
Celine George
 
Origin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theoriesOrigin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theories
PrachiSontakke5
 
Lecture 1 Introduction history and institutes of entomology_1.pptx
Lecture 1 Introduction history and institutes of entomology_1.pptxLecture 1 Introduction history and institutes of entomology_1.pptx
Lecture 1 Introduction history and institutes of entomology_1.pptx
Arshad Shaikh
 
How to Create Kanban View in Odoo 18 - Odoo Slides
How to Create Kanban View in Odoo 18 - Odoo SlidesHow to Create Kanban View in Odoo 18 - Odoo Slides
How to Create Kanban View in Odoo 18 - Odoo Slides
Celine George
 
Myasthenia gravis (Neuromuscular disorder)
Myasthenia gravis (Neuromuscular disorder)Myasthenia gravis (Neuromuscular disorder)
Myasthenia gravis (Neuromuscular disorder)
Mohamed Rizk Khodair
 
All About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdfAll About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdf
TechSoup
 
Bridging the Transit Gap: Equity Drive Feeder Bus Design for Southeast Brooklyn
Bridging the Transit Gap: Equity Drive Feeder Bus Design for Southeast BrooklynBridging the Transit Gap: Equity Drive Feeder Bus Design for Southeast Brooklyn
Bridging the Transit Gap: Equity Drive Feeder Bus Design for Southeast Brooklyn
i4jd41bk
 
puzzle Irregular Verbs- Simple Past Tense
puzzle Irregular Verbs- Simple Past Tensepuzzle Irregular Verbs- Simple Past Tense
puzzle Irregular Verbs- Simple Past Tense
OlgaLeonorTorresSnch
 
Kenan Fellows Participants, Projects 2025-26 Cohort
Kenan Fellows Participants, Projects 2025-26 CohortKenan Fellows Participants, Projects 2025-26 Cohort
Kenan Fellows Participants, Projects 2025-26 Cohort
EducationNC
 
What is the Philosophy of Statistics? (and how I was drawn to it)
What is the Philosophy of Statistics? (and how I was drawn to it)What is the Philosophy of Statistics? (and how I was drawn to it)
What is the Philosophy of Statistics? (and how I was drawn to it)
jemille6
 
APGAR SCORE BY sweety Tamanna Mahapatra MSc Pediatric
APGAR SCORE  BY sweety Tamanna Mahapatra MSc PediatricAPGAR SCORE  BY sweety Tamanna Mahapatra MSc Pediatric
APGAR SCORE BY sweety Tamanna Mahapatra MSc Pediatric
SweetytamannaMohapat
 
antiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidenceantiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidence
PrachiSontakke5
 
How to Add Customer Note in Odoo 18 POS - Odoo Slides
How to Add Customer Note in Odoo 18 POS - Odoo SlidesHow to Add Customer Note in Odoo 18 POS - Odoo Slides
How to Add Customer Note in Odoo 18 POS - Odoo Slides
Celine George
 
Rock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian HistoryRock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian History
Virag Sontakke
 
Drugs in Anaesthesia and Intensive Care,.pdf
Drugs in Anaesthesia and Intensive Care,.pdfDrugs in Anaesthesia and Intensive Care,.pdf
Drugs in Anaesthesia and Intensive Care,.pdf
crewot855
 
Herbs Used in Cosmetic Formulations .pptx
Herbs Used in Cosmetic Formulations .pptxHerbs Used in Cosmetic Formulations .pptx
Herbs Used in Cosmetic Formulations .pptx
RAJU THENGE
 
Cultivation Practice of Onion in Nepal.pptx
Cultivation Practice of Onion in Nepal.pptxCultivation Practice of Onion in Nepal.pptx
Cultivation Practice of Onion in Nepal.pptx
UmeshTimilsina1
 
Kumushini_Thennakoon_CAPWIC_slides_.pptx
Kumushini_Thennakoon_CAPWIC_slides_.pptxKumushini_Thennakoon_CAPWIC_slides_.pptx
Kumushini_Thennakoon_CAPWIC_slides_.pptx
kumushiniodu
 
CNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscessCNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscess
Mohamed Rizk Khodair
 
How to Manage Upselling in Odoo 18 Sales
How to Manage Upselling in Odoo 18 SalesHow to Manage Upselling in Odoo 18 Sales
How to Manage Upselling in Odoo 18 Sales
Celine George
 
How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18
Celine George
 
Origin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theoriesOrigin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theories
PrachiSontakke5
 
Lecture 1 Introduction history and institutes of entomology_1.pptx
Lecture 1 Introduction history and institutes of entomology_1.pptxLecture 1 Introduction history and institutes of entomology_1.pptx
Lecture 1 Introduction history and institutes of entomology_1.pptx
Arshad Shaikh
 
How to Create Kanban View in Odoo 18 - Odoo Slides
How to Create Kanban View in Odoo 18 - Odoo SlidesHow to Create Kanban View in Odoo 18 - Odoo Slides
How to Create Kanban View in Odoo 18 - Odoo Slides
Celine George
 
Myasthenia gravis (Neuromuscular disorder)
Myasthenia gravis (Neuromuscular disorder)Myasthenia gravis (Neuromuscular disorder)
Myasthenia gravis (Neuromuscular disorder)
Mohamed Rizk Khodair
 
All About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdfAll About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdf
TechSoup
 
Bridging the Transit Gap: Equity Drive Feeder Bus Design for Southeast Brooklyn
Bridging the Transit Gap: Equity Drive Feeder Bus Design for Southeast BrooklynBridging the Transit Gap: Equity Drive Feeder Bus Design for Southeast Brooklyn
Bridging the Transit Gap: Equity Drive Feeder Bus Design for Southeast Brooklyn
i4jd41bk
 
puzzle Irregular Verbs- Simple Past Tense
puzzle Irregular Verbs- Simple Past Tensepuzzle Irregular Verbs- Simple Past Tense
puzzle Irregular Verbs- Simple Past Tense
OlgaLeonorTorresSnch
 
Kenan Fellows Participants, Projects 2025-26 Cohort
Kenan Fellows Participants, Projects 2025-26 CohortKenan Fellows Participants, Projects 2025-26 Cohort
Kenan Fellows Participants, Projects 2025-26 Cohort
EducationNC
 
What is the Philosophy of Statistics? (and how I was drawn to it)
What is the Philosophy of Statistics? (and how I was drawn to it)What is the Philosophy of Statistics? (and how I was drawn to it)
What is the Philosophy of Statistics? (and how I was drawn to it)
jemille6
 
APGAR SCORE BY sweety Tamanna Mahapatra MSc Pediatric
APGAR SCORE  BY sweety Tamanna Mahapatra MSc PediatricAPGAR SCORE  BY sweety Tamanna Mahapatra MSc Pediatric
APGAR SCORE BY sweety Tamanna Mahapatra MSc Pediatric
SweetytamannaMohapat
 
antiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidenceantiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidence
PrachiSontakke5
 
How to Add Customer Note in Odoo 18 POS - Odoo Slides
How to Add Customer Note in Odoo 18 POS - Odoo SlidesHow to Add Customer Note in Odoo 18 POS - Odoo Slides
How to Add Customer Note in Odoo 18 POS - Odoo Slides
Celine George
 
Rock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian HistoryRock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian History
Virag Sontakke
 
Drugs in Anaesthesia and Intensive Care,.pdf
Drugs in Anaesthesia and Intensive Care,.pdfDrugs in Anaesthesia and Intensive Care,.pdf
Drugs in Anaesthesia and Intensive Care,.pdf
crewot855
 
Herbs Used in Cosmetic Formulations .pptx
Herbs Used in Cosmetic Formulations .pptxHerbs Used in Cosmetic Formulations .pptx
Herbs Used in Cosmetic Formulations .pptx
RAJU THENGE
 
Cultivation Practice of Onion in Nepal.pptx
Cultivation Practice of Onion in Nepal.pptxCultivation Practice of Onion in Nepal.pptx
Cultivation Practice of Onion in Nepal.pptx
UmeshTimilsina1
 

Glomosim adding routing protocol

  • 1. Adding new routing protocols in GloMoSim - 2.03 A.Kathirvel, AP/CSE B. S. Abdur Rahman University, Chennai
  • 2. Outline  Introduction  Compile simple c program using parsec  Steps to adding new protocols  Understanding the coding  Discussion
  • 3. Introduction  Each node in GloMoSim runs a protocol stack.  Each layer provides a service to the layer above it, by using the services of the layers below it.  Protocols in GloMoSim essentially operate as a finite state machine. The occurrence of an event corresponds to a transition in the finite state machine.  The interface between the layers is also event based.  Each protocol can either create events that make it change its own state (or perform some event handling), or create events that are processed by another protocol.  To pass data to, or request a service from, an adjacent layer, a protocol creates an event for that layer.
  • 4. Introduction  At the heart of a protocol model is an Event Dispatcher, which consists of a Wait For Event state and one or more Event Handler states.  In the Wait For Event state, the protocol waits for an event to occur.  When an event for the protocol occurs, the protocol transitions to the Event Handler state corresponding to that event (e.g., when Event 1 occurs, the protocol transitions to the Event 1 Handler state).  In this Event Handler state, the protocol performs the actions corresponding to the event, and then returns to the Wait For Event state.  Actions performed in the Event Handler state may include updating the protocol state, or scheduling other events, or both
  • 6. Introduction  Besides the Event Dispatcher, the protocol finite state machine has two other states: the Initialization state and the Finalization state.  In the Initialization state, the protocol reads external input to configure its initial state. The protocol then transitions to the Wait For Event state.  The transition to the Finalization state occurs automatically at the end of simulation. In the Finalization state, protocol statistics collected during the simulation are printed.
  • 7. Simple program in glomosim /g lomosim-2.03/glomosim/main Filename : hello.pc #include <stdio.h> int main(int argc, char **argv){ parsec_main(argc,argv); printf("Simulation Endednn"); } entity driver(int argc, char **argv){ int i; printf("Hello World nn"); }
  • 8. To Compile the program [root@localhost main]# vi hello.pc [root@localhost main]# pcc -clock longlong -lm -c hello.pc [root@localhost main]# pcc -clock longlong -user_main hello.o -lm -o hello
  • 9. Output [root@localhost main]# ./hello Hello World Execution time : 0.0002 sec Number of events (including timeouts) processed : 0 Number of messages processed : 0 Number of context switches occurred : 6 Number of Local NULL messages sent : 0 Number of Remote NULL messages sent : 0 Total Number of NULL messages sent : 0 Simulation Ended
  • 10. Pre-Requisition  Modify and store the protocol − Myprotocol.pc − Myprotocol.h  In *.pc and *.h the following routines are very important − void RoutingMyprotocolInit( ) − void RoutingMyprotocolFinalize( )
  • 11. Steps to Add a New Routing Protocol  The files that are to be modified are  Makent.bat  Application.pc  Nwcommon.h  Network.h  Nwip.pc
  • 12. Make file  Makent.bat (windows)  Makefile (Linux)  Network Layer add the line Makent.bat  call pcc %parsecflags% -I..include -I..network -clock longlong -c ..networkmyprotocol.pc Makefile  SIM_HDRS = ../network/aodv.h  PAR_FILES = ../network/myprotocol.pc
  • 13. Application.pc file  The initialisation function of application layer should include the code void GLOMO_AppInit(GlomoNode *node, const GlomoNodeInput *nodeInput) { ........... else if (strcmp(buf, "MYPROTOCOL") == 0) { .......... }
  • 14. Nwcommon.h file  A protocol number is assigned to MYPROTOCOL by adding a #define statement to nwcommon.h.  The protocol number is unique to each protocol #define IPPROTO_MYPROTOCOL 501
  • 15. Network.h file  MYPROTOCOL should be included in the enumerated type NetworkRoutingProtcolType defined in network.h typedef enum { ...... ROUTING_PROTOCOL_AODV, ROUTING_PROTOCOL_DSR, ROUTING_PROTOCOL_LAR1, ROUTING_PROTOCOL_MYPROTOCOL ......... } NetworkRoutingProtocolType;
  • 16. Nwip.pc file  Include Myprotocol.h as a header file and then add the code to the initialize function  The following 5 changes to be made in the file − #include "myprotocol.h" − Void NetworkIpInitialize( ) − Void NetworkIpFinalize( ) − Void NetworkIpLayer( ) − Static void ProcessPacketForMeFromMac( )
  • 17. Nwip.pc file  void NetworkIpInit(GlomoNode* node, const GlomoNodeInput* nodeInput) { ............... else if (strcmp(protocolString, "MYPROTOCOL") == 0) { ipLayer->routingProtocolChoice = ROUTING_PROTOCOL_MYPROTOCOL; RoutingMyprocotolInit( node, (GlomoRoutingMyprotocol**)&ipLayer- >routingProtocol, nodeInput); ..... }
  • 18. Nwip.pc file void NetworkIpFinalize(GlomoNode *node) { GlomoNetworkIp* ipLayer = (GlomoNetworkIp*)node- >networkData.networkVar; switch (ipLayer->routingProtocolChoice) { case ROUTING_PROTOCOL_MYPROTOCOL: RoutingMyprotocolFinalize(node); break; ..... }
  • 19. Nwip.pc file void NetworkIpLayer(GlomoNode *node, Message *msg) { switch (msg->protocolType) { ............ case ROUTING_PROTOCOL_MYPROTOCOL: { RoutingMyprotocolHandleProtocolEvent(node, msg); break; ......... }
  • 20. Nwip.pc file static void ProcessPacketForMeFromMac(GlomoNode *node, Message *msg) { GlomoNetworkIp* ipLayer = (GlomoNetworkIp *)node- >networkData.networkVar; NODE_ADDR sourceAddress; NODE_ADDR destinationAddress; ..............
  • 21. Nwip.pc file case IPPROTO_MYPROTOCOL: { RoutingMyprotocolHandleProtocolPacket(node, msg, sourceAddress, destinationAddress, ttl); break; } ........... }
  • 22. compile  Windows Makent clean Makent  Linux # make clean # make