Lines Matching +full:port +full:- +full:base

2  * Copyright (c) 2003-2007 Niels Provos <provos@citi.umich.edu>
3 * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
36 #include "event2/event-config.h"
66 #include "log-internal.h"
79 ev_uint16_t port; in http_setup() local
89 event_errx(1, "Couldn't open web port"); in http_setup()
91 port = regress_get_socket_port(evhttp_bound_socket_get_fd(sock)); in http_setup()
93 *pport = port; in http_setup()
109 struct kill* kill_reply = rpc->reply; in MessageCb()
114 req->input_headers, "X-Hook"); in MessageCb()
119 /* we just want to fill in some non-sense */ in MessageCb()
139 ev_uint16_t port; in rpc_setup() local
141 struct evrpc_base *base = NULL; in rpc_setup() local
143 http = http_setup(&port); in rpc_setup()
144 base = evrpc_init(http); in rpc_setup()
146 EVRPC_REGISTER(base, Message, msg, kill, MessageCb, NULL); in rpc_setup()
147 EVRPC_REGISTER(base, NeverReply, msg, kill, NeverReplyCb, NULL); in rpc_setup()
150 *pport = port; in rpc_setup()
151 *pbase = base; in rpc_setup()
158 rpc_teardown(struct evrpc_base *base) in rpc_teardown() argument
160 assert(EVRPC_UNREGISTER(base, Message) == 0); in rpc_teardown()
161 assert(EVRPC_UNREGISTER(base, NeverReply) == 0); in rpc_teardown()
163 evrpc_free(base); in rpc_teardown()
169 if (req->response_code != HTTP_SERVUNAVAIL) { in rpc_postrequest_failure()
186 ev_uint16_t port; in rpc_basic_test() local
188 struct evrpc_base *base = NULL; in rpc_basic_test() local
192 rpc_setup(&http, &port, &base); in rpc_basic_test()
194 evcon = evhttp_connection_new("127.0.0.1", port); in rpc_basic_test()
206 evhttp_add_header(req->output_headers, "Host", "somehost"); in rpc_basic_test()
207 evbuffer_add_printf(req->output_buffer, "Some Nonsense"); in rpc_basic_test()
211 "/.rpc.Message") == -1) { in rpc_basic_test()
221 rpc_teardown(base); in rpc_basic_test()
234 if (req->response_code != HTTP_OK) { in rpc_postrequest_done()
241 if ((kill_unmarshal(kill_reply, req->input_buffer)) == -1) { in rpc_postrequest_done()
255 ev_uint16_t port; in rpc_basic_message() local
257 struct evrpc_base *base = NULL; in rpc_basic_message() local
262 rpc_setup(&http, &port, &base); in rpc_basic_message()
264 evcon = evhttp_connection_new("127.0.0.1", port); in rpc_basic_message()
279 evhttp_add_header(req->output_headers, "Host", "somehost"); in rpc_basic_message()
285 msg_marshal(req->output_buffer, msg); in rpc_basic_message()
290 "/.rpc.Message") == -1) { in rpc_basic_message()
301 rpc_teardown(base); in rpc_basic_message()
308 rpc_pool_with_connection(ev_uint16_t port) in rpc_pool_with_connection() argument
316 evcon = evhttp_connection_new("127.0.0.1", port); in rpc_pool_with_connection()
332 struct evhttp_request *req = status->http_req; in GotKillCb()
334 req->input_headers, "X-Pool-Hook"); in GotKillCb()
339 if (status->error != EVRPC_STATUS_ERR_NONE) in GotKillCb()
342 if (EVTAG_GET(kill, weapon, &weapon) == -1) { in GotKillCb()
346 if (EVTAG_GET(kill, action, &action) == -1) { in GotKillCb()
370 if (status->error != EVRPC_STATUS_ERR_NONE) in GotKillCbTwo()
373 if (EVTAG_GET(kill, weapon, &weapon) == -1) { in GotKillCbTwo()
377 if (EVTAG_GET(kill, action, &action) == -1) { in GotKillCbTwo()
401 evhttp_add_header(req->input_headers, "X-Hook", hook_type); in rpc_hook_add_header()
403 evhttp_add_header(req->output_headers, "X-Hook", hook_type); in rpc_hook_add_header()
425 const char *header = evhttp_find_header(req->input_headers, "X-Hook"); in rpc_hook_remove_header()
432 evhttp_remove_header(req->input_headers, "X-Hook"); in rpc_hook_remove_header()
433 evhttp_add_header(req->input_headers, "X-Pool-Hook", "ran"); in rpc_hook_remove_header()
447 ev_uint16_t port; in rpc_basic_client() local
449 struct evrpc_base *base = NULL; in rpc_basic_client() local
454 rpc_setup(&http, &port, &base); in rpc_basic_client()
459 assert(evrpc_add_hook(base, EVRPC_INPUT, rpc_hook_add_header, (void*)"input") in rpc_basic_client()
461 assert(evrpc_add_hook(base, EVRPC_OUTPUT, rpc_hook_add_header, (void*)"output") in rpc_basic_client()
464 pool = rpc_pool_with_connection(port); in rpc_basic_client()
507 rpc_teardown(base); in rpc_basic_client()
533 ev_uint16_t port; in rpc_basic_queued_client() local
535 struct evrpc_base *base = NULL; in rpc_basic_queued_client() local
540 rpc_setup(&http, &port, &base); in rpc_basic_queued_client()
542 pool = rpc_pool_with_connection(port); in rpc_basic_queued_client()
561 rpc_teardown(base); in rpc_basic_queued_client()
583 if (status->error != EVRPC_STATUS_ERR_TIMEOUT) in GotErrorCb()
610 evrpc_resume_request(ctx->vbase, ctx->ctx, EVRPC_CONTINUE); in rpc_hook_pause_cb()
622 tmp->vbase = arg; in rpc_hook_pause()
623 tmp->ctx = ctx; in rpc_hook_pause()
626 event_once(-1, EV_TIMEOUT, rpc_hook_pause_cb, tmp, &tv); in rpc_hook_pause()
633 ev_uint16_t port; in rpc_basic_client_with_pause() local
635 struct evrpc_base *base = NULL; in rpc_basic_client_with_pause() local
640 rpc_setup(&http, &port, &base); in rpc_basic_client_with_pause()
642 assert(evrpc_add_hook(base, EVRPC_INPUT, rpc_hook_pause, base)); in rpc_basic_client_with_pause()
643 assert(evrpc_add_hook(base, EVRPC_OUTPUT, rpc_hook_pause, base)); in rpc_basic_client_with_pause()
645 pool = rpc_pool_with_connection(port); in rpc_basic_client_with_pause()
668 if (base) in rpc_basic_client_with_pause()
669 rpc_teardown(base); in rpc_basic_client_with_pause()
685 ev_uint16_t port; in rpc_client_timeout() local
687 struct evrpc_base *base = NULL; in rpc_client_timeout() local
692 rpc_setup(&http, &port, &base); in rpc_client_timeout()
694 pool = rpc_pool_with_connection(port); in rpc_client_timeout()
717 rpc_teardown(base); in rpc_client_timeout()
751 if (EVTAG_GET(msg, attack, &attack) == -1) { in rpc_test()
786 if (msg_complete(msg) == -1) in rpc_test()
791 if (evtag_peek(tmp, &tag) == -1) in rpc_test()
798 if (evtag_unmarshal_msg(tmp, 0xdeaf, msg2) == -1) in rpc_test()
813 if (EVTAG_GET(msg2, attack, &attack) == -1) { in rpc_test()
822 if (EVTAG_ARRAY_GET(msg2, run, 0, &run) == -1) { in rpc_test()
834 if (EVTAG_ARRAY_GET(run, notes, 0, &note_one) == -1 || in rpc_test()
835 EVTAG_ARRAY_GET(run, notes, 1, &note_two) == -1) { in rpc_test()
844 if (EVTAG_GET(run, large_number, &large_number) == -1 || in rpc_test()
854 run, other_numbers, 0, &short_number) == -1) { in rpc_test()
864 if (EVTAG_ARRAY_GET(attack, how_often, i, &res) == -1) { in rpc_test()
885 ev_uint16_t port; in rpc_invalid_type() local
887 struct evrpc_base *base = NULL; in rpc_invalid_type() local
891 rpc_setup(&http, &port, &base); in rpc_invalid_type()
893 evcon = evhttp_connection_new("127.0.0.1", port); in rpc_invalid_type()
905 evhttp_add_header(req->output_headers, "Host", "somehost"); in rpc_invalid_type()
906 evbuffer_add_printf(req->output_buffer, "Some Nonsense"); in rpc_invalid_type()
910 "/.rpc.Message") == -1) { in rpc_invalid_type()
920 rpc_teardown(base); in rpc_invalid_type()