.\" -*- coding: UTF-8 -*-
.\" This page was taken from the 4.4BSD-Lite CDROM (BSD license)
.\"
.\" %%%LICENSE_START(BSD_ONELINE_CDROM)
.\" This page was taken from the 4.4BSD-Lite CDROM (BSD license)
.\" %%%LICENSE_END
.\"
.\" @(#)xdr.3n	2.2 88/08/03 4.0 RPCSRC; from 1.16 88/03/14 SMI
.\"
.\" 2007-12-30, mtk, Convert function prototypes to modern C syntax
.\"
.\"*******************************************************************
.\"
.\" This file was generated with po4a. Translate the source file.
.\"
.\"*******************************************************************
.TH XDR 3 "15 Septiembre 2017" "" "Manual del Programador de Linux"
.SH NOMBRE
xdr \- rutinas de biblioteca para la representación externa de datos
.SH "SINOPSIS Y DESCRIPCIÓN"
Estas rutinas permiten a los programadores de C describir estructuras de
datos arbitrarias de una forma independiente de la máquina. Los datos para
las llamadas a procedimientos remotos se transmiten usando estas rutinas.
.PP
The prototypes below are declared in \fI<rpc/xdr.h>\fP and make use of
the following types:
.PP
.RS 4
.EX
\fBtypedef int \fP\fIbool_t\fP\fB;\fP
.PP
\fBtypedef bool_t (*\fP\fIxdrproc_t\fP\fB) (XDR *, void *,...);\fP
.EE
.RE
.PP
For the declaration of the \fIXDR\fP type, see \fI<rpc/xdr.h>\fP.
.PP
.nf
\fBbool_t xdr_array(XDR *\fP\fIxdrs\fP\fB, char **\fP\fIarrp\fP\fB, unsigned int *\fP\fIsizep\fP\fB,\fP
\fB                 unsigned int \fP\fImaxsize\fP\fB, unsigned int \fP\fIelsize\fP\fB,\fP
\fB                 xdrproc_t \fP\fIelproc\fP\fB);\fP
.fi
.IP
A filter primitive that translates between variable\-length arrays and their
corresponding external representations.  The argument \fIarrp\fP is the address
of the pointer to the array, while \fIsizep\fP is the address of the element
count of the array; this element count cannot exceed \fImaxsize\fP.  The
argument \fIelsize\fP is the \fIsizeof\fP each of the array's elements, and
\fIelproc\fP is an XDR filter that translates between the array elements' C
form, and their external representation.  This routine returns one if it
succeeds, zero otherwise.
.PP
.nf
\fBbool_t xdr_bool(XDR *\fP\fIxdrs\fP\fB, bool_t *\fP\fIbp\fP\fB);\fP
.fi
.IP
Una primitiva de filtro que convierte booleanos (enteros de C) a sus
representaciones externas y viceversa. Cuando se condifican datos, este
filtro produce valores de uno o de cero.  Esta rutina devuelve uno si tiene
éxito y cero en caso contrario.
.PP
.nf
\fBbool_t xdr_bytes(XDR *\fP\fIxdrs\fP\fB, char **\fP\fIsp\fP\fB, unsigned int *\fP\fIsizep\fP\fB,\fP
\fB                 unsigned int \fP\fImaxsize\fP\fB);\fP
.fi
.IP
A filter primitive that translates between counted byte strings and their
external representations.  The argument \fIsp\fP is the address of the string
pointer.  The length of the string is located at address \fIsizep\fP; strings
cannot be longer than \fImaxsize\fP.  This routine returns one if it succeeds,
zero otherwise.
.PP
.nf
\fBbool_t xdr_char(XDR *\fP\fIxdrs\fP\fB, char *\fP\fIcp\fP\fB);\fP
.fi
.IP
Una primitiva de filtro que convierte caracteres de C a sus representaciones
externas y viceversa. Esta rutina devuelve uno si tiene éxito y cero en caso
contrario. Nota: los caracteres codificados no se empaquetan y cada uno
ocupa 4 bytes. Para arrays de caracteres, vale la pena considerar
\fBxdr_bytes\fP(), \fBxdr_opaque\fP() o \fBxdr_string\fP().
.PP
.nf
\fBvoid xdr_destroy(XDR *\fP\fIxdrs\fP\fB);\fP
.fi
.IP
Una macro que invoca a la rutina de destrucción asociada con el flujo XDR,
\fIxdrs\fP.  Usualmente, la destrucción implica la liberación de estructuras de
datos privadas asociadas con el flujo. El uso de \fIxdrs\fP después de llamar a
\fBxdr_destroy\fP() es indefinido.
.PP
.nf
\fBbool_t xdr_double(XDR *\fP\fIxdrs\fP\fB, double *\fP\fIdp\fP\fB);\fP
.fi
.IP
Una primitiva de filtro que convierte números de precisión doble de C
(\fIdouble\fP)  a sus representaciones externas y viceversa. Esta rutina
devuelve uno si tiene éxito y cero en caso contrario.
.PP
.nf
\fBbool_t xdr_enum(XDR *\fP\fIxdrs\fP\fB, enum_t *\fP\fIep\fP\fB);\fP
.fi
.IP
Una primitiva de filtro que convierte enumerados de C (\fIenum\fPs)  (enteros
en realidad) a sus representaciones externas y viceversa.  Esta rutina
devuelve uno si tiene éxito y cero en caso contrario.
.PP
.nf
\fBbool_t xdr_float(XDR *\fP\fIxdrs\fP\fB, float *\fP\fIfp\fP\fB);\fP
.fi
.IP
Una primitiva de filtro que convierte números flotantes de C (\fIfloat\fPs)  a
sus representaciones externas y viceversa.  Esta rutina devuelve uno si
tiene éxito y cero en caso contrario.
.PP
.nf
\fBvoid xdr_free(xdrproc_t \fP\fIproc\fP\fB, char *\fP\fIobjp\fP\fB);\fP
.fi
.IP
Rutina genérica de liberación. El primer argumento es la rutina XDR para que
libera el objeto. El segundo argumento es un puntero al propio objeto. Nota:
\fIno\fP se libera el puntero pasado a esta rutina, sino \fIa lo que él apunta\fP
(de forma recursiva).
.PP
.nf
\fBunsigned int xdr_getpos(XDR *\fP\fIxdrs\fP\fB);\fP
.fi
.IP
Una macro que llama a la rutina "obtener posición" asociada con el flujo
XDR, \fIxdrs\fP.  La rutina devuelve un entero sin signo que indica la posición
en el flujo de bytes XDR. Una caracterísitica deseable de los flujos XDR es
que la aritmética simple funcione con este número, aunque las instancias de
flujos XDR no necesitan garantizar esto.
.PP
.nf
\fBlong *xdr_inline(XDR *\fP\fIxdrs\fP\fB, int \fP\fIlen\fP\fB);\fP
.fi
.IP
Una macro que llama a la rutina "en línea" asociada con el flujo XDR,
\fIxdrs\fP.  La rutina devuelve un puntero a una porción contigua del buffer
del flujo.  \fIlen\fP es la longitud en bytes del buffer deseado.  Nota: el
puntero se convierte al tipo \fIlong\ *\fP.
.IP
Cuidado: \fBxdr_inline\fP() puede devolver NULL (0)  si no puede reservar una
porción contigua de buffer. Por lo tanto, el comportamiento puede varias
entre instancias de flujo.  Existe por el bien de la eficiencia.
.PP
.nf
\fBbool_t xdr_int(XDR *\fP\fIxdrs\fP\fB, int *\fP\fIip\fP\fB);\fP
.fi
.IP
Una primitiva de filtro que convierte enteros de C a sus representaciones
externas y viceversa. Esta rutina devuelve uno si tiene éxito y cero en caso
contrario.
.PP
.nf
\fBbool_t xdr_long(XDR *\fP\fIxdrs\fP\fB, long *\fP\fIlp\fP\fB);\fP
.fi
.IP
Una primitiva de filtro que convierte enteros largos de C (\fIlong\fP)  a sus
representaciones externas y viceversa.  Esta rutina devuelve uno si tiene
éxito y cero en caso contrario.
.PP
.nf
\fBvoid xdrmem_create(XDR *\fP\fIxdrs\fP\fB, char *\fP\fIaddr\fP\fB, unsigned int \fP\fIsize\fP\fB,\fP
\fB                   enum xdr_op \fP\fIop\fP\fB);\fP
.fi
.IP
Esta rutina inicializa el objeto de flujo XDR apuntado por \fIxdrs\fP.  Los
datos del flujo se escriben en, o se leen de, una porción de memoria en la
posición \fIaddr\fP cuya longitud no es mayor que \fIsize\fP bytes.  El \fIop\fP
determina la dirección del flujo XDR (bien \fBXDR_ENCODE\fP, \fBXDR_DECODE\fP o
\fBXDR_FREE\fP).
.PP
.nf
\fBbool_t xdr_opaque(XDR *\fP\fIxdrs\fP\fB, char *\fP\fIcp\fP\fB, unsigned int \fP\fIcnt\fP\fB);\fP
.fi
.IP
A filter primitive that translates between fixed size opaque data and its
external representation.  The argument \fIcp\fP is the address of the opaque
object, and \fIcnt\fP is its size in bytes.  This routine returns one if it
succeeds, zero otherwise.
.PP
.nf
\fBbool_t xdr_pointer(XDR *\fP\fIxdrs\fP\fB, char **\fP\fIobjpp\fP\fB,\fP
\fB                   unsigned int \fP\fIobjsize\fP\fB, xdrproc_t \fP\fIxdrobj\fP\fB);\fP
.fi
.IP
Como \fBxdr_reference\fP() salvo que serializa punteros NULL, mientras que
\fBxdr_reference\fP() no lo hace. Por tanto, \fBxdr_pointer\fP() puede representar
estructuras de datos recursivas, tales como árboles binarios o listas
enlazadas.
.PP
.nf
\fBvoid xdrrec_create(XDR *\fP\fIxdrs\fP\fB, unsigned int \fP\fIsendsize\fP\fB,\fP
\fB                   unsigned int \fP\fIrecvsize\fP\fB, char *\fP\fIhandle\fP\fB,\fP
\fB                   int (*\fP\fIreadit\fP\fB) (char *, char *, int),\fP
\fB                   int (*\fP\fIwriteit\fP\fB) (char *, char *, int));\fP
.fi
.IP
This routine initializes the XDR stream object pointed to by \fIxdrs\fP.  The
stream's data is written to a buffer of size \fIsendsize\fP; a value of zero
indicates the system should use a suitable default.  The stream's data is
read from a buffer of size \fIrecvsize\fP; it too can be set to a suitable
default by passing a zero value.  When a stream's output buffer is full,
\fIwriteit\fP is called.  Similarly, when a stream's input buffer is empty,
\fIreadit\fP is called.  The behavior of these two routines is similar to the
system calls \fBread\fP(2)  and \fBwrite\fP(2), except that \fIhandle\fP is passed to
the former routines as the first argument.  Note: the XDR stream's \fIop\fP
field must be set by the caller.
.IP
Warning: to read from an XDR stream created by this API, you'll need to call
\fBxdrrec_skiprecord\fP()  first before calling any other XDR APIs.  This
inserts additional bytes in the stream to provide record boundary
information.  Also, XDR streams created with different \fBxdr*_create\fP APIs
are not compatible for the same reason.
.PP
.nf
\fBbool_t xdrrec_endofrecord(XDR *\fP\fIxdrs\fP\fB, int \fP\fIsendnow\fP\fB);\fP
.fi
.IP
Esta rutina sólo puede llamarse sobre flujos creados por
\fBxdrrec_create\fP().  Los datos del buffer de salida se marcan como un
registro terminado y, opcionalmente, se escribe el buffer de salida si
\fIsendnow\fP no es cero. Esta rutina devuelve uno si tiene éxito y cero en
caso contrario.
.PP
.nf
\fBbool_t xdrrec_eof(XDR *\fP\fIxdrs\fP\fB);\fP
.fi
.IP
Sólo pueda llamarse a esta rutina sobre flujos creados por
\fBxdrrec_create\fP().  Después de consumir el resto del registro actual en el
flujo, esta rutina devuelve uno si el flujo no tiene más datos de entrada y
cero en caso contrario.
.PP
.nf
\fBbool_t xdrrec_skiprecord(XDR *\fP\fIxdrs\fP\fB);\fP
.fi
.IP
Sólo pueda llamarse a esta rutina sobre flujos creados por
\fBxdrrec_create\fP().  Le dice a la implementación XDR que se debería
descartar el resto del registro actual en el buffer de entrada del
flujo. Esta rutina devuelve uno si tiene éxito y cero en caso contrario.
.PP
.nf
\fBbool_t xdr_reference(XDR *\fP\fIxdrs\fP\fB, char **\fP\fIpp\fP\fB, unsigned int \fP\fIsize\fP\fB,\fP
\fB                     xdrproc_t \fP\fIproc\fP\fB);\fP
.fi
.IP
A primitive that provides pointer chasing within structures.  The argument
\fIpp\fP is the address of the pointer; \fIsize\fP is the \fIsizeof\fP the structure
that \fI*pp\fP points to; and \fIproc\fP is an XDR procedure that filters the
structure between its C form and its external representation.  This routine
returns one if it succeeds, zero otherwise.
.IP
Warning: this routine does not understand null pointers.  Use
\fBxdr_pointer\fP()  instead.
.PP
.nf
\fBxdr_setpos(XDR *\fP\fIxdrs\fP\fB, unsigned int \fP\fIpos\fP\fB);\fP
.fi
.IP
A macro that invokes the set position routine associated with the XDR stream
\fIxdrs\fP.  The argument \fIpos\fP is a position value obtained from
\fBxdr_getpos\fP().  This routine returns one if the XDR stream could be
repositioned, and zero otherwise.
.IP
Cuidado: es difícil reposicionar algunos tipos de flujos XDR, por lo que
esta rutina puede fallar con un tipo de flujo y tener éxito con otro.
.PP
.nf
\fBbool_t xdr_short(XDR *\fP\fIxdrs\fP\fB, short *\fP\fIsp\fP\fB);\fP
.fi
.IP
Una primitiva de filtro que convierte enteros cortos de C (\fIshort\fP)  a sus
representaciones externas y viceversa.  Esta rutina devuelve uno si tiene
éxito y cero en caso contrario.
.PP
.nf
\fBvoid xdrstdio_create(XDR *\fP\fIxdrs\fP\fB, FILE *\fP\fIfile\fP\fB, enum xdr_op \fP\fIop\fP\fB);\fP
.fi
.IP
This routine initializes the XDR stream object pointed to by \fIxdrs\fP.  The
XDR stream data is written to, or read from, the \fIstdio\fP stream \fIfile\fP.
The argument \fIop\fP determines the direction of the XDR stream (either
\fBXDR_ENCODE\fP, \fBXDR_DECODE\fP, or \fBXDR_FREE\fP).
.IP
Cuidado: la rutina de destrucción asociada con tales flujos XDR llama a
\fBfflush\fP() sobre el flujo \fIfile\fP, pero nunca a \fBfclose\fP().
.PP
.nf
\fBbool_t xdr_string(XDR *\fP\fIxdrs\fP\fB, char **\fP\fIsp\fP\fB, unsigned int \fP\fImaxsize\fP\fB);\fP
.fi
.IP
Una primitiva de filtro que convierte cadenas de C en sus correspondientes
representaciones externas y viceversa.  Las candenas no pueden ser más
largas de \fImaxsize\fP.  Nota: \fIsp\fP es la dirección del puntero a la cadena.
Esta rutina devuelve uno si tiene éxito y cero en caso contrario.
.PP
.nf
\fBbool_t xdr_u_char(XDR *\fP\fIxdrs\fP\fB, unsigned char *\fP\fIucp\fP\fB);\fP
.fi
.IP
Una primitiva de filtro que convierte caracteres sin signo de C (\fIunsigned
char\fP)  a sus representaciones externas y viceversa.  Esta rutina devuelve
uno si tiene éxito y cero en caso contrario.
.PP
.nf
\fBbool_t xdr_u_int(XDR *\fP\fIxdrs\fP\fB, unsigned *\fP\fIup\fP\fB);\fP
.fi
.IP
Una primitiva de filtro que convierte enteros sin signo de C (\fIunsigned\fP)
a sus representaciones externas y viceversa.  Esta rutina devuelve uno si
tiene éxito y cero en caso contrario.
.PP
.nf
\fBbool_t xdr_u_long(XDR *\fP\fIxdrs\fP\fB, unsigned long *\fP\fIulp\fP\fB);\fP
.fi
.IP
Una primitiva de filtro que convierte enteros largos sin signo de C
(\fIunsigned long\fP)  a sus representaciones externas y viceversa.  Esta
rutina devuelve uno si tiene éxito y cero en caso contrario.
.PP
.nf
\fBbool_t xdr_u_short(XDR *\fP\fIxdrs\fP\fB, unsigned short *\fP\fIusp\fP\fB);\fP
.fi
.IP
Una primitiva de filtro que convierte enteros cortos sin signo de C
(\fIunsigned short\fP)  a sus representaciones externas y viceversa.  Esta
rutina devuelve uno si tiene éxito y cero en caso contrario.
.PP
.nf
\fBbool_t xdr_union(XDR *\fP\fIxdrs\fP\fB, int *\fP\fIdscmp\fP\fB, char *\fP\fIunp\fP\fB,\fP
\fB                 struct xdr_discrim *\fP\fIchoices\fP\fB,\fP
\fB                 xdrproc_t \fP\fIdefaultarm\fP\fB);     /* may equal NULL */\fP
.fi
.IP
A filter primitive that translates between a discriminated C \fIunion\fP and
its corresponding external representation.  It first translates the
discriminant of the union located at \fIdscmp\fP.  This discriminant is always
an \fIenum_t\fP.  Next the union located at \fIunp\fP is translated.  The argument
\fIchoices\fP is a pointer to an array of \fBxdr_discrim\fP()  structures.  Each
structure contains an ordered pair of [\fIvalue\fP,\fIproc\fP].  If the union's
discriminant is equal to the associated \fIvalue\fP, then the \fIproc\fP is called
to translate the union.  The end of the \fBxdr_discrim\fP()  structure array is
denoted by a routine of value NULL.  If the discriminant is not found in the
\fIchoices\fP array, then the \fIdefaultarm\fP procedure is called (if it is not
NULL).  Returns one if it succeeds, zero otherwise.
.PP
.nf
\fBbool_t xdr_vector(XDR *\fP\fIxdrs\fP\fB, char *\fP\fIarrp\fP\fB, unsigned int \fP\fIsize\fP\fB,\fP
\fB                  unsigned int \fP\fIelsize\fP\fB, xdrproc_t \fP\fIelproc\fP\fB);\fP
.fi
.IP
A filter primitive that translates between fixed\-length arrays and their
corresponding external representations.  The argument \fIarrp\fP is the address
of the pointer to the array, while \fIsize\fP is the element count of the
array.  The argument \fIelsize\fP is the \fIsizeof\fP each of the array's
elements, and \fIelproc\fP is an XDR filter that translates between the array
elements' C form, and their external representation.  This routine returns
one if it succeeds, zero otherwise.
.PP
.nf
\fBbool_t xdr_void(void);\fP
.fi
.IP
This routine always returns one.  It may be passed to RPC routines that
require a function argument, where nothing is to be done.
.PP
.nf
\fBbool_t xdr_wrapstring(XDR *\fP\fIxdrs\fP\fB, char **\fP\fIsp\fP\fB);\fP
.fi
.IP
A primitive that calls \fBxdr_string(xdrs, sp,MAXUN.UNSIGNED );\fP where
\fBMAXUN.UNSIGNED\fP is the maximum value of an unsigned integer.
\fBxdr_wrapstring\fP()  is handy because the RPC package passes a maximum of
two XDR routines as arguments, and \fBxdr_string\fP(), one of the most
frequently used primitives, requires three.  Returns one if it succeeds,
zero otherwise.
.SH ATRIBUTOS
Para obtener una explicación de los términos usados en esta sección, véase
\fBattributes\fP(7).
.TS
allbox;
lbw31 lb lb
l l l.
Interfaz	Atributo	Valor
T{
\fBxdr_array\fP(),
\fBxdr_bool\fP(),
.br
\fBxdr_bytes\fP(),
\fBxdr_char\fP(),
.br
\fBxdr_destroy\fP(),
\fBxdr_double\fP(),
.br
\fBxdr_enum\fP(),
\fBxdr_float\fP(),
.br
\fBxdr_free\fP(),
\fBxdr_getpos\fP(),
.br
\fBxdr_inline\fP(),
\fBxdr_int\fP(),
.br
\fBxdr_long\fP(),
\fBxdrmem_create\fP(),
.br
\fBxdr_opaque\fP(),
\fBxdr_pointer\fP(),
.br
\fBxdrrec_create\fP(),
\fBxdrrec_eof\fP(),
.br
\fBxdrrec_endofrecord\fP(),
.br
\fBxdrrec_skiprecord\fP(),
.br
\fBxdr_reference\fP(),
\fBxdr_setpos\fP(),
.br
\fBxdr_short\fP(),
\fBxdrstdio_create\fP(),
.br
\fBxdr_string\fP(),
\fBxdr_u_char\fP(),
.br
\fBxdr_u_int\fP(),
\fBxdr_u_long\fP(),
.br
\fBxdr_u_short\fP(),
\fBxdr_union\fP(),
.br
\fBxdr_vector\fP(),
\fBxdr_void\fP(),
.br
\fBxdr_wrapstring\fP()
T}	Seguridad del hilo	Multi\-hilo seguro
.TE
.sp 1
.SH "VÉASE TAMBIÉN"
\fBrpc\fP(3)
.PP
Los siguientes manuales:
.RS
eXternal Data Representation Standard: Protocol Specification
.br
eXternal Data Representation: Sun Technical Notes
.br
\fIXDR: External Data Representation Standard\fP, RFC\ 1014, Sun Microsystems,
Inc., USC\-ISI.
.RE
.SH COLOFÓN
Esta página es parte de la versión 5.10 del proyecto Linux
\fIman\-pages\fP. Puede encontrar una descripción del proyecto, información
sobre cómo informar errores y la última versión de esta página en
\%https://www.kernel.org/doc/man\-pages/.

.SH TRADUCCIÓN
La traducción al español de esta página del manual fue creada por
Juan Piernas <piernas@ditec.um.es>
.

Esta traducción es documentación libre; lea la
.UR https://www.gnu.org/licenses/gpl-3.0.html
GNU General Public License Version 3
.UE
o posterior con respecto a las condiciones de copyright.
No existe NINGUNA RESPONSABILIDAD.

Si encuentra algún error en la traducción de esta página del manual, envíe un
correo electrónico a
.MT
debian-l10n-spanish@lists.debian.org>.
.ME .