*/
int rpc_nsm1_null_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
+/*
+ * Call NSM/STAT
+ * Call the STAT procedure for the NSM protocol
+ *
+ * Function returns
+ * 0 : The call was initiated. The callback will be invoked when the call completes.
+ * <0 : An error occured when trying to set up the call. 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 nsm daemon.
+ * data is NSM1_STATres
+ * RPC_STATUS_ERROR : An error occured when trying to contact the nsm daemon.
+ * data is the error string.
+ * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
+ * data is NULL.
+ */
+struct NSM1_STATargs;
+int rpc_nsm1_stat_async(struct rpc_context *rpc, rpc_cb cb, struct NSM1_STATargs *args, void *private_data);
+
+/*
+ * Call NSM/MON
+ * Call the MON procedure for the NSM protocol
+ *
+ * Function returns
+ * 0 : The call was initiated. The callback will be invoked when the call completes.
+ * <0 : An error occured when trying to set up the call. 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 nsm daemon.
+ * data is NSM1_MONres
+ * RPC_STATUS_ERROR : An error occured when trying to contact the nsm daemon.
+ * data is the error string.
+ * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
+ * data is NULL.
+ */
+struct NSM1_MONargs;
+int rpc_nsm1_mon_async(struct rpc_context *rpc, rpc_cb cb, struct NSM1_MONargs *args, void *private_data);
+
+/*
+ * Call NSM/UNMON
+ * Call the UNMON procedure for the NSM protocol
+ *
+ * Function returns
+ * 0 : The call was initiated. The callback will be invoked when the call completes.
+ * <0 : An error occured when trying to set up the call. 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 nsm daemon.
+ * data is NSM1_UNMONres
+ * RPC_STATUS_ERROR : An error occured when trying to contact the nsm daemon.
+ * data is the error string.
+ * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
+ * data is NULL.
+ */
+struct NSM1_UNMONargs;
+int rpc_nsm1_unmon_async(struct rpc_context *rpc, rpc_cb cb, struct NSM1_UNMONargs *args, void *private_data);
+
+/*
+ * Call NSM/UNMONALL
+ * Call the UNMONALL procedure for the NSM protocol
+ *
+ * Function returns
+ * 0 : The call was initiated. The callback will be invoked when the call completes.
+ * <0 : An error occured when trying to set up the call. 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 nsm daemon.
+ * data is NSM1_UNMONALLres
+ * RPC_STATUS_ERROR : An error occured when trying to contact the nsm daemon.
+ * data is the error string.
+ * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
+ * data is NULL.
+ */
+struct NSM1_UNMONALLargs;
+int rpc_nsm1_unmonall_async(struct rpc_context *rpc, rpc_cb cb, struct NSM1_UNMONALLargs *args, void *private_data);
+
+/*
+ * Call NSM/SIMUCRASH
+ * Call the SIMUCRASH procedure for the NSM protocol
+ *
+ * Function returns
+ * 0 : The call was initiated. The callback will be invoked when the call completes.
+ * <0 : An error occured when trying to set up the call. 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 nsm daemon.
+ * data is NULL
+ * RPC_STATUS_ERROR : An error occured when trying to contact the nsm daemon.
+ * data is the error string.
+ * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
+ * data is NULL.
+ */
+int rpc_nsm1_simucrash_async(struct rpc_context *rpc, rpc_cb cb, void *private_data);
+
+/*
+ * Call NSM/NOTIFY
+ * Call the NOTIFY procedure for the NSM protocol
+ *
+ * Function returns
+ * 0 : The call was initiated. The callback will be invoked when the call completes.
+ * <0 : An error occured when trying to set up the call. 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 nsm daemon.
+ * data is NULL
+ * RPC_STATUS_ERROR : An error occured when trying to contact the nsm daemon.
+ * data is the error string.
+ * RPC_STATUS_CANCEL : The connection attempt was aborted before it could complete.
+ * data is NULL.
+ */
+struct NSM1_NOTIFYargs;
+int rpc_nsm1_notify_async(struct rpc_context *rpc, rpc_cb cb, struct NSM1_NOTIFYargs *args, void *private_data);
#endif
#include "libnfs-raw-nsm.h"
bool_t
-zdr_nsm_name (ZDR *zdrs, nsm_name *objp)
+zdr_nsmstat1 (ZDR *zdrs, nsmstat1 *objp)
{
register int32_t *buf;
buf = NULL;
- if (!zdr_string (zdrs, &objp->mon_name, NSM_MAXSTRLEN))
+ if (!zdr_enum (zdrs, (enum_t *) objp))
return FALSE;
return TRUE;
}
bool_t
-zdr_nsmstat1 (ZDR *zdrs, nsmstat1 *objp)
+zdr_nsm_my_id (ZDR *zdrs, nsm_my_id *objp)
{
register int32_t *buf;
buf = NULL;
- if (!zdr_enum (zdrs, (enum_t *) objp))
+ if (!zdr_string (zdrs, &objp->my_name, NSM_MAXSTRLEN))
+ return FALSE;
+ if (!zdr_int (zdrs, &objp->my_prog))
+ return FALSE;
+ if (!zdr_int (zdrs, &objp->my_vers))
+ return FALSE;
+ if (!zdr_int (zdrs, &objp->my_proc))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_nsm_mon_id (ZDR *zdrs, nsm_mon_id *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_string (zdrs, &objp->mon_name, NSM_MAXSTRLEN))
+ return FALSE;
+ if (!zdr_nsm_my_id (zdrs, &objp->my_id))
return FALSE;
return TRUE;
}
bool_t
-zdr_nsm_stat_res (ZDR *zdrs, nsm_stat_res *objp)
+zdr_NSM1_STATres (ZDR *zdrs, NSM1_STATres *objp)
{
register int32_t *buf;
buf = NULL;
}
bool_t
-zdr_nsm_stat (ZDR *zdrs, nsm_stat *objp)
+zdr_NSM1_STATargs (ZDR *zdrs, NSM1_STATargs *objp)
{
register int32_t *buf;
buf = NULL;
- if (!zdr_int (zdrs, &objp->state))
+ if (!zdr_string (zdrs, &objp->mon_name, NSM_MAXSTRLEN))
return FALSE;
return TRUE;
}
bool_t
-zdr_nsm_my_id (ZDR *zdrs, nsm_my_id *objp)
+zdr_NSM1_MONres (ZDR *zdrs, NSM1_MONres *objp)
{
register int32_t *buf;
buf = NULL;
- if (!zdr_string (zdrs, &objp->my_name, NSM_MAXSTRLEN))
+ if (!zdr_nsmstat1 (zdrs, &objp->res))
return FALSE;
- if (!zdr_int (zdrs, &objp->my_prog))
+ if (!zdr_int (zdrs, &objp->state))
return FALSE;
- if (!zdr_int (zdrs, &objp->my_vers))
+ return TRUE;
+}
+
+bool_t
+zdr_NSM1_MONargs (ZDR *zdrs, NSM1_MONargs *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ int i;
+ if (!zdr_nsm_mon_id (zdrs, &objp->mon_id))
return FALSE;
- if (!zdr_int (zdrs, &objp->my_proc))
+ if (!zdr_opaque (zdrs, objp->priv, 16))
return FALSE;
return TRUE;
}
bool_t
-zdr_nsm_mon_id (ZDR *zdrs, nsm_mon_id *objp)
+zdr_NSM1_UNMONres (ZDR *zdrs, NSM1_UNMONres *objp)
{
register int32_t *buf;
buf = NULL;
- if (!zdr_string (zdrs, &objp->mon_name, NSM_MAXSTRLEN))
- return FALSE;
- if (!zdr_nsm_my_id (zdrs, &objp->my_id))
+ if (!zdr_int (zdrs, &objp->state))
return FALSE;
return TRUE;
}
bool_t
-zdr_nsm_mon (ZDR *zdrs, nsm_mon *objp)
+zdr_NSM1_UNMONargs (ZDR *zdrs, NSM1_UNMONargs *objp)
{
register int32_t *buf;
buf = NULL;
- int i;
if (!zdr_nsm_mon_id (zdrs, &objp->mon_id))
return FALSE;
- if (!zdr_opaque (zdrs, objp->priv, 16))
+ return TRUE;
+}
+
+bool_t
+zdr_NSM1_UNMONALLres (ZDR *zdrs, NSM1_UNMONALLres *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_int (zdrs, &objp->state))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+zdr_NSM1_UNMONALLargs (ZDR *zdrs, NSM1_UNMONALLargs *objp)
+{
+ register int32_t *buf;
+ buf = NULL;
+
+ if (!zdr_nsm_my_id (zdrs, &objp->my_id))
return FALSE;
return TRUE;
}
bool_t
-zdr_nsm_stat_chg (ZDR *zdrs, nsm_stat_chg *objp)
+zdr_NSM1_NOTIFYargs (ZDR *zdrs, NSM1_NOTIFYargs *objp)
{
register int32_t *buf;
buf = NULL;
#define NSM_MAXSTRLEN 1024
-struct nsm_name {
- char *mon_name;
-};
-typedef struct nsm_name nsm_name;
-
enum nsmstat1 {
NSM_STAT_SUCC = 0,
NSM_STAT_FAIL = 1,
};
typedef enum nsmstat1 nsmstat1;
-struct nsm_stat_res {
- nsmstat1 res;
- int state;
-};
-typedef struct nsm_stat_res nsm_stat_res;
-
-struct nsm_stat {
- int state;
-};
-typedef struct nsm_stat nsm_stat;
-
struct nsm_my_id {
char *my_name;
int my_prog;
};
typedef struct nsm_mon_id nsm_mon_id;
-struct nsm_mon {
+struct NSM1_STATres {
+ nsmstat1 res;
+ int state;
+};
+typedef struct NSM1_STATres NSM1_STATres;
+
+struct NSM1_STATargs {
+ char *mon_name;
+};
+typedef struct NSM1_STATargs NSM1_STATargs;
+
+struct NSM1_MONres {
+ nsmstat1 res;
+ int state;
+};
+typedef struct NSM1_MONres NSM1_MONres;
+
+struct NSM1_MONargs {
struct nsm_mon_id mon_id;
char priv[16];
};
-typedef struct nsm_mon nsm_mon;
+typedef struct NSM1_MONargs NSM1_MONargs;
+
+struct NSM1_UNMONres {
+ int state;
+};
+typedef struct NSM1_UNMONres NSM1_UNMONres;
+
+struct NSM1_UNMONargs {
+ struct nsm_mon_id mon_id;
+};
+typedef struct NSM1_UNMONargs NSM1_UNMONargs;
+
+struct NSM1_UNMONALLres {
+ int state;
+};
+typedef struct NSM1_UNMONALLres NSM1_UNMONALLres;
+
+struct NSM1_UNMONALLargs {
+ struct nsm_my_id my_id;
+};
+typedef struct NSM1_UNMONALLargs NSM1_UNMONALLargs;
-struct nsm_stat_chg {
+struct NSM1_NOTIFYargs {
char *mon_name;
int state;
};
-typedef struct nsm_stat_chg nsm_stat_chg;
+typedef struct NSM1_NOTIFYargs NSM1_NOTIFYargs;
#define NSM_PROGRAM 100024
#define NSM_V1 1
extern void * nsm1_null_1(void *, CLIENT *);
extern void * nsm1_null_1_svc(void *, struct svc_req *);
#define NSM1_STAT 1
-extern struct nsm_stat_res * nsm1_stat_1(struct nsm_name *, CLIENT *);
-extern struct nsm_stat_res * nsm1_stat_1_svc(struct nsm_name *, struct svc_req *);
+extern struct NSM1_STATres * nsm1_stat_1(struct NSM1_STATargs *, CLIENT *);
+extern struct NSM1_STATres * nsm1_stat_1_svc(struct NSM1_STATargs *, struct svc_req *);
#define NSM1_MON 2
-extern struct nsm_stat_res * nsm1_mon_1(struct nsm_mon *, CLIENT *);
-extern struct nsm_stat_res * nsm1_mon_1_svc(struct nsm_mon *, struct svc_req *);
+extern struct NSM1_MONres * nsm1_mon_1(struct NSM1_MONargs *, CLIENT *);
+extern struct NSM1_MONres * nsm1_mon_1_svc(struct NSM1_MONargs *, struct svc_req *);
#define NSM1_UNMON 3
-extern struct nsm_stat * nsm1_unmon_1(struct nsm_mon_id *, CLIENT *);
-extern struct nsm_stat * nsm1_unmon_1_svc(struct nsm_mon_id *, struct svc_req *);
+extern struct NSM1_UNMONres * nsm1_unmon_1(struct NSM1_UNMONargs *, CLIENT *);
+extern struct NSM1_UNMONres * nsm1_unmon_1_svc(struct NSM1_UNMONargs *, struct svc_req *);
#define NSM1_UNMON_ALL 4
-extern struct nsm_stat * nsm1_unmon_all_1(struct nsm_my_id *, CLIENT *);
-extern struct nsm_stat * nsm1_unmon_all_1_svc(struct nsm_my_id *, struct svc_req *);
+extern struct NSM1_UNMONALLres * nsm1_unmon_all_1(struct NSM1_UNMONALLargs *, CLIENT *);
+extern struct NSM1_UNMONALLres * nsm1_unmon_all_1_svc(struct NSM1_UNMONALLargs *, struct svc_req *);
#define NSM1_SIMU_CRASH 5
extern void * nsm1_simu_crash_1(void *, CLIENT *);
extern void * nsm1_simu_crash_1_svc(void *, struct svc_req *);
#define NSM1_NOTIFY 6
-extern void * nsm1_notify_1(struct nsm_stat_chg *, CLIENT *);
-extern void * nsm1_notify_1_svc(struct nsm_stat_chg *, struct svc_req *);
+extern void * nsm1_notify_1(struct NSM1_NOTIFYargs *, CLIENT *);
+extern void * nsm1_notify_1_svc(struct NSM1_NOTIFYargs *, struct svc_req *);
extern int nsm_program_1_freeresult (SVCXPRT *, zdrproc_t, caddr_t);
#else /* K&R C */
extern void * nsm1_null_1();
extern void * nsm1_null_1_svc();
#define NSM1_STAT 1
-extern struct nsm_stat_res * nsm1_stat_1();
-extern struct nsm_stat_res * nsm1_stat_1_svc();
+extern struct NSM1_STATres * nsm1_stat_1();
+extern struct NSM1_STATres * nsm1_stat_1_svc();
#define NSM1_MON 2
-extern struct nsm_stat_res * nsm1_mon_1();
-extern struct nsm_stat_res * nsm1_mon_1_svc();
+extern struct NSM1_MONres * nsm1_mon_1();
+extern struct NSM1_MONres * nsm1_mon_1_svc();
#define NSM1_UNMON 3
-extern struct nsm_stat * nsm1_unmon_1();
-extern struct nsm_stat * nsm1_unmon_1_svc();
+extern struct NSM1_UNMONres * nsm1_unmon_1();
+extern struct NSM1_UNMONres * nsm1_unmon_1_svc();
#define NSM1_UNMON_ALL 4
-extern struct nsm_stat * nsm1_unmon_all_1();
-extern struct nsm_stat * nsm1_unmon_all_1_svc();
+extern struct NSM1_UNMONALLres * nsm1_unmon_all_1();
+extern struct NSM1_UNMONALLres * nsm1_unmon_all_1_svc();
#define NSM1_SIMU_CRASH 5
extern void * nsm1_simu_crash_1();
extern void * nsm1_simu_crash_1_svc();
/* the zdr functions */
#if defined(__STDC__) || defined(__cplusplus)
-extern bool_t zdr_nsm_name (ZDR *, nsm_name*);
extern bool_t zdr_nsmstat1 (ZDR *, nsmstat1*);
-extern bool_t zdr_nsm_stat_res (ZDR *, nsm_stat_res*);
-extern bool_t zdr_nsm_stat (ZDR *, nsm_stat*);
extern bool_t zdr_nsm_my_id (ZDR *, nsm_my_id*);
extern bool_t zdr_nsm_mon_id (ZDR *, nsm_mon_id*);
-extern bool_t zdr_nsm_mon (ZDR *, nsm_mon*);
-extern bool_t zdr_nsm_stat_chg (ZDR *, nsm_stat_chg*);
+extern bool_t zdr_NSM1_STATres (ZDR *, NSM1_STATres*);
+extern bool_t zdr_NSM1_STATargs (ZDR *, NSM1_STATargs*);
+extern bool_t zdr_NSM1_MONres (ZDR *, NSM1_MONres*);
+extern bool_t zdr_NSM1_MONargs (ZDR *, NSM1_MONargs*);
+extern bool_t zdr_NSM1_UNMONres (ZDR *, NSM1_UNMONres*);
+extern bool_t zdr_NSM1_UNMONargs (ZDR *, NSM1_UNMONargs*);
+extern bool_t zdr_NSM1_UNMONALLres (ZDR *, NSM1_UNMONALLres*);
+extern bool_t zdr_NSM1_UNMONALLargs (ZDR *, NSM1_UNMONALLargs*);
+extern bool_t zdr_NSM1_NOTIFYargs (ZDR *, NSM1_NOTIFYargs*);
#else /* K&R C */
-extern bool_t zdr_nsm_name ();
extern bool_t zdr_nsmstat1 ();
-extern bool_t zdr_nsm_stat_res ();
-extern bool_t zdr_nsm_stat ();
extern bool_t zdr_nsm_my_id ();
extern bool_t zdr_nsm_mon_id ();
-extern bool_t zdr_nsm_mon ();
-extern bool_t zdr_nsm_stat_chg ();
+extern bool_t zdr_NSM1_STATres ();
+extern bool_t zdr_NSM1_STATargs ();
+extern bool_t zdr_NSM1_MONres ();
+extern bool_t zdr_NSM1_MONargs ();
+extern bool_t zdr_NSM1_UNMONres ();
+extern bool_t zdr_NSM1_UNMONargs ();
+extern bool_t zdr_NSM1_UNMONALLres ();
+extern bool_t zdr_NSM1_UNMONALLargs ();
+extern bool_t zdr_NSM1_NOTIFYargs ();
#endif /* K&R C */
return 0;
}
+int rpc_nsm1_stat_async(struct rpc_context *rpc, rpc_cb cb, struct NSM1_STATargs *args, void *private_data)
+{
+ struct rpc_pdu *pdu;
+
+ pdu = rpc_allocate_pdu(rpc, NSM_PROGRAM, NSM_V1, NSM1_STAT, cb, private_data, (zdrproc_t)zdr_NSM1_STATres, sizeof(NSM1_STATres));
+ if (pdu == NULL) {
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nsm/stat call");
+ return -1;
+ }
+
+ if (zdr_NSM1_STATargs(&pdu->zdr, args) == 0) {
+ rpc_set_error(rpc, "ZDR error: Failed to encode NSM1_STATargs");
+ rpc_free_pdu(rpc, pdu);
+ return -2;
+ }
+
+ if (rpc_queue_pdu(rpc, pdu) != 0) {
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for nsm/stat call");
+ rpc_free_pdu(rpc, pdu);
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_nsm1_mon_async(struct rpc_context *rpc, rpc_cb cb, struct NSM1_MONargs *args, void *private_data)
+{
+ struct rpc_pdu *pdu;
+
+ pdu = rpc_allocate_pdu(rpc, NSM_PROGRAM, NSM_V1, NSM1_MON, cb, private_data, (zdrproc_t)zdr_NSM1_MONres, sizeof(NSM1_MONres));
+ if (pdu == NULL) {
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nsm/mon call");
+ return -1;
+ }
+
+ if (zdr_NSM1_MONargs(&pdu->zdr, args) == 0) {
+ rpc_set_error(rpc, "ZDR error: Failed to encode NSM1_MONargs");
+ rpc_free_pdu(rpc, pdu);
+ return -2;
+ }
+
+ if (rpc_queue_pdu(rpc, pdu) != 0) {
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for nsm/mon call");
+ rpc_free_pdu(rpc, pdu);
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_nsm1_unmon_async(struct rpc_context *rpc, rpc_cb cb, struct NSM1_UNMONargs *args, void *private_data)
+{
+ struct rpc_pdu *pdu;
+
+ pdu = rpc_allocate_pdu(rpc, NSM_PROGRAM, NSM_V1, NSM1_UNMON, cb, private_data, (zdrproc_t)zdr_NSM1_UNMONres, sizeof(NSM1_UNMONres));
+ if (pdu == NULL) {
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nsm/unmon call");
+ return -1;
+ }
+
+ if (zdr_NSM1_UNMONargs(&pdu->zdr, args) == 0) {
+ rpc_set_error(rpc, "ZDR error: Failed to encode NSM1_UNMONargs");
+ rpc_free_pdu(rpc, pdu);
+ return -2;
+ }
+
+ if (rpc_queue_pdu(rpc, pdu) != 0) {
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for nsm/unmon call");
+ rpc_free_pdu(rpc, pdu);
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_nsm1_unmonall_async(struct rpc_context *rpc, rpc_cb cb, struct NSM1_UNMONALLargs *args, void *private_data)
+{
+ struct rpc_pdu *pdu;
+
+ pdu = rpc_allocate_pdu(rpc, NSM_PROGRAM, NSM_V1, NSM1_UNMON_ALL, cb, private_data, (zdrproc_t)zdr_NSM1_UNMONALLres, sizeof(NSM1_UNMONALLres));
+ if (pdu == NULL) {
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nsm/unmonall call");
+ return -1;
+ }
+
+ if (zdr_NSM1_UNMONALLargs(&pdu->zdr, args) == 0) {
+ rpc_set_error(rpc, "ZDR error: Failed to encode NSM1_UNMONALLargs");
+ rpc_free_pdu(rpc, pdu);
+ return -2;
+ }
+
+ if (rpc_queue_pdu(rpc, pdu) != 0) {
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for nsm/unmonall call");
+ rpc_free_pdu(rpc, pdu);
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_nsm1_simucrash_async(struct rpc_context *rpc, rpc_cb cb, void *private_data)
+{
+ struct rpc_pdu *pdu;
+
+ pdu = rpc_allocate_pdu(rpc, NSM_PROGRAM, NSM_V1, NSM1_SIMU_CRASH, cb, private_data, (zdrproc_t)zdr_void, 0);
+ if (pdu == NULL) {
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nsm/simucrash call");
+ return -1;
+ }
+
+ if (rpc_queue_pdu(rpc, pdu) != 0) {
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for nsm/simucrash call");
+ rpc_free_pdu(rpc, pdu);
+ return -1;
+ }
+
+ return 0;
+}
+
+int rpc_nsm1_notify_async(struct rpc_context *rpc, rpc_cb cb, struct NSM1_NOTIFYargs *args, void *private_data)
+{
+ struct rpc_pdu *pdu;
+
+ pdu = rpc_allocate_pdu(rpc, NSM_PROGRAM, NSM_V1, NSM1_NOTIFY, cb, private_data, (zdrproc_t)zdr_void, 0);
+ if (pdu == NULL) {
+ rpc_set_error(rpc, "Out of memory. Failed to allocate pdu for nsm/notify call");
+ return -1;
+ }
+
+ if (zdr_NSM1_NOTIFYargs(&pdu->zdr, args) == 0) {
+ rpc_set_error(rpc, "ZDR error: Failed to encode NSM1_NOTIFYargs");
+ rpc_free_pdu(rpc, pdu);
+ return -2;
+ }
+
+ if (rpc_queue_pdu(rpc, pdu) != 0) {
+ rpc_set_error(rpc, "Out of memory. Failed to queue pdu for nsm/notify call");
+ rpc_free_pdu(rpc, pdu);
+ return -1;
+ }
+
+ return 0;
+}
+
char *nsmstat1_to_str(int st)
{
enum nsmstat1 stat = st;
*/
const NSM_MAXSTRLEN = 1024;
-struct nsm_name {
- string mon_name<NSM_MAXSTRLEN>;
-};
-
enum nsmstat1 {
NSM_STAT_SUCC = 0, /* NSM agrees to monitor. */
NSM_STAT_FAIL = 1 /* NSM cannot monitor. */
};
-struct nsm_stat_res {
- nsmstat1 res;
- int state;
-};
-
-struct nsm_stat {
- int state; /* state number of NSM */
-};
-
struct nsm_my_id {
string my_name<NSM_MAXSTRLEN>; /* hostname */
int my_prog; /* RPC program number */
struct nsm_my_id my_id;
};
-struct nsm_mon {
+struct NSM1_STATres {
+ nsmstat1 res;
+ int state;
+};
+
+struct NSM1_STATargs {
+ string mon_name<NSM_MAXSTRLEN>;
+};
+
+struct NSM1_MONres {
+ nsmstat1 res;
+ int state;
+};
+
+struct NSM1_MONargs {
struct nsm_mon_id mon_id;
opaque priv[16]; /* private information */
};
-struct nsm_stat_chg {
+struct NSM1_UNMONres {
+ int state; /* state number of NSM */
+};
+
+struct NSM1_UNMONargs {
+ struct nsm_mon_id mon_id;
+};
+
+struct NSM1_UNMONALLres {
+ int state; /* state number of NSM */
+};
+
+struct NSM1_UNMONALLargs {
+ struct nsm_my_id my_id;
+};
+
+struct NSM1_NOTIFYargs {
string mon_name<NSM_MAXSTRLEN>;
int state;
};
program NSM_PROGRAM {
version NSM_V1 {
void NSM1_NULL(void) = 0;
- struct nsm_stat_res NSM1_STAT(struct nsm_name) = 1;
- struct nsm_stat_res NSM1_MON(struct nsm_mon) = 2;
- struct nsm_stat NSM1_UNMON(struct nsm_mon_id) = 3;
- struct nsm_stat NSM1_UNMON_ALL(struct nsm_my_id) = 4;
+ struct NSM1_STATres NSM1_STAT(struct NSM1_STATargs) = 1;
+ struct NSM1_MONres NSM1_MON(struct NSM1_MONargs) = 2;
+ struct NSM1_UNMONres NSM1_UNMON(struct NSM1_UNMONargs) = 3;
+ struct NSM1_UNMONALLres NSM1_UNMON_ALL(struct NSM1_UNMONALLargs) = 4;
void NSM1_SIMU_CRASH(void) = 5;
- void NSM1_NOTIFY(struct nsm_stat_chg) = 6;
+ void NSM1_NOTIFY(struct NSM1_NOTIFYargs) = 6;
} = 1;
} = 100024;