-/* Routines for XDR-encoding to a growable string. */
-static bool_t xdr_string_putlong(XDR *xdrs, const long *lp)
-{
- GString *str = (GString *)xdrs->x_private;
- uint32_t data = htonl(*lp);
- g_string_set_size(str, str->len + 4);
- memcpy(str->str + str->len - 4, &data, 4);
- return TRUE;
-}
-
-static bool_t xdr_string_putbytes(XDR *xdrs, const char *addr, u_int len)
-{
- GString *str = (GString *)xdrs->x_private;
- g_string_set_size(str, str->len + len);
- memcpy(str->str + str->len - len, addr, len);
- return TRUE;
-}
-
-static u_int xdr_string_getpos(const XDR *xdrs)
-{
- GString *str = (GString *)xdrs->x_private;
- return str->len;
-}
-
-static bool_t xdr_string_putint32(XDR *xdrs, const int32_t *ip)
-{
- GString *str = (GString *)xdrs->x_private;
- uint32_t data = htonl(*ip);
- g_string_set_size(str, str->len + 4);
- memcpy(str->str + str->len - 4, &data, 4);
- return TRUE;
-}
-
-static int32_t *xdr_string_inline(XDR *xdrs, u_int len)
-{
- GString *str = (GString *)xdrs->x_private;
- g_string_set_size(str, str->len + len);
- return (int32_t *)(str->str + str->len - len);
-}
-
-static void xdr_string_destroy(XDR *xdrs)
-{
-}
-
-static struct xdr_ops xdr_string_ops = {
- .x_putlong = xdr_string_putlong,
- .x_putbytes = xdr_string_putbytes,
- .x_getpostn = xdr_string_getpos,
- .x_putint32 = xdr_string_putint32,
- .x_inline = xdr_string_inline,
- .x_destroy = xdr_string_destroy,
-};
-
-static void xdr_string_create(XDR *xdrs, GString *string, enum xdr_op op)
-{
- xdrs->x_op = op;
- xdrs->x_ops = &xdr_string_ops;
- xdrs->x_private = (char *)string;
- xdrs->x_base = NULL;
- xdrs->x_handy = 0;
-}
-