*
* When the callback is invoked, status indicates the result:
* RPC_STATUS_SUCCESS : We got a successful response from the portmapper daemon
- * data is a 'pmap_call_result' pointer.
+ * data is a 'pmap2_call_result' pointer.
* 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.
*/
EXTERN int rpc_pmap3_dump_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
+/*
+ * Call PORTMAPPER3/CALLIT.
+ * 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 'pmap3_call_result' pointer.
+ * 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.
+ */
+EXTERN int rpc_pmap3_callit_async(struct rpc_context *rpc, int program, int version, int procedure, char *data, int datalen, rpc_cb cb, void *private_data);
+
/*
* Call PORTMAPPER3/GETTIME.
* Function returns
rpc_pmap2_dump_async
rpc_pmap2_callit_async
rpc_pmap3_null_async
+rpc_pmap3_set_async
+rpc_pmap3_unset_async
rpc_pmap3_getaddr_async
rpc_pmap3_dump_async
+rpc_pmap3_callit_async
rpc_pmap3_gettime_async
rpc_mount_null_async
rpc_mount_mnt_async
return FALSE;
return TRUE;
}
+
+bool_t
+zdr_pmap3_call_args (ZDR *zdrs, pmap3_call_args *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+
+ if (zdrs->x_op == ZDR_ENCODE) {
+ buf = ZDR_INLINE (zdrs, 3 * BYTES_PER_ZDR_UNIT);
+ if (buf == NULL) {
+ if (!zdr_u_int (zdrs, &objp->prog))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->vers))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->proc))
+ return FALSE;
+
+ } else {
+ IZDR_PUT_U_LONG(buf, objp->prog);
+ IZDR_PUT_U_LONG(buf, objp->vers);
+ IZDR_PUT_U_LONG(buf, objp->proc);
+ }
+ if (!zdr_bytes (zdrs, (char **)&objp->args.args_val, (u_int *) &objp->args.args_len, ~0))
+ return FALSE;
+ return TRUE;
+ } else if (zdrs->x_op == ZDR_DECODE) {
+ buf = ZDR_INLINE (zdrs, 3 * BYTES_PER_ZDR_UNIT);
+ if (buf == NULL) {
+ if (!zdr_u_int (zdrs, &objp->prog))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->vers))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->proc))
+ return FALSE;
+
+ } else {
+ objp->prog = IZDR_GET_U_LONG(buf);
+ objp->vers = IZDR_GET_U_LONG(buf);
+ objp->proc = IZDR_GET_U_LONG(buf);
+ }
+ if (!zdr_bytes (zdrs, (char **)&objp->args.args_val, (u_int *) &objp->args.args_len, ~0))
+ return FALSE;
+ return TRUE;
+ }
+
+ if (!zdr_u_int (zdrs, &objp->prog))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->vers))
+ return FALSE;
+ if (!zdr_u_int (zdrs, &objp->proc))
+ return FALSE;
+ if (!zdr_bytes (zdrs, (char **)&objp->args.args_val, (u_int *) &objp->args.args_len, ~0))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_pmap3_call_result (ZDR *zdrs, pmap3_call_result *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_u_int (zdrs, &objp->port))
+ return FALSE;
+ if (!zdr_bytes (zdrs, (char **)&objp->res.res_val, (u_int *) &objp->res.res_len, ~0))
+ return FALSE;
+ return TRUE;
+}
};
typedef struct pmap3_dump_result pmap3_dump_result;
+struct pmap3_call_args {
+ u_int prog;
+ u_int vers;
+ u_int proc;
+ struct {
+ u_int args_len;
+ char *args_val;
+ } args;
+};
+typedef struct pmap3_call_args pmap3_call_args;
+
+struct pmap3_call_result {
+ u_int port;
+ struct {
+ u_int res_len;
+ char *res_val;
+ } res;
+};
+typedef struct pmap3_call_result pmap3_call_result;
+
#define PMAP_PROGRAM 100000
#define PMAP_V2 2
#define PMAP3_DUMP 4
extern pmap3_dump_result * pmap3_dump_3(void *, CLIENT *);
extern pmap3_dump_result * pmap3_dump_3_svc(void *, struct svc_req *);
+#define PMAP3_CALLIT 5
+extern pmap3_call_result * pmap3_callit_3(pmap3_call_args *, CLIENT *);
+extern pmap3_call_result * pmap3_callit_3_svc(pmap3_call_args *, struct svc_req *);
#define PMAP3_GETTIME 6
extern u_int * pmap3_gettime_3(void *, CLIENT *);
extern u_int * pmap3_gettime_3_svc(void *, struct svc_req *);
#define PMAP3_DUMP 4
extern pmap3_dump_result * pmap3_dump_3();
extern pmap3_dump_result * pmap3_dump_3_svc();
+#define PMAP3_CALLIT 5
+extern pmap3_call_result * pmap3_callit_3();
+extern pmap3_call_result * pmap3_callit_3_svc();
#define PMAP3_GETTIME 6
extern u_int * pmap3_gettime_3();
extern u_int * pmap3_gettime_3_svc();
extern bool_t zdr_pmap3_mapping (ZDR *, pmap3_mapping*);
extern bool_t zdr_pmap3_mapping_list (ZDR *, pmap3_mapping_list*);
extern bool_t zdr_pmap3_dump_result (ZDR *, pmap3_dump_result*);
+extern bool_t zdr_pmap3_call_args (ZDR *, pmap3_call_args*);
+extern bool_t zdr_pmap3_call_result (ZDR *, pmap3_call_result*);
#else /* K&R C */
extern bool_t zdr_pmap2_mapping ();
extern bool_t zdr_pmap3_mapping ();
extern bool_t zdr_pmap3_mapping_list ();
extern bool_t zdr_pmap3_dump_result ();
+extern bool_t zdr_pmap3_call_args ();
+extern bool_t zdr_pmap3_call_result ();
#endif /* K&R C */
return 0;
}
+
+int rpc_pmap3_callit_async(struct rpc_context *rpc, int program, int version, int procedure, char *data, int datalen, rpc_cb cb, void *private_data)
+{
+ struct rpc_pdu *pdu;
+ struct pmap3_call_args ca;
+
+ pdu = rpc_allocate_pdu(rpc, PMAP_PROGRAM, PMAP_V3, PMAP3_CALLIT, cb, private_data, (zdrproc_t)zdr_pmap3_call_result, sizeof(pmap3_call_result));
+ if (pdu == NULL) {
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for PORTMAP3/CALLIT call");
+ return -1;
+ }
+
+ ca.prog = program;
+ ca.vers = version;
+ ca.proc = procedure;
+ ca.args.args_len = datalen;
+ ca.args.args_val = data;
+
+ if (zdr_pmap3_call_args(&pdu->zdr, &ca) == 0) {
+ rpc_set_error(rpc, "ZDR error: Failed to encode data for PORTMAP3/CALLIT call");
+ rpc_free_pdu(rpc, pdu);
+ return -1;
+ }
+
+ if (rpc_queue_pdu(rpc, pdu) != 0) {
+ rpc_set_error(rpc, "Failed to queue PORTMAP3/CALLIT pdu: %s", rpc_get_error(rpc));
+ return -1;
+ }
+
+ return 0;
+}
struct pmap3_mapping_list *list;
};
+struct pmap3_call_args {
+ unsigned int prog;
+ unsigned int vers;
+ unsigned int proc;
+ opaque args<>;
+};
+
+struct pmap3_call_result {
+ unsigned int port;
+ opaque res<>;
+};
+
program PMAP_PROGRAM {
version PMAP_V2 {
void
pmap3_dump_result
PMAP3_DUMP(void) = 4;
+ pmap3_call_result
+ PMAP3_CALLIT(pmap3_call_args) = 5;
+
unsigned int
PMAP3_GETTIME(void) = 6;
} = 3;