Function Prototypes:ttUserIgmpFilterCallback
Table of Contents >> Programmer's Reference >> tfUserRegisterIgmpFilter
| int ttUserIgmpFilterCallback | ( |
| ttUserInterface interfaceHandle, | |
| void * ipHdrPtr, | |
| void * igmpHdrPtr, | |
| int totalLength | |
| ); |
Function Description
This function prototype should be used for user filter callbacks registered to handle IGMP datagrams. As traffic flows through each interface that has IGMP filtering enabled this function is invoked with the associated parameters as described below.
Usage
Implement an instance of this function and register it with a call to tfUserRegisterIgmpFilter(). This function is used to perform additional comparison logic of packet content to determine how the packet should be handled by the stack. Various return values dictate further stack processing.
Parameters
- interfaceHandle
- This is the interface on which the IGMP datagram was delivered.
- ipHdrPtr
- This is the start of the IP header.
- igmpHdrPtr
- This is the start of the IGMP header.
- totalLength
- This is the total length of the IGMP datagram.
Returns
- TM_ENOERROR
- The packet is acceptable and Treck is to process the packet normally.
- (Other)
- The packet is not acceptable and Treck is to drop the packet.
Example
int igmpFilterCallback(ttUserInterface interfaceHandle, void TM_FAR * ipHdrPtr, void TM_FAR * igmpHdrPtr, int totalLength) { int errorCode; /* Filter for all devices and all lengths of packets */ TM_UNREF_IN_ARG(interfaceHandle); TM_UNREF_IN_ARG(ipHdrPtr); TM_UNREF_IN_ARG(totalLength); /* Allow all traffic by default */ errorCode = TM_ENOERROR; if (*((char *)igmpHdrPtr) == 0x12) { /* IGMP V1 Membership Report - ignore this */ errorCode = TM_EINVAL; } else if (*((char *)igmpHdrPtr) == 0x22) { /* IGMP V3 Membership Report - ignore this */ errorCode = TM_EINVAL; } return errorCode; }
Table of Contents >> Programmer's Reference >> tfUserRegisterIgmpFilter