src/http/modules/xxslt/ngx_http_xxslt_selector.c File Reference

#include "ngx_http_xxslt_selector.h"

Go to the source code of this file.

Functions

static  ngx_int_t ngx_http_xxslt_selector_unknown_match (ngx_http_xxslt_selector_data_t *ctx, ngx_chain_t *ch_beg, ngx_chain_t *ch_end, u_char *beg, u_char *end, ngx_int_t last_in_chain)
 Processes any data other than xslt.
static ngx_int_t ngx_http_xxslt_selector_parse_match (ngx_http_xxslt_selector_data_t *ctx, ngx_chain_t *ch_beg, ngx_chain_t *ch_end, u_char *beg, u_char *end, ngx_int_t last_in_chain)
 Processes data between our tags.
static ngx_int_t ngx_http_xxslt_selector_add_unknown (ngx_http_request_t *r, ngx_chain_t *in, ngx_http_xxslt_out_data_t *out)
 Creates module specific structure, and forward data to unknown data module.
static ngx_int_t ngx_http_xxslt_selector_add_parse (ngx_http_request_t *r, ngx_chain_t *in, ngx_http_xxslt_out_data_t *out, ngx_http_xxslt_selector_data_t *sel_ctx)
 Creates module specific structure, and forward data to parse module.
static ngx_chain_t * ngx_http_xxslt_selector_prepare_in (ngx_http_request_t *r, ngx_chain_t *ch_beg, ngx_chain_t *ch_end, u_char *buf_beg, u_char *buf_end, ngx_int_t last_in_chain)
 Copies selected data from chain link.
static void ngx_http_xxslt_selector_set_pos (ngx_http_request_t *r, ngx_chain_t *in)
 Sets pos = last in every buffer in chain link.
ngx_http_xxslt_selector_data_tngx_http_xxslt_selector_init (ngx_http_request_t *r)
 Allocates and initializes selector structure.
ngx_int_t ngx_http_xxslt_selector_add_data_chunk (ngx_http_xxslt_selector_data_t *ctx, ngx_chain_t *in)
 Adds new data chunk to selector.
void ngx_http_xxslt_selector_log_chain (ngx_http_request_t *r, ngx_chain_t *cl, u_char *label)
 Helper function - writes chain to log-file.
void ngx_http_xxslt_selector_cleanup (ngx_http_xxslt_selector_data_t *sel_ctx)
 Frees all resources allocated by selector.

Function Documentation

ngx_int_t ngx_http_xxslt_selector_add_data_chunk ( ngx_http_xxslt_selector_data_t ctx,
ngx_chain_t *  in 
)
static ngx_int_t ngx_http_xxslt_selector_add_parse ( ngx_http_request_t *  r,
ngx_chain_t *  in,
ngx_http_xxslt_out_data_t out,
ngx_http_xxslt_selector_data_t sel_ctx 
) [static]

Creates module specific structure, and forward data to parse module.

Parameters:
r nginx http request
in data to forward
out output data structure
sel_ctx selector structure
Returns:
NGX_*

Definition at line 616 of file ngx_http_xxslt_selector.c.

References ngx_http_xxslt_out_data_s::id, ngx_http_xxslt_parse_data_t::id, ngx_http_xxslt_selector_data_t::includes, ngx_http_xxslt_parse_data_t::includes, ngx_http_xxslt_parse_add_data_chunk(), ngx_http_xxslt_parse_create_new(), ngx_http_xxslt_out_data_s::parse, and ngx_http_xxslt_parse_data_t::r.

Referenced by ngx_http_xxslt_selector_parse_match().

static ngx_int_t ngx_http_xxslt_selector_add_unknown ( ngx_http_request_t *  r,
ngx_chain_t *  in,
ngx_http_xxslt_out_data_t out 
) [static]

Creates module specific structure, and forward data to unknown data module.

Parameters:
r nginx http request
in data to forward
out output data structure
Returns:
NGX_OK or NGX_ERROR on error

Definition at line 588 of file ngx_http_xxslt_selector.c.

References ngx_http_xxslt_out_data_s::id, ngx_http_xxslt_unknown_data_t::id, ngx_http_xxslt_unknown_add_data_chunk(), ngx_http_xxslt_unknown_create_new(), ngx_http_xxslt_unknown_data_t::r, and ngx_http_xxslt_out_data_s::unknown.

Referenced by ngx_http_xxslt_selector_unknown_match().

void ngx_http_xxslt_selector_cleanup ( ngx_http_xxslt_selector_data_t sel_ctx  ) 

Frees all resources allocated by selector.

Parameters:
sel_ctx selector structure

Definition at line 657 of file ngx_http_xxslt_selector.c.

References ngx_http_xxslt_selector_data_t::includes.

Referenced by ngx_http_xxslt_cleanup().

ngx_http_xxslt_selector_data_t* ngx_http_xxslt_selector_init ( ngx_http_request_t *  r  ) 
void ngx_http_xxslt_selector_log_chain ( ngx_http_request_t *  r,
ngx_chain_t *  cl,
u_char *  label 
)

Helper function - writes chain to log-file.

Parameters:
r nginx http request
cl chain link
label additional string that will appear in logs

Definition at line 343 of file ngx_http_xxslt_selector.c.

static ngx_int_t ngx_http_xxslt_selector_parse_match ( ngx_http_xxslt_selector_data_t ctx,
ngx_chain_t *  ch_beg,
ngx_chain_t *  ch_end,
u_char *  beg,
u_char *  end,
ngx_int_t  last_in_chain 
) [static]

Processes data between our tags.

Gets the start and end of the data and forward it to parse module.

Parameters:
ctx selector structure
ch_beg first buffer
ch_end last buffer
beg position in first buffer
end position in last buffer
last_in_chain if set to 1 then buf->last_in_chain flag will be set
Returns:
NGX_OK or NGX_ERROR on error

Definition at line 435 of file ngx_http_xxslt_selector.c.

References ngx_http_xxslt_selector_data_t::act_out_data_parse, ngx_http_xxslt_selector_data_t::act_out_data_unknown, ngx_http_xxslt_selector_data_t::async, ngx_http_xxslt_out_data_s::data_type, ngx_http_xxslt_out_data_s::id, ngx_http_xxslt_selector_data_t::id_data, ngx_http_xxslt_enqueue_data(), ngx_http_xxslt_selector_add_parse(), NGX_HTTP_XXSLT_SELECTOR_PARSE, ngx_http_xxslt_selector_prepare_in(), ngx_http_xxslt_out_data_s::r, and ngx_http_xxslt_selector_data_t::r.

Referenced by ngx_http_xxslt_selector_add_data_chunk().

static ngx_chain_t * ngx_http_xxslt_selector_prepare_in ( ngx_http_request_t *  r,
ngx_chain_t *  ch_beg,
ngx_chain_t *  ch_end,
u_char *  buf_beg,
u_char *  buf_end,
ngx_int_t  last_in_chain 
) [static]

Copies selected data from chain link.

Todo:
division without copying the data buffers (note the nginx policy regarding the input buffers)
Parameters:
r nginx http request
ch_beg first buffer
ch_end last buffer
buf_beg position in first buffer
buf_end position in last buffer
last_in_chain if set to 1 then buf->last_in_chain flag will be set
Returns:
new chain link

Definition at line 505 of file ngx_http_xxslt_selector.c.

Referenced by ngx_http_xxslt_selector_add_data_chunk(), ngx_http_xxslt_selector_parse_match(), and ngx_http_xxslt_selector_unknown_match().

static void ngx_http_xxslt_selector_set_pos ( ngx_http_request_t *  r,
ngx_chain_t *  in 
) [static]

Sets pos = last in every buffer in chain link.

It's required by nginx to obtain that buffers are fully processed.

Definition at line 642 of file ngx_http_xxslt_selector.c.

Referenced by ngx_http_xxslt_selector_add_data_chunk().

static ngx_int_t ngx_http_xxslt_selector_unknown_match ( ngx_http_xxslt_selector_data_t ctx,
ngx_chain_t *  ch_beg,
ngx_chain_t *  ch_end,
u_char *  beg,
u_char *  end,
ngx_int_t  last_in_chain 
) [static]

Processes any data other than xslt.

Gets the start and end of the data and forward it to data module.

Parameters:
ctx selector structure
ch_beg first buffer
ch_end last buffer
beg position in first buffer
end position in last buffer
last_in_chain if set to 1 then buf->last_in_chain flag will be set
Returns:
NGX_OK or NGX_ERROR on error

Definition at line 373 of file ngx_http_xxslt_selector.c.

References ngx_http_xxslt_selector_data_t::act_out_data_parse, ngx_http_xxslt_selector_data_t::act_out_data_unknown, ngx_http_xxslt_out_data_s::data_type, ngx_http_xxslt_out_data_s::id, ngx_http_xxslt_selector_data_t::id_data, ngx_http_xxslt_enqueue_data(), ngx_http_xxslt_selector_add_unknown(), ngx_http_xxslt_selector_prepare_in(), NGX_HTTP_XXSLT_SELECTOR_UNKNOWN, ngx_http_xxslt_out_data_s::r, and ngx_http_xxslt_selector_data_t::r.

Referenced by ngx_http_xxslt_selector_add_data_chunk().


Generated on Mon Oct 12 14:03:36 2009 for XXSLT by  doxygen 1.6.1