Sockets connect() API Exit Program
Required Parameter Group:
1 | Connect exit information | Input | Char(*) |
2 | Return indicator | Output | Char(1) |
QSYSINC Member Name: ESOEXTPT
Exit Point Name: QIBM_QSO_CONNECT
Exit Point Format Name: CONN0100
A user-defined exit program enables a custom program to allow or deny attempted connections to complete based on a program's restrictions. The sockets connect() API will permit or deny the attempted connection from completing successfully based on the return indicator from the exit program.
Authorities and Locks
None.
Required Parameter Group
- Connect exit information
- INPUT; CHAR(*)
Used by the user-written program to help determine if the outgoing connection should be allowed to successfully complete. Refer to Format of Connect Exit Information for details about this parameter.
- Return indicator
- OUTPUT; CHAR(1)
Indicates whether the connection should be accepted or rejected.
'0' Allow the outgoing connection to complete. '1' Deny the outgoing connection and force connect() to fail with errno set to EPERM. '9' Allow the outgoing connection and indicate this user exit program should not be called again for this process. Note: Any value other than '0' or '9' indicates that the outgoing connection should be denied and force connect() to fail with errno set to EPERM. An unhandled exception in a user exit program will be treated the same as a return indicator of '1'.
Format of Connect Exit Information
The following table shows the structure of the connect exit information for format CONN0100. For detailed descriptions of the fields in this table, see Field Descriptions.CONN0100 Format
Offset | Type | Field | |
---|---|---|---|
Dec | Hex | ||
0 | 0 | Binary(4) | Local address length |
4 | 4 | Char(28) | Local address |
32 | 20 | Binary(4) | Destination address length |
36 | 24 | Char(28) | Destination address |
Field Descriptions
Destination address. The address the connection was issued to. This field is large enough to hold either a sockaddr_in or sockaddr_in6 structure. In order to determine the format of this field refer to the Destination address length field.
Destination address length. The length of the address structure the connection was issued to.
Local address. The address the connecting socket is bound to. This field will be large enough to hold either a sockaddr_in or sockaddr_in6 structure. In order to determine the format of this field refer to the Local address length field.
Local address length. The length of the address structure the connecting socket is bound to.
Usage Notes
-
If more than one exit program is called by this exit point, all of the
exit programs must have a return indicator of '0' or '9' otherwise the
outgoing connection will not be allowed.
-
For a connect API involving client SOCKS support, the remote address
specified on the connect() API will be the destination address provided
to the registered connect exit programs.
-
The Rbind() API causes a TCP connection to the SOCKS server to happen
under the covers. The registered connect exit programs will not be called
for this connection.
- A return indicator of '9' will prevent a particular user exit program from being called in a process until a change is made to the QIBM_QSO_CONNECT user exit programs in the registration facility.
Related Information
See the following for more information:
- connect()--Establish Connection or Destination Address
Exit program introduced: IBM® i 7.1