db2commexitRegister API - Registration

This function registers the agent to the connection. It is applicable only in communication buffer exit libraries.

This function is called by the database manager whenever an agent accepts a socket and starts receiving and sending data on the socket. This activity is typically associated with a new SQL connection to the database or instance attachment.

This function is also called when an idle connection is dispatched to an agent to handle a new request from the client.

This function is not directly associated with SQL connections to the database. An input parameter to the function differentiates between a new socket and existing one that is dispatched to a new agent.

API header file

db2commexit.h

API and data structure syntax

SQL_API_RC ( SQL_API_FN * db2commexitRegister )
(
   void                         ** pConnectionContext,
   const db2commexitCommInfo_v1  * pCommInfo,
   db2int32                        state,
   db2int64                      * pReservedFlags,
   char                         ** errormsg,
   db2int32                      * errormsglen
);

db2commexitRegister API Parameters

pConnectionContext
Input/output. A pointer to communication buffer exit library-specific data. This pointer is specific to the inbound connection. This parameter is passed as input to each function call for that connection. The library might allocate and store connection-specific information and make it available in each function call. The memory for the parameter must be freed in the call to db2commexitDeregister. The database manager cannot access the memory pointed to by this parameter.
pCommInfo
Input. A pointer to a structure that contains information which identifies the database server and protocol-specific information for the incoming connection. Some of the fields in the structure are not setup until multiple buffers are exchanged with the client. The fields are available in later calls to db2commexitRecv and db2commexitSend. This scenario applies specifically to inbound_appl_id, outbound_appl_id, and connection_type. When these values are known, the connection_type parameter indicates whether the connection is for a local database or a gateway connection.
State
Input. Indicates under which condition the function called. Possible values are:
  • NEW_CONNECTION - indicates a new physical incoming client connection.
  • AGENT_ASSOCIATION - indicates an existing idle client connection that becomes active again and is associated with an agent to handle the request.
pReservedFlags
Input/output. Reserved for future use. The value must be set to 0 on output.
errormsg
Output. A pointer to the address of an ASCII error message string that is allocated by the communication buffer exit library. This error messages string might be returned in this parameter if the function execution is not successful. This memory is not freed by calling db2commexitFreeErrormsg.
errormsglen
Output. A pointer to an integer that indicates the length, in bytes, of the error message string in the errormsg parameter.