NCBI C++ ToolKit
Public Attributes | List of all members
SSOCK_ApproveInfo Struct Reference

Search Toolkit Book for SSOCK_ApproveInfo

User-level connection approval hook. More...

#include <connect/ncbi_socket.h>

Public Attributes

const char * host
 Textual hostname if provided for outgoing. More...
unsigned int addr
 IPv4 (or -1 if unknown / broadcast), never 0. More...
unsigned short port
 Port number, host byte order, never 0. More...
ESOCK_Side side
 eSOCK_Client (out) / eSOCK_Server (in) More...
ESOCK_Type type
 eSOCK_Socket (conn) / eSOCK_Datagram (packet) More...

Detailed Description

User-level connection approval hook.

The hook (when installed) gets called for any attempt to establish an outgoing(eSOCK_Client) or incoming(eSOCK_Server) connection(eSOCK_Socket), or to send(eSOCK_Client) or receive(eSOCK_Server) a message packet in a datagram socket(eSOCK_Datagram). The peer end is always identified by the "addr:port" pair (which is non-0 in both parts). Optionally for outgoing transaction, a textual hostname("host") can be provided (to which "addr" corresponds). If the action was requested by a plain IP address, the "host" field is set to NULL.

The hook is expected to return eIO_Success to approve the action, or any other status code to deny. Note that either eIO_Timeout or eIO_Closed returned from the hook, will get converted to eIO_Unknown; and other codes will get passed through to the caller "as is".

Although returning eIO_Interrupt may be helpful to prevent the upper-lever connection (CONN) layer from processing further I/O on this communication channel, it may also be just an undesireable side-effect – so it should be used with caution.
When the hook is not installed, all the actions described above are treated as allowed (as if eIO_Success was returned).
See also
SOCK_Create, SOCK_Reconnect, LSOCK_Accept, DSOCK_SendMsg, DSOCK_RecvMsg

Definition at line 343 of file ncbi_socket.h.

The documentation for this struct was generated from the following file:
Modified on Fri May 24 14:58:13 2024 by rev. 669887