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.

72 lines
1.8 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 years ago
​
7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __BASIC_FUNCTIONALITY_HEADER__
  2. #define __BASIC_FUNCTIONALITY_HEADER__
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <sys/types.h>
  6. #include <time.h>
  7. #include "basicTypes.h"
  8. #ifdef __linux__
  9. #include <ifaddrs.h>
  10. #include <sys/socket.h>
  11. #include <netinet/in.h>
  12. #include <arpa/inet.h>
  13. #include <sys/statvfs.h>
  14. #include "basicBuildTimeStamp.h"
  15. #else
  16. //#include <winsock2.h>
  17. //#include <ws2tcpip.h>
  18. #define WIN32_LEAN_AND_MEAN
  19. #include <atlbase.h>
  20. #include <windows.h>
  21. #include <VersionHelpers.h>
  22. #include <dshow.h>
  23. #endif
  24. bool fileExist( const char *strFilename );
  25. CSTR trim( CSTR string );
  26. uint8_t checksum8( uint8_t *Buffer, size_t BufferSize );
  27. uint16_t checksum16( uint8_t *Buffer, size_t BufferSize );
  28. uint8_t checksumLGS( uint8_t *Buffer, size_t BufferSize );
  29. CArray *explode( char Delim, CSTR S_Str );
  30. CSTR implode( CArray *Data, CSTR S_Str, U8 Start, U8 End );
  31. CSTR getTStr( CSTR Fmt = NULL );
  32. #ifdef __linux__
  33. pid_t gettid( void );
  34. #define SLEEP(X) usleep(X*1000)
  35. long long getMilliseconds( void );
  36. #else
  37. #ifndef WIN_XP
  38. #include <VersionHelpers.h>
  39. #endif
  40. #define SLEEP(X) Sleep(X)
  41. unsigned __int64 getMilliseconds( void );
  42. #endif
  43. int getIP4( if_info **arrParam, int max_ifs = 10 );
  44. #ifdef __linux__
  45. long long getTotalSpace( CSTR DirName );
  46. long long getFreeSpace( CSTR DirName );
  47. bool enumerateDevices( enumeratorInfo *mlist, const char *dTemplate = "video" );
  48. #else
  49. __int64 getTotalSpace( CSTR DirName );
  50. __int64 getFreeSpace( CSTR DirName );
  51. bool enumerateDevices(enumeratorInfo *mlist, REFGUID category);
  52. #endif
  53. typedef struct S_localIp4Info{
  54. char address[16];
  55. char netmask[16];
  56. char broadcast[16];
  57. char gateway[16];
  58. }localIp4Info;
  59. typedef vector<localIp4Info*> localIpAddresses;
  60. localIpAddresses *getLocalIP();
  61. #endif