+ if (zdr_pmap_mapping(&pdu->zdr, &m) == 0) {
+ rpc_set_error(rpc, "ZDR error: Failed to encode data for portmap/getport call");
+ rpc_free_pdu(rpc, pdu);
+ return -1;
+ }
+
+ if (rpc_queue_pdu(rpc, pdu) != 0) {
+ rpc_set_error(rpc, "Failed to queue portmap/getport pdu");
+ rpc_free_pdu(rpc, pdu);
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_pmap_set_async(struct rpc_context *rpc, int program, int version, int protocol, int port, rpc_cb cb, void *private_data)
+{
+ struct rpc_pdu *pdu;
+ struct pmap_mapping m;
+
+ pdu = rpc_allocate_pdu(rpc, PMAP_PROGRAM, PMAP_V2, PMAP_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 portmap/set call");
+ return -1;
+ }
+
+ m.prog = program;
+ m.vers = version;
+ m.prot = protocol;
+ m.port = port;
+ if (zdr_pmap_mapping(&pdu->zdr, &m) == 0) {
+ rpc_set_error(rpc, "ZDR error: Failed to encode data for portmap/set call");
+ rpc_free_pdu(rpc, pdu);
+ return -1;
+ }
+
+ if (rpc_queue_pdu(rpc, pdu) != 0) {
+ rpc_set_error(rpc, "Failed to queue portmap/set pdu");
+ rpc_free_pdu(rpc, pdu);
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_pmap_unset_async(struct rpc_context *rpc, int program, int version, int protocol, int port, rpc_cb cb, void *private_data)
+{
+ struct rpc_pdu *pdu;
+ struct pmap_mapping m;
+
+ pdu = rpc_allocate_pdu(rpc, PMAP_PROGRAM, PMAP_V2, PMAP_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 portmap/unset call");
+ return -1;
+ }
+
+ m.prog = program;
+ m.vers = version;
+ m.prot = protocol;
+ m.port = port;
+ if (zdr_pmap_mapping(&pdu->zdr, &m) == 0) {
+ rpc_set_error(rpc, "ZDR error: Failed to encode data for portmap/unset call");