You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

340 lines
12 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /* soapwsddService.cpp
  2. Generated by gSOAP 2.8.17r from onvif.h
  3. Copyright(C) 2000-2013, Robert van Engelen, Genivia Inc. All Rights Reserved.
  4. The generated code is released under one of the following licenses:
  5. GPL or Genivia's license for commercial use.
  6. This program is released under the GPL with the additional exemption that
  7. compiling, linking, and/or using OpenSSL is allowed.
  8. */
  9. #include "soapwsddService.h"
  10. wsddService::wsddService()
  11. { wsddService_init(SOAP_IO_DEFAULT, SOAP_IO_DEFAULT);
  12. }
  13. wsddService::wsddService(const struct soap &_soap) : soap(_soap)
  14. { }
  15. wsddService::wsddService(soap_mode iomode)
  16. { wsddService_init(iomode, iomode);
  17. }
  18. wsddService::wsddService(soap_mode imode, soap_mode omode)
  19. { wsddService_init(imode, omode);
  20. }
  21. wsddService::~wsddService()
  22. { }
  23. void wsddService::wsddService_init(soap_mode imode, soap_mode omode)
  24. { soap_imode(this, imode);
  25. soap_omode(this, omode);
  26. static const struct Namespace namespaces[] =
  27. {
  28. {"SOAP-ENV", "http://www.w3.org/2003/05/soap-envelope", "http://schemas.xmlsoap.org/soap/envelope/", NULL},
  29. {"SOAP-ENC", "http://www.w3.org/2003/05/soap-encoding", "http://schemas.xmlsoap.org/soap/encoding/", NULL},
  30. {"xsi", "http://www.w3.org/2001/XMLSchema-instance", "http://www.w3.org/*/XMLSchema-instance", NULL},
  31. {"xsd", "http://www.w3.org/2001/XMLSchema", "http://www.w3.org/*/XMLSchema", NULL},
  32. {"c14n", "http://www.w3.org/2001/10/xml-exc-c14n#", NULL, NULL},
  33. {"wsu", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd", NULL, NULL},
  34. {"xenc", "http://www.w3.org/2001/04/xmlenc#", NULL, NULL},
  35. {"wsc", "http://schemas.xmlsoap.org/ws/2005/02/sc", NULL, NULL},
  36. {"ds", "http://www.w3.org/2000/09/xmldsig#", NULL, NULL},
  37. {"wsse", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", "http://docs.oasis-open.org/wss/oasis-wss-wssecurity-secext-1.1.xsd", NULL},
  38. {"wsa", "http://schemas.xmlsoap.org/ws/2004/08/addressing", NULL, NULL},
  39. {"wsdd", "http://schemas.xmlsoap.org/ws/2005/04/discovery", NULL, NULL},
  40. {"chan", "http://schemas.microsoft.com/ws/2005/02/duplex", NULL, NULL},
  41. {"wsa5", "http://www.w3.org/2005/08/addressing", "http://schemas.xmlsoap.org/ws/2004/08/addressing", NULL},
  42. {"xmime", "http://tempuri.org/xmime.xsd", NULL, NULL},
  43. {"xop", "http://www.w3.org/2004/08/xop/include", NULL, NULL},
  44. {"tt", "http://www.onvif.org/ver10/schema", NULL, NULL},
  45. {"wsrfbf", "http://docs.oasis-open.org/wsrf/bf-2", NULL, NULL},
  46. {"wstop", "http://docs.oasis-open.org/wsn/t-1", NULL, NULL},
  47. {"wsrfr", "http://docs.oasis-open.org/wsrf/r-2", NULL, NULL},
  48. {"tdn", "http://www.onvif.org/ver10/network/wsdl", NULL, NULL},
  49. {"tds", "http://www.onvif.org/ver10/device/wsdl", NULL, NULL},
  50. {"tev", "http://www.onvif.org/ver10/events/wsdl", NULL, NULL},
  51. {"wsnt", "http://docs.oasis-open.org/wsn/b-2", NULL, NULL},
  52. {"timg", "http://www.onvif.org/ver20/imaging/wsdl", NULL, NULL},
  53. {"tls", "http://www.onvif.org/ver10/display/wsdl", NULL, NULL},
  54. {"tmd", "http://www.onvif.org/ver10/deviceIO/wsdl", NULL, NULL},
  55. {"tptz", "http://www.onvif.org/ver20/ptz/wsdl", NULL, NULL},
  56. {"trc", "http://www.onvif.org/ver10/recording/wsdl", NULL, NULL},
  57. {"trp", "http://www.onvif.org/ver10/replay/wsdl", NULL, NULL},
  58. {"trt", "http://www.onvif.org/ver10/media/wsdl", NULL, NULL},
  59. {"trv", "http://www.onvif.org/ver10/receiver/wsdl", NULL, NULL},
  60. {"tse", "http://www.onvif.org/ver10/search/wsdl", NULL, NULL},
  61. {NULL, NULL, NULL, NULL}
  62. };
  63. soap_set_namespaces(this, namespaces);
  64. }
  65. void wsddService::destroy()
  66. { soap_destroy(this);
  67. soap_end(this);
  68. }
  69. void wsddService::reset()
  70. { destroy();
  71. soap_done(this);
  72. soap_initialize(this);
  73. wsddService_init(SOAP_IO_DEFAULT, SOAP_IO_DEFAULT);
  74. }
  75. #ifndef WITH_PURE_VIRTUAL
  76. wsddService *wsddService::copy()
  77. { wsddService *dup = SOAP_NEW_COPY(wsddService(*(struct soap*)this));
  78. return dup;
  79. }
  80. #endif
  81. int wsddService::soap_close_socket()
  82. { return soap_closesock(this);
  83. }
  84. int wsddService::soap_force_close_socket()
  85. { return soap_force_closesock(this);
  86. }
  87. int wsddService::soap_senderfault(const char *string, const char *detailXML)
  88. { return ::soap_sender_fault(this, string, detailXML);
  89. }
  90. int wsddService::soap_senderfault(const char *subcodeQName, const char *string, const char *detailXML)
  91. { return ::soap_sender_fault_subcode(this, subcodeQName, string, detailXML);
  92. }
  93. int wsddService::soap_receiverfault(const char *string, const char *detailXML)
  94. { return ::soap_receiver_fault(this, string, detailXML);
  95. }
  96. int wsddService::soap_receiverfault(const char *subcodeQName, const char *string, const char *detailXML)
  97. { return ::soap_receiver_fault_subcode(this, subcodeQName, string, detailXML);
  98. }
  99. void wsddService::soap_print_fault(FILE *fd)
  100. { ::soap_print_fault(this, fd);
  101. }
  102. #ifndef WITH_LEAN
  103. #ifndef WITH_COMPAT
  104. void wsddService::soap_stream_fault(std::ostream& os)
  105. { ::soap_stream_fault(this, os);
  106. }
  107. #endif
  108. char *wsddService::soap_sprint_fault(char *buf, size_t len)
  109. { return ::soap_sprint_fault(this, buf, len);
  110. }
  111. #endif
  112. void wsddService::soap_noheader()
  113. { this->header = NULL;
  114. }
  115. void wsddService::soap_header(struct _wsse__Security *wsse__Security, char *wsa__MessageID, struct wsa__Relationship *wsa__RelatesTo, struct wsa__EndpointReferenceType *wsa__From, struct wsa__EndpointReferenceType *wsa__ReplyTo, struct wsa__EndpointReferenceType *wsa__FaultTo, char *wsa__To, char *wsa__Action, struct wsdd__AppSequenceType *wsdd__AppSequence, char *wsa5__MessageID, struct wsa5__RelatesToType *wsa5__RelatesTo, struct wsa5__EndpointReferenceType *wsa5__From, struct wsa5__EndpointReferenceType *wsa5__ReplyTo, struct wsa5__EndpointReferenceType *wsa5__FaultTo, char *wsa5__To, char *wsa5__Action, struct chan__ChannelInstanceType *chan__ChannelInstance)
  116. { ::soap_header(this);
  117. this->header->wsse__Security = wsse__Security;
  118. this->header->wsa__MessageID = wsa__MessageID;
  119. this->header->wsa__RelatesTo = wsa__RelatesTo;
  120. this->header->wsa__From = wsa__From;
  121. this->header->wsa__ReplyTo = wsa__ReplyTo;
  122. this->header->wsa__FaultTo = wsa__FaultTo;
  123. this->header->wsa__To = wsa__To;
  124. this->header->wsa__Action = wsa__Action;
  125. this->header->wsdd__AppSequence = wsdd__AppSequence;
  126. this->header->wsa5__MessageID = wsa5__MessageID;
  127. this->header->wsa5__RelatesTo = wsa5__RelatesTo;
  128. this->header->wsa5__From = wsa5__From;
  129. this->header->wsa5__ReplyTo = wsa5__ReplyTo;
  130. this->header->wsa5__FaultTo = wsa5__FaultTo;
  131. this->header->wsa5__To = wsa5__To;
  132. this->header->wsa5__Action = wsa5__Action;
  133. this->header->chan__ChannelInstance = chan__ChannelInstance;
  134. }
  135. const SOAP_ENV__Header *wsddService::soap_header()
  136. { return this->header;
  137. }
  138. int wsddService::run(int port)
  139. { if (soap_valid_socket(this->master) || soap_valid_socket(bind(NULL, port, 100)))
  140. { for (;;)
  141. { if (!soap_valid_socket(accept()) || serve())
  142. return this->error;
  143. soap_destroy(this);
  144. soap_end(this);
  145. }
  146. }
  147. else
  148. return this->error;
  149. return SOAP_OK;
  150. }
  151. SOAP_SOCKET wsddService::bind(const char *host, int port, int backlog)
  152. { return soap_bind(this, host, port, backlog);
  153. }
  154. SOAP_SOCKET wsddService::accept()
  155. { return soap_accept(this);
  156. }
  157. #if defined(WITH_OPENSSL) || defined(WITH_GNUTLS)
  158. int wsddService::ssl_accept()
  159. { return soap_ssl_accept(this);
  160. }
  161. #endif
  162. int wsddService::serve()
  163. {
  164. #ifndef WITH_FASTCGI
  165. unsigned int k = this->max_keep_alive;
  166. #endif
  167. do
  168. {
  169. #ifndef WITH_FASTCGI
  170. if (this->max_keep_alive > 0 && !--k)
  171. this->keep_alive = 0;
  172. #endif
  173. if (soap_begin_serve(this))
  174. { if (this->error >= SOAP_STOP)
  175. continue;
  176. return this->error;
  177. }
  178. if (dispatch() || (this->fserveloop && this->fserveloop(this)))
  179. {
  180. #ifdef WITH_FASTCGI
  181. soap_send_fault(this);
  182. #else
  183. return soap_send_fault(this);
  184. #endif
  185. }
  186. #ifdef WITH_FASTCGI
  187. soap_destroy(this);
  188. soap_end(this);
  189. } while (1);
  190. #else
  191. } while (this->keep_alive);
  192. #endif
  193. return SOAP_OK;
  194. }
  195. static int serve___wsdd__Hello(wsddService*);
  196. static int serve___wsdd__Bye(wsddService*);
  197. static int serve___wsdd__Probe(wsddService*);
  198. static int serve___wsdd__ProbeMatches(wsddService*);
  199. static int serve___wsdd__Resolve(wsddService*);
  200. static int serve___wsdd__ResolveMatches(wsddService*);
  201. int wsddService::dispatch()
  202. { soap_peek_element(this);
  203. if (!soap_match_tag(this, this->tag, "wsdd:Hello"))
  204. return serve___wsdd__Hello(this);
  205. if (!soap_match_tag(this, this->tag, "wsdd:Bye"))
  206. return serve___wsdd__Bye(this);
  207. if (!soap_match_tag(this, this->tag, "wsdd:Probe"))
  208. return serve___wsdd__Probe(this);
  209. if (!soap_match_tag(this, this->tag, "wsdd:ProbeMatches"))
  210. return serve___wsdd__ProbeMatches(this);
  211. if (!soap_match_tag(this, this->tag, "wsdd:Resolve"))
  212. return serve___wsdd__Resolve(this);
  213. if (!soap_match_tag(this, this->tag, "wsdd:ResolveMatches"))
  214. return serve___wsdd__ResolveMatches(this);
  215. return this->error = SOAP_NO_METHOD;
  216. }
  217. static int serve___wsdd__Hello(wsddService *soap)
  218. { struct __wsdd__Hello soap_tmp___wsdd__Hello;
  219. soap_default___wsdd__Hello(soap, &soap_tmp___wsdd__Hello);
  220. if (!soap_get___wsdd__Hello(soap, &soap_tmp___wsdd__Hello, "-wsdd:Hello", NULL))
  221. return soap->error;
  222. if (soap_body_end_in(soap)
  223. || soap_envelope_end_in(soap)
  224. || soap_end_recv(soap))
  225. return soap->error;
  226. soap->error = soap->Hello(soap_tmp___wsdd__Hello.wsdd__Hello);
  227. if (soap->error)
  228. return soap->error;
  229. return soap_closesock(soap);
  230. }
  231. static int serve___wsdd__Bye(wsddService *soap)
  232. { struct __wsdd__Bye soap_tmp___wsdd__Bye;
  233. soap_default___wsdd__Bye(soap, &soap_tmp___wsdd__Bye);
  234. if (!soap_get___wsdd__Bye(soap, &soap_tmp___wsdd__Bye, "-wsdd:Bye", NULL))
  235. return soap->error;
  236. if (soap_body_end_in(soap)
  237. || soap_envelope_end_in(soap)
  238. || soap_end_recv(soap))
  239. return soap->error;
  240. soap->error = soap->Bye(soap_tmp___wsdd__Bye.wsdd__Bye);
  241. if (soap->error)
  242. return soap->error;
  243. return soap_closesock(soap);
  244. }
  245. static int serve___wsdd__Probe(wsddService *soap)
  246. { struct __wsdd__Probe soap_tmp___wsdd__Probe;
  247. soap_default___wsdd__Probe(soap, &soap_tmp___wsdd__Probe);
  248. if (!soap_get___wsdd__Probe(soap, &soap_tmp___wsdd__Probe, "-wsdd:Probe", NULL))
  249. return soap->error;
  250. if (soap_body_end_in(soap)
  251. || soap_envelope_end_in(soap)
  252. || soap_end_recv(soap))
  253. return soap->error;
  254. soap->error = soap->Probe(soap_tmp___wsdd__Probe.wsdd__Probe);
  255. if (soap->error)
  256. return soap->error;
  257. return soap_closesock(soap);
  258. }
  259. static int serve___wsdd__ProbeMatches(wsddService *soap)
  260. { struct __wsdd__ProbeMatches soap_tmp___wsdd__ProbeMatches;
  261. soap_default___wsdd__ProbeMatches(soap, &soap_tmp___wsdd__ProbeMatches);
  262. if (!soap_get___wsdd__ProbeMatches(soap, &soap_tmp___wsdd__ProbeMatches, "-wsdd:ProbeMatches", NULL))
  263. return soap->error;
  264. if (soap_body_end_in(soap)
  265. || soap_envelope_end_in(soap)
  266. || soap_end_recv(soap))
  267. return soap->error;
  268. soap->error = soap->ProbeMatches(soap_tmp___wsdd__ProbeMatches.wsdd__ProbeMatches);
  269. if (soap->error)
  270. return soap->error;
  271. return soap_closesock(soap);
  272. }
  273. static int serve___wsdd__Resolve(wsddService *soap)
  274. { struct __wsdd__Resolve soap_tmp___wsdd__Resolve;
  275. soap_default___wsdd__Resolve(soap, &soap_tmp___wsdd__Resolve);
  276. if (!soap_get___wsdd__Resolve(soap, &soap_tmp___wsdd__Resolve, "-wsdd:Resolve", NULL))
  277. return soap->error;
  278. if (soap_body_end_in(soap)
  279. || soap_envelope_end_in(soap)
  280. || soap_end_recv(soap))
  281. return soap->error;
  282. soap->error = soap->Resolve(soap_tmp___wsdd__Resolve.wsdd__Resolve);
  283. if (soap->error)
  284. return soap->error;
  285. return soap_closesock(soap);
  286. }
  287. static int serve___wsdd__ResolveMatches(wsddService *soap)
  288. { struct __wsdd__ResolveMatches soap_tmp___wsdd__ResolveMatches;
  289. soap_default___wsdd__ResolveMatches(soap, &soap_tmp___wsdd__ResolveMatches);
  290. if (!soap_get___wsdd__ResolveMatches(soap, &soap_tmp___wsdd__ResolveMatches, "-wsdd:ResolveMatches", NULL))
  291. return soap->error;
  292. if (soap_body_end_in(soap)
  293. || soap_envelope_end_in(soap)
  294. || soap_end_recv(soap))
  295. return soap->error;
  296. soap->error = soap->ResolveMatches(soap_tmp___wsdd__ResolveMatches.wsdd__ResolveMatches);
  297. if (soap->error)
  298. return soap->error;
  299. return soap_closesock(soap);
  300. }
  301. /* End of server object code */