Transfer Tabular Data Stream (TDS) login response information from a DBPROCESS structure to a newly allocated DBLOGINFO structure.
RETCODE dbgetloginfo(dbproc, loginfo) DBPROCESS *dbproc; DBLOGINFO **loginfo;
A pointer to the DBPROCESS structure that provides the connection for a particular front-end/server process. It contains all the information that DB-Library/C uses to manage communications and data between the front end and the server.
The address of a DBLOGINFO pointer variable. dbgetloginfo sets the DBLOGINFO pointer to the address of a newly-allocated DBLOGINFO structure.
SUCCEED or FAIL.
dbgetloginfo transfers TDS login response information from a DBPROCESS structure to a newly allocated DBLOGINFO structure.
An application needs to call dbgetloginfo only if 1) it is an Open Server gateway application, and 2) it is using TDS passthrough.
TDS is an application protocol used for the transfer of requests and request results between clients and servers.
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 application 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.
dbgetloginfo is the second of four calls, two of them Server Library calls, that allow a client and remote server to negotiate a TDS format. The calls, which can be made only in a SRV_CONNECT event handler, are:
srv_getloginfo - allocate a DBLOGINFO structure and fill it with TDS information from a client SRV_PROC.
dbsetloginfo - transfer the TDS information retrieved in step 1 from the DBLOGINFO structure to a DB-Library/C LOGINREC structure, and then free the DBLOGINFO structure. After the information is transferred, the application can use this LOGINREC structure in the dbopen call which establishes its connection with the remote server.
dbgetloginfo - transfer the remote server’s response to the client’s TDS information from a DBPROCESS structure into a newly-allocated DBLOGINFO structure.
srv_setloginfo - send the remote server’s response, retrieved in the previous step, to the client, and then free the DBLOGINFO structure.
This is an example of a SRV_CONNECT handler preparing a remote connection for TDS passthrough:
RETCODE connect_handler(srvproc)
SRVPROC *srvproc;
{
DBLOGINFO *loginfo;
LOGINREC *loginrec;
DBPROCESS *dbproc;
/*
** Get the TDS login information from the client
** SRV_PROC.
*/
srv_getloginfo(srvproc, &loginfo);
/* Get a LOGINREC structure */
loginrec = dblogin();
/*
** Initialize the LOGINREC with the login info
** from the SRV_PROC.
*/
dbsetloginfo(loginrec, loginfo);
/* Connect to the remote server */
dbproc = dbopen(loginrec, REMOTE_SERVER_NAME);
/*
** Get the TDS login response information from
** the remote connection.
*/
dbgetloginfo(dbproc, &loginfo);
/*
** Return the login response information to the
** SRV_PROC.
*/
srv_setloginfo(srvproc, loginfo);
/* Accept the connection and return */
srv_senddone(srvproc, 0, 0, 0);
return(SRV_CONTINUE);
}