Bridge.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // SoftEther VPN Source Code - Developer Edition Master Branch
  2. // Cedar Communication Module
  3. // Bridge.h
  4. // Header of Bridge.c
  5. #ifndef BRIDGE_H
  6. #define BRIDGE_H
  7. #include "Cedar.h"
  8. // Constants
  9. #define BRIDGE_SPECIAL_IPRAW_NAME "ipv4_rawsocket_virtual_router"
  10. // Bridge
  11. struct BRIDGE
  12. {
  13. bool Active; // Status
  14. CEDAR *Cedar; // Cedar
  15. HUB *Hub; // HUB
  16. SESSION *Session; // Session
  17. POLICY *Policy; // Policy
  18. ETH *Eth; // Ethernet
  19. char Name[MAX_SIZE]; // Device name
  20. UINT64 LastBridgeTry; // Time to try to bridge at last
  21. bool Local; // Local mode
  22. bool Monitor; // Monitor mode
  23. bool TapMode; // Tap mode
  24. bool LimitBroadcast; // Broadcasts limiting mode
  25. UCHAR TapMacAddress[6]; // MAC address of the tap
  26. UINT LastNumDevice; // Number of device (Number of last checked)
  27. UINT64 LastNumDeviceCheck; // Time at which to check the number of devices at last
  28. UINT64 LastChangeMtuError; // Time that recorded the error to change the MTU at last
  29. LOCALBRIDGE *ParentLocalBridge; // Parent Local Bridge
  30. };
  31. // Local bridge
  32. struct LOCALBRIDGE
  33. {
  34. char HubName[MAX_HUBNAME_LEN + 1]; // Virtual HUB name
  35. char DeviceName[MAX_SIZE]; // Device name
  36. bool Local; // Local mode
  37. bool Monitor; // Monitor mode
  38. bool TapMode; // Tap mode
  39. bool LimitBroadcast; // Broadcast packets limiting mode
  40. UCHAR TapMacAddress[6]; // MAC address of the tap
  41. BRIDGE *Bridge; // Bridge
  42. };
  43. BRIDGE *BrNewBridge(HUB *h, char *name, POLICY *p, bool local, bool monitor, bool tapmode, char *tapaddr, bool limit_broadcast, LOCALBRIDGE *parent_local_bridge);
  44. void BrBridgeThread(THREAD *thread, void *param);
  45. void BrFreeBridge(BRIDGE *b);
  46. void InitLocalBridgeList(CEDAR *c);
  47. void FreeLocalBridgeList(CEDAR *c);
  48. void AddLocalBridge(CEDAR *c, char *hubname, char *devicename, bool local, bool monitor, bool tapmode, char *tapaddr, bool limit_broadcast);
  49. bool DeleteLocalBridge(CEDAR *c, char *hubname, char *devicename);
  50. bool IsBridgeSupported();
  51. bool IsNeedWinPcap();
  52. UINT GetEthDeviceHash();
  53. bool IsRawIpBridgeSupported();
  54. #endif // BRIDGE_H