SlideShare a Scribd company logo
1 of 23
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
   ?

More Related Content

What's hot

LinuxCon 2015 Linux Kernel Networking Walkthrough
LinuxCon 2015 Linux Kernel Networking WalkthroughLinuxCon 2015 Linux Kernel Networking Walkthrough
LinuxCon 2015 Linux Kernel Networking WalkthroughThomas 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 ExplainedThomas Graf
 
DevConf 2014 Kernel Networking Walkthrough
DevConf 2014   Kernel Networking WalkthroughDevConf 2014   Kernel Networking Walkthrough
DevConf 2014 Kernel Networking WalkthroughThomas 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 bridgingdimuthur
 
Sdnds tw-meetup-2
Sdnds tw-meetup-2Sdnds tw-meetup-2
Sdnds tw-meetup-2Fei Ji Siao
 
Byte blower basic setting full_v2
Byte blower basic setting full_v2Byte blower basic setting full_v2
Byte blower basic setting full_v2Chen-Chih Lee
 
He Pi Xii2003
He Pi Xii2003He Pi Xii2003
He Pi Xii2003FNian
 
Memory Barriers in the Linux Kernel
Memory Barriers in the Linux KernelMemory Barriers in the Linux Kernel
Memory Barriers in the Linux KernelDavidlohr Bueso
 
Virtualized network with openvswitch
Virtualized network with openvswitchVirtualized network with openvswitch
Virtualized network with openvswitchSim Janghoon
 
Hunt For Blue Leader
Hunt For Blue LeaderHunt For Blue Leader
Hunt For Blue LeaderAngelbo
 
Automating linux network performance testing
Automating linux network performance testingAutomating linux network performance testing
Automating linux network performance testingAntonio 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-28Jxck 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 QUICShuya Osaki
 

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
 
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
 
Linux Networking Explained
Linux Networking ExplainedLinux Networking Explained
Linux Networking Explained
 
Staging driver sins
Staging driver sinsStaging driver sins
Staging driver sins
 
DevConf 2014 Kernel Networking Walkthrough
DevConf 2014   Kernel Networking WalkthroughDevConf 2014   Kernel Networking Walkthrough
DevConf 2014 Kernel Networking Walkthrough
 
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
 
Sdnds tw-meetup-2
Sdnds tw-meetup-2Sdnds tw-meetup-2
Sdnds tw-meetup-2
 
Byte blower basic setting full_v2
Byte blower basic setting full_v2Byte blower basic setting full_v2
Byte blower basic setting full_v2
 
He Pi Xii2003
He Pi Xii2003He Pi Xii2003
He Pi Xii2003
 
Memory Barriers in the Linux Kernel
Memory Barriers in the Linux KernelMemory Barriers in the Linux Kernel
Memory Barriers in the Linux Kernel
 
Virtualized network with openvswitch
Virtualized network with openvswitchVirtualized network with openvswitch
Virtualized network with openvswitch
 
Syslog
SyslogSyslog
Syslog
 
QUIC
QUICQUIC
QUIC
 
Hunt For Blue Leader
Hunt For Blue LeaderHunt For Blue Leader
Hunt For Blue Leader
 
Automating linux network performance testing
Automating linux network performance testingAutomating linux network performance testing
Automating linux network performance testing
 
Linux Network Stack
Linux Network StackLinux Network Stack
Linux Network Stack
 
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
 
Geneve
GeneveGeneve
Geneve
 
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)
 
Introduction to QUIC
Introduction to QUICIntroduction to QUIC
Introduction to QUIC
 

Similar to Glomosim adding routing protocol

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 howDingxin Xu
 
RTOS implementation
RTOS implementationRTOS implementation
RTOS implementationRajan Kumar
 
Parallel programming using MPI
Parallel programming using MPIParallel programming using MPI
Parallel programming using MPIAjit Nayak
 
Tornado Web Server Internals
Tornado Web Server InternalsTornado Web Server Internals
Tornado Web Server InternalsPraveen Gollakota
 
Virtual platform
Virtual platformVirtual platform
Virtual platformsean chen
 
Lab report 201001067_201001104
Lab report 201001067_201001104Lab report 201001067_201001104
Lab report 201001067_201001104swena_gupta
 
Lab report 201001067_201001104
Lab report 201001067_201001104Lab report 201001067_201001104
Lab report 201001067_201001104swena_gupta
 
Lab report 201001067_201001104
Lab report 201001067_201001104Lab report 201001067_201001104
Lab report 201001067_201001104swena_gupta
 
Os2 2
Os2 2Os2 2
Os2 2issbp
 
Unix Shell and System Boot Process
Unix Shell and System Boot ProcessUnix Shell and System Boot Process
Unix Shell and System Boot ProcessArvind Krishnaa
 
Pascal script maxbox_ekon_14_2
Pascal script maxbox_ekon_14_2Pascal script maxbox_ekon_14_2
Pascal script maxbox_ekon_14_2Max Kleiner
 
Introduction to MPI
Introduction to MPIIntroduction to MPI
Introduction to MPIyaman dua
 
embeddedc-lecture1-160404055102.pptx
embeddedc-lecture1-160404055102.pptxembeddedc-lecture1-160404055102.pptx
embeddedc-lecture1-160404055102.pptxsangeetaSS
 
Buffer overflow tutorial
Buffer overflow tutorialBuffer overflow tutorial
Buffer overflow tutorialhughpearse
 

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
 
RTOS implementation
RTOS implementationRTOS implementation
RTOS implementation
 
Parallel programming using MPI
Parallel programming using MPIParallel programming using MPI
Parallel programming using MPI
 
Tornado Web Server Internals
Tornado Web Server InternalsTornado Web Server Internals
Tornado Web Server Internals
 
Virtual platform
Virtual platformVirtual platform
Virtual platform
 
project_docs
project_docsproject_docs
project_docs
 
Lab report 201001067_201001104
Lab report 201001067_201001104Lab report 201001067_201001104
Lab report 201001067_201001104
 
Lab report 201001067_201001104
Lab report 201001067_201001104Lab report 201001067_201001104
Lab report 201001067_201001104
 
Lab report 201001067_201001104
Lab report 201001067_201001104Lab report 201001067_201001104
Lab report 201001067_201001104
 
Process management
Process managementProcess management
Process management
 
Os2 2
Os2 2Os2 2
Os2 2
 
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
 
Unix Shell and System Boot Process
Unix Shell and System Boot ProcessUnix Shell and System Boot Process
Unix Shell and System Boot Process
 
Pascal script maxbox_ekon_14_2
Pascal script maxbox_ekon_14_2Pascal script maxbox_ekon_14_2
Pascal script maxbox_ekon_14_2
 
Introduction to MPI
Introduction to MPIIntroduction to MPI
Introduction to MPI
 
Embedded C - Lecture 1
Embedded C - Lecture 1Embedded C - Lecture 1
Embedded C - Lecture 1
 
embeddedc-lecture1-160404055102.pptx
embeddedc-lecture1-160404055102.pptxembeddedc-lecture1-160404055102.pptx
embeddedc-lecture1-160404055102.pptx
 
Buffer overflow tutorial
Buffer overflow tutorialBuffer overflow tutorial
Buffer overflow tutorial
 
Toby3
Toby3Toby3
Toby3
 
xxxx
xxxxxxxx
xxxx
 

More from Kathirvel Ayyaswamy

22cs201 COMPUTER ORGANIZATION AND ARCHITECTURE
22cs201 COMPUTER ORGANIZATION AND ARCHITECTURE22cs201 COMPUTER ORGANIZATION AND ARCHITECTURE
22cs201 COMPUTER ORGANIZATION AND ARCHITECTUREKathirvel Ayyaswamy
 
20CS2021-Distributed Computing module 2
20CS2021-Distributed Computing module 220CS2021-Distributed Computing module 2
20CS2021-Distributed Computing module 2Kathirvel Ayyaswamy
 
Recent Trends in IoT and Sustainability
Recent Trends in IoT and SustainabilityRecent Trends in IoT and Sustainability
Recent Trends in IoT and SustainabilityKathirvel Ayyaswamy
 
18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network Security18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network SecurityKathirvel Ayyaswamy
 
18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network Security18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network SecurityKathirvel Ayyaswamy
 
18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network Security18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network SecurityKathirvel 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 SecurityKathirvel Ayyaswamy
 
18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network Security18CS2005 Cryptography and Network Security
18CS2005 Cryptography and Network SecurityKathirvel Ayyaswamy
 
20CS024 Ethics in Information Technology
20CS024 Ethics in Information Technology20CS024 Ethics in Information Technology
20CS024 Ethics in Information TechnologyKathirvel Ayyaswamy
 

More from Kathirvel Ayyaswamy (20)

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

Recently uploaded

MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxMaryGraceBautista27
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)cama23
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 

Recently uploaded (20)

MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 

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