Define and retrieve Open Server properties.
CS_RETCODE srv_props(cp, cmd, property, bufp, buflen, outlenp)
CS_CONTEXT *cp; CS_INT cmd; CS_INT property; CS_VOID *bufp; CS_INT buflen; CS_INT *outlenp;
A pointer to a CS_CONTEXT structure previously allocated using cs_ctx_alloc.
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 is placed (CS_SET) or property value information is retrieved (CS_GET).
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_set_propPROTOTYPE((
CS_CONTEXT *cp,
CS_INT property,
CS_VOID *bufp,
CS_INT buflen
));
/*
** EX_SRV_SET_PROP
**
** Example routine to set a property using srv_props.
**
** Arguments:
**
** *cp Pointer to a CS_CONTEXT structure previously
** allocated by cs_ctx_alloc.
** property The property being set.
** *bufp Pointer to the value the property is to be
** set to.
** buflen The length of the value.
**
** Returns
**
** CS_SUCCEED Arguments were valid and srv_props was called.
** CS_FAIL An error was detected.
**
*/
CS_RETCODE ex_srv_set_prop(cp, property, bufp, buflen)
CS_CONTEXT *cp;
CS_INT property;
CS_VOID *bufp;
CS_INT buflen;
{
/* Check arguments. */
if(cp == (CS_CONTEXT *)NULL)
{
return(CS_FAIL);
}
if(buflen < 1)
return(CS_FAIL); return(srv_props(cp,(CS_INT)CS_SET,property,bufp,buflen,
(CS_INT *)0));
}
srv_props is called to define and retrieve server-wide configuration parameters and properties.
srv_version must be called before srv_props can be called. Any properties to be set by srv_props must be set before srv_init is called.
The following table summarizes the server properties, whether they can be set or retrieved, and the datatype of each property value:
Property |
SET/ CLEAR |
GET |
bufp when cmd is CS_SET |
bufp when cmd is CS_GET |
---|---|---|---|---|
SRV_S_ALLOCFUNC |
Yes |
Yes |
A function pointer |
The address of a function pointer |
SRV_S_APICHK |
Yes |
Yes |
A CS_BOOL |
A CS_BOOL |
SRV_S_ATTNREASON |
No |
Yes |
Not applicable |
A CS_INT |
SRV_S_CERT_AUTH |
Yes |
Yes |
char* |
char* |
SRV_S_CURTHREAD |
No |
Yes |
Not applicable |
The address of a thread pointer |
SRV_S_DISCONNECT |
Yes |
Yes |
A CS_BOOL |
A CS_BOOL |
SRV_S_DEFQUEUESIZE |
Yes |
Yes |
A CS_INT |
A CS_INT |
SRV_S_DS_PROVIDER |
Yes |
Yes |
A pointer to a character string |
A pointer to a character string |
SRV_S_DS_REGISTER |
Yes |
Yes |
A CS_BOOL |
A CS_BOOL |
SRV_S_ERRHANDLE |
Yes |
Yes |
A function pointer |
The address of a function pointer |
SRV_S_FREEFUNC |
Yes |
Yes |
A function pointer |
The address of a function pointer |
SRV_S_IFILE |
Yes |
Yes |
A character string |
A character string |
SRV_S_LOGFILE |
Yes |
Yes |
A character string |
A character string |
SRV_S_LOGSIZE |
Yes |
Yes |
A CS_INT |
A CS_INT |
SRV_S_MSGPOOL |
Yes |
Yes |
A CS_INT |
A CS_INT |
SRV_S_NETBUFSIZE |
Yes |
Yes |
A CS_INT |
A CS_INT |
SRV_S_NETTRACEFILE |
Yes |
Yes |
A character string |
A character string |
SRV_S_NUMCONNECTIONS |
Yes |
Yes |
A CS_INT |
A CS_INT |
SRV_S_NUMMSGQUEUES |
Yes |
Yes |
A CS_INT |
A CS_INT |
SRV_S_NUMMUTEXES |
Yes |
Yes |
A CS_INT |
A CS_INT |
SRV_S_NUMREMBUF |
Yes |
Yes |
A CS_INT |
A CS_INT |
SRV_S_NUMREMSITES |
Yes |
Yes |
A CS_INT |
A CS_INT |
SRV_S_NUMTHREADS |
Yes |
Yes |
A CS_INT |
A CS_INT |
SRV_S_NUMUSEREVENTS |
Yes |
Yes |
A CS_INT |
A CS_INT |
SRV_S_PREEMPT |
Yes |
Yes |
A CS_BOOL |
A CS_BOOL |
SRV_S_REALLOCFUNC |
Yes |
Yes |
A function pointer |
The address of a function pointer |
SRV_S_RETPARMS |
Yes |
Yes |
A CS_BOOL |
A CS BOOL |
SRV_S_REQUESTCAP |
Yes |
Yes |
A CS_CAP_TYPE structure |
A CS_CAP_TYPE structure |
SRV_S_RESPONSECAP |
Yes |
Yes |
A CS_CAP_TYPE structure |
A CS_CAP_TYPE structure |
SRV_S_SEC_KEYTAB |
Yes |
Yes |
A pointer to a character string |
A pointer to a character string |
SRV_S_SEC_PRINCIPAL |
Yes |
Yes |
A pointer to a character string |
A pointer to a character string |
SRV_S_SERVERNAME |
No |
Yes |
A character string |
A character string |
SRV_S_SSL_CIPHER |
Yes |
No |
char* |
|
SRV_S_SSL_LOCAL_ID |
Yes |
Yes |
struct |
char* |
SRV_S_SSL_VERSION |
Yes |
No |
CS_INT |
|
SRV_S_STACKSIZE |
Yes |
Yes |
A CS_INT |
A CS_INT |
SRV_S_TDSVERSION |
Yes |
Yes |
A CS_INT |
A CS_INT |
SRV_S_TIMESLICE |
Yes |
Yes |
A CS_INT |
A CS_INT |
SRV_S_TRACEFLAG |
Yes |
Yes |
A CS_INT (bit mask) |
A CS_INT (bit mask) |
SRV_S_TRUNCATELOG |
Yes |
Yes |
A CS_BOOL |
A CS_BOOL |
SRV_S_USESRVLANG |
Yes |
Yes |
A CS_BOOL |
A CS_BOOL |
SRV_S_VERSION |
No |
Yes |
Not applicable |
A character string |
SRV_S_VIRTCLKRATE |
Yes |
Yes |
A CS_INT |
A CS_INT |
SRV_S_VIRTTIMER |
Yes |
Yes |
A CS_BOOL |
A CS_BOOL |
The following table lists the default value for each server property:
Property |
Default |
---|---|
SRV_S_ALLOCFUNC |
malloc() |
SRV_S_APICHK |
CS_TRUE |
SRV_S_ATTNREASON |
No default |
SRV_S_CURTHREAD |
N/A. |
SRV_S_DEFQUEUESIZE |
SRV_DEF_DEFQUEUESIZE |
SRV_S_DISCONNECT |
CS_FALSE |
SRV_S_DS_PROVIDER |
Platform dependent. Refer to the Open Client and Open Server Configuration Guide for your platform. |
SRV_S_DS_REGISTER |
CS_TRUE, Server-Library registers itself with a directory on start-up. |
SRV_S_ERRHANDLE |
No error handler |
SRV_S_FREEFUNC |
free() |
SRV_S_IFILE |
$SYBASE/interfaces |
SRV_S_LOGFILE |
srv.log |
SRV_S_LOGSIZE |
Max integer value |
SRV_S_MSGPOOL |
SRV_DEF_MSGPOOL |
SRV_S_NETBUFSIZE |
SRV_DEF_NETBUFSIZE |
SRV_S_NETTRACEFILE |
sybnet.dbg |
SRV_S_NUMCONNECTIONS |
SRV_DEF_NUMCONNECTIONS |
SRV_S_NUMMSGQUEUES |
SRV_DEF_NUMMSGQUEUES |
SRV_S_NUMMUTEXES |
SRV_DEF_NUMMUTEXES |
SRV_S_NUMREMBUF |
SRV_DEF_NUMREMBUF |
SRV_S_NUMREMSITES |
SRV_DEF_NUMREMSITES |
SRV_S_NUMTHREADS |
SRV_DEF_NUMTHREADS |
SRV_S_NUMUSEREVENTS |
SRV_DEF_NUMUSEREVENTS |
SRV_S_PREEMPT |
CS_FALSE |
SRV_S_REALLOCFUNC |
realloc() |
SRV_S_REQUESTCAP |
See “Capabilities” |
SRV_S_RESPONSECAP |
See “Capabilities” |
SRV_S_RETPARMS |
No default |
SRV_S_SEC_KEYTAB |
No default |
SRV_S_SEC_PRINCIPAL |
Security mechanism dependent |
SRV_S_SERVERNAME |
DSLISTEN environment variable |
SRV_S_STACKSIZE |
SRV_DEF_STACKSIZE |
SRV_S_TDSVERSION |
SRV_TDS_5_0 |
SRV_S_TIMESLICE |
SRV_DEF_TIMESLICE |
SRV_S_TRACEFLAG |
0 |
SRV_S_TRUNCATELOG |
CS_FALSE |
SRV_S_USESRVLANG |
CS_TRUE |
SRV_S_VERSION |
Compile-time version string |
SRV_S_VIRTCLKRATE |
SRV_DEF_VIRTCLKRATE |
SRV_S_VIRTTIMER |
CS_FALSE |
All server properties that have a default and are settable can be reset back to the default value by calling srv_props with cmd set to CS_CLEAR.
All server properties can be retrieved at any time by calling srv_props with cmd set to CS_GET. If the Open Server application has not defined a value for a property, the default value is returned.
For a description of properties, see the Properties topic page.
All properties must be set before srv_init is called, except SRV_S_TRACEFLAG.
When a property is being retrieved, if buflen indicates that the user buffer is not big enough to hold the property value, Open Server will place the number of bytes required in *outlenp, and the user buffer will not be modified.