Annotation of embedaddon/nginx/src/core/ngx_conf_file.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_HTTP_CONF_FILE_H_INCLUDED_
        !             9: #define _NGX_HTTP_CONF_FILE_H_INCLUDED_
        !            10: 
        !            11: 
        !            12: #include <ngx_config.h>
        !            13: #include <ngx_core.h>
        !            14: 
        !            15: 
        !            16: /*
        !            17:  *        AAAA  number of arguments
        !            18:  *      FF      command flags
        !            19:  *    TT        command type, i.e. HTTP "location" or "server" command
        !            20:  */
        !            21: 
        !            22: #define NGX_CONF_NOARGS      0x00000001
        !            23: #define NGX_CONF_TAKE1       0x00000002
        !            24: #define NGX_CONF_TAKE2       0x00000004
        !            25: #define NGX_CONF_TAKE3       0x00000008
        !            26: #define NGX_CONF_TAKE4       0x00000010
        !            27: #define NGX_CONF_TAKE5       0x00000020
        !            28: #define NGX_CONF_TAKE6       0x00000040
        !            29: #define NGX_CONF_TAKE7       0x00000080
        !            30: 
        !            31: #define NGX_CONF_MAX_ARGS    8
        !            32: 
        !            33: #define NGX_CONF_TAKE12      (NGX_CONF_TAKE1|NGX_CONF_TAKE2)
        !            34: #define NGX_CONF_TAKE13      (NGX_CONF_TAKE1|NGX_CONF_TAKE3)
        !            35: 
        !            36: #define NGX_CONF_TAKE23      (NGX_CONF_TAKE2|NGX_CONF_TAKE3)
        !            37: 
        !            38: #define NGX_CONF_TAKE123     (NGX_CONF_TAKE1|NGX_CONF_TAKE2|NGX_CONF_TAKE3)
        !            39: #define NGX_CONF_TAKE1234    (NGX_CONF_TAKE1|NGX_CONF_TAKE2|NGX_CONF_TAKE3   \
        !            40:                               |NGX_CONF_TAKE4)
        !            41: 
        !            42: #define NGX_CONF_ARGS_NUMBER 0x000000ff
        !            43: #define NGX_CONF_BLOCK       0x00000100
        !            44: #define NGX_CONF_FLAG        0x00000200
        !            45: #define NGX_CONF_ANY         0x00000400
        !            46: #define NGX_CONF_1MORE       0x00000800
        !            47: #define NGX_CONF_2MORE       0x00001000
        !            48: #define NGX_CONF_MULTI       0x00000000  /* compatibility */
        !            49: 
        !            50: #define NGX_DIRECT_CONF      0x00010000
        !            51: 
        !            52: #define NGX_MAIN_CONF        0x01000000
        !            53: #define NGX_ANY_CONF         0x0F000000
        !            54: 
        !            55: 
        !            56: 
        !            57: #define NGX_CONF_UNSET       -1
        !            58: #define NGX_CONF_UNSET_UINT  (ngx_uint_t) -1
        !            59: #define NGX_CONF_UNSET_PTR   (void *) -1
        !            60: #define NGX_CONF_UNSET_SIZE  (size_t) -1
        !            61: #define NGX_CONF_UNSET_MSEC  (ngx_msec_t) -1
        !            62: 
        !            63: 
        !            64: #define NGX_CONF_OK          NULL
        !            65: #define NGX_CONF_ERROR       (void *) -1
        !            66: 
        !            67: #define NGX_CONF_BLOCK_START 1
        !            68: #define NGX_CONF_BLOCK_DONE  2
        !            69: #define NGX_CONF_FILE_DONE   3
        !            70: 
        !            71: #define NGX_CORE_MODULE      0x45524F43  /* "CORE" */
        !            72: #define NGX_CONF_MODULE      0x464E4F43  /* "CONF" */
        !            73: 
        !            74: 
        !            75: #define NGX_MAX_CONF_ERRSTR  1024
        !            76: 
        !            77: 
        !            78: struct ngx_command_s {
        !            79:     ngx_str_t             name;
        !            80:     ngx_uint_t            type;
        !            81:     char               *(*set)(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
        !            82:     ngx_uint_t            conf;
        !            83:     ngx_uint_t            offset;
        !            84:     void                 *post;
        !            85: };
        !            86: 
        !            87: #define ngx_null_command  { ngx_null_string, 0, NULL, 0, 0, NULL }
        !            88: 
        !            89: 
        !            90: struct ngx_open_file_s {
        !            91:     ngx_fd_t              fd;
        !            92:     ngx_str_t             name;
        !            93: 
        !            94:     void                (*flush)(ngx_open_file_t *file, ngx_log_t *log);
        !            95:     void                 *data;
        !            96: };
        !            97: 
        !            98: 
        !            99: #define NGX_MODULE_V1          0, 0, 0, 0, 0, 0, 1
        !           100: #define NGX_MODULE_V1_PADDING  0, 0, 0, 0, 0, 0, 0, 0
        !           101: 
        !           102: struct ngx_module_s {
        !           103:     ngx_uint_t            ctx_index;
        !           104:     ngx_uint_t            index;
        !           105: 
        !           106:     ngx_uint_t            spare0;
        !           107:     ngx_uint_t            spare1;
        !           108:     ngx_uint_t            spare2;
        !           109:     ngx_uint_t            spare3;
        !           110: 
        !           111:     ngx_uint_t            version;
        !           112: 
        !           113:     void                 *ctx;
        !           114:     ngx_command_t        *commands;
        !           115:     ngx_uint_t            type;
        !           116: 
        !           117:     ngx_int_t           (*init_master)(ngx_log_t *log);
        !           118: 
        !           119:     ngx_int_t           (*init_module)(ngx_cycle_t *cycle);
        !           120: 
        !           121:     ngx_int_t           (*init_process)(ngx_cycle_t *cycle);
        !           122:     ngx_int_t           (*init_thread)(ngx_cycle_t *cycle);
        !           123:     void                (*exit_thread)(ngx_cycle_t *cycle);
        !           124:     void                (*exit_process)(ngx_cycle_t *cycle);
        !           125: 
        !           126:     void                (*exit_master)(ngx_cycle_t *cycle);
        !           127: 
        !           128:     uintptr_t             spare_hook0;
        !           129:     uintptr_t             spare_hook1;
        !           130:     uintptr_t             spare_hook2;
        !           131:     uintptr_t             spare_hook3;
        !           132:     uintptr_t             spare_hook4;
        !           133:     uintptr_t             spare_hook5;
        !           134:     uintptr_t             spare_hook6;
        !           135:     uintptr_t             spare_hook7;
        !           136: };
        !           137: 
        !           138: 
        !           139: typedef struct {
        !           140:     ngx_str_t             name;
        !           141:     void               *(*create_conf)(ngx_cycle_t *cycle);
        !           142:     char               *(*init_conf)(ngx_cycle_t *cycle, void *conf);
        !           143: } ngx_core_module_t;
        !           144: 
        !           145: 
        !           146: typedef struct {
        !           147:     ngx_file_t            file;
        !           148:     ngx_buf_t            *buffer;
        !           149:     ngx_uint_t            line;
        !           150: } ngx_conf_file_t;
        !           151: 
        !           152: 
        !           153: typedef char *(*ngx_conf_handler_pt)(ngx_conf_t *cf,
        !           154:     ngx_command_t *dummy, void *conf);
        !           155: 
        !           156: 
        !           157: struct ngx_conf_s {
        !           158:     char                 *name;
        !           159:     ngx_array_t          *args;
        !           160: 
        !           161:     ngx_cycle_t          *cycle;
        !           162:     ngx_pool_t           *pool;
        !           163:     ngx_pool_t           *temp_pool;
        !           164:     ngx_conf_file_t      *conf_file;
        !           165:     ngx_log_t            *log;
        !           166: 
        !           167:     void                 *ctx;
        !           168:     ngx_uint_t            module_type;
        !           169:     ngx_uint_t            cmd_type;
        !           170: 
        !           171:     ngx_conf_handler_pt   handler;
        !           172:     char                 *handler_conf;
        !           173: };
        !           174: 
        !           175: 
        !           176: typedef char *(*ngx_conf_post_handler_pt) (ngx_conf_t *cf,
        !           177:     void *data, void *conf);
        !           178: 
        !           179: typedef struct {
        !           180:     ngx_conf_post_handler_pt  post_handler;
        !           181: } ngx_conf_post_t;
        !           182: 
        !           183: 
        !           184: typedef struct {
        !           185:     ngx_conf_post_handler_pt  post_handler;
        !           186:     char                     *old_name;
        !           187:     char                     *new_name;
        !           188: } ngx_conf_deprecated_t;
        !           189: 
        !           190: 
        !           191: typedef struct {
        !           192:     ngx_conf_post_handler_pt  post_handler;
        !           193:     ngx_int_t                 low;
        !           194:     ngx_int_t                 high;
        !           195: } ngx_conf_num_bounds_t;
        !           196: 
        !           197: 
        !           198: typedef struct {
        !           199:     ngx_str_t                 name;
        !           200:     ngx_uint_t                value;
        !           201: } ngx_conf_enum_t;
        !           202: 
        !           203: 
        !           204: #define NGX_CONF_BITMASK_SET  1
        !           205: 
        !           206: typedef struct {
        !           207:     ngx_str_t                 name;
        !           208:     ngx_uint_t                mask;
        !           209: } ngx_conf_bitmask_t;
        !           210: 
        !           211: 
        !           212: 
        !           213: char * ngx_conf_deprecated(ngx_conf_t *cf, void *post, void *data);
        !           214: char *ngx_conf_check_num_bounds(ngx_conf_t *cf, void *post, void *data);
        !           215: 
        !           216: 
        !           217: #define ngx_get_conf(conf_ctx, module)  conf_ctx[module.index]
        !           218: 
        !           219: 
        !           220: 
        !           221: #define ngx_conf_init_value(conf, default)                                   \
        !           222:     if (conf == NGX_CONF_UNSET) {                                            \
        !           223:         conf = default;                                                      \
        !           224:     }
        !           225: 
        !           226: #define ngx_conf_init_ptr_value(conf, default)                               \
        !           227:     if (conf == NGX_CONF_UNSET_PTR) {                                        \
        !           228:         conf = default;                                                      \
        !           229:     }
        !           230: 
        !           231: #define ngx_conf_init_uint_value(conf, default)                              \
        !           232:     if (conf == NGX_CONF_UNSET_UINT) {                                       \
        !           233:         conf = default;                                                      \
        !           234:     }
        !           235: 
        !           236: #define ngx_conf_init_size_value(conf, default)                              \
        !           237:     if (conf == NGX_CONF_UNSET_SIZE) {                                       \
        !           238:         conf = default;                                                      \
        !           239:     }
        !           240: 
        !           241: #define ngx_conf_init_msec_value(conf, default)                              \
        !           242:     if (conf == NGX_CONF_UNSET_MSEC) {                                       \
        !           243:         conf = default;                                                      \
        !           244:     }
        !           245: 
        !           246: #define ngx_conf_merge_value(conf, prev, default)                            \
        !           247:     if (conf == NGX_CONF_UNSET) {                                            \
        !           248:         conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
        !           249:     }
        !           250: 
        !           251: #define ngx_conf_merge_ptr_value(conf, prev, default)                        \
        !           252:     if (conf == NGX_CONF_UNSET_PTR) {                                        \
        !           253:         conf = (prev == NGX_CONF_UNSET_PTR) ? default : prev;                \
        !           254:     }
        !           255: 
        !           256: #define ngx_conf_merge_uint_value(conf, prev, default)                       \
        !           257:     if (conf == NGX_CONF_UNSET_UINT) {                                       \
        !           258:         conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
        !           259:     }
        !           260: 
        !           261: #define ngx_conf_merge_msec_value(conf, prev, default)                       \
        !           262:     if (conf == NGX_CONF_UNSET_MSEC) {                                       \
        !           263:         conf = (prev == NGX_CONF_UNSET_MSEC) ? default : prev;               \
        !           264:     }
        !           265: 
        !           266: #define ngx_conf_merge_sec_value(conf, prev, default)                        \
        !           267:     if (conf == NGX_CONF_UNSET) {                                            \
        !           268:         conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
        !           269:     }
        !           270: 
        !           271: #define ngx_conf_merge_size_value(conf, prev, default)                       \
        !           272:     if (conf == NGX_CONF_UNSET_SIZE) {                                       \
        !           273:         conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
        !           274:     }
        !           275: 
        !           276: #define ngx_conf_merge_off_value(conf, prev, default)                        \
        !           277:     if (conf == NGX_CONF_UNSET) {                                            \
        !           278:         conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
        !           279:     }
        !           280: 
        !           281: #define ngx_conf_merge_str_value(conf, prev, default)                        \
        !           282:     if (conf.data == NULL) {                                                 \
        !           283:         if (prev.data) {                                                     \
        !           284:             conf.len = prev.len;                                             \
        !           285:             conf.data = prev.data;                                           \
        !           286:         } else {                                                             \
        !           287:             conf.len = sizeof(default) - 1;                                  \
        !           288:             conf.data = (u_char *) default;                                  \
        !           289:         }                                                                    \
        !           290:     }
        !           291: 
        !           292: #define ngx_conf_merge_bufs_value(conf, prev, default_num, default_size)     \
        !           293:     if (conf.num == 0) {                                                     \
        !           294:         if (prev.num) {                                                      \
        !           295:             conf.num = prev.num;                                             \
        !           296:             conf.size = prev.size;                                           \
        !           297:         } else {                                                             \
        !           298:             conf.num = default_num;                                          \
        !           299:             conf.size = default_size;                                        \
        !           300:         }                                                                    \
        !           301:     }
        !           302: 
        !           303: #define ngx_conf_merge_bitmask_value(conf, prev, default)                    \
        !           304:     if (conf == 0) {                                                         \
        !           305:         conf = (prev == 0) ? default : prev;                                 \
        !           306:     }
        !           307: 
        !           308: 
        !           309: char *ngx_conf_param(ngx_conf_t *cf);
        !           310: char *ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename);
        !           311: char *ngx_conf_include(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
        !           312: 
        !           313: 
        !           314: ngx_int_t ngx_conf_full_name(ngx_cycle_t *cycle, ngx_str_t *name,
        !           315:     ngx_uint_t conf_prefix);
        !           316: ngx_open_file_t *ngx_conf_open_file(ngx_cycle_t *cycle, ngx_str_t *name);
        !           317: void ngx_cdecl ngx_conf_log_error(ngx_uint_t level, ngx_conf_t *cf,
        !           318:     ngx_err_t err, const char *fmt, ...);
        !           319: 
        !           320: 
        !           321: char *ngx_conf_set_flag_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
        !           322: char *ngx_conf_set_str_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
        !           323: char *ngx_conf_set_str_array_slot(ngx_conf_t *cf, ngx_command_t *cmd,
        !           324:     void *conf);
        !           325: char *ngx_conf_set_keyval_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
        !           326: char *ngx_conf_set_num_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
        !           327: char *ngx_conf_set_size_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
        !           328: char *ngx_conf_set_off_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
        !           329: char *ngx_conf_set_msec_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
        !           330: char *ngx_conf_set_sec_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
        !           331: char *ngx_conf_set_bufs_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
        !           332: char *ngx_conf_set_enum_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
        !           333: char *ngx_conf_set_bitmask_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
        !           334: 
        !           335: 
        !           336: extern ngx_uint_t     ngx_max_module;
        !           337: extern ngx_module_t  *ngx_modules[];
        !           338: 
        !           339: 
        !           340: #endif /* _NGX_HTTP_CONF_FILE_H_INCLUDED_ */

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