srv_thread_props

Description

Define and retrieve thread properties.

Syntax

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;

Parameters

spp

A pointer to an internal thread control structure.

cmd

The action to take. Table 3-142 summarizes the legal values for cmd:

Table 3-142: Values for cmd (srv_thread_props)

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.

property

The property being set, retrieved or cleared. See below for a list of this argument’s legal values.

bufp

A pointer to the Open Server application data buffer where property value information from the client is placed or property value information is retrieved.

buflen

The length, in bytes, of the buffer.

outlenp

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

Table 3-143:  Return values (srv_thread_props)

Returns

To indicate

CS_SUCCEED

The routine completed successfully.

CS_FAIL

The routine failed.

Examples

Example 1

#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;
}

Usage

See also

srv_props, “Properties”