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.
94 lines
3.0 KiB
94 lines
3.0 KiB
#ifndef __KERNEL_MODULE_ONVIF_OBSERVER_HEADER__
|
|
#define __KERNEL_MODULE_ONVIF_OBSERVER_HEADER__
|
|
|
|
#include <sys/socket.h>
|
|
#include <netinet/in.h>
|
|
#include <arpa/inet.h>
|
|
#include <ifaddrs.h>
|
|
#include <fcntl.h>
|
|
|
|
#include "kernelModule.h"
|
|
#include "../../data/protocol/xmlParser.h"
|
|
#include "../../components/base/basicThread.h"
|
|
#include "../../components/base/basicMutex.h"
|
|
#include "../../components/base/basicEventHeap.h"
|
|
#include "../../components/base/basicFunctionality.h"
|
|
|
|
#pragma warning(disable: 4251)
|
|
|
|
#define HTTPMU_HOST_ADDRESS "239.255.255.250"
|
|
#define HTTPMU_HOST_PORT 3702
|
|
|
|
|
|
//#define DEBUG_ONVIF_PRINTOUT_MESSAGES
|
|
|
|
#define DEFAULT_HTTP_PORT 80
|
|
|
|
typedef std::vector<OBSERVER_RESULT*> vectorOBSERVER_RESULT;
|
|
|
|
class kernelModuleOnvifObserver;
|
|
|
|
typedef struct S_PROBE_CTX{
|
|
int AddressID;
|
|
char IpAddress[16];
|
|
int Port;
|
|
int socketFD;
|
|
char buff[MAX_BUFF_SIZE + 1];
|
|
CSTR send_buff;
|
|
CSTR recv_buff;
|
|
struct sockaddr_in r_address;
|
|
bool bOptVal;
|
|
int bOptLen;
|
|
int iOptLen;
|
|
int RetVal;
|
|
int index;
|
|
bool isFinished;
|
|
kernelModuleOnvifObserver * observer;
|
|
}PROBE_CTX;
|
|
|
|
typedef struct S_OBSERVER_CTX{
|
|
DWORD m_dwThreadID;
|
|
#ifdef __linux__
|
|
pthread_t m_hThreadHandle;
|
|
#else
|
|
HANDLE m_hThreadHandle;
|
|
#endif
|
|
PROBE_CTX * context;
|
|
}OBSERVER_CTX;
|
|
|
|
typedef std::vector<OBSERVER_CTX*> vectorOBSERVER_CTX;
|
|
|
|
|
|
class kernelModuleOnvifObserver: public kernelModule, public basicThread {
|
|
private:
|
|
basicEventHeap * m_pEventHeap;
|
|
//enumeratorInfo m_vLocalDevices;
|
|
//localIpAddresses m_vIpAddresses;
|
|
|
|
vectorOBSERVER_RESULT m_vResultPool;
|
|
basicMutex m_mResultProtector;
|
|
basicMutex m_mNIFMUTEX;
|
|
vectorCSTR m_vNIFIPS;
|
|
bool m_bProbeIsActive;
|
|
bool m_bWSAOK;
|
|
uint8_t m_bCurrentNIF;
|
|
|
|
//PROBE_CTX * init_PROBE_CTX( CSTR ADR, int ID );
|
|
//bool loadAssignedSources(void);
|
|
//bool startProbe( CSTR IP, int ID );
|
|
//static void * probeThreadProc(void *);
|
|
OBSERVER_RESULT * parseXML( CSTR data );
|
|
protected:
|
|
virtual void m_fThreadProc( void );
|
|
|
|
public:
|
|
explicit kernelModuleOnvifObserver( uint32_t moduleID );
|
|
~kernelModuleOnvifObserver();
|
|
virtual bool reloadSettings();
|
|
virtual bool startService();
|
|
virtual bool stopService( bool force = false );
|
|
virtual bool dispatchEvent(EVENT_CONTAINER *Evt);
|
|
virtual bool validate();
|
|
};
|
|
|
|
#endif
|