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.

488 lines
12 KiB

  1. /*++ BUILD Version: 0001 // Increment this if a change has global effects
  2. Copyright (c) 1993 Microsoft Corporation
  3. Module Name:
  4. ncp.h
  5. Abstract:
  6. This module defines NCP fields and constants.
  7. Author:
  8. Manny Weiser (mannyw) 10-Aug-1993
  9. Revision History:
  10. --*/
  11. #ifndef _NCP_
  12. #define _NCP_
  13. ///////////////////////////////// IPX ///////////////////////////////////////
  14. #define RIP_SOCKET 0x5304
  15. #define SAP_SOCKET 0x5204
  16. #define NCP_SOCKET 0x5104
  17. //
  18. // SAP request types
  19. //
  20. #define SAP_GENERAL_REQUEST 1
  21. #define SAP_FIND_NEAREST 3
  22. //
  23. // SAP services
  24. //
  25. #define SAP_SERVICE_TYPE_SERVER 4
  26. #define SAP_SERVICE_TYPE_DIR_SERVER 278
  27. ///// IPX driver services:
  28. #ifndef NWDOS_INCLUDED
  29. typedef UCHAR byte;
  30. typedef USHORT word;
  31. #endif
  32. typedef ULONG NetAddress;
  33. typedef byte NodeAddress [6];
  34. typedef struct
  35. {
  36. NetAddress Net;
  37. NodeAddress Node;
  38. word Socket;
  39. } IPXaddress;
  40. NTSTATUS IPX_Get_Local_Target ( IPXaddress*, NodeAddress*, word* );
  41. void IPX_Get_Internetwork_Address ( IPXaddress* );
  42. word IPX_Get_Interval_Marker ( void );
  43. struct _IRP_CONTEXT;
  44. struct _NW_TDI_STRUCT;
  45. NTSTATUS
  46. IPX_Open_Socket(
  47. IN struct _IRP_CONTEXT* pIrpC,
  48. IN struct _NW_TDI_STRUCT* pTdiStruc
  49. );
  50. VOID
  51. IPX_Close_Socket(
  52. IN struct _NW_TDI_STRUCT* pTdiStruc
  53. );
  54. ///// IPX support routines to hide V86/VxD differences:
  55. //byte* IPX_Allocate_Low_Memory ( word );
  56. //ESR* IPX_Wrap_Callback ( ESR* );
  57. ///////////////////////////////// SAP ///////////////////////////////////////
  58. typedef struct
  59. {
  60. word Command;
  61. word ServerType;
  62. char Name [48];
  63. IPXaddress Address;
  64. word Hops;
  65. } SAPpacket;
  66. ///////////////////////////////// RIP ///////////////////////////////////////
  67. typedef struct
  68. {
  69. word Command;
  70. NetAddress Net;
  71. word Hops;
  72. word Ticks;
  73. } RIPpacket;
  74. ///////////////////////////////// PEP ///////////////////////////////////////
  75. #define PEP_COMMAND_CONNECT 0x1111
  76. #define PEP_COMMAND_REQUEST 0x2222
  77. #define PEP_COMMAND_RESPONSE 0x3333
  78. #define PEP_COMMAND_DISCONNECT 0x5555
  79. #define PEP_COMMAND_BURST 0x7777
  80. #define PEP_COMMAND_ACKNOWLEDGE 0x9999
  81. typedef struct
  82. {
  83. word command;
  84. byte sequence;
  85. byte connection;
  86. byte x;
  87. } PEPrequest;
  88. typedef struct
  89. {
  90. byte error;
  91. byte status;
  92. } PEPresponse;
  93. //
  94. // Bindery object types
  95. //
  96. #define OT_WILD ~0
  97. #define OT_USER 1
  98. #define OT_GROUP 2
  99. #define OT_PRINT_QUEUE 3
  100. #define OT_FILESERVER 4
  101. #define OT_DIRSERVER 0x278
  102. #define OT_JOBQUEUE 0xA
  103. #define ENCRYPTION_KEY_SIZE 8
  104. #define OBJECT_ID_SIZE 4
  105. #define BROADCAST_MESSAGE_WAITING 0x21
  106. //
  107. // NCP function codes
  108. //
  109. #define NCP_MESSAGE_FUNCTION 0x15
  110. #define NCP_DIR_FUNCTION 0x16
  111. #define NCP_ADMIN_FUNCTION 0x17
  112. #define NCP_END_OF_JOB 0x18
  113. #define NCP_LOGOUT 0x19
  114. #define NCP_LOCK_RANGE 0x1A
  115. #define NCP_UNLOCK_RANGE 0x1E
  116. #define NCP_NEGOTIATE_BUFFER_SIZE 0x21
  117. #define NCP_GET_SHORT_NAME 0x30
  118. #define NCP_FLUSH_FILE 0x3D
  119. #define NCP_SEARCH_INITIATE 0x3E
  120. #define NCP_SEARCH_CONTINUE 0x3F
  121. #define NCP_SEARCH_FILE 0x40
  122. #define NCP_CLOSE 0x42
  123. #define NCP_CREATE_FILE 0x43
  124. #define NCP_DELETE_FILE 0x44
  125. #define NCP_RENAME_FILE 0x45
  126. #define NCP_SET_FILE_ATTRIBUTES 0x46
  127. #define NCP_GET_FILE_SIZE 0x47
  128. #define NCP_READ_FILE 0x48
  129. #define NCP_WRITE_FILE 0x49
  130. #define NCP_SET_FILE_TIME 0x4B
  131. #define NCP_OPEN_FILE 0x4C
  132. #define NCP_CREATE_NEW_FILE 0x4D
  133. #define NCP_LFN_FUNCTION 0x57
  134. #define NCP_NEGOTIATE_LIP_CONNECTION 0x61
  135. #define NCP_NEGOTIATE_BURST_CONNECTION 0x65
  136. //
  137. // Subfunctions of NCP_MESSAGE_FUNCTION
  138. //
  139. #define NCP_GET_MESSAGE 0x01
  140. #define NCP_GET_ENTIRE_MESSAGE 0x0B
  141. //
  142. // Subfunctions of NCP_DIR_FUNCTION
  143. //
  144. #define NCP_GET_DIRECTORY_PATH 0x01
  145. #define NCP_GET_VOLUME_NUMBER 0x05
  146. #define NCP_CREATE_DIRECTORY 0x0A
  147. #define NCP_DELETE_DIRECTORY 0x0B
  148. #define NCP_RENAME_DIRECTORY 0x0F
  149. #define NCP_ALLOCATE_DIR_HANDLE 0x12
  150. #define NCP_ALLOCATE_TEMP_DIR_HANDLE 0x13
  151. #define NCP_DEALLOCATE_DIR_HANDLE 0x14
  152. #define NCP_GET_VOLUME_STATS 0x15
  153. #define NCP_GET_VOLUME_INFO 0x2C
  154. #define NCP_GET_NAME_SPACE_INFO 0x2F
  155. //
  156. // Subfunctions of NCP_ADMIN_FUNCTION
  157. //
  158. #define NCP_GET_SERVER_INFO 0x11
  159. #define NCP_PLAIN_TEXT_LOGIN 0x14
  160. #define NCP_GET_LOGIN_KEY 0x17
  161. #define NCP_ENCRYPTED_LOGIN 0x18
  162. #define NCP_CHANGE_CONN_AUTH_STATUS 0x1D
  163. #define NCP_QUERY_OBJECT_ID 0x35
  164. #define NCP_SCAN_BINDERY_OBJECT 0x37
  165. #define NCP_QUERY_PROPERTY_VALUE 0x3D
  166. #define NCP_PLAIN_TEXT_VERIFY_PASSWORD 0x3F
  167. #define NCP_IS_OBJECT_IN_SET 0x43
  168. #define NCP_ENCRYPTED_VERIFY_PASSWORD 0x4A
  169. #define NCP_CREATE_QUEUE_JOB 0x68
  170. #define NCP_CLOSE_FILE_AND_START_JOB 0x69
  171. #define NCP_CLOSE_FILE_AND_CANCEL_JOB 0x6A
  172. #define NCP_SUBFUNC_79 0x79
  173. #define NCP_SUBFUNC_7F 0x7F
  174. //
  175. // Values for NCP_CHANGE_CONN_AUTH_STATUS
  176. //
  177. #define NCP_CONN_NOT_LICENSED 0
  178. #define NCP_CONN_LICENSED 1
  179. //
  180. // Subfunctions of NCP_NAME_SPACE_FUNCTION
  181. //
  182. #define NCP_LFN_OPEN_CREATE 0x01
  183. #define NCP_LFN_SEARCH_INITIATE 0x02
  184. #define NCP_LFN_SEARCH_CONTINUE 0x03
  185. #define NCP_LFN_RENAME_FILE 0x04
  186. #define NCP_LFN_GET_INFO 0x06
  187. #define NCP_LFN_SET_INFO 0x07
  188. #define NCP_LFN_DELETE_FILE 0x08
  189. #define NCP_LFN_ALLOCATE_DIR_HANDLE 0x0C
  190. //
  191. // Packet types
  192. //
  193. #define PACKET_TYPE_SAP 0x00
  194. #define PACKET_TYPE_NCP 0x11
  195. //
  196. // Special character used to indicate that the next char in the
  197. // search mask is a wild card character.
  198. //
  199. #define LFN_META_CHARACTER (UCHAR)0xFF
  200. //
  201. // Properties we query and set
  202. //
  203. #define NET_ADDRESS_PROPERTY "NET_ADDRESS"
  204. //
  205. // Search attributes
  206. //
  207. #define SEARCH_ALL_DIRECTORIES 0x16
  208. #define SEARCH_ALL_FILES 0x06
  209. #define SEARCH_EXEC_ONLY_FILES 0x4E
  210. // File Attributes
  211. #define NW_ATTRIBUTE_SHARABLE 0x80
  212. #define NW_ATTRIBUTE_ARCHIVE 0x20
  213. #define NW_ATTRIBUTE_DIRECTORY 0x10
  214. #define NW_ATTRIBUTE_EXECUTE_ONLY 0x08
  215. #define NW_ATTRIBUTE_SYSTEM 0x04
  216. #define NW_ATTRIBUTE_HIDDEN 0x02
  217. #define NW_ATTRIBUTE_READ_ONLY 0x01
  218. #define NW_ATTRIBUTE_EXEC_ONLY 0x4E
  219. // Open Flags
  220. #define NW_OPEN_EXCLUSIVE 0x10
  221. #define NW_DENY_WRITE 0x08
  222. #define NW_DENY_READ 0x04
  223. #define NW_OPEN_FOR_WRITE 0x02
  224. #define NW_OPEN_FOR_READ 0x01
  225. //
  226. // Connection status flags
  227. //
  228. #define NCP_STATUS_BAD_CONNECTION 0x01
  229. #define NCP_STATUS_NO_CONNECTIONS 0x02
  230. #define NCP_STATUS_SERVER_DOWN 0x04
  231. #define NCP_STATUS_MSG_PENDING 0x08
  232. #define NCP_STATUS_SHUTDOWN 0x10
  233. //
  234. // Extended name space (long file name) query information flags
  235. //
  236. #define LFN_FLAG_INFO_NAME 0x0001
  237. #define LFN_FLAG_INFO_BLOCK_SIZE 0x0002
  238. #define LFN_FLAG_INFO_ATTRIBUTES 0x0004
  239. #define LFN_FLAG_INFO_FILE_SIZE 0x0008
  240. #define LFN_FLAG_INFO_STREAMS 0x0010
  241. #define LFN_FLAG_INFO_EA_INFO 0x0020
  242. #define LFN_FLAG_INFO_ARCHIVE_TIME 0x0040
  243. #define LFN_FLAG_INFO_MODIFY_TIME 0x0080
  244. #define LFN_FLAG_INFO_CREATION_TIME 0x0100
  245. #define LFN_FLAG_INFO_CREATOR 0x0200
  246. #define LFN_FLAG_INFO_DIR_INFO 0x0400
  247. #define LFN_FLAG_INFO_RIGHTS 0x0800
  248. //
  249. // Extended name space (long file name) set information flags
  250. //
  251. #define LFN_FLAG_SET_NAME 0x0001 // Never used
  252. #define LFN_FLAG_SET_INFO_ATTRIBUTES 0x0002
  253. #define LFN_FLAG_SET_INFO_CREATE_DATE 0x0004
  254. #define LFN_FLAG_SET_INFO_CREATE_TIME 0x0008
  255. #define LFN_FLAG_SET_INFO_CREATOR_ID 0x0010
  256. #define LFN_FLAG_SET_INFO_ARCHIVE_DATE 0x0020
  257. #define LFN_FLAG_SET_INFO_ARCHIVE_TIME 0x0040
  258. #define LFN_FLAG_SET_INFO_ARCHIVE_ID 0x0080
  259. #define LFN_FLAG_SET_INFO_MODIFY_DATE 0x0100
  260. #define LFN_FLAG_SET_INFO_MODIFY_TIME 0x0200
  261. #define LFN_FLAG_SET_INFO_MODIFY_ID 0x0400
  262. #define LFN_FLAG_SET_INFO_LASTACCESS_DATE 0x0800
  263. #define LFN_FLAG_SET_INFO_INHERITANCE 0x1000
  264. #define LFN_FLAG_SET_INFO_MAXIMUM_SPACE 0x2000
  265. //
  266. // Extended name space (long file name) open mode flags
  267. //
  268. #define LFN_FLAG_OM_OPEN 0x01
  269. #define LFN_FLAG_OM_OVERWRITE 0x02
  270. #define LFN_FLAG_OM_CREATE 0x08
  271. //
  272. // Long name directory flags
  273. //
  274. #define LFN_FLAG_SHORT_DIRECTORY 0x00
  275. //
  276. // Burst request
  277. //
  278. #define BURST_REQUEST_READ 0x01
  279. #define BURST_REQUEST_WRITE 0x02
  280. //
  281. // Burst flags
  282. //
  283. #define BURST_FLAG_END_OF_BURST 0x10
  284. #define BURST_FLAG_SYSTEM_PACKET 0x80
  285. /////////////////////////////////////////////////////////////////////////////
  286. #define MAX_SERVER_NAME_LENGTH 48
  287. #include <packon.h>
  288. typedef struct _SAP_FIND_NEAREST_RESPONSE {
  289. USHORT SapType; // == 4
  290. USHORT SapServiceType;
  291. UCHAR ServerName[MAX_SERVER_NAME_LENGTH];
  292. ULONG Network;
  293. UCHAR NodeNumber[6];
  294. USHORT HopCount; // Hi-lo order
  295. } SAP_FIND_NEAREST_RESPONSE, *PSAP_FIND_NEAREST_RESPONSE;
  296. typedef struct _NCP_HEADER {
  297. USHORT Command;
  298. UCHAR SequenceNumber;
  299. UCHAR ConnectionIdLow;
  300. UCHAR TaskId;
  301. UCHAR ConnectionIdHigh;
  302. } NCP_HEADER, *PNCP_HEADER;
  303. //
  304. // Header format for NCP request with no subfunction.
  305. //
  306. typedef struct _NCP_REQUEST {
  307. NCP_HEADER NcpHeader;
  308. UCHAR FunctionCode;
  309. //
  310. // Function specific stuff follows.
  311. //
  312. } NCP_REQUEST, *PNCP_REQUEST;
  313. //
  314. // Header format for NCP request with a subfunction.
  315. //
  316. typedef struct _NCP_REQUEST_WITH_SUB {
  317. NCP_HEADER NcpHeader;
  318. UCHAR FunctionCode;
  319. USHORT SubfunctionLength;
  320. UCHAR SubfunctionCode;
  321. //
  322. // Function specific stuff follows.
  323. //
  324. } NCP_REQUEST_WITH_SUB, *PNCP_REQUEST_WITH_SUB;
  325. typedef struct _NCP_RESPONSE {
  326. NCP_HEADER NcpHeader;
  327. UCHAR Error;
  328. UCHAR Status;
  329. //
  330. // Function specific stuff follows.
  331. //
  332. } NCP_RESPONSE, *PNCP_RESPONSE;
  333. typedef struct _NCP_BURST_HEADER {
  334. USHORT Command; // 0x7777
  335. UCHAR Flags;
  336. UCHAR StreamType; // 0x02
  337. ULONG SourceConnection;
  338. ULONG DestinationConnection;
  339. ULONG PacketSequenceNo;
  340. ULONG SendDelayTime;
  341. USHORT BurstSequenceNo;
  342. USHORT AckSequenceNo;
  343. ULONG DataSize;
  344. ULONG BurstOffset;
  345. USHORT BurstLength;
  346. USHORT MissingFragmentCount;
  347. } NCP_BURST_HEADER, *PNCP_BURST_HEADER;
  348. typedef struct _NCP_BURST_WRITE_REQUEST {
  349. NCP_BURST_HEADER BurstHeader;
  350. ULONG Function; // 0x02 = Write
  351. ULONG Handle;
  352. ULONG TotalWriteOffset;
  353. ULONG TotalWriteLength;
  354. ULONG Offset;
  355. ULONG Length;
  356. //UCHAR Data[x];
  357. } NCP_BURST_WRITE_REQUEST, *PNCP_BURST_WRITE_REQUEST;
  358. typedef struct _NCP_BURST_READ_RESPONSE {
  359. NCP_BURST_HEADER BurstHeader;
  360. ULONG Result;
  361. ULONG BytesRead;
  362. //UCHAR Data[x];
  363. } NCP_BURST_READ_RESPONSE, *PNCP_BURST_READ_RESPONSE;
  364. typedef struct _NCP_BURST_READ_REQUEST {
  365. NCP_BURST_HEADER BurstHeader;
  366. ULONG Function; // 0x02 = Write
  367. ULONG Handle;
  368. ULONG TotalReadOffset;
  369. ULONG TotalReadLength;
  370. ULONG Offset;
  371. ULONG Length;
  372. } NCP_BURST_READ_REQUEST, *PNCP_BURST_READ_REQUEST;
  373. typedef struct _NCP_READ_REQUEST {
  374. NCP_REQUEST RequestHeader;
  375. UCHAR Unused;
  376. UCHAR Handle[6];
  377. ULONG FileOffset;
  378. USHORT Length;
  379. } NCP_READ_REQUEST, *PNCP_READ_REQUEST;
  380. typedef struct _NCP_READ_RESPONSE {
  381. NCP_RESPONSE ResponseHeader;
  382. USHORT Length;
  383. //UCHAR Data[x];
  384. } NCP_READ_RESPONSE, *PNCP_READ_RESPONSE;
  385. #include <packoff.h>
  386. #endif // _NCP_