A negotiation callback is defined as follows:
CS_RETCODE CS_PUBLIC negotiation_cb(connection, inmsgid, outmsgid, inbuffmt, inbuf,outbuffmt, outbuf, outbufoutlen) CS_CONNECTION *connection; CS_INT inmsgid; CS_INT *outmsgid; CS_DATAFMT *inbuffmt; CS_BYTE *inbuf; CS_DATAFMT *outbuffmt; CS_BYTE *outbuf; CS_INT *outbufoutlen;
where:
connection is a pointer to the CS_CONNECTION structure representing the connection that is logging into the server.
inmsgid is the type of information that the server is requesting. inmsgid can be any of the following values:
Value of inmsgid |
Meaning |
---|---|
CS_MSG_GETLABELS |
The server is requesting security labels. |
A value < CS_USER_MSGID |
The server is requesting a Sybase-defined value. |
A user-defined value >= CS_USER_MSGID and <= CS_USER_MAX_MSGID |
The Open Server application is requesting an application-defined value. The negotiation callback’s must interpret inmsgid. |
outmsgid is the type of information that the negotiation callback is returning. This table lists the values that are legal for outmsgid:
Value of outmsgid |
Indicates: |
---|---|
CS_MSG_LABELS |
The negotiation callback is returning security labels. |
A value < CS_USER_MSGID |
The callback is returning a Sybase-defined value. |
A user-defined value >= CS_USER_MSGID and <= CS_USER_MAX_MSGID |
The callback is returning an application-defined value. |
inbuffmt is a pointer to a CS_DATAFMT structure. If the negotiation callback is handling a trusted-user handshake, inbuffmt is NULL. If the negotiation callback is handling a challenge/response handshake, *inbuffmt describes the inbuf challenge key.
inbuf is a pointer to data space. If the negotiation callback is handling a trusted-user handshake, inbuf is NULL. If the negotiation callback is handling a challenge/response handshake, inbuf points to the challenge key.
inbuffmt is a pointer to a CS_DATAFMT structure. The negotiation callback should fill this CS_DATAFMT with a description of the security label or response that it is returning.
Client-Library does not define which fields in the CS_DATAFMT need to be set.
outbuf is a pointer to a buffer. The negotiation callback should place the security label or response in this buffer. This buffer is allocated and freed by Client-Library. Its length is described by outbuffmt−>maxlength.
outbufoutlen is the length, in bytes, of the data placed in *outbuf.
A negotiation callback must return CS_SUCCEED, CS_FAIL, or CS_CONTINUE:
If the callback returns CS_CONTINUE, Client-Library calls the negotiation callback again to generate an additional security label or response.
If the callback returns CS_SUCCEED, Client-Library sends the security label(s) or response(s) to the server.
If the callback returns CS_FAIL, Client-Library aborts the connection process, causing ct_connect to return CS_FAIL.