X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=include%2Flibnfs-private.h;h=328d79dc62720d45f2205bb61f9d1c3081fa0b30;hb=fadbf8cf56c8675829502bacad9a4f166cf32be9;hp=a083b37031100b82fafea1d85b2267ebcb8b18a9;hpb=fa3c25beeeb4c533089a2af8454ef50e21e7b8f5;p=deb_libnfs.git diff --git a/include/libnfs-private.h b/include/libnfs-private.h index a083b37..328d79d 100644 --- a/include/libnfs-private.h +++ b/include/libnfs-private.h @@ -14,8 +14,40 @@ You should have received a copy of the GNU Lesser General Public License along with this program; if not, see . */ -#include -#include +#ifdef HAVE_CONFIG_H +#include "config.h" /* HAVE_SOCKADDR_STORAGE ? */ +#endif + +#ifndef WIN32 +#include /* struct sockaddr_storage */ +#endif + +#include "libnfs-zdr.h" + + +#if !defined(HAVE_SOCKADDR_STORAGE) && !defined(WIN32) +/* + * RFC 2553: protocol-independent placeholder for socket addresses + */ +#define _SS_MAXSIZE 128 +#define _SS_ALIGNSIZE (sizeof(double)) +#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(unsigned char) * 2) +#define _SS_PAD2SIZE (_SS_MAXSIZE - sizeof(unsigned char) * 2 - \ + _SS_PAD1SIZE - _SS_ALIGNSIZE) + +struct sockaddr_storage { +#ifdef HAVE_SOCKADDR_LEN + unsigned char ss_len; /* address length */ + unsigned char ss_family; /* address family */ +#else + unsigned short ss_family; +#endif + char __ss_pad1[_SS_PAD1SIZE]; + double __ss_align; /* force desired structure storage alignment */ + char __ss_pad2[_SS_PAD2SIZE]; +}; +#endif + struct rpc_fragment { struct rpc_fragment *next; @@ -23,7 +55,10 @@ struct rpc_fragment { char *data; }; +#define RPC_CONTEXT_MAGIC 0xc6e46435 + struct rpc_context { + uint32_t magic; int fd; int is_connected; @@ -32,8 +67,8 @@ struct rpc_context { rpc_cb connect_cb; void *connect_data; - AUTH *auth; - unsigned long xid; + struct AUTH *auth; + uint32_t xid; /* buffer used for encoding RPC PDU */ char *encodebuf; @@ -43,8 +78,8 @@ struct rpc_context { struct sockaddr_storage udp_src; struct rpc_pdu *waitpdu; - int inpos; - int insize; + uint32_t inpos; + uint32_t insize; char *inbuf; /* special fields for UDP, which can sometimes be BROADCASTed */ @@ -63,22 +98,22 @@ struct rpc_context { struct rpc_pdu { struct rpc_pdu *next; - unsigned long xid; - XDR xdr; + uint32_t xid; + ZDR zdr; - int written; + uint32_t written; struct rpc_data outdata; rpc_cb cb; void *private_data; - /* function to decode the xdr reply data and buffer to decode into */ - xdrproc_t xdr_decode_fn; - caddr_t xdr_decode_buf; - int xdr_decode_bufsize; + /* function to decode the zdr reply data and buffer to decode into */ + zdrproc_t zdr_decode_fn; + caddr_t zdr_decode_buf; + uint32_t zdr_decode_bufsize; }; -struct rpc_pdu *rpc_allocate_pdu(struct rpc_context *rpc, int program, int version, int procedure, rpc_cb cb, void *private_data, xdrproc_t xdr_decode_fn, int xdr_bufsize); +struct rpc_pdu *rpc_allocate_pdu(struct rpc_context *rpc, int program, int version, int procedure, rpc_cb cb, void *private_data, zdrproc_t zdr_decode_fn, int zdr_bufsize); void rpc_free_pdu(struct rpc_context *rpc, struct rpc_pdu *pdu); int rpc_queue_pdu(struct rpc_context *rpc, struct rpc_pdu *pdu); int rpc_get_pdu_size(char *buf);