PORTMAP: Add PMAP v3 UADDR2TADDR support
[deb_libnfs.git] / portmap / portmap.c
index 5c0633bc25d894f60aa56263afda7d20c1fcdf1b..e6aea825d729b7a7488aa5ba07a4583bd69d139c 100644 (file)
@@ -352,3 +352,27 @@ int rpc_pmap3_callit_async(struct rpc_context *rpc, int program, int version, in
 
        return 0;
 }
+
+int rpc_pmap3_uaddr2taddr_async(struct rpc_context *rpc, char *uaddr, rpc_cb cb, void *private_data)
+{
+       struct rpc_pdu *pdu;
+
+       pdu = rpc_allocate_pdu(rpc, PMAP_PROGRAM, PMAP_V3, PMAP3_UADDR2TADDR, cb, private_data, (zdrproc_t)zdr_pmap3_netbuf, sizeof(pmap3_netbuf));
+       if (pdu == NULL) {
+               rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for PORTMAP3/UADDR2TADDR call");
+               return -1;
+       }
+
+       if (zdr_string(&pdu->zdr, &uaddr, 255) == 0) {
+               rpc_set_error(rpc, "ZDR error: Failed to encode data for PORTMAP3/UADDR2TADDR call");
+               rpc_free_pdu(rpc, pdu);
+               return -1;
+       }
+
+       if (rpc_queue_pdu(rpc, pdu) != 0) {
+               rpc_set_error(rpc, "Failed to queue PORTMAP3/UADDR2TADDR pdu: %s", rpc_get_error(rpc));
+               return -1;
+       }
+
+       return 0;
+}