XDR routines specify external data representation. They allow C
programmers to describe arbitrary data structures in a system-
independent fashion.
Important: In order to maintain uniqueness for the OpenVMS HELP
utility, some XDR routines have a "_#" appended at the end. Do
not use the "_#" when coding the routine in a program.
1 – xdr_accepted_reply
Serializes and deserializes a message-accepted indication in an
RPC reply message.
Format
#include <tcpip$rpcxdr.h>
bool_t xdr_accepted_reply(XDR *xdrs, struct accepted_reply
*arp);
1.1 – Arguments
xdrs
A pointer to an XDR stream handle created by one of the XDR
stream-handle creation routines.
arp
A pointer to a buffer to which the message-accepted indication is
written.
1.2 – Description
Used for encoding reply messages. This routine encodes the status
of the RPC call and, in the case of success, the call results
as well. This routine is useful for users who want to generate
messages without using the ONC RPC package. It returns the
message-accepted variant of a reply message union in the arp
argument.
The xdr_replymsg routine calls this routine.
1.3 – Return Values
TRUE Indicates success.
FALSE Indicates failure to encode the message.
2 – xdr_array
Serializes and deserializes the elements of a variable-length
array.
Format
#include <tcpip$rpcxdr.h>
bool_t xdr_array(XDR *xdrs, char **arrp, u_int *sizep, u_int
maxsize, u_int elsize, xdrproc_t elproc);
2.1 – Arguments
xdrs
A pointer to an XDR stream handle created by one of the XDR
stream-handle creation routines.
arrp
A pointer to the pointer to the array.
sizep
A pointer to the number of elements in the array. This element
count cannot exceed the maxsize parameter.
maxsize
The maximum size of the sizep parameter. This value is the
maximum number of elements that the array can hold.
elsize
The size, in bytes, of each of the array's elements.
elproc
The XDR routine to call that handles each element of the array.
2.2 – Description
A filter primitive that translates between variable-length arrays
and their corresponding external representations.
2.3 – Return Values
TRUE Indicates success.
FALSE Indicates failure.
3 – xdr_authunix_parms
Serializes and deserializes credentials in an authentication
parameter structure.
Format
#include <tcpip$rpcxdr.h>
bool_t xdr_authunix_parms (XDR *xdrs, struct authunix_parms
*authp);
3.1 – Arguments
xdrs
A pointer to an XDR stream handle created by one of the XDR
stream-handle creation routines.
authp
A pointer to an authunix_parms structure.
3.2 – Description
Used for externally describing standard UNIX credentials. On a
TCP/IP Services host, this routine encodes the host name, the
user ID, and the group ID. It sets the group ID list to NULL.
This routine is useful for users who want to generate these
credentials without using the ONC RPC authentication package.
3.3 – Return Values
TRUE Indicates success.
FALSE Indicates failure.
4 – xdr_bool
Serializes and deserializes boolean data.
Format
#include <tcpip$rpcxdr.h>
bool_t xdr_bool (XDR *xdrs, bool_t *bp);
4.1 – Arguments
xdrs
A pointer to an XDR stream handle created by one of the XDR
stream-handle creation routines.
bp
A pointer to the boolean data.
4.2 – Description
A filter primitive that translates between booleans (integers)
and their external representations. When encoding data, this
filter produces values of either 1 or 0.
4.3 – Return Values
TRUE Indicates success.
FALSE Indicates failure.
5 – xdr_bytes
Serializes and deserializes a counted byte array.
Format
#include <tcpip$rpcxdr.h>
bool_t xdr_bytes (XDR *xdrs, char **bpp, u_int *sizep, u_int
maxsize);
5.1 – Arguments
xdrs
A pointer to an XDR stream handle created by one of the XDR
stream-handle creation routines.
bpp
A pointer to a pointer to the byte array.
sizep
A pointer to the length of the byte array.
maxsize
The maximum size of the length of the byte array.
5.2 – Description
A filter primitive that translates between a variable-length byte
array and its external representation. The length of the array
is located at sizep; the array cannot be longer than maxsize. If
*bpp is NULL, xdr_bytes allocates maxsize bytes.
5.3 – Return Values
TRUE Indicates success.
FALSE Indicates failure.
6 – xdr_callhdr
Serializes and deserializes the static part of a call message
header.
Format
#include <tcpip$rpcxdr.h>
bool_t xdr_callhdr(XDR *xdrs, struct rpc_msg *chdrp);
6.1 – Arguments
xdrs
A pointer to an XDR stream handle created by one of the XDR
stream-handle creation routines.
chdrp
A pointer to the call header data.
6.2 – Description
Describes call header messages. This routine is useful for users
who want to generate messages without using the ONC RPC package.
The xdr_callhdr routine encodes the following fields: transaction
ID, direction, RPC version, server program number, and server
version.
6.3 – Return Values
TRUE Indicate success.
FALSE Indicates failure.
7 – xdr_callmsg
Serializes and deserializes an ONC RPC call message.
Format
#include <tcpip$rpcxdr.h>
bool_t xdr_callmsg(XDR *xdrs, struct rpc_msg *cmsgp);
7.1 – Arguments
xdrs
A pointer to an XDR stream handle created by one of the XDR
stream-handle creation routines.
cmsgp
A pointer to an rpc_msg structure that describes the RPC call
message.
7.2 – Description
This routine is useful for users who want to generate messages
without using the ONC RPC package. The xdr_callmsg routine
encodes the following fields: transaction ID, direction, RPC
version, server program number, server version number, server
procedure number, and client authentication.
The pmap_rmtcall and svc_sendreply routines call xdr_callmsg.
7.3 – Return Values
TRUE Indicates success.
FALSE Indicates failure.
8 – xdr_char
Serializes and deserializes character data.
Format
#include <tcpip$rpcxdr.h>
bool_t xdr_char(XDR *xdrs, char *cp);
8.1 – Arguments
xdrs
A pointer to an XDR stream handle created by one of the XDR
stream-handle creation routines.
cp
A pointer to a character.
8.2 – Description
A filter primitive that translates between internal
representations of characters and their XDR representations.
8.3 – Return Values
TRUE Indicates success.
FALSE Indicates failure.
9 – xdr_double
Serializes and deserializes VAX and IEEE double-precision
floating-point numbers.
Format
#include <tcpip$rpcxdr.h>
bool_t xdr_double(XDR *xdrs, double *dp);
9.1 – Arguments
xdrs
A pointer to an XDR stream handle created by one of the XDR
stream-handle creation routines.
dp
A pointer to the double-precision floating-point number.
9.2 – Description
A filter primitive that translates between double-precision
numbers and their external representations.
This routine is implemented by four XDR routines:
xdr_ Converts VAX D-format floating-point numbers.
double_D
xdr_ Converts VAX G-format floating-point numbers.
double_G
xdr_ Converts IEEE T-format floating-point numbers.
double_T
xdr_ Converts IEEE X-format floating-point numbers.
double_X
You can reference these routines explicitly or you can use
compiler settings to control which routine is used when you
reference the xdr_double routine.
9.3 – Return Values
TRUE Indicates success.
FALSE Indicates failure.
10 – xdr_enum
Serializes and deserializes enumerations.
Format
#include <tcpip$rpcxdr.h>
bool_t xdr_enum(XDR *xdrs, enum_t *ep);
10.1 – Arguments
xdrs
A pointer to an XDR stream handle created by one of the XDR
stream-handle creation routines.
ep
A pointer to the enumeration data.
10.2 – Description
A filter primitive that translates between enumerations (actually
integers) and their external representations.
10.3 – Return Values
TRUE Indicates success.
FALSE Indicates failure.
11 – xdr_float
Serializes and deserializes VAX and IEEE single-precision
floating-point numbers.
Format
#include <tcpip$rpcxdr.h>
bool_t xdr_float(XDR *xdrs, float *fp);
11.1 – Arguments
xdrs
A pointer to an XDR stream handle created by one of the XDR
stream-handle creation routines.
fp
A pointer to a single-precision floating-point number.
11.2 – Description
A filter primitive that translates between single-precision
floating-point numbers and their external representations.
This routine is implemented by two XDR routines:
xdr_ Converts VAX F-format floating-point numbers.
float_F
xdr_ Converts IEEE T-format floating-point numbers.
float_S
You can reference these routines explicitly or you can use
compiler settings to control which routine is used when you
reference the xdr_float routine.
11.3 – Return Values
TRUE Indicates success.
FALSE Indicates failure.
12 – xdr_free
Deallocates the memory associated with the indicated data
structure.
Format
#include <tcpip$rpcxdr.h>
bool_t xdr_free(xdrproc_t proc, char *objp);
12.1 – Arguments
proc
The XDR routine for the data structure being freed.
objp
A pointer to the data structure to be freed.
12.2 – Description
Releases memory allocated for the data structure to which objp
points. The pointer passed to this routine is not freed, but what
it points to is freed (recursively). Use this routine to free
decoded data that is no longer needed. Never use this routine for
encoded data.
12.3 – Return Values
TRUE Indicate success.
FALSE Indicates failure.
13 – xdr_hyper
Serializes and deserializes VAX quadwords (known in XDR as
hyperintegers).
Format
#include <tcpip$rpcxdr.h>
bool_t xdr_hyper(XDR *xdrs, quad *hp);
13.1 – Arguments
xdrs
A pointer to an XDR stream handle created by one of the XDR
stream-handle creation routines.
hp
A pointer to the hyperinteger data.
13.2 – Description
A filter primitive that translates between hyperintegers and
their external representations.
13.3 – Return Values
TRUE Indicates success.
FALSE Indicates failure.
14 – xdr_int
Serializes and deserializes integers.
Format
#include <tcpip$rpcxdr.h>
bool_t xdr_int(XDR *xdrs, int *ip);
14.1 – Arguments
xdrs
A pointer to an XDR stream handle created by one of the XDR
stream-handle creation routines.
ip
A pointer to the integer data.
14.2 – Description
A filter primitive that translates between integers and their
external representations.
14.3 – Return Values
TRUE Indicates success.
FALSE Indicates failure.
15 – xdr_long
Serializes and deserializes long integers.
Format
#include <tcpip$rpcxdr.h>
bool_t xdr_long(XDR *xdrs, long *lp);
15.1 – Arguments
xdrs
A pointer to an XDR stream handle created by one of the XDR
stream-handle creation routines.
lp
A pointer to a long integer.
15.2 – Description
A filter primitive that translates between long integers and
their external representations.
15.3 – Return Values
TRUE Indicates success.
FALSE Indicates failure.
16 – xdr_opaque
Serializes and deserializes opaque structures.
Format
#include <tcpip$rpcxdr.h>
bool_t xdr_opaque(XDR *xdrs, char *op, u_int cnt);
16.1 – Arguments
xdrs
A pointer to an XDR stream handle created by one of the XDR
stream-handle creation routines.
op
A pointer to the opaque data.
cnt
The size of op in bytes.
16.2 – Description
A filter primitive that translates between fixed-size opaque data
and its external representation. This routine treats the data
as a fixed length of bytes and does not attempt to convert the
bytes.
16.3 – Return Values
TRUE Indicates success.
FALSE Indicates failure.
17 – xdr_opaque_auth
Serializes and deserializes ONC RPC authentication information
message.
Format
#include <tcpip$rpcxdr.h>
bool_t xdr_opaque_auth(XDR *xdrs, struct opaque_auth *authp);
17.1 – Arguments
xdrs
A pointer to an XDR stream handle created by one of the XDR
stream-handle creation routines.
authp
A pointer to an opaque_auth structure describing authentication
information. The pointer should reference data created by the
authnone_create, authunix_create, or authunix_create_default
routine.
17.2 – Description
Translates ONC RPC authentication information messages. This
routine is useful for users who want to generate messages without
using the ONC RPC package.
17.3 – Return Values
TRUE Indicates success.
FALSE Indicates failure.
18 – xdr_pmap_#
Serializes and deserializes Portmapper parameters.
Format
#include <tcpip$rpcxdr.h>
bool_t xdr_pmap(XDR *xdrs, struct pmap *regs);
18.1 – Arguments
xdrs
A pointer to an XDR stream handle created by one of the XDR
stream-handle creation routines.
regs
A pointer to the pmap structure. This structure contains the
program number, version number, protocol number, and port number.
18.2 – Description
Describes parameters to various Portmapper procedures,
externally. This routine is useful for users who want to generate
these parameters without using the Portmapper interface.
18.3 – Return Values
TRUE Indicates success.
FALSE Indicates failure.
19 – xdr_pmap_vms
Serializes and deserializes OpenVMS specific Portmapper
parameters.
Format
#include <tcpip$rpcxdr.h>
bool_t xdr_pmap_vms(XDR *xdrs, struct pmap_vms *regs);
19.1 – Arguments
xdrs
A pointer to an XDR stream handle created by one of the XDR
stream-handle creation routines.
regs
A pointer to the pmap_vms structure. This structure contains the
program number, version number, protocol number, port number and
the OpenVMS specific process identification.
19.2 – Description
This routine is similar to xdr_pmap(), except it also includes
the process identification in the pmap_vms structure.
19.3 – Return Values
TRUE Indicates success.
FALSE Indicates failure.
20 – xdr_pmaplist_#
Serializes and deserializes a list of Portmapper port mappings.
Format
#include <tcpip$rpcxdr.h>
bool_t xdr_pmaplist(XDR *xdrs, struct pmaplist **rpp);
20.1 – Arguments
xdrs
A pointer to an XDR stream handle created by one of the XDR
stream-handle creation routines.
rpp
A pointer to a pointer to a pmaplist structure containing a
list of Portmapper programs and their respective information.
If the routine is used to decode a Portmapper listing, it sets
rpp to the address of a newly allocated linked list of pmaplist
structures.
20.2 – Description
Describes a list of port mappings, externally. This routine is
useful for users who want to generate these parameters without
using the Portmapper interface.
20.3 – Return Values
TRUE Indicates success.
FALSE Indicates failure.
21 – xdr_pmaplist_vms
Serializes and deserializes a list of Portmapper port mappings
for OpenVMS systems.
Format
#include <tcpip$rpcxdr.h>
bool_t xdr_pmaplist_vms (XDR *xdrs, struct pmaplist_vms
**rpp);
21.1 – Arguments
xdrs
A pointer to an XDR stream handle created by one of the XDR
stream-handle creation routines.
rpp
A pointer to a pointer to a pmaplist_vms structure containing
a list of Portmapper programs and their respective information,
including OpenVMS-specific information.
21.2 – Description
This routine is similar to the xdr_pmaplist routine, except that
it also includes the process identification in the pmaplist_vms
structure.
21.3 – Return Values
TRUE Indicates success.
FALSE Indicates failure.
22 – xdr_pointer
Serializes and deserializes indirect pointers and the data being
pointed to.
Format
#include <tcpip$rpcxdr.h>
bool_t xdr_pointer(XDR *xdrs, char **objpp, u_int objsize,
xdrproc_t objproc);
22.1 – Arguments
xdrs
A pointer to an XDR stream handle created by one of the XDR
stream-handle creation routines.
objpp
A pointer to a pointer to the data being converted.
objsize
The size of the data structure in bytes.
objproc
The XDR procedure that filters the structure between its local
form and its external representation.
22.2 – Description
An XDR routine for translating data structures that contain
pointers to other structures, such as a linked list. The xdr_
pointer routine is similar to the xdr_reference routine. The
differences are that the xdr_pointer routine handles pointers
with the value NULL and that it translates the pointer values to
a boolean. If the boolean is TRUE, the data follows the boolean.
22.3 – Return Values
TRUE Indicates success.
FALSE Indicates failure.
23 – xdr_reference
Serializes and deserializes indirect pointers and the data being
pointed to.
Format
#include <tcpip$rpcxdr.h>
bool_t xdr_reference(XDR *xdrs, char **objpp, u_int objsize,
xdrproc_t objproc);
23.1 – Arguments
xdrs
A pointer to an XDR stream handle created by one of the XDR
stream-handle creation routines.
objpp
A pointer to a pointer to the structure containing the data
being converted. If objpp is zero, the xdr_reference routine
allocates the necessary storage when decoding. This argument must
be nonzero during encoding.
objsize
The size of the structure in bytes.
objproc
The XDR procedure that filters the structure between its local
form and its external representation.
23.2 – Description
A primitive that provides pointer chasing within structures.
23.3 – Return Values
TRUE Indicates success.
FALSE Indicates failure.
24 – xdr_rejected_reply
Serializes and deserializes the remainder of an RPC reply message
after the header indicates that the reply is rejected.
Format
#include <tcpip$rpcxdr.h>
bool_t xdr_rejected_reply(XDR *xdrs, struct rejected_reply
*rrp);
24.1 – Arguments
xdrs
A pointer to an XDR stream handle created by one of the XDR
stream-handle creation routines.
rrp
A pointer to the rejected_reply structure describing the rejected
reply message.
24.2 – Description
Describes ONC RPC reply messages. This routine is useful for
users who want to generate messages without using the ONC RPC
package.
24.3 – Return Values
TRUE Indicates success.
FALSE Indicates failure.
25 – xdr_replymsg
Serializes and deserializes the RPC reply header and then calls
the appropriate routine to interpret the rest of the message.
Format
#include <tcpip$rpcxdr.h>
bool_t xdr_replymsg(XDR *xdrs, struct rpc_msg *rmsgp);
25.1 – Arguments
xdrs
A pointer to an XDR stream handle created by one of the XDR
stream-handle creation routines.
rmsgp
A pointer to the rpc_msg structure describing the reply message.
25.2 – Description
Describes ONC RPC reply messages. This routine is useful for
users who want to generate messages without using the ONC RPC
package. This routine interprets the message header and then
calls either the xdr_accepted_reply or the xdr_rejected_reply
routine to interpret the body of the RPC message.
25.3 – Return Values
TRUE Indicates success.
FALSE Indicates failure.
26 – xdr_short
Serializes and deserializes short integers.
Format
#include <tcpip$rpcxdr.h>
bool_t xdr_short(XDR *xdrs, short *sp);
26.1 – Arguments
xdrs
A pointer to an XDR stream handle created by one of the XDR
stream-handle creation routines.
sp
A pointer to a short integer.
26.2 – Description
A filter primitive that translates between short integers and
their external representations.
26.3 – Return Values
TRUE Indicates success.
FALSE Indicates failure.
27 – xdr_string
Serializes and deserializes strings (arrays of bytes terminated
by a NULL character).
Format
#include <tcpip$rpcxdr.h>
bool_t xdr_string(XDR *xdrs, char **spp, u_int maxsize);
27.1 – Arguments
xdrs
A pointer to an XDR stream handle created by one of the XDR
stream-handle creation routines.
spp
A pointer to a pointer to a character string.
maxsize
The maximum size of the string.
27.2 – Description
A filter primitive that translates between strings and their
corresponding external representations. Strings cannot be longer
than the value specified with the maxsize parameter.
While decoding, if *spp is NULL, this routine allocates the
necessary storage to hold the NULL-terminated string and sets
*spp to point to the allocated storage.
This routine is the same as the xdr_wrapstring routine, except
that this routine allows you to specify maxsize.
27.3 – Return Values
TRUE Indicates success.
FALSE Indicates failure.
28 – xdr_u_char
Serializes and deserializes unsigned characters.
Format
#include <tcpip$rpcxdr.h>
bool_t xdr_u_char(XDR *xdrs, char *ucp);
28.1 – Arguments
xdrs
A pointer to an XDR stream handle created by one of the XDR
stream-handle creation routines.
ucp
A pointer to a character.
28.2 – Description
A filter primitive that translates between internal
representation of unsigned characters and their XDR
representations.
28.3 – Return Values
TRUE Indicates success.
FALSE Indicates failure.
29 – xdr_u_hyper
Serializes and deserializes unsigned VAX quadwords (known in XDR
as hyperintegers).
Format
#include <tcpip$rpcxdr.h>
bool_t xdr_u_hyper(XDR *xdrs, unsigned quad *uhp);
29.1 – Arguments
xdrs
A pointer to an XDR stream handle created by one of the XDR
stream-handle creation routines.
uhp
A pointer to the unsigned hyperinteger.
29.2 – Description
A filter primitive that translates between unsigned hyperintegers
and their external representations.
29.3 – Return Values
TRUE Indicates success.
FALSE Indicates failure.
30 – xdr_u_int
Serializes and deserializes unsigned integers.
Format
#include <tcpip$rpcxdr.h>
bool_t xdr_u_int(XDR *xdrs, unsigned *uip);
30.1 – Arguments
xdrs
A pointer to an XDR stream handle created by one of the XDR
stream-handle creation routines.
uip
A pointer to the unsigned integer.
30.2 – Description
A filter primitive that translates between unsigned integers and
their external representations.
30.3 – Return Values
TRUE Indicates success.
FALSE Indicates failure.
31 – xdr_u_long
Serializes and deserializes unsigned long integers.
Format
#include <tcpip$rpcxdr.h>
bool_t xdr_u_long(XDR *xdrs, unsigned long *ulp);
31.1 – Arguments
xdrs
A pointer to an XDR stream handle created by one of the XDR
stream-handle creation routines.
ulp
A pointer to the unsigned long integer.
31.2 – Description
A filter primitive that translates between unsigned long integers
and their external representations.
31.3 – Return Values
TRUE Indicates success.
FALSE Indicates failure.
32 – xdr_u_short
Serializes and deserializes unsigned short integers.
Format
#include <tcpip$rpcxdr.h>
bool_t xdr_u_short(XDR *xdrs, unsigned short *usp);
32.1 – Arguments
xdrs
A pointer to an XDR stream handle created by one of the XDR
stream-handle creation routines.
usp
A pointer to the unsigned short integer.
32.2 – Description
A filter primitive that translates between unsigned short
integers and their external representations.
32.3 – Return Values
TRUE Indicates success.
FALSE Indicates failure.
33 – xdr_union
Serializes and deserializes discriminant unions.
Format
#include <tcpip$rpcxdr.h>
bool_t xdr_union(XDR *xdrs, enum *dscmp, char *unp, struct
xdr_discrim *choices, xdrproc_t default);
33.1 – Arguments
xdrs
A pointer to an XDR stream handle created by one of the XDR
stream-handle creation routines.
dscmp
A pointer to the union's discriminant.
unp
A pointer to the union's data.
choices
A pointer to an array of xdr_discrim structures. Each structure
contains an ordered pair of [value,proc]. The final structure in
the array is denoted by a pointer with the value NULL.
default
The address of the default XDR routine to call if the dscmp
argument is not found in the choices array.
33.2 – Description
A filter primitive that translates between a discriminated union
and its corresponding external representation. The xdr_union
routine first translates the discriminant of the union located at
dscmp. This discriminant is always of type enum_t.
Next, the routine translates the union data located at unp. To
translate the union data the xdr_union routine first searches
the structure pointed to by the choices argument for the union
discriminant passed in the dscmp argument. If a match is found,
the xdr_union routine calls proc to translate the union data.
The end of the xdr_discrim structure array must contain an entry
with the value NULL for proc. If the xdr_union routine reaches
this entry before finding a match, the routine calls the default
procedure (if it is not NULL).
33.3 – Return Values
TRUE Indicates success.
FALSE Indicates failure.
34 – xdr_vector
Serializes and deserializes the elements of a fixed-length array
(known as a vector).
Format
#include <tcpip$rpcxdr.h>
bool_t xdr_vector(XDR *xdrs, char **vecpp, u_int elnum, u_int
elsize, xdrproc_t elproc);
34.1 – Arguments
xdrs
A pointer to an XDR stream handle created by one of the XDR
stream-handle creation routines.
vecpp
A pointer to a pointer to the array.
elnum
The number of elements in the array.
elsize
The size, in bytes, of each element.
elproc
The XDR routine to handle each element.
34.2 – Description
A routine that calls elproc to prepare the elements of an array
for XDR messages.
34.3 – Return Values
TRUE Indicates success.
FALSE Indicates failure.
35 – xdr_void
When there is no data to convert, this routine is passed to ONC
RPC routines that require an XDR procedure parameter.
Format
#include <tcpip$rpcxdr.h>
bool_t xdr_void();
35.1 – Description
This routine is used as a placeholder for a program that passes
no data in a remote procedure call. Most client and server
routines expect an XDR routine to be called, even when there
is no data to pass.
35.2 – Return Values
This routine always returns TRUE.
36 – xdr_wrapstring
Serializes and deserializes NULL-terminated strings.
Format
#include <tcpip$rpcxdr.h>
bool_t xdr_wrapstring(XDR *xdrs, char **spp);
36.1 – Arguments
xdrs
A pointer to an XDR stream handle created by one of the XDR
stream-handle creation routines.
spp
A pointer to a pointer to a string.
36.2 – Description
A primitive that calls xdr_string(xdrs, sp, MAXUNSIGNED), where
MAXUNSIGNED is the maximum value of an unsigned integer. This
routine is useful because the ONC RPC client and server routines
pass the XDR stream handle and a single pointer as parameters
to any referenced XDR routines. The xdr_string routine, one
of the most frequently used ONC RPC primitives, requires three
parameters.
While decoding, if *sp is NULL, the necessary storage is
allocated to hold the NULL-terminated string and *sp is set to
point to it.
36.3 – Return Values
TRUE Indicates success.
FALSE Indicates failure.
37 – xdrmem_create
Initializes an XDR stream descriptor for a memory buffer.
Format
#include <tcpip$rpcxdr.h>
void xdrmem_create(XDR *xdrs, char *addr, u_int size, enum
xdr_op op);
37.1 – Arguments
xdrs
A pointer to the XDR stream handle being created. The routine
xdrmem_create fills in xdrs with encoding and decoding
information.
addr
A pointer to the memory buffer.
size
The length of the memory buffer.
op
An XDR operation, one of: XDR_ENCODE, XDR_DECODE, and XDR_FREE.
37.2 – Description
The stream handle xdrs is initialized with the operation op, the
buffer addr and size, and the operations context for an xdrmem
stream.
37.3 – Return Values
None
38 – xdrrec_create
Initializes a record-oriented XDR stream descriptor.
Format
#include <tcpip$rpcxdr.h>
void xdrrec_create(XDR *xdrs, u_int sendsize, u_int recvsize,
char *tcp_handle, int (*readit)(), int (*writeit)());
38.1 – Arguments
xdrs
A pointer to the XDR stream handle being created. The routine
xdrrec_create fills in xdrs with encoding and decoding
information.
sendsize
The send buffer size.
recvsize
The receive buffer size.
tcp_handle
A pointer to an opaque handle that is passed as the first
parameter to the procedures (*readit)() and (*writeit)().
(*readit)()
Read procedure that takes the opaque handle tcp_handle. The
routine must use the following format:
int readit(char *tcp_handle, char *buffer, u_long len)
where tcp_handle is the client or server handle, buffer is the
buffer to fill, and len is the number of bytes to read. The
readit routine should return either the number of bytes read
or the value -1 if an error occurs.
(*writeit)()
Write procedure that takes the opaque handle tcp_handle. The
routine must use the following format:
int writeit(char *tcp_handle, char *buffer, u_long len)
where tcp_handle is the client or server handle, buffer is the
buffer to write, and len is the number of bytes to write. The
readit routine should return either the number of bytes written
or the value -1 if an error occurs.
38.2 – Description
The stream descriptor for xdrs initializes the maximum allowable
size for a request recvsize and reply sendsize, the addresses of
the routine to perform the read (readit) and write (writeit), and
the TCP handle used for network I/O.
38.3 – Return Values
None
39 – xdrrec_endofrecord
Generates an end-of-record for an XDR record.
Format
#include <tcpip$rpcxdr.h>
bool_t xdrrec_endofrecord (XDR *xdrs, bool_t sendnow);
39.1 – Arguments
xdrs
A pointer to an XDR stream handle created by one of the XDR
stream-handle creation routines.
sendnow
Indicates whether the record should be sent. If sendnow is TRUE,
xdrrec_endofrecord sends the record by calling the writeit
routine specified in the call to xdrrec_create. If sendnow is
FALSE, xdrrec_endofrecord marks the end of the record and calls
writeit when the buffer is full.
39.2 – Description
This routine lets an application support batch calls and
pipelined procedure calls.
39.3 – Return Values
TRUE Indicates success.
FALSE Indicates failure.
40 – xdrrec_eof
Moves the buffer pointer to the end of the current record and
returns an indication if any more data exists in the buffer.
Format
#include <tcpip$rpcxdr.h>
bool_t xdrrec_eof (XDR *xdrs);
40.1 – Arguments
xdrs
A pointer to an XDR stream handle created by one of the XDR
stream-handle creation routines.
40.2 – Description
Returns TRUE if there is no more input in the buffer after
consuming the rest of the current record.
40.3 – Return Values
TRUE Indicates no more input in the buffer.
FALSE Indicates more input in the buffer.
41 – xdrrec_skiprecord
Guarantees proper record alignment during deserialization from an
incoming stream.
Format
#include <tcpip$rpcxdr.h>
bool_t xdrrec_skiprecord (XDR *xdrs);
41.1 – Arguments
xdrs
A pointer to an XDR stream handle created by one of the XDR
stream-handle creation routines.
41.2 – Description
This routine ensures that the stream is properly aligned in
preparation for a subsequent read. It is recommended that, when a
record stream is being used, this routine be called prior to any
operations that would read from the stream.
This routine is similar to the xdrrec_eof routine, except that
this routine does not verify whether there is more data in the
buffer.
41.3 – Return Values
TRUE Indicates success.
FALSE Indicates failure.
42 – xdrstdio_create
Initializes an stdio XDR stream.
Format
#include <tcpip$rpcxdr.h>
void xdrstdio_create (XDR *xdrs, FILE *file, enum xdr_op op);
42.1 – Arguments
xdrs
A pointer to the XDR stream handle being created. The routine
xdrstdio_create fills in xdrs with encoding and decoding
information..
file
A pointer to the FILE structure that is to be associated with the
stream.
op
An XDR operation, one of: XDR_ENCODE, XDR_DECODE, and XDR_FREE.
42.2 – Description
Initializes a stdio stream for the specified file.
42.3 – Return Values
None