prototypes.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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-2010 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_PROTOTYPES_DEFINED
  25. #define TAP_PROTOTYPES_DEFINED
  26. NTSTATUS DriverEntry
  27. (
  28. IN PDRIVER_OBJECT p_DriverObject,
  29. IN PUNICODE_STRING p_RegistryPath
  30. );
  31. VOID TapDriverUnload
  32. (
  33. IN PDRIVER_OBJECT p_DriverObject
  34. );
  35. NDIS_STATUS AdapterCreate
  36. (
  37. OUT PNDIS_STATUS p_ErrorStatus,
  38. OUT PUINT p_MediaIndex,
  39. IN PNDIS_MEDIUM p_Media,
  40. IN UINT p_MediaCount,
  41. IN NDIS_HANDLE p_AdapterHandle,
  42. IN NDIS_HANDLE p_ConfigurationHandle
  43. );
  44. VOID AdapterHalt
  45. (
  46. IN NDIS_HANDLE p_AdapterContext
  47. );
  48. VOID AdapterFreeResources
  49. (
  50. TapAdapterPointer p_Adapter
  51. );
  52. NDIS_STATUS AdapterReset
  53. (
  54. OUT PBOOLEAN p_AddressingReset,
  55. IN NDIS_HANDLE p_AdapterContext
  56. );
  57. NDIS_STATUS AdapterQuery
  58. (
  59. IN NDIS_HANDLE p_AdapterContext,
  60. IN NDIS_OID p_OID,
  61. IN PVOID p_Buffer,
  62. IN ULONG p_BufferLength,
  63. OUT PULONG p_BytesWritten,
  64. OUT PULONG p_BytesNeeded
  65. );
  66. NDIS_STATUS AdapterModify
  67. (
  68. IN NDIS_HANDLE p_AdapterContext,
  69. IN NDIS_OID p_OID,
  70. IN PVOID p_Buffer,
  71. IN ULONG p_BufferLength,
  72. OUT PULONG p_BytesRead,
  73. OUT PULONG p_BytesNeeded
  74. );
  75. NDIS_STATUS AdapterTransmit
  76. (
  77. IN NDIS_HANDLE p_AdapterContext,
  78. IN PNDIS_PACKET p_Packet,
  79. IN UINT p_Flags
  80. );
  81. NDIS_STATUS AdapterReceive
  82. (
  83. OUT PNDIS_PACKET p_Packet,
  84. OUT PUINT p_Transferred,
  85. IN NDIS_HANDLE p_AdapterContext,
  86. IN NDIS_HANDLE p_ReceiveContext,
  87. IN UINT p_Offset,
  88. IN UINT p_ToTransfer
  89. );
  90. NTSTATUS TapDeviceHook
  91. (
  92. IN PDEVICE_OBJECT p_DeviceObject,
  93. IN PIRP p_IRP
  94. );
  95. NDIS_STATUS CreateTapDevice
  96. (
  97. TapExtensionPointer p_Extension,
  98. const char *p_Name
  99. );
  100. VOID DestroyTapDevice
  101. (
  102. TapExtensionPointer p_Extension
  103. );
  104. VOID TapDeviceFreeResources
  105. (
  106. TapExtensionPointer p_Extension
  107. );
  108. NTSTATUS CompleteIRP
  109. (
  110. IN PIRP p_IRP,
  111. IN TapPacketPointer p_PacketBuffer,
  112. IN CCHAR PriorityBoost
  113. );
  114. VOID CancelIRPCallback
  115. (
  116. IN PDEVICE_OBJECT p_DeviceObject,
  117. IN PIRP p_IRP
  118. );
  119. VOID CancelIRP
  120. (
  121. TapExtensionPointer p_Extension,
  122. IN PIRP p_IRP,
  123. BOOLEAN callback
  124. );
  125. VOID FlushQueues
  126. (
  127. TapExtensionPointer p_Extension
  128. );
  129. VOID SetMediaStatus
  130. (
  131. TapAdapterPointer p_Adapter,
  132. BOOLEAN state
  133. );
  134. VOID HookDispatchFunctions();
  135. struct WIN2K_NDIS_MINIPORT_BLOCK
  136. {
  137. unsigned char opaque[16];
  138. UNICODE_STRING MiniportName; // how mini-port refers to us
  139. };
  140. #endif