A security session callback is defined as follows:
CS_RETCODE CS_PUBLIC secsession_cb (conn, numinputs, infmt, inbuf, numoutputs, outfmt, outbuf, outlen) CS_CONNECTION *conn; CS_INT numinputs; CS_DATAFMT *infmt; CS_BYTE **inbuf; CS_INT *numoutputs; CS_DATAFMT *outfmt; CS_BYTE **outbuf; CS_INT *outlen;
where:
connection is a pointer to the connection structure that controls the connection to the gateway’s remote server.
numinputs is the number of input parameters sent by the remote server with the security session message.
infmt is the address of an array of CS_DATAFMT structures that describe each input parameter sent by the remote server.
inbuf is the address of an array of CS_BYTE * pointers that point to buffers containing the data for each input parameter. The length of each buffer inbuf[i] is given as infmt[i] ->.maxlength
numoutputs is the address of a CS_INT. The callback must return the number of items sent by the client in *numoutputs. On input, *numoutputs specifies the length of the outfmt, outbuf, and outlen arrays.
outfmt is the address of an array of CS_DATAFMT structures. The callback must place a description of each item in the client’s response into the corresponding CS_DATAFMT structure. The input value of *numoutputs specifies the length of this array.
outbuf is the address of an array of CS_BYTE * buffers. The callback must copy the data items from the client’s response into the corresponding buffer. The input value of *numoutputs specifies the length of this array, and for each buffer i, the input value of outfmt[i]−>maxlength specifies the allocated length of the buffer pointed at by outbuf[i].
outlen is the address of an array of CS_INT. The callback places the number of bytes written to each buffer into outlen[i].
The callback forwards the security session message data and reads the client’s response with Server-Library calls. See the reference page for srv_negotiate in the Open Server Server-Library/C Reference Manual.
A security session callback returns CS_SUCCEED or CS_FAIL. If the callback returns CS_FAIL, Client-Library aborts the connection attempt. Other return values are illegal: Client-Library responds by raising an error and aborting the connection attempt.