Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ExeBy/smexe_ro.../usr/include/gssrpc
File: xdr.h
/* @(#)xdr.h 2.2 88/07/29 4.0 RPCSRC */
[0] Fix | Delete
/*
[1] Fix | Delete
* Copyright (c) 2010, Oracle America, Inc.
[2] Fix | Delete
*
[3] Fix | Delete
* All rights reserved.
[4] Fix | Delete
*
[5] Fix | Delete
* Redistribution and use in source and binary forms, with or without
[6] Fix | Delete
* modification, are permitted provided that the following conditions are met:
[7] Fix | Delete
*
[8] Fix | Delete
* * Redistributions of source code must retain the above copyright
[9] Fix | Delete
* notice, this list of conditions and the following disclaimer.
[10] Fix | Delete
*
[11] Fix | Delete
* * Redistributions in binary form must reproduce the above copyright
[12] Fix | Delete
* notice, this list of conditions and the following disclaimer in
[13] Fix | Delete
* the documentation and/or other materials provided with the
[14] Fix | Delete
* distribution.
[15] Fix | Delete
*
[16] Fix | Delete
* * Neither the name of the "Oracle America, Inc." nor the names of
[17] Fix | Delete
* its contributors may be used to endorse or promote products
[18] Fix | Delete
* derived from this software without specific prior written permission.
[19] Fix | Delete
*
[20] Fix | Delete
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
[21] Fix | Delete
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
[22] Fix | Delete
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
[23] Fix | Delete
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
[24] Fix | Delete
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
[25] Fix | Delete
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
[26] Fix | Delete
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
[27] Fix | Delete
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
[28] Fix | Delete
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
[29] Fix | Delete
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
[30] Fix | Delete
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
[31] Fix | Delete
*/
[32] Fix | Delete
/* @(#)xdr.h 1.19 87/04/22 SMI */
[33] Fix | Delete
[34] Fix | Delete
/*
[35] Fix | Delete
* xdr.h, External Data Representation Serialization Routines.
[36] Fix | Delete
*/
[37] Fix | Delete
[38] Fix | Delete
#ifndef GSSRPC_XDR_H
[39] Fix | Delete
#define GSSRPC_XDR_H
[40] Fix | Delete
[41] Fix | Delete
#include <stdio.h> /* for FILE */
[42] Fix | Delete
[43] Fix | Delete
GSSRPC__BEGIN_DECLS
[44] Fix | Delete
/*
[45] Fix | Delete
* XDR provides a conventional way for converting between C data
[46] Fix | Delete
* types and an external bit-string representation. Library supplied
[47] Fix | Delete
* routines provide for the conversion on built-in C data types. These
[48] Fix | Delete
* routines and utility routines defined here are used to help implement
[49] Fix | Delete
* a type encode/decode routine for each user-defined type.
[50] Fix | Delete
*
[51] Fix | Delete
* Each data type provides a single procedure which takes two arguments:
[52] Fix | Delete
*
[53] Fix | Delete
* bool_t
[54] Fix | Delete
* xdrproc(xdrs, argresp)
[55] Fix | Delete
* XDR *xdrs;
[56] Fix | Delete
* <type> *argresp;
[57] Fix | Delete
*
[58] Fix | Delete
* xdrs is an instance of a XDR handle, to which or from which the data
[59] Fix | Delete
* type is to be converted. argresp is a pointer to the structure to be
[60] Fix | Delete
* converted. The XDR handle contains an operation field which indicates
[61] Fix | Delete
* which of the operations (ENCODE, DECODE * or FREE) is to be performed.
[62] Fix | Delete
*
[63] Fix | Delete
* XDR_DECODE may allocate space if the pointer argresp is null. This
[64] Fix | Delete
* data can be freed with the XDR_FREE operation.
[65] Fix | Delete
*
[66] Fix | Delete
* We write only one procedure per data type to make it easy
[67] Fix | Delete
* to keep the encode and decode procedures for a data type consistent.
[68] Fix | Delete
* In many cases the same code performs all operations on a user defined type,
[69] Fix | Delete
* because all the hard work is done in the component type routines.
[70] Fix | Delete
* decode as a series of calls on the nested data types.
[71] Fix | Delete
*/
[72] Fix | Delete
[73] Fix | Delete
/*
[74] Fix | Delete
* Xdr operations. XDR_ENCODE causes the type to be encoded into the
[75] Fix | Delete
* stream. XDR_DECODE causes the type to be extracted from the stream.
[76] Fix | Delete
* XDR_FREE can be used to release the space allocated by an XDR_DECODE
[77] Fix | Delete
* request.
[78] Fix | Delete
*/
[79] Fix | Delete
enum xdr_op {
[80] Fix | Delete
XDR_ENCODE=0,
[81] Fix | Delete
XDR_DECODE=1,
[82] Fix | Delete
XDR_FREE=2
[83] Fix | Delete
};
[84] Fix | Delete
[85] Fix | Delete
/*
[86] Fix | Delete
* This is the number of bytes per unit of external data.
[87] Fix | Delete
*/
[88] Fix | Delete
#define BYTES_PER_XDR_UNIT (4)
[89] Fix | Delete
#define RNDUP(x) ((((x) + BYTES_PER_XDR_UNIT - 1) / BYTES_PER_XDR_UNIT) \
[90] Fix | Delete
* BYTES_PER_XDR_UNIT)
[91] Fix | Delete
[92] Fix | Delete
/*
[93] Fix | Delete
* A xdrproc_t exists for each data type which is to be encoded or decoded.
[94] Fix | Delete
*
[95] Fix | Delete
* The second argument to the xdrproc_t is a pointer to an opaque pointer.
[96] Fix | Delete
* The opaque pointer generally points to a structure of the data type
[97] Fix | Delete
* to be decoded. If this pointer is 0, then the type routines should
[98] Fix | Delete
* allocate dynamic storage of the appropriate size and return it.
[99] Fix | Delete
* bool_t (*xdrproc_t)(XDR *, caddr_t *);
[100] Fix | Delete
*
[101] Fix | Delete
* XXX can't actually prototype it, because some take three args!!!
[102] Fix | Delete
*/
[103] Fix | Delete
typedef bool_t (*xdrproc_t)();
[104] Fix | Delete
[105] Fix | Delete
/*
[106] Fix | Delete
* The XDR handle.
[107] Fix | Delete
* Contains operation which is being applied to the stream,
[108] Fix | Delete
* an operations vector for the paticular implementation (e.g. see xdr_mem.c),
[109] Fix | Delete
* and two private fields for the use of the particular impelementation.
[110] Fix | Delete
*/
[111] Fix | Delete
typedef struct XDR {
[112] Fix | Delete
enum xdr_op x_op; /* operation; fast additional param */
[113] Fix | Delete
struct xdr_ops {
[114] Fix | Delete
/* get a long from underlying stream */
[115] Fix | Delete
bool_t (*x_getlong)(struct XDR *, long *);
[116] Fix | Delete
[117] Fix | Delete
/* put a long to underlying stream */
[118] Fix | Delete
bool_t (*x_putlong)(struct XDR *, long *);
[119] Fix | Delete
[120] Fix | Delete
/* get some bytes from underlying stream */
[121] Fix | Delete
bool_t (*x_getbytes)(struct XDR *, caddr_t, u_int);
[122] Fix | Delete
[123] Fix | Delete
/* put some bytes to underlying stream */
[124] Fix | Delete
bool_t (*x_putbytes)(struct XDR *, caddr_t, u_int);
[125] Fix | Delete
[126] Fix | Delete
/* returns bytes off from beginning */
[127] Fix | Delete
u_int (*x_getpostn)(struct XDR *);
[128] Fix | Delete
[129] Fix | Delete
/* lets you reposition the stream */
[130] Fix | Delete
bool_t (*x_setpostn)(struct XDR *, u_int);
[131] Fix | Delete
[132] Fix | Delete
/* buf quick ptr to buffered data */
[133] Fix | Delete
rpc_inline_t *(*x_inline)(struct XDR *, int);
[134] Fix | Delete
[135] Fix | Delete
/* free privates of this xdr_stream */
[136] Fix | Delete
void (*x_destroy)(struct XDR *);
[137] Fix | Delete
} *x_ops;
[138] Fix | Delete
caddr_t x_public; /* users' data */
[139] Fix | Delete
void * x_private; /* pointer to private data */
[140] Fix | Delete
caddr_t x_base; /* private used for position info */
[141] Fix | Delete
int x_handy; /* extra private word */
[142] Fix | Delete
} XDR;
[143] Fix | Delete
[144] Fix | Delete
/*
[145] Fix | Delete
* Operations defined on a XDR handle
[146] Fix | Delete
*
[147] Fix | Delete
* XDR *xdrs;
[148] Fix | Delete
* int32_t *longp;
[149] Fix | Delete
* caddr_t addr;
[150] Fix | Delete
* u_int len;
[151] Fix | Delete
* u_int pos;
[152] Fix | Delete
*/
[153] Fix | Delete
#define XDR_GETLONG(xdrs, longp) \
[154] Fix | Delete
(*(xdrs)->x_ops->x_getlong)(xdrs, longp)
[155] Fix | Delete
#define xdr_getlong(xdrs, longp) \
[156] Fix | Delete
(*(xdrs)->x_ops->x_getlong)(xdrs, longp)
[157] Fix | Delete
[158] Fix | Delete
#define XDR_PUTLONG(xdrs, longp) \
[159] Fix | Delete
(*(xdrs)->x_ops->x_putlong)(xdrs, longp)
[160] Fix | Delete
#define xdr_putlong(xdrs, longp) \
[161] Fix | Delete
(*(xdrs)->x_ops->x_putlong)(xdrs, longp)
[162] Fix | Delete
[163] Fix | Delete
#define XDR_GETBYTES(xdrs, addr, len) \
[164] Fix | Delete
(*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len)
[165] Fix | Delete
#define xdr_getbytes(xdrs, addr, len) \
[166] Fix | Delete
(*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len)
[167] Fix | Delete
[168] Fix | Delete
#define XDR_PUTBYTES(xdrs, addr, len) \
[169] Fix | Delete
(*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len)
[170] Fix | Delete
#define xdr_putbytes(xdrs, addr, len) \
[171] Fix | Delete
(*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len)
[172] Fix | Delete
[173] Fix | Delete
#define XDR_GETPOS(xdrs) \
[174] Fix | Delete
(*(xdrs)->x_ops->x_getpostn)(xdrs)
[175] Fix | Delete
#define xdr_getpos(xdrs) \
[176] Fix | Delete
(*(xdrs)->x_ops->x_getpostn)(xdrs)
[177] Fix | Delete
[178] Fix | Delete
#define XDR_SETPOS(xdrs, pos) \
[179] Fix | Delete
(*(xdrs)->x_ops->x_setpostn)(xdrs, pos)
[180] Fix | Delete
#define xdr_setpos(xdrs, pos) \
[181] Fix | Delete
(*(xdrs)->x_ops->x_setpostn)(xdrs, pos)
[182] Fix | Delete
[183] Fix | Delete
#define XDR_INLINE(xdrs, len) \
[184] Fix | Delete
(*(xdrs)->x_ops->x_inline)(xdrs, len)
[185] Fix | Delete
#define xdr_inline(xdrs, len) \
[186] Fix | Delete
(*(xdrs)->x_ops->x_inline)(xdrs, len)
[187] Fix | Delete
[188] Fix | Delete
#define XDR_DESTROY(xdrs) \
[189] Fix | Delete
if ((xdrs)->x_ops->x_destroy) \
[190] Fix | Delete
(*(xdrs)->x_ops->x_destroy)(xdrs)
[191] Fix | Delete
#define xdr_destroy(xdrs) \
[192] Fix | Delete
if ((xdrs)->x_ops->x_destroy) \
[193] Fix | Delete
(*(xdrs)->x_ops->x_destroy)(xdrs)
[194] Fix | Delete
[195] Fix | Delete
/*
[196] Fix | Delete
* Support struct for discriminated unions.
[197] Fix | Delete
* You create an array of xdrdiscrim structures, terminated with
[198] Fix | Delete
* a entry with a null procedure pointer. The xdr_union routine gets
[199] Fix | Delete
* the discriminant value and then searches the array of structures
[200] Fix | Delete
* for a matching value. If a match is found the associated xdr routine
[201] Fix | Delete
* is called to handle that part of the union. If there is
[202] Fix | Delete
* no match, then a default routine may be called.
[203] Fix | Delete
* If there is no match and no default routine it is an error.
[204] Fix | Delete
*/
[205] Fix | Delete
#define NULL_xdrproc_t ((xdrproc_t)0)
[206] Fix | Delete
struct xdr_discrim {
[207] Fix | Delete
int value;
[208] Fix | Delete
xdrproc_t proc;
[209] Fix | Delete
};
[210] Fix | Delete
[211] Fix | Delete
/*
[212] Fix | Delete
* In-line routines for fast encode/decode of primitve data types.
[213] Fix | Delete
* Caveat emptor: these use single memory cycles to get the
[214] Fix | Delete
* data from the underlying buffer, and will fail to operate
[215] Fix | Delete
* properly if the data is not aligned. The standard way to use these
[216] Fix | Delete
* is to say:
[217] Fix | Delete
* if ((buf = XDR_INLINE(xdrs, count)) == NULL)
[218] Fix | Delete
* return (FALSE);
[219] Fix | Delete
* <<< macro calls >>>
[220] Fix | Delete
* where ``count'' is the number of bytes of data occupied
[221] Fix | Delete
* by the primitive data types.
[222] Fix | Delete
*
[223] Fix | Delete
* N.B. and frozen for all time: each data type here uses 4 bytes
[224] Fix | Delete
* of external representation.
[225] Fix | Delete
*/
[226] Fix | Delete
#define IXDR_GET_INT32(buf) ((int32_t)IXDR_GET_U_INT32(buf))
[227] Fix | Delete
#define IXDR_PUT_INT32(buf, v) IXDR_PUT_U_INT32((buf),((uint32_t)(v)))
[228] Fix | Delete
#define IXDR_GET_U_INT32(buf) (ntohl((uint32_t)*(buf)++))
[229] Fix | Delete
#define IXDR_PUT_U_INT32(buf, v) (*(buf)++ = (int32_t)htonl((v)))
[230] Fix | Delete
[231] Fix | Delete
#define IXDR_GET_LONG(buf) ((long)IXDR_GET_INT32(buf))
[232] Fix | Delete
#define IXDR_PUT_LONG(buf, v) IXDR_PUT_U_INT32((buf),((uint32_t)(v)))
[233] Fix | Delete
[234] Fix | Delete
#define IXDR_GET_BOOL(buf) ((bool_t)IXDR_GET_LONG(buf))
[235] Fix | Delete
#define IXDR_GET_ENUM(buf, t) ((t)IXDR_GET_INT32(buf))
[236] Fix | Delete
#define IXDR_GET_U_LONG(buf) ((u_long)IXDR_GET_U_INT32(buf))
[237] Fix | Delete
#define IXDR_GET_SHORT(buf) ((short)IXDR_GET_INT32(buf))
[238] Fix | Delete
#define IXDR_GET_U_SHORT(buf) ((u_short)IXDR_GET_U_INT32(buf))
[239] Fix | Delete
[240] Fix | Delete
#define IXDR_PUT_BOOL(buf, v) IXDR_PUT_INT32((buf),((int32_t)(v)))
[241] Fix | Delete
#define IXDR_PUT_ENUM(buf, v) IXDR_PUT_INT32((buf),((int32_t)(v)))
[242] Fix | Delete
#define IXDR_PUT_U_LONG(buf, v) IXDR_PUT_U_INT32((buf),((uint32_t)(v)))
[243] Fix | Delete
#define IXDR_PUT_SHORT(buf, v) IXDR_PUT_INT32((buf),((int32_t)(v)))
[244] Fix | Delete
#define IXDR_PUT_U_SHORT(buf, v) IXDR_PUT_U_INT32((buf),((uint32_t)(v)))
[245] Fix | Delete
[246] Fix | Delete
/*
[247] Fix | Delete
* These are the "generic" xdr routines.
[248] Fix | Delete
*/
[249] Fix | Delete
extern bool_t xdr_void(XDR *, void *);
[250] Fix | Delete
extern bool_t xdr_int(XDR *, int *);
[251] Fix | Delete
extern bool_t xdr_u_int(XDR *, u_int *);
[252] Fix | Delete
extern bool_t xdr_long(XDR *, long *);
[253] Fix | Delete
extern bool_t xdr_u_long(XDR *, u_long *);
[254] Fix | Delete
extern bool_t xdr_short(XDR *, short *);
[255] Fix | Delete
extern bool_t xdr_u_short(XDR *, u_short *);
[256] Fix | Delete
extern bool_t xdr_bool(XDR *, bool_t *);
[257] Fix | Delete
extern bool_t xdr_enum(XDR *, enum_t *);
[258] Fix | Delete
extern bool_t xdr_array(XDR *, caddr_t *, u_int *,
[259] Fix | Delete
u_int, u_int, xdrproc_t);
[260] Fix | Delete
extern bool_t xdr_bytes(XDR *, char **, u_int *, u_int);
[261] Fix | Delete
extern bool_t xdr_opaque(XDR *, caddr_t, u_int);
[262] Fix | Delete
extern bool_t xdr_string(XDR *, char **, u_int);
[263] Fix | Delete
extern bool_t xdr_union(XDR *, enum_t *, char *, struct xdr_discrim *,
[264] Fix | Delete
xdrproc_t);
[265] Fix | Delete
extern bool_t xdr_char(XDR *, char *);
[266] Fix | Delete
extern bool_t xdr_u_char(XDR *, u_char *);
[267] Fix | Delete
extern bool_t xdr_vector(XDR *, char *, u_int, u_int, xdrproc_t);
[268] Fix | Delete
extern bool_t xdr_float(XDR *, float *);
[269] Fix | Delete
extern bool_t xdr_double(XDR *, double *);
[270] Fix | Delete
extern bool_t xdr_reference(XDR *, caddr_t *, u_int, xdrproc_t);
[271] Fix | Delete
extern bool_t xdr_pointer(XDR *, char **, u_int, xdrproc_t);
[272] Fix | Delete
extern bool_t xdr_wrapstring(XDR *, char **);
[273] Fix | Delete
[274] Fix | Delete
extern unsigned long xdr_sizeof(xdrproc_t, void *);
[275] Fix | Delete
[276] Fix | Delete
#define xdr_rpcprog xdr_u_int32
[277] Fix | Delete
#define xdr_rpcvers xdr_u_int32
[278] Fix | Delete
#define xdr_rpcprot xdr_u_int32
[279] Fix | Delete
#define xdr_rpcproc xdr_u_int32
[280] Fix | Delete
#define xdr_rpcport xdr_u_int32
[281] Fix | Delete
[282] Fix | Delete
/*
[283] Fix | Delete
* Common opaque bytes objects used by many rpc protocols;
[284] Fix | Delete
* declared here due to commonality.
[285] Fix | Delete
*/
[286] Fix | Delete
#define MAX_NETOBJ_SZ 2048
[287] Fix | Delete
struct netobj {
[288] Fix | Delete
u_int n_len;
[289] Fix | Delete
char *n_bytes;
[290] Fix | Delete
};
[291] Fix | Delete
typedef struct netobj netobj;
[292] Fix | Delete
[293] Fix | Delete
extern bool_t xdr_netobj(XDR *, struct netobj *);
[294] Fix | Delete
[295] Fix | Delete
extern bool_t xdr_int32(XDR *, int32_t *);
[296] Fix | Delete
extern bool_t xdr_u_int32(XDR *, uint32_t *);
[297] Fix | Delete
[298] Fix | Delete
/*
[299] Fix | Delete
* These are the public routines for the various implementations of
[300] Fix | Delete
* xdr streams.
[301] Fix | Delete
*/
[302] Fix | Delete
[303] Fix | Delete
/* XDR allocating memory buffer */
[304] Fix | Delete
extern void xdralloc_create(XDR *, enum xdr_op);
[305] Fix | Delete
[306] Fix | Delete
/* destroy xdralloc, save buf */
[307] Fix | Delete
extern void xdralloc_release(XDR *);
[308] Fix | Delete
[309] Fix | Delete
/* get buffer from xdralloc */
[310] Fix | Delete
extern caddr_t xdralloc_getdata(XDR *);
[311] Fix | Delete
[312] Fix | Delete
/* XDR using memory buffers */
[313] Fix | Delete
extern void xdrmem_create(XDR *, caddr_t, u_int, enum xdr_op);
[314] Fix | Delete
[315] Fix | Delete
/* XDR using stdio library */
[316] Fix | Delete
extern void xdrstdio_create(XDR *, FILE *, enum xdr_op);
[317] Fix | Delete
[318] Fix | Delete
/* XDR pseudo records for tcp */
[319] Fix | Delete
extern void xdrrec_create(XDR *xdrs, u_int, u_int, caddr_t,
[320] Fix | Delete
int (*) (caddr_t, caddr_t, int),
[321] Fix | Delete
int (*) (caddr_t, caddr_t, int));
[322] Fix | Delete
[323] Fix | Delete
/* make end of xdr record */
[324] Fix | Delete
extern bool_t xdrrec_endofrecord(XDR *, bool_t);
[325] Fix | Delete
[326] Fix | Delete
/* move to beginning of next record */
[327] Fix | Delete
extern bool_t xdrrec_skiprecord (XDR *xdrs);
[328] Fix | Delete
[329] Fix | Delete
/* true if no more input */
[330] Fix | Delete
extern bool_t xdrrec_eof (XDR *xdrs);
[331] Fix | Delete
[332] Fix | Delete
/* free memory buffers for xdr */
[333] Fix | Delete
extern void xdr_free (xdrproc_t, void *);
[334] Fix | Delete
GSSRPC__END_DECLS
[335] Fix | Delete
[336] Fix | Delete
#endif /* !defined(GSSRPC_XDR_H) */
[337] Fix | Delete
[338] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function