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

Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxAmanpreet Kaur
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdfssuserdda66b
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 

Recently uploaded (20)

Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 

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