php_sdl.h 7.8 KB

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