libmct_convProgrammer’s Manual



mct_session_affinity_name — Set multicast affinity for a MCT session by name


#include <sys/types.h>
#include <sys/socket.h>

#include <mct/session.h>

int mct_session_affinity_name(struct mct *mct, int s,
	const char *ifname, const char *host, const char *serv, int flags);


The mct_session_affinity_name() function is a convenience to call mct_session_affinity() with sockaddr structs constructed automatically.

The ifname argument identifies the network interface as per if_nametoindex, or NULL to indicate the default interface.

A host name and service name are given. These are passed through to getaddrinfo verbatim.

Either a host name or a service name (but not both) may be NULL. For AF_INET and AF_INET6 multicast it is only meaningful to specify the service as NULL.

The flags argument passed to getaddrinfo as the ai_flags field in its hints struct for the src and dst addresses respectively. The ai_family field is set to AF_UNSPEC. The ai_protocol field is set to 0. The ai_socktype field is set to SOCK_RAW.

Either a host name or a service name (or both) may be specified numerically. For IP, this would be an IP address and (possibly) a port number. See getaddrinfo for more information.

mct_session_affinity is called for each of the addresses getaddrinfo resolves. If no addresses are resolved then mct_session_add_name and mct_session_drop_name return EAI_NONAME.

The multicast address given must be of the same address family as the session when created by mct_bridge.

Return Value

The mct_session_affinity_name() function returns 0 on success. On failure these functions returns one of the EAI_ constants <0 defined by getaddrinfo. As for getaddrinfo, EAI_SYSTEM indicates errno is set accordingly.


The mct_session_affinity_name() function may fail for any of the reasons the socket API may produce.

In addition, mct_session_affinity_name() may fail for any of the reasons documented by mct_ipc.

In addition, mct_session_affinity_name() may fail for the following reasons:


The given session ID is not valid.


An unsupported address family was given. See caveats below.


See mct_session_affinity.

See Also

mctd, mct, mct_ipc, mct_session_affinity, if_nametoindex, ip.