From 07edf784fab4e25c31eef3fdcccec3975e2741db Mon Sep 17 00:00:00 2001 From: Shuo Chen Date: Wed, 14 Apr 2010 14:23:03 -0400 Subject: [PATCH] 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) --- evrpc.c | 12 ++++++++++++ include/event2/rpc.h | 4 ++++ 2 files changed, 16 insertions(+) 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 -- 2.40.0