xref: /unit/src/nxt_router_request.h (revision 1131:ec7d924d8dfb)
1 
2 /*
3  * Copyright (C) NGINX, Inc.
4  */
5 
6 #ifndef _NXT_ROUTER_REQUEST_H_INCLUDED_
7 #define _NXT_ROUTER_REQUEST_H_INCLUDED_
8 
9 
10 typedef struct nxt_msg_info_s {
11     nxt_buf_t                 *buf;
12     nxt_port_mmap_tracking_t  tracking;
13     nxt_work_handler_t        completion_handler;
14 } nxt_msg_info_t;
15 
16 
17 typedef struct nxt_request_app_link_s  nxt_request_app_link_t;
18 
19 
20 typedef enum {
21     NXT_APR_NEW_PORT,
22     NXT_APR_REQUEST_FAILED,
23     NXT_APR_GOT_RESPONSE,
24     NXT_APR_UPGRADE,
25     NXT_APR_CLOSE,
26 } nxt_apr_action_t;
27 
28 
29 typedef struct {
30     uint32_t                stream;
31     nxt_app_t               *app;
32 
33     nxt_port_t              *app_port;
34     nxt_apr_action_t        apr_action;
35 
36     nxt_http_request_t      *request;
37     nxt_msg_info_t          msg_info;
38     nxt_request_app_link_t  *req_app_link;
39 } nxt_request_rpc_data_t;
40 
41 
42 struct nxt_request_app_link_s {
43     uint32_t                stream;
44     nxt_atomic_t            use_count;
45 
46     nxt_port_t              *app_port;
47     nxt_apr_action_t        apr_action;
48 
49     nxt_port_t              *reply_port;
50     nxt_http_request_t      *request;
51     nxt_msg_info_t          msg_info;
52     nxt_request_rpc_data_t  *req_rpc_data;
53 
54     nxt_nsec_t              res_time;
55 
56     nxt_queue_link_t        link_app_requests; /* for nxt_app_t.requests */
57     /* for nxt_port_t.pending_requests */
58     nxt_queue_link_t        link_port_pending;
59     nxt_queue_link_t        link_app_pending;  /* for nxt_app_t.pending */
60     /* for nxt_port_t.active_websockets */
61     nxt_queue_link_t        link_port_websockets;
62 
63     nxt_mp_t                *mem_pool;
64     nxt_work_t              work;
65 
66     int                     err_code;
67     const char              *err_str;
68 };
69 
70 
71 #endif /* _NXT_ROUTER_REQUEST_H_INCLUDED_ */
72