SeLowUser.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. // SoftEther VPN Source Code - Developer Edition Master Branch
  2. // SeLow: SoftEther Lightweight Network Protocol
  3. // SeLowUser.h
  4. // Header for SeLowUser.c
  5. #ifndef SELOWUSER_H
  6. #define SELOWUSER_H
  7. #include "CedarType.h"
  8. #include "Mayaqua/Mayaqua.h"
  9. #include <SeLow/SeLowCommon.h>
  10. //// Macro
  11. #define SL_USER_INSTALL_LOCK_TIMEOUT 60000 // Lock acquisition timeout
  12. #define SL_USER_AUTO_PUSH_TIMER 60000 // Timer to start the installation automatically
  13. //// Type
  14. // SU
  15. struct SU
  16. {
  17. void *hFile; // File handle
  18. SL_ADAPTER_INFO_LIST AdapterInfoList; // Adapter list cache
  19. };
  20. // Adapter
  21. struct SU_ADAPTER
  22. {
  23. char AdapterId[MAX_PATH]; // Adapter ID
  24. char DeviceName[MAX_PATH]; // Device name
  25. void *hFile; // File handle
  26. void *hEvent; // Event handle
  27. bool Halt;
  28. UINT CurrentPacketCount;
  29. UCHAR GetBuffer[SL_EXCHANGE_BUFFER_SIZE]; // Read buffer
  30. UCHAR PutBuffer[SL_EXCHANGE_BUFFER_SIZE]; // Write buffer
  31. };
  32. // Adapter list items
  33. struct SU_ADAPTER_LIST
  34. {
  35. SL_ADAPTER_INFO Info; // Adapter information
  36. char Guid[128]; // GUID
  37. char Name[MAX_SIZE]; // Name
  38. char SortKey[MAX_SIZE]; // Sort key
  39. };
  40. //// Function prototype
  41. SU *SuInit();
  42. SU *SuInitEx(UINT wait_for_bind_complete_tick);
  43. void SuFree(SU *u);
  44. TOKEN_LIST *SuEnumAdapters(SU *u);
  45. SU_ADAPTER *SuOpenAdapter(SU *u, char *adapter_id);
  46. void SuCloseAdapter(SU_ADAPTER *a);
  47. void SuCloseAdapterHandleInner(SU_ADAPTER *a);
  48. bool SuGetPacketsFromDriver(SU_ADAPTER *a);
  49. bool SuGetNextPacket(SU_ADAPTER *a, void **buf, UINT *size);
  50. bool SuPutPacketsToDriver(SU_ADAPTER *a);
  51. bool SuPutPacket(SU_ADAPTER *a, void *buf, UINT size);
  52. SU_ADAPTER_LIST *SuAdapterInfoToAdapterList(SL_ADAPTER_INFO *info);
  53. LIST *SuGetAdapterList(SU *u);
  54. void SuFreeAdapterList(LIST *o);
  55. int SuCmpAdapterList(void *p1, void *p2);
  56. bool SuInstallDriver(bool force);
  57. bool SuInstallDriverInner(bool force);
  58. bool SuIsSupportedOs(bool on_install);
  59. bool SuCopySysFile(wchar_t *src, wchar_t *dst);
  60. void SuDeleteGarbageInfs();
  61. void SuDeleteGarbageInfsInner();
  62. bool SuLoadDriversHive();
  63. bool SuUnloadDriversHive();
  64. #endif // SELOWUSER_H