PORTMAP: Add support for v3 TADDR2UADDR

libnfs-4.0.0-vitalif
Ronnie Sahlberg 2014-03-17 21:20:12 -07:00
parent 729266a796
commit 29258a73c0
5 changed files with 51 additions and 0 deletions

View File

@ -352,6 +352,23 @@ EXTERN int rpc_pmap3_gettime_async(struct rpc_context *rpc, rpc_cb cb, void *pri
*/
EXTERN int rpc_pmap3_uaddr2taddr_async(struct rpc_context *rpc, char *uaddr, rpc_cb cb, void *private_data);
/*
* Call PORTMAPPER3/TADDR2UADDR.
* Function returns
* 0 : The connection was initiated. Once the connection establish finishes, the callback will be invoked.
* <0 : An error occured when trying to set up the connection. The callback will not be invoked.
*
* When the callback is invoked, status indicates the result:
* RPC_STATUS_SUCCESS : We got a successful response from the portmapper daemon.
* data is a struct pmap3_getaddr_result *.
* RPC_STATUS_ERROR : An error occured when trying to contact the portmapper.
* data is the error string.
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
struct pmap3_netbuf;
EXTERN int rpc_pmap3_taddr2uaddr_async(struct rpc_context *rpc, struct pmap3_netbuf *netbuf, rpc_cb cb, void *private_data);
/*
* MOUNT v3 FUNCTIONS
*/

View File

@ -110,6 +110,7 @@ rpc_pmap3_dump_async
rpc_pmap3_callit_async
rpc_pmap3_gettime_async
rpc_pmap3_uaddr2taddr_async
rpc_pmap3_taddr2uaddr_async
rpc_mount_null_async
rpc_mount_mnt_async
rpc_mount_dump_async

View File

@ -180,6 +180,9 @@ extern u_int * pmap3_gettime_3_svc(void *, struct svc_req *);
#define PMAP3_UADDR2TADDR 7
extern pmap3_netbuf * pmap3_uaddr2taddr_3(char **, CLIENT *);
extern pmap3_netbuf * pmap3_uaddr2taddr_3_svc(char **, struct svc_req *);
#define PMAP3_TADDR2UADDR 8
extern struct pmap3_getaddr_result * pmap3_taddr2uaddr_3(pmap3_netbuf *, CLIENT *);
extern struct pmap3_getaddr_result * pmap3_taddr2uaddr_3_svc(pmap3_netbuf *, struct svc_req *);
extern int pmap_program_3_freeresult (SVCXPRT *, zdrproc_t, caddr_t);
#else /* K&R C */
@ -207,6 +210,9 @@ extern u_int * pmap3_gettime_3_svc();
#define PMAP3_UADDR2TADDR 7
extern pmap3_netbuf * pmap3_uaddr2taddr_3();
extern pmap3_netbuf * pmap3_uaddr2taddr_3_svc();
#define PMAP3_TADDR2UADDR 8
extern struct pmap3_getaddr_result * pmap3_taddr2uaddr_3();
extern struct pmap3_getaddr_result * pmap3_taddr2uaddr_3_svc();
extern int pmap_program_3_freeresult ();
#endif /* K&R C */

View File

@ -376,3 +376,27 @@ int rpc_pmap3_uaddr2taddr_async(struct rpc_context *rpc, char *uaddr, rpc_cb cb,
return 0;
}
int rpc_pmap3_taddr2uaddr_async(struct rpc_context *rpc, struct pmap3_netbuf *nb, rpc_cb cb, void *private_data)
{
struct rpc_pdu *pdu;
pdu = rpc_allocate_pdu(rpc, PMAP_PROGRAM, PMAP_V3, PMAP3_TADDR2UADDR, cb, private_data, (zdrproc_t)zdr_pmap3_getaddr_result, sizeof(pmap3_getaddr_result));
if (pdu == NULL) {
rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for PORTMAP3/TADDR2UADDR call");
return -1;
}
if (zdr_pmap3_netbuf(&pdu->zdr, nb) == 0) {
rpc_set_error(rpc, "ZDR error: Failed to encode data for PORTMAP3/TADDR2UADDR call");
rpc_free_pdu(rpc, pdu);
return -1;
}
if (rpc_queue_pdu(rpc, pdu) != 0) {
rpc_set_error(rpc, "Failed to queue PORTMAP3/TADDR2UADDR pdu: %s", rpc_get_error(rpc));
return -1;
}
return 0;
}

View File

@ -114,6 +114,9 @@ program PMAP_PROGRAM {
pmap3_netbuf
PMAP3_UADDR2TADDR(string) = 7;
struct pmap3_getaddr_result
PMAP3_TADDR2UADDR(pmap3_netbuf) = 8;
} = 3;
} = 100000;