You can create and implement XDR data streams. The following example shows the abstract data types (XDR handle) required for you to implement your own XDR streams. They contain operations applied to the stream (an operation vector for the particular implementation) and two private fields for using that implementation.
enum xdr_op { XDR_ENCODE=0, XDR_DECODE=1, XDR_FREE=2 }; typedef struct xdr { enum xdr_op x_op; struct xdr_ops { bool_t (*x_getlong)(struct xdr *, long *); bool_t (*x_putlong)(struct xdr *, long *); bool_t (*x_getbytes)(struct xdr *, caddr_t, u_int); /* get some bytes from " */ bool_t (*x_putbytes)(struct xdr *, caddr_t, u_int); /* put some bytes to " */ u_int (*x_getpostn)(struct xdr *); bool_t (*x_setpostn)(struct xdr *,u_int); long * (*x_inline)(struct xdr *,u_int); void (*x_destroy)(struct xdr *); } *x_ops; caddr_t x_public; caddr_t x_private; caddr_t x_base; int x_handy; } XDR;
The following parameters are pointers to XDR stream manipulation routines:
Parameter
The following fields are specific to a stream's implementation:
Field