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.

70 lines
1.8 KiB

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. #include <atlbase.h>
  19. #include <windows.h>
  20. #include <VersionHelpers.h>
  21. #include <dshow.h>
  22. #endif
  23. bool fileExist( const char *strFilename );
  24. CSTR trim( CSTR string );
  25. uint8_t checksum8( uint8_t *Buffer, size_t BufferSize );
  26. uint16_t checksum16( uint8_t *Buffer, size_t BufferSize );
  27. uint8_t checksumLGS( uint8_t *Buffer, size_t BufferSize );
  28. CArray *explode( char Delim, CSTR S_Str );
  29. CSTR implode( CArray *Data, CSTR S_Str, U8 Start, U8 End );
  30. CSTR getTStr( CSTR Fmt = NULL );
  31. #ifdef __linux__
  32. #define SLEEP(X) usleep(X*1000)
  33. long long getMilliseconds( void );
  34. #else
  35. #ifndef WIN_XP
  36. #include <VersionHelpers.h>
  37. #endif
  38. #define SLEEP(X) Sleep(X)
  39. unsigned __int64 getMilliseconds( void );
  40. #endif
  41. int getIP4( if_info **arrParam, int max_ifs = 10 );
  42. #ifdef __linux__
  43. long long getTotalSpace( CSTR DirName );
  44. long long getFreeSpace( CSTR DirName );
  45. bool enumerateDevices( enumeratorInfo *mlist, const char *dTemplate = "video" );
  46. #else
  47. __int64 getTotalSpace( CSTR DirName );
  48. __int64 getFreeSpace( CSTR DirName );
  49. bool enumerateDevices(enumeratorInfo *mlist, REFGUID category);
  50. #endif
  51. typedef struct S_localIp4Info{
  52. char address[16];
  53. char netmask[16];
  54. char broadcast[16];
  55. char gateway[16];
  56. }localIp4Info;
  57. typedef vector<localIp4Info*> localIpAddresses;
  58. localIpAddresses *getLocalIP();
  59. #endif