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)
This commit is contained in:
Shuo Chen 2010-04-14 14:23:03 -04:00 committed by Nick Mathewson
parent a0983b67f9
commit 07edf784fa
2 changed files with 16 additions and 0 deletions

12
evrpc.c
View File

@ -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)
{

View 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