233 lines
5.6 KiB
HTML
233 lines
5.6 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<meta name="Copyright" content="Copyright (c) 2006 by IBM Corporation">
|
|
<title>xdr_array()--Translate between Arrays and Their XDR</title>
|
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
|
<!-- US Government Users Restricted Rights -->
|
|
<!-- Use, duplication or disclosure restricted by -->
|
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
|
<!-- Begin Header Records ========================================== -->
|
|
<!-- RPCMST SCRIPT A converted by B2H R4.1 (346) (CMS) by PMHALL at -->
|
|
<!-- RCHVMW2 on 7 Oct 1998 at 23:43:14 -->
|
|
<!-- Edited by Kersten Feb 02 -->
|
|
<!--End Header Records -->
|
|
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
|
|
</head>
|
|
<body>
|
|
<a name="Top_of_Page"></a>
|
|
<!-- Java sync-link -->
|
|
<script language="Javascript" src="../rzahg/synch.js" type="text/javascript">
|
|
</script>
|
|
|
|
<h2>xdr_array()--Translate between Arrays and Their XDR</h2>
|
|
|
|
<div class="box" style="width: 60%;">
|
|
<br>
|
|
Syntax<br>
|
|
<pre>
|
|
#include <rpc/xdr.h>
|
|
|
|
bool_t xdr_array(XDR *<em>xdrs</em>,
|
|
caddr_t *<em>arrp</em>,
|
|
u_int *<em>sizep</em>,
|
|
const u_int <em>maxsize</em>,
|
|
const u_int <em>elsize</em>,
|
|
const xdrproc_t <em>elproc</em>);
|
|
</pre>
|
|
|
|
<br>
|
|
Service Program Name: QZNFTRPC<br>
|
|
<!-- iddvc RMBR -->
|
|
<br>
|
|
Default Public Authority: *USE<br>
|
|
<!-- iddvc RMBR -->
|
|
<br>
|
|
Threadsafe: No<br>
|
|
<!-- iddvc RMBR -->
|
|
<br>
|
|
</div>
|
|
|
|
<p>The <strong>xdr_array()</strong> function is a filter primitive that
|
|
translates between variable-length arrays and their corresponding external
|
|
representations. This function is called to encode or decode each element of
|
|
the array.</p>
|
|
|
|
<br>
|
|
|
|
|
|
<h3>Parameters</h3>
|
|
|
|
<dl>
|
|
<dt><strong>xdrs</strong> (Input) </dt>
|
|
|
|
<dd>A pointer to the eXternal Data Representation (XDR) stream handle.<br>
|
|
<br>
|
|
</dd>
|
|
|
|
<dt><strong>arrp</strong> (I/O) </dt>
|
|
|
|
<dd>The address of the pointer to the array. If *arrp==NULL and the array is
|
|
being deserialized, XDR allocates an array of the appropriate size and sets
|
|
this parameter to point to that array.<br>
|
|
<br>
|
|
</dd>
|
|
|
|
<dt><strong>sizep</strong> (I/O) </dt>
|
|
|
|
<dd>The address of the element count of the array. The element count cannot
|
|
exceed the value for the <em>maxsize</em> parameter.<br>
|
|
<br>
|
|
</dd>
|
|
|
|
<dt><strong>maxsize</strong> (Input) </dt>
|
|
|
|
<dd>The maximum number of array elements.<br>
|
|
<br>
|
|
</dd>
|
|
|
|
<dt><strong>elsize</strong> (Input) </dt>
|
|
|
|
<dd>The byte size of each of the array elements.<br>
|
|
<br>
|
|
</dd>
|
|
|
|
<dt><strong>elproc</strong> (Input) </dt>
|
|
|
|
<dd>Translates between the C form of the array elements and their external
|
|
representations. This parameter is an XDR filter.</dd>
|
|
</dl>
|
|
|
|
<br>
|
|
|
|
|
|
<h3>Authorities</h3>
|
|
|
|
<p>No authorization is required.</p>
|
|
|
|
<br>
|
|
|
|
|
|
<h3>Return Value</h3>
|
|
|
|
<table cellpadding="5">
|
|
<!-- cols="15 85" -->
|
|
<tr>
|
|
<td align="left" valign="top"><em>TRUE (1)</em></td>
|
|
<td align="left" valign="top">Successful</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top"><em>FALSE (0)</em></td>
|
|
<td align="left" valign="top">Unsuccessful</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<br>
|
|
<br>
|
|
|
|
|
|
<h3>Error Conditions</h3>
|
|
|
|
<p>None.</p>
|
|
|
|
<br>
|
|
|
|
|
|
<h3>Error Messages</h3>
|
|
|
|
<table width="100%" cellpadding="5">
|
|
<!-- cols="15 85" -->
|
|
<tr>
|
|
<th align="left" valign="top">Message ID</th>
|
|
<th align="left" valign="top">Error Message Text</th>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td width="15%" valign="top">CPE3418 E</td>
|
|
<td width="85%" valign="top">Possible APAR condition or hardware failure.</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top">CPF3CF2 E</td>
|
|
<td align="left" valign="top">Error(s) occurred during running of &1 API.</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top">CPF9872 E</td>
|
|
<td align="left" valign="top">Program or service program &1 in library &2 ended.
|
|
Reason code &3.</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<br>
|
|
<br>
|
|
|
|
|
|
<h3>Example</h3>
|
|
|
|
<p>See <a href="../apiref/aboutapis.htm#codedisclaimer">Code disclaimer information</a>
|
|
for information pertaining to code examples.</p>
|
|
|
|
<p>The following example shows how <strong>xdr_array()</strong> is used:</p>
|
|
|
|
<pre>
|
|
#include <stdio.h>
|
|
#include <values.h>
|
|
#include <xdr.h>
|
|
|
|
#define ARRAY_SIZE 256
|
|
|
|
typedef struct xarray
|
|
{
|
|
int size;
|
|
int *p_array;
|
|
} xarray ;
|
|
|
|
bool_t xdr_xarray(XDR *xdrs, xarray *p_xarray )
|
|
{
|
|
/*
|
|
* Force XDR to allocate memory while decoding
|
|
*/
|
|
if((xdrs->x_op==XDR_DECODE)&&
|
|
(p_xarray->p_array!=NULL))
|
|
{
|
|
free(p_xarray->p_array);
|
|
p_xarray->p_array=NULL;
|
|
}
|
|
/*
|
|
* This code has a dual job :
|
|
* A) While decoding, it allocated memory, stores the decoded
|
|
* xarray in it, and updates size field in xarray
|
|
* struct.
|
|
* B) While decoding it stores xarray's size and the data
|
|
* itself in XDR.
|
|
*/
|
|
return <strong>xdr_array</strong>(
|
|
xdrs,
|
|
(char**)(&(p_xarray->p_array)),
|
|
&(p_xarray->size),
|
|
MAX_INT,
|
|
sizeof(int),
|
|
(xdrproc_t)xdr_int))
|
|
|
|
}
|
|
</pre>
|
|
|
|
<br>
|
|
<hr>
|
|
API introduced: V4R2
|
|
|
|
<hr>
|
|
<table cellpadding="2" cellspacing="2" align="center">
|
|
<tr align="center">
|
|
<td valign="middle" align="center"><a href="#Top_Of_Page">Top</a> | <a href=
|
|
"rpc1.htm">Remote Procedure Call (RPC) APIs</a> | <a href="aplist.htm">APIs by
|
|
category</a></td>
|
|
</tr>
|
|
</table>
|
|
</body>
|
|
</html>
|
|
|