ngx_http_traffic_filter_module.c File Reference

#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_http.h>
#include <ngx_log.h>
#include "ngx_connection_pool.h"
#include "ngx_http_limit_proxy_protocol.h"

Classes

struct  ngx_http_traffic_conf_t
struct  ngx_http_traffic_ctx_t
struct  ngx_http_traffic_send_context_t

Functions

static ngx_int_t ngx_http_traffic_filter_init (ngx_conf_t *cf)
 Called by nginx, attachs filter to filter list.
static void * ngx_http_traffic_create_conf (ngx_conf_t *cf)
 Creates module configuration.
static char * ngx_http_traffic_merge_conf (ngx_conf_t *cf, void *parent, void *child)
 Merges module config, allocates local pool.
static ngx_int_t ngx_http_traffic_filter (ngx_http_request_t *r)
 Creates traffic context, sets data amount to zero. Called before request is parsed.
static
ngx_http_traffic_send_context_t
ngx_http_traffic_filter_create_question (ngx_http_request_t *request, long long traffic, ngx_pool_t *pool)
 Creates packet, sends traffic and headers.
static void ngx_traffic_dummy_handler (ngx_event_t *ev)
 Doesn't do anything, filler for write/read handlers.
static void ngx_http_traffic_deallocate_context (ngx_http_traffic_send_context_t *context)
 destroys local memmory pool.
static void ngx_http_traffic_read_handler (ngx_event_t *read_event)
 Handles connection errors, doesn't read anything.
static void ngx_http_traffic_write_handler (ngx_event_t *write_event)
 Writes packet then calls ngx_http_traffic_deallocate_context.
static ngx_int_t ngx_http_traffic_body_filter (ngx_http_request_t *r, ngx_chain_t *in)
 Collects amount of data to be send, finally, sends them.

Variables

static ngx_command_t ngx_http_traffic_filter_commands []
static ngx_http_module_t ngx_http_traffic_filter_module_ctx
static
ngx_http_output_header_filter_pt 
ngx_http_next_header_filter
static
ngx_http_output_body_filter_pt 
ngx_http_next_body_filter
ngx_module_t ngx_http_traffic_filter_module

Function Documentation

static ngx_int_t ngx_http_traffic_body_filter ( ngx_http_request_t *  r,
ngx_chain_t *  in 
) [static]

Collects amount of data to be send, finally, sends them.

static void * ngx_http_traffic_create_conf ( ngx_conf_t *  cf  )  [static]

Creates module configuration.

static void ngx_http_traffic_deallocate_context ( ngx_http_traffic_send_context_t context  )  [static]

destroys local memmory pool.

static ngx_int_t ngx_http_traffic_filter ( ngx_http_request_t *  r  )  [static]

Creates traffic context, sets data amount to zero. Called before request is parsed.

static ngx_http_traffic_send_context_t* ngx_http_traffic_filter_create_question ( ngx_http_request_t *  request,
long long  traffic,
ngx_pool_t *  pool 
) [static]

Creates packet, sends traffic and headers.

static ngx_int_t ngx_http_traffic_filter_init ( ngx_conf_t *  cf  )  [static]

Called by nginx, attachs filter to filter list.

static char * ngx_http_traffic_merge_conf ( ngx_conf_t *  cf,
void *  parent,
void *  child 
) [static]

Merges module config, allocates local pool.

static void ngx_http_traffic_read_handler ( ngx_event_t *  read_event  )  [static]

Handles connection errors, doesn't read anything.

static void ngx_http_traffic_write_handler ( ngx_event_t *  write_event  )  [static]

Writes packet then calls ngx_http_traffic_deallocate_context.

static void ngx_traffic_dummy_handler ( ngx_event_t *  ev  )  [static]

Doesn't do anything, filler for write/read handlers.


Variable Documentation

ngx_http_output_body_filter_pt ngx_http_next_body_filter [static]

static ngx_http_output_header_filter_pt ngx_http_next_header_filter [static]

ngx_command_t ngx_http_traffic_filter_commands[] [static]

Initial value:

 { 
        NGX_MODULE_V1, 
        &ngx_http_traffic_filter_module_ctx, 
        ngx_http_traffic_filter_commands, 
        NGX_HTTP_MODULE, 
        NULL, 
        NULL, 
        NULL, 
        NULL, 
        NULL, 
        NULL, 
        NULL, 
        NGX_MODULE_V1_PADDING 
}

ngx_http_module_t ngx_http_traffic_filter_module_ctx [static]


Generated on Thu Oct 22 16:31:17 2009 for Nginx limit related modules by  doxygen 1.5.6