NetSim Source Code Help
Loading...
Searching...
No Matches
PIM_SM.h
Go to the documentation of this file.
1/************************************************************************************
2* Copyright (C) 2020 *
3* TETCOS, Bangalore. India *
4* *
5* Tetcos owns the intellectual property rights in the Product and its content. *
6* The copying, redistribution, reselling or publication of any or all of the *
7* Product or its content without express prior written consent of Tetcos is *
8* prohibited. Ownership and / or any other right relating to the software and all *
9* intellectual property rights therein shall remain at all times with Tetcos. *
10* *
11* Author: Shashi Kant Suman *
12* *
13* ---------------------------------------------------------------------------------*/
14/*
15Internet Engineering Task Force (IETF)
16Request for Comments: 7761
17STD: 83
18Obsoletes: 4601
19Category: Standards Track
20ISSN: 2070-1721
21
22Protocol Independent Multicast - Sparse Mode (PIM-SM):
23Protocol Specification (Revised)
24
25*/
26#pragma once
27#ifndef _NETSIM_PIM_SM_H_
28#define _NETSIM_PIM_SM_H_
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33//#define PRINT_RPT_TREE
34
35#define time_interval UINT16 // In millisecond
36#define Propagation_delay_default 500 // millisecond
37#define t_override_default 2500 // millisecond
38
39 //Config parameter
40#define PIM_HELLO_PERIOD_DEFAULT 30 //Second
41#define PIM_TRIGGERED_HELLO_DELAY_DEFAULT 5 //Second
42#define PIM_DR_PRIORITY_DEFAULT 1
43#define PIM_PROPAGATION_DELAY_DEFAULT Propagation_delay_default
44#define PIM_OVERRIDE_INTERVAL_DEFAULT t_override_default
45#define PIM_T_PERIODIC_DEFAULT 60 //Second
46
47 //Const
49
50 typedef enum
51 {
54 }EN_DIS;
55
56 typedef enum
57 {
61 }LMS;
62
63 typedef enum
64 {
65 JPS_NI, // NoInfo
66 JPS_J, // Join
67 JPS_PP, // Prune-pending
68 JPS_P, // Prune
69 JPS_JP, // Join-Pending
70 }JPS;
71
72 typedef enum
73 {
74 AWS_NI, // NoInfo
75 AWS_L, // I lost assert
76 AWS_W, // I Won assert
77 }AWS;
78
79 typedef enum
80 {
85 }UJPS;
86
88 {
90
93 double NLT;
95
96 typedef struct stru_pim_state
97 {
104
105 //General purpose state -- For each Interface
111 {
115
116 //(*,G) State -- For each interface
119 double PPT; // Prune-pending timer
120 double ET; // Join/Prune expiry timer
122 double AT; // Assert Timer
123 NETSIM_IPAddress assertWinner; // Assert winner IP address
124 UINT assertWinnerMetric; // Assert winner assert metric
125
126 //(*,G) state -- For not interface specific
128 double JT; // Upstream join/prune timer
131
132 //(S,G) state -- For each interface
133 //same as (*,G) state
134
135 //(S,G) State -- For not interface specific. Extra from (*,G) state
136 bool sptBit;
137 double KAT; // (S,G) keep alive timer
139 double RST; //Register-stop timer
140
141 //(S,G,RPT) state -- Extra from above
142 double OT; // Override timer
143
146#define PIM_STATE_ALLOC() (ptrPIM_STATE)list_alloc(sizeof(PIM_STATE),offsetof(PIM_STATE,ele))
147#define PIM_STATE_NEXT(state) state = (ptrPIM_STATE)LIST_NEXT(state)
148#define PIM_STATE_ADD(l,m) LIST_ADD_LAST((void**)l,m)
149
150 typedef struct stru_pim_JP_state
151 {
153 double PPT;
154 double ET;
156
157 typedef struct stru_pim_neighbor
158 {
166 double timeout;
167
170 UINT16 propagation_delay; //In millisecond
171 UINT16 override_interval; //In millisecond
172
175
178#define PIM_NEIGHBOR_ALLOC() (ptrPIM_NEIGHBOR)list_alloc(sizeof(PIM_NEIGHBOR),offsetof(PIM_NEIGHBOR,ele))
179#define PIM_NEIGHBOR_NEXT(neigh) neigh = (ptrPIM_NEIGHBOR)LIST_NEXT(neigh)
180#define PIM_NEIGHBOR_ADD(l,m) LIST_ADD_LAST((void**)l,m)
181
182 typedef struct stru_pim_group
183 {
188
189 //(*,G) State
191
192 //Forward Interface
195
198#define PIM_GROUP_ALLOC() (ptrPIM_GROUP)list_alloc(sizeof(PIM_GROUP),offsetof(PIM_GROUP,ele))
199#define PIM_GROUP_NEXT(gr) gr = (ptrPIM_GROUP)LIST_NEXT(gr)
200#define PIM_GROUP_ADD(l,m) LIST_ADD_LAST((void**)l,m)
201
202
203 typedef struct stru_pim_var
204 {
206
210
213
215
217
218 //Config parameter
226#define GET_PIM_VAR(d) ((ptrPIM_VAR)(GET_IP_DEVVAR(d)->pim))
227#define SET_PIM_VAR(d,var) (GET_IP_DEVVAR(d)->pim = (void*)var)
228
229 //Function prototype
231 double time,
232 IP_SUBEVENT eve,
233 NETSIM_IPAddress groupAddress);
234 void configure_PIM();
235
236 //PIM Route
238 NETSIM_ID i,
239 UINT metric,
240 NETSIM_IPAddress dest);
242 int pim_route_msg();
243
244 //PIM Neighbor
247 NETSIM_ID ifId,
248 NETSIM_IPAddress address);
249 void elect_DR(NETSIM_ID d, NETSIM_ID ifid);
250
251 //PIM Group
255
256 //PIM MSG
257 void send_hello_msg(NETSIM_ID d, double time);
259
260 //PIM Join
261 void pim_send_joinprune(NETSIM_ID d, double time, ptrPIM_GROUP group);
262 bool pim_process_join();
263
264 //Utility
265 void print_pim_sm_log(char* format, ...);
267
268#ifdef __cplusplus
269}
270#endif
271#endif
unsigned int NETSIM_ID
Definition: Animation.h:45
GROUP_MOBILITY * group
Definition: GroupMobility.c:30
IP_SUBEVENT
Enumeration for ip sub-events.
Definition: IP.h:92
#define UINT
Definition: Linux.h:38
#define UINT16
Definition: Linux.h:33
void pim_add_interface_to_group(NETSIM_ID d, NETSIM_ID i, ptrPIM_GROUP g)
Definition: PIM_Group.c:56
void elect_DR(NETSIM_ID d, NETSIM_ID ifid)
Definition: PIM_Neighbor.c:95
void pim_route_add(NETSIM_ID d, NETSIM_ID i, UINT metric, NETSIM_IPAddress dest)
Definition: PIM_Route.c:72
LMS
Definition: PIM_SM.h:57
@ LMS_NoInfo
Definition: PIM_SM.h:58
@ LMS_Exclude
Definition: PIM_SM.h:60
@ LMS_Include
Definition: PIM_SM.h:59
void pim_add_timeout_event(NETSIM_ID d, double time, IP_SUBEVENT eve, NETSIM_IPAddress groupAddress)
Definition: PIM_SM.c:50
NETSIM_IPAddress pimroute_find_nexthop(NETSIM_ID d, NETSIM_IPAddress dest)
Definition: PIM_Route.c:165
void configure_PIM()
Definition: PIM_Config.c:34
struct stru_pim_state * ptrPIM_STATE
struct stru_pim_neighbor_state PIM_NEIGH_STATE
struct stru_pim_JP_state PIM_JP_STATE
void send_hello_msg(NETSIM_ID d, double time)
Definition: PIM_Hello.c:142
struct stru_pim_neighbor * ptrPIM_NEIGHBOR
struct stru_pim_var * ptrPIM_VAR
void print_RPT_Tree(NETSIM_ID rp, ptrPIM_GROUP group)
Definition: PIM_Print.c:59
ptrPIM_GROUP create_group(NETSIM_ID d, NETSIM_IPAddress addr, NETSIM_IPAddress RP)
Definition: PIM_Group.c:32
AWS
Definition: PIM_SM.h:73
@ AWS_L
Definition: PIM_SM.h:75
@ AWS_W
Definition: PIM_SM.h:76
@ AWS_NI
Definition: PIM_SM.h:74
UJPS
Definition: PIM_SM.h:80
@ UJPS_Joined
Definition: PIM_SM.h:82
@ UJPS_NotJoined
Definition: PIM_SM.h:81
@ UJPS_Pruned
Definition: PIM_SM.h:84
@ UJPS_NotPruned
Definition: PIM_SM.h:83
NETSIM_IPAddress ALL_PIM_ROUTERS_ADDRESS
Definition: PIM_SM.h:48
bool process_pim_hello_packet()
Definition: PIM_Hello.c:162
struct stru_pim_group PIM_GROUP
void pim_send_joinprune(NETSIM_ID d, double time, ptrPIM_GROUP group)
Definition: PIM_Join.c:128
ptrPIM_NEIGHBOR find_neighbor(NETSIM_ID d, NETSIM_IPAddress ip)
Definition: PIM_Neighbor.c:20
struct stru_pim_neighbor PIM_NEIGHBOR
ptrPIM_GROUP pim_find_group(NETSIM_ID d, NETSIM_IPAddress addr)
Definition: PIM_Group.c:20
int pim_route_msg()
Definition: PIM_Route_Msg.c:59
struct stru_pim_neighbor_state * ptrPIM_NEIGH_STATE
struct stru_pim_JP_state * ptrPIM_JP_STATE
bool pim_process_join()
Definition: PIM_Join.c:193
void print_pim_sm_log(char *format,...)
Definition: PIM_SM.c:38
EN_DIS
Definition: PIM_SM.h:51
@ ENABLE
Definition: PIM_SM.h:53
@ DISABLE
Definition: PIM_SM.h:52
ptrPIM_NEIGHBOR create_and_add_neighbor(NETSIM_ID d, NETSIM_ID ifId, NETSIM_IPAddress address)
Definition: PIM_Neighbor.c:46
struct stru_pim_group * ptrPIM_GROUP
struct stru_pim_state PIM_STATE
JPS
Definition: PIM_SM.h:64
@ JPS_JP
Definition: PIM_SM.h:69
@ JPS_J
Definition: PIM_SM.h:66
@ JPS_P
Definition: PIM_SM.h:68
@ JPS_NI
Definition: PIM_SM.h:65
@ JPS_PP
Definition: PIM_SM.h:67
struct stru_pim_var PIM_VAR
Definition: List.h:43
_ele * ele
Definition: PIM_SM.h:196
NETSIM_IPAddress RP
Definition: PIM_SM.h:186
UINT count
Definition: PIM_SM.h:193
ptrPIM_JP_STATE * jpState_G
Definition: PIM_SM.h:190
NETSIM_ID RPId
Definition: PIM_SM.h:187
NETSIM_ID * ifid
Definition: PIM_SM.h:194
NETSIM_ID groupId
Definition: PIM_SM.h:184
NETSIM_IPAddress groupAddress
Definition: PIM_SM.h:185
NETSIM_IPAddress address
Definition: PIM_SM.h:89
NETSIM_IPAddress neighborAddr
Definition: PIM_SM.h:160
UINT16 propagation_delay
Definition: PIM_SM.h:170
bool tracking_support
Definition: PIM_SM.h:169
double timeout
Definition: PIM_SM.h:166
UINT16 override_interval
Definition: PIM_SM.h:171
NETSIM_IPAddress * secondary_address_list
Definition: PIM_SM.h:174
bool dr_priority_present
Definition: PIM_SM.h:164
bool lan_prune_delay_present
Definition: PIM_SM.h:168
NETSIM_ID neighborId
Definition: PIM_SM.h:159
NETSIM_ID incomingInterface
Definition: PIM_SM.h:161
bool isTimeoutAdded
Definition: PIM_SM.h:165
UINT16 dr_priority
Definition: PIM_SM.h:163
UINT secondary_address_count
Definition: PIM_SM.h:173
NETSIM_IPAddress DRIPaddress
Definition: PIM_SM.h:112
double PPT
Definition: PIM_SM.h:119
_ele * ele
Definition: PIM_SM.h:144
NETSIM_ID groupId
Definition: PIM_SM.h:99
double RST
Definition: PIM_SM.h:139
double JT
Definition: PIM_SM.h:128
AWS AWSState
Definition: PIM_SM.h:121
JPS registerState
Definition: PIM_SM.h:138
NETSIM_IPAddress assertWinner
Definition: PIM_SM.h:123
UINT lastRPUsed
Definition: PIM_SM.h:129
JPS JPSState
Definition: PIM_SM.h:118
double AT
Definition: PIM_SM.h:122
UJPS UJPSState
Definition: PIM_SM.h:127
double OT
Definition: PIM_SM.h:142
struct stru_pim_state::stru_DR_state DR_STATE
EN_DIS suppressionState
Definition: PIM_SM.h:108
double ET
Definition: PIM_SM.h:120
NETSIM_ID sourceId
Definition: PIM_SM.h:101
UINT lastRPFNeigh
Definition: PIM_SM.h:130
bool sptBit
Definition: PIM_SM.h:136
UINT assertWinnerMetric
Definition: PIM_SM.h:124
NETSIM_ID rptId
Definition: PIM_SM.h:103
ptrPIM_NEIGH_STATE * neighState
Definition: PIM_SM.h:109
double effProppagationDelay
Definition: PIM_SM.h:107
LMS LMSState
Definition: PIM_SM.h:117
NETSIM_IPAddress groupAddress
Definition: PIM_SM.h:100
double KAT
Definition: PIM_SM.h:137
NETSIM_IPAddress sourceAddress
Definition: PIM_SM.h:102
NETSIM_ID interfaceId
Definition: PIM_SM.h:98
double effOverrideInterval
Definition: PIM_SM.h:106
double triggeredHelloDelay
Definition: PIM_SM.h:220
UINT neighCount
Definition: PIM_SM.h:207
NETSIM_IPAddress * DR
Definition: PIM_SM.h:209
UINT groupCount
Definition: PIM_SM.h:211
UINT genId
Definition: PIM_SM.h:216
ptrPIM_GROUP groupList
Definition: PIM_SM.h:212
ptrPIM_NEIGHBOR neighborList
Definition: PIM_SM.h:208
ptrPIM_STATE pimState
Definition: PIM_SM.h:214
UINT16 propagationDelay
Definition: PIM_SM.h:223
double t_periodic
Definition: PIM_SM.h:221
UINT16 overrideInterval
Definition: PIM_SM.h:224
UINT DRPriority
Definition: PIM_SM.h:222
UINT interfaceCount
Definition: PIM_SM.h:205
double helloPeriod
Definition: PIM_SM.h:219