Module: sip-router
Branch: andrei/rpc_async
Commit: e256ce91db53172264a6e42cfd5040b30dada526
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=e256ce9…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Thu Jul 30 15:40:42 2009 +0200
core: rpc capabilities and delayed reply api
- added a new rpc function for interrogating the current rpc
transport capabilities (for now the only extra capability is
RPC_DELAYED_REPLY).
- added a new special delayed reply rpc context and rpc functions hooks for
creating and closing it.
---
rpc.h | 25 ++++++++++++++++++++++++-
1 files changed, 24 insertions(+), 1 deletions(-)
diff --git a/rpc.h b/rpc.h
index 18e767e..1434146 100644
--- a/rpc.h
+++ b/rpc.h
@@ -37,7 +37,13 @@ enum rpc_flags {
RET_ARRAY = (1 << 0),
RET_VALUE = (1 << 1)
};
-
+
+typedef enum rpc_capabilities {
+ RPC_DELAYED_REPLY = (1 <<0) /* delayed reply support */
+} rpc_capabilities_t;
+
+struct rpc_delayed_ctx;
+
/* Send the result to the caller */
typedef int (*rpc_send_f)(void* ctx); /* Send the
reply to the client */
@@ -49,6 +55,13 @@ typedef int (*rpc_struct_add_f)(void* ctx, char* fmt, ...);
/* Cr
typedef int (*rpc_struct_scan_f)(void* ctx, char* fmt, ...); /* Scan
attributes of a structure */
typedef int (*rpc_struct_printf_f)(void* ctx, char* name, char* fmt, ...); /* Struct
version of rpc_printf */
+/* returns the supported capabilities */
+typedef rpc_capabilities_t (*rpc_capabilities_f)(void* ctx);
+/* create a special "context" for delayed replies */
+typedef struct rpc_delayed_ctx* (*rpc_delayed_ctx_new_f)(void* ctx);
+/* close the special "context" for delayed replies */
+typedef void (*rpc_delayed_ctx_close_f)(struct rpc_delayed_ctx* dctx);
+
/*
* RPC context, this is what RPC functions get as a parameter and use
* it to obtain the value of the parameters of the call and reference
@@ -63,9 +76,19 @@ typedef struct rpc {
rpc_struct_add_f struct_add;
rpc_struct_scan_f struct_scan;
rpc_struct_printf_f struct_printf;
+ rpc_capabilities_f capabilities;
+ rpc_delayed_ctx_new_f delayed_ctx_new;
+ rpc_delayed_ctx_close_f delayed_ctx_close;
} rpc_t;
+typedef struct rpc_delayed_ctx{
+ rpc_t rpc;
+ void* reply_ctx;
+ /* more private data might follow */
+} rpc_delayed_ctx_t;
+
+
/*
* RPC Function Prototype
*/