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