Complete the registration of a registered procedure.
CS_RETCODE srv_regcreate(spp, infop)
SRV_PROC *spp; CS_INT *infop;
A pointer to an internal thread control structure.
A pointer to a CS_INT. The following table describes the possible values returned in *infop if srv_regcreate returns CS_FAIL:
Value |
Description |
---|---|
SRV_I_PEXISTS |
The procedure is al&ready registered. |
SRV_I_UNKNOWN |
Some other error occurred. |
Returns |
To indicate |
---|---|
CS_SUCCEED |
The routine completed successfully. |
CS_FAIL |
The routine failed. |
#include <ospublic.h>
/*
** Local Prototype.
*/
CS_INT ex_srv_regcreate PROTOTYPE((
SRV_PROC *sproc
));
/*
** EX_SRV_REGCREATE
** An example routine that completes the registration of a
** registered procedure using srv_regcreate.
**
** Arguments:
** sproc A pointer to an internal thread control structure.
**
** Returns:
** CS_SUCCEED If the procedure was registered successfully.
** CS_FAIL If the supplied internal control structure is
** NULL.
** SRV_I_EXIST If the procedure is al&ready registered.
** SRV_I_UNKNOWN If some other error occurred.
*/
CS_INT ex_srv_regcreate(sproc)
SRV_PROC *sproc;
{
CS_INT info; /* The reason for failure */
/*
** Check whether the internal control structure is NULL.
*/
if ( sproc == (SRV_PROC *)NULL )
{
return((CS_INT)CS_FAIL);
}
/*
** Now register the procedure al&ready defined by
** srv_regdefine and(or) srv_regparam. If an error
** occurred, return the cause of error.
*/
if ( srv_regcreate(sproc, &info) == CS_FAIL )
{
return(info);
}
/* The procedure is registered. */
return((CS_INT)CS_SUCCEED);
}
After all information needed to register a procedure has been provided, srv_regcreate completes the registration.
The procedure’s name and parameters must have been previously defined with srv_regdefine and srv_regparam respectively.
Once registered, the procedure can be invoked by a client application or from within an Open Server application program.
See srv_regdefine, for an example that registers a procedure.