170 likes | 325 Views
Adding a New Routing Protocol. Authors : Jeong GangHee Updated by Park YoonYoung. by Jeong - Ganghee. Step 1) Let QualNet know SRIP as a network layer protocol In the file include/ network.h. enum NetworkRoutingProtocolType { … ROUTING_PROTOCOL_SRIP , … }.
E N D
Adding a New Routing Protocol Authors : JeongGangHee Updated by Park YoonYoung by Jeong - Ganghee Advanced Operating System – Spring 2012
Advanced Operating System – Spring 2012 • Step 1) Let QualNet know SRIP as a network layer protocol • In the file include/network.h enumNetworkRoutingProtocolType { … ROUTING_PROTOCOL_SRIP, … } Make SRIP Recognized by QualNet
Advanced Operating System – Spring 2012 • Step 2)Let QualNet know SRIP as a network layer protocol • In the file include/network.h enumNetworkRoutingAdminDistanceType { … ROUTING_ADMIN_DISTANCE_SRIP, … } Make SRIP Recognized by QualNet
Advanced Operating System – Spring 2012 • Step 3) Let QualNet know SRIP as a network layer protocol • In the file include/trace.h enumTraceProtocolType { … TRACE_SRIP, … } Make SRIP Recognized by QualNet
Advanced Operating System – Spring 2012 • Step 4) Let IP module know SRIP as an IP protocol • In the file libraries/developer/src/network_ip.h // EndIARP #defineIPPROTO_SRIP number //InsertPatch ROUTING_IPPROTO 211 Make SRIP Recognized by QualNet
Advanced Operating System – Spring 2012 • Step 5) Have IP module recognize the five entry functions of SRIP • Have the file libraries/developer/src/network_ip.cppinclude routing_srip.h #include <stdio.h> #include <stdlib.h> #include <string.h> … //InsertPatch HEADER_FILES #include “routing_srip.h” Make SRIP Recognized by QualNet
Advanced Operating System – Spring 2012 • Step 6) Have IP initialize SRIP if specified in the configuration file • In the file network_ip.cpp, function NetworkIpParseAndSetRoutingProtocolType() … else if (strcmp(protocolString, “SRIP”) == 0) { routingProtocolType = ROUTING_PROTOCOL_SRIP; } else if (strcmp(protocolString, “NONE”) == 0) Make SRIP Recognized by QualNet
Advanced Operating System – Spring 2012 • Step 7) Have IP initialize SRIP • In the file network_ip.cpp, function IpRoutingInit() #endif // NETSEC_LIB case ROUTING_PROTOCOL_SRIP: { if(!NetworkIpGetRoutingProtocol(node, ROUTING_PROTOCOL_SRIP)) SripInit(node, (SripData**)&ip->interfaceInfo[i]->routingProtocol, nodeInput, i); else NetworkIpUpdateUnicastRoutingProtocoAndRouterFunction( node, ROUTING_PROTOCOL_SRIP, i): break; } Make SRIP Recognized by QualNet
Advanced Operating System – Spring 2012 • Step 8) When the network layer receives an event for SRIP, dispatch it to SRIP’s event handling function • In the file network_ip.cpp, function NetworkIpLayer() // InsertPatch NETWORK_IP_LAYER caseROUTING_PROTOCOL_SRIP: { SripHandleProtocolEvent(node, msg); break; } Make SRIP Recognized by QualNet
Advanced Operating System – Spring 2012 • Step 9) When IP receives an SRIP route advertisement packet, dispatch it to SRIP’s packet handling function • In the file network_ip.cpp, function DeliverPacket() caseIPPROTO_SRIP: { if(NetworkIpGetUnicastRoutingProtocolType(node, interfaceIndex) == ROUTING_PROTOCOL_SRIP) { SripHandleProtocolPacket(node, msg, sourceAddr); } else { MESSAGE_Free(node, msg); } break; } // InsertPatchNETWORK_HANDLE_PACKET Make SRIP Recognized by QualNet
Advanced Operating System – Spring 2012 • Step 10) Call SRIP’s finalizing function when IP is terminating • In the file network_ip.cpp, function NetworkIpFinalize() // InsertPatchNETWORK_HANDLE_PACKET caseROUTING_PROTOCOL_SRIP: { SripFinalize(node); break; } Make SRIP Recognized by QualNet
Advanced Operating System – Spring 2012 • Step 11) Put SRIP source files (routing_srip.h/cpp) into the directory libraries/developer/src/ • Edit libraries/developer/Makefile-common • Add routing_srip.cpp to DEVELOPER_SRCS macro as the following # # common sources #DEVELOPER_SRCS = \ $(DEVELOPER_SRCDIR)/adaptation_aal5.cpp \ $(DEVELOPER_SRCDIR)/routing_srip.cpp \ Compiling QualNet with SRIP
Advanced Operating System – Spring 2012 cd $(QUALNET_HOME)/main nmake • Step 12) Rebuild QualNet executable: Compiling QualNet with SRIP
Advanced Operating System – Spring 2012 • Step 13) In $(QUALNET_HOME)/scenarios/default directory, • copy default.config into srip.config, • then modify/add the following parameters: EXPERIMENT-NAMEsrip #… ROUTING-PROTOCOLSRIP SRIP-UPDATE-INTERVAL10s #… Creating a configuration file for SRIP
Advanced Operating System – Spring 2012 • Step 14) In $(QUALNET_HOME)/bin directory, run qualnet on the SRIP configuration file: • Check srip.stat file to find SRIP’s statistics #cd $(QUALNET_HOME)/bin #qualnetsrip.config Testing the Protocol
Advanced Operating System – Spring 2012 • Step 15) In $(QUALNET_HOME)/gui/settings/protocol-models directory, routing-protocols.prt file: • Update this xml file • Insert SRIP to Qualnet GUI tool <option value=“SRIP” name=“SRIP”> <variable Key=“SRIP-UPDATE-INTERVAL” type=“Time” name=“SRIP Updated” default=“8s” /> </option> Insert SRIP to GUI menu