2 .\" Copyright 2014 Nexenta Systems, Inc. All rights reserved.
3 .\" Copyright (c) 2001, Sun Microsystems, Inc. All Rights Reserved.
4 .\" Copyright 1989 AT&T
5 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
6 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
7 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
8 .TH XDR_SIMPLE 3NSL "Oct 22, 2014"
10 xdr_simple, xdr_bool, xdr_char, xdr_double, xdr_enum, xdr_float, xdr_free,
11 xdr_hyper, xdr_int, xdr_long, xdr_longlong_t, xdr_quadruple, xdr_short,
12 xdr_u_char, xdr_u_hyper, xdr_u_int, xdr_u_long, xdr_u_longlong_t, xdr_u_short,
13 xdr_void \- library routines for external data representation
21 \fBbool_t\fR \fBxdr_bool\fR(\fBXDR *\fR\fIxdrs\fR, \fBbool_t *\fR\fIbp\fR);
26 \fBbool_t\fR \fBxdr_char\fR(\fBXDR *\fR\fIxdrs\fR, \fBchar *\fR\fIcp\fR);
31 \fBbool_t\fR \fBxdr_double\fR(\fBXDR *\fR\fIxdrs\fR, \fBdouble *\fR\fIdp\fR);
36 \fBbool_t\fR \fBxdr_enum\fR(\fBXDR *\fR\fIxdrs\fR, \fBenum_t *\fR\fIep\fR);
41 \fBbool_t\fR \fBxdr_float\fR(\fBXDR *\fR\fIxdrs\fR, \fBfloat *\fR\fIfp\fR);
46 \fBvoid\fR \fBxdr_free\fR(\fBxdrproc_t\fR \fIproc\fR, \fBchar *\fR\fIobjp\fR);
51 \fBbool_t\fR \fBxdr_hyper\fR(\fBXDR *\fR\fIxdrs\fR, \fBlonglong_t *\fR\fIllp\fR);
56 \fBbool_t\fR \fBxdr_int\fR(\fBXDR *\fR\fIxdrs\fR, \fBint *\fR\fIip\fR);
61 \fBbool_t\fR \fBxdr_long\fR(\fBXDR *\fR\fIxdrs\fR, \fBlongt *\fR\fIlp\fR);
66 \fBbool_t\fR \fBxdr_longlong_t\fR(\fBXDR *\fR\fIxdrs\fR, \fBlonglong_t *\fR\fIllp\fR);
71 \fBbool_t\fR \fBxdr_quadruple\fR(\fBXDR *\fR\fIxdrs\fR, \fBlong double *\fR\fIpq\fR);
76 \fBbool_t\fR \fBxdr_short\fR(\fBXDR *\fR\fIxdrs\fR, \fBshort *\fR\fIsp\fR);
81 \fBbool_t\fR \fBxdr_u_char\fR(\fBXDR *\fR\fIxdrs\fR, \fBunsigned char *\fR\fIucp\fR);
86 \fBbool_t\fR \fBxdr_u_hyper\fR(\fBXDR *\fR\fIxdrs\fR, \fBu_longlong_t *\fR\fIullp\fR);
91 \fBbool_t\fR \fBxdr_u_int\fR(\fBXDR *\fR\fIxdrs\fR, \fBunsigned *\fR\fIup\fR);
96 \fBbool_t\fR \fBxdr_u_long\fR(\fBXDR *\fR\fIxdrs\fR, \fBunsigned long *\fR\fIulp\fR);
101 \fBbool_t\fR \fBxdr_u_longlong_t\fR(\fBXDR *\fR\fIxdrs\fR, \fBu_longlong_t *\fR\fIullp\fR);
106 \fBbool_t\fR \fBxdr_u_short\fR(\fBXDR\fR \fIxdrs\fR, \fBunsigned short *\fR\fIusp\fR);
111 \fBbool_t\fR \fBxdr_void\fR(void)
117 The \fBXDR\fR library routines allow C programmers to describe simple data
118 structures in a machine-independent fashion. Protocols such as remote procedure
119 calls (RPC) use these routines to describe the format of the data.
122 These routines require the creation of \fBXDR\fR streams (see
123 \fBxdr_create\fR(3NSL)).
127 See \fBrpc\fR(3NSL) for the definition of the \fBXDR\fR data structure. Note
128 that any buffers passed to the \fBXDR\fR routines must be properly aligned. It
129 is suggested that \fBmalloc\fR(3C) be used to allocate these buffers or that
130 the programmer insure that the buffer address is divisible evenly by four.
134 \fB\fBxdr_bool()\fR\fR
137 \fBxdr_bool()\fR translates between booleans (C integers) and their external
138 representations. When encoding data, this filter produces values of either
139 \fB1\fR or \fB0\fR. This routine returns \fBTRUE\fR if it succeeds, \fBFALSE\fR
146 \fB\fBxdr_char()\fR\fR
149 \fBxdr_char()\fR translates between C characters and their external
150 representations. This routine returns \fBTRUE\fR if it succeeds, \fBFALSE\fR
151 otherwise. Note: encoded characters are not packed, and occupy 4 bytes each.
152 For arrays of characters, it is worthwhile to consider \fBxdr_bytes()\fR,
153 \fBxdr_opaque()\fR, or \fBxdr_string()\fR (see \fBxdr_complex\fR(3NSL)).
159 \fB\fBxdr_double()\fR\fR
162 \fBxdr_double()\fR translates between C \fBdouble\fR precision numbers and
163 their external representations. This routine returns \fBTRUE\fR if it succeeds,
164 \fBFALSE\fR otherwise.
170 \fB\fBxdr_enum()\fR\fR
173 \fBxdr_enum()\fR translates between C \fBenum\fRs (actually integers) and their
174 external representations. This routine returns \fBTRUE\fR if it succeeds,
175 \fBFALSE\fR otherwise.
181 \fB\fBxdr_float()\fR\fR
184 \fBxdr_float()\fR translates between C \fBfloat\fRs and their external
185 representations. This routine returns \fBTRUE\fR if it succeeds, \fBFALSE\fR
192 \fB\fBxdr_free()\fR\fR
195 Generic freeing routine. The first argument is the \fBXDR\fR routine for the
196 object being freed. The second argument is a pointer to the object itself.
197 Note: the pointer passed to this routine is not freed, but what it points to is
198 freed (recursively, depending on the XDR routine).
204 \fB\fBxdr_hyper()\fR\fR
207 \fBxdr_hyper()\fR translates between ANSI C \fBlong\fR \fBlong\fR integers and
208 their external representations. This routine returns \fBTRUE\fR if it succeeds,
209 \fBFALSE\fR otherwise.
215 \fB\fBxdr_int()\fR\fR
218 \fBxdr_int()\fR translates between C integers and their external
219 representations. This routine returns \fBTRUE\fR if it succeeds, \fBFALSE\fR
226 \fB\fBxdr_long()\fR\fR
229 \fBxdr_long()\fR translates between C \fBlong\fR integers and their external
230 representations. This routine returns \fBTRUE\fR if it succeeds, \fBFALSE\fR
233 In a 64-bit environment, this routine returns an error if the value of \fBlp\fR
234 is outside the range \fB[INT32_MIN, INT32_MAX]\fR. The \fBxdr_int()\fR routine
235 is recommended in place of this routine.
241 \fB\fBxdr_longlong_t()\fR\fR
244 \fBxdr_longlong_t()\fR translates between ANSI C \fBlong\fR \fBlong\fR
245 integers and their external representations. This routine returns \fBTRUE\fR if
246 it succeeds, \fBFALSE\fR otherwise. This routine is identical to
253 \fB\fBxdr_quadruple()\fR\fR
256 \fBxdr_quadruple()\fR translates between IEEE quadruple precision floating
257 point numbers and their external representations. This routine returns
258 \fBTRUE\fR if it succeeds, \fBFALSE\fR otherwise.
264 \fB\fBxdr_short()\fR\fR
267 \fBxdr_short()\fR translates between C \fBshort\fR integers and their external
268 representations. This routine returns \fBTRUE\fR if it succeeds, \fBFALSE\fR
275 \fB\fBxdr_u_char()\fR\fR
278 \fBxdr_u_char()\fR translates between \fBunsigned\fR C characters and their
279 external representations. This routine returns \fBTRUE\fR if it succeeds,
280 \fBFALSE\fR otherwise.
286 \fB\fBxdr_u_hyper()\fR\fR
289 \fBxdr_u_hyper()\fR translates between unsigned ANSI C \fBlong\fR \fBlong\fR
290 integers and their external representations. This routine returns \fBTRUE\fR if
291 it succeeds, \fBFALSE\fR otherwise.
297 \fB\fBxdr_u_int()\fR\fR
300 A filter primitive that translates between a C \fBunsigned\fR integer and its
301 external representation. This routine returns \fBTRUE\fR if it succeeds,
302 \fBFALSE\fR otherwise.
308 \fB\fBxdr_u_long()\fR\fR
311 \fBxdr_u_long()\fR translates between C \fBunsigned long\fR integers and their
312 external representations. This routine returns \fBTRUE\fR if it succeeds,
313 \fBFALSE\fR otherwise.
315 In a 64-bit environment, this routine returns an error if the value of
316 \fIulp\fR is outside the range \fB[0, UINT32_MAX]\fR. The \fBxdr_u_int()\fR
317 routine is recommended in place of this routine.
323 \fB\fBxdr_u_longlong_t()\fR\fR
326 \fBxdr_u_longlong_t()\fR translates between unsigned ANSI C \fBlong\fR
327 \fBlong\fR integers and their external representations. This routine returns
328 \fBTRUE\fR if it succeeds, \fBFALSE\fR otherwise. This routine is identical to
335 \fB\fBxdr_u_short()\fR\fR
338 \fBxdr_u_short()\fR translates between C \fBunsigned short\fR integers and
339 their external representations. This routine returns \fBTRUE\fR if it succeeds,
340 \fBFALSE\fR otherwise.
346 \fB\fBxdr_void()\fR\fR
349 This routine always returns \fBTRUE\fR. It may be passed to \fBRPC\fR routines
350 that require a function parameter, where nothing is to be done.
356 See \fBattributes\fR(5) for descriptions of the following attributes:
364 ATTRIBUTE TYPE ATTRIBUTE VALUE
372 \fBmalloc\fR(3C), \fBrpc\fR(3NSL), \fBxdr_admin\fR(3NSL),
373 \fBxdr_complex\fR(3NSL), \fBxdr_create\fR(3NSL), \fBattributes\fR(5)