Future patches will add PMAP3 which we will need for IPv6 support.
exit(10);
}
- if (rpc_pmap_callit_async(rpc, MOUNT_PROGRAM, 2, 0, NULL, 0, pm_cb, &data) < 0) {
+ if (rpc_pmap2_callit_async(rpc, MOUNT_PROGRAM, 2, 0, NULL, 0, pm_cb, &data) < 0) {
printf("Failed to set up callit function\n");
exit(10);
}
}
printf("Send getport request asking for MOUNT port\n");
- if (rpc_pmap_getport_async(rpc, MOUNT_PROGRAM, MOUNT_V3, IPPROTO_TCP, pmap_getport2_cb, client) != 0) {
+ if (rpc_pmap2_getport_async(rpc, MOUNT_PROGRAM, MOUNT_V3, IPPROTO_TCP, pmap_getport2_cb, client) != 0) {
printf("Failed to send getport request\n");
exit(10);
}
}
printf("Send getport request asking for MOUNT port\n");
- if (rpc_pmap_getport_async(rpc, RQUOTA_PROGRAM, RQUOTA_V1, IPPROTO_TCP, pmap_getport1_cb, client) != 0) {
+ if (rpc_pmap2_getport_async(rpc, RQUOTA_PROGRAM, RQUOTA_V1, IPPROTO_TCP, pmap_getport1_cb, client) != 0) {
printf("Failed to send getport request\n");
exit(10);
}
printf("Got reply from server for PORTMAP/NULL procedure.\n");
printf("Send PMAP/DUMP command\n");
- if (rpc_pmap_dump_async(rpc, pmap_dump_cb, client) != 0) {
+ if (rpc_pmap2_dump_async(rpc, pmap_dump_cb, client) != 0) {
printf("Failed to send getport request\n");
exit(10);
}
}
printf("Send NULL request to check if portmapper is actually running\n");
- if (rpc_pmap_null_async(rpc, pmap_null_cb, client) != 0) {
+ if (rpc_pmap2_null_async(rpc, pmap_null_cb, client) != 0) {
printf("Failed to send null request\n");
exit(10);
}
/*
- * PORTMAP FUNCTIONS
+ * PORTMAP v2 FUNCTIONS
*/
/*
- * Call PORTMAPPER/NULL
+ * Call PORTMAPPER2/NULL
* 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.
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-EXTERN int rpc_pmap_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
+EXTERN int rpc_pmap2_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
/*
- * Call PORTMAPPER/GETPORT.
+ * Call PORTMAPPER2/GETPORT.
* 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.
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-EXTERN int rpc_pmap_getport_async(struct rpc_context *rpc, int program, int version, int protocol, rpc_cb cb, void *private_data);
+EXTERN int rpc_pmap2_getport_async(struct rpc_context *rpc, int program, int version, int protocol, rpc_cb cb, void *private_data);
/*
- * Call PORTMAPPER/SET
+ * Call PORTMAPPER2/SET
* 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.
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-EXTERN int rpc_pmap_set_async(struct rpc_context *rpc, int program, int version, int protocol, int port, rpc_cb cb, void *private_data);
+EXTERN int rpc_pmap2_set_async(struct rpc_context *rpc, int program, int version, int protocol, int port, rpc_cb cb, void *private_data);
/*
- * Call PORTMAPPER/UNSET
+ * Call PORTMAPPER2/UNSET
* 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.
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-EXTERN int rpc_pmap_unset_async(struct rpc_context *rpc, int program, int version, int protocol, int port, rpc_cb cb, void *private_data);
+EXTERN int rpc_pmap2_unset_async(struct rpc_context *rpc, int program, int version, int protocol, int port, rpc_cb cb, void *private_data);
/*
- * Call PORTMAPPER/DUMP.
+ * Call PORTMAPPER2/DUMP.
* 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 struct *pmap_mapping_list.
+ * data is struct pmap_dump_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.
*/
-EXTERN int rpc_pmap_dump_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
+EXTERN int rpc_pmap2_dump_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
/*
- * Call PORTMAPPER/CALLIT.
+ * Call PORTMAPPER2/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.
* RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
* data is NULL.
*/
-EXTERN int rpc_pmap_callit_async(struct rpc_context *rpc, int program, int version, int procedure, char *data, int datalen, rpc_cb cb, void *private_data);
+EXTERN int rpc_pmap2_callit_async(struct rpc_context *rpc, int program, int version, int procedure, char *data, int datalen, rpc_cb cb, void *private_data);
/*
* MOUNT v3 FUNCTIONS
return -1;
}
- if (rpc_pmap_callit_async(rpc, MOUNT_PROGRAM, 2, 0, NULL, 0, callit_cb, data) < 0)
+ if (rpc_pmap2_callit_async(rpc, MOUNT_PROGRAM, 2, 0, NULL, 0, callit_cb, data) < 0)
{
return -1;
}
return -1;
}
- if (rpc_pmap_callit_async(rpc, MOUNT_PROGRAM, 2, 0, NULL, 0, callit_cb, data) < 0) {
+ if (rpc_pmap2_callit_async(rpc, MOUNT_PROGRAM, 2, 0, NULL, 0, callit_cb, data) < 0) {
return -1;
}
}
rpc_get_error
rpc_get_fd
rpc_init_context
-rpc_pmap_null_async
-rpc_pmap_getport_async
-rpc_pmap_set_async
-rpc_pmap_unset_async
-rpc_pmap_dump_async
-rpc_pmap_callit_async
+rpc_pmap2_null_async
+rpc_pmap2_getport_async
+rpc_pmap2_set_async
+rpc_pmap2_unset_async
+rpc_pmap2_dump_async
+rpc_pmap2_callit_async
rpc_mount_null_async
rpc_mount_mnt_async
rpc_mount_dump_async
return;
}
- if (rpc_pmap_getport_async(rpc, data->program, data->version, IPPROTO_TCP, rpc_connect_program_3_cb, private_data) != 0) {
+ if (rpc_pmap2_getport_async(rpc, data->program, data->version, IPPROTO_TCP, rpc_connect_program_3_cb, private_data) != 0) {
data->cb(rpc, status, command_data, data->private_data);
free_rpc_cb_data(data);
return;
return;
}
- if (rpc_pmap_null_async(rpc, rpc_connect_program_2_cb, data) != 0) {
+ if (rpc_pmap2_null_async(rpc, rpc_connect_program_2_cb, data) != 0) {
data->cb(rpc, status, command_data, data->private_data);
free_rpc_cb_data(data);
return;
return;
}
- if (rpc_pmap_getport_async(rpc, MOUNT_PROGRAM, MOUNT_V3, IPPROTO_TCP, nfs_mount_3_cb, private_data) != 0) {
+ if (rpc_pmap2_getport_async(rpc, MOUNT_PROGRAM, MOUNT_V3, IPPROTO_TCP, nfs_mount_3_cb, private_data) != 0) {
data->cb(-ENOMEM, nfs, command_data, data->private_data);
free_nfs_cb_data(data);
return;
return;
}
- if (rpc_pmap_null_async(rpc, nfs_mount_2_cb, data) != 0) {
+ if (rpc_pmap2_null_async(rpc, nfs_mount_2_cb, data) != 0) {
data->cb(-ENOMEM, nfs, command_data, data->private_data);
free_nfs_cb_data(data);
return;
return;
}
- if (rpc_pmap_getport_async(rpc, MOUNT_PROGRAM, MOUNT_V3, IPPROTO_TCP, mount_export_3_cb, private_data) != 0) {
+ if (rpc_pmap2_getport_async(rpc, MOUNT_PROGRAM, MOUNT_V3, IPPROTO_TCP, mount_export_3_cb, private_data) != 0) {
data->cb(rpc, -ENOMEM, command_data, data->private_data);
free_mount_cb_data(data);
return;
return;
}
- if (rpc_pmap_null_async(rpc, mount_export_2_cb, data) != 0) {
+ if (rpc_pmap2_null_async(rpc, mount_export_2_cb, data) != 0) {
data->cb(rpc, -ENOMEM, command_data, data->private_data);
free_mount_cb_data(data);
return;
#define PMAP_V2 2
#if defined(__STDC__) || defined(__cplusplus)
-#define PMAP_NULL 0
-extern void * pmap_null_2(void *, CLIENT *);
-extern void * pmap_null_2_svc(void *, struct svc_req *);
-#define PMAP_SET 1
-extern bool_t * pmap_set_2(pmap_mapping *, CLIENT *);
-extern bool_t * pmap_set_2_svc(pmap_mapping *, struct svc_req *);
-#define PMAP_UNSET 2
-extern bool_t * pmap_unset_2(pmap_mapping *, CLIENT *);
-extern bool_t * pmap_unset_2_svc(pmap_mapping *, struct svc_req *);
-#define PMAP_GETPORT 3
-extern u_int * pmap_getport_2(pmap_mapping *, CLIENT *);
-extern u_int * pmap_getport_2_svc(pmap_mapping *, struct svc_req *);
-#define PMAP_DUMP 4
-extern pmap_mapping_list * pmap_dump_2(void *, CLIENT *);
-extern pmap_mapping_list * pmap_dump_2_svc(void *, struct svc_req *);
-#define PMAP_CALLIT 5
-extern pmap_call_result * pmap_callit_2(pmap_call_args *, CLIENT *);
-extern pmap_call_result * pmap_callit_2_svc(pmap_call_args *, struct svc_req *);
+#define PMAP2_NULL 0
+extern void * pmap2_null_2(void *, CLIENT *);
+extern void * pmap2_null_2_svc(void *, struct svc_req *);
+#define PMAP2_SET 1
+extern bool_t * pmap2_set_2(pmap_mapping *, CLIENT *);
+extern bool_t * pmap2_set_2_svc(pmap_mapping *, struct svc_req *);
+#define PMAP2_UNSET 2
+extern bool_t * pmap2_unset_2(pmap_mapping *, CLIENT *);
+extern bool_t * pmap2_unset_2_svc(pmap_mapping *, struct svc_req *);
+#define PMAP2_GETPORT 3
+extern u_int * pmap2_getport_2(pmap_mapping *, CLIENT *);
+extern u_int * pmap2_getport_2_svc(pmap_mapping *, struct svc_req *);
+#define PMAP2_DUMP 4
+extern pmap_dump_result * pmap2_dump_2(void *, CLIENT *);
+extern pmap_dump_result * pmap2_dump_2_svc(void *, struct svc_req *);
+#define PMAP2_CALLIT 5
+extern pmap_call_result * pmap2_callit_2(pmap_call_args *, CLIENT *);
+extern pmap_call_result * pmap2_callit_2_svc(pmap_call_args *, struct svc_req *);
extern int pmap_program_2_freeresult (SVCXPRT *, zdrproc_t, caddr_t);
#else /* K&R C */
-#define PMAP_NULL 0
-extern void * pmap_null_2();
-extern void * pmap_null_2_svc();
-#define PMAP_SET 1
-extern bool_t * pmap_set_2();
-extern bool_t * pmap_set_2_svc();
-#define PMAP_UNSET 2
-extern bool_t * pmap_unset_2();
-extern bool_t * pmap_unset_2_svc();
-#define PMAP_GETPORT 3
-extern u_int * pmap_getport_2();
-extern u_int * pmap_getport_2_svc();
-#define PMAP_DUMP 4
-extern pmap_mapping_list * pmap_dump_2();
-extern pmap_mapping_list * pmap_dump_2_svc();
-#define PMAP_CALLIT 5
-extern pmap_call_result * pmap_callit_2();
-extern pmap_call_result * pmap_callit_2_svc();
+#define PMAP2_NULL 0
+extern void * pmap2_null_2();
+extern void * pmap2_null_2_svc();
+#define PMAP2_SET 1
+extern bool_t * pmap2_set_2();
+extern bool_t * pmap2_set_2_svc();
+#define PMAP2_UNSET 2
+extern bool_t * pmap2_unset_2();
+extern bool_t * pmap2_unset_2_svc();
+#define PMAP2_GETPORT 3
+extern u_int * pmap2_getport_2();
+extern u_int * pmap2_getport_2_svc();
+#define PMAP2_DUMP 4
+extern pmap_dump_result * pmap2_dump_2();
+extern pmap_dump_result * pmap2_dump_2_svc();
+#define PMAP2_CALLIT 5
+extern pmap_call_result * pmap2_callit_2();
+extern pmap_call_result * pmap2_callit_2_svc();
extern int pmap_program_2_freeresult ();
#endif /* K&R C */
#include "libnfs-raw-portmap.h"
-int rpc_pmap_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data)
+int rpc_pmap2_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data)
{
struct rpc_pdu *pdu;
- pdu = rpc_allocate_pdu(rpc, PMAP_PROGRAM, PMAP_V2, PMAP_NULL, cb, private_data, (zdrproc_t)zdr_void, 0);
+ pdu = rpc_allocate_pdu(rpc, PMAP_PROGRAM, PMAP_V2, PMAP2_NULL, cb, private_data, (zdrproc_t)zdr_void, 0);
if (pdu == NULL) {
- rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for portmap/null call");
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for PORTMAP2/NULL call");
return -1;
}
if (rpc_queue_pdu(rpc, pdu) != 0) {
- rpc_set_error(rpc, "Out of memory. Failed to queue pdu for portmap/null call");
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for PORTMAP2/NULL call");
rpc_free_pdu(rpc, pdu);
return -1;
}
return 0;
}
-int rpc_pmap_getport_async(struct rpc_context *rpc, int program, int version, int protocol, rpc_cb cb, void *private_data)
+int rpc_pmap2_getport_async(struct rpc_context *rpc, int program, int version, int protocol, rpc_cb cb, void *private_data)
{
struct rpc_pdu *pdu;
struct pmap_mapping m;
- pdu = rpc_allocate_pdu(rpc, PMAP_PROGRAM, PMAP_V2, PMAP_GETPORT, cb, private_data, (zdrproc_t)zdr_int, sizeof(uint32_t));
+ pdu = rpc_allocate_pdu(rpc, PMAP_PROGRAM, PMAP_V2, PMAP2_GETPORT, 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/getport call");
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for PORTMAP2/GETPORT call");
return -1;
}
m.prot = protocol;
m.port = 0;
if (zdr_pmap_mapping(&pdu->zdr, &m) == 0) {
- rpc_set_error(rpc, "ZDR error: Failed to encode data for portmap/getport call");
+ rpc_set_error(rpc, "ZDR error: Failed to encode data for PORTMAP2/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_set_error(rpc, "Failed to queue PORTMAP2/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)
+int rpc_pmap2_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));
+ pdu = rpc_allocate_pdu(rpc, PMAP_PROGRAM, PMAP_V2, PMAP2_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");
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for PORTMAP2/SET call");
return -1;
}
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_set_error(rpc, "ZDR error: Failed to encode data for PORTMAP2/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_set_error(rpc, "Failed to queue PORTMAP2/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)
+int rpc_pmap2_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));
+ pdu = rpc_allocate_pdu(rpc, PMAP_PROGRAM, PMAP_V2, PMAP2_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");
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for PORTMAP2/UNSET call");
return -1;
}
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");
+ rpc_set_error(rpc, "ZDR error: Failed to encode data for PORTMAP2/UNSET call");
rpc_free_pdu(rpc, pdu);
return -1;
}
if (rpc_queue_pdu(rpc, pdu) != 0) {
- rpc_set_error(rpc, "Failed to queue portmap/unset pdu");
+ rpc_set_error(rpc, "Failed to queue PORTMAP2/UNSET pdu");
rpc_free_pdu(rpc, pdu);
return -1;
}
return 0;
}
-int rpc_pmap_dump_async(struct rpc_context *rpc, rpc_cb cb, void *private_data)
+int rpc_pmap2_dump_async(struct rpc_context *rpc, rpc_cb cb, void *private_data)
{
struct rpc_pdu *pdu;
- pdu = rpc_allocate_pdu(rpc, PMAP_PROGRAM, PMAP_V2, PMAP_DUMP, cb, private_data, (zdrproc_t)zdr_pmap_dump_result, sizeof(pmap_dump_result));
+ pdu = rpc_allocate_pdu(rpc, PMAP_PROGRAM, PMAP_V2, PMAP2_DUMP, cb, private_data, (zdrproc_t)zdr_pmap_dump_result, sizeof(pmap_dump_result));
if (pdu == NULL) {
- rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for portmap/dump call");
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for PORTMAP2/DUMP call");
return -1;
}
if (rpc_queue_pdu(rpc, pdu) != 0) {
- rpc_set_error(rpc, "Failed to queue portmap/dump pdu");
+ rpc_set_error(rpc, "Failed to queue PORTMAP2/DUMP pdu");
rpc_free_pdu(rpc, pdu);
return -1;
}
return 0;
}
-int rpc_pmap_callit_async(struct rpc_context *rpc, int program, int version, int procedure, char *data, int datalen, rpc_cb cb, void *private_data)
+int rpc_pmap2_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 pmap_call_args ca;
- pdu = rpc_allocate_pdu(rpc, PMAP_PROGRAM, PMAP_V2, PMAP_CALLIT, cb, private_data, (zdrproc_t)zdr_pmap_call_result, sizeof(pmap_call_result));
+ pdu = rpc_allocate_pdu(rpc, PMAP_PROGRAM, PMAP_V2, PMAP2_CALLIT, cb, private_data, (zdrproc_t)zdr_pmap_call_result, sizeof(pmap_call_result));
if (pdu == NULL) {
- rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for portmap/callit call");
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for PORTMAP2/CALLIT call");
return -1;
}
ca.args.args_val = data;
if (zdr_pmap_call_args(&pdu->zdr, &ca) == 0) {
- rpc_set_error(rpc, "ZDR error: Failed to encode data for portmap/callit call");
+ rpc_set_error(rpc, "ZDR error: Failed to encode data for PORTMAP2/CALLIT call");
rpc_free_pdu(rpc, pdu);
return -1;
}
if (rpc_queue_pdu(rpc, pdu) != 0) {
- rpc_set_error(rpc, "Failed to queue portmap/callit pdu: %s", rpc_get_error(rpc));
+ rpc_set_error(rpc, "Failed to queue PORTMAP2/CALLIT pdu: %s", rpc_get_error(rpc));
return -1;
}
program PMAP_PROGRAM {
version PMAP_V2 {
void
- PMAP_NULL(void) = 0;
+ PMAP2_NULL(void) = 0;
bool
- PMAP_SET(pmap_mapping) = 1;
+ PMAP2_SET(pmap_mapping) = 1;
bool
- PMAP_UNSET(pmap_mapping) = 2;
+ PMAP2_UNSET(pmap_mapping) = 2;
unsigned int
- PMAP_GETPORT(pmap_mapping) = 3;
+ PMAP2_GETPORT(pmap_mapping) = 3;
- pmap_mapping_list
- PMAP_DUMP(void) = 4;
+ pmap_dump_result
+ PMAP2_DUMP(void) = 4;
pmap_call_result
- PMAP_CALLIT(pmap_call_args) = 5;
+ PMAP2_CALLIT(pmap_call_args) = 5;
} = 2;
} = 100000;