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.

364 lines
13 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /* soapRemoteDiscoveryBindingService.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 "soapRemoteDiscoveryBindingService.h"
  10. RemoteDiscoveryBindingService::RemoteDiscoveryBindingService()
  11. { RemoteDiscoveryBindingService_init(SOAP_IO_DEFAULT, SOAP_IO_DEFAULT);
  12. }
  13. RemoteDiscoveryBindingService::RemoteDiscoveryBindingService(const struct soap &_soap) : soap(_soap)
  14. { }
  15. RemoteDiscoveryBindingService::RemoteDiscoveryBindingService(soap_mode iomode)
  16. { RemoteDiscoveryBindingService_init(iomode, iomode);
  17. }
  18. RemoteDiscoveryBindingService::RemoteDiscoveryBindingService(soap_mode imode, soap_mode omode)
  19. { RemoteDiscoveryBindingService_init(imode, omode);
  20. }
  21. RemoteDiscoveryBindingService::~RemoteDiscoveryBindingService()
  22. { }
  23. void RemoteDiscoveryBindingService::RemoteDiscoveryBindingService_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 RemoteDiscoveryBindingService::destroy()
  66. { soap_destroy(this);
  67. soap_end(this);
  68. }
  69. void RemoteDiscoveryBindingService::reset()
  70. { destroy();
  71. soap_done(this);
  72. soap_initialize(this);
  73. RemoteDiscoveryBindingService_init(SOAP_IO_DEFAULT, SOAP_IO_DEFAULT);
  74. }
  75. #ifndef WITH_PURE_VIRTUAL
  76. RemoteDiscoveryBindingService *RemoteDiscoveryBindingService::copy()
  77. { RemoteDiscoveryBindingService *dup = SOAP_NEW_COPY(RemoteDiscoveryBindingService(*(struct soap*)this));
  78. return dup;
  79. }
  80. #endif
  81. int RemoteDiscoveryBindingService::soap_close_socket()
  82. { return soap_closesock(this);
  83. }
  84. int RemoteDiscoveryBindingService::soap_force_close_socket()
  85. { return soap_force_closesock(this);
  86. }
  87. int RemoteDiscoveryBindingService::soap_senderfault(const char *string, const char *detailXML)
  88. { return ::soap_sender_fault(this, string, detailXML);
  89. }
  90. int RemoteDiscoveryBindingService::soap_senderfault(const char *subcodeQName, const char *string, const char *detailXML)
  91. { return ::soap_sender_fault_subcode(this, subcodeQName, string, detailXML);
  92. }
  93. int RemoteDiscoveryBindingService::soap_receiverfault(const char *string, const char *detailXML)
  94. { return ::soap_receiver_fault(this, string, detailXML);
  95. }
  96. int RemoteDiscoveryBindingService::soap_receiverfault(const char *subcodeQName, const char *string, const char *detailXML)
  97. { return ::soap_receiver_fault_subcode(this, subcodeQName, string, detailXML);
  98. }
  99. void RemoteDiscoveryBindingService::soap_print_fault(FILE *fd)
  100. { ::soap_print_fault(this, fd);
  101. }
  102. #ifndef WITH_LEAN
  103. #ifndef WITH_COMPAT
  104. void RemoteDiscoveryBindingService::soap_stream_fault(std::ostream& os)
  105. { ::soap_stream_fault(this, os);
  106. }
  107. #endif
  108. char *RemoteDiscoveryBindingService::soap_sprint_fault(char *buf, size_t len)
  109. { return ::soap_sprint_fault(this, buf, len);
  110. }
  111. #endif
  112. void RemoteDiscoveryBindingService::soap_noheader()
  113. { this->header = NULL;
  114. }
  115. void RemoteDiscoveryBindingService::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 *RemoteDiscoveryBindingService::soap_header()
  136. { return this->header;
  137. }
  138. int RemoteDiscoveryBindingService::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 RemoteDiscoveryBindingService::bind(const char *host, int port, int backlog)
  152. { return soap_bind(this, host, port, backlog);
  153. }
  154. SOAP_SOCKET RemoteDiscoveryBindingService::accept()
  155. { return soap_accept(this);
  156. }
  157. #if defined(WITH_OPENSSL) || defined(WITH_GNUTLS)
  158. int RemoteDiscoveryBindingService::ssl_accept()
  159. { return soap_ssl_accept(this);
  160. }
  161. #endif
  162. int RemoteDiscoveryBindingService::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___tdn__Hello(RemoteDiscoveryBindingService*);
  196. static int serve___tdn__Bye(RemoteDiscoveryBindingService*);
  197. static int serve___tdn__Probe(RemoteDiscoveryBindingService*);
  198. int RemoteDiscoveryBindingService::dispatch()
  199. { soap_peek_element(this);
  200. if (!soap_match_tag(this, this->tag, "tdn:Hello"))
  201. return serve___tdn__Hello(this);
  202. if (!soap_match_tag(this, this->tag, "tdn:Bye"))
  203. return serve___tdn__Bye(this);
  204. if (!soap_match_tag(this, this->tag, "tdn:Probe"))
  205. return serve___tdn__Probe(this);
  206. return this->error = SOAP_NO_METHOD;
  207. }
  208. static int serve___tdn__Hello(RemoteDiscoveryBindingService *soap)
  209. { struct __tdn__Hello soap_tmp___tdn__Hello;
  210. struct wsdd__ResolveType tdn__HelloResponse;
  211. soap_default_wsdd__ResolveType(soap, &tdn__HelloResponse);
  212. soap_default___tdn__Hello(soap, &soap_tmp___tdn__Hello);
  213. if (!soap_get___tdn__Hello(soap, &soap_tmp___tdn__Hello, "-tdn:Hello", NULL))
  214. return soap->error;
  215. if (soap_body_end_in(soap)
  216. || soap_envelope_end_in(soap)
  217. || soap_end_recv(soap))
  218. return soap->error;
  219. soap->error = soap->Hello(soap_tmp___tdn__Hello.tdn__Hello, tdn__HelloResponse);
  220. if (soap->error)
  221. return soap->error;
  222. soap->encodingStyle = NULL;
  223. soap_serializeheader(soap);
  224. soap_serialize_wsdd__ResolveType(soap, &tdn__HelloResponse);
  225. if (soap_begin_count(soap))
  226. return soap->error;
  227. if (soap->mode & SOAP_IO_LENGTH)
  228. { if (soap_envelope_begin_out(soap)
  229. || soap_putheader(soap)
  230. || soap_body_begin_out(soap)
  231. || soap_put_wsdd__ResolveType(soap, &tdn__HelloResponse, "tdn:HelloResponse", NULL)
  232. || soap_body_end_out(soap)
  233. || soap_envelope_end_out(soap))
  234. return soap->error;
  235. };
  236. if (soap_end_count(soap)
  237. || soap_response(soap, SOAP_OK)
  238. || soap_envelope_begin_out(soap)
  239. || soap_putheader(soap)
  240. || soap_body_begin_out(soap)
  241. || soap_put_wsdd__ResolveType(soap, &tdn__HelloResponse, "tdn:HelloResponse", NULL)
  242. || soap_body_end_out(soap)
  243. || soap_envelope_end_out(soap)
  244. || soap_end_send(soap))
  245. return soap->error;
  246. return soap_closesock(soap);
  247. }
  248. static int serve___tdn__Bye(RemoteDiscoveryBindingService *soap)
  249. { struct __tdn__Bye soap_tmp___tdn__Bye;
  250. struct wsdd__ResolveType tdn__ByeResponse;
  251. soap_default_wsdd__ResolveType(soap, &tdn__ByeResponse);
  252. soap_default___tdn__Bye(soap, &soap_tmp___tdn__Bye);
  253. if (!soap_get___tdn__Bye(soap, &soap_tmp___tdn__Bye, "-tdn:Bye", NULL))
  254. return soap->error;
  255. if (soap_body_end_in(soap)
  256. || soap_envelope_end_in(soap)
  257. || soap_end_recv(soap))
  258. return soap->error;
  259. soap->error = soap->Bye(soap_tmp___tdn__Bye.tdn__Bye, tdn__ByeResponse);
  260. if (soap->error)
  261. return soap->error;
  262. soap->encodingStyle = NULL;
  263. soap_serializeheader(soap);
  264. soap_serialize_wsdd__ResolveType(soap, &tdn__ByeResponse);
  265. if (soap_begin_count(soap))
  266. return soap->error;
  267. if (soap->mode & SOAP_IO_LENGTH)
  268. { if (soap_envelope_begin_out(soap)
  269. || soap_putheader(soap)
  270. || soap_body_begin_out(soap)
  271. || soap_put_wsdd__ResolveType(soap, &tdn__ByeResponse, "tdn:ByeResponse", NULL)
  272. || soap_body_end_out(soap)
  273. || soap_envelope_end_out(soap))
  274. return soap->error;
  275. };
  276. if (soap_end_count(soap)
  277. || soap_response(soap, SOAP_OK)
  278. || soap_envelope_begin_out(soap)
  279. || soap_putheader(soap)
  280. || soap_body_begin_out(soap)
  281. || soap_put_wsdd__ResolveType(soap, &tdn__ByeResponse, "tdn:ByeResponse", NULL)
  282. || soap_body_end_out(soap)
  283. || soap_envelope_end_out(soap)
  284. || soap_end_send(soap))
  285. return soap->error;
  286. return soap_closesock(soap);
  287. }
  288. static int serve___tdn__Probe(RemoteDiscoveryBindingService *soap)
  289. { struct __tdn__Probe soap_tmp___tdn__Probe;
  290. struct wsdd__ProbeMatchesType tdn__ProbeResponse;
  291. soap_default_wsdd__ProbeMatchesType(soap, &tdn__ProbeResponse);
  292. soap_default___tdn__Probe(soap, &soap_tmp___tdn__Probe);
  293. if (!soap_get___tdn__Probe(soap, &soap_tmp___tdn__Probe, "-tdn:Probe", NULL))
  294. return soap->error;
  295. if (soap_body_end_in(soap)
  296. || soap_envelope_end_in(soap)
  297. || soap_end_recv(soap))
  298. return soap->error;
  299. soap->error = soap->Probe(soap_tmp___tdn__Probe.tdn__Probe, tdn__ProbeResponse);
  300. if (soap->error)
  301. return soap->error;
  302. soap->encodingStyle = NULL;
  303. soap_serializeheader(soap);
  304. soap_serialize_wsdd__ProbeMatchesType(soap, &tdn__ProbeResponse);
  305. if (soap_begin_count(soap))
  306. return soap->error;
  307. if (soap->mode & SOAP_IO_LENGTH)
  308. { if (soap_envelope_begin_out(soap)
  309. || soap_putheader(soap)
  310. || soap_body_begin_out(soap)
  311. || soap_put_wsdd__ProbeMatchesType(soap, &tdn__ProbeResponse, "tdn:ProbeResponse", NULL)
  312. || soap_body_end_out(soap)
  313. || soap_envelope_end_out(soap))
  314. return soap->error;
  315. };
  316. if (soap_end_count(soap)
  317. || soap_response(soap, SOAP_OK)
  318. || soap_envelope_begin_out(soap)
  319. || soap_putheader(soap)
  320. || soap_body_begin_out(soap)
  321. || soap_put_wsdd__ProbeMatchesType(soap, &tdn__ProbeResponse, "tdn:ProbeResponse", NULL)
  322. || soap_body_end_out(soap)
  323. || soap_envelope_end_out(soap)
  324. || soap_end_send(soap))
  325. return soap->error;
  326. return soap_closesock(soap);
  327. }
  328. /* End of server object code */