libmct_convProgrammer’s Manual

mct_bridge_name(3)

Name

mct_bridge_name — Create an MCT session by name

Synopsis

#include <mct/convenience.h>

int
mct_bridge_name(struct mct *mct, int type,
	const char *src_host, const char *src_serv, int src_flags,
	const char *dst_host, const char *dst_serv, int dst_flags);

Description

The mct_bridge_name() function is a convenience to call mct_bridge() with sockaddr structs constructed automatically.

A pair of names (src and dst) is given; each of this pair is a string consisting of a host name and a service name respectively. These are passed through to getaddrinfo verbatim. The src_host and src_serv names represent the source address passed to mct_bridge and the dst_host_ and dst_serv names represent the corresponding destination address passed to mct_bridge.

Either a host name or a service name (but not both) may be NULL.

The corresponding src_flags and dst_flags arguments are 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 the value of the type parameter.

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_bridge is called for each of the src and dst addresses getaddrinfo resolves. If no addresses are resolved for either src or dst then mct_bridge returns EAI_NONAME.

Return Value

The mct_bridge() function returns a valid session ID >=0 on success. On failure this function returns one of the EAI_ constants <0 defined by getaddrinfo. As for getaddrinfo, EAI_SYSTEM indicates errno is set accordingly.

Errors

The mct_bridge_name() function may fail for any of the reasons mct_bridge may produce.

In addition, mct_bridge_name() may fail for any of the reasons getaddrinfo may produce.

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

EINVAL

Both src_host and src_serv are NULL, or both dst_host and dst_serv are NULL.

EAI_NONAME

The name resolver could not find the given src_ or dst_ name.

Caveats

See mct_bridge.

See Also

mctd, mct, mct_ipc, mct_session_close, getaddrinfo.