1 /* 2 +----------------------------------------------------------------------+ 3 | PHP Version 7 | 4 +----------------------------------------------------------------------+ 5 | Copyright (c) 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_SDL_H 22 #define PHP_SDL_H 23 24 #define XSD_WHITESPACE_COLLAPSE 1 25 #define XSD_WHITESPACE_PRESERVE 1 26 #define XSD_WHITESPACE_REPLACE 1 27 28 typedef enum _sdlBindingType { 29 BINDING_SOAP = 1, 30 BINDING_HTTP = 2 31 } sdlBindingType; 32 33 typedef enum _sdlEncodingStyle { 34 SOAP_RPC = 1, 35 SOAP_DOCUMENT = 2 36 } sdlEncodingStyle; 37 38 typedef enum _sdlRpcEncodingStyle { 39 SOAP_ENCODING_DEFAULT = 0, 40 SOAP_ENCODING_1_1 = 1, 41 SOAP_ENCODING_1_2 = 2 42 } sdlRpcEncodingStyle; 43 44 typedef enum _sdlEncodingUse { 45 SOAP_ENCODED = 1, 46 SOAP_LITERAL = 2 47 } sdlEncodingUse; 48 49 typedef enum _sdlTransport { 50 SOAP_TRANSPORT_HTTP = 1 51 } sdlTransport; 52 53 struct _sdl { 54 HashTable functions; /* array of sdlFunction */ 55 HashTable *types; /* array of sdlTypesPtr */ 56 HashTable *elements; /* array of sdlTypesPtr */ 57 HashTable *encoders; /* array of encodePtr */ 58 HashTable *bindings; /* array of sdlBindings (key'd by name) */ 59 HashTable *requests; /* array of sdlFunction (references) */ 60 HashTable *groups; /* array of sdlTypesPtr */ 61 char *target_ns; 62 char *source; 63 zend_bool is_persistent; 64 }; 65 66 typedef struct sdlCtx { 67 sdlPtr sdl; 68 69 HashTable docs; /* array of xmlDocPtr */ 70 71 HashTable messages; /* array of xmlNodePtr */ 72 HashTable bindings; /* array of xmlNodePtr */ 73 HashTable portTypes; /* array of xmlNodePtr */ 74 HashTable services; /* array of xmlNodePtr */ 75 76 HashTable *attributes; /* array of sdlAttributePtr */ 77 HashTable *attributeGroups; /* array of sdlTypesPtr */ 78 php_stream_context *context; 79 zval old_header; 80 } sdlCtx; 81 82 struct _sdlBinding { 83 char *name; 84 char *location; 85 sdlBindingType bindingType; 86 void *bindingAttributes; /* sdlSoapBindingPtr */ 87 }; 88 89 /* Soap Binding Specific stuff */ 90 struct _sdlSoapBinding { 91 sdlEncodingStyle style; 92 sdlTransport transport; /* not implemented yet */ 93 }; 94 95 typedef struct _sdlSoapBindingFunctionHeader { 96 char *name; 97 char *ns; 98 sdlEncodingUse use; 99 sdlTypePtr element; 100 encodePtr encode; 101 sdlRpcEncodingStyle encodingStyle; /* not implemented yet */ 102 HashTable *headerfaults; /* array of sdlSoapBindingFunctionHeaderPtr */ 103 } sdlSoapBindingFunctionHeader, *sdlSoapBindingFunctionHeaderPtr; 104 105 typedef struct _sdlSoapBindingFunctionFault { 106 char *ns; 107 sdlEncodingUse use; 108 sdlRpcEncodingStyle encodingStyle; /* not implemented yet */ 109 } sdlSoapBindingFunctionFault, *sdlSoapBindingFunctionFaultPtr; 110 111 struct _sdlSoapBindingFunctionBody { 112 char *ns; 113 sdlEncodingUse use; 114 sdlRpcEncodingStyle encodingStyle; /* not implemented yet */ 115 HashTable *headers; /* array of sdlSoapBindingFunctionHeaderPtr */ 116 }; 117 118 struct _sdlSoapBindingFunction { 119 char *soapAction; 120 sdlEncodingStyle style; 121 122 sdlSoapBindingFunctionBody input; 123 sdlSoapBindingFunctionBody output; 124 }; 125 126 struct _sdlRestrictionInt { 127 int value; 128 char fixed; 129 }; 130 131 struct _sdlRestrictionChar { 132 char *value; 133 char fixed; 134 }; 135 136 struct _sdlRestrictions { 137 HashTable *enumeration; /* array of sdlRestrictionCharPtr */ 138 sdlRestrictionIntPtr minExclusive; 139 sdlRestrictionIntPtr minInclusive; 140 sdlRestrictionIntPtr maxExclusive; 141 sdlRestrictionIntPtr maxInclusive; 142 sdlRestrictionIntPtr totalDigits; 143 sdlRestrictionIntPtr fractionDigits; 144 sdlRestrictionIntPtr length; 145 sdlRestrictionIntPtr minLength; 146 sdlRestrictionIntPtr maxLength; 147 sdlRestrictionCharPtr whiteSpace; 148 sdlRestrictionCharPtr pattern; 149 }; 150 151 typedef enum _sdlContentKind { 152 XSD_CONTENT_ELEMENT, 153 XSD_CONTENT_SEQUENCE, 154 XSD_CONTENT_ALL, 155 XSD_CONTENT_CHOICE, 156 XSD_CONTENT_GROUP_REF, 157 XSD_CONTENT_GROUP, 158 XSD_CONTENT_ANY 159 } sdlContentKind; 160 161 162 typedef struct _sdlContentModel sdlContentModel, *sdlContentModelPtr; 163 164 struct _sdlContentModel { 165 sdlContentKind kind; 166 int min_occurs; 167 int max_occurs; 168 union { 169 sdlTypePtr element; /* pointer to element */ 170 sdlTypePtr group; /* pointer to group */ 171 HashTable *content; /* array of sdlContentModel for sequnce,all,choice*/ 172 char *group_ref; /* reference to group */ 173 } u; 174 }; 175 176 typedef enum _sdlTypeKind { 177 XSD_TYPEKIND_SIMPLE, 178 XSD_TYPEKIND_LIST, 179 XSD_TYPEKIND_UNION, 180 XSD_TYPEKIND_COMPLEX, 181 XSD_TYPEKIND_RESTRICTION, 182 XSD_TYPEKIND_EXTENSION 183 } sdlTypeKind; 184 185 typedef enum _sdlUse { 186 XSD_USE_DEFAULT, 187 XSD_USE_OPTIONAL, 188 XSD_USE_PROHIBITED, 189 XSD_USE_REQUIRED 190 } sdlUse; 191 192 typedef enum _sdlForm { 193 XSD_FORM_DEFAULT, 194 XSD_FORM_QUALIFIED, 195 XSD_FORM_UNQUALIFIED 196 } sdlForm; 197 198 struct _sdlType { 199 sdlTypeKind kind; 200 char *name; 201 char *namens; 202 char nillable; 203 HashTable *elements; /* array of sdlTypePtr */ 204 HashTable *attributes; /* array of sdlAttributePtr */ 205 sdlRestrictionsPtr restrictions; 206 encodePtr encode; 207 sdlContentModelPtr model; 208 char *def; 209 char *fixed; 210 char *ref; 211 sdlForm form; 212 }; 213 214 struct _sdlParam { 215 int order; 216 sdlTypePtr element; 217 encodePtr encode; 218 char *paramName; 219 }; 220 221 typedef struct _sdlFault { 222 char *name; 223 HashTable *details; /* array of sdlParamPtr */ 224 void *bindingAttributes; /* sdlSoapBindingFunctionFaultPtr */ 225 } sdlFault, *sdlFaultPtr; 226 227 struct _sdlFunction { 228 char *functionName; 229 char *requestName; 230 char *responseName; 231 HashTable *requestParameters; /* array of sdlParamPtr */ 232 HashTable *responseParameters; /* array of sdlParamPtr (this should only be one) */ 233 struct _sdlBinding *binding; 234 void *bindingAttributes; /* sdlSoapBindingFunctionPtr */ 235 HashTable *faults; /* array of sdlFaultPtr */ 236 }; 237 238 typedef struct _sdlExtraAttribute { 239 char *ns; 240 char *val; 241 } sdlExtraAttribute, *sdlExtraAttributePtr; 242 243 struct _sdlAttribute { 244 char *name; 245 char *namens; 246 char *ref; 247 char *def; 248 char *fixed; 249 sdlForm form; 250 sdlUse use; 251 HashTable *extraAttributes; /* array of sdlExtraAttribute */ 252 encodePtr encode; 253 }; 254 255 256 sdlPtr get_sdl(zval *this_ptr, char *uri, zend_long cache_wsdl); 257 258 encodePtr get_encoder_from_prefix(sdlPtr sdl, xmlNodePtr data, const xmlChar *type); 259 encodePtr get_encoder(sdlPtr sdl, const char *ns, const char *type); 260 encodePtr get_encoder_ex(sdlPtr sdl, const char *nscat, int len); 261 262 sdlBindingPtr get_binding_from_type(sdlPtr sdl, sdlBindingType type); 263 sdlBindingPtr get_binding_from_name(sdlPtr sdl, char *name, char *ns); 264 265 void delete_sdl(void *handle); 266 void delete_sdl_impl(void *handle); 267 268 void sdl_set_uri_credentials(sdlCtx *ctx, char *uri); 269 void sdl_restore_uri_credentials(sdlCtx *ctx); 270 271 #endif 272