Lines Matching refs:rpc
58 #include "event2/rpc.h"
95 struct evrpc *rpc;
100 while ((rpc = TAILQ_FIRST(&base->registered_rpcs)) != NULL) {
101 r = evrpc_unregister_rpc(base, rpc->uri);
218 event_err(1, "%s: failed to register rpc at %s",
228 evrpc_register_rpc(struct evrpc_base *base, struct evrpc *rpc,
231 char *constructed_uri = evrpc_construct_uri(rpc->uri);
233 rpc->base = base;
234 rpc->cb = cb;
235 rpc->cb_arg = cb_arg;
237 TAILQ_INSERT_TAIL(&base->registered_rpcs, rpc, next);
242 rpc);
253 struct evrpc *rpc;
256 /* find the right rpc; linear search might be slow */
257 TAILQ_FOREACH(rpc, &base->registered_rpcs, next) {
258 if (strcmp(rpc->uri, name) == 0)
261 if (rpc == NULL) {
265 TAILQ_REMOVE(&base->registered_rpcs, rpc, next);
275 mm_free((char *)rpc->uri);
276 mm_free(rpc);
287 struct evrpc *rpc = arg;
298 rpc_state->rpc = rpc;
302 if (TAILQ_FIRST(&rpc->base->input_hooks) != NULL) {
310 hook_res = evrpc_process_hooks(&rpc->base->input_hooks,
316 evrpc_pause_request(rpc->base, rpc_state,
341 struct evrpc *rpc;
345 rpc = rpc_state->rpc;
352 rpc_state->request = rpc->request_new(rpc->request_new_arg);
356 if (rpc->request_unmarshal(
364 rpc_state->reply = rpc->reply_new(rpc->reply_new_arg);
368 /* give the rpc to the user; they can deal with it */
369 rpc->cb(rpc_state, rpc->cb_arg);
383 struct evrpc *rpc;
385 rpc = rpc_state->rpc;
391 rpc->request_free(rpc_state->request);
393 rpc->reply_free(rpc_state->reply);
406 struct evrpc *rpc;
411 rpc = rpc_state->rpc;
413 if (rpc->reply_complete(rpc_state->reply) == -1) {
424 rpc->reply_marshal(rpc_state->rpc_data, rpc_state->reply);
426 if (TAILQ_FIRST(&rpc->base->output_hooks) != NULL) {
432 hook_res = evrpc_process_hooks(&rpc->base->output_hooks,
438 if (evrpc_pause_request(rpc->base, rpc_state,
736 * a timeout after which the whole rpc is going to be aborted.
803 /* initialize the event structure for this rpc */
811 * the next time a connection is empty, the rpc will be send on that.
1111 struct evrpc* rpc = (struct evrpc *)mm_calloc(1, sizeof(struct evrpc));
1112 if (rpc == NULL)
1114 rpc->uri = mm_strdup(name);
1115 if (rpc->uri == NULL) {
1116 mm_free(rpc);
1119 rpc->request_new = req_new;
1120 rpc->request_new_arg = req_new_arg;
1121 rpc->request_free = req_free;
1122 rpc->request_unmarshal = req_unmarshal;
1123 rpc->reply_new = rpl_new;
1124 rpc->reply_new_arg = rpl_new_arg;
1125 rpc->reply_free = rpl_free;
1126 rpc->reply_complete = rpl_complete;
1127 rpc->reply_marshal = rpl_marshal;
1128 return (rpc);
1140 struct evrpc* rpc =
1143 if (rpc == NULL)
1145 evrpc_register_rpc(base, rpc,