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

Linux Cross Reference
Nginx/core/ngx_connection.h

Version: ~ [ nginx-0.8.20 ] ~ [ nginx-0.7.62 ] ~ [ nginx-0.6.39 ] ~

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

~ [ 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.