summaryrefslogtreecommitdiffstats
path: root/rpc/rpc-lib/src/rpc-clnt.h
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2010-08-27 06:45:38 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-08-27 05:53:56 -0700
commit8071909e84b6a479a6b5be1eddd15e8b16fc1a80 (patch)
treedb3a56cef557a3c86fd983e778927c70a8665363 /rpc/rpc-lib/src/rpc-clnt.h
parentfd282c4299a5354aa272345e312ac600d9dcc680 (diff)
rpc: server to client callback mechanism
Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
Diffstat (limited to 'rpc/rpc-lib/src/rpc-clnt.h')
-rw-r--r--rpc/rpc-lib/src/rpc-clnt.h43
1 files changed, 42 insertions, 1 deletions
diff --git a/rpc/rpc-lib/src/rpc-clnt.h b/rpc/rpc-lib/src/rpc-clnt.h
index 2381aaa08..a0251c7c5 100644
--- a/rpc/rpc-lib/src/rpc-clnt.h
+++ b/rpc/rpc-lib/src/rpc-clnt.h
@@ -83,6 +83,38 @@ typedef struct rpc_clnt_program {
int numproc;
} rpc_clnt_prog_t;
+typedef int (*rpcclnt_cb_fn) (void *data);
+
+/* The descriptor for each procedure/actor that runs
+ * over the RPC service.
+ */
+typedef struct rpcclnt_actor_desc {
+ char procname[32];
+ int procnum;
+ rpcclnt_cb_fn actor;
+} rpcclnt_cb_actor_t;
+
+/* Describes a program and its version along with the function pointers
+ * required to handle the procedures/actors of each program/version.
+ * Never changed ever by any thread so no need for a lock.
+ */
+typedef struct rpcclnt_cb_program {
+ char progname[32];
+ int prognum;
+ int progver;
+ rpcclnt_cb_actor_t *actors; /* All procedure handlers */
+ int numactors; /* Num actors in actor array */
+
+ /* Program specific state handed to actors */
+ void *private;
+
+
+ /* list member to link to list of registered services with rpc_clnt */
+ struct list_head program;
+} rpcclnt_cb_program_t;
+
+
+
#define RPC_MAX_AUTH_BYTES 400
typedef struct rpc_auth_data {
int flavour;
@@ -141,6 +173,9 @@ struct rpc_clnt {
void *mydata;
uint64_t xid;
+ /* list of cb programs registered with rpc-clnt */
+ struct list_head programs;
+
/* Memory pool for rpc_req_t */
struct mem_pool *reqpool;
@@ -171,7 +206,7 @@ int rpc_clnt_register_notify (struct rpc_clnt *rpc, rpc_clnt_notify_t fn,
* also be filled with pointer to buffer to hold header and length
* of the header.
*/
-
+
int rpc_clnt_submit (struct rpc_clnt *rpc, rpc_clnt_prog_t *prog,
int procnum, fop_cbk_fn_t cbkfn,
struct iovec *proghdr, int proghdrcount,
@@ -190,4 +225,10 @@ void rpc_clnt_reconnect (void *trans_ptr);
void rpc_clnt_reconfig (struct rpc_clnt *rpc, struct rpc_clnt_config *config);
+/* All users of RPC services should use this API to register their
+ * procedure handlers.
+ */
+int rpcclnt_cbk_program_register (struct rpc_clnt *svc,
+ rpcclnt_cb_program_t *program);
+
#endif /* !_RPC_CLNT_H */