srv_rpcname

Description

Return the name component of the current remote procedure call’s designation.

Syntax

CS_CHAR *srv_rpcname(spp, lenp)
SRV_PROC        *spp;
CS_INT             *lenp;

Parameters

spp

A pointer to an internal thread control structure.

lenp

A pointer to the buffer that will contain the length of the RPC name. lenp can be NULL, in which case the length of the RPC name is not returned.

Returns

Table 3-108:  Return values (srv_rpcname)

Returns

To indicate

A pointer to the null terminated name component of the current RPC’s designation.

The location of the database component of the current RPC’s designation.

A null pointer

There is no current RPC.

Open Server sets lenp to -1 and raises an informational error.

Examples

Example 1

#include        <ospublic.h>
/*
** Local Prototype.
*/
CS_RETCODE      ex_srv_rpcname PROTOTYPE((
SRV_PROC        *sp,
CS_CHAR         *buf,
CS_INT          buflen,
CS_INT          *lenp
));

/*
** EX_SRV_RPCNAME
**
**    This routine demonstrates how to use srv_rrpcname to obtain
 **    the name of the remote procedure call received by this
 **    thread.
**
** Arguments:
**   sp       A pointer to an internal thread control 
 **            structure.
**   buf      The address of the buffer in which the RPC 
 **            name will be returned.
**   buflen   The size of the name buffer.
**   lenp     The address of an integer variable, which 
 **            will be set to the length of the name 
 **            returned.
**
** Returns
**   CS_SUCCEED       If the RPC name is returned.
**   CS_FAIL          If an error occurred.
*/
CS_RETCODE      ex_srv_rpcname(sp, buf, buflen, lenp)
SRV_PROC        *sp;
CS_CHAR         *buf;
CS_INT          buflen;
CS_INT          *lenp;
{
CS_CHAR         *np;    /* The procedure name pointer. */

     /*
     ** Initialization.
     */
     np = (CS_CHAR *)NULL;
     *lenp = (CS_INT)0;

     /*
     ** Get the procedure name.
     */
     np = srv_rpcname(sp, lenp);

     if( np == (CS_CHAR *)NULL )
     {
           /*
           ** An error was al&ready raised.
           */
           return CS_FAIL;
     }

     /*
     ** Copy the RPC name to the output buffer.
     */
     (void)strncpy(buf, np, buflen);

     /*
     ** All done.
     */
     return CS_SUCCEED;
}

Usage

See also

srv_numparams, srv_rpcdb, srv_rpcnumber, srv_rpcoptions, srv_rpcowner