ncp.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. /*
  3. * ncp.h
  4. *
  5. * Copyright (C) 1995 by Volker Lendecke
  6. * Modified for sparc by J.F. Chadima
  7. * Modified for __constant_ntoh by Frank A. Vorstenbosch
  8. *
  9. */
  10. #ifndef _LINUX_NCP_H
  11. #define _LINUX_NCP_H
  12. #include <linux/types.h>
  13. #define NCP_PTYPE (0x11)
  14. #define NCP_PORT (0x0451)
  15. #define NCP_ALLOC_SLOT_REQUEST (0x1111)
  16. #define NCP_REQUEST (0x2222)
  17. #define NCP_DEALLOC_SLOT_REQUEST (0x5555)
  18. struct ncp_request_header {
  19. __u16 type;
  20. __u8 sequence;
  21. __u8 conn_low;
  22. __u8 task;
  23. __u8 conn_high;
  24. __u8 function;
  25. __u8 data[0];
  26. } __attribute__((packed));
  27. #define NCP_REPLY (0x3333)
  28. #define NCP_WATCHDOG (0x3E3E)
  29. #define NCP_POSITIVE_ACK (0x9999)
  30. struct ncp_reply_header {
  31. __u16 type;
  32. __u8 sequence;
  33. __u8 conn_low;
  34. __u8 task;
  35. __u8 conn_high;
  36. __u8 completion_code;
  37. __u8 connection_state;
  38. __u8 data[0];
  39. } __attribute__((packed));
  40. #define NCP_VOLNAME_LEN (16)
  41. #define NCP_NUMBER_OF_VOLUMES (256)
  42. struct ncp_volume_info {
  43. __u32 total_blocks;
  44. __u32 free_blocks;
  45. __u32 purgeable_blocks;
  46. __u32 not_yet_purgeable_blocks;
  47. __u32 total_dir_entries;
  48. __u32 available_dir_entries;
  49. __u8 sectors_per_block;
  50. char volume_name[NCP_VOLNAME_LEN + 1];
  51. };
  52. #define AR_READ (cpu_to_le16(1))
  53. #define AR_WRITE (cpu_to_le16(2))
  54. #define AR_EXCLUSIVE (cpu_to_le16(0x20))
  55. #define NCP_FILE_ID_LEN 6
  56. /* Defines for Name Spaces */
  57. #define NW_NS_DOS 0
  58. #define NW_NS_MAC 1
  59. #define NW_NS_NFS 2
  60. #define NW_NS_FTAM 3
  61. #define NW_NS_OS2 4
  62. /* Defines for ReturnInformationMask */
  63. #define RIM_NAME (cpu_to_le32(1))
  64. #define RIM_SPACE_ALLOCATED (cpu_to_le32(2))
  65. #define RIM_ATTRIBUTES (cpu_to_le32(4))
  66. #define RIM_DATA_SIZE (cpu_to_le32(8))
  67. #define RIM_TOTAL_SIZE (cpu_to_le32(0x10))
  68. #define RIM_EXT_ATTR_INFO (cpu_to_le32(0x20))
  69. #define RIM_ARCHIVE (cpu_to_le32(0x40))
  70. #define RIM_MODIFY (cpu_to_le32(0x80))
  71. #define RIM_CREATION (cpu_to_le32(0x100))
  72. #define RIM_OWNING_NAMESPACE (cpu_to_le32(0x200))
  73. #define RIM_DIRECTORY (cpu_to_le32(0x400))
  74. #define RIM_RIGHTS (cpu_to_le32(0x800))
  75. #define RIM_ALL (cpu_to_le32(0xFFF))
  76. #define RIM_COMPRESSED_INFO (cpu_to_le32(0x80000000))
  77. /* Defines for NSInfoBitMask */
  78. #define NSIBM_NFS_NAME 0x0001
  79. #define NSIBM_NFS_MODE 0x0002
  80. #define NSIBM_NFS_GID 0x0004
  81. #define NSIBM_NFS_NLINKS 0x0008
  82. #define NSIBM_NFS_RDEV 0x0010
  83. #define NSIBM_NFS_LINK 0x0020
  84. #define NSIBM_NFS_CREATED 0x0040
  85. #define NSIBM_NFS_UID 0x0080
  86. #define NSIBM_NFS_ACSFLAG 0x0100
  87. #define NSIBM_NFS_MYFLAG 0x0200
  88. /* open/create modes */
  89. #define OC_MODE_OPEN 0x01
  90. #define OC_MODE_TRUNCATE 0x02
  91. #define OC_MODE_REPLACE 0x02
  92. #define OC_MODE_CREATE 0x08
  93. /* open/create results */
  94. #define OC_ACTION_NONE 0x00
  95. #define OC_ACTION_OPEN 0x01
  96. #define OC_ACTION_CREATE 0x02
  97. #define OC_ACTION_TRUNCATE 0x04
  98. #define OC_ACTION_REPLACE 0x04
  99. /* access rights attributes */
  100. #ifndef AR_READ_ONLY
  101. #define AR_READ_ONLY 0x0001
  102. #define AR_WRITE_ONLY 0x0002
  103. #define AR_DENY_READ 0x0004
  104. #define AR_DENY_WRITE 0x0008
  105. #define AR_COMPATIBILITY 0x0010
  106. #define AR_WRITE_THROUGH 0x0040
  107. #define AR_OPEN_COMPRESSED 0x0100
  108. #endif
  109. struct nw_nfs_info {
  110. __u32 mode;
  111. __u32 rdev;
  112. };
  113. struct nw_info_struct {
  114. __u32 spaceAlloc;
  115. __le32 attributes;
  116. __u16 flags;
  117. __le32 dataStreamSize;
  118. __le32 totalStreamSize;
  119. __u16 numberOfStreams;
  120. __le16 creationTime;
  121. __le16 creationDate;
  122. __u32 creatorID;
  123. __le16 modifyTime;
  124. __le16 modifyDate;
  125. __u32 modifierID;
  126. __le16 lastAccessDate;
  127. __u16 archiveTime;
  128. __u16 archiveDate;
  129. __u32 archiverID;
  130. __u16 inheritedRightsMask;
  131. __le32 dirEntNum;
  132. __le32 DosDirNum;
  133. __u32 volNumber;
  134. __u32 EADataSize;
  135. __u32 EAKeyCount;
  136. __u32 EAKeySize;
  137. __u32 NSCreator;
  138. __u8 nameLen;
  139. __u8 entryName[256];
  140. /* libncp may depend on there being nothing after entryName */
  141. #ifdef __KERNEL__
  142. struct nw_nfs_info nfs;
  143. #endif
  144. } __attribute__((packed));
  145. /* modify mask - use with MODIFY_DOS_INFO structure */
  146. #define DM_ATTRIBUTES (cpu_to_le32(0x02))
  147. #define DM_CREATE_DATE (cpu_to_le32(0x04))
  148. #define DM_CREATE_TIME (cpu_to_le32(0x08))
  149. #define DM_CREATOR_ID (cpu_to_le32(0x10))
  150. #define DM_ARCHIVE_DATE (cpu_to_le32(0x20))
  151. #define DM_ARCHIVE_TIME (cpu_to_le32(0x40))
  152. #define DM_ARCHIVER_ID (cpu_to_le32(0x80))
  153. #define DM_MODIFY_DATE (cpu_to_le32(0x0100))
  154. #define DM_MODIFY_TIME (cpu_to_le32(0x0200))
  155. #define DM_MODIFIER_ID (cpu_to_le32(0x0400))
  156. #define DM_LAST_ACCESS_DATE (cpu_to_le32(0x0800))
  157. #define DM_INHERITED_RIGHTS_MASK (cpu_to_le32(0x1000))
  158. #define DM_MAXIMUM_SPACE (cpu_to_le32(0x2000))
  159. struct nw_modify_dos_info {
  160. __le32 attributes;
  161. __le16 creationDate;
  162. __le16 creationTime;
  163. __u32 creatorID;
  164. __le16 modifyDate;
  165. __le16 modifyTime;
  166. __u32 modifierID;
  167. __u16 archiveDate;
  168. __u16 archiveTime;
  169. __u32 archiverID;
  170. __le16 lastAccessDate;
  171. __u16 inheritanceGrantMask;
  172. __u16 inheritanceRevokeMask;
  173. __u32 maximumSpace;
  174. } __attribute__((packed));
  175. struct nw_search_sequence {
  176. __u8 volNumber;
  177. __u32 dirBase;
  178. __u32 sequence;
  179. } __attribute__((packed));
  180. #endif /* _LINUX_NCP_H */