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

APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...Pooja Nehwal
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 

Recently uploaded (20)

APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 

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