Skip to content

Latest commit

 

History

History
161 lines (95 loc) · 8.3 KB

ns-ws2ipdef-ip_msfilter.md

File metadata and controls

161 lines (95 loc) · 8.3 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NS:ws2ipdef.ip_msfilter
IP_MSFILTER (ws2ipdef.h)
The ip_msfilter structure provides multicast filtering parameters for IPv4 addresses.
*PIP_MSFILTER
IP_MSFILTER
IP_MSFILTER [Winsock]
IP_MSFILTER structure [Winsock]
PIP_MSFILTER
PIP_MSFILTER structure pointer [Winsock]
ip_msfilter
ip_msfilter structure [Winsock]
winsock.ip_msfilter
ws2ipdef/PIP_MSFILTER
ws2ipdef/ip_msfilter
ws2tcpip/PIP_MSFILTER
ws2tcpip/ip_msfilter
winsock\ip_msfilter.htm
WinSock
8d9d515e-9369-4d71-9614-6cbeb5557a5d
12/05/2018
*PIP_MSFILTER, IP_MSFILTER, IP_MSFILTER [Winsock], IP_MSFILTER structure [Winsock], PIP_MSFILTER, PIP_MSFILTER structure pointer [Winsock], ip_msfilter, ip_msfilter structure [Winsock], winsock.ip_msfilter, ws2ipdef/PIP_MSFILTER, ws2ipdef/ip_msfilter, ws2tcpip/PIP_MSFILTER, ws2tcpip/ip_msfilter
ws2ipdef.h
Ws2tcpip.h
Windows
Windows XP [desktop apps only]
Windows Server 2003 [desktop apps only]
Windows
IP_MSFILTER, *PIP_MSFILTER
19H1
ip_msfilter
ws2ipdef/ip_msfilter
PIP_MSFILTER
ws2ipdef/PIP_MSFILTER
IP_MSFILTER
ws2ipdef/IP_MSFILTER
c++
APIRef
kbSyntax
HeaderDef
Ws2ipdef.h
Ws2tcpip.h
IP_MSFILTER

IP_MSFILTER structure

-description

The ip_msfilter structure provides multicast filtering parameters for IPv4 addresses.

-struct-fields

-field imsf_multiaddr

The IPv4 address of the multicast group.

-field imsf_interface

The local IPv4 address of the interface or the interface index on which the multicast group should be filtered. This value is in network byte order. If this member specifies an IPv4 address of 0.0.0.0, the default IPv4 multicast interface is used.

To use an interface index of 1 would be the same as an IP address of 0.0.0.1.

-field imsf_fmode

The multicast filter mode to be used. This parameter can be either MCAST_INCLUDE (value of 0) to include particular multicast sources, or MCAST_EXCLUDE (value of 1) to exclude traffic from specified sources.

On Windows Server 2003 and Windows XP, these values are defined in the Ws2tcpip.h header file.

On Windows Vista and later, these values are defined as enumeration values in the MULTICAST_MODE_TYPE enumeration defined in the Ws2ipdef.h header file.

-field imsf_numsrc

The number of sources in the imsf_slist member.

-field imsf_slist

An array of in_addr structures that specify the IPv4 multicast source addresses to include or exclude.

-remarks

The ip_msfilter structure is used with IPv4 addresses. The ip_msfilter structure is passed as an argument for the SIO_GET_MULTICAST_FILTER and SIO_SET_MULTICAST_FILTER IOCTLs.

The ip_msfilter structure and related structures used for IPv4 multicast programming are based on IETF recommendations in sections 4 and 8.1 of RFC 3768. For more information, see http://www.ietf.org/rfc/rfc3678.txt.

On Windows Vista and later, a set of socket options are available for multicast programming that support IPv6 and IPv4 addresses. These socket options are IP agnostic and can be used on both IPv6 and IPv4. These IP agnostic options use the GROUP_REQ and the GROUP_SOURCE_REQ structures and the SIOCSMSFILTER and SIOCGMSFILTER IOCTLs. These are the preferred socket options and IOCTLs for multicast programming on Windows Vista and later.

The imsf_interface member can be an interface index. Any IPv4 address in the 0.x.x.x block (first octet of 0) except for the IPv4 address of 0.0.0.0 is treated as an interface index. An interface index is a 24-bit number. The 0.0.0.0/8 IPv4 address block is not used (this range is reserved). The GetAdaptersAddresses function can be used to obtain interface index information to use for the imsf_interface member.

It is recommended that a local IPv4 address or interface index always be specified in the imsf_interface member of the ip_msfilter structure, rather than use the default interface. This is particularly important on computers with multiple network interfaces and multiple public IPv4 addresses.

The default interface used for IPv4 multicast is determined by the networking stack in Windows. An application can determine the default interface used for IPv4 multicast using the GetIpForwardTable function to retrieve the IPv4 routing table. The network interface with the lowest value for the routing metric for a destination IP address of 224.0.0.0 is the default interface for IPv4 multicast. The routing table can also be displayed from the command prompt with the following command:

route print

The IP_MULTICAST_IF socket option can be used to set the default interface to send IPv4 multicast packets. This socket option does not change the default interface used to receive IPv4 multicast packets.

A typical IPv4 multicast application would use the IP_ADD_MEMBERSHIP socket option with the ip_mreq structure or the IP_ADD_SOURCE_MEMBERSHIP socket option with the ip_mreq_source structure to join a multicast group and listen for multicast packets on a specific interface. The IP_MULTICAST_IF socket option would be used to set the interface to send IPv4 multicast packets to the multicast group. The most common scenario would be a multicast application that listens and sends on the same interface for a multicast group. Multiple sockets might be used by a multicast application with one socket for listening and one or more sockets for sending.

On the Microsoft Windows Software Development Kit (SDK) released for Windows Vista and later, the organization of header files has changed and the ip_msfilter structure is defined in the Ws2ipdef.h header file which is automatically included in the Ws2tcpip.h header file. The Ws2ipdef.h header files should never be used directly.

Note  The IP_MSFILTER and PIP_MSFILTER derived structures are only defined on the Windows SDK released with Windows Vista and later. The ip_msfilter structure should be used on earlier versions of the Windows SDK.
 

-see-also

Final-State-Based Multicast Programming

GROUP_FILTER

GROUP_REQ

GROUP_SOURCE_REQ

GetAdaptersAddresses

GetIpForwardTable

IPPROTO_IP Socket Options

MULTICAST_MODE_TYPE

Multicast Programming

Socket Options

ip_mreq

ip_mreq_source