Source code of Windows XP (NT5)
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.

219 lines
6.6 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. private\inc\ddipinip.h
  5. Abstract:
  6. Public IOCTLS and related structures for the IP in IP encapsulation
  7. driver
  8. See documentation for more details
  9. Author:
  10. Amritansh Raghav
  11. Revision History:
  12. AmritanR Created
  13. Notes:
  14. --*/
  15. #ifndef __DDIPINIP_H__
  16. #define __DDIPINIP_H__
  17. #ifndef ANY_SIZE
  18. #define ANY_SIZE 1
  19. #endif
  20. #define IPINIP_SERVICE_NAME "IPINIP"
  21. //////////////////////////////////////////////////////////////////////////////
  22. // //
  23. // Device Name - this string is the name of the device. It is the name //
  24. // that should be passed to NtCreateFile when accessing the device. //
  25. // //
  26. //////////////////////////////////////////////////////////////////////////////
  27. #define DD_IPINIP_DEVICE_NAME L"\\Device\\IPINIP"
  28. //////////////////////////////////////////////////////////////////////////////
  29. // //
  30. // Win32 Name - This is the (Unicode and NonUnicode) name exposed by Win32 //
  31. // subsystem for the device. It is the name that should be passed to //
  32. // CreateFile(Ex) when opening the device. //
  33. // //
  34. //////////////////////////////////////////////////////////////////////////////
  35. #define IPINIP_NAME L"\\\\.\\IPINIP"
  36. #define IPINIP_NAME_NUC "\\\\.\\IPINIP"
  37. //////////////////////////////////////////////////////////////////////////////
  38. // //
  39. // IOCTL code definitions and related structures //
  40. // All the IOCTLs are synchronous //
  41. // All need administrator privilege //
  42. // //
  43. //////////////////////////////////////////////////////////////////////////////
  44. #define FSCTL_IPINIP_BASE FILE_DEVICE_NETWORK
  45. #define _IPINIP_CTL_CODE(function, method, access) \
  46. CTL_CODE(FSCTL_IPINIP_BASE, function, method, access)
  47. #define MIN_IPINIP_CODE 0
  48. #define CREATE_TUNNEL_CODE (MIN_IPINIP_CODE)
  49. #define DELETE_TUNNEL_CODE (CREATE_TUNNEL_CODE + 1)
  50. #define SET_TUNNEL_INFO_CODE (DELETE_TUNNEL_CODE + 1)
  51. #define GET_TUNNEL_TABLE_CODE (SET_TUNNEL_INFO_CODE + 1)
  52. #define IPINIP_NOTIFICATION_CODE (GET_TUNNEL_TABLE_CODE + 1)
  53. #define MAX_IPINIP_CODE (IPINIP_NOTIFICATION_CODE)
  54. //////////////////////////////////////////////////////////////////////////////
  55. // //
  56. // The IOCTL used to create a tunnel //
  57. // //
  58. //////////////////////////////////////////////////////////////////////////////
  59. #define IOCTL_IPINIP_CREATE_TUNNEL \
  60. _IPINIP_CTL_CODE(CREATE_TUNNEL_CODE,METHOD_BUFFERED,FILE_WRITE_ACCESS)
  61. typedef struct _IPINIP_CREATE_TUNNEL
  62. {
  63. //
  64. // The index of the created tunnel
  65. //
  66. OUT DWORD dwIfIndex;
  67. //
  68. // Name of the interface (must be a guid)
  69. //
  70. IN GUID Guid;
  71. }IPINIP_CREATE_TUNNEL, *PIPINIP_CREATE_TUNNEL;
  72. //////////////////////////////////////////////////////////////////////////////
  73. // //
  74. // The IOCTL used to delete a tunnel //
  75. // //
  76. //////////////////////////////////////////////////////////////////////////////
  77. #define IOCTL_IPINIP_DELETE_TUNNEL \
  78. _IPINIP_CTL_CODE(DELETE_TUNNEL_CODE,METHOD_BUFFERED,FILE_WRITE_ACCESS)
  79. typedef struct _IPINIP_DELETE_TUNNEL
  80. {
  81. //
  82. // The index of the tunnel to remove
  83. //
  84. IN DWORD dwIfIndex;
  85. }IPINIP_DELETE_TUNNEL, *PIPINIP_DELETE_TUNNEL;
  86. //////////////////////////////////////////////////////////////////////////////
  87. // //
  88. // The IOCTL used to set up a tunnel //
  89. // //
  90. //////////////////////////////////////////////////////////////////////////////
  91. #define IOCTL_IPINIP_SET_TUNNEL_INFO \
  92. _IPINIP_CTL_CODE(SET_TUNNEL_INFO_CODE,METHOD_BUFFERED,FILE_WRITE_ACCESS)
  93. typedef struct _IPINIP_SET_TUNNEL_INFO
  94. {
  95. //
  96. // Index as returned by the create call
  97. //
  98. IN DWORD dwIfIndex;
  99. //
  100. // The state the tunnel goes to after the set
  101. //
  102. OUT DWORD dwOperationalState;
  103. //
  104. // Configuration
  105. //
  106. IN DWORD dwRemoteAddress;
  107. IN DWORD dwLocalAddress;
  108. IN BYTE byTtl;
  109. }IPINIP_SET_TUNNEL_INFO, *PIPINIP_SET_TUNNEL_INFO;
  110. #define IOCTL_IPINIP_GET_TUNNEL_TABLE \
  111. _IPINIP_CTL_CODE(GET_TUNNEL_TABLE_CODE,METHOD_BUFFERED,FILE_WRITE_ACCESS)
  112. typedef struct _TUNNEL_INFO
  113. {
  114. OUT DWORD dwIfIndex;
  115. OUT DWORD dwRemoteAddress;
  116. OUT DWORD dwLocalAddress;
  117. OUT DWORD fMapped;
  118. OUT BYTE byTtl;
  119. }TUNNEL_INFO, *PTUNNEL_INFO;
  120. typedef struct _IPINIP_TUNNEL_TABLE
  121. {
  122. OUT ULONG ulNumTunnels;
  123. OUT TUNNEL_INFO rgTable[ANY_SIZE];
  124. }IPINIP_TUNNEL_TABLE, *PIPINIP_TUNNEL_TABLE;
  125. #define SIZEOF_BASIC_TUNNEL_TABLE \
  126. (ULONG)(FIELD_OFFSET(IPINIP_TUNNEL_TABLE, rgTable[0]))
  127. #define SIZEOF_TUNNEL_TABLE(X) \
  128. SIZEOF_BASIC_TUNNEL_TABLE + ((X) * sizeof(TUNNEL_INFO))
  129. //////////////////////////////////////////////////////////////////////////////
  130. // //
  131. // The asynchronous IOCTL used to receive state change notifications //
  132. // //
  133. //////////////////////////////////////////////////////////////////////////////
  134. #define IOCTL_IPINIP_NOTIFICATION \
  135. _IPINIP_CTL_CODE(IPINIP_NOTIFICATION_CODE,METHOD_BUFFERED,FILE_WRITE_ACCESS)
  136. typedef enum _IPINIP_EVENT
  137. {
  138. IE_INTERFACE_UP = 0,
  139. IE_INTERFACE_DOWN = 1,
  140. }IPINIP_EVENT, *PIPINIP_EVENT;
  141. typedef enum _IPINIP_SUB_EVENT
  142. {
  143. ISE_ICMP_TTL_TOO_LOW = 0,
  144. ISE_DEST_UNREACHABLE = 1,
  145. }IPINIP_SUB_EVENT, *PIPINIP_SUB_EVENT;
  146. typedef struct _IPINIP_NOTIFICATION
  147. {
  148. IPINIP_EVENT ieEvent;
  149. IPINIP_SUB_EVENT iseSubEvent;
  150. DWORD dwIfIndex;
  151. }IPINIP_NOTIFICATION, *PIPINIP_NOTIFICATION;
  152. #endif // __DDIPINIP_H__