X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=portmap%2Fportmap.c;h=16a43dcf0664eead0c548318046b52f8534c8a82;hb=d731e94cfa97651aa6a44dbff8855c924858696c;hp=926ca6075aedc65add3553d44f16e53c1b1cdde4;hpb=7fbedfdefd1df0bb6f67d7ee769918c0a09ed3be;p=deb_libnfs.git diff --git a/portmap/portmap.c b/portmap/portmap.c index 926ca60..16a43dc 100644 --- a/portmap/portmap.c +++ b/portmap/portmap.c @@ -209,6 +209,56 @@ int rpc_pmap3_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data) return 0; } +int rpc_pmap3_set_async(struct rpc_context *rpc, struct pmap3_mapping *map, rpc_cb cb, void *private_data) +{ + struct rpc_pdu *pdu; + + pdu = rpc_allocate_pdu(rpc, PMAP_PROGRAM, PMAP_V3, PMAP3_SET, cb, private_data, (zdrproc_t)zdr_int, sizeof(uint32_t)); + if (pdu == NULL) { + rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for PORTMAP3/SET call"); + return -1; + } + + if (zdr_pmap3_mapping(&pdu->zdr, map) == 0) { + rpc_set_error(rpc, "ZDR error: Failed to encode data for PORTMAP3/SET call"); + rpc_free_pdu(rpc, pdu); + return -1; + } + + if (rpc_queue_pdu(rpc, pdu) != 0) { + rpc_set_error(rpc, "Failed to queue PORTMAP3/SET pdu"); + rpc_free_pdu(rpc, pdu); + return -1; + } + + return 0; +} + +int rpc_pmap3_unset_async(struct rpc_context *rpc, struct pmap3_mapping *map, rpc_cb cb, void *private_data) +{ + struct rpc_pdu *pdu; + + pdu = rpc_allocate_pdu(rpc, PMAP_PROGRAM, PMAP_V3, PMAP3_UNSET, cb, private_data, (zdrproc_t)zdr_int, sizeof(uint32_t)); + if (pdu == NULL) { + rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for PORTMAP3/UNSET call"); + return -1; + } + + if (zdr_pmap3_mapping(&pdu->zdr, map) == 0) { + rpc_set_error(rpc, "ZDR error: Failed to encode data for PORTMAP3/UNSET call"); + rpc_free_pdu(rpc, pdu); + return -1; + } + + if (rpc_queue_pdu(rpc, pdu) != 0) { + rpc_set_error(rpc, "Failed to queue PORTMAP3/UNSET pdu"); + rpc_free_pdu(rpc, pdu); + return -1; + } + + return 0; +} + int rpc_pmap3_getaddr_async(struct rpc_context *rpc, struct pmap3_mapping *map, rpc_cb cb, void *private_data) { struct rpc_pdu *pdu;