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