@ -1,25 +1,30 @@
# include "ponvif.h"
# include "ponvif.h"
# include <unistd.h>
# include <fcntl.h>
# include <fcntl.h>
# include <netdb.h>
# include <sys/types.h> /* See NOTES */
# include <sys/types.h> /* See NOTES */
# include <sys/socket.h>
# include <stdio.h>
# include <stdio.h>
# include <stdlib.h>
# include <stdlib.h>
# include <unistd.h>
# include <string.h>
# include <string.h>
# include <sys/types.h>
# include <sys/types.h>
# include <sys/socket.h>
# include <arpa/inet.h>
# include <netinet/in.h>
//http://dspace.nplg.gov.ge/handle/1234/3051
//http://dspace.nplg.gov.ge/handle/1234/3051
//http://dspace.nplg.gov.ge/handle/1234/3057
//http://dspace.nplg.gov.ge/handle/1234/3057
//http://dspace.nplg.gov.ge/handle/1234/3061
//http://dspace.nplg.gov.ge/handle/1234/3061
# define LOG( X ) m_pLog->Log( "pOnVif", this, X )
# define TLOG( X ) basicLogCollection::getInstance()->Log( "TpOnVif", NULL, X )
# define LOG_ERROR( X ) m_pLog->Log( "pOnVif", this, _LOG_ERROR, X )
# define LOG( X ) m_pLog->Log( "PONVIF", this, X )
# define TLOG( X ) basicLogCollection::getInstance()->Log( "PONVIF_T", NULL, X )
# ifdef DEBUG
# define LOG_ERROR( X ) {\
char _tBfrErrMSG2w34 [ 256 ] ; \
sprintf ( _tBfrErrMSG2w34 , " In file %s[%d] in func:%s %s " , __FILE__ , __LINE__ , __func__ , X ) ; \
m_pLog - > Log ( " PONVIF " , this , _LOG_ERROR , _tBfrErrMSG2w34 ) ; \
}
# else
# define LOG_ERROR( X ) m_pLog->Log( "PONVIF", this, _LOG_ERROR, X );
# endif
inline bool checkBool ( const char * A ) {
inline bool checkBool ( const char * A ) {
if ( A = = NULL ) return false ;
if ( A = = NULL ) return false ;
@ -60,7 +65,7 @@ pOnvif::pOnvif(){
m_pDiscoveryMCastIP = NULL ; //PONVIF_DEFAULT_DISCOVERYMCASTIP;
m_pDiscoveryMCastIP = NULL ; //PONVIF_DEFAULT_DISCOVERYMCASTIP;
m_nDiscoveryMCastPort = PONVIF_DEFAULT_DISCOVERYMCASTPORT ;
m_nDiscoveryMCastPort = PONVIF_DEFAULT_DISCOVERYMCASTPORT ;
m_bDiscoveryHideDuplicates = true ;
m_bDiscoveryHideDuplicates = true ;
m_pHttpAccessManager = NULL ;
m_sCapabilities . Analytics = NULL ;
m_sCapabilities . Analytics = NULL ;
m_sCapabilities . Device = NULL ;
m_sCapabilities . Device = NULL ;
m_sCapabilities . Events = NULL ;
m_sCapabilities . Events = NULL ;
@ -201,15 +206,35 @@ CSTR pOnvif::getDeviceUri( void ){
return m_pDeviceURI ;
return m_pDeviceURI ;
} ;
} ;
bool pOnvif : : setDeviceUri ( CSTR deviceUri ) {
if ( m_pDeviceURI ! = NULL ) free ( m_pDeviceURI ) ;
bool pOnvif : : setDeviceUri ( CSTR deviceUri ) {
if ( deviceUri = = NULL | | strlen ( deviceUri ) = = 0 ) {
if ( deviceUri = = NULL | | strlen ( deviceUri ) = = 0 ) {
m_pDeviceURI = NULL ;
m_pDeviceURI = NULL ;
return tru e;
return fals e;
} ;
} ;
if ( strstr ( deviceUri , " http " ) = = NULL ) {
LOG_ERROR ( " Malformed device URI " ) ;
return false ;
} ;
if ( m_pDeviceURI ! = NULL ) free ( m_pDeviceURI ) ;
m_pDeviceURI = ( CSTR ) malloc ( strlen ( deviceUri ) + 1 ) ;
m_pDeviceURI = ( CSTR ) malloc ( strlen ( deviceUri ) + 1 ) ;
if ( m_pDeviceURI = = NULL ) return false ;
if ( m_pDeviceURI = = NULL ) return false ;
memcpy ( m_pDeviceURI , deviceUri , strlen ( deviceUri ) + 1 ) ;
memcpy ( m_pDeviceURI , deviceUri , strlen ( deviceUri ) ) ;
m_pDeviceURI [ strlen ( deviceUri ) ] = ( char ) 0 ;
//toDo: Must parsed Host/IP
char * tT = strstr ( m_pDeviceURI , " / " ) ;
if ( tT ) {
tT + = 2 ;
char * tB = strstr ( tT , " / " ) ;
int len = tB - tT + 1 ;
m_pIpAddress = ( CSTR ) malloc ( len ) ;
if ( m_pIpAddress ) {
len - - ;
memcpy ( m_pIpAddress , tT , len ) ;
m_pIpAddress [ len ] = ( char ) 0 ;
LOG ( m_pIpAddress ) ;
} ;
} ;
return true ;
return true ;
} ;
} ;
@ -218,14 +243,22 @@ CSTR pOnvif::getIPAddress( void ){
} ;
} ;
bool pOnvif : : setIPAddress ( CSTR ipAddress ) {
bool pOnvif : : setIPAddress ( CSTR ipAddress ) {
if ( m_pIpAddress ! = NULL ) free ( m_pIpAddress ) ;
if ( ipAddress = = NULL | | strlen ( ipAddress ) = = 0 ) {
if ( ipAddress = = NULL | | strlen ( ipAddress ) = = 0 ) {
m_pIpAddress = NULL ;
m_pIpAddress = NULL ;
return tru e;
return fals e;
} ;
} ;
if ( m_pIpAddress ! = NULL ) free ( m_pIpAddress ) ;
m_pIpAddress = ( CSTR ) malloc ( strlen ( ipAddress ) + 1 ) ;
m_pIpAddress = ( CSTR ) malloc ( strlen ( ipAddress ) + 1 ) ;
if ( m_pIpAddress = = NULL ) return false ;
if ( m_pIpAddress = = NULL ) return false ;
memcpy ( m_pIpAddress , ipAddress , strlen ( ipAddress ) + 1 ) ;
memcpy ( m_pIpAddress , ipAddress , strlen ( ipAddress ) ) ;
m_pIpAddress [ strlen ( ipAddress ) ] = ( char ) 0 ;
//ToDo: Must be created URI ... sprintf(tURL, "http://%s/onvif/device_service", m_pIpAddress);
int len = strlen ( ipAddress ) + 28 ;
m_pDeviceURI = ( CSTR ) malloc ( len + 1 ) ;
if ( m_pDeviceURI ) {
sprintf ( m_pDeviceURI , " http://%s/onvif/device_service " , m_pIpAddress ) ;
LOG ( m_pDeviceURI ) ;
} ;
return true ;
return true ;
} ;
} ;
@ -324,7 +357,11 @@ discoveryResults pOnvif::discover( void ){
CSTR tPostString = PONVIF_PACK_DISCOVERY ;
CSTR tPostString = PONVIF_PACK_DISCOVERY ;
struct sockaddr_in tSockAddr ;
struct sockaddr_in tSockAddr ;
struct hostent * h_info ;
struct hostent * h_info ;
# ifdef __linux__
int tSocket ;
int tSocket ;
# else
int tSocket ;
# endif
int RetCode ;
int RetCode ;
char Response [ DEFAULT_BUFFER_SIZE ] ;
char Response [ DEFAULT_BUFFER_SIZE ] ;
try {
try {
@ -335,7 +372,7 @@ discoveryResults pOnvif::discover( void ){
return RetVal ;
return RetVal ;
} ;
} ;
LOG ( " Socket Created! " ) ;
LOG ( " Socket Created! " ) ;
bzero ( & tSockAddr , sizeof ( struct sockaddr_in ) ) ;
memset ( & tSockAddr , 0 , sizeof ( struct sockaddr_in ) ) ;
h_info = gethostbyname ( m_pDiscoveryBindIP ) ;
h_info = gethostbyname ( m_pDiscoveryBindIP ) ;
if ( h_info = = NULL ) {
if ( h_info = = NULL ) {
LOG_ERROR ( " Some throuble with networking on this machine (Cannot Get Hostname)! " ) ;
LOG_ERROR ( " Some throuble with networking on this machine (Cannot Get Hostname)! " ) ;
@ -345,7 +382,7 @@ discoveryResults pOnvif::discover( void ){
//*****************************************
//*****************************************
//* there we building our network address *
//* there we building our network address *
//*****************************************
//*****************************************
bco py( h_info - > h_addr , & ( tSockAddr . sin_addr ) , h_info - > h_length ) ;
memc py( h_info - > h_addr , & ( tSockAddr . sin_addr ) , h_info - > h_length ) ;
tSockAddr . sin_family = h_info - > h_addrtype ;
tSockAddr . sin_family = h_info - > h_addrtype ;
tSockAddr . sin_port = htons ( 20000 + ( 20000 * rand ( ) ) / RAND_MAX ) ;
tSockAddr . sin_port = htons ( 20000 + ( 20000 * rand ( ) ) / RAND_MAX ) ;
@ -355,15 +392,31 @@ discoveryResults pOnvif::discover( void ){
return RetVal ;
return RetVal ;
} ;
} ;
LOG ( " Binding Done! " ) ;
LOG ( " Binding Done! " ) ;
//setsockopt( tSocket, IPPROTO_IP, MCAST_JOIN_GROUP, );
int tVal = 1 ;
setsockopt ( tSocket , SOL_SOCKET , SO_BROADCAST , & tVal , sizeof ( int ) ) ;
//socket_sendto($sock, $post_string, strlen(tPostString), 0, $this->discoverymcastip, $this->discoverymcastport);
sendto ( tSocket , tPostString , strlen ( tPostString ) , 0 , ( const sockaddr * ) & tSockAddr , sizeof ( struct sockaddr_in ) ) ;
LOG ( " Broadcast Ping Sent! " ) ;
# ifdef __linux__
//setsockopt( tSocket, IPPROTO_IP, MCAST_JOIN_GROUP, );
int tVal = 1 ;
setsockopt ( tSocket , SOL_SOCKET , SO_BROADCAST , & tVal , sizeof ( int ) ) ;
//socket_sendto($sock, $post_string, strlen(tPostString), 0, $this->discoverymcastip, $this->discoverymcastport);
sendto ( tSocket , tPostString , strlen ( tPostString ) , 0 , ( const sockaddr * ) & tSockAddr , sizeof ( struct sockaddr_in ) ) ;
LOG ( " Broadcast Ping Sent! " ) ;
fcntl ( tSocket , F_SETFL , fcntl ( tSocket , F_GETFL , 0 ) | O_NONBLOCK ) ;
fcntl ( tSocket , F_SETFL , fcntl ( tSocket , F_GETFL , 0 ) | O_NONBLOCK ) ;
//socket_set_nonblock($sock);
LOG ( " Socket Set Not Bloking Mode! " ) ;
LOG ( " Socket Set Not Bloking Mode! " ) ;
# else
//setsockopt( tSocket, IPPROTO_IP, MCAST_JOIN_GROUP, );
bool tVal = 1 ;
setsockopt ( tSocket , SOL_SOCKET , SO_BROADCAST , ( const char * ) & tVal , sizeof ( bool ) ) ;
//socket_sendto($sock, $post_string, strlen(tPostString), 0, $this->discoverymcastip, $this->discoverymcastport);
sendto ( tSocket , tPostString , strlen ( tPostString ) , 0 , ( const sockaddr * ) & tSockAddr , sizeof ( struct sockaddr_in ) ) ;
LOG ( " Broadcast Ping Sent! " ) ;
u_long arg = 1 ;
if ( ioctlsocket ( tSocket , FIONBIO , & arg ) < 0 ) {
char tBuf [ 128 ] ;
sprintf ( tBuf , " Error ioctlsocket(..., FIONBIO) (%s) " , strerror ( errno ) ) ;
LOG_ERROR ( tBuf ) ;
return RetVal ;
} ;
# endif
while ( time ( NULL ) < tTimeout ) {
while ( time ( NULL ) < tTimeout ) {
//n = recvfrom(sockfd, (char *)buffer, MAXLINE, MSG_WAITALL, (struct sockaddr *) &servaddr, &len);
//n = recvfrom(sockfd, (char *)buffer, MAXLINE, MSG_WAITALL, (struct sockaddr *) &servaddr, &len);
tVal = recvfrom ( tSocket , Response , DEFAULT_BUFFER_SIZE , 0 , NULL , NULL ) ;
tVal = recvfrom ( tSocket , Response , DEFAULT_BUFFER_SIZE , 0 , NULL , NULL ) ;
@ -386,7 +439,11 @@ discoveryResults pOnvif::discover( void ){
//};
//};
} ;
} ;
} ;
} ;
# ifdef __linux__
close ( tSocket ) ;
close ( tSocket ) ;
# else
closesocket ( tSocket ) ;
# endif
} catch ( exception e ) {
} catch ( exception e ) {
LOG_ERROR ( " Communication at Discovery Exception Catched! " ) ;
LOG_ERROR ( " Communication at Discovery Exception Catched! " ) ;
} ;
} ;
@ -397,20 +454,26 @@ discoveryResults pOnvif::discover( void ){
Public functions ( basic initialization method and other collaterals )
Public functions ( basic initialization method and other collaterals )
*/
*/
bool pOnvif : : create ( void ) {
bool pOnvif : : create ( void ) {
m_pHttpAccessManager = curlRequestsManager : : getInstance ( ) ;
if ( m_pHttpAccessManager = = NULL ) return false ;
LOG ( " CURL MANAGER OK " ) ;
try {
try {
struct tm * tTS ;
struct tm * tTS ;
tTS = core_GetSystemDateAndTime ( ) ;
tTS = core_GetSystemDateAndTime ( ) ;
if ( tTS ! = NULL ) {
if ( tTS ! = NULL ) {
time_t tTimeStamp = mktime ( tTS ) ;
time_t tTimeStamp = mktime ( tTS ) ;
m_nDeltaTime = time ( NULL ) - tTimeStamp - 5 ;
m_nDeltaTime = time ( NULL ) - tTimeStamp ; // -5;
free ( tTS ) ;
free ( tTS ) ;
} ;
} catch ( exception e ) { }
} else return false ;
} catch ( exception e ) {
LOG_ERROR ( " Catched Exception! " ) ;
return false ;
} ;
if ( ! core_GetCapabilities ( ) ) {
if ( ! core_GetCapabilities ( ) ) {
LOG_ERROR ( " Error Getting Caps! " ) ;
LOG_ERROR ( " Error Getting Caps! " ) ;
return false ;
return false ;
}
} ;
_getOnvifVersion ( m_sCapabilities ) ;
_getOnvifVersion ( m_sCapabilities ) ;
// Update some Vars Online!
// Update some Vars Online!
//preg_match("/^http(.*)onvif\//",$this->mediauri,$matches);
//preg_match("/^http(.*)onvif\//",$this->mediauri,$matches);
@ -430,13 +493,21 @@ bool pOnvif::create( void ) {
struct tm * pOnvif : : core_GetSystemDateAndTime ( void ) {
struct tm * pOnvif : : core_GetSystemDateAndTime ( void ) {
struct tm * RetVal = NULL ;
struct tm * RetVal = NULL ;
char tURL [ CTEXT ] ;
char tURL [ CTEXT ] ;
sprintf ( tURL , " http://%s/onvif/device_service " , m_pIpAddress ) ;
if ( _send_request ( tURL , PONVIF_PACK_GET_SYS_DTS ) ) {
if ( m_pDeviceURI ! = NULL ) {
sprintf ( tURL , m_pDeviceURI ) ;
} else {
if ( m_pIpAddress ! = NULL ) {
sprintf ( tURL , " http://%s/onvif/device_service " , m_pIpAddress ) ;
} else {
return NULL ;
} ;
} ;
LOG ( " Before REQ " ) ;
if ( _send_request ( tURL , PONVIF_PACK_GET_SYS_DTS , true ) ) {
XMLResults tParseResults ;
XMLResults tParseResults ;
XMLNode response = XMLNode : : parseString ( m_pLastResponse , " root " , & tParseResults ) ;
XMLNode response = XMLNode : : parseString ( m_pLastResponse , " root " , & tParseResults ) ;
# ifdef DEBUG_ONVIF_PRINTOUT_MESSAGES
LOG ( " RCPT: " ) ;
printf ( m_pLastResponse ) ;
# ifdef DEBUG
LOG ( " core_GetSystemDateAndTime " ) ;
# endif
# endif
if ( tParseResults . error ) {
if ( tParseResults . error ) {
char tBuffer [ CTEXT ] ;
char tBuffer [ CTEXT ] ;
@ -493,7 +564,15 @@ bool pOnvif::core_GetCapabilities( void ){
accessToken tTOKEN ;
accessToken tTOKEN ;
tTOKEN = _makeToken ( ) ;
tTOKEN = _makeToken ( ) ;
char tURL [ CTEXT ] ;
char tURL [ CTEXT ] ;
sprintf ( tURL , " http://%s/onvif/device_service " , m_pIpAddress ) ;
if ( m_pDeviceURI ! = NULL ) {
sprintf ( tURL , m_pDeviceURI ) ;
} else {
if ( m_pIpAddress ! = NULL ) {
sprintf ( tURL , " http://%s/onvif/device_service " , m_pIpAddress ) ;
} else {
return NULL ;
} ;
} ;
//char tSTR[CTEXT];
//char tSTR[CTEXT];
sprintf ( tBuffer , PONVIF_PACK_GET_CAPABILITIES , tTOKEN . USERNAME , tTOKEN . PASSDIGEST , tTOKEN . NONCE , tTOKEN . TIMESTAMP ) ;
sprintf ( tBuffer , PONVIF_PACK_GET_CAPABILITIES , tTOKEN . USERNAME , tTOKEN . PASSDIGEST , tTOKEN . NONCE , tTOKEN . TIMESTAMP ) ;
//sprintf( tSTR, PONVIF_PCK_GET_CAPABILITIES, tTOKEN.USERNAME, tTOKEN.PASSDIGEST, tTOKEN.NONCE, tTOKEN.TIMESTAMP );
//sprintf( tSTR, PONVIF_PCK_GET_CAPABILITIES, tTOKEN.USERNAME, tTOKEN.PASSDIGEST, tTOKEN.NONCE, tTOKEN.TIMESTAMP );
@ -1312,28 +1391,17 @@ CSTR pOnvif::media_GetSnapshotUri( CSTR profileToken ){
} ;
} ;
return NULL ;
return NULL ;
} ;
} ;
bool pOnvif : : ptz_GetStatus ( CSTR profileToken , ptzStatus * tStatus ) {
bool pOnvif : : ptz_GetStatus ( CSTR profileToken , ptzStatus * tStatus ) {
if ( m_pPTZURI = = NULL ) return false ;
if ( m_pPTZURI = = NULL ) return false ;
if ( tStatus = = NULL ) return false ;
if ( tStatus = = NULL ) return false ;
char tBuffer [ DEFAULT_BUFFER_SIZE ] ;
char tBuffer [ DEFAULT_BUFFER_SIZE ] ;
accessToken tTOKEN ;
accessToken tTOKEN ;
tTOKEN = _makeToken ( ) ;
tTOKEN = _makeToken ( ) ;
sprintf ( tBuffer , PONVIF_PACK_GET_PTZ_STATUS , tTOKEN . USERNAME , tTOKEN . PASSDIGEST , tTOKEN . NONCE , tTOKEN . TIMESTAMP , profileToken ) ;
sprintf ( tBuffer , PONVIF_PACK_GET_PTZ_STATUS , tTOKEN . USERNAME , tTOKEN . PASSDIGEST , tTOKEN . NONCE , tTOKEN . TIMESTAMP , profileToken ) ;
if ( _send_request ( m_pPTZURI , tBuffer ) ) {
if ( _send_request ( m_pPTZURI , tBuffer , true ) ) {
XMLResults tParseResults ;
XMLResults tParseResults ;
XMLNode response = XMLNode : : parseString ( m_pLastResponse , " root " , & tParseResults ) ;
XMLNode response = XMLNode : : parseString ( m_pLastResponse , " root " , & tParseResults ) ;
//LOG( m_pLastResponse );
# ifdef DEBUG_ONVIF_PRINTOUT_MESSAGES
FILE * fd ;
fd = fopen ( " ONVIF_MSGS.txt " , " a+ " ) ;
fprintf ( fd , " -------------------- \r \n " ) ;
fprintf ( fd , m_pLastResponse ) ;
fprintf ( fd , " -------------------- \r \n " ) ;
fclose ( fd ) ;
# endif
if ( tParseResults . error ) {
if ( tParseResults . error ) {
char tBuf [ CTEXT ] ;
char tBuf [ CTEXT ] ;
sprintf ( tBuf , " XML Parse Error %d at %d:%d " , tParseResults . error , tParseResults . nLine , tParseResults . nColumn ) ;
sprintf ( tBuf , " XML Parse Error %d at %d:%d " , tParseResults . error , tParseResults . nLine , tParseResults . nColumn ) ;
@ -1441,18 +1509,7 @@ bool pOnvif::ptz_GotoPreset( CSTR profileToken, CSTR presetToken, float speed_pa
accessToken tTOKEN ;
accessToken tTOKEN ;
tTOKEN = _makeToken ( ) ;
tTOKEN = _makeToken ( ) ;
sprintf ( tBuffer , PONVIF_PACK_GOTO_PRESET , tTOKEN . USERNAME , tTOKEN . PASSDIGEST , tTOKEN . NONCE , tTOKEN . TIMESTAMP , profileToken , presetToken , speed_pantilt_x , speed_pantilt_y , speed_zoom_x ) ;
sprintf ( tBuffer , PONVIF_PACK_GOTO_PRESET , tTOKEN . USERNAME , tTOKEN . PASSDIGEST , tTOKEN . NONCE , tTOKEN . TIMESTAMP , profileToken , presetToken , speed_pantilt_x , speed_pantilt_y , speed_zoom_x ) ;
if ( _send_request ( m_pPTZURI , tBuffer ) ) {
XMLResults tParseResults ;
XMLNode response = XMLNode : : parseString ( m_pLastResponse , " root " , & tParseResults ) ;
LOG ( " RCPT: " ) ;
printf ( m_pLastResponse ) ;
if ( tParseResults . error ) {
char tBuf [ CTEXT ] ;
sprintf ( tBuf , " XML Parse Error %d at %d:%d " , tParseResults . error , tParseResults . nLine , tParseResults . nColumn ) ;
LOG_ERROR ( tBuf ) ;
} else return true ;
} ;
return false ;
return _send_request ( m_pPTZURI , tBuffer , true ) ;
} ;
} ;
bool pOnvif : : ptz_RemovePreset ( CSTR profileToken , CSTR presetToken ) {
bool pOnvif : : ptz_RemovePreset ( CSTR profileToken , CSTR presetToken ) {
@ -1461,18 +1518,7 @@ bool pOnvif::ptz_RemovePreset( CSTR profileToken, CSTR presetToken ){
accessToken tTOKEN ;
accessToken tTOKEN ;
tTOKEN = _makeToken ( ) ;
tTOKEN = _makeToken ( ) ;
sprintf ( tBuffer , PONVIF_PACK_REMOVE_PRESET , tTOKEN . USERNAME , tTOKEN . PASSDIGEST , tTOKEN . NONCE , tTOKEN . TIMESTAMP , profileToken , presetToken ) ;
sprintf ( tBuffer , PONVIF_PACK_REMOVE_PRESET , tTOKEN . USERNAME , tTOKEN . PASSDIGEST , tTOKEN . NONCE , tTOKEN . TIMESTAMP , profileToken , presetToken ) ;
if ( _send_request ( m_pPTZURI , tBuffer ) ) {
XMLResults tParseResults ;
XMLNode response = XMLNode : : parseString ( m_pLastResponse , " root " , & tParseResults ) ;
LOG ( " RCPT: " ) ;
printf ( m_pLastResponse ) ;
if ( tParseResults . error ) {
char tBuf [ CTEXT ] ;
sprintf ( tBuf , " XML Parse Error %d at %d:%d " , tParseResults . error , tParseResults . nLine , tParseResults . nColumn ) ;
LOG_ERROR ( tBuf ) ;
} else return true ;
} ;
return false ;
return _send_request ( m_pPTZURI , tBuffer , true ) ;
} ;
} ;
bool pOnvif : : ptz_SetPreset ( CSTR profileToken , CSTR presetName ) {
bool pOnvif : : ptz_SetPreset ( CSTR profileToken , CSTR presetName ) {
@ -1481,18 +1527,7 @@ bool pOnvif::ptz_SetPreset( CSTR profileToken, CSTR presetName ){
accessToken tTOKEN ;
accessToken tTOKEN ;
tTOKEN = _makeToken ( ) ;
tTOKEN = _makeToken ( ) ;
sprintf ( tBuffer , PONVIF_PACK_SET_PRESET , tTOKEN . USERNAME , tTOKEN . PASSDIGEST , tTOKEN . NONCE , tTOKEN . TIMESTAMP , profileToken , presetName ) ;
sprintf ( tBuffer , PONVIF_PACK_SET_PRESET , tTOKEN . USERNAME , tTOKEN . PASSDIGEST , tTOKEN . NONCE , tTOKEN . TIMESTAMP , profileToken , presetName ) ;
if ( _send_request ( m_pPTZURI , tBuffer ) ) {
XMLResults tParseResults ;
XMLNode response = XMLNode : : parseString ( m_pLastResponse , " root " , & tParseResults ) ;
LOG ( " RCPT: " ) ;
printf ( m_pLastResponse ) ;
if ( tParseResults . error ) {
char tBuf [ CTEXT ] ;
sprintf ( tBuf , " XML Parse Error %d at %d:%d " , tParseResults . error , tParseResults . nLine , tParseResults . nColumn ) ;
LOG_ERROR ( tBuf ) ;
} else return true ;
} ;
return false ;
return _send_request ( m_pPTZURI , tBuffer , true ) ;
} ;
} ;
bool pOnvif : : ptz_RelativeMove ( CSTR profileToken , float translation_pantilt_x , float translation_pantilt_y , float speed_pantilt_x , float speed_pantilt_y ) {
bool pOnvif : : ptz_RelativeMove ( CSTR profileToken , float translation_pantilt_x , float translation_pantilt_y , float speed_pantilt_x , float speed_pantilt_y ) {
@ -1501,18 +1536,7 @@ bool pOnvif::ptz_RelativeMove( CSTR profileToken, float translation_pantilt_x, f
accessToken tTOKEN ;
accessToken tTOKEN ;
tTOKEN = _makeToken ( ) ;
tTOKEN = _makeToken ( ) ;
sprintf ( tBuffer , PONVIF_PACK_RELATIVE_MOVE , tTOKEN . USERNAME , tTOKEN . PASSDIGEST , tTOKEN . NONCE , tTOKEN . TIMESTAMP , profileToken , translation_pantilt_x , translation_pantilt_y , speed_pantilt_x , speed_pantilt_y ) ;
sprintf ( tBuffer , PONVIF_PACK_RELATIVE_MOVE , tTOKEN . USERNAME , tTOKEN . PASSDIGEST , tTOKEN . NONCE , tTOKEN . TIMESTAMP , profileToken , translation_pantilt_x , translation_pantilt_y , speed_pantilt_x , speed_pantilt_y ) ;
if ( _send_request ( m_pPTZURI , tBuffer ) ) {
XMLResults tParseResults ;
XMLNode response = XMLNode : : parseString ( m_pLastResponse , " root " , & tParseResults ) ;
LOG ( " RCPT: " ) ;
printf ( m_pLastResponse ) ;
if ( tParseResults . error ) {
char tBuf [ CTEXT ] ;
sprintf ( tBuf , " XML Parse Error %d at %d:%d " , tParseResults . error , tParseResults . nLine , tParseResults . nColumn ) ;
LOG_ERROR ( tBuf ) ;
} else return true ;
} ;
return false ;
return _send_request ( m_pPTZURI , tBuffer , true ) ;
} ;
} ;
bool pOnvif : : ptz_RelativeMoveZoom ( CSTR profileToken , float zoom , float speedZoom ) {
bool pOnvif : : ptz_RelativeMoveZoom ( CSTR profileToken , float zoom , float speedZoom ) {
@ -1521,16 +1545,7 @@ bool pOnvif::ptz_RelativeMoveZoom( CSTR profileToken, float zoom, float speedZoo
accessToken tTOKEN ;
accessToken tTOKEN ;
tTOKEN = _makeToken ( ) ;
tTOKEN = _makeToken ( ) ;
sprintf ( tBuffer , PONVIF_PACK_RELATIVE_ZOOM , tTOKEN . USERNAME , tTOKEN . PASSDIGEST , tTOKEN . NONCE , tTOKEN . TIMESTAMP , profileToken , zoom , speedZoom ) ;
sprintf ( tBuffer , PONVIF_PACK_RELATIVE_ZOOM , tTOKEN . USERNAME , tTOKEN . PASSDIGEST , tTOKEN . NONCE , tTOKEN . TIMESTAMP , profileToken , zoom , speedZoom ) ;
if ( _send_request ( m_pPTZURI , tBuffer ) ) {
XMLResults tParseResults ;
XMLNode response = XMLNode : : parseString ( m_pLastResponse , " root " , & tParseResults ) ;
if ( tParseResults . error ) {
char tBuf [ CTEXT ] ;
sprintf ( tBuf , " XML Parse Error %d at %d:%d " , tParseResults . error , tParseResults . nLine , tParseResults . nColumn ) ;
LOG_ERROR ( tBuf ) ;
} else return true ;
} ;
return false ;
return _send_request ( m_pPTZURI , tBuffer , true ) ;
} ;
} ;
bool pOnvif : : ptz_AbsoluteMove ( CSTR profileToken , float position_pantilt_x , float position_pantilt_y , float zoom ) {
bool pOnvif : : ptz_AbsoluteMove ( CSTR profileToken , float position_pantilt_x , float position_pantilt_y , float zoom ) {
@ -1539,32 +1554,7 @@ bool pOnvif::ptz_AbsoluteMove( CSTR profileToken, float position_pantilt_x, floa
accessToken tTOKEN ;
accessToken tTOKEN ;
tTOKEN = _makeToken ( ) ;
tTOKEN = _makeToken ( ) ;
sprintf ( tBuffer , PONVIF_PACK_ABSOLUTE_MOVE , tTOKEN . USERNAME , tTOKEN . PASSDIGEST , tTOKEN . NONCE , tTOKEN . TIMESTAMP , profileToken , position_pantilt_x , position_pantilt_y , zoom ) ;
sprintf ( tBuffer , PONVIF_PACK_ABSOLUTE_MOVE , tTOKEN . USERNAME , tTOKEN . PASSDIGEST , tTOKEN . NONCE , tTOKEN . TIMESTAMP , profileToken , position_pantilt_x , position_pantilt_y , zoom ) ;
# ifdef DEBUG_ONVIF_TRAFFIC
FILE * tf ;
tf = fopen ( " Traffic.txt " , " a+ " ) ;
fprintf ( tf , " %s \n " , tBuffer ) ;
# endif
if ( _send_request ( m_pPTZURI , tBuffer ) ) {
XMLResults tParseResults ;
XMLNode response = XMLNode : : parseString ( m_pLastResponse , " root " , & tParseResults ) ;
# ifdef DEBUG_ONVIF_TRAFFIC
fprintf ( tf , " %s \n " , m_pLastResponse ) ;
# endif
if ( tParseResults . error ) {
char tBuf [ CTEXT ] ;
sprintf ( tBuf , " XML Parse Error %d at %d:%d " , tParseResults . error , tParseResults . nLine , tParseResults . nColumn ) ;
LOG_ERROR ( tBuf ) ;
} else {
# ifdef DEBUG_ONVIF_TRAFFIC
fclose ( tf ) ;
# endif
return true ;
} ;
} ;
# ifdef DEBUG_ONVIF_TRAFFIC
fclose ( tf ) ;
# endif
return false ;
return _send_request ( m_pPTZURI , tBuffer , false ) ;
} ;
} ;
bool pOnvif : : ptz_ContinuousMove ( CSTR profileToken , float velocity_pantilt_x , float velocity_pantilt_y ) {
bool pOnvif : : ptz_ContinuousMove ( CSTR profileToken , float velocity_pantilt_x , float velocity_pantilt_y ) {
@ -1573,41 +1563,7 @@ bool pOnvif::ptz_ContinuousMove( CSTR profileToken, float velocity_pantilt_x, fl
accessToken tTOKEN ;
accessToken tTOKEN ;
tTOKEN = _makeToken ( ) ;
tTOKEN = _makeToken ( ) ;
sprintf ( tBuffer , PONVIF_PACK_CONTINUOUS_MOVE , tTOKEN . USERNAME , tTOKEN . PASSDIGEST , tTOKEN . NONCE , tTOKEN . TIMESTAMP , profileToken , velocity_pantilt_x , velocity_pantilt_y ) ;
sprintf ( tBuffer , PONVIF_PACK_CONTINUOUS_MOVE , tTOKEN . USERNAME , tTOKEN . PASSDIGEST , tTOKEN . NONCE , tTOKEN . TIMESTAMP , profileToken , velocity_pantilt_x , velocity_pantilt_y ) ;
/*
# ifdef DEBUG_ONVIF_TRAFFIC
FILE * tf ;
tf = fopen ( " Traffic.txt " , " a+ " ) ;
fprintf ( tf , " -------------------- \r \n " ) ;
fprintf ( tf , " >>>>> %s \n " , tBuffer ) ;
fprintf ( tf , " -------------------- \r \n " ) ;
# endif
*/
return _send_request ( m_pPTZURI , tBuffer ) ;
/*
if ( _send_request ( m_pPTZURI , tBuffer ) ) {
XMLResults tParseResults ;
XMLNode response = XMLNode : : parseString ( m_pLastResponse , " root " , & tParseResults ) ;
# ifdef DEBUG_ONVIF_TRAFFIC
fprintf ( tf , " -------------------- \r \n " ) ;
fprintf ( tf , " <<<<< %s \n " , m_pLastResponse ) ;
fprintf ( tf , " -------------------- \r \n " ) ;
# endif
if ( tParseResults . error ) {
char tBuf [ CTEXT ] ;
sprintf ( tBuf , " XML Parse Error %d at %d:%d " , tParseResults . error , tParseResults . nLine , tParseResults . nColumn ) ;
LOG_ERROR ( tBuf ) ;
} else {
# ifdef DEBUG_ONVIF_TRAFFIC
fclose ( tf ) ;
# endif
return true ;
} ;
} ;
# ifdef DEBUG_ONVIF_TRAFFIC
fclose ( tf ) ;
# endif
return false ;
//*/
return _send_request ( m_pPTZURI , tBuffer , true ) ;
} ;
} ;
bool pOnvif : : ptz_ContinuousMoveZoom ( CSTR profileToken , float zoom ) {
bool pOnvif : : ptz_ContinuousMoveZoom ( CSTR profileToken , float zoom ) {
@ -1616,39 +1572,7 @@ bool pOnvif::ptz_ContinuousMoveZoom( CSTR profileToken, float zoom ){
accessToken tTOKEN ;
accessToken tTOKEN ;
tTOKEN = _makeToken ( ) ;
tTOKEN = _makeToken ( ) ;
sprintf ( tBuffer , PONVIF_PACK_CONTINUOUS_ZOOM , tTOKEN . USERNAME , tTOKEN . PASSDIGEST , tTOKEN . NONCE , tTOKEN . TIMESTAMP , profileToken , zoom ) ;
sprintf ( tBuffer , PONVIF_PACK_CONTINUOUS_ZOOM , tTOKEN . USERNAME , tTOKEN . PASSDIGEST , tTOKEN . NONCE , tTOKEN . TIMESTAMP , profileToken , zoom ) ;
//#ifdef DEBUG_ONVIF_TRAFFIC
// FILE *tf;
// tf = fopen("Traffic.txt", "a+");
// fprintf( tf, "--------------------\r\n");
// fprintf( tf, ">>>>> %s\n", tBuffer );
// fprintf( tf, "--------------------\r\n");
//#endif
return _send_request ( m_pPTZURI , tBuffer ) ;
/*
if ( _send_request ( m_pPTZURI , tBuffer ) ) {
XMLResults tParseResults ;
XMLNode response = XMLNode : : parseString ( m_pLastResponse , " root " , & tParseResults ) ;
# ifdef DEBUG_ONVIF_TRAFFIC
fprintf ( tf , " -------------------- \r \n " ) ;
fprintf ( tf , " <<<<< %s \n " , m_pLastResponse ) ;
fprintf ( tf , " -------------------- \r \n " ) ;
# endif
if ( tParseResults . error ) {
char tBuf [ CTEXT ] ;
sprintf ( tBuf , " XML Parse Error %d at %d:%d " , tParseResults . error , tParseResults . nLine , tParseResults . nColumn ) ;
LOG_ERROR ( tBuf ) ;
} else {
# ifdef DEBUG_ONVIF_TRAFFIC
fclose ( tf ) ;
# endif
return true ;
}
} ;
# ifdef DEBUG_ONVIF_TRAFFIC
fclose ( tf ) ;
# endif
return false ;
// */
return _send_request ( m_pPTZURI , tBuffer , true ) ;
} ;
} ;
bool pOnvif : : ptz_Stop ( CSTR profileToken , bool pantilt , bool zoom ) {
bool pOnvif : : ptz_Stop ( CSTR profileToken , bool pantilt , bool zoom ) {
@ -1657,19 +1581,7 @@ bool pOnvif::ptz_Stop( CSTR profileToken, bool pantilt, bool zoom ){
accessToken tTOKEN ;
accessToken tTOKEN ;
tTOKEN = _makeToken ( ) ;
tTOKEN = _makeToken ( ) ;
sprintf ( tBuffer , PONVIF_PACK_PTZ_STOP , tTOKEN . USERNAME , tTOKEN . PASSDIGEST , tTOKEN . NONCE , tTOKEN . TIMESTAMP , profileToken ) ; //, pantilt, zoom );
sprintf ( tBuffer , PONVIF_PACK_PTZ_STOP , tTOKEN . USERNAME , tTOKEN . PASSDIGEST , tTOKEN . NONCE , tTOKEN . TIMESTAMP , profileToken ) ; //, pantilt, zoom );
return _send_request ( m_pPTZURI , tBuffer ) ;
/*if( _send_request( m_pPTZURI, tBuffer ) ){
XMLResults tParseResults ;
XMLNode response = XMLNode : : parseString ( m_pLastResponse , " root " , & tParseResults ) ;
printf ( m_pLastResponse ) ;
if ( tParseResults . error ) {
char tBuf [ CTEXT ] ;
sprintf ( tBuf , " XML Parse Error %d at %d:%d " , tParseResults . error , tParseResults . nLine , tParseResults . nColumn ) ;
LOG_ERROR ( tBuf ) ;
} else return true ;
} ;
return false ;
*/
return _send_request ( m_pPTZURI , tBuffer , true ) ;
} ;
} ;
/*
/*
@ -1770,7 +1682,7 @@ accessToken pOnvif::_passwordDigest( CSTR username, CSTR password, time_t timest
accessToken RetVal ;
accessToken RetVal ;
char tTS [ CTEXT ] ;
char tTS [ CTEXT ] ;
unsigned char * tPDIGEST ;
unsigned char * tPDIGEST ;
if ( timestamp = = 0 | | 1 ) {
if ( timestamp = = 0 ) {
time_t t ;
time_t t ;
struct tm * tmp ;
struct tm * tmp ;
t = time ( NULL ) ;
t = time ( NULL ) ;
@ -1791,7 +1703,7 @@ accessToken pOnvif::_passwordDigest( CSTR username, CSTR password, time_t timest
LOG_ERROR ( " strftime returned 0! " ) ;
LOG_ERROR ( " strftime returned 0! " ) ;
} ;
} ;
} ;
} ;
if ( nonce = = 0 | | 1 ) {
if ( nonce = = 0 ) {
nonce = ( uint32_t ) rand ( ) ;
nonce = ( uint32_t ) rand ( ) ;
} ;
} ;
unsigned char tBuff [ CTEXT ] ;
unsigned char tBuff [ CTEXT ] ;
@ -1827,9 +1739,72 @@ accessToken pOnvif::_passwordDigest( CSTR username, CSTR password, time_t timest
free ( tPDIGEST ) ;
free ( tPDIGEST ) ;
//$REQ['NONCE']=base64_encode($nonce); // alternative
//$REQ['NONCE']=base64_encode($nonce); // alternative
return RetVal ;
return RetVal ;
}
} ;
bool pOnvif : : _send_request ( CSTR url , CSTR post_string ) {
void * pOnvif : : parser ( void * obj , void * ptr ) {
pOnvif * ME = ( pOnvif * ) obj ;
curlRequest * RQ = ( curlRequest * ) ptr ;
if ( ME ) {
if ( ME - > m_pLastResponse ) free ( ME - > m_pLastResponse ) ;
ME - > m_pLastResponse = ( CSTR ) malloc ( RQ - > getSize ( ) + 1 ) ;
if ( ME - > m_pLastResponse ) {
memcpy ( ME - > m_pLastResponse , RQ - > getBuffer ( ) , RQ - > getSize ( ) ) ;
ME - > m_pLastResponse [ RQ - > getSize ( ) ] = ( char ) 0 ;
# ifdef DEBUG_ONVIF_TRAFFIC
FILE * tf ;
tf = fopen ( " Traffic.txt " , " a+ " ) ;
fprintf ( tf , " ~~~~~~~~~~~~~~~~~~~~ \r \n " ) ;
fprintf ( tf , " <<<<< [%d] %s \n " , RQ - > getSize ( ) , ME - > m_pLastResponse ) ;
fprintf ( tf , " ~~~~~~~~~~~~~~~~~~~~ \r \n " ) ;
fclose ( tf ) ;
# endif
} ;
ME - > parser_done = true ;
} ;
return NULL ;
} ;
bool pOnvif : : _send_request ( CSTR url , CSTR post_string , bool mustReturnData ) {
# ifdef CURL_MANAGER
bool RetVal = false ;
if ( m_pHttpAccessManager ) {
m_mResponseProtector . lock ( ) ;
curlRequest * tRC ; //application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetSystemDateAndTime"
tRC = new curlRequest ( url , ( CSTR ) " application/soap+xml; charset=utf-8; " ) ;
if ( tRC ! = NULL ) {
# ifdef DEBUG_ONVIF_TRAFFIC
FILE * tf ;
tf = fopen ( " Traffic.txt " , " a+ " ) ;
fprintf ( tf , " -------------------- \r \n " ) ;
fprintf ( tf , " REQ: %s (%d) \n " , url , strlen ( post_string ) ) ;
fprintf ( tf , " >>>>> %s \n " , post_string ) ;
fprintf ( tf , " -------------------- \r \n " ) ;
fclose ( tf ) ;
mustReturnData = true ; //In Debug Allways Read Return
# endif
tRC - > setCredentials ( m_pUsername , m_pPassword , false ) ;
tRC - > setPOST ( post_string , strlen ( post_string ) ) ;
if ( mustReturnData ) {
tRC - > setHandler ( ( void * ) this , pOnvif : : parser , ( void * ) tRC ) ;
if ( m_pHttpAccessManager - > accomplish ( tRC ) ) {
parser_done = false ;
uint8_t cnt = 200 ; // TO = 2 second
bool chk = false ;
while ( ! chk & & cnt - - ) {
chk = parser_done ;
SLEEP ( 10 ) ;
} ;
if ( chk ) RetVal = true ;
} ;
} else {
RetVal = m_pHttpAccessManager - > accomplish ( tRC ) ;
} ;
} ;
m_mResponseProtector . unlock ( ) ;
} ;
return RetVal ;
# else
char tBuffer [ CTEXT ] ;
char tBuffer [ CTEXT ] ;
if ( m_pCURL = = NULL ) {
if ( m_pCURL = = NULL ) {
if ( m_pLastResponse = = NULL ) {
if ( m_pLastResponse = = NULL ) {
@ -1844,18 +1819,18 @@ bool pOnvif::_send_request( CSTR url, CSTR post_string ){
curl_easy_setopt ( m_pCURL , CURLOPT_PROXYUSERPWD , tBuffer ) ;
curl_easy_setopt ( m_pCURL , CURLOPT_PROXYUSERPWD , tBuffer ) ;
} ;
} ;
} ;
} ;
curl_easy_setopt ( m_pCURL , CURLOPT_CONNECTTIMEOUT , 10 ) ;
curl_easy_setopt ( m_pCURL , CURLOPT_TIMEOUT , 10 ) ;
curl_easy_setopt ( m_pCURL , CURLOPT_CONNECTTIMEOUT , 1 ) ;
curl_easy_setopt ( m_pCURL , CURLOPT_TIMEOUT , 2 ) ;
curl_easy_setopt ( m_pCURL , CURLOPT_SSL_VERIFYPEER , 0 ) ;
curl_easy_setopt ( m_pCURL , CURLOPT_SSL_VERIFYPEER , 0 ) ;
curl_easy_setopt ( m_pCURL , CURLOPT_SSL_VERIFYHOST , 0 ) ;
curl_easy_setopt ( m_pCURL , CURLOPT_SSL_VERIFYHOST , 0 ) ;
curl_easy_setopt ( m_pCURL , CURLOPT_VERBOSE , 0 ) ;
curl_easy_setopt ( m_pCURL , CURLOPT_VERBOSE , 0 ) ;
curl_easy_setopt ( m_pCURL , CURLOPT_POST , 1 ) ;
curl_easy_setopt ( m_pCURL , CURLOPT_POST , 1 ) ;
curl_easy_setopt ( m_pCURL , CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS , 0 ) ;
curl_easy_setopt ( m_pCURL , CURLOPT_NOPROGRESS , 1 ) ;
curl_easy_setopt ( m_pCURL , CURLOPT_NOSIGNAL , 1 ) ;
//curl_easy_setopt( m_pCURL, CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS, 0 );
//curl_easy_setopt( m_pCURL, CURLOPT_NOPROGRESS, 1 );
//curl_easy_setopt( m_pCURL, CURLOPT_NOSIGNAL, 1 );
curl_easy_setopt ( m_pCURL , CURLOPT_TCP_FASTOPEN , 1 ) ;
curl_easy_setopt ( m_pCURL , CURLOPT_TCP_FASTOPEN , 1 ) ;
curl_easy_setopt ( m_pCURL , CURLOPT_TCP_NODELAY , 1 ) ;
curl_easy_setopt ( m_pCURL , CURLOPT_TCP_NODELAY , 1 ) ;
curl_easy_setopt ( m_pCURL , CURLOPT_IPRESOLVE , CURL_IPRESOLVE_V4 ) ;
//curl_easy_setopt( m_pCURL, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 );
curl_easy_setopt ( m_pCURL , CURLOPT_WRITEFUNCTION , pOnvif : : _writer ) ;
curl_easy_setopt ( m_pCURL , CURLOPT_WRITEFUNCTION , pOnvif : : _writer ) ;
curl_easy_setopt ( m_pCURL , CURLOPT_WRITEDATA , this ) ;
curl_easy_setopt ( m_pCURL , CURLOPT_WRITEDATA , this ) ;
} ;
} ;
@ -1871,9 +1846,16 @@ bool pOnvif::_send_request( CSTR url, CSTR post_string ){
curl_easy_setopt ( m_pCURL , CURLOPT_POSTFIELDS , post_string ) ;
curl_easy_setopt ( m_pCURL , CURLOPT_POSTFIELDS , post_string ) ;
sprintf ( tBuffer , " %s:%s " , m_pUsername , m_pPassword ) ;
sprintf ( tBuffer , " %s:%s " , m_pUsername , m_pPassword ) ;
curl_easy_setopt ( m_pCURL , CURLOPT_USERPWD , tBuffer ) ;
curl_easy_setopt ( m_pCURL , CURLOPT_USERPWD , tBuffer ) ;
# ifdef DEBUG
char tErrorBuffer [ CURL_ERROR_SIZE ] ;
curl_easy_setopt ( m_pCURL , CURLOPT_ERRORBUFFER , tErrorBuffer ) ;
# endif
m_pLastIndex = 0 ;
m_pLastIndex = 0 ;
if ( curl_easy_perform ( m_pCURL ) ) {
if ( curl_easy_perform ( m_pCURL ) ) {
LOG_ERROR ( " CURL Failure! " ) ;
LOG_ERROR ( " CURL Failure! " ) ;
# ifdef DEBUG
LOG_ERROR ( tErrorBuffer ) ;
# endif
} else {
} else {
m_pLastResponse [ m_pLastIndex ] = ( char ) 0 ;
m_pLastResponse [ m_pLastIndex ] = ( char ) 0 ;
return true ;
return true ;
@ -1881,8 +1863,10 @@ bool pOnvif::_send_request( CSTR url, CSTR post_string ){
m_pLastIndex = 0 ;
m_pLastIndex = 0 ;
} ;
} ;
return false ;
return false ;
# endif
} ;
} ;
# ifndef CURL_MANAGER
int pOnvif : : _writer ( char * data , size_t size , size_t nmemb , pOnvif * Ptr ) {
int pOnvif : : _writer ( char * data , size_t size , size_t nmemb , pOnvif * Ptr ) {
if ( Ptr = = NULL ) return 0 ;
if ( Ptr = = NULL ) return 0 ;
//TLOG("*");
//TLOG("*");
@ -1890,6 +1874,7 @@ int pOnvif::_writer( char *data, size_t size, size_t nmemb, pOnvif *Ptr ){
Ptr - > m_pLastIndex + = size * nmemb ;
Ptr - > m_pLastIndex + = size * nmemb ;
return size * nmemb ;
return size * nmemb ;
} ;
} ;
# endif
# undef LOG
# undef LOG
# undef TLOG
# undef TLOG