]> granicus.if.org Git - libevent/commitdiff
Expose the request and reply members of rpc_req_generic()
authorShuo Chen <giantchen@gmail.com>
Wed, 14 Apr 2010 18:23:03 +0000 (14:23 -0400)
committerNick Mathewson <nickm@torproject.org>
Wed, 14 Apr 2010 18:23:03 +0000 (14:23 -0400)
This code adds two accessor functions to evprc, and helps integrate
evrpc with Google protocol buffers.

(Code by Shuo Chen; commit message by nickm)

evrpc.c
include/event2/rpc.h

diff --git a/evrpc.c b/evrpc.c
index 3b7bd029de8e67b7595ae8ea19a4231b4e905e8b..b5e4ca8cdadd9659647680c600fce30386447719 100644 (file)
--- a/evrpc.c
+++ b/evrpc.c
@@ -444,6 +444,18 @@ error:
        return;
 }
 
+void *
+evrpc_get_request(struct evrpc_req_generic *req)
+{
+       return req->request;
+}
+
+void *
+evrpc_get_reply(struct evrpc_req_generic *req)
+{
+       return req->reply;
+}
+
 static void
 evrpc_request_done_closure(void *arg, enum EVRPC_HOOK_RESULT hook_res)
 {
index b19b36bc69afed3b5c20a1b9b99858cc271c0ccb..c11e77ca88d8d3fa847f84454fbaf16e51960621 100644 (file)
@@ -259,6 +259,10 @@ struct evrpc_request_wrapper *evrpc_make_request_ctx(
 /** completes the server response to an rpc request */
 void evrpc_request_done(struct evrpc_req_generic *req);
 
+/** accessors for request and reply */
+void *evrpc_get_request(struct evrpc_req_generic *req);
+void *evrpc_get_reply(struct evrpc_req_generic *req);
+
 /** Creates the reply to an RPC request
  *
  * EVRPC_REQUEST_DONE is used to answer a request; the reply is expected