#include <netinet/in.h> int getsourcefilter(int socket_descriptor, uint32_t interface, struct sockaddr *group_address, socklen_t address_length, uint32_t *filter_mode, uint32_t *number_sources, struct sockaddr_storage *source_list)
The getsourcefilter() function retrieves the multicast filtering state for a tuple that consists of a socket (socket_descriptor), an interface (interface), and a multicast group (group_address).
The structure sockaddr is defined in <sys/socket.h>.
The BSD 4.3 structure is: struct sockaddr { u_short sa_family; char sa_data[14]; }; The BSD 4.4/UNIX 98 compatible structure is: typedef uchar sa_family_t; struct sockaddr { uint8_t sa_len; sa_family_t sa_family; char sa_data[14]; };
The BSD 4.4 sa_len field is the length of the address. The sa_family field identifies the address family to which the address belongs, and sa_data is the address whose format is dependent on the address family.
Note: See the usage notes about using different address families with sockaddr_storage.
The structure sockaddr_storage is defined in <sys/socket.h>.
The BSD 4.3 structure is: #define _SS_MAXSIZE 304 #define _SS_ALIGNSIZE (sizeof (char*)) #define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(sa_family_t)) #define _SS_PAD2SIZE (_SS_MAXSIZE - (sizeof(sa_family_t)+ _SS_PAD1SIZE + _SS_ALIGNSIZE)) struct sockaddr_storage { sa_family_t ss_family; char _ss_pad1[_SS_PAD1SIZE]; char* _ss_align; char _ss_pad2[_SS_PAD2SIZE]; }; The BSD 4.4/UNIX 98 compatible structure is: #define _SS_MAXSIZE 304 #define _SS_ALIGNSIZE (sizeof (char*)) #define _SS_PAD1SIZE (_SS_ALIGNSIZE - (sizeof(uint8_t) + sizeof(sa_family_t))) #define _SS_PAD2SIZE (_SS_MAXSIZE - (sizeof(uint8_t) + sizeof(sa_family_t)+ _SS_PAD1SIZE + _SS_ALIGNSIZE)) struct sockaddr_storage { uint8_t ss_len; sa_family_t ss_family; char _ss_pad1[_SS_PAD1SIZE]; char* _ss_align; char _ss_pad2[_SS_PAD2SIZE]; };
No authorization is required.
getsourcefilter() returns an integer. Possible values are:
When getsourcefilter() fails, errno can be set to one of the following:
[EADDRNOTAVAIL] | Address is not available.
The tuple consisting of socket, interface, and multicast group values do not exist; group_address is not being listened to on interface by socket, socket_descriptor. |
[EAFNOSUPPORT] | The type of socket is not supported in this
protocol family.
The address family specified in the sockaddr parameter is not AF_INET or AF_INET6. |
[EBADF] | Descriptor is not valid. |
[EINVAL] | Parameter not valid.
This error code indicates one of the following:
|
[ENOPROTOOPT] | The protocol does not support the specified
option.
The socket is not of type SOCK_DGRAM or SOCK_RAW. The address family of the group_address parameter does not match the protocol family of the socket, socket_descriptor. |
[ENOTSOCK] | The specified descriptor does not reference a socket. |
[ENXIO] | No such device or address.
The interface argument, an index or an IPv4 address, does not identify a valid interface. |