This file is indexed.

/usr/include/afpfs-ng/afp_protocol.h is in libafpclient-dev 0.8.1-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
#ifndef _AFP_PROTOCOL_H_
#define _AFP_PROTOCOL_H_

#include <sys/types.h>
#include <stddef.h>
#include <unistd.h>
#include <stdint.h>

/* This file defines constants for the Apple File Protocol.
   All page references are from "Apple Filing Protocol Programming" version 3.2.
   except where noted.
*/

#define AFP_SERVER_NAME_LEN 33
#define AFP_SERVER_NAME_UTF8_LEN 255
#define AFP_VOLUME_NAME_LEN 33
#define AFP_VOLUME_NAME_UTF8_LEN 33
#define AFP_SIGNATURE_LEN 16
#define AFP_MACHINETYPE_LEN 33
#define AFP_LOGINMESG_LEN 200
#define AFP_VOLPASS_LEN 8
#define AFP_HOSTNAME_LEN 255
/* This is actually just a guess, and only used for appletalk */
#define AFP_ZONE_LEN 255

#define AFP_SERVER_ICON_LEN 256


#define AFP_MAX_USERNAME_LEN 127
#define AFP_MAX_PASSWORD_LEN 127


/* This is the maximum length of any UAM string */
#define AFP_UAM_LENGTH 24

/* This is the maximum length of any path description */
#define AFP_MAX_PATH 768

#define AFP_VOL_FLAT 1
#define AFP_VOL_FIXED 2
#define AFP_VOL_VARIABLE 3

/* The root directory ID, p.26 */

#define AFP_ROOT_DID 2

/* Path type constants, p.249 */

enum {
kFPShortName = 1,
kFPLongName = 2,
kFPUTF8Name = 3
};

/* fork types */

#define AFP_FORKTYPE_DATA 0x0
#define AFP_FORKTYPE_RESOURCE 0x80

/* openfork access modes, from p.196 */

#define AFP_OPENFORK_ALLOWREAD 1
#define AFP_OPENFORK_ALLOWWRITE 2
#define AFP_OPENFORK_DENYREAD 0x10
#define AFP_OPENFORK_DENYWRITE 0x20

/* Message type for getsrvmesg, p. 169*/

typedef enum {
  AFPMESG_LOGIN = 0,
  AFPMESG_SERVER = 1
} afpmessage_t;

/* Message bitmap for getsrvrmsg */

#define AFP_GETSRVRMSG_UTF8 0x2
#define AFP_GETSRVRMSG_GETMSG 0x1


/* Maximum Version length, p.17 */
#define AFP_MAX_VERSION_LENGTH 16

/* Maximum length of a token, this is undocumented */
#define AFP_TOKEN_MAX_LEN 256

/* The maximum size of a file for AFP 2 */
#define AFP_MAX_AFP2_FILESIZE (4294967296)

/* Unix privs, p.240 */

struct afp_unixprivs {
	uint32_t uid __attribute__((__packed__));
	uint32_t gid __attribute__((__packed__));
	uint32_t permissions __attribute__((__packed__));
	uint32_t ua_permissions __attribute__((__packed__));

};


/* AFP Volume attributes bitmap, p.241 */

enum {
    kReadOnly = 0x01,
    kHasVolumePassword = 0x02,
    kSupportsFileIDs = 0x04,
    kSupportsCatSearch = 0x08,
    kSupportsBlankAccessPrivs = 0x10,
    kSupportsUnixPrivs = 0x20,
    kSupportsUTF8Names = 0x40,
    kNoNetworkUserIDs = 0x80,
    kDefaultPrivsFromParent = 0x100,
    kNoExchangeFiles = 0x200,
    kSupportsExtAttrs = 0x400,
    kSupportsACLs=0x800
};

/* AFP file creation constantes, p.250 */
enum {
kFPSoftCreate = 0,
kFPHardCreate = 0x80
};

/* AFP Directory attributes, taken from the protocol guide p.236 */

enum {
    kFPAttributeBit = 0x1,
    kFPParentDirIDBit = 0x2,
    kFPCreateDateBit = 0x4,
    kFPModDateBit = 0x8,
    kFPBackupDateBit = 0x10,
    kFPFinderInfoBit = 0x20,
    kFPLongNameBit = 0x40,
    kFPShortNameBit = 0x80,
    kFPNodeIDBit = 0x100,
    kFPOffspringCountBit = 0x0200,
    kFPOwnerIDBit = 0x0400,
    kFPGroupIDBit = 0x0800,
    kFPAccessRightsBit = 0x1000,
    kFPProDOSInfoBit = 0x2000, // AFP version 2.2 and earlier
    kFPUTF8NameBit = 0x2000, // AFP version 3.0 and later
    kFPUnixPrivsBit = 0x8000 // AFP version 3.0 and later
};

/* AFP File bitmap, p.238.  These are the ones not in the AFP Directory
   attributes map. */

enum {
	kFPDataForkLenBit = 0x0200,
	kFPRsrcForkLenBit = 0x0400,
	kFPExtDataForkLenBit = 0x0800, // AFP version 3.0 and later
	kFPLaunchLimitBit = 0x1000,
	kFPExtRsrcForkLenBit = 0x4000, // AFP version 3.0 and later
};

/* AFP Extended Attributes Bitmap, p.238  */

enum {
	kXAttrNoFollow = 0x1,
	kXAttrCreate = 0x2,
	kXAttrREplace=0x4
};


/* AFP function codes */
enum AFPFunction
{
        afpByteRangeLock = 1, afpCloseVol, afpCloseDir, afpCloseFork,
        afpCopyFile, afpCreateDir, afpCreateFile,
        afpDelete, afpEnumerate, afpFlush, afpFlushFork,
        afpGetForkParms = 14, afpGetSrvrInfo, afpGetSrvrParms,
        afpGetVolParms, afpLogin, afpLoginCont, afpLogout, afpMapID,
        afpMapName, afpMoveAndRename, afpOpenVol, afpOpenDir, afpOpenFork,
        afpRead, afpRename, afpSetDirParms, afpSetFileParms,
        afpSetForkParms, afpSetVolParms, afpWrite, afpGetFileDirParms,
	afpSetFileDirParms, afpChangePassword,
        afpGetUserInfo=37,afpGetSrvrMsg = 38,
	afpOpenDT=48,
	afpCloseDT=49,
	afpGetIcon=51, afpGetIconInfo=52,
	afpAddComment=56, afpRemoveComment=57, afpGetComment=58,
	afpByteRangeLockExt=59, afpReadExt, afpWriteExt,
	afpGetAuthMethods=62,
	afp_LoginExt=63,
	afpGetSessionToken=64,
	afpDisconnectOldSession=65,
	afpEnumerateExt=66,
	afpCatSearchExt = 67,
	afpEnumerateExt2 = 68, afpGetExtAttr, afpSetExtAttr, 
	afpRemoveExtAttr , afpListExtAttrs,
	afpZzzzz = 122,
	afpAddIcon=192,
};

/* AFP Volume bitmap.  Take from 242 of the protocol guide. */
enum {
	kFPBadVolPre222Bitmap = 0xFe00,
	kFPBadVolBitmap = 0xF000,
	kFPVolAttributeBit = 0x1,
	kFPVolSignatureBit = 0x2,
	kFPVolCreateDateBit = 0x4,
	kFPVolModDateBit = 0x8,
	kFPVolBackupDateBit = 0x10,
	kFPVolIDBit = 0x20,
	kFPVolBytesFreeBit = 0x40,
	kFPVolBytesTotalBit = 0x80,
	kFPVolNameBit = 0x100,
	kFPVolExtBytesFreeBit = 0x200,
	kFPVolExtBytesTotalBit = 0x400,
	kFPVolBlockSizeBit = 0x800
};

/* AFP Attention Codes -- 4 bits */
#define AFPATTN_SHUTDOWN     (1 << 15)            /* shutdown/disconnect */
#define AFPATTN_CRASH        (1 << 14)            /* server crashed */
#define AFPATTN_MESG         (1 << 13)            /* server has message */
#define AFPATTN_NORECONNECT  (1 << 12)            /* don't reconnect */
/* server notification */
#define AFPATTN_NOTIFY       (AFPATTN_MESG | AFPATTN_NORECONNECT) 

/* extended bitmap -- 12 bits. volchanged is only useful w/ a server
 * notification, and time is only useful for shutdown. */
#define AFPATTN_VOLCHANGED   (1 << 0)             /* volume has changed */
#define AFPATTN_TIME(x)      ((x) & 0xfff)        /* time in minutes */

#define kFPNoErr 0

/* AFP result codes, p252 */
#define kASPSessClosed -1072
#define kFPAccessDenied -5000
#define kFPAuthContinue -5001
#define kFPBadUAM -5002
#define kFPBadVersNum -5003
#define kFPBitmapErr -5004
#define kFPCantMove -5005
#define kFPDenyConflict -5006
#define kFPDirNotEmpty -5007
#define kFPDiskFull -5008
#define kFPEOFErr -5009
#define kFPFileBusy -5010
#define kFPFlatVol -5011
#define kFPItemNotFound -5012
#define kFPLockErr -5013
#define kFPMiscErr -5014
#define kFPNoMoreLocks -5015
#define kFPNoServer -5016
#define kFPObjectExists -5017
#define kFPObjectNotFound -5018
#define kFPParamErr -5019
#define kFPRangeNotLocked -5020
#define kFPRangeOverlap -5021
#define kFPSessClosed -5022
#define kFPUserNotAuth -5023
#define kFPCallNotSupported -5024
#define kFPObjectTypeErr -5025
#define kFPTooManyFilesOpen -5026
#define kFPServerGoingDown -5027
#define kFPCantRename -5028
#define kFPDirNotFound -5029
#define kFPIconTypeError -5030
#define kFPVolLocked -5031
#define kFPObjectLocked -5032
#define kFPContainsSharedErr -5033
#define kFPIDNotFound -5034
#define kFPIDExists -5035
#define kFPDiffVolErr  -5036
#define kFPCatalogChanged -5037
#define kFPSameObjectErr -5038
#define kFPBadIDErr -5039
#define kFPPwdSameErr -5040
#define kFPPwdTooShortErr -5041
#define kFPPwdExpiredErr -5042
#define kFPInsideSharedErr -5043
#define kFPInsideTrashErr -5044
#define kFPPwdNeedsChangeErr -5045
#define kFPPwdPolicyErr -5046
#define kFPDiskQuotaExceeded –5047 



/* These flags determine to lock or unlock in ByteRangeLock(Ext) */

enum {
ByteRangeLock_Lock = 0,
ByteRangeLock_Unlock = 1
};

/* These flags are used in volopen and getsrvrparm replies, p.171 */

#define HasConfigInfo 0x1
#define HasPassword 0x80

/* These are the subfunction for kFPMapID, as per p.248 */

enum {
kUserIDToName = 1,
kGroupIDToName = 2,
kUserIDToUTF8Name = 3,
kGroupIDToUTF8Name = 4,
kUserUUIDToUTF8Name = 5,
kGroupUUIDToUTF8Name = 6
};


/* These are the subfunction flags described in the FPMapName command, p.286.
   Note that this is different than what's described on p. 186. */

enum {
kNameToUserID = 1,
kNameToGroupID = 2,
kUTF8NameToUserID = 3,
kUTF8NameToGroupID = 4,
kUTF8NameToUserUUID = 5,
kUTF8NameToGroupUUID = 6
};

/* These are bits for FPGetUserInfo, p.173. */
#define kFPGetUserInfo_USER_ID 1
#define kFPGetUserInfo_PRI_GROUPID 2

/* Flags for the replies of GetSrvrInfo and DSI GetStatus, p.240 */

enum {
	kSupportsCopyfile = 0x01,
	kSupportsChgPwd = 0x02,
	kDontAllowSavePwd = 0x04,
	kSupportsSrvrMsg = 0x08,
	kSrvrSig = 0x10,
	kSupportsTCP = 0x20,
	kSupportsSrvrNotify = 0x40,
	kSupportsReconnect = 0x80,
	kSupportsDirServices = 0x100,
	kSupportsUTF8SrvrName = 0x200,
	kSupportsUUIDs = 0x400,
	kSupportsSuperClient = 0x8000
};


/* p.247 */

enum {
	kLoginWithoutID = 0,
	kLoginWithID = 1,
	kReconnWithID = 2,
	kLoginWithTimeAndID = 3,
	kReconnWithTimeAndID = 4,
	kRecon1Login = 5,
	kRecon1ReconnectLogin = 6,
	kRecon1Refresh = 7, kGetKerberosSessionKey = 8
};


#define AFP_CHMOD_ALLOWED_BITS_22 \
	(S_IRUSR |S_IWUSR | S_IRGRP | S_IWGRP |S_IROTH | S_IWOTH | S_IFREG )


#endif