xdr_netobj()--Translate between Netobj Structures and Their XDR


  Syntax
 #include <rpc/xdr.h>

 bool_t xdr_netobj(XDR *xdrs,
                   struct netobj *np);

  Service Program Name: QZNFTRPC

  Default Public Authority: *USE

  Threadsafe: No

The xdr_netobj() function is a filter primitive that translates between variable-length opaque data and its external representation.


Parameters

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

np  (I/O) 
A pointer to the address of the netobj structure that contains both a length and a pointer to the opaque data.

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

The following example shows how xdr_netobj() is used.

Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.

#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 is it. We can use xdr_netobj() to send
 * the value
 * or xdr_opaque() to send a pointer.
 */
typedef struct handle
{
        int pid;
        int oid;
} handle ;

bool_t xdr_handle(XDR *xdrs, handle *p_handle )
{
     struct netobj obj;
     obj.n_len=sizeof(handle);
     obj.n_bytes=(char *)p_handle;
     return xdr_netobj(xdrs,&obj);
}


API introduced: V4R2

[ Back to top | Remote Procedure Call (RPC) APIs | APIs by category ]