freebsd-nq/lib/libc/xdr/xdr.3

830 lines
15 KiB
Groff
Raw Normal View History

1994-08-07 18:39:35 +00:00
.\" @(#)xdr.3n 2.2 88/08/03 4.0 RPCSRC; from 1.16 88/03/14 SMI
1999-08-28 00:22:10 +00:00
.\" $FreeBSD$
.\"
2001-01-18 12:56:17 +00:00
.Dd February 16, 1988
.Dt XDR 3
.Os
.Sh NAME
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and associated changes that had to happen to make this possible as well as bugs fixed along the way. Bring in required TLI library routines to support this. Since we don't support TLI we've essentially copied what NetBSD has done, adding a thin layer to emulate direct the TLI calls into BSD socket calls. This is mostly from Sun's tirpc release that was made in 1994, however some fixes were backported from the 1999 release (supposedly only made available after this porting effort was underway). The submitter has agreed to continue on and bring us up to the 1999 release. Several key features are introduced with this update: Client calls are thread safe. (1999 code has server side thread safe) Updated, a more modern interface. Many userland updates were done to bring the code up to par with the recent RPC API. There is an update to the pthreads library, a function pthread_main_np() was added to emulate a function of Sun's threads library. While we're at it, bring in NetBSD's lockd, it's been far too long of a wait. New rpcbind(8) replaces portmap(8) (supporting communication over an authenticated Unix-domain socket, and by default only allowing set and unset requests over that channel). It's much more secure than the old portmapper. Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded to support TI-RPC and to support IPV6. Umount(8) is also fixed to unmount pathnames longer than 80 chars, which are currently truncated by the Kernel statfs structure. Submitted by: Martin Blapp <mb@imp.ch> Manpage review: ru Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
.Nm xdr ,
.Nm xdr_array ,
.Nm xdr_bool ,
.Nm xdr_bytes ,
.Nm xdr_char ,
.Nm xdr_destroy ,
.Nm xdr_double ,
.Nm xdr_enum ,
.Nm xdr_float ,
.Nm xdr_free ,
.Nm xdr_getpos ,
.Nm xdr_hyper ,
.Nm xdr_inline ,
.Nm xdr_int ,
.Nm xdr_long ,
.Nm xdr_longlong_t ,
.Nm xdrmem_create ,
.Nm xdr_opaque ,
.Nm xdr_pointer ,
.Nm xdrrec_create ,
.Nm xdrrec_endofrecord ,
.Nm xdrrec_eof ,
.Nm xdrrec_skiprecord ,
.Nm xdr_reference ,
.Nm xdr_setpos ,
.Nm xdr_short ,
.Nm xdrstdio_create ,
.Nm xdr_string ,
.Nm xdr_u_char ,
.Nm xdr_u_hyper ,
.Nm xdr_u_int ,
.Nm xdr_u_long ,
.Nm xdr_u_longlong_t ,
.Nm xdr_u_short ,
.Nm xdr_union ,
.Nm xdr_vector ,
.Nm xdr_void ,
.Nm xdr_wrapstring
2001-01-18 12:56:17 +00:00
.Nd "library routines for external data representation"
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
.In rpc/types.h
.In rpc/xdr.h
2001-01-18 12:56:17 +00:00
.Pp
See
.Sx DESCRIPTION
for function declarations.
.Sh DESCRIPTION
1994-08-07 18:39:35 +00:00
These routines allow C programmers to describe
arbitrary data structures in a machine-independent fashion.
Data for remote procedure calls are transmitted using these
routines.
2001-01-18 12:56:17 +00:00
.Pp
.Bl -tag -width indent -compact
.It Xo
.Ft int
.Xc
.It Xo
.Fo xdr_array
.Fa "XDR *xdrs"
.Fa "char **arrp"
.Fa "u_int *sizep"
.Fa "u_int maxsize"
.Fa "u_int elsize"
.Fa "xdrproc_t elproc"
.Fc
.Xc
.Pp
1994-08-07 18:39:35 +00:00
A filter primitive that translates between variable-length
arrays
and their corresponding external representations.
The
2001-01-18 12:56:17 +00:00
.Fa arrp
2002-12-19 09:40:28 +00:00
argument
1994-08-07 18:39:35 +00:00
is the address of the pointer to the array, while
2001-01-18 12:56:17 +00:00
.Fa sizep
1994-08-07 18:39:35 +00:00
is the address of the element count of the array;
this element count cannot exceed
2001-01-18 12:56:17 +00:00
.Fa maxsize .
2002-12-19 09:40:28 +00:00
The
2001-01-18 12:56:17 +00:00
.Fa elsize
2002-12-19 09:40:28 +00:00
argument
1994-08-07 18:39:35 +00:00
is the
2001-01-18 12:56:17 +00:00
.Ic sizeof
1994-08-07 18:39:35 +00:00
each of the array's elements, and
2001-01-18 12:56:17 +00:00
.Fa elproc
1994-08-07 18:39:35 +00:00
is an
2001-01-18 12:56:17 +00:00
.Tn XDR
1994-08-07 18:39:35 +00:00
filter that translates between
the array elements' C form, and their external
representation.
This routine returns one if it succeeds, zero otherwise.
2001-01-18 12:56:17 +00:00
.Pp
.It Xo
.Ft int
.Xc
.It Xo
.Fn xdr_bool "XDR *xdrs" "bool_t *bp"
.Xc
.Pp
1994-08-07 18:39:35 +00:00
A filter primitive that translates between booleans (C
integers)
and their external representations.
When encoding data, this
1994-08-07 18:39:35 +00:00
filter produces values of either one or zero.
This routine returns one if it succeeds, zero otherwise.
2001-01-18 12:56:17 +00:00
.Pp
.It Xo
.Ft int
.Xc
.It Xo
.Fn xdr_bytes "XDR *xdrs" "char **sp" "u_int *sizep" "u_int maxsize"
.Xc
.Pp
1994-08-07 18:39:35 +00:00
A filter primitive that translates between counted byte
strings and their external representations.
2002-12-19 09:40:28 +00:00
The
2001-01-18 12:56:17 +00:00
.Fa sp
2002-12-19 09:40:28 +00:00
argument
is the address of the string pointer.
The length of the
1994-08-07 18:39:35 +00:00
string is located at address
2001-01-18 12:56:17 +00:00
.Fa sizep ;
1994-08-07 18:39:35 +00:00
strings cannot be longer than
2001-01-18 12:56:17 +00:00
.Fa maxsize .
1994-08-07 18:39:35 +00:00
This routine returns one if it succeeds, zero otherwise.
2001-01-18 12:56:17 +00:00
.Pp
.It Xo
.Ft int
.Xc
.It Xo
.Fn xdr_char "XDR *xdrs" "char *cp"
.Xc
.Pp
1994-08-07 18:39:35 +00:00
A filter primitive that translates between C characters
and their external representations.
This routine returns one if it succeeds, zero otherwise.
Note: encoded characters are not packed, and occupy 4 bytes
each.
For arrays of characters, it is worthwhile to
1994-08-07 18:39:35 +00:00
consider
2001-01-18 12:56:17 +00:00
.Fn xdr_bytes ,
.Fn xdr_opaque
1994-08-07 18:39:35 +00:00
or
2001-01-18 12:56:17 +00:00
.Fn xdr_string .
.Pp
.It Xo
.Ft void
.Xc
.It Xo
.Fn xdr_destroy "XDR *xdrs"
.Xc
.Pp
1994-08-07 18:39:35 +00:00
A macro that invokes the destroy routine associated with the
2001-01-18 12:56:17 +00:00
.Tn XDR
1994-08-07 18:39:35 +00:00
stream,
2001-01-18 12:56:17 +00:00
.Fa xdrs .
1994-08-07 18:39:35 +00:00
Destruction usually involves freeing private data structures
2001-01-18 12:56:17 +00:00
associated with the stream.
Using
.Fa xdrs
1994-08-07 18:39:35 +00:00
after invoking
2001-01-18 12:56:17 +00:00
.Fn xdr_destroy
1994-08-07 18:39:35 +00:00
is undefined.
2001-01-18 12:56:17 +00:00
.Pp
.It Xo
.Ft int
.Xc
.It Xo
.Fn xdr_double "XDR *xdrs" "double *dp"
.Xc
.Pp
1994-08-07 18:39:35 +00:00
A filter primitive that translates between C
2001-01-18 12:56:17 +00:00
.Vt double
1994-08-07 18:39:35 +00:00
precision numbers and their external representations.
This routine returns one if it succeeds, zero otherwise.
2001-01-18 12:56:17 +00:00
.Pp
.It Xo
.Ft int
.Xc
.It Xo
.Fn xdr_enum "XDR *xdrs" "enum_t *ep"
.Xc
.Pp
1994-08-07 18:39:35 +00:00
A filter primitive that translates between C
2001-01-18 12:56:17 +00:00
.Vt enum Ns s
1994-08-07 18:39:35 +00:00
(actually integers) and their external representations.
This routine returns one if it succeeds, zero otherwise.
2001-01-18 12:56:17 +00:00
.Pp
.It Xo
.Ft int
.Xc
.It Xo
.Fn xdr_float "XDR *xdrs" "float *fp"
.Xc
.Pp
1994-08-07 18:39:35 +00:00
A filter primitive that translates between C
2001-01-18 12:56:17 +00:00
.Vt float Ns s
1994-08-07 18:39:35 +00:00
and their external representations.
This routine returns one if it succeeds, zero otherwise.
2001-01-18 12:56:17 +00:00
.Pp
.It Xo
.Ft void
.Xc
.It Xo
.Fn xdr_free "xdrproc_t proc" "char *objp"
.Xc
.Pp
Generic freeing routine.
The first argument is the
2001-01-18 12:56:17 +00:00
.Tn XDR
routine for the object being freed.
The second argument
is a pointer to the object itself.
Note: the pointer passed
1994-08-07 18:39:35 +00:00
to this routine is
2001-01-18 12:56:17 +00:00
.Em not
1994-08-07 18:39:35 +00:00
freed, but what it points to
2001-01-18 12:56:17 +00:00
.Em is
1994-08-07 18:39:35 +00:00
freed (recursively).
2001-01-18 12:56:17 +00:00
.Pp
.It Xo
.Ft u_int
.Xc
.It Xo
.Fn xdr_getpos "XDR *xdrs"
.Xc
.Pp
A macro that invokes the get\-position routine
1994-08-07 18:39:35 +00:00
associated with the
2001-01-18 12:56:17 +00:00
.Tn XDR
1994-08-07 18:39:35 +00:00
stream,
2001-01-18 12:56:17 +00:00
.Fa xdrs .
1994-08-07 18:39:35 +00:00
The routine returns an unsigned integer,
which indicates the position of the
2001-01-18 12:56:17 +00:00
.Tn XDR
1994-08-07 18:39:35 +00:00
byte stream.
A desirable feature of
2001-01-18 12:56:17 +00:00
.Tn XDR
1994-08-07 18:39:35 +00:00
streams is that simple arithmetic works with this number,
although the
2001-01-18 12:56:17 +00:00
.Tn XDR
1994-08-07 18:39:35 +00:00
stream instances need not guarantee this.
2001-01-18 12:56:17 +00:00
.Pp
.It Xo
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and associated changes that had to happen to make this possible as well as bugs fixed along the way. Bring in required TLI library routines to support this. Since we don't support TLI we've essentially copied what NetBSD has done, adding a thin layer to emulate direct the TLI calls into BSD socket calls. This is mostly from Sun's tirpc release that was made in 1994, however some fixes were backported from the 1999 release (supposedly only made available after this porting effort was underway). The submitter has agreed to continue on and bring us up to the 1999 release. Several key features are introduced with this update: Client calls are thread safe. (1999 code has server side thread safe) Updated, a more modern interface. Many userland updates were done to bring the code up to par with the recent RPC API. There is an update to the pthreads library, a function pthread_main_np() was added to emulate a function of Sun's threads library. While we're at it, bring in NetBSD's lockd, it's been far too long of a wait. New rpcbind(8) replaces portmap(8) (supporting communication over an authenticated Unix-domain socket, and by default only allowing set and unset requests over that channel). It's much more secure than the old portmapper. Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded to support TI-RPC and to support IPV6. Umount(8) is also fixed to unmount pathnames longer than 80 chars, which are currently truncated by the Kernel statfs structure. Submitted by: Martin Blapp <mb@imp.ch> Manpage review: ru Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
.Ft int
.Xc
.It Xo
2001-10-03 16:53:59 +00:00
.Fn xdr_hyper "XDR *xdrs" "quad_t *llp"
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and associated changes that had to happen to make this possible as well as bugs fixed along the way. Bring in required TLI library routines to support this. Since we don't support TLI we've essentially copied what NetBSD has done, adding a thin layer to emulate direct the TLI calls into BSD socket calls. This is mostly from Sun's tirpc release that was made in 1994, however some fixes were backported from the 1999 release (supposedly only made available after this porting effort was underway). The submitter has agreed to continue on and bring us up to the 1999 release. Several key features are introduced with this update: Client calls are thread safe. (1999 code has server side thread safe) Updated, a more modern interface. Many userland updates were done to bring the code up to par with the recent RPC API. There is an update to the pthreads library, a function pthread_main_np() was added to emulate a function of Sun's threads library. While we're at it, bring in NetBSD's lockd, it's been far too long of a wait. New rpcbind(8) replaces portmap(8) (supporting communication over an authenticated Unix-domain socket, and by default only allowing set and unset requests over that channel). It's much more secure than the old portmapper. Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded to support TI-RPC and to support IPV6. Umount(8) is also fixed to unmount pathnames longer than 80 chars, which are currently truncated by the Kernel statfs structure. Submitted by: Martin Blapp <mb@imp.ch> Manpage review: ru Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
.Xc
A filter primitive that translates between ANSI C
.Vt "long long"
integers and their external representations.
This routine returns one if it succeeds, zero otherwise.
.Pp
.It Xo
2001-01-18 12:56:17 +00:00
.Ft "long *"
.Xc
.It Xo
.Fn xdr_inline "XDR *xdrs" "int len"
.Xc
.Pp
1994-08-07 18:39:35 +00:00
A macro that invokes the in-line routine associated with the
2001-01-18 12:56:17 +00:00
.Tn XDR
1994-08-07 18:39:35 +00:00
stream,
2001-01-18 12:56:17 +00:00
.Fa xdrs .
1994-08-07 18:39:35 +00:00
The routine returns a pointer
to a contiguous piece of the stream's buffer;
2001-01-18 12:56:17 +00:00
.Fa len
1994-08-07 18:39:35 +00:00
is the byte length of the desired buffer.
Note: pointer is cast to
2001-01-18 12:56:17 +00:00
.Vt "long *" .
.Pp
1994-08-07 18:39:35 +00:00
Warning:
2001-01-18 12:56:17 +00:00
.Fn xdr_inline
1994-08-07 18:39:35 +00:00
may return
2001-01-18 12:56:17 +00:00
.Dv NULL
1994-08-07 18:39:35 +00:00
(0)
if it cannot allocate a contiguous piece of a buffer.
Therefore the behavior may vary among stream instances;
it exists for the sake of efficiency.
2001-01-18 12:56:17 +00:00
.Pp
.It Xo
.Ft int
.Xc
.It Xo
.Fn xdr_int "XDR *xdrs" "int *ip"
.Xc
.Pp
1994-08-07 18:39:35 +00:00
A filter primitive that translates between C integers
and their external representations.
This routine returns one if it succeeds, zero otherwise.
2001-01-18 12:56:17 +00:00
.Pp
.It Xo
.Ft int
.Xc
.It Xo
.Fn xdr_long "XDR *xdrs" "long *lp"
.Xc
.Pp
1994-08-07 18:39:35 +00:00
A filter primitive that translates between C
2001-01-18 12:56:17 +00:00
.Vt long
1994-08-07 18:39:35 +00:00
integers and their external representations.
This routine returns one if it succeeds, zero otherwise.
2001-01-18 12:56:17 +00:00
.Pp
.It Xo
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and associated changes that had to happen to make this possible as well as bugs fixed along the way. Bring in required TLI library routines to support this. Since we don't support TLI we've essentially copied what NetBSD has done, adding a thin layer to emulate direct the TLI calls into BSD socket calls. This is mostly from Sun's tirpc release that was made in 1994, however some fixes were backported from the 1999 release (supposedly only made available after this porting effort was underway). The submitter has agreed to continue on and bring us up to the 1999 release. Several key features are introduced with this update: Client calls are thread safe. (1999 code has server side thread safe) Updated, a more modern interface. Many userland updates were done to bring the code up to par with the recent RPC API. There is an update to the pthreads library, a function pthread_main_np() was added to emulate a function of Sun's threads library. While we're at it, bring in NetBSD's lockd, it's been far too long of a wait. New rpcbind(8) replaces portmap(8) (supporting communication over an authenticated Unix-domain socket, and by default only allowing set and unset requests over that channel). It's much more secure than the old portmapper. Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded to support TI-RPC and to support IPV6. Umount(8) is also fixed to unmount pathnames longer than 80 chars, which are currently truncated by the Kernel statfs structure. Submitted by: Martin Blapp <mb@imp.ch> Manpage review: ru Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
.Ft int
.Xc
.It Xo
2001-10-03 16:53:59 +00:00
.Fn xdr_longlong_t "XDR *xdrs" "quad_t *llp"
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and associated changes that had to happen to make this possible as well as bugs fixed along the way. Bring in required TLI library routines to support this. Since we don't support TLI we've essentially copied what NetBSD has done, adding a thin layer to emulate direct the TLI calls into BSD socket calls. This is mostly from Sun's tirpc release that was made in 1994, however some fixes were backported from the 1999 release (supposedly only made available after this porting effort was underway). The submitter has agreed to continue on and bring us up to the 1999 release. Several key features are introduced with this update: Client calls are thread safe. (1999 code has server side thread safe) Updated, a more modern interface. Many userland updates were done to bring the code up to par with the recent RPC API. There is an update to the pthreads library, a function pthread_main_np() was added to emulate a function of Sun's threads library. While we're at it, bring in NetBSD's lockd, it's been far too long of a wait. New rpcbind(8) replaces portmap(8) (supporting communication over an authenticated Unix-domain socket, and by default only allowing set and unset requests over that channel). It's much more secure than the old portmapper. Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded to support TI-RPC and to support IPV6. Umount(8) is also fixed to unmount pathnames longer than 80 chars, which are currently truncated by the Kernel statfs structure. Submitted by: Martin Blapp <mb@imp.ch> Manpage review: ru Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
.Xc
A filter primitive that translates between ANSI C
.Vt "long long"
integers and their external representations.
This routine returns one if it succeeds, zero otherwise.
.Pp
.It Xo
2001-01-18 12:56:17 +00:00
.Ft void
.Xc
.It Xo
.Fn xdrmem_create "XDR *xdrs" "char *addr" "u_int size" "enum xdr_op op"
.Xc
.Pp
1994-08-07 18:39:35 +00:00
This routine initializes the
2001-01-18 12:56:17 +00:00
.Tn XDR
1994-08-07 18:39:35 +00:00
stream object pointed to by
2001-01-18 12:56:17 +00:00
.Fa xdrs .
1994-08-07 18:39:35 +00:00
The stream's data is written to, or read from,
a chunk of memory at location
2001-01-18 12:56:17 +00:00
.Fa addr
1994-08-07 18:39:35 +00:00
whose length is no more than
2001-01-18 12:56:17 +00:00
.Fa size
bytes long.
The
.Fa op
2002-12-19 09:40:28 +00:00
argument
1994-08-07 18:39:35 +00:00
determines the direction of the
2001-01-18 12:56:17 +00:00
.Tn XDR
1994-08-07 18:39:35 +00:00
stream
(either
2001-01-18 12:56:17 +00:00
.Dv XDR_ENCODE ,
.Dv XDR_DECODE ,
1994-08-07 18:39:35 +00:00
or
2001-01-18 12:56:17 +00:00
.Dv XDR_FREE ) .
.Pp
.It Xo
.Ft int
.Xc
.It Xo
.Fn xdr_opaque "XDR *xdrs" "char *cp" "u_int cnt"
.Xc
.Pp
1994-08-07 18:39:35 +00:00
A filter primitive that translates between fixed size opaque
data
and its external representation.
2002-12-19 09:40:28 +00:00
The
2001-01-18 12:56:17 +00:00
.Fa cp
2002-12-19 09:40:28 +00:00
argument
1994-08-07 18:39:35 +00:00
is the address of the opaque object, and
2001-01-18 12:56:17 +00:00
.Fa cnt
1994-08-07 18:39:35 +00:00
is its size in bytes.
This routine returns one if it succeeds, zero otherwise.
2001-01-18 12:56:17 +00:00
.Pp
.It Xo
.Ft int
.Xc
.It Xo
.Fn xdr_pointer "XDR *xdrs" "char **objpp" "u_int objsize" "xdrproc_t xdrobj"
.Xc
.Pp
1994-08-07 18:39:35 +00:00
Like
2001-01-18 12:56:17 +00:00
.Fn xdr_reference
except that it serializes
.Dv NULL
1994-08-07 18:39:35 +00:00
pointers, whereas
2001-01-18 12:56:17 +00:00
.Fn xdr_reference
does not.
Thus,
.Fn xdr_pointer
1994-08-07 18:39:35 +00:00
can represent
recursive data structures, such as binary trees or
linked lists.
2001-01-18 12:56:17 +00:00
.Pp
.It Xo
.Ft void
.Xc
.It Xo
.Fo xdrrec_create
.Fa "XDR *xdrs"
.Fa "u_int sendsize"
.Fa "u_int recvsize"
.Fa "char *handle"
.Fa "int \*(lp*readit\*(rp\*(lp\*(rp"
.Fa "int \*(lp*writeit\*(rp\*(lp\*(rp"
.Fc
.Xc
.Pp
1994-08-07 18:39:35 +00:00
This routine initializes the
2001-01-18 12:56:17 +00:00
.Tn XDR
1994-08-07 18:39:35 +00:00
stream object pointed to by
2001-01-18 12:56:17 +00:00
.Fa xdrs .
1994-08-07 18:39:35 +00:00
The stream's data is written to a buffer of size
2001-01-18 12:56:17 +00:00
.Fa sendsize ;
1994-08-07 18:39:35 +00:00
a value of zero indicates the system should use a suitable
default.
The stream's data is read from a buffer of size
2001-01-18 12:56:17 +00:00
.Fa recvsize ;
1994-08-07 18:39:35 +00:00
it too can be set to a suitable default by passing a zero
value.
When a stream's output buffer is full,
2001-01-18 12:56:17 +00:00
.Fn writeit
is called.
Similarly, when a stream's input buffer is empty,
.Fn readit
is called.
The behavior of these two routines is similar to
1994-08-07 18:39:35 +00:00
the
system calls
2001-01-18 12:56:17 +00:00
.Xr read 2
1994-08-07 18:39:35 +00:00
and
2001-01-18 12:56:17 +00:00
.Xr write 2 ,
1994-08-07 18:39:35 +00:00
except that
2001-01-18 12:56:17 +00:00
.Fa handle
2002-12-19 09:40:28 +00:00
is passed to the former routines as the first argument.
1994-08-07 18:39:35 +00:00
Note: the
2001-01-18 12:56:17 +00:00
.Tn XDR
1994-08-07 18:39:35 +00:00
stream's
2001-01-18 12:56:17 +00:00
.Fa op
1994-08-07 18:39:35 +00:00
field must be set by the caller.
2001-01-18 12:56:17 +00:00
.Pp
1994-08-07 18:39:35 +00:00
Warning: this
2001-01-18 12:56:17 +00:00
.Tn XDR
1994-08-07 18:39:35 +00:00
stream implements an intermediate record stream.
Therefore there are additional bytes in the stream
to provide record boundary information.
2001-01-18 12:56:17 +00:00
.Pp
.It Xo
.Ft int
.Xc
.It Xo
.Fn xdrrec_endofrecord "XDR *xdrs" "int sendnow"
.Xc
.Pp
1994-08-07 18:39:35 +00:00
This routine can be invoked only on
streams created by
2001-01-18 12:56:17 +00:00
.Fn xdrrec_create .
1994-08-07 18:39:35 +00:00
The data in the output buffer is marked as a completed
record,
and the output buffer is optionally written out if
2001-01-18 12:56:17 +00:00
.Fa sendnow
is non-zero.
This routine returns one if it succeeds, zero
1994-08-07 18:39:35 +00:00
otherwise.
2001-01-18 12:56:17 +00:00
.Pp
.It Xo
.Ft int
.Xc
.It Xo
.Fn xdrrec_eof "XDR *xdrs"
.Xc
.Pp
1994-08-07 18:39:35 +00:00
This routine can be invoked only on
streams created by
2001-01-18 12:56:17 +00:00
.Fn xdrrec_create .
1994-08-07 18:39:35 +00:00
After consuming the rest of the current record in the stream,
this routine returns one if the stream has no more input,
zero otherwise.
2001-01-18 12:56:17 +00:00
.Pp
.It Xo
.Ft int
.Xc
.It Xo
.Fn xdrrec_skiprecord "XDR *xdrs"
.Xc
.Pp
1994-08-07 18:39:35 +00:00
This routine can be invoked only on
streams created by
2001-01-18 12:56:17 +00:00
.Fn xdrrec_create .
1994-08-07 18:39:35 +00:00
It tells the
2001-01-18 12:56:17 +00:00
.Tn XDR
1994-08-07 18:39:35 +00:00
implementation that the rest of the current record
in the stream's input buffer should be discarded.
This routine returns one if it succeeds, zero otherwise.
2001-01-18 12:56:17 +00:00
.Pp
.It Xo
.Ft int
.Xc
.It Xo
.Fn xdr_reference "XDR *xdrs" "char **pp" "u_int size" "xdrproc_t proc"
.Xc
.Pp
1994-08-07 18:39:35 +00:00
A primitive that provides pointer chasing within structures.
2002-12-19 09:40:28 +00:00
The
2001-01-18 12:56:17 +00:00
.Fa pp
2002-12-19 09:40:28 +00:00
argument
1994-08-07 18:39:35 +00:00
is the address of the pointer;
2001-01-18 12:56:17 +00:00
.Fa size
1994-08-07 18:39:35 +00:00
is the
2001-01-18 12:56:17 +00:00
.Ic sizeof
1994-08-07 18:39:35 +00:00
the structure that
2001-01-18 12:56:17 +00:00
.Fa *pp
1994-08-07 18:39:35 +00:00
points to; and
2001-01-18 12:56:17 +00:00
.Fa proc
1994-08-07 18:39:35 +00:00
is an
2001-01-18 12:56:17 +00:00
.Tn XDR
1994-08-07 18:39:35 +00:00
procedure that filters the structure
between its C form and its external representation.
This routine returns one if it succeeds, zero otherwise.
2001-01-18 12:56:17 +00:00
.Pp
1994-08-07 18:39:35 +00:00
Warning: this routine does not understand
2001-01-18 12:56:17 +00:00
.Dv NULL
pointers.
Use
2001-01-18 12:56:17 +00:00
.Fn xdr_pointer
1994-08-07 18:39:35 +00:00
instead.
2001-01-18 12:56:17 +00:00
.Pp
.It Xo
.Ft int
.Xc
.It Xo
.Fn xdr_setpos "XDR *xdrs" "u_int pos"
.Xc
.Pp
1994-08-07 18:39:35 +00:00
A macro that invokes the set position routine associated with
the
2001-01-18 12:56:17 +00:00
.Tn XDR
1994-08-07 18:39:35 +00:00
stream
2001-01-18 12:56:17 +00:00
.Fa xdrs .
2002-12-19 09:40:28 +00:00
The
2001-01-18 12:56:17 +00:00
.Fa pos
2002-12-19 09:40:28 +00:00
argument
1994-08-07 18:39:35 +00:00
is a position value obtained from
2001-01-18 12:56:17 +00:00
.Fn xdr_getpos .
1994-08-07 18:39:35 +00:00
This routine returns one if the
2001-01-18 12:56:17 +00:00
.Tn XDR
1994-08-07 18:39:35 +00:00
stream could be repositioned,
and zero otherwise.
2001-01-18 12:56:17 +00:00
.Pp
1994-08-07 18:39:35 +00:00
Warning: it is difficult to reposition some types of
2001-01-18 12:56:17 +00:00
.Tn XDR
1994-08-07 18:39:35 +00:00
streams, so this routine may fail with one
type of stream and succeed with another.
2001-01-18 12:56:17 +00:00
.Pp
.It Xo
.Ft int
.Xc
.It Xo
.Fn xdr_short "XDR *xdrs" "short *sp"
.Xc
.Pp
1994-08-07 18:39:35 +00:00
A filter primitive that translates between C
2001-01-18 12:56:17 +00:00
.Vt short
1994-08-07 18:39:35 +00:00
integers and their external representations.
This routine returns one if it succeeds, zero otherwise.
2001-01-18 12:56:17 +00:00
.Pp
.It Li "#ifdef _STDIO_H_"
.It Li "/* XDR using stdio library */"
2001-01-18 12:56:17 +00:00
.It Xo
.Ft void
.Xc
.It Xo
.Fn xdrstdio_create "XDR *xdrs" "FILE *file" "enum xdr_op op"
.Xc
.It Li "#endif"
2001-01-18 12:56:17 +00:00
.Pp
1994-08-07 18:39:35 +00:00
This routine initializes the
2001-01-18 12:56:17 +00:00
.Tn XDR
1994-08-07 18:39:35 +00:00
stream object pointed to by
2001-01-18 12:56:17 +00:00
.Fa xdrs .
1994-08-07 18:39:35 +00:00
The
2001-01-18 12:56:17 +00:00
.Tn XDR
1994-08-07 18:39:35 +00:00
stream data is written to, or read from, the Standard
2001-01-18 12:56:17 +00:00
.Tn I/O
1994-08-07 18:39:35 +00:00
stream
2001-01-18 12:56:17 +00:00
.Fa file .
2002-12-19 09:40:28 +00:00
The
2001-01-18 12:56:17 +00:00
.Fa op
2002-12-19 09:40:28 +00:00
argument
1994-08-07 18:39:35 +00:00
determines the direction of the
2001-01-18 12:56:17 +00:00
.Tn XDR
1994-08-07 18:39:35 +00:00
stream (either
2001-01-18 12:56:17 +00:00
.Dv XDR_ENCODE ,
.Dv XDR_DECODE ,
1994-08-07 18:39:35 +00:00
or
2001-01-18 12:56:17 +00:00
.Dv XDR_FREE ) .
.Pp
1994-08-07 18:39:35 +00:00
Warning: the destroy routine associated with such
2001-01-18 12:56:17 +00:00
.Tn XDR
1994-08-07 18:39:35 +00:00
streams calls
2001-01-18 12:56:17 +00:00
.Xr fflush 3
1994-08-07 18:39:35 +00:00
on the
2001-01-18 12:56:17 +00:00
.Fa file
1994-08-07 18:39:35 +00:00
stream, but never
2001-01-18 12:56:17 +00:00
.Xr fclose 3 .
.Pp
.It Xo
.Ft int
.Xc
.It Xo
.Fn xdr_string "XDR *xdrs" "char **sp" "u_int maxsize"
.Xc
.Pp
1994-08-07 18:39:35 +00:00
A filter primitive that translates between C strings and
their
corresponding external representations.
Strings cannot be longer than
2001-01-18 12:56:17 +00:00
.Fa maxsize .
Note:
.Fa sp
1994-08-07 18:39:35 +00:00
is the address of the string's pointer.
This routine returns one if it succeeds, zero otherwise.
2001-01-18 12:56:17 +00:00
.Pp
.It Xo
.Ft int
.Xc
.It Xo
.Fn xdr_u_char "XDR *xdrs" "unsigned char *ucp"
.Xc
.Pp
1994-08-07 18:39:35 +00:00
A filter primitive that translates between
2001-01-18 12:56:17 +00:00
.Vt unsigned
1994-08-07 18:39:35 +00:00
C characters and their external representations.
This routine returns one if it succeeds, zero otherwise.
2001-01-18 12:56:17 +00:00
.Pp
.It Xo
.Ft int
.Xc
.It Xo
2001-10-03 16:53:59 +00:00
.Fn xdr_u_hyper "XDR *xdrs" "u_quad_t *ullp"
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and associated changes that had to happen to make this possible as well as bugs fixed along the way. Bring in required TLI library routines to support this. Since we don't support TLI we've essentially copied what NetBSD has done, adding a thin layer to emulate direct the TLI calls into BSD socket calls. This is mostly from Sun's tirpc release that was made in 1994, however some fixes were backported from the 1999 release (supposedly only made available after this porting effort was underway). The submitter has agreed to continue on and bring us up to the 1999 release. Several key features are introduced with this update: Client calls are thread safe. (1999 code has server side thread safe) Updated, a more modern interface. Many userland updates were done to bring the code up to par with the recent RPC API. There is an update to the pthreads library, a function pthread_main_np() was added to emulate a function of Sun's threads library. While we're at it, bring in NetBSD's lockd, it's been far too long of a wait. New rpcbind(8) replaces portmap(8) (supporting communication over an authenticated Unix-domain socket, and by default only allowing set and unset requests over that channel). It's much more secure than the old portmapper. Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded to support TI-RPC and to support IPV6. Umount(8) is also fixed to unmount pathnames longer than 80 chars, which are currently truncated by the Kernel statfs structure. Submitted by: Martin Blapp <mb@imp.ch> Manpage review: ru Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
.Xc
A filter primitive that translates between
.Vt unsigned
ANSI C
.Vt long long
integers and their external representations.
This routine returns one if it succeeds, zero otherwise.
.Pp
.It Xo
.Ft int
.Xc
.It Xo
2001-01-18 12:56:17 +00:00
.Fn xdr_u_int "XDR *xdrs" "unsigned *up"
.Xc
.Pp
1994-08-07 18:39:35 +00:00
A filter primitive that translates between C
2001-01-18 12:56:17 +00:00
.Vt unsigned
1994-08-07 18:39:35 +00:00
integers and their external representations.
This routine returns one if it succeeds, zero otherwise.
2001-01-18 12:56:17 +00:00
.Pp
.It Xo
.Ft int
.Xc
.It Xo
.Fn xdr_u_long "XDR *xdrs" "unsigned long *ulp"
.Xc
.Pp
1994-08-07 18:39:35 +00:00
A filter primitive that translates between C
2001-01-18 12:56:17 +00:00
.Vt "unsigned long"
1994-08-07 18:39:35 +00:00
integers and their external representations.
This routine returns one if it succeeds, zero otherwise.
2001-01-18 12:56:17 +00:00
.Pp
.It Xo
.Ft int
.Xc
.It Xo
2001-10-03 16:53:59 +00:00
.Fn xdr_u_longlong_t "XDR *xdrs" "u_quad_t *ullp"
Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and associated changes that had to happen to make this possible as well as bugs fixed along the way. Bring in required TLI library routines to support this. Since we don't support TLI we've essentially copied what NetBSD has done, adding a thin layer to emulate direct the TLI calls into BSD socket calls. This is mostly from Sun's tirpc release that was made in 1994, however some fixes were backported from the 1999 release (supposedly only made available after this porting effort was underway). The submitter has agreed to continue on and bring us up to the 1999 release. Several key features are introduced with this update: Client calls are thread safe. (1999 code has server side thread safe) Updated, a more modern interface. Many userland updates were done to bring the code up to par with the recent RPC API. There is an update to the pthreads library, a function pthread_main_np() was added to emulate a function of Sun's threads library. While we're at it, bring in NetBSD's lockd, it's been far too long of a wait. New rpcbind(8) replaces portmap(8) (supporting communication over an authenticated Unix-domain socket, and by default only allowing set and unset requests over that channel). It's much more secure than the old portmapper. Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded to support TI-RPC and to support IPV6. Umount(8) is also fixed to unmount pathnames longer than 80 chars, which are currently truncated by the Kernel statfs structure. Submitted by: Martin Blapp <mb@imp.ch> Manpage review: ru Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
.Xc
A filter primitive that translates between
.Vt unsigned
ANSI C
.Vt "long long"
integers and their external representations.
This routine returns one if it succeeds, zero otherwise.
.Pp
.It Xo
.Ft int
.Xc
.It Xo
2001-01-18 12:56:17 +00:00
.Fn xdr_u_short "XDR *xdrs" "unsigned short *usp"
.Xc
.Pp
1994-08-07 18:39:35 +00:00
A filter primitive that translates between C
2001-01-18 12:56:17 +00:00
.Vt "unsigned short"
1994-08-07 18:39:35 +00:00
integers and their external representations.
This routine returns one if it succeeds, zero otherwise.
2001-01-18 12:56:17 +00:00
.Pp
.It Xo
.Ft int
.Xc
.It Xo
.Fo xdr_union
.Fa "XDR *xdrs"
2001-10-03 16:53:59 +00:00
.Fa "enum_t *dscmp"
2001-01-18 12:56:17 +00:00
.Fa "char *unp"
2001-10-03 16:53:59 +00:00
.Fa "const struct xdr_discrim *choices"
.Fa "xdrproc_t defaultarm"
2001-01-18 12:56:17 +00:00
.Fc
.Xc
.Pp
1994-08-07 18:39:35 +00:00
A filter primitive that translates between a discriminated C
2001-01-18 12:56:17 +00:00
.Vt union
and its corresponding external representation.
It first
1994-08-07 18:39:35 +00:00
translates the discriminant of the union located at
2001-01-18 12:56:17 +00:00
.Fa dscmp .
1994-08-07 18:39:35 +00:00
This discriminant is always an
2001-01-18 12:56:17 +00:00
.Vt enum_t .
1994-08-07 18:39:35 +00:00
Next the union located at
2001-01-18 12:56:17 +00:00
.Fa unp
is translated.
2002-12-19 09:40:28 +00:00
The
2001-01-18 12:56:17 +00:00
.Fa choices
2002-12-19 09:40:28 +00:00
argument
1994-08-07 18:39:35 +00:00
is a pointer to an array of
2001-01-18 12:56:17 +00:00
.Vt xdr_discrim
structures.
Each structure contains an ordered pair of
2001-01-18 12:56:17 +00:00
.Bq Va value , proc .
1994-08-07 18:39:35 +00:00
If the union's discriminant is equal to the associated
2001-01-18 12:56:17 +00:00
.Va value ,
1994-08-07 18:39:35 +00:00
then the
2001-01-18 12:56:17 +00:00
.Fn proc
is called to translate the union.
The end of the
.Vt xdr_discrim
1994-08-07 18:39:35 +00:00
structure array is denoted by a routine of value
2001-01-18 12:56:17 +00:00
.Dv NULL .
1994-08-07 18:39:35 +00:00
If the discriminant is not found in the
2001-01-18 12:56:17 +00:00
.Fa choices
1994-08-07 18:39:35 +00:00
array, then the
2001-01-18 12:56:17 +00:00
.Fn defaultarm
1994-08-07 18:39:35 +00:00
procedure is called (if it is not
2001-01-18 12:56:17 +00:00
.Dv NULL ) .
1994-08-07 18:39:35 +00:00
Returns one if it succeeds, zero otherwise.
2001-01-18 12:56:17 +00:00
.Pp
.It Xo
.Ft int
.Xc
.It Xo
.Fo xdr_vector
.Fa "XDR *xdrs"
.Fa "char *arrp"
.Fa "u_int size"
.Fa "u_int elsize"
.Fa "xdrproc_t elproc"
.Fc
.Xc
.Pp
1994-08-07 18:39:35 +00:00
A filter primitive that translates between fixed-length
arrays
2001-01-18 12:56:17 +00:00
and their corresponding external representations.
The
.Fa arrp
2002-12-19 09:40:28 +00:00
argument
1994-08-07 18:39:35 +00:00
is the address of the pointer to the array, while
2001-01-18 12:56:17 +00:00
.Fa size
is the element count of the array.
2002-12-19 09:40:28 +00:00
The
2001-01-18 12:56:17 +00:00
.Fa elsize
2002-12-19 09:40:28 +00:00
argument
1994-08-07 18:39:35 +00:00
is the
2001-01-18 12:56:17 +00:00
.Ic sizeof
1994-08-07 18:39:35 +00:00
each of the array's elements, and
2001-01-18 12:56:17 +00:00
.Fa elproc
1994-08-07 18:39:35 +00:00
is an
2001-01-18 12:56:17 +00:00
.Tn XDR
1994-08-07 18:39:35 +00:00
filter that translates between
the array elements' C form, and their external
representation.
This routine returns one if it succeeds, zero otherwise.
2001-01-18 12:56:17 +00:00
.Pp
.It Xo
.Ft int
.Xc
.It Xo
.Fn xdr_void void
.Xc
.Pp
1994-08-07 18:39:35 +00:00
This routine always returns one.
It may be passed to
2001-01-18 12:56:17 +00:00
.Tn RPC
2002-12-19 09:40:28 +00:00
routines that require a function argument,
1994-08-07 18:39:35 +00:00
where nothing is to be done.
2001-01-18 12:56:17 +00:00
.Pp
.It Xo
.Ft int
.Xc
.It Xo
.Fn xdr_wrapstring "XDR *xdrs" "char **sp"
.Xc
.Pp
1994-08-07 18:39:35 +00:00
A primitive that calls
2001-01-18 12:56:17 +00:00
.Fn xdr_string xdrs sp MAXUN.UNSIGNED ;
1994-08-07 18:39:35 +00:00
where
2001-01-18 12:56:17 +00:00
.Dv MAXUN.UNSIGNED
1994-08-07 18:39:35 +00:00
is the maximum value of an unsigned integer.
2002-12-18 12:45:11 +00:00
The
2001-01-18 12:56:17 +00:00
.Fn xdr_wrapstring
2002-12-18 12:45:11 +00:00
function
1994-08-07 18:39:35 +00:00
is handy because the
2001-01-18 12:56:17 +00:00
.Tn RPC
1994-08-07 18:39:35 +00:00
package passes a maximum of two
2001-01-18 12:56:17 +00:00
.Tn XDR
2002-12-19 09:40:28 +00:00
routines as arguments, and
2001-01-18 12:56:17 +00:00
.Fn xdr_string ,
1994-08-07 18:39:35 +00:00
one of the most frequently used primitives, requires three.
Returns one if it succeeds, zero otherwise.
2001-01-18 12:56:17 +00:00
.El
.Sh SEE ALSO
.Xr rpc 3
.Rs
.%T "eXternal Data Representation Standard: Protocol Specification"
.Re
.Rs
.%T "eXternal Data Representation: Sun Technical Notes"
.Re
.Rs
.%T "XDR: External Data Representation Standard"
.%O RFC1014
.%Q "Sun Microsystems, Inc., USC\-ISI"
.Re