types.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * TAP-Windows -- A kernel driver to provide virtual tap
  3. * device functionality on Windows.
  4. *
  5. * This code was inspired by the CIPE-Win32 driver by Damion K. Wilson.
  6. *
  7. * This source code is Copyright (C) 2002-2014 OpenVPN Technologies, Inc.,
  8. * and is released under the GPL version 2 (see below).
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2
  12. * as published by the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program (see the file COPYING included with this
  21. * distribution); if not, write to the Free Software Foundation, Inc.,
  22. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  23. */
  24. #ifndef TAP_TYPES_DEFINED
  25. #define TAP_TYPES_DEFINED
  26. //typedef
  27. //struct _Queue
  28. //{
  29. // ULONG base;
  30. // ULONG size;
  31. // ULONG capacity;
  32. // ULONG max_size;
  33. // PVOID data[];
  34. //} Queue;
  35. //typedef struct _TAP_PACKET;
  36. //typedef struct _TapExtension
  37. //{
  38. // // TAP device object and packet queues
  39. // Queue *m_PacketQueue, *m_IrpQueue;
  40. // PDEVICE_OBJECT m_TapDevice;
  41. // NDIS_HANDLE m_TapDeviceHandle;
  42. // ULONG TapFileIsOpen;
  43. //
  44. // // Used to lock packet queues
  45. // NDIS_SPIN_LOCK m_QueueLock;
  46. // BOOLEAN m_AllocatedSpinlocks;
  47. //
  48. // // Used to bracket open/close
  49. // // state changes.
  50. // MUTEX m_OpenCloseMutex;
  51. //
  52. // // True if device has been permanently halted
  53. // BOOLEAN m_Halt;
  54. //
  55. // // TAP device name
  56. // unsigned char *m_TapName;
  57. // UNICODE_STRING m_UnicodeLinkName;
  58. // BOOLEAN m_CreatedUnicodeLinkName;
  59. //
  60. // // Used for device status ioctl only
  61. // const char *m_LastErrorFilename;
  62. // int m_LastErrorLineNumber;
  63. // LONG TapFileOpenCount;
  64. //
  65. // // Flags
  66. // BOOLEAN TapDeviceCreated;
  67. // BOOLEAN m_CalledTapDeviceFreeResources;
  68. //
  69. // // DPC queue for deferred packet injection
  70. // BOOLEAN m_InjectDpcInitialized;
  71. // KDPC m_InjectDpc;
  72. // NDIS_SPIN_LOCK m_InjectLock;
  73. // Queue *m_InjectQueue;
  74. //}
  75. //TapExtension, *TapExtensionPointer;
  76. typedef struct _InjectPacket
  77. {
  78. # define INJECT_PACKET_SIZE(data_size) (sizeof (InjectPacket) + (data_size))
  79. # define INJECT_PACKET_FREE(ib) NdisFreeMemory ((ib), INJECT_PACKET_SIZE ((ib)->m_Size), 0)
  80. ULONG m_Size;
  81. UCHAR m_Data []; // m_Data must be the last struct member
  82. }
  83. InjectPacket, *InjectPacketPointer;
  84. #endif