NetSim Source Code Help
Loading...
Searching...
No Matches
IGMP.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  stru_igmp_msg
 
struct  stru_host_database
 
struct  stru_igmp_host
 
struct  stru_router_database
 
struct  stru_igmp_router
 
struct  stru_igmpvar
 

Macros

#define _NETSIM_IGMP_H_
 
#define IGMP_ROBUSTNESS_VARIABLE_DEFAULT   2
 
#define IGMP_QUERY_INTERVAL_DEFAULT   125
 
#define IGMP_QUERY_RESPONSE_INTERVAL_DEFAULT   100
 
#define IGMP_GROUP_MEMBERSHIP_INTERVAL_DEFAULT
 
#define IGMP_QUERIER_PRESENT_INTERVAL_DEFAULT
 
#define IGMP_STARTUP_QUERY_INTERVAL_DEFAULT   (1/4.0*IGMP_QUERY_INTERVAL_DEFAULT)
 
#define IGMP_STARTUP_QUERY_COUNT_DEFAULT   IGMP_ROBUSTNESS_VARIABLE_DEFAULT
 
#define IGMP_LAST_MEMBER_QUERY_INTERVAL_DEFAULT   10
 
#define IGMP_LAST_MEMBER_QUERY_COUNT_DEFAULT   IGMP_ROBUSTNESS_VARIABLE_DEFAULT
 
#define IGMP_UNSOLICITED_REPORT_INTERVAL_DEFAULT   (10)
 
#define IGMP_STARTUP_DELAY   1*MILLISECOND
 
#define isBroadcastInterface(d, i)   (DEVICE_INTERFACE(d,i)->nInterfaceType != INTERFACE_WAN_ROUTER)
 
#define isIGMPPacket(packet)   (packet->nControlDataType / 100 == NW_PROTOCOL_IPV4 && packet->nControlDataType % 100 >= 30 && packet->nControlDataType % 100 < 40)
 
#define IGMP_HDR_SIZE   8
 
#define IGMP_HOST_DB_ALLOC()   (ptrIGMP_HOST_DB)list_alloc(sizeof(IGMP_HOST_DB),offsetof(IGMP_HOST_DB,ele))
 
#define IGMP_HOST_DB_ADD(d, db)   LIST_ADD_LAST((void**)&GET_IGMP_HOST(d)->database,db)
 
#define IGMP_ROUTER_DB_ALLOC()   (ptrIGMP_ROUTER_DB)list_alloc(sizeof(IGMP_ROUTER_DB),offsetof(IGMP_ROUTER_DB,ele))
 
#define IGMP_ROUTER_DB_ADD(d, db)   LIST_ADD_LAST((void**)&GET_IGMP_ROUTER(d)->database,db)
 
#define GET_IGMP_VAR(d)   ((ptrIGMP_VAR)GET_IP_DEVVAR(d)->igmp)
 
#define SET_IGMP_VAR(d, var)   (GET_IP_DEVVAR(d)->igmp = (void*)var)
 
#define isIPHOST(d)   (GET_IGMP_VAR(d)->devType == IP_HOST)
 
#define isIPRouter(d)   (GET_IGMP_VAR(d)->devType == IP_ROUTER)
 
#define GET_IGMP_HOST(d)   ((ptrIGMP_HOST)(GET_IGMP_VAR(d)->DEV.host))
 
#define GET_IGMP_ROUTER(d)   ((ptrIGMP_ROUTER)(GET_IGMP_VAR(d)->DEV.router))
 
#define SET_IGMP_HOST(d, var)   (GET_IGMP_VAR(d)->DEV.host = var)
 
#define SET_IGMP_ROUTER(d, var)   (GET_IGMP_VAR(d)->DEV.router = var)
 

Typedefs

typedef struct stru_igmp_msg IGMP_MSG
 
typedef struct stru_igmp_msgptrIGMP_MSG
 
typedef struct stru_host_database IGMP_HOST_DB
 
typedef struct stru_host_databaseptrIGMP_HOST_DB
 
typedef struct stru_igmp_host IGMP_HOST
 
typedef struct stru_igmp_hostptrIGMP_HOST
 
typedef struct stru_router_database IGMP_ROUTER_DB
 
typedef struct stru_router_databaseptrIGMP_ROUTER_DB
 
typedef struct stru_igmp_router IGMP_ROUTER
 
typedef struct stru_igmp_routerptrIGMP_ROUTER
 
typedef struct stru_igmpvar IGMP_VAR
 
typedef struct stru_igmpvarptrIGMP_VAR
 

Enumerations

enum  DEV_TYPE { IP_HOST , IP_ROUTER }
 
enum  IGMPMSG_TYPE { IGMPMSG_MembershipQuery = 0x11 , IGMPMSG_V2MembershipReport = 0x16 , IGMPMSG_LeaveGroup = 0x17 , IGMPMSG_V1MembershipReport = 0x12 }
 
enum  IGMP_HOST_STATE { HostState_NonMember , HostState_IdleMember , HostState_DelayingMember }
 
enum  IGMP_ROUTER_STATE { RouterState_Querier , RouterState_NonQuerier }
 

Functions

void igmp_router_init (NETSIM_ID d)
 
ptrIGMP_ROUTER_DB find_or_alloc_multicast_db_router (NETSIM_IPAddress addr, NETSIM_ID d, bool *isAlreadyJoined)
 
ptrIGMP_ROUTER_DB router_get_multicast_db (NETSIM_ID d, NETSIM_IPAddress ip)
 
bool router_process_report (NetSim_PACKET *packet, ptrIGMP_MSG msg, NETSIM_ID d)
 
bool router_process_query (NetSim_PACKET *packet, ptrIGMP_MSG msg, NETSIM_ID d)
 
void router_free (NETSIM_ID d)
 
void igmp_host_init (NETSIM_ID d)
 
ptrIGMP_HOST_DB host_get_multicast_db (NETSIM_ID d, NETSIM_IPAddress addr)
 
bool host_process_report (NetSim_PACKET *packet, ptrIGMP_MSG msg, NETSIM_ID d)
 
bool host_process_query (NetSim_PACKET *packet, ptrIGMP_MSG msg, NETSIM_ID d)
 
void host_free (NETSIM_ID d)
 
void send_membership_report (NETSIM_ID d, NETSIM_IPAddress group)
 
void print_igmp_log (char *format,...)
 
void igmp_start_timer (NETSIM_ID d, IP_SUBEVENT sev, NETSIM_IPAddress addr, double time)
 

Macro Definition Documentation

◆ _NETSIM_IGMP_H_

#define _NETSIM_IGMP_H_

Definition at line 28 of file IGMP.h.

◆ GET_IGMP_HOST

#define GET_IGMP_HOST (   d)    ((ptrIGMP_HOST)(GET_IGMP_VAR(d)->DEV.host))

Definition at line 174 of file IGMP.h.

◆ GET_IGMP_ROUTER

#define GET_IGMP_ROUTER (   d)    ((ptrIGMP_ROUTER)(GET_IGMP_VAR(d)->DEV.router))

Definition at line 175 of file IGMP.h.

◆ GET_IGMP_VAR

#define GET_IGMP_VAR (   d)    ((ptrIGMP_VAR)GET_IP_DEVVAR(d)->igmp)

Definition at line 170 of file IGMP.h.

◆ IGMP_GROUP_MEMBERSHIP_INTERVAL_DEFAULT

#define IGMP_GROUP_MEMBERSHIP_INTERVAL_DEFAULT
Value:
#define IGMP_QUERY_INTERVAL_DEFAULT
Definition: IGMP.h:35
#define IGMP_QUERY_RESPONSE_INTERVAL_DEFAULT
Definition: IGMP.h:36
#define IGMP_ROBUSTNESS_VARIABLE_DEFAULT
Definition: IGMP.h:34

Definition at line 37 of file IGMP.h.

◆ IGMP_HDR_SIZE

#define IGMP_HDR_SIZE   8

Definition at line 82 of file IGMP.h.

◆ IGMP_HOST_DB_ADD

#define IGMP_HOST_DB_ADD (   d,
  db 
)    LIST_ADD_LAST((void**)&GET_IGMP_HOST(d)->database,db)

Definition at line 103 of file IGMP.h.

◆ IGMP_HOST_DB_ALLOC

#define IGMP_HOST_DB_ALLOC ( )    (ptrIGMP_HOST_DB)list_alloc(sizeof(IGMP_HOST_DB),offsetof(IGMP_HOST_DB,ele))

Definition at line 102 of file IGMP.h.

◆ IGMP_LAST_MEMBER_QUERY_COUNT_DEFAULT

#define IGMP_LAST_MEMBER_QUERY_COUNT_DEFAULT   IGMP_ROBUSTNESS_VARIABLE_DEFAULT

Definition at line 44 of file IGMP.h.

◆ IGMP_LAST_MEMBER_QUERY_INTERVAL_DEFAULT

#define IGMP_LAST_MEMBER_QUERY_INTERVAL_DEFAULT   10

Definition at line 43 of file IGMP.h.

◆ IGMP_QUERIER_PRESENT_INTERVAL_DEFAULT

#define IGMP_QUERIER_PRESENT_INTERVAL_DEFAULT

◆ IGMP_QUERY_INTERVAL_DEFAULT

#define IGMP_QUERY_INTERVAL_DEFAULT   125

Definition at line 35 of file IGMP.h.

◆ IGMP_QUERY_RESPONSE_INTERVAL_DEFAULT

#define IGMP_QUERY_RESPONSE_INTERVAL_DEFAULT   100

Definition at line 36 of file IGMP.h.

◆ IGMP_ROBUSTNESS_VARIABLE_DEFAULT

#define IGMP_ROBUSTNESS_VARIABLE_DEFAULT   2

Definition at line 34 of file IGMP.h.

◆ IGMP_ROUTER_DB_ADD

#define IGMP_ROUTER_DB_ADD (   d,
  db 
)    LIST_ADD_LAST((void**)&GET_IGMP_ROUTER(d)->database,db)

Definition at line 135 of file IGMP.h.

◆ IGMP_ROUTER_DB_ALLOC

#define IGMP_ROUTER_DB_ALLOC ( )    (ptrIGMP_ROUTER_DB)list_alloc(sizeof(IGMP_ROUTER_DB),offsetof(IGMP_ROUTER_DB,ele))

Definition at line 134 of file IGMP.h.

◆ IGMP_STARTUP_DELAY

#define IGMP_STARTUP_DELAY   1*MILLISECOND

Definition at line 47 of file IGMP.h.

◆ IGMP_STARTUP_QUERY_COUNT_DEFAULT

#define IGMP_STARTUP_QUERY_COUNT_DEFAULT   IGMP_ROBUSTNESS_VARIABLE_DEFAULT

Definition at line 42 of file IGMP.h.

◆ IGMP_STARTUP_QUERY_INTERVAL_DEFAULT

#define IGMP_STARTUP_QUERY_INTERVAL_DEFAULT   (1/4.0*IGMP_QUERY_INTERVAL_DEFAULT)

Definition at line 41 of file IGMP.h.

◆ IGMP_UNSOLICITED_REPORT_INTERVAL_DEFAULT

#define IGMP_UNSOLICITED_REPORT_INTERVAL_DEFAULT   (10)

Definition at line 45 of file IGMP.h.

◆ isBroadcastInterface

#define isBroadcastInterface (   d,
 
)    (DEVICE_INTERFACE(d,i)->nInterfaceType != INTERFACE_WAN_ROUTER)

Definition at line 49 of file IGMP.h.

◆ isIGMPPacket

#define isIGMPPacket (   packet)    (packet->nControlDataType / 100 == NW_PROTOCOL_IPV4 && packet->nControlDataType % 100 >= 30 && packet->nControlDataType % 100 < 40)

Definition at line 64 of file IGMP.h.

◆ isIPHOST

#define isIPHOST (   d)    (GET_IGMP_VAR(d)->devType == IP_HOST)

Definition at line 172 of file IGMP.h.

◆ isIPRouter

#define isIPRouter (   d)    (GET_IGMP_VAR(d)->devType == IP_ROUTER)

Definition at line 173 of file IGMP.h.

◆ SET_IGMP_HOST

#define SET_IGMP_HOST (   d,
  var 
)    (GET_IGMP_VAR(d)->DEV.host = var)

Definition at line 176 of file IGMP.h.

◆ SET_IGMP_ROUTER

#define SET_IGMP_ROUTER (   d,
  var 
)    (GET_IGMP_VAR(d)->DEV.router = var)

Definition at line 177 of file IGMP.h.

◆ SET_IGMP_VAR

#define SET_IGMP_VAR (   d,
  var 
)    (GET_IP_DEVVAR(d)->igmp = (void*)var)

Definition at line 171 of file IGMP.h.

Typedef Documentation

◆ IGMP_HOST

typedef struct stru_igmp_host IGMP_HOST

◆ IGMP_HOST_DB

◆ IGMP_MSG

typedef struct stru_igmp_msg IGMP_MSG

◆ IGMP_ROUTER

typedef struct stru_igmp_router IGMP_ROUTER

◆ IGMP_ROUTER_DB

◆ IGMP_VAR

typedef struct stru_igmpvar IGMP_VAR

◆ ptrIGMP_HOST

typedef struct stru_igmp_host * ptrIGMP_HOST

◆ ptrIGMP_HOST_DB

◆ ptrIGMP_MSG

typedef struct stru_igmp_msg * ptrIGMP_MSG

◆ ptrIGMP_ROUTER

typedef struct stru_igmp_router * ptrIGMP_ROUTER

◆ ptrIGMP_ROUTER_DB

◆ ptrIGMP_VAR

typedef struct stru_igmpvar * ptrIGMP_VAR

Enumeration Type Documentation

◆ DEV_TYPE

enum DEV_TYPE
Enumerator
IP_HOST 
IP_ROUTER 

Definition at line 51 of file IGMP.h.

◆ IGMP_HOST_STATE

Enumerator
HostState_NonMember 
HostState_IdleMember 
HostState_DelayingMember 

Definition at line 84 of file IGMP.h.

◆ IGMP_ROUTER_STATE

Enumerator
RouterState_Querier 
RouterState_NonQuerier 

Definition at line 110 of file IGMP.h.

◆ IGMPMSG_TYPE

Enumerator
IGMPMSG_MembershipQuery 
IGMPMSG_V2MembershipReport 
IGMPMSG_LeaveGroup 
IGMPMSG_V1MembershipReport 

Definition at line 57 of file IGMP.h.

Function Documentation

◆ find_or_alloc_multicast_db_router()

ptrIGMP_ROUTER_DB find_or_alloc_multicast_db_router ( NETSIM_IPAddress  addr,
NETSIM_ID  d,
bool *  isAlreadyJoined 
)

Definition at line 20 of file IGMP_Router.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ host_free()

void host_free ( NETSIM_ID  d)

Definition at line 205 of file IGMP_Host.c.

Here is the caller graph for this function:

◆ host_get_multicast_db()

ptrIGMP_HOST_DB host_get_multicast_db ( NETSIM_ID  d,
NETSIM_IPAddress  addr 
)

Definition at line 45 of file IGMP_Host.c.

Here is the caller graph for this function:

◆ host_process_query()

bool host_process_query ( NetSim_PACKET packet,
ptrIGMP_MSG  msg,
NETSIM_ID  d 
)

Definition at line 82 of file IGMP_Host.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ host_process_report()

bool host_process_report ( NetSim_PACKET packet,
ptrIGMP_MSG  msg,
NETSIM_ID  d 
)

Definition at line 140 of file IGMP_Host.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ igmp_host_init()

void igmp_host_init ( NETSIM_ID  d)

Definition at line 58 of file IGMP_Host.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ igmp_router_init()

void igmp_router_init ( NETSIM_ID  d)

Definition at line 158 of file IGMP_Router.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ igmp_start_timer()

void igmp_start_timer ( NETSIM_ID  d,
IP_SUBEVENT  sev,
NETSIM_IPAddress  addr,
double  time 
)

Definition at line 123 of file IGMP.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_igmp_log()

void print_igmp_log ( char *  format,
  ... 
)

Definition at line 33 of file IGMP.c.

Here is the caller graph for this function:

◆ router_free()

void router_free ( NETSIM_ID  d)

Definition at line 341 of file IGMP_Router.c.

Here is the caller graph for this function:

◆ router_get_multicast_db()

ptrIGMP_ROUTER_DB router_get_multicast_db ( NETSIM_ID  d,
NETSIM_IPAddress  ip 
)

Definition at line 59 of file IGMP_Router.c.

Here is the caller graph for this function:

◆ router_process_query()

bool router_process_query ( NetSim_PACKET packet,
ptrIGMP_MSG  msg,
NETSIM_ID  d 
)

Definition at line 200 of file IGMP_Router.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ router_process_report()

bool router_process_report ( NetSim_PACKET packet,
ptrIGMP_MSG  msg,
NETSIM_ID  d 
)

Definition at line 274 of file IGMP_Router.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_membership_report()

void send_membership_report ( NETSIM_ID  d,
NETSIM_IPAddress  group 
)

Definition at line 152 of file IGMP_Msg.c.

Here is the call graph for this function:
Here is the caller graph for this function: