xdr_wrapstring()--Call the xdr_string() Function


  Syntax
 #include <rpc/xdr.h>

 bool_t xdr_wrapstring(XDR *xdrs,
                       char **sp);

  Service Program Name: QZNFTRPC

  Default Public Authority: *USE

  Threadsafe: No

The xdr_wrapstring() function is a primitive that calls the xdr_string(xdr, sp, maxuint) API, where maxuint is the maximum value of an unsigned integer. The xdr_wrapstring() is useful where a translation of xdrproc_t is required. xdrproc_t has only two parameters while the xdr_string() function requires three.


Parameters

xdrs  (Input) 
A pointer to the eXternal Data Representation (XDR) stream handle.

sp  (I/O) 
The address of the pointer to the string. If decoding and *sp==NULL, XDR allocated memory for the decoded string.

Authorities

No authorization is required.


Return Value

TRUE (1) Successful
FALSE (0) Unsuccessful


Error Conditions

None.


Error Messages

Message ID Error Message Text
CPE3418 E Possible APAR condition or hardware failure.
CPF3CF2 E Error(s) occurred during running of &1 API.
CPF9872 E Program or service program &1 in library &2 ended. Reason code &3.


Example

See Code disclaimer information for information pertaining to code examples.

The following example shows how xdr_wrapstring() is used:

#include <stdio.h>
#include <xdr.h>

#define MAX_LENGTH 100
typedef struct address
{
        char  street[MAX_LENGTH];
        int   number;
        int   apartment;
} address ;

bool_t xdr_address(XDR *xdrs, address *p_address)
{
        if!(xdr_wrapstring(xdrs,&(p_address->street)))
                return FALSE;
        if(!xdr_int(xdrs,&(p_address->number)))
                return FALSE;
        return xdr_int(xdrs,&(p_address->apartment));
}


API introduced: V4R2
Top | Remote Procedure Call (RPC) APIs | APIs by category