Introduce rpcbind client utility functions
[nfs-utils.git] / support / include / nfsrpc.h
index e129a72..1529d44 100644 (file)
@@ -67,4 +67,75 @@ extern CLIENT                *nfs_get_rpcclient(const struct sockaddr *,
                                const rpcprog_t, const rpcvers_t,
                                struct timeval *);
 
+/*
+ * Convert a socket address to a universal address
+ */
+extern char            *nfs_sockaddr2universal(const struct sockaddr *,
+                               const socklen_t);
+
+/*
+ * 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 socklen_t,
+                               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);
+
 #endif /* __NFS_UTILS_NFSRPC_H */