xref: /PHP-7.0/ext/soap/php_encoding.h (revision 478f119a)
1 /*
2   +----------------------------------------------------------------------+
3   | PHP Version 7                                                        |
4   +----------------------------------------------------------------------+
5   | Copyright (c) 1997-2017 The PHP Group                                |
6   +----------------------------------------------------------------------+
7   | This source file is subject to version 3.01 of the PHP license,      |
8   | that is bundled with this package in the file LICENSE, and is        |
9   | available through the world-wide-web at the following url:           |
10   | http://www.php.net/license/3_01.txt                                  |
11   | If you did not receive a copy of the PHP license and are unable to   |
12   | obtain it through the world-wide-web, please send a note to          |
13   | license@php.net so we can mail you a copy immediately.               |
14   +----------------------------------------------------------------------+
15   | Authors: Brad Lafountain <rodif_bl@yahoo.com>                        |
16   |          Shane Caraveo <shane@caraveo.com>                           |
17   |          Dmitry Stogov <dmitry@zend.com>                             |
18   +----------------------------------------------------------------------+
19 */
20 /* $Id$ */
21 
22 #ifndef PHP_ENCODING_H
23 #define PHP_ENCODING_H
24 
25 #define XSD_1999_NAMESPACE "http://www.w3.org/1999/XMLSchema"
26 #define XSD_1999_TIMEINSTANT 401
27 #define XSD_1999_TIMEINSTANT_STRING "timeInstant"
28 
29 #define SOAP_1_1_ENV_NAMESPACE "http://schemas.xmlsoap.org/soap/envelope/"
30 #define SOAP_1_1_ENV_NS_PREFIX "SOAP-ENV"
31 
32 #define SOAP_1_2_ENV_NAMESPACE "http://www.w3.org/2003/05/soap-envelope"
33 #define SOAP_1_2_ENV_NS_PREFIX "env"
34 
35 #define SOAP_1_1_ENC_NAMESPACE "http://schemas.xmlsoap.org/soap/encoding/"
36 #define SOAP_1_1_ENC_NS_PREFIX "SOAP-ENC"
37 
38 #define SOAP_1_2_ENC_NAMESPACE "http://www.w3.org/2003/05/soap-encoding"
39 #define SOAP_1_2_ENC_NS_PREFIX "enc"
40 
41 #define SCHEMA_NAMESPACE "http://www.w3.org/2001/XMLSchema"
42 #define XSD_NAMESPACE "http://www.w3.org/2001/XMLSchema"
43 #define XSD_NS_PREFIX "xsd"
44 #define XSI_NAMESPACE "http://www.w3.org/2001/XMLSchema-instance"
45 #define XSI_NS_PREFIX "xsi"
46 #define XML_NAMESPACE "http://www.w3.org/XML/1998/namespace"
47 #define XML_NS_PREFIX "xml"
48 
49 #define XSD_STRING 101
50 #define XSD_STRING_STRING "string"
51 #define XSD_BOOLEAN 102
52 #define XSD_BOOLEAN_STRING "boolean"
53 #define XSD_DECIMAL 103
54 #define XSD_DECIMAL_STRING "decimal"
55 #define XSD_FLOAT 104
56 #define XSD_FLOAT_STRING "float"
57 #define XSD_DOUBLE 105
58 #define XSD_DOUBLE_STRING "double"
59 #define XSD_DURATION 106
60 #define XSD_DURATION_STRING "duration"
61 #define XSD_DATETIME 107
62 #define XSD_DATETIME_STRING "dateTime"
63 #define XSD_TIME 108
64 #define XSD_TIME_STRING "time"
65 #define XSD_DATE 109
66 #define XSD_DATE_STRING "date"
67 #define XSD_GYEARMONTH 110
68 #define XSD_GYEARMONTH_STRING "gYearMonth"
69 #define XSD_GYEAR 111
70 #define XSD_GYEAR_STRING "gYear"
71 #define XSD_GMONTHDAY 112
72 #define XSD_GMONTHDAY_STRING "gMonthDay"
73 #define XSD_GDAY 113
74 #define XSD_GDAY_STRING "gDay"
75 #define XSD_GMONTH 114
76 #define XSD_GMONTH_STRING "gMonth"
77 #define XSD_HEXBINARY 115
78 #define XSD_HEXBINARY_STRING "hexBinary"
79 #define XSD_BASE64BINARY 116
80 #define XSD_BASE64BINARY_STRING "base64Binary"
81 #define XSD_ANYURI 117
82 #define XSD_ANYURI_STRING "anyURI"
83 #define XSD_QNAME 118
84 #define XSD_QNAME_STRING "QName"
85 #define XSD_NOTATION 119
86 #define XSD_NOTATION_STRING "NOTATION"
87 #define XSD_NORMALIZEDSTRING 120
88 #define XSD_NORMALIZEDSTRING_STRING "normalizedString"
89 #define XSD_TOKEN 121
90 #define XSD_TOKEN_STRING "token"
91 #define XSD_LANGUAGE 122
92 #define XSD_LANGUAGE_STRING "language"
93 #define XSD_NMTOKEN 123
94 #define XSD_NMTOKEN_STRING "NMTOKEN"
95 #define XSD_NAME 124
96 #define XSD_NAME_STRING "Name"
97 #define XSD_NCNAME 125
98 #define XSD_NCNAME_STRING "NCName"
99 #define XSD_ID 126
100 #define XSD_ID_STRING "ID"
101 #define XSD_IDREF 127
102 #define XSD_IDREF_STRING "IDREF"
103 #define XSD_IDREFS 128
104 #define XSD_IDREFS_STRING "IDREFS"
105 #define XSD_ENTITY 129
106 #define XSD_ENTITY_STRING "ENTITY"
107 #define XSD_ENTITIES 130
108 #define XSD_ENTITIES_STRING "ENTITIES"
109 #define XSD_INTEGER 131
110 #define XSD_INTEGER_STRING "integer"
111 #define XSD_NONPOSITIVEINTEGER 132
112 #define XSD_NONPOSITIVEINTEGER_STRING "nonPositiveInteger"
113 #define XSD_NEGATIVEINTEGER 133
114 #define XSD_NEGATIVEINTEGER_STRING "negativeInteger"
115 #define XSD_LONG 134
116 #define XSD_LONG_STRING "long"
117 #define XSD_INT 135
118 #define XSD_INT_STRING "int"
119 #define XSD_SHORT 136
120 #define XSD_SHORT_STRING "short"
121 #define XSD_BYTE 137
122 #define XSD_BYTE_STRING "byte"
123 #define XSD_NONNEGATIVEINTEGER 138
124 #define XSD_NONNEGATIVEINTEGER_STRING "nonNegativeInteger"
125 #define XSD_UNSIGNEDLONG 139
126 #define XSD_UNSIGNEDLONG_STRING "unsignedLong"
127 #define XSD_UNSIGNEDINT 140
128 #define XSD_UNSIGNEDINT_STRING "unsignedInt"
129 #define XSD_UNSIGNEDSHORT 141
130 #define XSD_UNSIGNEDSHORT_STRING "unsignedShort"
131 #define XSD_UNSIGNEDBYTE 142
132 #define XSD_UNSIGNEDBYTE_STRING "unsignedByte"
133 #define XSD_POSITIVEINTEGER 143
134 #define XSD_POSITIVEINTEGER_STRING "positiveInteger"
135 #define XSD_NMTOKENS 144
136 #define XSD_NMTOKENS_STRING "NMTOKENS"
137 #define XSD_ANYTYPE 145
138 #define XSD_ANYTYPE_STRING "anyType"
139 #define XSD_UR_TYPE 146
140 #define XSD_UR_TYPE_STRING "ur-type"
141 
142 #define XSD_ANYXML 147
143 
144 #define APACHE_NAMESPACE "http://xml.apache.org/xml-soap"
145 #define APACHE_MAP 200
146 #define APACHE_MAP_STRING "Map"
147 
148 #define SOAP_ENC_ARRAY 300
149 #define SOAP_ENC_ARRAY_STRING "Array"
150 #define SOAP_ENC_OBJECT 301
151 #define SOAP_ENC_OBJECT_STRING "Struct"
152 
153 #define WSDL_NAMESPACE "http://schemas.xmlsoap.org/wsdl/"
154 #define WSDL_NS_PREFIX "wsdl"
155 
156 #define WSDL_SOAP11_NAMESPACE "http://schemas.xmlsoap.org/wsdl/soap/"
157 #define WSDL_SOAP12_NAMESPACE "http://schemas.xmlsoap.org/wsdl/soap12/"
158 #define RPC_SOAP12_NAMESPACE  "http://www.w3.org/2003/05/soap-rpc"
159 #define RPC_SOAP12_NS_PREFIX  "rpc"
160 
161 #define WSDL_HTTP11_NAMESPACE "http://schemas.xmlsoap.org/wsdl/http/"
162 #define WSDL_HTTP12_NAMESPACE	"http://www.w3.org/2003/05/soap/bindings/HTTP/"
163 #define WSDL_HTTP_NS_PREFIX "http"
164 
165 #define WSDL_HTTP_TRANSPORT "http://schemas.xmlsoap.org/soap/http"
166 
167 #define WSDL_MIME_NAMESPACE "http://schemas.xmlsoap.org/wsdl/mime/"
168 
169 #define WSDL_DIME_NAMESPACE "http://schemas.xmlsoap.org/ws/2002/04/dime/wsdl/"
170 #define WSDL_DIME_OPEN      "http://schemas.xmlsoap.org/ws/2002/04/dime/open-layout"
171 #define WSDL_DIME_CLOSED    "http://schemas.xmlsoap.org/ws/2002/04/dime/closed-layout"
172 
173 #define UNKNOWN_TYPE 999998
174 #define END_KNOWN_TYPES 999999
175 
176 struct _encodeType {
177 	int type;
178 	char *type_str;
179 	char *ns;
180 	sdlTypePtr sdl_type;
181 	soapMappingPtr map;
182 };
183 
184 struct _encode {
185 	encodeType details;
186 	zval *(*to_zval)(zval *ret, encodeTypePtr type, xmlNodePtr data);
187 	xmlNodePtr (*to_xml)(encodeTypePtr type, zval *data, int style, xmlNodePtr parent);
188 };
189 
190 /* Master functions all encode/decode should be called thur these functions */
191 xmlNodePtr master_to_xml(encodePtr encode, zval *data, int style, xmlNodePtr parent);
192 zval *master_to_zval(zval *ret, encodePtr encode, xmlNodePtr data);
193 
194 /* user defined mapping */
195 xmlNodePtr to_xml_user(encodeTypePtr type, zval *data, int style, xmlNodePtr parent);
196 zval *to_zval_user(zval *ret, encodeTypePtr type, xmlNodePtr node);
197 
198 void whiteSpace_replace(xmlChar* str);
199 void whiteSpace_collapse(xmlChar* str);
200 
201 xmlNodePtr sdl_guess_convert_xml(encodeTypePtr enc, zval* data, int style, xmlNodePtr parent);
202 zval *sdl_guess_convert_zval(zval *ret, encodeTypePtr enc, xmlNodePtr data);
203 
204 void encode_finish();
205 void encode_reset_ns();
206 xmlNsPtr encode_add_ns(xmlNodePtr node, const char* ns);
207 
208 encodePtr get_conversion(int encode);
209 
210 void delete_encoder(zval *zv);
211 void delete_encoder_persistent(zval *zv);
212 
213 extern encode defaultEncoding[];
214 extern int numDefaultEncodings;
215 
216 #endif
217