00001 /* 00002 * Copyright 2009 DreamLab Onet.pl Sp. z o.o. 00003 * Licensed under the Apache License, Version 2.0 (the "License"); 00004 * you may not use this file except in compliance with the License. 00005 * You may obtain a copy of the License at 00006 * 00007 * http://www.apache.org/licenses/LICENSE-2.0 00008 * 00009 * Unless required by applicable law or agreed to in writing, software 00010 * distributed under the License is distributed on an "AS IS" BASIS, 00011 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00012 * See the License for the specific language governing permissions and 00013 * limitations under the License. 00014 * 00015 * 00016 * Authors: 00017 * Piotr Janik, email: janik.piotrek(malpa)gmail.com 00018 * Przemyslaw Gajda, email: quermit(malpa)gmail.com 00019 * malpa = @ 00020 */ 00021 00022 #ifndef NGX_HTTP_XSLT2_XML_H_ 00023 #define NGX_HTTP_XSLT2_XML_H_ 00024 00025 #include <ngx_config.h> 00026 #include <ngx_core.h> 00027 #include <ngx_http.h> 00028 00029 #include <libxml/tree.h> 00030 #include <libxml/parser.h> 00031 #include <libxslt/xsltInternals.h> 00032 #include <libxslt/transform.h> 00033 #include <libxslt/xsltutils.h> 00034 #include <libxslt/xslt.h> 00035 00036 #include <download/ngx_http_download_module.h> 00037 #include <download/ngx_http_filesync.h> 00038 #include <mxcache/ngx_http_mxcache_module.h> 00039 00040 00041 #define XML_GENERAL_ERR 1 00042 #define XML_STYLESHEET_ERR 2 00043 #define XML_NO_STYLESHEETS 3 00044 00045 00046 typedef struct ngx_http_xslt2_sheet_s ngx_http_xslt2_sheet_t; 00047 00049 typedef struct { 00050 ngx_int_t id; 00052 ngx_http_request_t *r; 00053 00055 xmlDocPtr doc; 00057 xmlParserCtxtPtr ctxt; 00059 xmlSAXHandler *sax; 00060 00062 ngx_http_xslt2_sheet_t *sheets; 00063 ngx_http_xslt2_sheet_t *act_sheet; 00064 ngx_http_xslt2_sheet_t *sheets_tail; 00065 ngx_int_t sheets_n; 00066 00068 ngx_int_t dl_in_progress; 00070 ngx_flag_t xml_ready; 00071 00073 ngx_chain_t *buffer_chain; 00075 ngx_int_t res_len; 00076 00078 char *libxml_error; 00079 00081 ngx_int_t stylesheet_err; 00082 u_char *stylesheet_err_msg; 00083 00085 ngx_uint_t done; 00086 } ngx_http_xslt2_xml_data_t; 00087 00089 struct ngx_http_xslt2_sheet_s { 00090 ngx_int_t id; 00091 00093 u_char *res_uri; 00094 00096 ngx_chain_t *buffer_chain; 00098 xsltStylesheetPtr stylesheet; 00099 00101 ngx_flag_t ready; 00102 00104 ngx_http_download_conn_t *download; 00106 ngx_http_mxcache_conn_t *xcache_get; 00107 00109 ngx_http_xslt2_xml_data_t *parent_xml; 00111 ngx_http_xslt2_sheet_t *next; 00112 }; 00113 00114 ngx_http_xslt2_xml_data_t * ngx_http_xslt2_xml_create_new(); 00115 ngx_int_t ngx_http_xslt2_xml_add_data_chunk(ngx_http_xslt2_xml_data_t *xml_data, ngx_chain_t *in); 00116 void ngx_http_xslt2_xml_cleanup(ngx_http_xslt2_xml_data_t *xml_data); 00117 00118 #endif /* NGX_HTTP_XSLT2_XML_H_ */