comparison src/core/ngx_connection.h @ 103:6dfda4cf5200

nginx-0.0.1-2003-06-11-19:28:34 import
author Igor Sysoev <igor@sysoev.ru>
date Wed, 11 Jun 2003 15:28:34 +0000
parents 2e069b6e6920
children a9bc21d63fe4
comparison
equal deleted inserted replaced
102:7e86d028d8f0 103:6dfda4cf5200
1 #ifndef _NGX_CONNECTION_H_INCLUDED_ 1 #ifndef _NGX_CONNECTION_H_INCLUDED_
2 #define _NGX_CONNECTION_H_INCLUDED_ 2 #define _NGX_CONNECTION_H_INCLUDED_
3 3
4
4 #include <ngx_config.h> 5 #include <ngx_config.h>
5 #include <ngx_core.h> 6 #include <ngx_core.h>
6 #include <ngx_event.h> 7
8
9 typedef struct {
10 ngx_socket_t fd;
11
12 struct sockaddr *sockaddr;
13 socklen_t socklen; /* size of sockaddr */
14 int addr; /* offset to address in sockaddr */
15 int addr_text_max_len;
16 ngx_str_t addr_text;
17
18 int family;
19 int type;
20 int protocol;
21 int flags; /* Winsock2 flags */
22
23 void (*handler)(ngx_connection_t *c); /* handler of accepted
24 connection */
25 void *ctx; /* ngx_http_conf_ctx_t, for example */
26 void *servers; /* array of ngx_http_in_addr_t, for example */
27
28 ngx_log_t *log;
29 int backlog;
30
31 int pool_size;
32 int post_accept_buffer_size; /* should be here because
33 of the AcceptEx() preread */
34 time_t post_accept_timeout; /* should be here because
35 of the deferred accept */
36
37 unsigned bound:1; /* already bound */
38 unsigned inherited:1; /* inherited from previous process */
39 unsigned nonblocking_accept:1;
40 unsigned nonblocking:1;
41 #if 0
42 unsigned overlapped:1; /* Winsock2 overlapped */
43 #endif
44 unsigned shared:1; /* shared between threads or processes */
45 #if (HAVE_DEFERRED_ACCEPT)
46 unsigned deferred_accept:1;
47 #endif
48 } ngx_listening_t;
7 49
8 50
9 struct ngx_connection_s { 51 struct ngx_connection_s {
10 ngx_socket_t fd; 52 void *data;
11 void *data;
12
13 #ifdef NGX_EVENT
14 ngx_event_t *read; 53 ngx_event_t *read;
15 ngx_event_t *write; 54 ngx_event_t *write;
16 #endif 55
56 ngx_socket_t fd;
57
58 ngx_listening_t *listening;
17 59
18 off_t sent; 60 off_t sent;
19 61
62 #if 0
20 void (*handler)(ngx_connection_t *c); 63 void (*handler)(ngx_connection_t *c);
64 #endif
21 void *ctx; 65 void *ctx;
22 void *servers; 66 void *servers;
67
23 68
24 ngx_log_t *log; 69 ngx_log_t *log;
25 70
26 ngx_pool_t *pool; 71 ngx_pool_t *pool;
72 #if 0
27 int pool_size; 73 int pool_size;
28 74
29 int family; 75 int family;
76 #endif
77
30 struct sockaddr *sockaddr; 78 struct sockaddr *sockaddr;
31 socklen_t socklen; 79 socklen_t socklen;
80 ngx_str_t addr_text;
81
32 #if (HAVE_IOCP) 82 #if (HAVE_IOCP)
33 struct sockaddr *local_sockaddr; 83 struct sockaddr *local_sockaddr;
34 socklen_t local_socklen; 84 socklen_t local_socklen;
35 void *listening;
36 #endif 85 #endif
86
87 #if 0
37 int addr; 88 int addr;
38 int addr_text_max_len; 89 int addr_text_max_len;
39 ngx_str_t addr_text; 90 #endif
40 91
41 ngx_hunk_t *buffer; 92 ngx_hunk_t *buffer;
93 #if 0
42 unsigned int post_accept_timeout; 94 unsigned int post_accept_timeout;
95 #endif
43 96
44 int number; 97 int number;
45 98
46 unsigned pipeline:1; 99 unsigned pipeline:1;
47 unsigned unexpected_eof:1; 100 unsigned unexpected_eof:1;
48 unsigned tcp_nopush:1; 101 unsigned tcp_nopush:1;
49 unsigned tcp_nopush_enabled:1; 102 unsigned tcp_nopush_enabled:1;
103 #if (HAVE_IOCP)
104 unsigned accept_context_updated:1;
105 #endif
50 }; 106 };
107
108
109
51 110
52 111
53 #if 0 112 #if 0
54 cached file 113 cached file
55 int fd; -2 unused, -1 closed (but read or mmaped), >=0 open 114 int fd; -2 unused, -1 closed (but read or mmaped), >=0 open
82 ngx_chain_t *(*send_chain)(ngx_connection_t *c, ngx_chain_t *in); 141 ngx_chain_t *(*send_chain)(ngx_connection_t *c, ngx_chain_t *in);
83 } ngx_os_io_t; 142 } ngx_os_io_t;
84 #endif 143 #endif
85 144
86 145
146
147 extern ngx_array_t ngx_listening_sockets;
87 extern ngx_os_io_t ngx_io; 148 extern ngx_os_io_t ngx_io;
88
89 149
90 150
91 extern ngx_chain_t *(*ngx_write_chain_proc) 151 extern ngx_chain_t *(*ngx_write_chain_proc)
92 (ngx_connection_t *c, ngx_chain_t *in); 152 (ngx_connection_t *c, ngx_chain_t *in);
93 153