xref: /PHP-8.2/ext/xsl/php_xsl.h (revision 01b3fc03)
1 /*
2   +----------------------------------------------------------------------+
3   | Copyright (c) The PHP Group                                          |
4   +----------------------------------------------------------------------+
5   | This source file is subject to version 3.01 of the PHP license,      |
6   | that is bundled with this package in the file LICENSE, and is        |
7   | available through the world-wide-web at the following url:           |
8   | https://www.php.net/license/3_01.txt                                 |
9   | If you did not receive a copy of the PHP license and are unable to   |
10   | obtain it through the world-wide-web, please send a note to          |
11   | license@php.net so we can mail you a copy immediately.               |
12   +----------------------------------------------------------------------+
13   | Author:                                                              |
14   +----------------------------------------------------------------------+
15 */
16 
17 #ifndef PHP_XSL_H
18 #define PHP_XSL_H
19 
20 extern zend_module_entry xsl_module_entry;
21 #define phpext_xsl_ptr &xsl_module_entry
22 
23 #include "php_version.h"
24 #define PHP_XSL_VERSION PHP_VERSION
25 
26 #ifdef ZTS
27 #include "TSRM.h"
28 #endif
29 
30 #include <libxslt/xsltconfig.h>
31 #include <libxslt/xsltInternals.h>
32 #include <libxslt/xsltutils.h>
33 #include <libxslt/transform.h>
34 #include <libxslt/security.h>
35 #ifdef HAVE_XSL_EXSLT
36 #include <libexslt/exslt.h>
37 #include <libexslt/exsltconfig.h>
38 #endif
39 
40 #include "../dom/xml_common.h"
41 
42 #include <libxslt/extensions.h>
43 #include <libxml/xpathInternals.h>
44 
45 #define XSL_SECPREF_NONE 0
46 #define XSL_SECPREF_READ_FILE 2
47 #define XSL_SECPREF_WRITE_FILE 4
48 #define XSL_SECPREF_CREATE_DIRECTORY 8
49 #define XSL_SECPREF_READ_NETWORK 16
50 #define XSL_SECPREF_WRITE_NETWORK 32
51 /* Default == disable all write access ==  XSL_SECPREF_WRITE_NETWORK | XSL_SECPREF_CREATE_DIRECTORY | XSL_SECPREF_WRITE_FILE */
52 #define XSL_SECPREF_DEFAULT 44
53 
54 typedef struct _xsl_object {
55 	void *ptr;
56 	HashTable *prop_handler;
57 	zval handle;
58 	HashTable *parameter;
59 	int hasKeys;
60 	int registerPhpFunctions;
61 	HashTable *registered_phpfunctions;
62 	HashTable *node_list;
63 	php_libxml_node_object *doc;
64 	char *profiling;
65 	zend_long securityPrefs;
66 	int securityPrefsSet;
67 	zend_object  std;
68 } xsl_object;
69 
php_xsl_fetch_object(zend_object * obj)70 static inline xsl_object *php_xsl_fetch_object(zend_object *obj) {
71 	return (xsl_object *)((char*)(obj) - XtOffsetOf(xsl_object, std));
72 }
73 
74 #define Z_XSL_P(zv) php_xsl_fetch_object(Z_OBJ_P((zv)))
75 
76 void php_xsl_set_object(zval *wrapper, void *obj);
77 void xsl_objects_free_storage(zend_object *object);
78 void php_xsl_create_object(xsltStylesheetPtr obj, zval *wrapper_in, zval *return_value );
79 
80 void xsl_ext_function_string_php(xmlXPathParserContextPtr ctxt, int nargs);
81 void xsl_ext_function_object_php(xmlXPathParserContextPtr ctxt, int nargs);
82 
83 PHP_MINIT_FUNCTION(xsl);
84 PHP_MSHUTDOWN_FUNCTION(xsl);
85 PHP_RINIT_FUNCTION(xsl);
86 PHP_RSHUTDOWN_FUNCTION(xsl);
87 PHP_MINFO_FUNCTION(xsl);
88 
89 #endif	/* PHP_XSL_H */
90