setipv4sourcefilter() — Set source filter
Standards
Standards / Extensions | C or C++ | Dependencies |
---|---|---|
RFC3678 | both | z/OS® V1.9 |
Format
#define _OPEN_SYS_SOCK_EXT3
#include <netinet/in.h>
int setipv4sourcefilter(int s, struct in_addr interface, struct in_addr group,
uint32_t fmode, uint32_t numsrc, struct in_addr *slist);
General description
This function allows applications to set and replace the current multicast filtering state for a tuple consisting of socket, interface, and multicast group values.
A multicast filter is described by a filter mode, which is MCAST_INCLUDE or MCAST_EXCLUDE, and a list of source addresses which are filtered.
This function is IPv4-specific, must be used only on AF_INET sockets with an open socket of type SOCK_DGRAM or SOCK_RAW.
If the function is unable to obtain the required storage, control will not return to the caller. Instead the application will terminate due to an out of memory condition (if the reserve stack is available and the caller is not XPLINK), or it will terminate with an abend indicating that storage could not be obtained.
- Argument
- Description
- s
- Identifies the socket.
- interface
- Holds the local IP address of the interface.
- group
- Holds the IP multicast address of the group.
- fmode
- Identifies the filter mode. The value of this field must be either MCAST_INCLUDE or MCAST_EXCLUDE, which are likewise defined in <netinet/in.h>.
- numsrc
- Holds the number of source addresses in the slist array.
- slist
- Points to an array of IP addresses of sources to include or exclude depending on the filter mode.
Returned value
If successful, the function returns 0. Otherwise, it returns -1 and sets errno to one of the following values.
- errno
- Description
- EADDRNOTAVAIL
- The specified interface address is incorrect for this host, or the specified interface address is not multicast capable.
- EBADF
- s is not a valid socket descriptor.
- EINVAL
- Interface or group is not a valid IPv4 address, or the socket s has already requested multicast setsockopt options.
- ENOBUFS
- The number of the source addresses exceeds the allowed limit.
- EPROTOTYPE
- The socket s is not of type SOCK_DGRAM or SOCK_RAW.