#include <sys/types.h> #include <sys/socket.h> int Rbind(int socket_descriptor, struct sockaddr *local_address, int address_length)
#define _XOPEN_SOURCE 520 #include <sys/socket.h> int Rbind(int socket_descriptor, const struct sockaddr *local_address, socklen_t address_length)
A program uses the Rbind() call to request that a SOCKS server allow an inbound connection request across a firewall. This call should only be used by applications that require inbound connections across a firewall, and should only be used for sockets with an address family of af_inet. Note that for an Rbind() call to succeed, a previous connect() call must have been issued for this thread, and must have resulted in an outbound connection over the same SOCKS server. The Rbind() inbound connection will be from the same IP address addressed by the original outbound connection. Caution must be exercised so that outbound and inbound connections over the SOCKS server are paired. In other words, all Rbind() inbound connections should immediately follow the outbound connection over the SOCKS server, and no intervening non-SOCKS connections relating to this thread can be attempted before the Rbind() runs. For an overview of using sockets and how to interact with a SOCKS server, see the topic about i5/OS client SOCKS support in the Sockets Programming in the iSeries Information Center.
There are two versions of the API, as shown above. The base i5/OS API uses BSD 4.3 structures and syntax. The other uses syntax and structures compatible with the UNIX 98 programming interface specifications. You can select the UNIX 98 compatible interface with the _XOPEN_SOURCE macro.
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.
Rbind() returns an integer. Possible values are:
When an Rbind() fails, errno can be set to one of the following:
[EADDRNOTAVAIL] | Address not available. This error code indicates
one of the following:
|
[EAFNOSUPPORT] | The type of socket is not supported in this
protocol family.
The address family specified in the address structure pointed to by the local_address parameter cannot be used with the socket pointed to by the socket_descriptor parameter. |
[EBADF] | Descriptor not valid. |
[EFAULT] | Bad address.
The system detected an address that was not valid while attempting to access the local_address parameter. |
[EINVAL] | Parameter not valid. This error code indicates
one of the following:
|
[EIO] | Input/output error. |
[ENOBUFS] | There is not enough buffer space for the
requested operation. |
[ENOTSOCK] | The specified descriptor does not reference a
socket. |
[EUNATCH] | The protocol required to support the specified
address family is not available at this time. |
[EUNKNOWN] | Unknown system state. |
Message ID | Error Message Text |
---|---|
CPE3418 E | Possible APAR condition or hardware failure. |
CPF9872 E | Program or service program &1 in library &2 ended. Reason code &3. |
CPFA081 E | Unable to set return value or error code. |
Top | UNIX-Type APIs | APIs by category |