getsourcefilter() — Get source filter
Standards
Standards / Extensions | C or C++ | Dependencies |
---|---|---|
RFC3678 | both | z/OS® V1.9 |
Format
#define _XOPEN_SYS_SOCK_EXT3
#include <netinet/in.h>
int getsourcefilter(int s, uint32_t interface, struct sockaddr *group,
socklen_t grouplen, uint32_t *fmode, uint32_t *numsrc,
struct sockaddr_storage *slist);
General description
This function allow applications to get a previously set 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 protocol-independent. It can be on either AF_INET or AF_INET6 sockets of the 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 index of the interface.
- group
- Points to either a sockaddr_in structure for IPv4 or a sockaddr_in6 structure for IPv6 that holds the IP multicast address of the group.
- grouplen
- Gives the length of the sockaddr_in or sockaddr_in6 structure.
- fmode
- Points to an integer that will contain the filter mode on a successful return. The value of this field will be either MCAST_INCLUDE or MCAST_EXCLUDE, which are likewise defined in <netinet/in.h>.
- numsrc
- It is a pointer that on input, points to the number of source adresses that will fit in the slist array. On return, points to the total number of sources associated with the filter.
- slist
- Points to buffer into which an array of IP addresses of included or excluded (depending on the filter mode) sources will be written. If numsrc was 0 on input, a NULL pointer may be supplied.
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 tuple consisting of socket, interface, and multicast group values does not exist; or the specified interface address is not multicast capable.
- EAFNOSUPPORT
- The address family of the input sockaddr is not AF_INET or AF_INET6.
- EBADF
- s is not a valid socket descriptor.
- EINVAL
- Interface or group is not a valid address, or the socket s has already requested multicast setsockopt options (refer to z/OS Communications Server: IP Sockets Application Programming Interface Guide and Reference for details.) Or if the group address family is AF_INET and grouplen is not at least size of sockaddr_in or if the group address family is AF_INET6 and grouplen is not at least size of sockaddr_in6 or if grouplen is not at least size of sockaddr_in.
- ENXIO
- The specified interface index provided in the interface parameter does not exist.
- EPROTOTYPE
- The socket s is not of type SOCK_DGRAM or SOCK_RAW.