~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Nginx/core/ngx_connection.h

Version: ~ [ nginx-0.6.26 ] ~ [ nginx-0.5.35 ] ~ [ nginx-0.5.20 ] ~ [ nginx-0.5.19 ] ~

  1 
  2 /*
  3  * Copyright (C) Igor Sysoev
  4  */
  5 
  6 
  7 #ifndef _NGX_CONNECTION_H_INCLUDED_
  8 #define _NGX_CONNECTION_H_INCLUDED_
  9 
 10 
 11 #include <ngx_config.h>
 12 #include <ngx_core.h>
 13 
 14 
 15 typedef struct ngx_listening_s  ngx_listening_t;
 16 
 17 struct ngx_listening_s {
 18     ngx_socket_t        fd;
 19 
 20     struct sockaddr    *sockaddr;
 21     socklen_t           socklen;    /* size of sockaddr */
 22     size_t              addr;       /* offset to address in sockaddr */
 23     size_t              addr_text_max_len;
 24     ngx_str_t           addr_text;
 25 
 26     int                 family;
 27     int                 type;
 28 
 29     int                 backlog;
 30     int                 rcvbuf;
 31     int                 sndbuf;
 32 
 33     /* handler of accepted connection */
 34     ngx_connection_handler_pt   handler;
 35 
 36     void               *servers;  /* array of ngx_http_in_addr_t, for example */
 37 
 38     ngx_log_t           log;
 39 
 40     size_t              pool_size;
 41     /* should be here because of the AcceptEx() preread */
 42     size_t              post_accept_buffer_size;
 43     /* should be here because of the deferred accept */
 44     ngx_msec_t          post_accept_timeout;
 45 
 46     ngx_listening_t    *previous;
 47     ngx_connection_t   *connection;
 48 
 49     unsigned            open:1;
 50     unsigned            remain:1;
 51     unsigned            ignore:1;
 52 
 53     unsigned            bound:1;       /* already bound */
 54     unsigned            inherited:1;   /* inherited from previous process */
 55     unsigned            nonblocking_accept:1;
 56     unsigned            listen:1;
 57     unsigned            nonblocking:1;
 58     unsigned            shared:1;    /* shared between threads or processes */
 59     unsigned            addr_ntop:1;
 60 
 61 #if (NGX_HAVE_DEFERRED_ACCEPT)
 62     unsigned            deferred_accept:1;
 63     unsigned            delete_deferred:1;
 64     unsigned            add_deferred:1;
 65 #ifdef SO_ACCEPTFILTER
 66     char               *accept_filter;
 67 #endif
 68 #endif
 69 
 70 };
 71 
 72 
 73 typedef enum {
 74      NGX_ERROR_CRIT = 0,
 75      NGX_ERROR_ERR,
 76      NGX_ERROR_INFO,
 77      NGX_ERROR_IGNORE_ECONNRESET
 78 } ngx_connection_log_error_e;
 79 
 80 
 81 typedef enum {
 82      NGX_TCP_NODELAY_UNSET = 0,
 83      NGX_TCP_NODELAY_SET,
 84      NGX_TCP_NODELAY_DISABLED
 85 } ngx_connection_tcp_nodelay_e;
 86 
 87 
 88 typedef enum {
 89      NGX_TCP_NOPUSH_UNSET = 0,
 90      NGX_TCP_NOPUSH_SET,
 91      NGX_TCP_NOPUSH_DISABLED
 92 } ngx_connection_tcp_nopush_e;
 93 
 94 
 95 #define NGX_LOWLEVEL_BUFFERED  0x0f
 96 #define NGX_SSL_BUFFERED       0x01
 97 
 98 
 99 struct ngx_connection_s {
100     void               *data;
101     ngx_event_t        *read;
102     ngx_event_t        *write;
103 
104     ngx_socket_t        fd;
105 
106     ngx_recv_pt         recv;
107     ngx_send_pt         send;
108     ngx_recv_chain_pt   recv_chain;
109     ngx_send_chain_pt   send_chain;
110 
111     ngx_listening_t    *listening;
112 
113     off_t               sent;
114 
115     ngx_log_t          *log;
116 
117     ngx_pool_t         *pool;
118 
119     struct sockaddr    *sockaddr;
120     socklen_t           socklen;
121     ngx_str_t           addr_text;
122 
123 #if (NGX_SSL)
124     ngx_ssl_connection_t  *ssl;
125 #endif
126 
127 #if (NGX_HAVE_IOCP)
128     struct sockaddr    *local_sockaddr;
129     socklen_t           local_socklen;
130 #endif
131 
132     ngx_buf_t          *buffer;
133 
134     ngx_atomic_uint_t   number;
135 
136     unsigned            buffered:8;
137 
138     unsigned            log_error:2;     /* ngx_connection_log_error_e */
139 
140     unsigned            single_connection:1;
141     unsigned            unexpected_eof:1;
142     unsigned            timedout:1;
143     unsigned            error:1;
144     unsigned            destroyed:1;
145 
146     unsigned            idle:1;
147     unsigned            close:1;
148 
149     unsigned            sendfile:1;
150     unsigned            sndlowat:1;
151     unsigned            tcp_nodelay:2;   /* ngx_connection_tcp_nodelay_e */
152     unsigned            tcp_nopush:2;    /* ngx_connection_tcp_nopush_e */
153 
154 #if (NGX_HAVE_IOCP)
155     unsigned            accept_context_updated:1;
156 #endif
157 
158 #if (NGX_THREADS)
159     ngx_atomic_t        lock;
160 #endif
161 };
162 
163 
164 #ifndef ngx_ssl_set_nosendshut
165 #define ngx_ssl_set_nosendshut(ssl)
166 #endif
167 
168 
169 ngx_listening_t *ngx_listening_inet_stream_socket(ngx_conf_t *cf,
170     in_addr_t addr, in_port_t port);
171 ngx_int_t ngx_set_inherited_sockets(ngx_cycle_t *cycle);
172 ngx_int_t ngx_open_listening_sockets(ngx_cycle_t *cycle);
173 void ngx_configure_listening_socket(ngx_cycle_t *cycle);
174 void ngx_close_listening_sockets(ngx_cycle_t *cycle);
175 void ngx_close_connection(ngx_connection_t *c);
176 ngx_int_t ngx_connection_error(ngx_connection_t *c, ngx_err_t err, char *text);
177 
178 ngx_connection_t *ngx_get_connection(ngx_socket_t s, ngx_log_t *log);
179 void ngx_free_connection(ngx_connection_t *c);
180 
181 
182 #endif /* _NGX_CONNECTION_H_INCLUDED_ */
183 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.