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.

496 lines
18 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #include "rgooseModuleOnvifObserver.h"
  2. #include "rgooseKernel.h"
  3. #include "rgooseHardwareResourceNetworkProvider.h"
  4. #define SEARCH_REQUEST_STRING "<?xml version=\"1.0\" encoding=\"UTF-8\"?><e:Envelope xmlns:e=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:w=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\" xmlns:d=\"http://schemas.xmlsoap.org/ws/2005/04/discovery\" xmlns:dn=\"http://www.onvif.org/ver10/network/wsdl\"><e:Header><w:MessageID>uuid:84ede3de-7dec-11d0-c360-f01234567890</w:MessageID><w:To e:mustUnderstand=\"true\">urn:schemas-xmlsoap-org:ws:2005:04:discovery</w:To><w:Action a:mustUnderstand=\"true\">http://schemas.xmlsoap.org/ws/2005/04/discovery/Probe</w:Action></e:Header><e:Body><d:Probe><d:Types>dn:NetworkVideoTransmitter</d:Types></d:Probe></e:Body></e:Envelope>"
  5. #define SEARCH_REQUEST_STRING2323 "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" \
  6. "<SOAP:Envelope xmlns:SOAP=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:wsa=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\" xmlns:DISCOVERY=\"http://schemas.xmlsoap.org/ws/2005/04/discovery\" xmlns:ssdp=\"http://example.com/wsdp/sample/print\">\n" \
  7. "<SOAP:Header>\n" \
  8. "<wsa:MessageID>urn:uuid:ac9823ee-6813-498c-8c1b-6272a22353f7</wsa:MessageID>\n" \
  9. "<wsa:Action>\n" \
  10. "http ://schemas.xmlsoap.org/ws/2005/04/discovery/Probe\n" \
  11. "</wsa:Action>\n" \
  12. "<wsa:To>urn:schemas-xmlsoap-org:ws:2005:04:discovery</wsa:To>\n" \
  13. "</SOAP:Header>\n" \
  14. "<SOAP:Body>\n" \
  15. "<DISCOVERY:Probe>\n" \
  16. "<DISCOVERY:Types>ssdp:any</DISCOVERY:Types>\n" \
  17. "</DISCOVERY:Probe>\n" \
  18. "</SOAP:Body>\n" \
  19. "</SOAP:Envelope>\r\n\r\n"
  20. #define HTTP_OK "200 OK"
  21. /******************************************************************
  22. ** Action Defines *
  23. *******************************************************************/
  24. #define HTTP_HEADER_ACTION "POST %s HTTP/1.1\r\n" \
  25. "HOST: %s:%u\r\n" \
  26. "SOAPACTION:\"%s#%s\"\r\n" \
  27. "CONTENT-TYPE: text/xml ; charset=\"utf-8\"\r\n"\
  28. "Content-Length: %d \r\n\r\n"
  29. #define SOAP_ACTION "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n" \
  30. "<s:Envelope xmlns:s=" \
  31. "\"http://schemas.xmlsoap.org/soap/envelope/\" " \
  32. "s:encodingStyle=" \
  33. "\"http://schemas.xmlsoap.org/soap/encoding/\">\r\n" \
  34. "<s:Body>\r\n" \
  35. "<u:%s xmlns:u=\"%s\">\r\n%s" \
  36. "</u:%s>\r\n" \
  37. "</s:Body>\r\n" \
  38. "</s:Envelope>\r\n"
  39. #define PORT_MAPPING_LEASE_TIME "63072000" //two year
  40. #define ADD_PORT_MAPPING_PARAMS "<NewRemoteHost></NewRemoteHost>\r\n" \
  41. "<NewExternalPort>%u</NewExternalPort>\r\n"\
  42. "<NewProtocol>%s</NewProtocol>\r\n" \
  43. "<NewInternalPort>%u</NewInternalPort>\r\n"\
  44. "<NewInternalClient>%s</NewInternalClient>\r\n" \
  45. "<NewEnabled>1</NewEnabled>\r\n" \
  46. "<NewPortMappingDescription>%s</NewPortMappingDescription>\r\n" \
  47. "<NewLeaseDuration>" \
  48. PORT_MAPPING_LEASE_TIME \
  49. "</NewLeaseDuration>\r\n"
  50. #define LOG( X ) argusKernelModule::m_pLog->Log( "MOD_ONVIF", this, X )
  51. #ifdef DEBUG
  52. #define LOG_ERROR( X ) {\
  53. char _tBfrErrMSG2w34[256];\
  54. sprintf( _tBfrErrMSG2w34, "In file %s[%d] in func:%s %s",__FILE__, __LINE__, __func__, X );\
  55. argusKernelModule::m_pLog->Log( "MOD_ONVIF", this, _LOG_ERROR, _tBfrErrMSG2w34 );\
  56. }
  57. #else
  58. #define LOG_ERROR( X ) argusKernelModule::m_pLog->Log( "MOD_ONVIF", this, _LOG_ERROR, X );
  59. #endif
  60. #define TLOG( X ) basicLogCollection::getInstance()->Log( "MOD_ONVIF_T", me, X )
  61. #define TLOG_ERROR( X ) basicLogCollection::getInstance()->Log( "MOD_ONVIF_T", me, _LOG_ERROR, X )
  62. argusModuleOnvifObserver::argusModuleOnvifObserver( uint32_t ModuleID ): argusKernelModule( ModuleID, ARGUS_MODULE_FLYHUNTER ), basicThread(){
  63. m_bEnabled = false;
  64. m_pEventHeap = basicEventHeap::getInstance();
  65. m_pIpAddresses = NULL;
  66. m_nStatus = 0;
  67. #ifdef __linux__
  68. m_bWSAOK = true;
  69. #else
  70. m_bWSAOK = false;
  71. WORD wVersionRequested;
  72. WSADATA wsaData;
  73. int err;
  74. wVersionRequested = MAKEWORD(2, 2);
  75. err = WSAStartup(wVersionRequested, &wsaData);
  76. if (err != 0){
  77. LOG_ERROR("WSAStartup failed with error");
  78. } else m_bWSAOK = true;
  79. #endif
  80. };
  81. argusModuleOnvifObserver::~argusModuleOnvifObserver(){
  82. m_bEnabled = false;
  83. stopService();
  84. };
  85. bool argusModuleOnvifObserver::startService(){
  86. LOG("Starting Service!");
  87. m_bEnabled = true;
  88. //if( m_bEnabled ) return false;
  89. if( !m_bWSAOK ) return false;
  90. return init();
  91. };
  92. bool argusModuleOnvifObserver::stopService( bool force ){
  93. waitThreadEnd( true );
  94. if( m_vThreads.size() ) { // Kill-Wait Started Probes
  95. #ifdef DEBUG
  96. LOG("Have to Wait Probes!");
  97. #endif
  98. for( vectorOBSERVER_CTX::iterator index = m_vThreads.begin(); index < m_vThreads.end(); index++ ) {
  99. if( force ){
  100. // force
  101. pthread_cancel( (*index)->m_hThreadHandle );
  102. } else{
  103. // easy
  104. pthread_join( (*index)->m_hThreadHandle, NULL );
  105. };
  106. };
  107. m_vThreads.clear();
  108. };
  109. #ifdef DEBUG
  110. LOG("No More Probes!");
  111. #endif
  112. if (m_vResultPool.size()){ // Clear structures
  113. for( vectorOBSERVER_RESULT::iterator index = m_vResultPool.begin(); index < m_vResultPool.end(); index++){
  114. free(*index);
  115. };
  116. m_vResultPool.clear();
  117. };
  118. #ifdef DEBUG
  119. LOG("Data is Cleared!");
  120. #endif
  121. return true;
  122. };
  123. void argusModuleOnvifObserver::m_fThreadProc(){
  124. double dStatus = 0, dStep = 30.0;
  125. int id = 0;
  126. dStatus = 0;
  127. m_bThreadStatus = TH_WORKING;
  128. if( !m_bEnabled ) {
  129. m_bThreadStatus = TH_ENDED;
  130. #ifdef DEBUG
  131. LOG("Module is Disabled!");
  132. #endif
  133. };
  134. #ifdef DEBUG
  135. LOG("Module Started!");
  136. #endif
  137. while( m_bThreadStatus < TH_ENDED ) {
  138. id = 0;
  139. if( m_pKernel != NULL ){
  140. #ifdef DEBUG_EXTRA
  141. LOG("Check IPS");
  142. #endif
  143. argusHardwareManager *tHWM = m_pKernel->getHardwareManager();
  144. if( tHWM != NULL ) {
  145. DBC_INT_LIST *rIDS = tHWM->requestResourcesByType( ARGUS_HARDWARE_PROVIDER_NETWORK );
  146. if( rIDS != NULL ) {
  147. dStep = 30.0 / (rIDS->size() + 1);
  148. for( DBC_INT_LIST::iterator idx = rIDS->begin(); idx < rIDS->end(); idx++ ){
  149. argusHardwareResourceNetwork *tRES = (argusHardwareResourceNetwork *) tHWM->requestResource( ARGUS_HARDWARE_PROVIDER_NETWORK, *idx );
  150. if( tRES != NULL ) {
  151. CSTR BC = tRES->getBroadcast();
  152. if( BC!= NULL ) {
  153. #ifdef DEBUG_EXTRA
  154. LOG("Have BC Address");
  155. #endif
  156. startProbe( BC, id, (int) dStep );
  157. #ifdef DEBUG_EXTRA
  158. LOG("Probe Started");
  159. #endif
  160. dStatus += dStep;
  161. m_nStatus = (int)dStatus;
  162. id++;
  163. free( BC );
  164. }
  165. #ifdef DEBUG_EXTRA
  166. else {
  167. LOG("NO BC Address");
  168. }
  169. #endif
  170. ;
  171. } else {
  172. LOG_ERROR("Cannot Get Resource!");
  173. };
  174. };
  175. delete( rIDS );
  176. }
  177. #ifdef DEBUG_EXTRA
  178. else {
  179. LOG("No Networks Detected!");
  180. }
  181. #endif
  182. ;
  183. } else {
  184. LOG_ERROR("No HW Manager");
  185. };
  186. } else {
  187. LOG_ERROR("Kernel Not Assigned!" );
  188. };
  189. #ifdef DEBUG_EXTRA
  190. LOG("Start Default Probe");
  191. #endif
  192. startProbe(HTTPMU_HOST_ADDRESS, id, (int)dStep);
  193. dStatus += dStep;
  194. m_nStatus = (int)dStatus;
  195. SLEEP( 30000 );
  196. };
  197. };
  198. void argusModuleOnvifObserver::dispatchEvent(EVENT_CONTAINER *Evt){
  199. if(!m_bEnabled) {
  200. LOG("Module Disabled!");
  201. return;
  202. }
  203. if( Evt == NULL ) return;
  204. };
  205. bool argusModuleOnvifObserver::reloadSettings(){
  206. return true;
  207. };
  208. PROBE_CTX *argusModuleOnvifObserver::init_PROBE_CTX(CSTR ADR, int ID, int stp){
  209. PROBE_CTX *RetVal;
  210. RetVal = (PROBE_CTX*)malloc(sizeof(PROBE_CTX));
  211. if (RetVal == NULL) return NULL;
  212. sprintf(RetVal->IpAddress, "%s", ADR);
  213. RetVal->Port = HTTPMU_HOST_PORT;
  214. RetVal->socketFD = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
  215. RetVal->send_buff = (CSTR) SEARCH_REQUEST_STRING;
  216. RetVal->r_address.sin_family = AF_INET;
  217. RetVal->r_address.sin_port = htons(RetVal->Port);
  218. RetVal->r_address.sin_addr.s_addr = inet_addr(RetVal->IpAddress);
  219. RetVal->bOptVal = true;
  220. RetVal->bOptLen = sizeof(bool);
  221. RetVal->iOptLen = sizeof(int);
  222. RetVal->AddressID = ID;
  223. RetVal->step = stp;
  224. RetVal->observer = this;
  225. return RetVal;
  226. };
  227. void *argusModuleOnvifObserver::probeThreadProc( void *ptr ){
  228. PROBE_CTX *me;
  229. if (ptr == NULL) return NULL;
  230. me = (PROBE_CTX *)ptr;
  231. #ifdef DEBUG
  232. //TLOG("Probe Request Sent");
  233. #endif
  234. me->RetVal = setsockopt(me->socketFD, SOL_SOCKET, SO_BROADCAST, (char*)&me->bOptVal, me->bOptLen);
  235. me->RetVal = sendto(me->socketFD, me->send_buff, strlen(me->send_buff), 0, (struct sockaddr*)&me->r_address, sizeof(struct sockaddr_in));
  236. #ifdef DEBUG
  237. //sprintf(me->buff, "Sent %d Bytes", me->RetVal );
  238. //TLOG(me->buff);
  239. #endif
  240. #ifdef __linux__
  241. fcntl( me->socketFD, F_SETFL, fcntl(me->socketFD, F_GETFL, 0) | O_NONBLOCK );
  242. #else
  243. u_long val = 1;
  244. ioctlsocket(me->socketFD, FIONBIO, &val);//none block
  245. #endif
  246. for (me->index = 1; me->index <= 10; me->index++){
  247. memset(me->buff, 0, sizeof(me->buff));
  248. me->RetVal = recvfrom(me->socketFD, me->buff, MAX_BUFF_SIZE, 0, NULL, NULL);
  249. if( me->RetVal < 0 ){//SOCKET_ERROR){
  250. SLEEP(1000);
  251. continue;
  252. };
  253. me->recv_buff = me->buff;
  254. XMLResults tParseResults;
  255. XMLNode response = XMLNode::parseString( me->buff, "root", &tParseResults );
  256. #ifdef DEBUG_ONVIF_PRINTOUT_MESSAGES
  257. FILE *fd;
  258. fd = fopen("ONVIF_MSGS.txt","a+");
  259. fprintf(fd,me->buff);
  260. fprintf(fd,"--------------------\r\n");
  261. fclose(fd);
  262. #endif
  263. if( tParseResults.error ){
  264. char tBuffer[CTEXT];
  265. sprintf( tBuffer, "XML Parse Error %d at %d:%d", tParseResults.error, tParseResults.nLine, tParseResults.nColumn );
  266. TLOG_ERROR( tBuffer );
  267. } else {
  268. if(response.isEmpty()){
  269. TLOG_ERROR("The device descripe XML file is not a valid XML file. Cann't find root element.");
  270. continue;
  271. } else {
  272. XMLNode Body = response.getChildNode("Body", 0);
  273. if(!Body.isEmpty()){
  274. XMLNode ProbeMatches = Body.getChildNode("ProbeMatches", 0);//EndpointReference
  275. if(!ProbeMatches.isEmpty()) {
  276. int matches = ProbeMatches.nChildNode();
  277. OBSERVER_RESULT *tRecord;
  278. for(int index=0;index<matches;index++){
  279. XMLNode ProbeMatch = ProbeMatches.getChildNode("ProbeMatch", index);
  280. tRecord = (OBSERVER_RESULT *)malloc(sizeof(OBSERVER_RESULT));
  281. if (tRecord != NULL){
  282. memset(tRecord, 0, sizeof(OBSERVER_RESULT));
  283. tRecord->resultID = me->AddressID;
  284. if(!ProbeMatch.isEmpty()) {
  285. {
  286. XMLNode node = ProbeMatch.getChildNode("EndpointReference", 0);
  287. if(!node.isEmpty()) {
  288. XMLNode nod = node.getChildNode("Address", 0);
  289. char tBuf[CLOG];
  290. sprintf(tBuf,"%s", nod.getText(0));
  291. CArray *tArr;
  292. tArr = explode(':',tBuf);
  293. for(int j=0; j<tArr->size(); j++) {
  294. if( strlen(tArr->at(j)) > 10 ) {
  295. sprintf(tRecord->RefID,"%s",tArr->at(j));
  296. break;
  297. };
  298. };
  299. tArr->clear();
  300. delete(tArr);
  301. };
  302. }
  303. {
  304. XMLNode node = ProbeMatch.getChildNode("Types", 0);
  305. char tBuf[CLOG];
  306. sprintf(tBuf,"%s", node.getText(0));
  307. CArray *tArr;
  308. tArr = explode(' ',tBuf);
  309. sprintf(tRecord->Type,"%s",tArr->at(0));
  310. tArr->clear();
  311. delete(tArr);
  312. }
  313. {
  314. XMLNode node = ProbeMatch.getChildNode("Scopes", 0);
  315. char tBuf[CLOG];
  316. sprintf(tBuf,"%s", node.getText(0));
  317. CArray *tArr;
  318. tArr = explode(' ',tBuf);
  319. if( tArr->size() > 0 ) {
  320. for( int index = 0; index < tArr->size(); index++){
  321. char *tPtr;
  322. if( tPtr = strstr( tArr->at(index), "mac/" ) ){
  323. sprintf(tRecord->MAC,"%s",tPtr+4);
  324. };
  325. if( tPtr = strstr( tArr->at(index), "hardware/" ) ){
  326. sprintf(tRecord->Hardware,"%s",tPtr+9);
  327. };
  328. if( tPtr = strstr( tArr->at(index), "name/" ) ){
  329. sprintf(tRecord->Name,"%s",tPtr+5);
  330. };
  331. if (tPtr = strstr(tArr->at(index), "MAC/")) {
  332. sprintf(tRecord->MAC, "%s", tPtr + 4);
  333. };
  334. if (tPtr = strstr(tArr->at(index), "HARDWARE/")) {
  335. sprintf(tRecord->Hardware, "%s", tPtr + 9);
  336. };
  337. if (tPtr = strstr(tArr->at(index), "NAME/")) {
  338. sprintf(tRecord->Name, "%s", tPtr + 5);
  339. };
  340. };
  341. tArr->clear();
  342. };
  343. delete(tArr);
  344. }
  345. {
  346. XMLNode node = ProbeMatch.getChildNode("XAddrs", 0);
  347. char tBuf[CLOG];
  348. sprintf(tBuf,"%s", node.getText(0));
  349. CArray *tArr;
  350. tArr = explode(' ',tBuf);
  351. if( tArr->size() > 0 ) {
  352. for(int index=0; index < tArr->size(); index++) {
  353. if( strstr( tArr->at(index), "[" ) != NULL ){
  354. // IPv6
  355. } else{
  356. // IPv4
  357. sprintf(tRecord->XAddrs,"%s",tArr->at(0));
  358. };
  359. };
  360. tArr->clear();
  361. };
  362. delete(tArr);
  363. }
  364. };
  365. me->observer->m_vResultPool.push_back(tRecord);
  366. };
  367. };
  368. };
  369. };
  370. };
  371. };
  372. };
  373. me->observer->m_nStatus += me->step;
  374. #ifdef DEBUG_EXTRA
  375. TLOG("Probe Finished");
  376. #endif
  377. #ifdef __linux__
  378. close(me->socketFD);
  379. #else
  380. closesocket(me->socketFD);
  381. #endif
  382. free( me );
  383. return NULL;
  384. };
  385. bool argusModuleOnvifObserver::startProbe(CSTR IP, int ID, int stp){
  386. #ifdef DEBUG_EXTRA
  387. LOG("Starting Probe!");
  388. LOG( IP );
  389. #endif
  390. PROBE_CTX *tVal = init_PROBE_CTX(IP, ID, stp);
  391. if( tVal == NULL ) return false;
  392. OBSERVER_CTX *tThread;
  393. tThread = (OBSERVER_CTX *) malloc(sizeof(OBSERVER_CTX));
  394. if( tThread != NULL ){
  395. memset( tThread, 0, sizeof(OBSERVER_CTX));
  396. #ifdef __linux__
  397. int RetVal = pthread_create( &tThread->m_hThreadHandle, NULL, probeThreadProc, ( void * ) tVal );
  398. if( RetVal == -1 ) {
  399. LOG_ERROR("Thread Creation Faled.");
  400. free(tVal);
  401. free(tThread);
  402. return false;
  403. };
  404. #else
  405. tThread->m_hThreadHandle = CreateThread(
  406. NULL,
  407. 0,
  408. (LPTHREAD_START_ROUTINE)probeThreadProc,
  409. (LPVOID)tVal,
  410. 0,
  411. &tThread->m_dwThreadID);
  412. if( tThread->m_hThreadHandle==NULL ){
  413. LOG_ERROR("Thread Creation Faled.");
  414. free(tVal);
  415. free(tThread);
  416. return false;
  417. };
  418. #endif
  419. tThread->context = tVal;
  420. m_vThreads.push_back(tThread);
  421. #ifdef DEBUG_EXTRA
  422. LOG("Probe Created");
  423. #endif
  424. return true;
  425. } else {
  426. LOG_ERROR("Can not allocate Memory for Probe CTX");
  427. free(tVal);
  428. };
  429. return false;
  430. };
  431. bool argusModuleOnvifObserver::validate(){
  432. if( m_vResultPool.size() ){ // Clear structures
  433. for( vectorOBSERVER_RESULT::iterator index = m_vResultPool.begin(); index < m_vResultPool.end(); index++){
  434. #ifdef DEBUG_EXTRA
  435. char tBuffer[256];
  436. sprintf( tBuffer, "Found Camwera [%s] %s", (*index)->XAddrs, (*index)->RefID );
  437. LOG( tBuffer );
  438. #endif
  439. uint32_t cid = m_pDBC->getCamId( (*index)->RefID ); //isCameraListed( DiscoverResults->at(index)->RefID );
  440. if( cid ) {
  441. #ifdef DEBUG_EXTRA
  442. sprintf( tBuffer, "Camera is Listed as %d", cid );
  443. LOG( tBuffer );
  444. #endif
  445. m_pDBC->updateIPCam( m_pKernel->getSiteId(), cid, (*index)->XAddrs );// DiscoverResults->at(index));
  446. } else {
  447. // Uncknown camera - no checking
  448. #ifdef DEBUG_EXTRA
  449. LOG("Camera is Not Listed");
  450. #endif
  451. m_pDBC->addIPCam( m_pKernel->getSiteId(), (*index) );
  452. };
  453. free(*index);
  454. }
  455. m_vResultPool.clear();
  456. #ifdef DEBUG_EXTRA
  457. LOG("Clear Structs Done!");
  458. #endif
  459. } else {
  460. #ifdef DEBUG_EXTRA
  461. LOG("No Online IP Cameras in Network");
  462. #endif
  463. };
  464. return true;
  465. };
  466. #undef LOG
  467. #undef LOG_ERROR
  468. #undef TLOG
  469. #undef TLOG_ERROR