Lines Matching +full:rpc +full:- +full:if
2 * Copyright (c) 2006-2007 Niels Provos <provos@citi.umich.edu>
3 * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 /** @file rpc.h
40 * This header files provides basic support for an RPC server and client.
42 * To support RPCs in a server, every supported RPC command needs to be
47 * SendCommand is the name of the RPC command.
49 * It contains all parameters relating to the SendCommand RPC. The
52 * contains the answer to the RPC.
54 * To register an RPC with an HTTP server, you need to first create an RPC
59 * A specific RPC can then be registered with
63 * when the server receives an appropriately formatted RPC, the user callback
66 * void FunctionCB(EVRPC_STRUCT(SendCommand)* rpc, void *arg);
68 * To send the reply, call EVRPC_REQUEST_DONE(rpc);
74 Determines if the member has been set in the message
78 @return 1 if it's present or 0 otherwise.
81 ((msg)->member##_set == 1)
93 (*(msg)->base->member##_assign)((msg), (value))
103 (*(msg)->base->member##_assign)((msg), (value), (len))
110 @return 0 on success, -1 otherwise.
113 (*(msg)->base->member##_get)((msg), (pvalue))
121 @return 0 on success, -1 otherwise.
124 (*(msg)->base->member##_get)((msg), (pvalue), (plen))
132 (*(msg)->base->member##_add)((msg), (value))
137 (*(msg)->base->member##_add)(msg)
142 (*(msg)->base->member##_get)((msg), (offset), (pvalue))
146 #define EVTAG_ARRAY_LEN(msg, member) ((msg)->member##_length)
155 /** The type of a specific RPC Message
157 * @param rpcname the name of the RPC message
165 /** Creates the definitions and prototypes for an RPC
169 * defined in an .rpc file and converted to source code via event_rpcgen.py
171 * @param rpcname the name of the RPC
172 * @param reqstruct the name of the RPC request structure
173 * @param replystruct the name of the RPC reply structure
181 struct evrpc* rpc; \
205 /** Creates a context structure that contains rpc specific information.
207 * EVRPC_MAKE_CTX is used to populate a RPC specific context that
208 * contains information about marshaling the RPC data types.
210 * @param rpcname the name of the RPC
211 * @param reqstruct the name of the RPC request structure
212 * @param replystruct the name of the RPC reply structure
214 * @param request a pointer to the RPC request structure object
215 * @param reply a pointer to the RPC reply structure object
216 * @param cb the callback function to call when the RPC has completed
229 /** Generates the code for receiving and sending an RPC message
232 * and receiving a particular RPC message
234 * @param rpcname the name of the RPC
235 * @param reqstruct the name of the RPC request structure
236 * @param replystruct the name of the RPC reply structure
254 /** Provides access to the HTTP request object underlying an RPC
259 * @param rpc_req the rpc request structure provided to the server callback
263 #define EVRPC_REQUEST_HTTP(rpc_req) (rpc_req)->http_req
265 /** completes the server response to an rpc request */
275 /** Creates the reply to an RPC request
281 * @param rpc_req the rpc request structure provided to the server callback
292 /* functions to start up the rpc system */
294 /** Creates a new rpc base from which RPC requests can be received
297 * @return a newly allocated evrpc_base struct or NULL if an error occurred
316 * registers a new RPC with the HTTP server, each RPC needs to have
319 * @param base the evrpc_base structure in which the RPC should be
321 * @param name the name of the RPC
322 * @param request the name of the RPC request structure
323 * @param reply the name of the RPC reply structure
324 * @param callback the callback that should be invoked when the RPC
326 * void (*callback)(EVRPC_STRUCT(Message)* rpc, void *arg)
342 Low level function for registering an RPC with a server.
353 * Unregisters an already registered RPC
355 * @param base the evrpc_base object from which to unregister an RPC
356 * @param name the name of the rpc to unregister
357 * @return -1 on error or 0 when successful.
366 * Client-side RPC support
372 /** launches an RPC and sends it to the server
374 * EVRPC_MAKE_REQUEST() is used by the client to send an RPC to the server.
376 * @param name the name of the RPC
379 * @param request a pointer to the RPC request structure - it contains the
381 * @param reply a pointer to the RPC reply structure. It is going to be filled
382 * if the request was answered successfully
383 * @param cb the callback to invoke when the RPC request has been answered
385 * @return 0 on success, -1 on failure
391 Makes an RPC request based on the provided context.
393 This is a low-level function and should not be used directly
398 @returns 0 on success, -1 otherwise.
404 /** creates an rpc connection pool
407 * rpc requests are always made via a pool.
410 * in singled-threaded applications
411 * @return a newly allocated struct evrpc_pool object or NULL if an error
417 /** frees an rpc connection pool
426 * Adds a connection over which rpc can be dispatched to the pool.
451 * RPC is completely aborted if it does not complete by then. Setting
457 * called receive the pool timeout only if no timeout has been set
491 EVRPC_TERMINATE = -1, /**< indicates the rpc should be terminated */
492 EVRPC_CONTINUE = 0, /**< continue processing the rpc */
496 /** adds a processing hook to either an rpc base or rpc pool
498 * If a hook returns TERMINATE, the processing is aborted. On CONTINUE,
499 * the request is immediately processed after the hook returns. If the
546 * @param key a NUL-terminated c-string
559 * @param key a NUL-terminated c-string
562 * @return 0 on success or -1 on failure
572 * @return a pointer to the evhttp_connection object or NULL if an error
579 Function for sending a generic RPC request.
596 Function for registering a generic RPC with the RPC base.