* xdr_rec.c, Implements TCP/IP based XDR streams with a "record marking"
* layer above tcp (for rpc's use).
*
- * Copyright (C) 1984, Sun Microsystems, Inc.
+ * Copyright (c) 2010, Oracle America, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
- * * Neither the name of Sun Microsystems, Inc. nor the names of its
+ * * Neither the name of the "Oracle America, Inc." nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
#include <stdio.h>
#include <string.h>
#include <unistd.h>
+#include <stdint.h>
#include <rpc/rpc.h>
#include <libintl.h>
-
-#ifdef USE_IN_LIBIO
-# include <wchar.h>
-# include <libio/iolibio.h>
-#endif
+#include <wchar.h>
+#include <libio/iolibio.h>
+#include <shlib-compat.h>
static bool_t xdrrec_getlong (XDR *, long *);
static bool_t xdrrec_putlong (XDR *, const long *);
caddr_t out_base; /* output buffer (points to frag header) */
caddr_t out_finger; /* next output position */
caddr_t out_boundry; /* data cannot up to this address */
- u_int32_t *frag_header; /* beginning of curren fragment */
+ uint32_t *frag_header; /* beginning of curren fragment */
bool_t frag_sent; /* true if buffer sent in middle of record */
/*
* in-coming bits
}
RECSTREAM;
-static u_int fix_buf_size (u_int) internal_function;
-static bool_t skip_input_bytes (RECSTREAM *, long) internal_function;
-static bool_t flush_out (RECSTREAM *, bool_t) internal_function;
-static bool_t set_input_fragment (RECSTREAM *) internal_function;
-static bool_t get_input_bytes (RECSTREAM *, caddr_t, int) internal_function;
+static u_int fix_buf_size (u_int);
+static bool_t skip_input_bytes (RECSTREAM *, long);
+static bool_t flush_out (RECSTREAM *, bool_t);
+static bool_t set_input_fragment (RECSTREAM *);
+static bool_t get_input_bytes (RECSTREAM *, caddr_t, int);
/*
* Create an xdr handle for xdrrec
rstrm->readit = readit;
rstrm->writeit = writeit;
rstrm->out_finger = rstrm->out_boundry = rstrm->out_base;
- rstrm->frag_header = (u_int32_t *) rstrm->out_base;
+ rstrm->frag_header = (uint32_t *) rstrm->out_base;
rstrm->out_finger += 4;
rstrm->out_boundry += sendsize;
rstrm->frag_sent = FALSE;
rstrm->fbtbc = 0;
rstrm->last_frag = TRUE;
}
-INTDEF(xdrrec_create)
+libc_hidden_nolink_sunrpc (xdrrec_create, GLIBC_2_0)
/*
rstrm->last_frag = FALSE;
return TRUE;
}
-INTDEF(xdrrec_skiprecord)
+libc_hidden_nolink_sunrpc (xdrrec_skiprecord, GLIBC_2_0)
/*
* Lookahead function.
return TRUE;
return FALSE;
}
-INTDEF(xdrrec_eof)
+libc_hidden_nolink_sunrpc (xdrrec_eof, GLIBC_2_0)
/*
* The client must tell the package when an end-of-record has occurred.
len = (rstrm->out_finger - (char *) rstrm->frag_header
- BYTES_PER_XDR_UNIT);
*rstrm->frag_header = htonl ((u_long) len | LAST_FRAG);
- rstrm->frag_header = (u_int32_t *) rstrm->out_finger;
+ rstrm->frag_header = (uint32_t *) rstrm->out_finger;
rstrm->out_finger += BYTES_PER_XDR_UNIT;
return TRUE;
}
-INTDEF(xdrrec_endofrecord)
+libc_hidden_nolink_sunrpc (xdrrec_endofrecord, GLIBC_2_0)
/*
* Internal useful routines
*/
static bool_t
-internal_function
flush_out (RECSTREAM *rstrm, bool_t eor)
{
u_long eormask = (eor == TRUE) ? LAST_FRAG : 0;
if ((*(rstrm->writeit)) (rstrm->tcp_handle, rstrm->out_base, (int) len)
!= (int) len)
return FALSE;
- rstrm->frag_header = (u_int32_t *) rstrm->out_base;
+ rstrm->frag_header = (uint32_t *) rstrm->out_base;
rstrm->out_finger = (caddr_t) rstrm->out_base + BYTES_PER_XDR_UNIT;
return TRUE;
}
}
static bool_t /* knows nothing about records! Only about input buffers */
-internal_function
get_input_bytes (RECSTREAM *rstrm, caddr_t addr, int len)
{
int current;
}
static bool_t /* next two bytes of the input stream are treated as a header */
-internal_function
set_input_fragment (RECSTREAM *rstrm)
{
uint32_t header;
}
static bool_t /* consumes input bytes; knows nothing about records! */
-internal_function
skip_input_bytes (RECSTREAM *rstrm, long cnt)
{
int current;
}
static u_int
-internal_function
fix_buf_size (u_int s)
{
if (s < 100)