From: Shuo Chen Date: Wed, 14 Apr 2010 18:23:03 +0000 (-0400) Subject: Expose the request and reply members of rpc_req_generic() X-Git-Tag: release-2.0.5-beta~51 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=07edf784fab4e25c31eef3fdcccec3975e2741db;p=libevent Expose the request and reply members of rpc_req_generic() This code adds two accessor functions to evprc, and helps integrate evrpc with Google protocol buffers. (Code by Shuo Chen; commit message by nickm) --- diff --git a/evrpc.c b/evrpc.c index 3b7bd029..b5e4ca8c 100644 --- 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) { diff --git a/include/event2/rpc.h b/include/event2/rpc.h index b19b36bc..c11e77ca 100644 --- a/include/event2/rpc.h +++ b/include/event2/rpc.h @@ -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