Transfer TDS login response information from a CS_LOGINFO structure to a CS_CONNECTION structure.
CS_RETCODE ct_setloginfo (connection, loginfo) CS_CONNECTION *connection; CS_LOGINFO *loginfo;
A pointer to a CS_CONNECTION structure. A CS_CONNECTION structure contains information about a particular client/server connection.
A pointer to a CS_LOGINFO structure.
ct_setloginfo returns the following values:
Return value |
Meaning |
---|---|
CS_SUCCEED |
The routine completed successfully. |
CS_FAIL |
The routine failed. |
CS_BUSY |
An asynchronous operation is already pending for this connection. See “Asynchronous programming”. |
TDS (Tabular Data Stream) is a communications protocol used for the transfer of requests and request results between Sybase clients and servers.
Because ct_setloginfo frees the CS_LOGINFO structure after transferring the TDS information, an application cannot use the CS_LOGINFO again. An application can get a new CS_LOGINFO by calling ct_getloginfo.
There are two reasons an application might call ct_setloginfo:
If it is an Open Server gateway application using TDS passthrough.
To copy login properties from an open connection to a newly allocated connection structure.
Do not call ct_setloginfo from within a completion callback routine. ct_setloginfo calls system-level memory functions which may not be reentrant.
When a client connects directly to a server, the two programs negotiate the TDS format they will use to send and receive data. When a gateway application uses TDS passthrough, the gateway forwards TDS packets between the client and a remote server without examining or processing them. For this reason, the remote server and the client must agree on a TDS format to use.
ct_setloginfo is the second of four calls, two of them Server Library calls, that allow a client and a remote server to negotiate a TDS format. The calls, which can be made only in an Open Server SRV_CONNECT event handler, are:
srv_getloginfo to allocate a CS_LOGINFO structure and fill it with TDS information from a client login request.
ct_setloginfo to transfer the TDS information retrieved in step 1 from the CS_LOGINFO structure to a Client-Library CS_CONNECTION structure. The gateway uses this CS_CONNECTION structure in the ct_connect call which establishes its connection with the remote server.
ct_getloginfo to transfer the remote server’s response to the client’s TDS information from the CS_CONNECTION structure into a newly allocated CS_LOGINFO structure.
srv_setloginfo to send the remote server’s response, retrieved in step 3, to the client.
For information on using ct_setloginfo to copy login properties from an open connection to a newly allocated connection structure, see “Copying login properties”.