Annotation of embedaddon/nginx/src/core/ngx_connection.h, revision 1.1

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>