diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2010-01-12 16:41:43 -0500 |
---|---|---|
committer | Steve Dickson <steved@redhat.com> | 2010-01-15 14:55:51 -0500 |
commit | d89f50b2902305020a8e5d63ddc0b024679a1fc1 (patch) | |
tree | dae68b1082437a54a5ffdb3435cb0402dac8aa99 /support/include/nsm.h | |
parent | 1c0f9045bf479f38ec39ffa5c6a4c77a8fcabda8 (diff) | |
download | nfs-utils-d89f50b2902305020a8e5d63ddc0b024679a1fc1.tar.gz nfs-utils-d89f50b2902305020a8e5d63ddc0b024679a1fc1.tar.xz nfs-utils-d89f50b2902305020a8e5d63ddc0b024679a1fc1.zip |
libnsm.a: Add RPC construction helper functions
To manage concurrency, both statd and sm-notify construct raw RPC
requests in socket buffers, and use a minimal request scheduler
to send these requests and manage replies. Both statd and sm-notify
open code the RPC request construction.
Introduce helper functions that can construct and send raw
NSMPROC_NOTIFY, NLM downcalls, and portmapper calls over a datagram
socket, and receive and parse their replies. Support for IPv6 and
RPCB_GETADDR is featured. This code (and the IPv6 support it
introduces) can now be shared by statd and sm-notify, eliminating
code and bug duplication.
This implementation is based on what's in utils/statd/rmtcall.c now,
but is wrapped up in a nice API and includes extra error checking.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Diffstat (limited to 'support/include/nsm.h')
-rw-r--r-- | support/include/nsm.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/support/include/nsm.h b/support/include/nsm.h index 28314d1..ce9e294 100644 --- a/support/include/nsm.h +++ b/support/include/nsm.h @@ -63,4 +63,29 @@ extern void nsm_delete_notified_host(const char *hostname); extern size_t nsm_priv_to_hex(const char *priv, char *buf, const size_t buflen); +/* rpc.c */ + +#define NSM_MAXMSGSIZE (2048u) + +extern uint32_t nsm_xmit_getport(const int sock, + const struct sockaddr_in *sin, + const unsigned long program, + const unsigned long version); +extern uint32_t nsm_xmit_getaddr(const int sock, + const struct sockaddr_in6 *sin6, + const rpcprog_t program, const rpcvers_t version); +extern uint32_t nsm_xmit_rpcbind(const int sock, const struct sockaddr *sap, + const rpcprog_t program, const rpcvers_t version); +extern uint32_t nsm_xmit_notify(const int sock, const struct sockaddr *sap, + const socklen_t salen, const rpcprog_t program, + const char *mon_name, const int state); +extern uint32_t nsm_xmit_nlmcall(const int sock, const struct sockaddr *sap, + const socklen_t salen, const struct mon *m, + const int state); +extern uint32_t nsm_parse_reply(XDR *xdrs); +extern unsigned long + nsm_recv_getport(XDR *xdrs); +extern uint16_t nsm_recv_getaddr(XDR *xdrs); +extern uint16_t nsm_recv_rpcbind(const sa_family_t family, XDR *xdrs); + #endif /* !NFS_UTILS_SUPPORT_NSM_H */ |