Define and retrieve thread properties.
CS_RETCODE srv_thread_props(spp, cmd, property, bufp, buflen, outlenp)
SRV_PROC *spp; CS_INT cmd; CS_INT property; CS_VOID *bufp; CS_INT buflen; CS_INT *outlenp;
A pointer to an internal thread control structure.
The action to take. The following table summarizes the legal values for cmd:
Value |
Meaning |
---|---|
CS_SET |
The Open Server application is setting the property. In this case, bufp should contain the value the property is to be set to, and buflen should specify the size, in bytes, of that value. |
CS_GET |
The Open Server application is retrieving the property. In this case, bufp should point to the buffer where the property value is placed, and buflen should be the size, in bytes, of the buffer. |
CS_CLEAR |
The Open Server application is resetting the property to its default value. In this case, bufp, buflen, and outlenp are ignored. |
The property being set, retrieved or cleared. See below for a list of this argument’s legal values.
A pointer to the Open Server application data buffer where property value information from the client is placed or property value information is retrieved.
The length, in bytes, of the buffer.
A pointer to a CS_INT variable, which Open Server will set to the size, in bytes, of the property value retrieved. This argument is only used when cmd is CS_GET, and is optional.
Returns |
To indicate |
---|---|
CS_SUCCEED |
The routine completed successfully. |
CS_FAIL |
The routine failed. |
#include <ospublic.h>
/*
** Local Prototype.
*/
CS_RETCODE ex_srv_thread_props PROTOTYPE((
SRV_PROC *sp,
CS_CHAR *user,
CS_INT ulen,
CS_INT *lenp
));
/*
** EX_SRV_THREAD_PROPS
**
** Example routine to obtain a client thread’s user name through
** srv_thread_props.
**
** Arguments:
** sp A pointer to an internal thread control
structure.
** user A pointer to the address of the user name
** buffer.
** ulen The size of the user name buffer.
** lenp A pointer to an integer variable, that will
** be set to the length of the user name string.
**
** Returns:
** CS_TRUE If the user name was returned succesfully.
** CS_FALSE If an error was detected.
*/
CS_RETCODE ex_srv_thread_props(sp, user, ulen, lenp)
SRV_PROC *sp;
CS_CHAR *user;
CS_INT ulen;
CS_INT *lenp;
{
/*
** Call srv_thread_props to get the user name.
*/
if( srv_thread_props(sp, CS_GET, SRV_T_USER, user,
ulen, lenp) == CS_FAIL )
{
/*
** An error was al&ready raised.
*/
return CS_FAIL;
}
/*
** All done.
*/
return CS_SUCCEED;
}
srv_thread_props is called to define, retrieve, and reset thread properties.
The following table summarizes legal property values, whether they can be set or retrieved, and each value’s datatype.
Refer to Table 2-25 for descriptions of each thread property.
Property |
SET/ CLEAR |
GET |
bufp when cmd is CS_SET: |
bufp when cmd is CS_GET: |
---|---|---|---|---|
SRV_T_APPLNAME |
No |
Yes |
Not applicable |
A pointer to a character string |
SRV_T_BYTEORDER |
No |
Yes |
Not applicable |
A pointer to a CS_INT |
SRV_T_BULKTYPE |
No |
Yes |
Not applicable |
A pointer to a CS_INT |
SRV_T_BYTEORDER |
No |
Yes |
Not applicable |
A pointer to a CS_INT |
SRV_T_CHARTYPE |
No |
Yes |
Not applicable |
A pointer to a CS_INT |
SRV_T_CLIB |
No |
Yes |
Not applicable |
A pointer to a character string |
SRV_T_CLIBVERS |
No |
Yes |
Not applicable |
A pointer to a character string |
SRV_T_CLIENTLOGOUT |
No |
Yes |
Not applicable |
A pointer to a CS_BOOL |
SRV_T_CONVERTSHORT |
No |
Yes |
Not applicable |
A pointer to a CS_BOOL |
SRV_T_DUMPLOAD |
No |
Yes |
Not applicable |
A pointer to a CS_BOOL |
SRV_T_ENDPOINT |
No |
Yes |
Not applicable |
A CS_VOID pointer to a buffer of sufficient size to hold the end point (file descriptor or file handle). |
SRV_T_EVENT |
No |
Yes |
Not applicable |
A pointer to a CS_INT |
SRV_T_EVENTDATA |
No |
Yes |
Not applicable |
The address of a CS_VOID pointer |
SRV_T_FLTTYPE |
No |
Yes |
Not applicable |
A pointer to a CS_INT |
SRV_T_GOTATTENTION |
No |
Yes |
Not applicable |
A CS_BOOL |
SRV_T_HOSTNAME |
No |
Yes |
Not applicable |
A pointer to a character string |
SRV_T_HOSTPROCID |
No |
Yes |
Not applicable |
A pointer to a character string |
SRV_T_IODEAD |
No |
Yes |
Not applicable |
A pointer to a CS_BOOL |
SRV_T_LOCALE |
Yes |
Yes |
A pointer to a CS_LOCALE pointer |
A pointer to a CS_LOCALE pointer |
SRV_T_LOGINTYPE |
No |
Yes |
Not applicable |
A pointer to a CS_INT |
SRV_T_MACHINE |
No |
Yes |
Not applicable |
A pointer to a character string |
SRV_T_NEGLOGIN |
No |
Yes |
Not applicable |
A pointer to a CS_INT |
SRV_T_NOTIFYCHARSET |
No |
Yes |
Not applicable |
A pointer to a CS_BOOL |
SRV_T_NOTIFYDB |
No |
Yes |
Not applicable |
A pointer to a CS_BOOL |
SRV_T_NOTIFYLANG |
No |
Yes |
Not applicable |
A pointer to a CS_BOOL |
SRV_T_NUMRMTPWDS |
No |
Yes |
Not applicable |
A pointer to a CS_INT |
SRV_T_PACKETSIZE |
No |
Yes |
Not applicable |
A pointer to a CS_INT |
SRV_T_PASSTHRU |
No |
Yes |
Not applicable |
A pointer to a CS_BOOL |
SRV_T_PRIORITY |
No |
Yes |
Not applicable |
A pointer to a CS_INT |
SRV_T_PWD |
No |
Yes |
Not applicable |
A pointer to a character string |
SRV_T_RETPARMS |
No |
Yes |
Not applicable |
Return parameters sent if an error occurs during execution |
SRV_T_RMTPWDS |
No |
Yes |
Not applicable |
A pointer to an array of SRV_RMTPWD structures |
SRV_T_RMTSERVER |
No |
Yes |
Not applicable |
A pointer to a character string |
SRV_T_ROWSENT |
No |
Yes |
Not applicable |
A pointer to a CS_INT |
SRV_T_SEC_CHANBIND |
No |
Yes |
Not applicable |
A pointer to a CS_BOOL |
SRV_T_SEC_CONFIDENTIALITY |
No |
Yes |
Not applicable |
A pointer to a CS_BOOL |
SRV_T_SEC_CREDTIMEOUT |
No |
Yes |
Not applicable |
A pointer to a CS_INT |
SRV_T_SEC_DATAORIGIN |
No |
Yes |
Not applicable |
A pointer to a CS_BOOL |
SRV_T_SEC_DELEGATION |
No |
Yes |
Not applicable |
A pointer to a CS_BOOL |
SRV_T_SEC_DELEGCRED |
No |
Yes |
Not applicable |
A pointer to a CS_VOID |
SRV_T_SEC_DETECTREPLAY |
No |
Yes |
Not applicable |
A pointer to a CS_BOOL |
SRV_T_SEC_DETECTSEQ |
No |
Yes |
Not applicable |
A pointer to a CS_BOOL |
SRV_T_SEC_INTEGRITY |
No |
Yes |
Not applicable |
A pointer to a CS_BOOL |
SRV_T_SEC_MECHANISM |
No |
Yes |
Not applicable |
A pointer to a CS_CHAR |
SRV_T_SEC_MUTUALAUTH |
No |
Yes |
Not applicable |
A pointer to a CS_BOOL |
SRV_T_SEC_NETWORKAUTH |
No |
Yes |
Not applicable |
A pointer to a CS_BOOL |
SRV_T_SEC_SESSTIMEOUT |
No |
Yes |
Not applicable |
A pointer to a CS_INT |
SRV_T_SPID |
No |
Yes |
Not applicable |
A pointer to a CS_INT |
SRV_T_STACKLEFT |
No |
Yes |
Not applicable |
A pointer to a CS_INT |
SRV_T_TDSVERSION |
Yes |
Yes |
A pointer to a CS_INT |
A pointer to a CS_INT |
SRV_T_TYPE |
No |
Yes |
Not applicable |
A pointer to a CS_INT |
SRV_T_USER |
No |
Yes |
Not applicable |
A pointer to a character string |
SRV_T_USERDATA |
Yes |
Yes |
A CS_VOID pointer |
The address of a CS_VOID pointer |
SRV_T_USERVLANG |
Yes |
Yes |
A pointer to a CS_BOOL |
A pointer to a CS_BOOL |
SRV_T_USTATE |
Yes |
Yes |
A pointer to a character string |
A pointer to a character string |
The following table lists the default values for the thread properties that can be defined (CS_SET).
Property |
Default |
---|---|
SRV_T_USERDATA |
(CS_VOID *)NULL |
SRV_T_USTATE |
NULL string |
SRV_T_TDSVERSION |
Min (client’s, server’s default) |
SRV_T_USESRVLANG |
Value of SRV_S_USESRVLANG |
SRV_T_LOCALE |
(CS_LOCALE *)NULL |
When the property is being retrieved (CS_GET), if buflen indicates that the user buffer is not big enough to hold the property value, Open Server will place the required number of bytes in *outlenp, and the application buffer will not be modified.
See Table 2-25 for descriptions of each thread property.