Network Component  Version 6.6
MDK-Professional Middleware for IP Networking
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
IGMP Routines

IGMP Routines enable IP Multicasting. More...

Functions

netStatus igmp_join (uint32_t if_num, const uint8_t *ip_addr)
 Join this host to a host group specified with IP address.
 
netStatus igmp_leave (uint32_t if_num, const uint8_t *ip_addr)
 Leave a host group specified with IP address.
 

Description

IGMP Routines enable IP Multicasting.

IGMP routines enable you to use IP Multicasting - the transmission of an IP datagram to a "host group". A multicast datagram is delivered to all the members of its destination host group. IGMPv1 and IGMPv2 protocol specification is supported in the Network Component.

Function Documentation

netStatus igmp_join ( uint32_t  if_num,
const uint8_t *  ip_addr 
)

Join this host to a host group specified with IP address.

Parameters
[in]if_numinterface number.
[in]ip_addrgroup IP address.
Returns
status code that indicates the execution status of the function as defined with netStatus.

The function igmp_join requests that a host should become a member of the host group identified by ip_addr.

The argument if_num is the interface number of the host.

The argument ip_addr points to the address of the group. Before any datagrams destined to a particular group can be received, an upper-layer protocol must ask the IP module to join that group.

Code Example

const uint8_t sgroup[4] = { 238, 0, 100, 1};
..
if (igmp_join (0, sgroup) == netOK) {
printf ("This Host is a member of group: %d.%d.%d.%d\n",
sgroup[0],sgroup[1],sgroup[2],sgroup[3]);
}
else {
printf ("Failed to join a host group.\n");
}
..
netStatus igmp_leave ( uint32_t  if_num,
const uint8_t *  ip_addr 
)

Leave a host group specified with IP address.

Parameters
[in]if_numinterface number.
[in]ip_addrgroup IP address.
Returns
status code that indicates the execution status of the function as defined with netStatus.

The function igmp_leave requests a host to give up its membership in a host group.

The argument if_num is the host interface number.

The argument ip_addr points to the host group. After the upper-layer has requested to leave the host group, datagrams destined to a particular group can not be received, but are silently discarded by the IP-layer.

Code Example

const uint8_t sgroup[4] = { 238, 0, 100, 1};
..
if (igmp_leave (0, sgroup) == netOK) {
printf ("This Host has left the group: %d.%d.%d.%d\n",
sgroup[0],sgroup[1],sgroup[2],sgroup[3]);
}
else {
printf ("Failed to leave a group, this host is not a member.\n");
}