econnect Subroutine

Purpose

Connects two sockets. The econnect subroutine is similar to the connect subroutine with the addition of the sec_labels_t pointer. The sec_labels_t pointer indicates the Sensitivity Level (SL) of the outgoing connection request.

Library

Standard C Library (libc.a)

Syntax

#include <sys/socket.h>
#include <sys/mac.h>
int econnect ( Socket, Name, NameLength, Label)  
int Socket; 
const struct sockaddr *Name;
socklen_t NameLength;
sec_labels_t *Label;

Description

The econnect subroutine requests a connection between two sockets, similar to the connect subroutine. The kernel sets up the communication link between the sockets; both sockets must use the same address format and protocol.

The SL specified by the Label parameter is the SL of the outgoing request. The requested SL must be dominated by the current clearance or must have appropriate privileges to clear the MAC check.

Parameters

Item Description
Socket Specifies the unique name of the socket.
Name Specifies the address of the target socket that will form the other end of the communication line.
NameLength Specifies the length of the address structure.
Label Specifies the SL of the outgoing connection request.

Return Values

Item Description
Successful 0
Unsuccessful -1

Error Codes

The econnect subroutine is unsuccessful if any of the following errors occurs:

Value Description
EADDRINUSE The specified address is already in use.
EADDRNOTAVAIL The specified address is not available from the local machine.
EAFNOSUPPORT The addresses in the specified address family cannot be used with this socket.
EALREADY The socket is specified with O_NONBLOCK or O_NDLAY, and a previous connection attempt has not yet completed.
EINTR The attempt to establish a connection was interrupted by delivery of a signal that was caught; the connection will be established asynchronously.
EACCES Search permission was denied on a component of the path prefix or write access to the named socket was denied.
ENOBUFS The system has run out of memory for an internal data structure.
EOPNOTSUPP The socket referenced by the Socket parameter does not support the econnect subroutine.
EWOULDBLOCK The range allocated for TCP/UDP ephemeral ports has been exhausted.
EBADF The Socket parameter is not valid.
ECONNREFUSED The attempt to connect was rejected.
EFAULT The Address parameter is not in a writable part of the user address space.
EINPROGRESS The socket is marked as nonblocking. The connection cannot be immediately completed. The application program can select the socket for writing during the connection process.
EINVAL The specified path name contains a character with the high-order bit set.
EISCONN The socket is already connected.
ENETDOWN The specified physical network is down.
ENETUNREACH No route to the network or host is present.
ENOSPC There is no space left on a device or system table.
ENOTCONN The socket could not be connected.
ENOTSOCK The Socket parameter refers to a file, not a socket.
ETIMEDOUT The establishment of a connection times out before a connection is made.
EPERM The Trusted AIX® MAC check failed.