Mercurial > hg > nginx-quic
annotate src/stream/ngx_stream_upstream.h @ 6698:e8d4c9e9682a
Removed influence of some options on structures.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Tue, 20 Sep 2016 12:30:52 +0300 |
parents | 56fc55e32f23 |
children | edcd9303a4d3 |
rev | line source |
---|---|
6115 | 1 |
2 /* | |
3 * Copyright (C) Igor Sysoev | |
4 * Copyright (C) Nginx, Inc. | |
5 */ | |
6 | |
7 | |
8 #ifndef _NGX_STREAM_UPSTREAM_H_INCLUDED_ | |
9 #define _NGX_STREAM_UPSTREAM_H_INCLUDED_ | |
10 | |
11 | |
12 #include <ngx_config.h> | |
13 #include <ngx_core.h> | |
14 #include <ngx_stream.h> | |
15 #include <ngx_event_connect.h> | |
16 | |
17 | |
18 #define NGX_STREAM_UPSTREAM_CREATE 0x0001 | |
19 #define NGX_STREAM_UPSTREAM_WEIGHT 0x0002 | |
20 #define NGX_STREAM_UPSTREAM_MAX_FAILS 0x0004 | |
21 #define NGX_STREAM_UPSTREAM_FAIL_TIMEOUT 0x0008 | |
22 #define NGX_STREAM_UPSTREAM_DOWN 0x0010 | |
23 #define NGX_STREAM_UPSTREAM_BACKUP 0x0020 | |
24 | |
25 | |
26 typedef struct { | |
27 ngx_array_t upstreams; | |
28 /* ngx_stream_upstream_srv_conf_t */ | |
29 } ngx_stream_upstream_main_conf_t; | |
30 | |
31 | |
32 typedef struct ngx_stream_upstream_srv_conf_s ngx_stream_upstream_srv_conf_t; | |
33 | |
34 | |
35 typedef ngx_int_t (*ngx_stream_upstream_init_pt)(ngx_conf_t *cf, | |
36 ngx_stream_upstream_srv_conf_t *us); | |
37 typedef ngx_int_t (*ngx_stream_upstream_init_peer_pt)(ngx_stream_session_t *s, | |
38 ngx_stream_upstream_srv_conf_t *us); | |
39 | |
40 | |
41 typedef struct { | |
42 ngx_stream_upstream_init_pt init_upstream; | |
43 ngx_stream_upstream_init_peer_pt init; | |
44 void *data; | |
45 } ngx_stream_upstream_peer_t; | |
46 | |
47 | |
48 typedef struct { | |
49 ngx_str_t name; | |
50 ngx_addr_t *addrs; | |
51 ngx_uint_t naddrs; | |
52 ngx_uint_t weight; | |
53 ngx_uint_t max_fails; | |
54 time_t fail_timeout; | |
55 | |
56 unsigned down:1; | |
57 unsigned backup:1; | |
58 } ngx_stream_upstream_server_t; | |
59 | |
60 | |
61 struct ngx_stream_upstream_srv_conf_s { | |
62 ngx_stream_upstream_peer_t peer; | |
63 void **srv_conf; | |
64 | |
65 ngx_array_t *servers; | |
66 /* ngx_stream_upstream_server_t */ | |
67 | |
68 ngx_uint_t flags; | |
69 ngx_str_t host; | |
70 u_char *file_name; | |
71 ngx_uint_t line; | |
72 in_port_t port; | |
73 ngx_uint_t no_port; /* unsigned no_port:1 */ | |
74 | |
75 #if (NGX_STREAM_UPSTREAM_ZONE) | |
76 ngx_shm_zone_t *shm_zone; | |
77 #endif | |
78 }; | |
79 | |
80 | |
81 typedef struct { | |
6677
c02290241cbe
Stream: upstream response time variables.
Vladimir Homutov <vl@nginx.com>
parents:
6676
diff
changeset
|
82 ngx_msec_t response_time; |
c02290241cbe
Stream: upstream response time variables.
Vladimir Homutov <vl@nginx.com>
parents:
6676
diff
changeset
|
83 ngx_msec_t connect_time; |
c02290241cbe
Stream: upstream response time variables.
Vladimir Homutov <vl@nginx.com>
parents:
6676
diff
changeset
|
84 ngx_msec_t first_byte_time; |
6676
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
85 off_t bytes_sent; |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
86 off_t bytes_received; |
df3a7c029dec
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Vladimir Homutov <vl@nginx.com>
parents:
6675
diff
changeset
|
87 |
6675
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6643
diff
changeset
|
88 ngx_str_t *peer; |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6643
diff
changeset
|
89 } ngx_stream_upstream_state_t; |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6643
diff
changeset
|
90 |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6643
diff
changeset
|
91 |
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6643
diff
changeset
|
92 typedef struct { |
6643
9757cffc1e2f
Stream: variables in proxy_pass and proxy_ssl_name.
Vladimir Homutov <vl@nginx.com>
parents:
6436
diff
changeset
|
93 ngx_str_t host; |
9757cffc1e2f
Stream: variables in proxy_pass and proxy_ssl_name.
Vladimir Homutov <vl@nginx.com>
parents:
6436
diff
changeset
|
94 in_port_t port; |
9757cffc1e2f
Stream: variables in proxy_pass and proxy_ssl_name.
Vladimir Homutov <vl@nginx.com>
parents:
6436
diff
changeset
|
95 ngx_uint_t no_port; /* unsigned no_port:1 */ |
9757cffc1e2f
Stream: variables in proxy_pass and proxy_ssl_name.
Vladimir Homutov <vl@nginx.com>
parents:
6436
diff
changeset
|
96 |
9757cffc1e2f
Stream: variables in proxy_pass and proxy_ssl_name.
Vladimir Homutov <vl@nginx.com>
parents:
6436
diff
changeset
|
97 ngx_uint_t naddrs; |
9757cffc1e2f
Stream: variables in proxy_pass and proxy_ssl_name.
Vladimir Homutov <vl@nginx.com>
parents:
6436
diff
changeset
|
98 ngx_resolver_addr_t *addrs; |
9757cffc1e2f
Stream: variables in proxy_pass and proxy_ssl_name.
Vladimir Homutov <vl@nginx.com>
parents:
6436
diff
changeset
|
99 |
9757cffc1e2f
Stream: variables in proxy_pass and proxy_ssl_name.
Vladimir Homutov <vl@nginx.com>
parents:
6436
diff
changeset
|
100 struct sockaddr *sockaddr; |
9757cffc1e2f
Stream: variables in proxy_pass and proxy_ssl_name.
Vladimir Homutov <vl@nginx.com>
parents:
6436
diff
changeset
|
101 socklen_t socklen; |
9757cffc1e2f
Stream: variables in proxy_pass and proxy_ssl_name.
Vladimir Homutov <vl@nginx.com>
parents:
6436
diff
changeset
|
102 |
9757cffc1e2f
Stream: variables in proxy_pass and proxy_ssl_name.
Vladimir Homutov <vl@nginx.com>
parents:
6436
diff
changeset
|
103 ngx_resolver_ctx_t *ctx; |
9757cffc1e2f
Stream: variables in proxy_pass and proxy_ssl_name.
Vladimir Homutov <vl@nginx.com>
parents:
6436
diff
changeset
|
104 } ngx_stream_upstream_resolved_t; |
9757cffc1e2f
Stream: variables in proxy_pass and proxy_ssl_name.
Vladimir Homutov <vl@nginx.com>
parents:
6436
diff
changeset
|
105 |
9757cffc1e2f
Stream: variables in proxy_pass and proxy_ssl_name.
Vladimir Homutov <vl@nginx.com>
parents:
6436
diff
changeset
|
106 |
9757cffc1e2f
Stream: variables in proxy_pass and proxy_ssl_name.
Vladimir Homutov <vl@nginx.com>
parents:
6436
diff
changeset
|
107 typedef struct { |
6115 | 108 ngx_peer_connection_t peer; |
6692 | 109 |
6115 | 110 ngx_buf_t downstream_buf; |
111 ngx_buf_t upstream_buf; | |
6692 | 112 |
113 ngx_chain_t *free; | |
114 ngx_chain_t *upstream_out; | |
115 ngx_chain_t *upstream_busy; | |
116 ngx_chain_t *downstream_out; | |
117 ngx_chain_t *downstream_busy; | |
118 | |
6115 | 119 off_t received; |
6201
24488e6db782
Stream: upstream and downstream limit rates.
Roman Arutyunyan <arut@nginx.com>
parents:
6184
diff
changeset
|
120 time_t start_sec; |
6436 | 121 ngx_uint_t responses; |
6692 | 122 |
6115 | 123 #if (NGX_STREAM_SSL) |
124 ngx_str_t ssl_name; | |
125 #endif | |
6692 | 126 |
6643
9757cffc1e2f
Stream: variables in proxy_pass and proxy_ssl_name.
Vladimir Homutov <vl@nginx.com>
parents:
6436
diff
changeset
|
127 ngx_stream_upstream_resolved_t *resolved; |
6675
ab9b4fd8c5b7
Stream: the $upstream_addr variable.
Vladimir Homutov <vl@nginx.com>
parents:
6643
diff
changeset
|
128 ngx_stream_upstream_state_t *state; |
6202
6345822f0abb
Stream: upstream "connected" flag.
Roman Arutyunyan <arut@nginx.com>
parents:
6201
diff
changeset
|
129 unsigned connected:1; |
6345822f0abb
Stream: upstream "connected" flag.
Roman Arutyunyan <arut@nginx.com>
parents:
6201
diff
changeset
|
130 unsigned proxy_protocol:1; |
6115 | 131 } ngx_stream_upstream_t; |
132 | |
133 | |
134 ngx_stream_upstream_srv_conf_t *ngx_stream_upstream_add(ngx_conf_t *cf, | |
135 ngx_url_t *u, ngx_uint_t flags); | |
136 | |
137 | |
138 #define ngx_stream_conf_upstream_srv_conf(uscf, module) \ | |
139 uscf->srv_conf[module.ctx_index] | |
140 | |
141 | |
142 extern ngx_module_t ngx_stream_upstream_module; | |
143 | |
144 | |
145 #endif /* _NGX_STREAM_UPSTREAM_H_INCLUDED_ */ |