#ifndef __BASIC_FUNCTIONALITY_HEADER__ #define __BASIC_FUNCTIONALITY_HEADER__ #include #include #include #include #include "basicTypes.h" #ifdef __linux__ #include #include #include #include #include #include "basicBuildTimeStamp.h" #else //#include //#include #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif #include #include #include #include #endif bool fileExist( const char *strFilename ); CSTR trim( CSTR string ); uint8_t checksum8( uint8_t *Buffer, size_t BufferSize ); uint16_t checksum16( uint8_t *Buffer, size_t BufferSize ); uint8_t checksumLGS( uint8_t *Buffer, size_t BufferSize ); CArray * explode( char Delim, CSTR S_Str ); CSTR implode( CArray *Data, CSTR S_Str, U8 Start, U8 End ); CSTR getTStr( CSTR Fmt = NULL ); CSTR getUniqID_SHA256(void); CSTR getUniqID_MD5(void); CSTR getUniqID_UUID(void); CSTR strReplace( CSTR orig, CSTR rep, CSTR with ); //#define EPOCH_DIFF 11644473600LL #define UNIX_TimeStamp_2_WINDOWS_FileTime_SHIFT 116444736000000000 #ifdef __linux__ unsigned long long getSHTimeValue( void ); #else unsigned __int64 getSHTimeValue( void ); #endif CSTR getSHDTimeStamp(void); #ifdef __linux__ inline PF_TIMESTAMP * getPFTS( PF_TIMESTAMP * ptr = NULL ){ struct timeval tData; struct timezone tTZ; if( ptr == NULL ) { PF_TIMESTAMP *retVal; retVal = (PF_TIMESTAMP *) malloc(sizeof(PF_TIMESTAMP)); if( retVal != NULL ) { if( gettimeofday( &tData, &tTZ ) == -1 ){ free(retVal); retVal = NULL; } else { retVal->seconds = tData.tv_sec; retVal->milliseconds = ( tData.tv_usec / 1000 ); }; }; return retVal; } else { if( gettimeofday( &tData, &tTZ ) == -1 ){ ptr->seconds = 0; ptr->milliseconds = 0; } else { ptr->seconds = tData.tv_sec; ptr->milliseconds = ( tData.tv_usec / 1000 ); }; return ptr; }; }; pid_t gettid( void ); #define SLEEP(X) usleep(X*1000) long long getMilliseconds( void ); #else #ifndef WIN_XP #include #endif #define SLEEP(X) Sleep(X) unsigned __int64 getMilliseconds( void ); #endif int getIP4( if_info **arrParam, int max_ifs = 10 ); #ifdef __linux__ long long getTotalSpace( CSTR DirName ); long long getFreeSpace( CSTR DirName ); bool enumerateDevices( enumeratorInfo *mlist, const char *dTemplate = "video" ); #else __int64 getTotalSpace( CSTR DirName ); __int64 getFreeSpace( CSTR DirName ); bool enumerateDevices(enumeratorInfo *mlist, REFGUID category); #endif localIpAddresses *getLocalIP(); #endif