From e7a0634a718ca1f2379f4694c17ef4219f5538fa Mon Sep 17 00:00:00 2001 From: Max Romanov Date: Fri, 23 Jun 2017 19:20:08 +0300 Subject: Application-side message processing. Usage on the router side: nxt_app_wmsg_t wmsg; nxt_app_parse_ctx_t parse_ctx; nxt_app_http_req_init(task, &parse_ctx); /* parse incoming request data */ if (nxt_app_http_req_parse(task, &parse_ctx, buf) == NXT_DONE) { /* choose app */ nxt_app = nxt_select_app(... &parse_ctx.r ...); /* find port */ wmsg.port = nxt_get_app_port(... nxt_app ...); wmsg.buf = &wmsg.write; /* fill write message buffer in shared mem */ nxt_app->prepare_msg(task, &parse_ctx.r, &wmsg); /* send message to app for processing */ nxt_port_socket_write(task, wmsg.port, NXT_PORT_MSG_DATA, -1, 0, 0, wmsg.write); } --- src/nxt_runtime.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/nxt_runtime.h') diff --git a/src/nxt_runtime.h b/src/nxt_runtime.h index 13072021..8316d1e3 100644 --- a/src/nxt_runtime.h +++ b/src/nxt_runtime.h @@ -135,6 +135,8 @@ void nxt_cdecl nxt_log_time_handler(nxt_uint_t level, nxt_log_t *log, void nxt_stream_connection_init(nxt_task_t *task, void *obj, void *data); nxt_int_t nxt_app_start(nxt_task_t *task, nxt_runtime_t *rt); +void nxt_port_app_data_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg); + #define nxt_runtime_process_each(rt, process) \ do { \ -- cgit