]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - support/include/nfsrpc.h
getport: Recognize "rdma" and "rdma6" netid
[nfs-utils.git] / support / include / nfsrpc.h
index e129a72dffab062fad12f2532d03b6e0c73bd0bd..d50fe94c8870017f30112af272671cefe62ecdc9 100644 (file)
 #define __NFS_UTILS_NFSRPC_H
 
 #include <rpc/types.h>
+#include <rpc/clnt.h>
+
+/*
+ * IANA does not define an IP protocol number for RDMA transports.
+ * Choose an arbitrary value we can use locally.
+ */
+#define NFSPROTO_RDMA          (3939)
 
 /*
  * Conventional RPC program numbers
 #define NSMPROG                ((rpcprog_t)100024)
 #endif
 
+/**
+ * nfs_clear_rpc_createerr - zap all error reporting fields
+ *
+ */
+static inline void nfs_clear_rpc_createerr(void)
+{
+       memset(&rpc_createerr, 0, sizeof(rpc_createerr));
+}
+
 /*
  * Look up an RPC program name in /etc/rpc
  */
 extern rpcprog_t       nfs_getrpcbyname(const rpcprog_t, const char *table[]);
 
 /*
- * Look up a port number in /etc/services for an RPC program
+ * Acquire an RPC CLIENT * with an ephemeral source port
  */
-extern unsigned short  nfs_getportbynumber(const rpcprog_t program,
-                               const unsigned short transport);
+extern CLIENT          *nfs_get_rpcclient(const struct sockaddr *,
+                               const socklen_t, const unsigned short,
+                               const rpcprog_t, const rpcvers_t,
+                               struct timeval *);
 
 /*
- * Acquire an RPC CLIENT *
+ * Acquire an RPC CLIENT * with a privileged source port
  */
-extern CLIENT          *nfs_get_rpcclient(const struct sockaddr *,
+extern CLIENT          *nfs_get_priv_rpcclient( const struct sockaddr *,
                                const socklen_t, const unsigned short,
                                const rpcprog_t, const rpcvers_t,
                                struct timeval *);
 
-#endif /* __NFS_UTILS_NFSRPC_H */
+/*
+ * Convert a netid to a protocol number and protocol family
+ */
+extern int             nfs_get_proto(const char *netid, sa_family_t *family,
+                               unsigned long *protocol);
+
+/*
+ * Convert a protocol family and protocol name to a netid
+ */
+extern char            *nfs_get_netid(const sa_family_t family,
+                               const unsigned long protocol);
+
+/*
+ * Convert a socket address to a universal address
+ */
+extern char            *nfs_sockaddr2universal(const struct sockaddr *);
+
+/*
+ * Extract port number from a universal address
+ */
+extern int             nfs_universal2port(const char *);
+
+/*
+ * Generic function that maps an RPC service tuple to an IP port
+ * number of the service on a remote post, and sends a NULL
+ * request to determine if the service is responding to requests
+ */
+extern int             nfs_getport_ping(struct sockaddr *sap,
+                               const socklen_t salen,
+                               const rpcprog_t program,
+                               const rpcvers_t version,
+                               const unsigned short protocol);
+
+/*
+ * Generic function that maps an RPC service tuple to an IP port
+ * number of the service on a remote host
+ */
+extern unsigned short  nfs_getport(const struct sockaddr *,
+                               const socklen_t, const rpcprog_t,
+                               const rpcvers_t, const unsigned short);
+
+/*
+ * Generic function that maps an RPC service tuple to an IP port
+ * number of the service on the local host
+ */
+extern unsigned short  nfs_getlocalport(const rpcprot_t,
+                               const rpcvers_t, const unsigned short);
+
+/*
+ * Function to invoke an rpcbind v3/v4 GETADDR request
+ */
+extern unsigned short  nfs_rpcb_getaddr(const struct sockaddr *,
+                               const socklen_t,
+                               const unsigned short,
+                               const struct sockaddr *,
+                               const rpcprog_t,
+                               const rpcvers_t,
+                               const unsigned short,
+                               const struct timeval *);
+
+/*
+ * Function to invoke a portmap GETPORT request
+ */
+extern unsigned long   nfs_pmap_getport(const struct sockaddr_in *,
+                               const unsigned short,
+                               const unsigned long,
+                               const unsigned long,
+                               const unsigned long,
+                               const struct timeval *);
+
+/*
+ * Contact a remote RPC service to discover whether it is responding
+ * to requests.
+ */
+extern int             nfs_rpc_ping(const struct sockaddr *sap,
+                               const socklen_t salen,
+                               const rpcprog_t program,
+                               const rpcvers_t version,
+                               const unsigned short protocol,
+                               const struct timeval *timeout);
+
+/* create AUTH_SYS handle with no supplemental groups */
+extern AUTH *                   nfs_authsys_create(void);
+
+#endif /* !__NFS_UTILS_NFSRPC_H */