1 /* Copyright (c) 1998-2021 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1998.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
19 #include <rpc/types.h>
21 /* We play dirty tricks with aliases. */
25 #include <shlib-compat.h>
27 /* XDR 64bit integers */
29 xdr_int64_t (XDR
*xdrs
, int64_t *ip
)
36 t1
= (int32_t) ((*ip
) >> 32);
38 return (XDR_PUTINT32(xdrs
, &t1
) && XDR_PUTINT32(xdrs
, &t2
));
40 if (!XDR_GETINT32(xdrs
, &t1
) || !XDR_GETINT32(xdrs
, &t2
))
42 *ip
= ((int64_t) t1
) << 32;
43 *ip
|= (uint32_t) t2
; /* Avoid sign extension. */
51 libc_hidden_nolink_sunrpc (xdr_int64_t
, GLIBC_2_1_1
)
54 xdr_quad_t (XDR
*xdrs
, quad_t
*ip
)
56 return xdr_int64_t (xdrs
, (int64_t *) ip
);
58 libc_hidden_nolink_sunrpc (xdr_quad_t
, GLIBC_2_3_4
)
60 /* XDR 64bit unsigned integers */
62 xdr_uint64_t (XDR
*xdrs
, uint64_t *uip
)
70 t1
= (uint32_t) ((*uip
) >> 32);
71 t2
= (uint32_t) (*uip
);
72 return (XDR_PUTINT32 (xdrs
, (int32_t *) &t1
) &&
73 XDR_PUTINT32(xdrs
, (int32_t *) &t2
));
75 if (!XDR_GETINT32(xdrs
, (int32_t *) &t1
) ||
76 !XDR_GETINT32(xdrs
, (int32_t *) &t2
))
78 *uip
= ((uint64_t) t1
) << 32;
87 libc_hidden_nolink_sunrpc (xdr_uint64_t
, GLIBC_2_1_1
)
90 xdr_u_quad_t (XDR
*xdrs
, u_quad_t
*ip
)
92 return xdr_uint64_t (xdrs
, (uint64_t *) ip
);
94 libc_hidden_nolink_sunrpc (xdr_u_quad_t
, GLIBC_2_3_4
)
96 /* XDR 32bit integers */
98 xdr_int32_t (XDR
*xdrs
, int32_t *lp
)
103 return XDR_PUTINT32 (xdrs
, lp
);
105 return XDR_GETINT32 (xdrs
, lp
);
112 libc_hidden_nolink_sunrpc (xdr_int32_t
, GLIBC_2_1
)
114 /* XDR 32bit unsigned integers */
116 xdr_uint32_t (XDR
*xdrs
, uint32_t *ulp
)
121 return XDR_PUTINT32 (xdrs
, (int32_t *) ulp
);
123 return XDR_GETINT32 (xdrs
, (int32_t *) ulp
);
130 #ifdef EXPORT_RPC_SYMBOLS
131 libc_hidden_def (xdr_uint32_t
)
133 libc_hidden_nolink_sunrpc (xdr_uint32_t
, GLIBC_2_1
)
136 /* XDR 16bit integers */
138 xdr_int16_t (XDR
*xdrs
, int16_t *ip
)
146 return XDR_PUTINT32 (xdrs
, &t
);
148 if (!XDR_GETINT32 (xdrs
, &t
))
158 libc_hidden_nolink_sunrpc (xdr_int16_t
, GLIBC_2_1
)
160 /* XDR 16bit unsigned integers */
162 xdr_uint16_t (XDR
*xdrs
, uint16_t *uip
)
169 ut
= (uint32_t) *uip
;
170 return XDR_PUTINT32 (xdrs
, (int32_t *) &ut
);
172 if (!XDR_GETINT32 (xdrs
, (int32_t *) &ut
))
174 *uip
= (uint16_t) ut
;
182 libc_hidden_nolink_sunrpc (xdr_uint16_t
, GLIBC_2_1
)
184 /* XDR 8bit integers */
186 xdr_int8_t (XDR
*xdrs
, int8_t *ip
)
194 return XDR_PUTINT32 (xdrs
, &t
);
196 if (!XDR_GETINT32 (xdrs
, &t
))
206 libc_hidden_nolink_sunrpc (xdr_int8_t
, GLIBC_2_1
)
208 /* XDR 8bit unsigned integers */
210 xdr_uint8_t (XDR
*xdrs
, uint8_t *uip
)
217 ut
= (uint32_t) *uip
;
218 return XDR_PUTINT32 (xdrs
, (int32_t *) &ut
);
220 if (!XDR_GETINT32 (xdrs
, (int32_t *) &ut
))
230 libc_hidden_nolink_sunrpc (xdr_uint8_t
, GLIBC_2_1
)