NetHack Proxy Reference Manual |
---|
External Data RepresentationExternal Data Representation — Encoding binary data in a platform independant manner |
#include <nhproxy/nhproxy.h> NhProxyXdr; enum nhproxy_xdr_op_t; unsigned int nhproxy_xdr_getpos (NhProxyXdr *xdrs); nhproxy_bool_t nhproxy_xdr_setpos (NhProxyXdr *xdrs, unsigned int pos); void nhproxy_xdr_free (nhproxy_bool_t (*codec) (), char *addr); #define nhproxy_xdr_destroy (xdrs) nhproxy_bool_t nhproxy_xdr_long (NhProxyXdr *xdrs, long *datum); nhproxy_bool_t nhproxy_xdr_u_long (NhProxyXdr *xdrs, unsigned long *datum); nhproxy_bool_t nhproxy_xdr_short (NhProxyXdr *xdrs, short *datum); nhproxy_bool_t nhproxy_xdr_u_short (NhProxyXdr *xdrs, unsigned short *datum); nhproxy_bool_t nhproxy_xdr_int (NhProxyXdr *xdrs, int *datum); nhproxy_bool_t nhproxy_xdr_u_int (NhProxyXdr *xdrs, unsigned int *datum); nhproxy_bool_t nhproxy_xdr_char (NhProxyXdr *xdrs, char *datum); nhproxy_bool_t nhproxy_xdr_u_char (NhProxyXdr *xdrs, unsigned char *datum); nhproxy_bool_t nhproxy_xdr_enum (NhProxyXdr *xdrs, int *datum); nhproxy_bool_t nhproxy_xdr_bool (NhProxyXdr *xdrs, nhproxy_bool_t *datum); nhproxy_bool_t nhproxy_xdr_string (NhProxyXdr *xdrs, char **datum, unsigned int maxsize); nhproxy_bool_t nhproxy_xdr_bytes (NhProxyXdr *xdrs, char **datum, unsigned int *len, unsigned int maxlen); nhproxy_bool_t nhproxy_xdr_wrapstring (NhProxyXdr *xdrs, char **datum); nhproxy_bool_t nhproxy_xdr_vector (NhProxyXdr *xdrs, char *addr, unsigned int len, unsigned int size, nhproxy_bool_t (*codec) ()); nhproxy_bool_t nhproxy_xdr_array (NhProxyXdr *xdrs, char **addr, unsigned int *len, unsigned int maxlen, unsigned int size, nhproxy_bool_t (*codec) ()); void nhproxy_xdrmem_create (NhProxyXdr *xdrs, char *addr, unsigned int size, nhproxy_xdr_op_t op); void nhproxy_xdrio_create (NhProxyXdr *xdrs, NhProxyIO *io, nhproxy_xdr_op_t op);
typedef struct { nhproxy_genericptr_t x_data; nhproxy_xdr_op_t x_op; nhproxy_bool_t (*x_write)(struct nhproxy_xdr *xdrs, const nhproxy_genericptr_t addr, int size); nhproxy_bool_t (*x_read)(struct nhproxy_xdr *xdrs, nhproxy_genericptr_t addr, int size); void (*x_destroy)(struct nhproxy_xdr *xdrs); unsigned int x_pos, x_size; } NhProxyXdr;
typedef enum { NHPROXY_XDR_ENCODE, NHPROXY_XDR_DECODE, NHPROXY_XDR_FREE, NHPROXY_XDR_COUNT } nhproxy_xdr_op_t;
nhproxy_bool_t nhproxy_xdr_setpos (NhProxyXdr *xdrs, unsigned int pos);
xdrs : | |
pos : | |
Returns : |
nhproxy_bool_t nhproxy_xdr_long (NhProxyXdr *xdrs, long *datum);
xdrs : | |
datum : | |
Returns : |
nhproxy_bool_t nhproxy_xdr_u_long (NhProxyXdr *xdrs, unsigned long *datum);
xdrs : | |
datum : | |
Returns : |
nhproxy_bool_t nhproxy_xdr_short (NhProxyXdr *xdrs, short *datum);
xdrs : | |
datum : | |
Returns : |
nhproxy_bool_t nhproxy_xdr_u_short (NhProxyXdr *xdrs, unsigned short *datum);
xdrs : | |
datum : | |
Returns : |
nhproxy_bool_t nhproxy_xdr_int (NhProxyXdr *xdrs, int *datum);
xdrs : | |
datum : | |
Returns : |
nhproxy_bool_t nhproxy_xdr_u_int (NhProxyXdr *xdrs, unsigned int *datum);
xdrs : | |
datum : | |
Returns : |
nhproxy_bool_t nhproxy_xdr_char (NhProxyXdr *xdrs, char *datum);
xdrs : | |
datum : | |
Returns : |
nhproxy_bool_t nhproxy_xdr_u_char (NhProxyXdr *xdrs, unsigned char *datum);
xdrs : | |
datum : | |
Returns : |
nhproxy_bool_t nhproxy_xdr_enum (NhProxyXdr *xdrs, int *datum);
xdrs : | |
datum : | |
Returns : |
nhproxy_bool_t nhproxy_xdr_bool (NhProxyXdr *xdrs, nhproxy_bool_t *datum);
xdrs : | |
datum : | |
Returns : |
nhproxy_bool_t nhproxy_xdr_string (NhProxyXdr *xdrs, char **datum, unsigned int maxsize);
xdrs : | |
datum : | |
maxsize : | |
Returns : |
nhproxy_bool_t nhproxy_xdr_bytes (NhProxyXdr *xdrs, char **datum, unsigned int *len, unsigned int maxlen);
xdrs : | |
datum : | |
len : | |
maxlen : | |
Returns : |
nhproxy_bool_t nhproxy_xdr_wrapstring (NhProxyXdr *xdrs, char **datum);
xdrs : | |
datum : | |
Returns : |
nhproxy_bool_t nhproxy_xdr_vector (NhProxyXdr *xdrs, char *addr, unsigned int len, unsigned int size, nhproxy_bool_t (*codec) ());
xdrs : | |
addr : | |
len : | |
size : | |
codec : | |
Returns : |
nhproxy_bool_t nhproxy_xdr_array (NhProxyXdr *xdrs, char **addr, unsigned int *len, unsigned int maxlen, unsigned int size, nhproxy_bool_t (*codec) ());
xdrs : | |
addr : | |
len : | |
maxlen : | |
size : | |
codec : | |
Returns : |
void nhproxy_xdrmem_create (NhProxyXdr *xdrs, char *addr, unsigned int size, nhproxy_xdr_op_t op);
xdrs : | |
addr : | |
size : | |
op : |
void nhproxy_xdrio_create (NhProxyXdr *xdrs, NhProxyIO *io, nhproxy_xdr_op_t op);
xdrs : | |
io : | |
op : |
<< Compound XDR | Packet I/O >> |