Leaked source code of windows server 2003
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.

324 lines
11 KiB

  1. /********************************************************************/
  2. /** Copyright(c) 1996 Microsoft Corporation. **/
  3. /********************************************************************/
  4. //***
  5. //
  6. // Filename: arapio.h
  7. //
  8. // Description: Contains all the defines, macros, structures that are needed
  9. // for the ioctl interface between arap and the stack
  10. //
  11. // History: Sep 11, 1996 Shirish Koti Created original version.
  12. //
  13. //***
  14. // range 0x800-0xfff is for private ioctls: pick something!
  15. #define ARAP_IOCTL_BASE 0x900
  16. #define ARAP_CTL(_req_, _method_) CTL_CODE( FILE_DEVICE_NETWORK, \
  17. _req_ + ARAP_IOCTL_BASE, \
  18. _method_, \
  19. FILE_ANY_ACCESS )
  20. //
  21. // ioctl codes issued to the stack
  22. //
  23. #define IOCTL_ARAP_START ARAP_CTL( 1, METHOD_BUFFERED)
  24. #define IOCTL_ARAP_EXCHANGE_PARMS ARAP_CTL( 2, METHOD_BUFFERED)
  25. #define IOCTL_ARAP_SETUP_CONNECTION ARAP_CTL( 3, METHOD_BUFFERED)
  26. #define IOCTL_ARAP_GET_ZONE_LIST ARAP_CTL( 4, METHOD_BUFFERED)
  27. #define IOCTL_ARAP_MNP_CONN_INITIATE ARAP_CTL( 5, METHOD_BUFFERED)
  28. #define IOCTL_ARAP_MNP_CONN_RESPOND ARAP_CTL( 6, METHOD_BUFFERED)
  29. #define IOCTL_ARAP_GET_ADDR ARAP_CTL( 7, METHOD_BUFFERED)
  30. #define IOCTL_ARAP_CONNECTION_UP ARAP_CTL( 8, METHOD_BUFFERED)
  31. #define IOCTL_ARAP_SEND ARAP_CTL( 9, METHOD_BUFFERED)
  32. #define IOCTL_ARAP_RECV ARAP_CTL( 10, METHOD_BUFFERED)
  33. #define IOCTL_ARAP_SELECT ARAP_CTL( 11, METHOD_BUFFERED)
  34. #define IOCTL_ARAP_GET_STATS ARAP_CTL( 12, METHOD_BUFFERED)
  35. #define IOCTL_ARAP_DISCONNECT ARAP_CTL( 13, METHOD_BUFFERED)
  36. #define IOCTL_ARAP_CONTINUE_SHUTDOWN ARAP_CTL( 14, METHOD_BUFFERED)
  37. #define IOCTL_ARAP_SNIFF_PKTS ARAP_CTL( 15, METHOD_BUFFERED)
  38. #define IOCTL_ATCP_SETUP_CONNECTION ARAP_CTL( 16, METHOD_BUFFERED)
  39. #define IOCTL_ATCP_SUPPRESS_BCAST ARAP_CTL( 17, METHOD_BUFFERED)
  40. #define IOCTL_ATCP_CLOSE_CONNECTION ARAP_CTL( 18, METHOD_BUFFERED)
  41. #define IOCTL_ARAP_END ARAP_CTL( 19, METHOD_BUFFERED)
  42. //
  43. // 0x122404 IOCTL_ARAP_START
  44. // 0x122408 IOCTL_ARAP_EXCHANGE_PARMS
  45. // 0x12240c IOCTL_ARAP_SETUP_CONNECTION
  46. // 0x122410 IOCTL_ARAP_GET_ZONE_LIST
  47. // 0x122414 IOCTL_ARAP_MNP_CONN_INITIATE
  48. // 0x122418 IOCTL_ARAP_MNP_CONN_RESPOND
  49. // 0x12241c IOCTL_ARAP_GET_ADDR
  50. // 0x122420 IOCTL_ARAP_CONNECTION_UP
  51. // 0x122424 IOCTL_ARAP_SEND
  52. // 0x122428 IOCTL_ARAP_RECV
  53. // 0x12242c IOCTL_ARAP_SELECT
  54. // 0x122430 IOCTL_ARAP_GET_STATS
  55. // 0x122434 IOCTL_ARAP_DISCONNECT
  56. // 0x122438 IOCTL_ARAP_CONTINUE_SHUTDOWN
  57. // 0x12243c IOCTL_ARAP_SNIFF_PKTS
  58. // 0x122440 IOCTL_ATCP_SETUP_CONNECTION
  59. // 0x122444 IOCTL_ATCP_SUPPRESS_BCAST
  60. // 0x122448 IOCTL_ATCP_CLOSE_CONNECTION
  61. // 0x12244c IOCTL_ARAP_END
  62. //
  63. // Error codes used by the various ARAP components
  64. //
  65. #define ARAPERRBASE 40000
  66. #define ARAPERR_NO_ERROR 0
  67. #define ARAPERR_PENDING (ARAPERRBASE + 1)
  68. #define ARAPERR_CANNOT_OPEN_STACK (ARAPERRBASE + 2)
  69. #define ARAPERR_OUT_OF_RESOURCES (ARAPERRBASE + 3)
  70. #define ARAPERR_SEND_FAILED (ARAPERRBASE + 4)
  71. #define ARAPERR_LSA_ERROR (ARAPERRBASE + 5)
  72. #define ARAPERR_PASSWD_NOT_AVAILABLE (ARAPERRBASE + 6)
  73. #define ARAPERR_NO_DIALIN_PERMS (ARAPERRBASE + 7)
  74. #define ARAPERR_AUTH_FAILURE (ARAPERRBASE + 8)
  75. #define ARAPERR_PASSWORD_TOO_LONG (ARAPERRBASE + 9)
  76. #define ARAPERR_COULDNT_GET_SAMHANDLE (ARAPERRBASE + 10)
  77. #define ARAPERR_BAD_PASSWORD (ARAPERRBASE + 11)
  78. #define ARAPERR_SET_PASSWD_FAILED (ARAPERRBASE + 12)
  79. #define ARAPERR_CLIENT_OUT_OF_SYNC (ARAPERRBASE + 13)
  80. #define ARAPERR_IOCTL_FAILURE (ARAPERRBASE + 14)
  81. #define ARAPERR_UNEXPECTED_RESPONSE (ARAPERRBASE + 15)
  82. #define ARAPERR_BAD_VERSION (ARAPERRBASE + 16)
  83. #define ARAPERR_BAD_FORMAT (ARAPERRBASE + 17)
  84. #define ARAPERR_BUF_TOO_SMALL (ARAPERRBASE + 18)
  85. #define ARAPERR_FATAL_ERROR (ARAPERRBASE + 19)
  86. #define ARAPERR_TIMEOUT (ARAPERRBASE + 20)
  87. #define ARAPERR_IRP_IN_PROGRESS (ARAPERRBASE + 21)
  88. #define ARAPERR_DISCONNECT_IN_PROGRESS (ARAPERRBASE + 22)
  89. #define ARAPERR_LDISCONNECT_COMPLETE (ARAPERRBASE + 23)
  90. #define ARAPERR_RDISCONNECT_COMPLETE (ARAPERRBASE + 24)
  91. #define ARAPERR_NO_SUCH_CONNECTION (ARAPERRBASE + 25)
  92. #define ARAPERR_STACK_NOT_UP (ARAPERRBASE + 26)
  93. #define ARAPERR_NO_NETWORK_ADDR (ARAPERRBASE + 27)
  94. #define ARAPERR_BAD_NETWORK_RANGE (ARAPERRBASE + 28)
  95. #define ARAPERR_INVALID_STATE (ARAPERRBASE + 29)
  96. #define ARAPERR_CONN_INACTIVE (ARAPERRBASE + 30)
  97. #define ARAPERR_DATA (ARAPERRBASE + 31)
  98. #define ARAPERR_STACK_SHUTDOWN_REQUEST (ARAPERRBASE + 32)
  99. #define ARAPERR_SHUTDOWN_COMPLETE (ARAPERRBASE + 33)
  100. #define ARAPERR_STACK_ROUTER_NOT_UP (ARAPERRBASE + 34)
  101. #define ARAPERR_STACK_PNP_IN_PROGRESS (ARAPERRBASE + 35)
  102. #define ARAPERR_STACK_IS_NOT_ACTIVE (ARAPERRBASE + 35)
  103. #define ARAPERR_STACK_IS_ACTIVE (ARAPERRBASE + 36)
  104. //
  105. // max LTM can be 618 bytes, min is 604: let's be conservative on the way out,
  106. // and liberal on incoming packets
  107. //
  108. #define ARAP_MAXPKT_SIZE_INCOMING 618
  109. #define ARAP_MAXPKT_SIZE_OUTGOING 604
  110. #define MAX_DOMAIN_LEN 15
  111. #define MAX_ZONE_LENGTH 32
  112. #define MAX_ENTITY_LENGTH 32
  113. #define ZONESTR_LEN MAX_ZONE_LENGTH+2
  114. #define NAMESTR_LEN MAX_ENTITY_LENGTH+2
  115. #define MNP_SYN 0x16
  116. #define MNP_DLE 0x10
  117. #define MNP_SOH 0x1
  118. #define MNP_ESC 0x1B
  119. #define MNP_STX 0x2
  120. #define MNP_ETX 0x3
  121. #define ARAP_SNIFF_BUFF_SIZE 4080
  122. typedef struct _NET_ADDR
  123. {
  124. USHORT ata_Network;
  125. USHORT ata_Node;
  126. } NET_ADDR, *PNET_ADDR;
  127. typedef struct _NETWORKRANGE
  128. {
  129. USHORT LowEnd;
  130. USHORT HighEnd;
  131. } NETWORKRANGE, *PNETWORKRANGE;
  132. typedef struct _HIDZONES
  133. {
  134. DWORD BufSize; // how big is the buffer containing zone names
  135. DWORD NumZones; // number of zones "disallowed" for dial-in users
  136. UCHAR ZonesNames[1]; // list of zones "disallowed" for dial-in users
  137. } HIDZONES, *PHIDZONES;
  138. typedef struct _ARAP_PARMS
  139. {
  140. DWORD LowVersion;
  141. DWORD HighVersion;
  142. DWORD accessFlags; // GuestAccess?|ManualPwd?|MultiPort?
  143. DWORD NumPorts; // number of ras ports on the system
  144. DWORD UserCallCBOk; // user can request callback
  145. DWORD CallbackDelay; // seconds to wait before callback
  146. DWORD PasswordRetries; // allow client to try pwd these many times
  147. DWORD MinPwdLen; // min length of the pwd that server needs
  148. DWORD MnpInactiveTime; // seconds of idle time before disconnect
  149. DWORD MaxLTFrames; // max LT frames outstanding (rcv window)
  150. BOOLEAN V42bisEnabled; //
  151. BOOLEAN SmartBuffEnabled; //
  152. BOOLEAN NetworkAccess; // access to network or only this server
  153. BOOLEAN DynamicMode; // we want the stack to get node address
  154. NETWORKRANGE NetRange;
  155. BOOLEAN SniffMode; // give all pkts to ARAP to "sniff"
  156. DWORD NumZones; // # of zones (info provided by the stack)
  157. NET_ADDR ServerAddr; // atalk addr of the srvr (on default node)
  158. UCHAR ServerZone[ZONESTR_LEN]; // space padded Pascal string
  159. UCHAR ServerName[NAMESTR_LEN]; // space padded Pascal string
  160. WCHAR ServerDomain[MAX_DOMAIN_LEN+1];
  161. UNICODE_STRING GuestName;
  162. } ARAP_PARMS, *PARAP_PARMS;
  163. typedef struct _EXCHGPARMS
  164. {
  165. DWORD StatusCode;
  166. ARAP_PARMS Parms;
  167. HIDZONES HidZones;
  168. } EXCHGPARMS, *PEXCHGPARMS;
  169. typedef struct _ARAP_BIND_INFO
  170. {
  171. IN DWORD BufLen; // size of this structure
  172. IN PVOID pDllContext;
  173. IN BOOLEAN fThisIsPPP; // TRUE if PPP conn, FALSE if ARAP
  174. IN NET_ADDR ClientAddr; // network addr of the remote client
  175. OUT PVOID AtalkContext;
  176. OUT DWORD ErrorCode;
  177. } ARAP_BIND_INFO, *PARAP_BIND_INFO;
  178. typedef struct _ARAP_SEND_RECV_INFO
  179. {
  180. PVOID AtalkContext;
  181. PVOID pDllContext;
  182. NET_ADDR ClientAddr;
  183. DWORD IoctlCode;
  184. DWORD StatusCode; // returned by the stack
  185. DWORD DataLen;
  186. BYTE Data[1];
  187. } ARAP_SEND_RECV_INFO, *PARAP_SEND_RECV_INFO;
  188. typedef struct _ARAP_ZONE
  189. {
  190. BYTE ZoneNameLen;
  191. BYTE ZoneName[1];
  192. } ARAP_ZONE, *PARAP_ZONE;
  193. typedef struct _ZONESTAT
  194. {
  195. DWORD BufLen; // how big is this buffer
  196. DWORD BytesNeeded; // how many bytes are needed
  197. DWORD StatusCode; // returned by the stack
  198. DWORD NumZones; // number of zones (in this buffer)
  199. UCHAR ZoneNames[1]; // Names of the zones (Pascal strings)
  200. } ZONESTAT, *PZONESTAT;
  201. typedef struct _STAT_INFO
  202. {
  203. DWORD BytesSent;
  204. DWORD BytesRcvd;
  205. DWORD FramesSent;
  206. DWORD FramesRcvd;
  207. DWORD BytesTransmittedUncompressed;
  208. DWORD BytesReceivedUncompressed;
  209. DWORD BytesTransmittedCompressed;
  210. DWORD BytesReceivedCompressed;
  211. } STAT_INFO, *PSTAT_INFO;
  212. typedef struct _ATCPINFO
  213. {
  214. NET_ADDR ServerAddr;
  215. NET_ADDR DefaultRouterAddr;
  216. UCHAR ServerZoneName[ZONESTR_LEN];
  217. } ATCPINFO, *PATCPINFO;
  218. typedef struct _ATCP_SUPPRESS_INFO
  219. {
  220. BOOLEAN SuppressRtmp;
  221. BOOLEAN SuppressAllBcast;
  222. } ATCP_SUPPRESS_INFO, *PATCP_SUPPRESS_INFO;
  223. #define ARAP_SNIFF_SIGNATURE 0xfacebead
  224. typedef struct _SNIFF_INFO
  225. {
  226. DWORD Signature;
  227. DWORD TimeStamp;
  228. USHORT Location;
  229. USHORT FrameLen;
  230. BYTE Frame[1];
  231. } SNIFF_INFO, *PSNIFF_INFO;
  232. //
  233. // states for the Arap-Atcp engine
  234. //
  235. #define ENGINE_UNBORN 0 // nothing happened yet
  236. #define ENGINE_DLL_ATTACHED 1 // dll loaded, and init for globals done
  237. #define ENGINE_INIT_PENDING 2 // engine init work in progress
  238. #define ENGINE_INIT_DONE 3 // engine init completed
  239. #define ENGINE_STACK_OPEN_PENDING 4 // appletalk stack open is pending
  240. #define ENGINE_STACK_OPENED 5 // appletalk stack has been opened
  241. #define ENGINE_CONFIGURE_PENDING 6 // configuring appletalk stack in progress
  242. #define ENGINE_RUNNING 7 // ready to accept arap connections
  243. #define ENGINE_PNP_PENDING 8 // engine is undergoing a PnP change
  244. #define ENGINE_STOPPING 9 // engine's stopping
  245. //
  246. // exports from rasarap.lib, used by ATCP
  247. //
  248. DWORD
  249. ArapAtcpGetState(
  250. IN VOID
  251. );
  252. HANDLE
  253. ArapAtcpGetHandle(
  254. IN VOID
  255. );
  256. DWORD
  257. ArapAtcpPnPNotify(
  258. IN VOID
  259. );
  260. DWORD
  261. ArapAtcpStartEngine(
  262. IN VOID
  263. );
  264.