php_sdl.h 8.0 KB

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