nginx/src/http/modules/ngx_http_limit_conn_module.c


/*
 * Copyright (C) Igor Sysoev
 * Copyright (C) Nginx, Inc.
 */


#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_http.h>


#define NGX_HTTP_LIMIT_CONN_PASSED
#define NGX_HTTP_LIMIT_CONN_REJECTED
#define NGX_HTTP_LIMIT_CONN_REJECTED_DRY_RUN


ngx_http_limit_conn_node_t;


ngx_http_limit_conn_cleanup_t;


ngx_http_limit_conn_shctx_t;


ngx_http_limit_conn_ctx_t;


ngx_http_limit_conn_limit_t;


ngx_http_limit_conn_conf_t;


static ngx_rbtree_node_t *ngx_http_limit_conn_lookup(ngx_rbtree_t *rbtree,
    ngx_str_t *key, uint32_t hash);
static void ngx_http_limit_conn_cleanup(void *data);
static ngx_inline void ngx_http_limit_conn_cleanup_all(ngx_pool_t *pool);

static ngx_int_t ngx_http_limit_conn_status_variable(ngx_http_request_t *r,
    ngx_http_variable_value_t *v, uintptr_t data);
static void *ngx_http_limit_conn_create_conf(ngx_conf_t *cf);
static char *ngx_http_limit_conn_merge_conf(ngx_conf_t *cf, void *parent,
    void *child);
static char *ngx_http_limit_conn_zone(ngx_conf_t *cf, ngx_command_t *cmd,
    void *conf);
static char *ngx_http_limit_conn(ngx_conf_t *cf, ngx_command_t *cmd,
    void *conf);
static ngx_int_t ngx_http_limit_conn_add_variables(ngx_conf_t *cf);
static ngx_int_t ngx_http_limit_conn_init(ngx_conf_t *cf);


static ngx_conf_enum_t  ngx_http_limit_conn_log_levels[] =;


static ngx_conf_num_bounds_t  ngx_http_limit_conn_status_bounds =;


static ngx_command_t  ngx_http_limit_conn_commands[] =;


static ngx_http_module_t  ngx_http_limit_conn_module_ctx =;


ngx_module_t  ngx_http_limit_conn_module =;


static ngx_http_variable_t  ngx_http_limit_conn_vars[] =;


static ngx_str_t  ngx_http_limit_conn_status[] =;


static ngx_int_t
ngx_http_limit_conn_handler(ngx_http_request_t *r)
{}


static void
ngx_http_limit_conn_rbtree_insert_value(ngx_rbtree_node_t *temp,
    ngx_rbtree_node_t *node, ngx_rbtree_node_t *sentinel)
{}


static ngx_rbtree_node_t *
ngx_http_limit_conn_lookup(ngx_rbtree_t *rbtree, ngx_str_t *key, uint32_t hash)
{}


static void
ngx_http_limit_conn_cleanup(void *data)
{}


static ngx_inline void
ngx_http_limit_conn_cleanup_all(ngx_pool_t *pool)
{}


static ngx_int_t
ngx_http_limit_conn_init_zone(ngx_shm_zone_t *shm_zone, void *data)
{}


static ngx_int_t
ngx_http_limit_conn_status_variable(ngx_http_request_t *r,
    ngx_http_variable_value_t *v, uintptr_t data)
{}


static void *
ngx_http_limit_conn_create_conf(ngx_conf_t *cf)
{}


static char *
ngx_http_limit_conn_merge_conf(ngx_conf_t *cf, void *parent, void *child)
{}


static char *
ngx_http_limit_conn_zone(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{}


static char *
ngx_http_limit_conn(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{}


static ngx_int_t
ngx_http_limit_conn_add_variables(ngx_conf_t *cf)
{}


static ngx_int_t
ngx_http_limit_conn_init(ngx_conf_t *cf)
{}