comparison src/core/ngx_inet.h @ 200:d2ae1c9f1fd3 NGINX_0_3_47

nginx 0.3.47 *) Feature: the "upstream" directive. *) Change: now the "\" escape symbol in the "\"" and "\'" pairs in the SSI command is always removed.
author Igor Sysoev <http://sysoev.ru>
date Tue, 23 May 2006 00:00:00 +0400
parents 7ca9bdc82b3f
children 3866d57d9cfd
comparison
equal deleted inserted replaced
199:869664706c09 200:d2ae1c9f1fd3
10 10
11 #include <ngx_config.h> 11 #include <ngx_config.h>
12 #include <ngx_core.h> 12 #include <ngx_core.h>
13 13
14 14
15 #define NGX_PARSE_URL_INET 1
16 #define NGX_PARSE_URL_UNIX 2
17
18
15 typedef struct { 19 typedef struct {
16 in_addr_t addr; 20 in_addr_t addr;
17 in_addr_t mask; 21 in_addr_t mask;
18 } ngx_inet_cidr_t; 22 } ngx_inet_cidr_t;
23
24
25 typedef struct {
26 struct sockaddr *sockaddr;
27 socklen_t socklen;
28
29 ngx_str_t name;
30 char *uri_separator;
31
32 ngx_uint_t weight;
33
34 ngx_uint_t fails;
35 time_t accessed;
36
37 ngx_uint_t max_fails;
38 time_t fail_timeout;
39
40 #if (NGX_SSL)
41 ngx_ssl_session_t *ssl_session;
42 #endif
43 } ngx_peer_t;
44
45
46 struct ngx_peers_s {
47 ngx_uint_t current;
48 ngx_uint_t weight;
49
50 ngx_uint_t number;
51 ngx_uint_t last_cached;
52
53 /* ngx_mutex_t *mutex; */
54 ngx_connection_t **cached;
55
56 ngx_peer_t peer[1];
57 };
58
59
60 typedef struct {
61 ngx_int_t type;
62
63 ngx_peers_t *peers;
64
65 ngx_str_t url;
66 ngx_str_t host;
67 ngx_str_t host_header;
68 ngx_str_t port;
69 ngx_str_t uri;
70
71 in_port_t portn;
72 in_port_t default_portn;
73
74 unsigned listen:1;
75 unsigned uri_part:1;
76 unsigned upstream:1;
77
78 unsigned default_port:1;
79 unsigned wildcard:1;
80
81 char *err;
82 } ngx_url_t;
19 83
20 84
21 typedef struct { 85 typedef struct {
22 ngx_str_t name; /* "schema:host:port/uri" */ 86 ngx_str_t name; /* "schema:host:port/uri" */
23 ngx_str_t url; /* "host:port/uri" */ 87 ngx_str_t url; /* "host:port/uri" */
33 unsigned default_port:1; 97 unsigned default_port:1;
34 unsigned wildcard:1; 98 unsigned wildcard:1;
35 99
36 unsigned uri_part:1; 100 unsigned uri_part:1;
37 unsigned port_only:1; 101 unsigned port_only:1;
102 unsigned virtual:1;
38 } ngx_inet_upstream_t; 103 } ngx_inet_upstream_t;
39 104
40 105
41 size_t ngx_sock_ntop(int family, struct sockaddr *sa, u_char *text, 106 size_t ngx_sock_ntop(int family, struct sockaddr *sa, u_char *text,
42 size_t len); 107 size_t len);
43 size_t ngx_inet_ntop(int family, void *addr, u_char *text, size_t len); 108 size_t ngx_inet_ntop(int family, void *addr, u_char *text, size_t len);
44 109
45 ngx_int_t ngx_ptocidr(ngx_str_t *text, void *cidr); 110 ngx_int_t ngx_ptocidr(ngx_str_t *text, void *cidr);
46 111
47 ngx_peers_t *ngx_inet_upstream_parse(ngx_conf_t *cf, ngx_inet_upstream_t *u); 112 ngx_peers_t *ngx_inet_upstream_parse(ngx_conf_t *cf, ngx_inet_upstream_t *u);
113 ngx_peers_t *ngx_inet_resolve_peer(ngx_conf_t *cf, ngx_str_t *name,
114 in_port_t port);
48 char *ngx_inet_parse_host_port(ngx_inet_upstream_t *u); 115 char *ngx_inet_parse_host_port(ngx_inet_upstream_t *u);
116 ngx_int_t ngx_parse_url(ngx_conf_t *cf, ngx_url_t *u);
49 117
50 118
51 #endif /* _NGX_INET_H_INCLUDED_ */ 119 #endif /* _NGX_INET_H_INCLUDED_ */