xdr_opaque()--Translate between Fixed-Size Data and Its XDR


  Syntax
 #include <rpc/xdr.h>

 bool_t xdr_opaque(XDR *xdrs,
                   caddr_t cp,
                   const u_int cnt);

  Service Program Name: QZNFTRPC

  Default Public Authority: *USE

  Threadsafe: No

The xdr_opaque() function is a filter primitive that translates between fixed-size opaque data and its external representation.


Parameters

xdrs  (Input) 
A pointer to the eXternal Data Representation (XDR) stream handle.
cp  (I/O) 
The address of the opaque object.

cnt  (Input) 
The size, in bytes, of the object. By definition, the actual data that is contained in the opaque object will not be portable to another system.

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_opaque() is used:

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

/*
 * Handle of an external client -
 * pid - process ID of the server process on our host
 * oid - object ID of the server assigned to that client
 * Typical case when the other side needs a handle, without
 * actually knowing what it is. We can use xdr_netobj()
 * or xdr_opaque().
 */
typedef struct handle
{
        int pid;
        int oid;
} handle ;

bool_t xdr_handle(XDR *xdrs, handle *p_handle )
{
     return xdr_opaque(xdrs,(caddr_t)p_handle,sizeof(handle));
}


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