#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_t * | ngx_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. |
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.
Parse/any: divides data into chunks and forwards to the relevant modules. XML: forwards data to xml module.
ctx | selector structure | |
in | input chain |
Definition at line 107 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::backup_in, ngx_http_xxslt_selector_match_t::buf_before, ngx_http_xxslt_selector_match_t::c_len, ngx_http_xxslt_selector_match_t::c_pos, ngx_http_xxslt_selector_match_t::cl_before, ngx_http_xxslt_selector_match_t::close, ngx_http_xxslt_out_data_s::last, ngx_http_xxslt_selector_data_t::match_data, NGX_HTTP_XXSLT_MATCH_CLOSE, NGX_HTTP_XXSLT_MATCH_OPEN, ngx_http_xxslt_process_data(), NGX_HTTP_XXSLT_SELECTOR_PARSE, ngx_http_xxslt_selector_parse_match(), ngx_http_xxslt_selector_prepare_in(), ngx_http_xxslt_selector_set_pos(), NGX_HTTP_XXSLT_SELECTOR_UNKNOWN, ngx_http_xxslt_selector_unknown_match(), ngx_http_xxslt_selector_match_t::o_len, ngx_http_xxslt_selector_match_t::o_pos, ngx_http_xxslt_selector_match_t::open, ngx_http_xxslt_selector_data_t::r, ngx_http_xxslt_selector_data_t::select_mode, and ngx_http_xxslt_selector_match_t::state.
Referenced by ngx_http_xxslt_body_filter().
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.
r | nginx http request | |
in | data to forward | |
out | output data structure | |
sel_ctx | selector structure |
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.
r | nginx http request | |
in | data to forward | |
out | output data structure |
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.
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 | ) |
Allocates and initializes selector structure.
Uses request pool to allocate structure.
r | nginx http request |
Definition at line 53 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::backup_in, ngx_http_xxslt_selector_match_t::c_len, ngx_http_xxslt_selector_match_t::close, ngx_http_xxslt_selector_data_t::id_data, ngx_http_xxslt_selector_data_t::includes, ngx_http_xxslt_selector_data_t::match_data, NGX_HTTP_XXSLT_MATCH_OPEN, NGX_HTTP_XXSLT_SELECTOR_UNKNOWN, ngx_http_xxslt_selector_match_t::o_len, ngx_http_xxslt_selector_match_t::open, ngx_http_xxslt_selector_data_t::r, ngx_http_xxslt_selector_data_t::select_mode, and ngx_http_xxslt_selector_match_t::state.
Referenced by ngx_http_xxslt_body_filter().
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.
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.
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 |
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.
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 |
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.
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 |
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().