2 * Routines for afp packet dissection
3 * Copyright 2002, Didier Gautheron <dgautheron@magic.fr>
5 * $Id: packet-afp.c,v 1.29 2003/03/30 22:14:06 guy Exp $
7 * Ethereal - Network traffic analyzer
8 * By Gerald Combs <gerald@ethereal.com>
9 * Copyright 1998 Gerald Combs
11 * Copied from README.developer
12 * Copied from packet-dsi.c
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 #ifdef NEED_SNPRINTF_H
36 # include "snprintf.h"
41 #include <epan/packet.h>
42 #include <epan/strutil.h>
43 #include <epan/conversation.h>
45 #include "packet-afp.h"
47 /* The information in this module (AFP) comes from:
49 AFP 2.1 & 2.2.pdf contained in AppleShare_IP_6.3_SDK
50 available from http://www.apple.com
52 AFP3.0.pdf from http://www.apple.com
53 AFP3.1.pdf from http://www.apple.com
55 The netatalk source code by Wesley Craig & Adrian Sun
56 http://netatalk.sf.net
58 /* from netatalk/include/afp.h */
59 #define AFPTRANS_NONE 0
60 #define AFPTRANS_DDP (1 << 0)
61 #define AFPTRANS_TCP (1 << 1)
62 #define AFPTRANS_ALL (AFPTRANS_DDP | AFPTRANS_TCP)
64 /* AFP Attention Codes -- 4 bits */
65 #define AFPATTN_SHUTDOWN (1 << 15) /* shutdown/disconnect */
66 #define AFPATTN_CRASH (1 << 14) /* server crashed */
67 #define AFPATTN_MESG (1 << 13) /* server has message */
68 #define AFPATTN_NORECONNECT (1 << 12) /* don't reconnect */
69 /* server notification */
70 #define AFPATTN_NOTIFY (AFPATTN_MESG | AFPATTN_NORECONNECT)
72 /* extended bitmap -- 12 bits. volchanged is only useful w/ a server
73 * notification, and time is only useful for shutdown. */
74 #define AFPATTN_VOLCHANGED (1 << 0) /* volume has changed */
75 #define AFPATTN_TIME(x) ((x) & 0xfff) /* time in minutes */
78 #define AFP_BYTELOCK 1
79 #define AFP_CLOSEVOL 2
80 #define AFP_CLOSEDIR 3
81 #define AFP_CLOSEFORK 4
82 #define AFP_COPYFILE 5
83 #define AFP_CREATEDIR 6
84 #define AFP_CREATEFILE 7
86 #define AFP_ENUMERATE 9
88 #define AFP_FLUSHFORK 11
89 #define AFP_GETFORKPARAM 14
90 #define AFP_GETSRVINFO 15
91 #define AFP_GETSRVPARAM 16
92 #define AFP_GETVOLPARAM 17
94 #define AFP_LOGINCONT 19
97 #define AFP_MAPNAME 22
99 #define AFP_OPENVOL 24
100 #define AFP_OPENDIR 25
101 #define AFP_OPENFORK 26
103 #define AFP_RENAME 28
104 #define AFP_SETDIRPARAM 29
105 #define AFP_SETFILEPARAM 30
106 #define AFP_SETFORKPARAM 31
107 #define AFP_SETVOLPARAM 32
109 #define AFP_GETFLDRPARAM 34
110 #define AFP_SETFLDRPARAM 35
111 #define AFP_CHANGEPW 36
112 #define AFP_GETUSERINFO 37
113 #define AFP_GETSRVRMSG 38
114 #define AFP_CREATEID 39
115 #define AFP_DELETEID 40
116 #define AFP_RESOLVEID 41
117 #define AFP_EXCHANGEFILE 42
118 #define AFP_CATSEARCH 43
119 #define AFP_OPENDT 48
120 #define AFP_CLOSEDT 49
121 #define AFP_GETICON 51
122 #define AFP_GTICNINFO 52
123 #define AFP_ADDAPPL 53
124 #define AFP_RMVAPPL 54
125 #define AFP_GETAPPL 55
126 #define AFP_ADDCMT 56
127 #define AFP_RMVCMT 57
128 #define AFP_GETCMT 58
130 #define AFP_ADDICON 192
132 /* AFP 3.0 new calls */
133 #define AFP_BYTELOCK_EXT 59
134 #define AFP_CATSEARCH_EXT 67
135 #define AFP_ENUMERATE_EXT 66
136 #define AFP_READ_EXT 60
137 #define AFP_WRITE_EXT 61
138 #define AFP_LOGIN_EXT 63
139 #define AFP_GETSESSTOKEN 64
140 #define AFP_DISCTOLDSESS 65
142 /* AFP 3.1 new calls */
143 #define AFP_ENUMERATE_EXT2 68
145 /* ----------------------------- */
146 static int proto_afp = -1;
147 static int hf_afp_reserved = -1;
149 static int hf_afp_command = -1; /* CommandCode */
150 static int hf_afp_AFPVersion = -1;
151 static int hf_afp_UAM = -1;
152 static int hf_afp_user = -1;
153 static int hf_afp_passwd = -1;
154 static int hf_afp_random = -1;
156 static int hf_afp_login_flags = -1;
157 static int hf_afp_pad = -1;
159 static int hf_afp_user_type = -1;
160 static int hf_afp_user_len = -1;
161 static int hf_afp_user_name = -1;
163 static int hf_afp_vol_flag_passwd = -1;
164 static int hf_afp_vol_flag_unix_priv = -1;
165 static int hf_afp_server_time = -1;
167 static int hf_afp_vol_bitmap = -1;
168 static int hf_afp_vol_name_offset = -1;
169 static int hf_afp_vol_id = -1;
170 static int hf_afp_vol_attribute = -1;
171 static int hf_afp_vol_name = -1;
172 static int hf_afp_vol_signature = -1;
173 static int hf_afp_vol_creation_date = -1;
174 static int hf_afp_vol_modification_date = -1;
175 static int hf_afp_vol_backup_date = -1;
176 static int hf_afp_vol_bytes_free = -1;
177 static int hf_afp_vol_bytes_total = -1;
178 static int hf_afp_vol_ex_bytes_free = -1;
179 static int hf_afp_vol_ex_bytes_total = -1;
180 static int hf_afp_vol_block_size = -1;
183 static int hf_afp_comment = -1;
184 static int hf_afp_file_creator = -1;
185 static int hf_afp_file_type = -1;
186 static int hf_afp_icon_type = -1;
187 static int hf_afp_icon_length = -1;
188 static int hf_afp_icon_tag = -1;
189 static int hf_afp_icon_index = -1;
190 static int hf_afp_appl_index = -1;
191 static int hf_afp_appl_tag = -1;
193 static int hf_afp_did = -1;
194 static int hf_afp_file_id = -1;
195 static int hf_afp_file_DataForkLen = -1;
196 static int hf_afp_file_RsrcForkLen = -1;
197 static int hf_afp_file_ExtDataForkLen = -1;
198 static int hf_afp_file_ExtRsrcForkLen = -1;
200 static int hf_afp_dir_bitmap = -1;
201 static int hf_afp_dir_offspring = -1;
202 static int hf_afp_dir_OwnerID = -1;
203 static int hf_afp_dir_GroupID = -1;
205 static int hf_afp_file_bitmap = -1;
206 static int hf_afp_req_count = -1;
207 static int hf_afp_start_index = -1;
208 static int hf_afp_start_index32 = -1;
209 static int hf_afp_max_reply_size = -1;
210 static int hf_afp_max_reply_size32 = -1;
211 static int hf_afp_file_flag = -1;
212 static int hf_afp_create_flag = -1;
213 static int hf_afp_struct_size = -1;
214 static int hf_afp_struct_size16 = -1;
216 static int hf_afp_cat_count = -1;
217 static int hf_afp_cat_req_matches = -1;
218 static int hf_afp_cat_position = -1;
220 static int hf_afp_creation_date = -1;
221 static int hf_afp_modification_date = -1;
222 static int hf_afp_backup_date = -1;
223 static int hf_afp_finder_info = -1;
224 static int hf_afp_long_name_offset = -1;
225 static int hf_afp_short_name_offset = -1;
226 static int hf_afp_unicode_name_offset = -1;
227 static int hf_afp_unix_privs_uid = -1;
228 static int hf_afp_unix_privs_gid = -1;
229 static int hf_afp_unix_privs_permissions = -1;
230 static int hf_afp_unix_privs_ua_permissions = -1;
232 static int hf_afp_path_type = -1;
233 static int hf_afp_path_len = -1;
234 static int hf_afp_path_name = -1;
235 static int hf_afp_path_unicode_hint = -1;
236 static int hf_afp_path_unicode_len = -1;
238 static int hf_afp_flag = -1;
239 static int hf_afp_dt_ref = -1;
240 static int hf_afp_ofork = -1;
241 static int hf_afp_ofork_len = -1;
242 static int hf_afp_offset = -1;
243 static int hf_afp_rw_count = -1;
244 static int hf_afp_newline_mask = -1;
245 static int hf_afp_newline_char = -1;
246 static int hf_afp_last_written = -1;
247 static int hf_afp_actual_count = -1;
249 static int hf_afp_fork_type = -1;
250 static int hf_afp_access_mode = -1;
251 static int hf_afp_access_read = -1;
252 static int hf_afp_access_write = -1;
253 static int hf_afp_access_deny_read = -1;
254 static int hf_afp_access_deny_write = -1;
256 static gint hf_afp_lock_op = -1;
257 static gint hf_afp_lock_from = -1;
258 static gint hf_afp_lock_offset = -1;
259 static gint hf_afp_lock_len = -1;
260 static gint hf_afp_lock_range_start = -1;
262 static gint ett_afp = -1;
264 static gint ett_afp_vol_attribute = -1;
265 static gint ett_afp_enumerate = -1;
266 static gint ett_afp_enumerate_line = -1;
267 static gint ett_afp_access_mode = -1;
269 static gint ett_afp_vol_bitmap = -1;
270 static gint ett_afp_dir_bitmap = -1;
271 static gint ett_afp_dir_attribute = -1;
272 static gint ett_afp_file_attribute = -1;
273 static gint ett_afp_file_bitmap = -1;
274 static gint ett_afp_unix_privs = -1;
275 static gint ett_afp_path_name = -1;
276 static gint ett_afp_lock_flags = -1;
277 static gint ett_afp_dir_ar = -1;
279 static gint ett_afp_server_vol = -1;
280 static gint ett_afp_vol_list = -1;
281 static gint ett_afp_vol_flag = -1;
282 static gint ett_afp_cat_search = -1;
283 static gint ett_afp_cat_r_bitmap = -1;
284 static gint ett_afp_cat_spec = -1;
285 static gint ett_afp_vol_did = -1;
287 /* AFP 3.0 parameters */
288 static gint hf_afp_lock_offset64 = -1;
289 static gint hf_afp_lock_len64 = -1;
290 static gint hf_afp_lock_range_start64 = -1;
292 static int hf_afp_offset64 = -1;
293 static int hf_afp_rw_count64 = -1;
295 static int hf_afp_last_written64 = -1;
297 static int hf_afp_ofork_len64 = -1;
298 static int hf_afp_session_token_type = -1;
299 static int hf_afp_session_token_len = -1;
300 static int hf_afp_session_token = -1;
301 static int hf_afp_session_token_timestamp = -1;
303 static dissector_handle_t data_handle;
305 static const value_string vol_signature_vals[] = {
307 {2, "Fixed Directory ID"},
308 {3, "Variable Directory ID (deprecated)"},
312 static const value_string CommandCode_vals[] = {
313 {AFP_BYTELOCK, "FPByteRangeLock" },
314 {AFP_CLOSEVOL, "FPCloseVol" },
315 {AFP_CLOSEDIR, "FPCloseDir" },
316 {AFP_CLOSEFORK, "FPCloseFork" },
317 {AFP_COPYFILE, "FPCopyFile" },
318 {AFP_CREATEDIR, "FPCreateDir" },
319 {AFP_CREATEFILE, "FPCreateFile" },
320 {AFP_DELETE, "FPDelete" },
321 {AFP_ENUMERATE, "FPEnumerate" },
322 {AFP_FLUSH, "FPFlush" },
323 {AFP_FLUSHFORK, "FPFlushFork" },
324 {AFP_GETFORKPARAM, "FPGetForkParms" },
325 {AFP_GETSRVINFO, "FPGetSrvrInfo" },
326 {AFP_GETSRVPARAM, "FPGetSrvrParms" },
327 {AFP_GETVOLPARAM, "FPGetVolParms" },
328 {AFP_LOGIN, "FPLogin" },
329 {AFP_LOGINCONT, "FPLoginCont" },
330 {AFP_LOGOUT, "FPLogout" },
331 {AFP_MAPID, "FPMapID" },
332 {AFP_MAPNAME, "FPMapName" },
333 {AFP_MOVE, "FPMoveAndRename" },
334 {AFP_OPENVOL, "FPOpenVol" },
335 {AFP_OPENDIR, "FPOpenDir" },
336 {AFP_OPENFORK, "FPOpenFork" },
337 {AFP_READ, "FPRead" },
338 {AFP_RENAME, "FPRename" },
339 {AFP_SETDIRPARAM, "FPSetDirParms" },
340 {AFP_SETFILEPARAM, "FPSetFileParms" },
341 {AFP_SETFORKPARAM, "FPSetForkParms" },
342 {AFP_SETVOLPARAM, "FPSetVolParms" },
343 {AFP_WRITE, "FPWrite" },
344 {AFP_GETFLDRPARAM, "FPGetFileDirParms" },
345 {AFP_SETFLDRPARAM, "FPSetFileDirParms" },
346 {AFP_CHANGEPW, "FPChangePassword" },
347 {AFP_GETUSERINFO, "FPGetUserInfo" },
348 {AFP_GETSRVRMSG, "FPGetSrvrMsg" },
349 {AFP_CREATEID, "FPCreateID" },
350 {AFP_DELETEID, "FPDeleteID" },
351 {AFP_RESOLVEID, "FPResolveID" },
352 {AFP_EXCHANGEFILE, "FPExchangeFiles" },
353 {AFP_CATSEARCH, "FPCatSearch" },
354 {AFP_OPENDT, "FPOpenDT" },
355 {AFP_CLOSEDT, "FPCloseDT" },
356 {AFP_GETICON, "FPGetIcon" },
357 {AFP_GTICNINFO, "FPGetIconInfo" },
358 {AFP_ADDAPPL, "FPAddAPPL" },
359 {AFP_RMVAPPL, "FPRemoveAPPL" },
360 {AFP_GETAPPL, "FPGetAPPL" },
361 {AFP_ADDCMT, "FPAddComment" },
362 {AFP_RMVCMT, "FPRemoveComment" },
363 {AFP_GETCMT, "FPGetComment" },
364 {AFP_BYTELOCK_EXT, "FPByteRangeLockExt" },
365 {AFP_CATSEARCH_EXT, "FPCatSearchExt" },
366 {AFP_ENUMERATE_EXT, "FPEnumerateExt" },
367 {AFP_ENUMERATE_EXT2, "FPEnumerateExt2" },
368 {AFP_READ_EXT, "FPReadExt" },
369 {AFP_WRITE_EXT, "FPWriteExt" },
370 {AFP_LOGIN_EXT, "FPLoginExt" },
371 {AFP_GETSESSTOKEN, "FPGetSessionToken" },
372 {AFP_DISCTOLDSESS, "FPDisconnectOldSession" },
374 {AFP_ADDICON, "FPAddIcon" },
378 static const value_string unicode_hint_vals[] = {
380 { 1, "MacJapanese" },
381 { 2, "MacChineseTrad" },
386 { 7, "MacCyrillic" },
387 { 9, "MacDevanagari" },
388 { 10, "MacGurmukhi" },
389 { 11, "MacGujarati" },
391 { 13, "MacBengali" },
394 { 16, "MacKannada" },
395 { 17, "MacMalayalam" },
396 { 18, "MacSinhalese" },
397 { 19, "MacBurmese" },
400 { 22, "MacLaotian" },
401 { 23, "MacGeorgian" },
402 { 24, "MacArmenian" },
403 { 25, "MacChineseSimp" },
404 { 26, "MacTibetan" },
405 { 27, "MacMongolian" },
406 { 28, "MacEthiopic" },
407 { 29, "MacCentralEurRoman" },
408 { 30, "MacVietnamese" },
409 { 31, "MacExtArabic" },
411 { 34, "MacDingbats" },
412 { 35, "MacTurkish" },
413 { 36, "MacCroatian" },
414 { 37, "MacIcelandic" },
415 { 38, "MacRomanian" },
418 { 41, "MacKeyboardGlyphs" },
419 { 126, "MacUnicode" },
421 { 152, "MacUkrainian" },
425 { 256, "UnicodeDefault" },
426 /* { 257, "UnicodeV1_1" }, */
427 { 257, "ISO10646_1993" },
428 { 259, "UnicodeV2_0" },
429 { 259, "UnicodeV2_1" },
430 { 260, "UnicodeV3_0" },
431 { 513, "ISOLatin1" },
432 { 514, "ISOLatin2" },
433 { 515, "ISOLatin3" },
434 { 516, "ISOLatin4" },
435 { 517, "ISOLatinCyrillic" },
436 { 518, "ISOLatinArabic" },
437 { 519, "ISOLatinGreek" },
438 { 520, "ISOLatinHebrew" },
439 { 521, "ISOLatin5" },
440 { 522, "ISOLatin6" },
441 { 525, "ISOLatin7" },
442 { 526, "ISOLatin8" },
443 { 527, "ISOLatin9" },
444 { 1024, "DOSLatinUS" },
445 { 1029, "DOSGreek" },
446 { 1030, "DOSBalticRim" },
447 { 1040, "DOSLatin1" },
448 { 1041, "DOSGreek1" },
449 { 1042, "DOSLatin2" },
450 { 1043, "DOSCyrillic" },
451 { 1044, "DOSTurkish" },
452 { 1045, "DOSPortuguese" },
453 { 1046, "DOSIcelandic" },
454 { 1047, "DOSHebrew" },
455 { 1048, "DOSCanadianFrench" },
456 { 1049, "DOSArabic" },
457 { 1050, "DOSNordic" },
458 { 1051, "DOSRussian" },
459 { 1052, "DOSGreek2" },
461 { 1056, "DOSJapanese" },
462 { 1057, "DOSChineseSimplif" },
463 { 1058, "DOSKorean" },
464 { 1059, "DOSChineseTrad" },
465 { 1280, "WindowsLatin1" },
466 /* { 1280, "WindowsANSI" }, */
467 { 1281, "WindowsLatin2" },
468 { 1282, "WindowsCyrillic" },
469 { 1283, "WindowsGreek" },
470 { 1284, "WindowsLatin5" },
471 { 1285, "WindowsHebrew" },
472 { 1286, "WindowsArabic" },
473 { 1287, "WindowsBalticRim" },
474 { 1288, "WindowsVietnamese" },
475 { 1296, "WindowsKoreanJohab" },
476 { 1536, "US_ASCII" },
477 { 1568, "JIS_X0201_76" },
478 { 1569, "JIS_X0208_83" },
479 { 1570, "JIS_X0208_90" },
484 from Apple AFP3.0.pdf
487 #define kFPVolAttributeBit (1 << 0)
488 #define kFPVolSignatureBit (1 << 1)
489 #define kFPVolCreateDateBit (1 << 2)
490 #define kFPVolModDateBit (1 << 3)
491 #define kFPVolBackupDateBit (1 << 4)
492 #define kFPVolIDBit (1 << 5)
493 #define kFPVolBytesFreeBit (1 << 6)
494 #define kFPVolBytesTotalBit (1 << 7)
495 #define kFPVolNameBit (1 << 8)
496 #define kFPVolExtBytesFreeBit (1 << 9)
497 #define kFPVolExtBytesTotalBit (1 << 10)
498 #define kFPVolBlockSizeBit (1 << 11)
500 static int hf_afp_vol_bitmap_Attributes = -1;
501 static int hf_afp_vol_bitmap_Signature = -1;
502 static int hf_afp_vol_bitmap_CreateDate = -1;
503 static int hf_afp_vol_bitmap_ModDate = -1;
504 static int hf_afp_vol_bitmap_BackupDate = -1;
505 static int hf_afp_vol_bitmap_ID = -1;
506 static int hf_afp_vol_bitmap_BytesFree = -1;
507 static int hf_afp_vol_bitmap_BytesTotal = -1;
508 static int hf_afp_vol_bitmap_Name = -1;
509 static int hf_afp_vol_bitmap_ExtBytesFree = -1;
510 static int hf_afp_vol_bitmap_ExtBytesTotal = -1;
511 static int hf_afp_vol_bitmap_BlockSize = -1;
513 static int hf_afp_vol_attribute_ReadOnly = -1;
514 static int hf_afp_vol_attribute_HasVolumePassword = -1;
515 static int hf_afp_vol_attribute_SupportsFileIDs = -1;
516 static int hf_afp_vol_attribute_SupportsCatSearch = -1;
517 static int hf_afp_vol_attribute_SupportsBlankAccessPrivs = -1;
518 static int hf_afp_vol_attribute_SupportsUnixPrivs = -1;
519 static int hf_afp_vol_attribute_SupportsUTF8Names = -1;
521 static int hf_afp_dir_bitmap_Attributes = -1;
522 static int hf_afp_dir_bitmap_ParentDirID = -1;
523 static int hf_afp_dir_bitmap_CreateDate = -1;
524 static int hf_afp_dir_bitmap_ModDate = -1;
525 static int hf_afp_dir_bitmap_BackupDate = -1;
526 static int hf_afp_dir_bitmap_FinderInfo = -1;
527 static int hf_afp_dir_bitmap_LongName = -1;
528 static int hf_afp_dir_bitmap_ShortName = -1;
529 static int hf_afp_dir_bitmap_NodeID = -1;
530 static int hf_afp_dir_bitmap_OffspringCount = -1;
531 static int hf_afp_dir_bitmap_OwnerID = -1;
532 static int hf_afp_dir_bitmap_GroupID = -1;
533 static int hf_afp_dir_bitmap_AccessRights = -1;
534 static int hf_afp_dir_bitmap_UTF8Name = -1;
535 static int hf_afp_dir_bitmap_UnixPrivs = -1;
537 static int hf_afp_dir_attribute_Invisible = -1;
538 static int hf_afp_dir_attribute_IsExpFolder = -1;
540 static int hf_afp_dir_attribute_System = -1;
541 static int hf_afp_dir_attribute_Mounted = -1;
542 static int hf_afp_dir_attribute_InExpFolder = -1;
544 static int hf_afp_dir_attribute_BackUpNeeded = -1;
545 static int hf_afp_dir_attribute_RenameInhibit = -1;
546 static int hf_afp_dir_attribute_DeleteInhibit = -1;
547 static int hf_afp_dir_attribute_SetClear = -1;
549 static int hf_afp_file_bitmap_Attributes = -1;
550 static int hf_afp_file_bitmap_ParentDirID = -1;
551 static int hf_afp_file_bitmap_CreateDate = -1;
552 static int hf_afp_file_bitmap_ModDate = -1;
553 static int hf_afp_file_bitmap_BackupDate = -1;
554 static int hf_afp_file_bitmap_FinderInfo = -1;
555 static int hf_afp_file_bitmap_LongName = -1;
556 static int hf_afp_file_bitmap_ShortName = -1;
557 static int hf_afp_file_bitmap_NodeID = -1;
558 static int hf_afp_file_bitmap_DataForkLen = -1;
559 static int hf_afp_file_bitmap_RsrcForkLen = -1;
560 static int hf_afp_file_bitmap_ExtDataForkLen = -1;
561 static int hf_afp_file_bitmap_LaunchLimit = -1;
563 static int hf_afp_file_bitmap_UTF8Name = -1;
564 static int hf_afp_file_bitmap_ExtRsrcForkLen = -1;
565 static int hf_afp_file_bitmap_UnixPrivs = -1;
567 static int hf_afp_file_attribute_Invisible = -1;
568 static int hf_afp_file_attribute_MultiUser = -1;
569 static int hf_afp_file_attribute_System = -1;
570 static int hf_afp_file_attribute_DAlreadyOpen = -1;
571 static int hf_afp_file_attribute_RAlreadyOpen = -1;
572 static int hf_afp_file_attribute_WriteInhibit = -1;
573 static int hf_afp_file_attribute_BackUpNeeded = -1;
574 static int hf_afp_file_attribute_RenameInhibit = -1;
575 static int hf_afp_file_attribute_DeleteInhibit = -1;
576 static int hf_afp_file_attribute_CopyProtect = -1;
577 static int hf_afp_file_attribute_SetClear = -1;
579 static int hf_afp_map_name_type = -1;
580 static int hf_afp_map_name = -1;
581 static int hf_afp_map_id = -1;
582 static int hf_afp_map_id_type = -1;
584 static const value_string vol_bitmap_vals[] = {
585 {kFPVolAttributeBit, "VolAttribute"},
586 {kFPVolSignatureBit, "VolSignature"},
587 {kFPVolCreateDateBit, "VolCreateDate"},
588 {kFPVolModDateBit, "VolModDate"},
589 {kFPVolBackupDateBit, "VolBackupDate"},
590 {kFPVolIDBit, "VolID"},
591 {kFPVolBytesFreeBit, "VolBytesFree"},
592 {kFPVolBytesTotalBit, "VolBytesTotal"},
593 {kFPVolNameBit, "VolNameBit"},
594 {kFPVolExtBytesFreeBit, "VolExtBytesFree"},
595 {kFPVolExtBytesTotalBit, "VolExtBytesTotal"},
596 {kFPVolBlockSizeBit, "VolBlockSize"},
599 static const value_string flag_vals[] = {
604 static const value_string path_type_vals[] = {
607 {3, "Unicode names" },
610 static const value_string map_name_type_vals[] = {
611 {1, "Unicode user name to a user ID" },
612 {2, "Unicode group name to a group ID" },
613 {3, "Macintosh roman user name to a user ID" },
614 {4, "Macintosh roman group name to a group ID" },
617 static const value_string map_id_type_vals[] = {
618 {1, "User ID to a Macintosh roman user name" },
619 {2, "Group ID to a Macintosh roman group name" },
620 {3, "User ID to a unicode user name" },
621 {4, "Group ID to a unicode group name" },
625 volume attribute from Apple AFP3.0.pdf
628 #define kReadOnly (1 << 0)
629 #define kHasVolumePassword (1 << 1)
630 #define kSupportsFileIDs (1 << 2)
631 #define kSupportsCatSearch (1 << 3)
632 #define kSupportsBlankAccessPrivs (1 << 4)
633 #define kSupportsUnixPrivs (1 << 5)
634 #define kSupportsUTF8Names (1 << 6)
636 #define kNoNetworkUserIDs (1 << 7)
639 directory bitmap from Apple AFP3.0.pdf
642 #define kFPAttributeBit (1 << 0)
643 #define kFPParentDirIDBit (1 << 1)
644 #define kFPCreateDateBit (1 << 2)
645 #define kFPModDateBit (1 << 3)
646 #define kFPBackupDateBit (1 << 4)
647 #define kFPFinderInfoBit (1 << 5)
648 #define kFPLongNameBit (1 << 6)
649 #define kFPShortNameBit (1 << 7)
650 #define kFPNodeIDBit (1 << 8)
651 #define kFPOffspringCountBit (1 << 9)
652 #define kFPOwnerIDBit (1 << 10)
653 #define kFPGroupIDBit (1 << 11)
654 #define kFPAccessRightsBit (1 << 12)
655 #define kFPUTF8NameBit (1 << 13)
656 #define kFPUnixPrivsBit (1 << 14)
659 directory Access Rights parameter AFP3.0.pdf
663 #define AR_O_SEARCH (1 << 0) /* owner has search access */
664 #define AR_O_READ (1 << 1) /* owner has read access */
665 #define AR_O_WRITE (1 << 2) /* owner has write access */
667 #define AR_G_SEARCH (1 << 8) /* group has search access */
668 #define AR_G_READ (1 << 9) /* group has read access */
669 #define AR_G_WRITE (1 << 10) /* group has write access */
671 #define AR_E_SEARCH (1 << 16) /* everyone has search access */
672 #define AR_E_READ (1 << 17) /* everyone has read access */
673 #define AR_E_WRITE (1 << 18) /* everyone has write access */
675 #define AR_U_SEARCH (1 << 24) /* user has search access */
676 #define AR_U_READ (1 << 25) /* user has read access */
677 #define AR_U_WRITE (1 << 26) /* user has write access */
679 #define AR_BLANK (1 << 28) /* Blank Access Privileges (use parent dir privileges) */
680 #define AR_U_OWN (1 << 31) /* user is the owner */
682 static int hf_afp_dir_ar = -1;
683 static int hf_afp_dir_ar_o_search = -1;
684 static int hf_afp_dir_ar_o_read = -1;
685 static int hf_afp_dir_ar_o_write = -1;
686 static int hf_afp_dir_ar_g_search = -1;
687 static int hf_afp_dir_ar_g_read = -1;
688 static int hf_afp_dir_ar_g_write = -1;
689 static int hf_afp_dir_ar_e_search = -1;
690 static int hf_afp_dir_ar_e_read = -1;
691 static int hf_afp_dir_ar_e_write = -1;
692 static int hf_afp_dir_ar_u_search = -1;
693 static int hf_afp_dir_ar_u_read = -1;
694 static int hf_afp_dir_ar_u_write = -1;
695 static int hf_afp_dir_ar_blank = -1;
696 static int hf_afp_dir_ar_u_own = -1;
698 static int hf_afp_user_flag = -1;
699 static int hf_afp_user_ID = -1;
700 static int hf_afp_group_ID = -1;
701 static int hf_afp_user_bitmap = -1;
702 static int hf_afp_user_bitmap_UID = -1;
703 static int hf_afp_user_bitmap_GID = -1;
705 static gint ett_afp_user_bitmap = -1;
707 static const value_string user_flag_vals[] = {
709 {1, "Default user" },
713 file bitmap AFP3.0.pdf
716 kFPAttributeBit (bit 0)
717 kFPParentDirIDBit (bit 1)
718 kFPCreateDateBit (bit 2)
719 kFPModDateBit (bit 3)
720 kFPBackupDateBit (bit 4)
721 kFPFinderInfoBit (bit 5)
722 kFPLongNameBit (bit 6)
723 kFPShortNameBit (bit 7)
726 kFPUTF8NameBit (bit 13)
729 #define kFPDataForkLenBit (1 << 9)
730 #define kFPRsrcForkLenBit (1 << 10)
731 #define kFPExtDataForkLenBit (1 << 11)
732 #define kFPLaunchLimitBit (1 << 12)
734 #define kFPExtRsrcForkLenBit (1 << 14)
735 #define kFPUnixPrivsBit_file (1 << 15) /* :( */
738 file attribute AFP3.0.pdf
741 #define kFPInvisibleBit (1 << 0)
742 #define kFPMultiUserBit (1 << 1)
743 #define kFPSystemBit (1 << 2)
744 #define kFPDAlreadyOpenBit (1 << 3)
745 #define kFPRAlreadyOpenBit (1 << 4)
746 #define kFPWriteInhibitBit (1 << 5)
747 #define kFPBackUpNeededBit (1 << 6)
748 #define kFPRenameInhibitBit (1 << 7)
749 #define kFPDeleteInhibitBit (1 << 8)
750 #define kFPCopyProtectBit (1 << 10)
751 #define kFPSetClearBit (1 << 15)
754 #define kIsExpFolder (1 << 1)
755 #define kMounted (1 << 3)
756 #define kInExpFolder (1 << 4)
758 /* AFP 3.1 getsession token type */
759 #define kLoginWithoutID 0
760 #define kLoginWithID 1
761 #define kReconnWithID 2
762 #define kLoginWithTimeAndID 3
763 #define kReconnWithTimeAndID 4
765 static const value_string token_type_vals[] = {
766 {kLoginWithoutID, "LoginWithoutID"},
767 {kLoginWithID, "LoginWithID"},
768 {kReconnWithID, "ReconnWithID"},
769 {kLoginWithTimeAndID, "LoginWithTimeAndID"},
770 {kReconnWithTimeAndID, "ReconnWithTimeAndID"},
773 #define hash_init_count 20
776 static gint afp_equal (gconstpointer v, gconstpointer v2);
777 static guint afp_hash (gconstpointer v);
779 static guint afp_packet_init_count = 200;
782 guint32 conversation;
790 static GHashTable *afp_request_hash = NULL;
791 static GMemChunk *afp_request_keys = NULL;
792 static GMemChunk *afp_request_vals = NULL;
794 static guint Vol; /* volume */
795 static guint Did; /* parent directory ID */
798 static gint afp_equal (gconstpointer v, gconstpointer v2)
800 const afp_request_key *val1 = (const afp_request_key*)v;
801 const afp_request_key *val2 = (const afp_request_key*)v2;
803 if (val1->conversation == val2->conversation &&
804 val1->seq == val2->seq) {
810 static guint afp_hash (gconstpointer v)
812 const afp_request_key *afp_key = (const afp_request_key*)v;
816 /* --------------------------
818 #define PAD(x) { proto_tree_add_item(tree, hf_afp_pad, tvb, offset, x, FALSE); offset += x; }
821 decode_vol_bitmap (proto_tree *tree, tvbuff_t *tvb, gint offset)
823 proto_tree *sub_tree = NULL;
827 bitmap = tvb_get_ntohs(tvb, offset);
829 item = proto_tree_add_item(tree, hf_afp_vol_bitmap, tvb, offset, 2,FALSE);
830 sub_tree = proto_item_add_subtree(item, ett_afp_vol_bitmap);
833 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_Attributes, tvb, offset, 2,FALSE);
834 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_Signature, tvb, offset, 2,FALSE);
835 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_CreateDate, tvb, offset, 2,FALSE);
836 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_ModDate, tvb, offset, 2,FALSE);
837 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_BackupDate, tvb, offset, 2,FALSE);
838 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_ID, tvb, offset, 2,FALSE);
839 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_BytesFree, tvb, offset, 2,FALSE);
840 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_BytesTotal, tvb, offset, 2,FALSE);
841 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_Name, tvb, offset, 2,FALSE);
842 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_ExtBytesFree, tvb, offset, 2,FALSE);
843 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_ExtBytesTotal, tvb, offset, 2,FALSE);
844 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_BlockSize , tvb, offset, 2,FALSE);
849 /* -------------------------- */
851 decode_vol_attribute (proto_tree *tree, tvbuff_t *tvb, gint offset)
853 proto_tree *sub_tree = NULL;
857 bitmap = tvb_get_ntohs(tvb, offset);
859 item = proto_tree_add_item(tree, hf_afp_vol_attribute, tvb, offset, 2,FALSE);
860 sub_tree = proto_item_add_subtree(item, ett_afp_vol_attribute);
862 proto_tree_add_item(sub_tree, hf_afp_vol_attribute_ReadOnly ,tvb, offset, 2,FALSE);
863 proto_tree_add_item(sub_tree, hf_afp_vol_attribute_HasVolumePassword ,tvb, offset, 2,FALSE);
864 proto_tree_add_item(sub_tree, hf_afp_vol_attribute_SupportsFileIDs ,tvb, offset, 2,FALSE);
865 proto_tree_add_item(sub_tree, hf_afp_vol_attribute_SupportsCatSearch ,tvb, offset, 2,FALSE);
866 proto_tree_add_item(sub_tree, hf_afp_vol_attribute_SupportsBlankAccessPrivs,tvb, offset, 2,FALSE);
867 proto_tree_add_item(sub_tree, hf_afp_vol_attribute_SupportsUnixPrivs ,tvb, offset, 2,FALSE);
868 proto_tree_add_item(sub_tree, hf_afp_vol_attribute_SupportsUTF8Names ,tvb, offset, 2,FALSE);
873 /* --------------------------
874 cf AFP3.0.pdf page 38
875 date are number of seconds from 12:00am on 01.01.2000 GMT
876 backup : 0x8000000 not set
877 from netatalk adouble.h
879 #define DATE_NOT_SET 0x80000000
880 #define AD_DATE_DELTA 946684800
881 #define AD_DATE_TO_UNIX(x) (x + AD_DATE_DELTA)
883 print_date(proto_tree *tree,int id, tvbuff_t *tvb, gint offset)
885 time_t date = tvb_get_ntohl(tvb, offset);
888 tv.secs = AD_DATE_TO_UNIX(date);
890 proto_tree_add_time(tree, id, tvb, offset, 4, &tv);
895 /* -------------------------- */
897 parse_vol_bitmap (proto_tree *tree, tvbuff_t *tvb, gint offset, guint16 bitmap)
901 if ((bitmap & kFPVolAttributeBit)) {
902 decode_vol_attribute(tree,tvb,offset);
905 if ((bitmap & kFPVolSignatureBit)) {
906 proto_tree_add_item(tree, hf_afp_vol_signature,tvb, offset, 2, FALSE);
909 if ((bitmap & kFPVolCreateDateBit)) {
910 print_date(tree, hf_afp_vol_creation_date,tvb, offset);
913 if ((bitmap & kFPVolModDateBit)) {
914 print_date(tree, hf_afp_vol_modification_date,tvb, offset);
917 if ((bitmap & kFPVolBackupDateBit)) {
918 print_date(tree, hf_afp_vol_backup_date,tvb, offset);
921 if ((bitmap & kFPVolIDBit)) {
922 proto_tree_add_item(tree, hf_afp_vol_id, tvb, offset, 2,FALSE);
925 if ((bitmap & kFPVolBytesFreeBit)) {
926 proto_tree_add_item(tree, hf_afp_vol_bytes_free,tvb, offset, 4, FALSE);
929 if ((bitmap & kFPVolBytesTotalBit)) {
930 proto_tree_add_item(tree, hf_afp_vol_bytes_total,tvb, offset, 4, FALSE);
933 if ((bitmap & kFPVolNameBit)) {
934 nameoff = tvb_get_ntohs(tvb, offset);
935 proto_tree_add_item(tree, hf_afp_vol_name_offset,tvb, offset, 2, FALSE);
938 if ((bitmap & kFPVolExtBytesFreeBit)) {
939 proto_tree_add_item(tree, hf_afp_vol_ex_bytes_free,tvb, offset, 8, FALSE);
942 if ((bitmap & kFPVolExtBytesTotalBit)) {
943 proto_tree_add_item(tree, hf_afp_vol_ex_bytes_total,tvb, offset, 8, FALSE);
946 if ((bitmap & kFPVolBlockSizeBit)) {
947 proto_tree_add_item(tree, hf_afp_vol_block_size,tvb, offset, 4, FALSE);
953 len = tvb_get_guint8(tvb, offset);
954 proto_tree_add_item(tree, hf_afp_vol_name, tvb, offset, 1,FALSE);
961 /* -------------------------- */
963 decode_file_bitmap (proto_tree *tree, tvbuff_t *tvb, gint offset)
965 proto_tree *sub_tree = NULL;
969 bitmap = tvb_get_ntohs(tvb, offset);
971 item = proto_tree_add_item(tree, hf_afp_file_bitmap, tvb, offset, 2,FALSE);
972 sub_tree = proto_item_add_subtree(item, ett_afp_file_bitmap);
974 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_Attributes , tvb, offset, 2,FALSE);
975 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_ParentDirID , tvb, offset, 2,FALSE);
976 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_CreateDate , tvb, offset, 2,FALSE);
977 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_ModDate , tvb, offset, 2,FALSE);
978 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_BackupDate , tvb, offset, 2,FALSE);
979 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_FinderInfo , tvb, offset, 2,FALSE);
980 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_LongName , tvb, offset, 2,FALSE);
981 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_ShortName , tvb, offset, 2,FALSE);
982 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_NodeID , tvb, offset, 2,FALSE);
984 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_DataForkLen , tvb, offset, 2,FALSE);
985 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_RsrcForkLen , tvb, offset, 2,FALSE);
986 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_ExtDataForkLen , tvb, offset, 2,FALSE);
987 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_LaunchLimit , tvb, offset, 2,FALSE);
988 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_UTF8Name , tvb, offset, 2,FALSE);
990 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_ExtRsrcForkLen , tvb, offset, 2,FALSE);
991 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_UnixPrivs , tvb, offset, 2,FALSE);
996 /* -------------------------- */
998 decode_file_attribute(proto_tree *tree, tvbuff_t *tvb, gint offset, int shared)
1000 proto_tree *sub_tree = NULL;
1004 attribute = tvb_get_ntohs(tvb, offset);
1006 item = proto_tree_add_text(tree, tvb, offset, 2,
1007 "File Attributes: 0x%04x", attribute);
1008 sub_tree = proto_item_add_subtree(item, ett_afp_file_attribute);
1010 proto_tree_add_item(sub_tree, hf_afp_file_attribute_Invisible , tvb, offset, 2,FALSE);
1012 proto_tree_add_item(sub_tree, hf_afp_file_attribute_MultiUser , tvb, offset, 2,FALSE);
1014 proto_tree_add_item(sub_tree, hf_afp_file_attribute_System , tvb, offset, 2,FALSE);
1017 proto_tree_add_item(sub_tree, hf_afp_file_attribute_DAlreadyOpen , tvb, offset, 2,FALSE);
1018 proto_tree_add_item(sub_tree, hf_afp_file_attribute_RAlreadyOpen , tvb, offset, 2,FALSE);
1020 /* writeinhibit is file only but Macs are setting it with FPSetFileDirParms too */
1021 proto_tree_add_item(sub_tree, hf_afp_file_attribute_WriteInhibit , tvb, offset, 2,FALSE);
1022 proto_tree_add_item(sub_tree, hf_afp_file_attribute_BackUpNeeded , tvb, offset, 2,FALSE);
1023 proto_tree_add_item(sub_tree, hf_afp_file_attribute_RenameInhibit, tvb, offset, 2,FALSE);
1024 proto_tree_add_item(sub_tree, hf_afp_file_attribute_DeleteInhibit, tvb, offset, 2,FALSE);
1027 proto_tree_add_item(sub_tree, hf_afp_file_attribute_CopyProtect , tvb, offset, 2,FALSE);
1029 proto_tree_add_item(sub_tree, hf_afp_file_attribute_SetClear , tvb, offset, 2,FALSE);
1035 decode_access_rights (proto_tree *tree, tvbuff_t *tvb, int hf, gint offset)
1037 proto_tree *sub_tree;
1041 item = proto_tree_add_item(tree, hf, tvb, offset, 4, FALSE);
1042 sub_tree = proto_item_add_subtree(item, ett_afp_dir_ar);
1044 proto_tree_add_item(sub_tree, hf_afp_dir_ar_o_search, tvb, offset, 4, FALSE);
1045 proto_tree_add_item(sub_tree, hf_afp_dir_ar_o_read , tvb, offset, 4, FALSE);
1046 proto_tree_add_item(sub_tree, hf_afp_dir_ar_o_write , tvb, offset, 4, FALSE);
1048 proto_tree_add_item(sub_tree, hf_afp_dir_ar_g_search, tvb, offset, 4, FALSE);
1049 proto_tree_add_item(sub_tree, hf_afp_dir_ar_g_read , tvb, offset, 4, FALSE);
1050 proto_tree_add_item(sub_tree, hf_afp_dir_ar_g_write , tvb, offset, 4, FALSE);
1052 proto_tree_add_item(sub_tree, hf_afp_dir_ar_e_search, tvb, offset, 4, FALSE);
1053 proto_tree_add_item(sub_tree, hf_afp_dir_ar_e_read , tvb, offset, 4, FALSE);
1054 proto_tree_add_item(sub_tree, hf_afp_dir_ar_e_write , tvb, offset, 4, FALSE);
1056 proto_tree_add_item(sub_tree, hf_afp_dir_ar_u_search, tvb, offset, 4, FALSE);
1057 proto_tree_add_item(sub_tree, hf_afp_dir_ar_u_read , tvb, offset, 4, FALSE);
1058 proto_tree_add_item(sub_tree, hf_afp_dir_ar_u_write , tvb, offset, 4, FALSE);
1060 proto_tree_add_item(sub_tree, hf_afp_dir_ar_blank , tvb, offset, 4, FALSE);
1061 proto_tree_add_item(sub_tree, hf_afp_dir_ar_u_own , tvb, offset, 4, FALSE);
1066 decode_unix_privs (proto_tree *tree, tvbuff_t *tvb, gint offset)
1068 proto_tree *sub_tree;
1072 item = proto_tree_add_text(tree, tvb, offset, 16,
1074 sub_tree = proto_item_add_subtree(item, ett_afp_unix_privs);
1076 proto_tree_add_item(sub_tree, hf_afp_unix_privs_uid, tvb, offset, 4, FALSE);
1077 proto_tree_add_item(sub_tree, hf_afp_unix_privs_gid, tvb, offset+4, 4, FALSE);
1078 proto_tree_add_item(sub_tree, hf_afp_unix_privs_permissions, tvb, offset+8, 4, FALSE);
1079 decode_access_rights(sub_tree, tvb, hf_afp_unix_privs_ua_permissions, offset+12);
1083 /* -------------------------- */
1085 parse_long_filename(proto_tree *tree, tvbuff_t *tvb, gint offset, gint org_offset)
1091 lnameoff = tvb_get_ntohs(tvb, offset);
1092 proto_tree_add_item(tree, hf_afp_long_name_offset,tvb, offset, 2, FALSE);
1094 tp_ofs = lnameoff +org_offset;
1095 len = tvb_get_guint8(tvb, tp_ofs);
1096 proto_tree_add_item(tree, hf_afp_path_len, tvb, tp_ofs, 1,FALSE);
1098 proto_tree_add_item(tree, hf_afp_path_name, tvb, tp_ofs, len,FALSE);
1104 /* -------------------------- */
1106 parse_UTF8_filename(proto_tree *tree, tvbuff_t *tvb, gint offset, gint org_offset)
1112 unameoff = tvb_get_ntohs(tvb, offset);
1113 proto_tree_add_item(tree, hf_afp_unicode_name_offset,tvb, offset, 2, FALSE);
1117 tp_ofs = unameoff +org_offset;
1118 proto_tree_add_item( tree, hf_afp_path_unicode_hint, tvb, tp_ofs, 4,FALSE);
1121 len = tvb_get_ntohs(tvb, tp_ofs);
1122 proto_tree_add_item( tree, hf_afp_path_unicode_len, tvb, tp_ofs, 2,FALSE);
1125 proto_tree_add_item(tree, hf_afp_path_name, tvb, tp_ofs, len,FALSE);
1131 /* -------------------------- */
1133 parse_file_bitmap (proto_tree *tree, tvbuff_t *tvb, gint offset, guint16 bitmap, int shared)
1135 guint16 snameoff = 0;
1136 gint max_offset = 0;
1138 gint org_offset = offset;
1140 if ((bitmap & kFPAttributeBit)) {
1141 decode_file_attribute(tree, tvb, offset, shared);
1144 if ((bitmap & kFPParentDirIDBit)) {
1145 proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4,FALSE);
1148 if ((bitmap & kFPCreateDateBit)) {
1149 print_date(tree, hf_afp_creation_date,tvb, offset);
1152 if ((bitmap & kFPModDateBit)) {
1153 print_date(tree, hf_afp_modification_date,tvb, offset);
1156 if ((bitmap & kFPBackupDateBit)) {
1157 print_date(tree, hf_afp_backup_date,tvb, offset);
1160 if ((bitmap & kFPFinderInfoBit)) {
1161 proto_tree_add_item(tree, hf_afp_finder_info,tvb, offset, 32, FALSE);
1164 if ((bitmap & kFPLongNameBit)) {
1167 tp_ofs = parse_long_filename(tree, tvb, offset, org_offset);
1168 max_offset = (tp_ofs >max_offset)?tp_ofs:max_offset;
1173 if ((bitmap & kFPShortNameBit)) {
1174 snameoff = tvb_get_ntohs(tvb, offset);
1175 proto_tree_add_item(tree, hf_afp_short_name_offset,tvb, offset, 2, FALSE);
1178 if ((bitmap & kFPNodeIDBit)) {
1179 proto_tree_add_item(tree, hf_afp_file_id, tvb, offset, 4,FALSE);
1183 if ((bitmap & kFPDataForkLenBit)) {
1184 proto_tree_add_item(tree, hf_afp_file_DataForkLen, tvb, offset, 4,FALSE);
1188 if ((bitmap & kFPRsrcForkLenBit)) {
1189 proto_tree_add_item(tree, hf_afp_file_RsrcForkLen, tvb, offset, 4,FALSE);
1193 if ((bitmap & kFPExtDataForkLenBit)) {
1194 proto_tree_add_item(tree, hf_afp_file_ExtDataForkLen, tvb, offset, 8,FALSE);
1198 if ((bitmap & kFPLaunchLimitBit)) {
1199 offset += 2; /* ? */
1202 if ((bitmap & kFPUTF8NameBit)) {
1205 tp_ofs = parse_UTF8_filename(tree, tvb, offset, org_offset);
1206 max_offset = (tp_ofs >max_offset)?tp_ofs:max_offset;
1210 if ((bitmap & kFPExtRsrcForkLenBit)) {
1211 proto_tree_add_item(tree, hf_afp_file_ExtRsrcForkLen, tvb, offset, 8,FALSE);
1215 if ((bitmap & kFPUnixPrivsBit_file)) {
1217 * XXX - the AFP 3.0 spec says this is "Four bytes", but
1218 * also says the privileges are "stored in an FPUnixPrivs
1219 * structure", which is 16 bytes long.
1221 * We assume, for now, that the latter is true.
1223 decode_unix_privs(tree, tvb, offset);
1227 return (max_offset)?max_offset:offset;
1230 /* -------------------------- */
1232 decode_dir_bitmap (proto_tree *tree, tvbuff_t *tvb, gint offset)
1234 proto_tree *sub_tree = NULL;
1238 bitmap = tvb_get_ntohs(tvb, offset);
1240 item = proto_tree_add_item(tree, hf_afp_dir_bitmap, tvb, offset, 2,FALSE);
1241 sub_tree = proto_item_add_subtree(item, ett_afp_dir_bitmap);
1244 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_Attributes , tvb, offset, 2,FALSE);
1245 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_ParentDirID , tvb, offset, 2,FALSE);
1246 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_CreateDate , tvb, offset, 2,FALSE);
1247 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_ModDate , tvb, offset, 2,FALSE);
1248 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_BackupDate , tvb, offset, 2,FALSE);
1249 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_FinderInfo , tvb, offset, 2,FALSE);
1250 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_LongName , tvb, offset, 2,FALSE);
1251 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_ShortName , tvb, offset, 2,FALSE);
1252 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_NodeID , tvb, offset, 2,FALSE);
1253 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_OffspringCount , tvb, offset, 2,FALSE);
1254 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_OwnerID , tvb, offset, 2,FALSE);
1255 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_GroupID , tvb, offset, 2,FALSE);
1256 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_AccessRights , tvb, offset, 2,FALSE);
1257 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_UTF8Name , tvb, offset, 2,FALSE);
1258 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_UnixPrivs , tvb, offset, 2,FALSE);
1263 /* -------------------------- */
1265 decode_dir_attribute(proto_tree *tree, tvbuff_t *tvb, gint offset)
1267 proto_tree *sub_tree = NULL;
1271 attribute = tvb_get_ntohs(tvb, offset);
1273 item = proto_tree_add_text(tree, tvb, offset, 2,
1274 "Directory Attributes: 0x%04x", attribute);
1275 sub_tree = proto_item_add_subtree(item, ett_afp_dir_attribute);
1277 proto_tree_add_item(sub_tree, hf_afp_dir_attribute_Invisible , tvb, offset, 2,FALSE);
1278 proto_tree_add_item(sub_tree, hf_afp_dir_attribute_IsExpFolder , tvb, offset, 2,FALSE);
1279 proto_tree_add_item(sub_tree, hf_afp_dir_attribute_System , tvb, offset, 2,FALSE);
1280 proto_tree_add_item(sub_tree, hf_afp_dir_attribute_Mounted , tvb, offset, 2,FALSE);
1281 proto_tree_add_item(sub_tree, hf_afp_dir_attribute_InExpFolder , tvb, offset, 2,FALSE);
1282 proto_tree_add_item(sub_tree, hf_afp_dir_attribute_BackUpNeeded , tvb, offset, 2,FALSE);
1283 proto_tree_add_item(sub_tree, hf_afp_dir_attribute_RenameInhibit, tvb, offset, 2,FALSE);
1284 proto_tree_add_item(sub_tree, hf_afp_dir_attribute_DeleteInhibit, tvb, offset, 2,FALSE);
1289 /* -------------------------- */
1291 parse_dir_bitmap (proto_tree *tree, tvbuff_t *tvb, gint offset, guint16 bitmap)
1293 guint16 snameoff = 0;
1294 gint max_offset = 0;
1296 gint org_offset = offset;
1298 if ((bitmap & kFPAttributeBit)) {
1299 decode_dir_attribute(tree, tvb, offset);
1302 if ((bitmap & kFPParentDirIDBit)) {
1303 proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4,FALSE);
1306 if ((bitmap & kFPCreateDateBit)) {
1307 print_date(tree, hf_afp_creation_date,tvb, offset);
1310 if ((bitmap & kFPModDateBit)) {
1311 print_date(tree, hf_afp_modification_date,tvb, offset);
1314 if ((bitmap & kFPBackupDateBit)) {
1315 print_date(tree, hf_afp_backup_date,tvb, offset);
1318 if ((bitmap & kFPFinderInfoBit)) {
1319 proto_tree_add_item(tree, hf_afp_finder_info,tvb, offset, 32, FALSE);
1322 if ((bitmap & kFPLongNameBit)) {
1325 tp_ofs = parse_long_filename(tree, tvb, offset, org_offset);
1326 max_offset = (tp_ofs >max_offset)?tp_ofs:max_offset;
1330 if ((bitmap & kFPShortNameBit)) {
1331 snameoff = tvb_get_ntohs(tvb, offset);
1332 proto_tree_add_item(tree, hf_afp_short_name_offset,tvb, offset, 2, FALSE);
1335 if ((bitmap & kFPNodeIDBit)) {
1336 proto_tree_add_item(tree, hf_afp_file_id, tvb, offset, 4,FALSE);
1339 if ((bitmap & kFPOffspringCountBit)) {
1340 proto_tree_add_item(tree, hf_afp_dir_offspring, tvb, offset, 2,FALSE);
1341 offset += 2; /* error in AFP3.0.pdf */
1343 if ((bitmap & kFPOwnerIDBit)) {
1344 proto_tree_add_item(tree, hf_afp_dir_OwnerID, tvb, offset, 4, FALSE);
1347 if ((bitmap & kFPGroupIDBit)) {
1348 proto_tree_add_item(tree, hf_afp_dir_GroupID, tvb, offset, 4, FALSE);
1351 if ((bitmap & kFPAccessRightsBit)) {
1352 decode_access_rights(tree, tvb, hf_afp_dir_ar, offset);
1355 if ((bitmap & kFPUTF8NameBit)) {
1358 tp_ofs = parse_UTF8_filename(tree, tvb, offset, org_offset);
1359 max_offset = (tp_ofs >max_offset)?tp_ofs:max_offset;
1362 if ((bitmap & kFPUnixPrivsBit)) {
1364 * XXX - the AFP 3.0 spec says this is "Four bytes", but
1365 * also says the privileges are "stored in an FPUnixPrivs
1366 * structure", which is 16 bytes long.
1368 * We assume, for now, that the latter is true.
1370 decode_unix_privs(tree, tvb, offset);
1373 return (max_offset)?max_offset:offset;
1376 /* -------------------------- */
1378 name_in_bitmap(tvbuff_t *tvb, gint offset, guint16 bitmap, int isdir)
1381 gint org_offset = offset;
1388 if ((bitmap & kFPAttributeBit)) /* 0 */
1390 if ((bitmap & kFPParentDirIDBit)) /* 1 */
1392 if ((bitmap & kFPCreateDateBit)) /* 2 */
1394 if ((bitmap & kFPModDateBit)) /* 3 */
1396 if ((bitmap & kFPBackupDateBit)) /* 4 */
1398 if ((bitmap & kFPFinderInfoBit)) /* 5 */
1401 if ((bitmap & kFPLongNameBit)) { /* 6 */
1402 nameoff = tvb_get_ntohs(tvb, offset);
1404 tp_ofs = nameoff +org_offset;
1405 len = tvb_get_guint8(tvb, tp_ofs);
1407 if (!(name = g_malloc(len +1)))
1409 tvb_memcpy(tvb, name, tp_ofs, len);
1416 if ((bitmap & kFPShortNameBit)) /* 7 */
1418 if ((bitmap & kFPNodeIDBit)) /* 8 */
1422 if ((bitmap & kFPOffspringCountBit)) /* 9 */
1424 if ((bitmap & kFPOwnerIDBit)) /* 10*/
1426 if ((bitmap & kFPGroupIDBit)) /* 11*/
1428 if ((bitmap & kFPAccessRightsBit)) /* 12*/
1432 if ((bitmap & kFPDataForkLenBit)) /* 9 */
1434 if ((bitmap & kFPRsrcForkLenBit)) /* 10*/
1436 if ((bitmap & kFPExtDataForkLenBit)) /* 11*/
1438 if ((bitmap & kFPLaunchLimitBit)) /* 12*/
1439 offset += 2; /* FIXME ? */
1442 if ((bitmap & kFPUTF8NameBit)) { /* 13 */
1443 nameoff = tvb_get_ntohs(tvb, offset);
1445 tp_ofs = nameoff +org_offset +4;
1446 len16 = tvb_get_ntohs(tvb, tp_ofs);
1448 if (!(name = g_malloc(len16 +1)))
1450 tvb_memcpy(tvb, name, tp_ofs, len16);
1458 /* -------------------------- */
1460 name_in_dbitmap(tvbuff_t *tvb, gint offset, guint16 bitmap)
1464 name = name_in_bitmap(tvb, offset, bitmap, 1);
1474 /* -------------------------- */
1476 name_in_fbitmap(tvbuff_t *tvb, gint offset, guint16 bitmap)
1480 name = name_in_bitmap(tvb, offset, bitmap, 0);
1490 /* -------------------------- */
1492 decode_vol_did(proto_tree *tree, tvbuff_t *tvb, gint offset)
1494 Vol = tvb_get_ntohs(tvb, offset);
1495 proto_tree_add_item(tree, hf_afp_vol_id, tvb, offset, 2,FALSE);
1498 Did = tvb_get_ntohl(tvb, offset);
1499 proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4,FALSE);
1504 /* -------------------------- */
1506 decode_vol_did_file_dir_bitmap (proto_tree *tree, tvbuff_t *tvb, gint offset)
1508 offset = decode_vol_did(tree, tvb, offset);
1510 decode_file_bitmap(tree, tvb, offset);
1513 decode_dir_bitmap(tree, tvb, offset);
1519 /* ------------------------ */
1521 get_name(tvbuff_t *tvb, int offset, int type)
1529 len = tvb_get_guint8(tvb, offset);
1531 string = tvb_format_text(tvb,offset, len);
1534 len = tvb_get_ntohs(tvb, offset +4);
1536 string = tvb_format_text(tvb,offset, len);
1539 string = "unknow type";
1544 /* -------------------------- */
1546 decode_name_label (proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, gint offset, const gchar *label)
1552 proto_tree *sub_tree = NULL;
1555 type = tvb_get_guint8(tvb, offset);
1558 len = tvb_get_ntohs(tvb, offset +5);
1562 len = tvb_get_guint8(tvb, offset +1);
1564 name = get_name(tvb, offset +1, type);
1566 if (pinfo && check_col(pinfo->cinfo, COL_INFO)) {
1567 col_append_fstr(pinfo->cinfo, COL_INFO, ": Vol=%u Did=%u", Vol, Did);
1569 col_append_fstr(pinfo->cinfo, COL_INFO, " Name=%s", name);
1574 item = proto_tree_add_text(tree, tvb, offset, len +header, label, name);
1575 sub_tree = proto_item_add_subtree(item, ett_afp_path_name);
1577 proto_tree_add_item( sub_tree, hf_afp_path_type, tvb, offset, 1,FALSE);
1580 proto_tree_add_item( sub_tree, hf_afp_path_unicode_hint, tvb, offset, 4,FALSE);
1582 proto_tree_add_item( sub_tree, hf_afp_path_unicode_len, tvb, offset, 2,FALSE);
1586 proto_tree_add_item( sub_tree, hf_afp_path_len, tvb, offset, 1,FALSE);
1590 proto_tree_add_string(sub_tree, hf_afp_path_name, tvb, offset, len,name);
1598 /* -------------------------- */
1600 decode_name (proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, gint offset)
1602 return decode_name_label(tree, pinfo, tvb, offset, "Path: %s");
1605 /* -------------------------- */
1607 add_info_fork(tvbuff_t *tvb, packet_info *pinfo, gint offset)
1611 ofork = tvb_get_ntohs(tvb, offset);
1612 if (ofork && check_col(pinfo->cinfo, COL_INFO)) {
1613 col_append_fstr(pinfo->cinfo, COL_INFO, ": Fork=%u", ofork);
1617 /* -------------------------- */
1619 add_info_vol(tvbuff_t *tvb, packet_info *pinfo, gint offset)
1623 vol = tvb_get_ntohs(tvb, offset);
1624 if (check_col(pinfo->cinfo, COL_INFO)) {
1625 col_append_fstr(pinfo->cinfo, COL_INFO, ": Vol=%u", vol);
1629 /* ************************** */
1631 dissect_query_afp_open_vol(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
1637 decode_vol_bitmap(tree, tvb, offset);
1640 len = tvb_get_guint8(tvb, offset);
1642 if (check_col(pinfo->cinfo, COL_INFO)) {
1644 rep = get_name(tvb, offset, 2);
1645 col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", rep);
1651 proto_tree_add_item(tree, hf_afp_vol_name, tvb, offset, 1,FALSE);
1654 len = tvb_reported_length_remaining(tvb,offset);
1656 /* optionnal password */
1657 proto_tree_add_item(tree, hf_afp_passwd, tvb, offset, 8,FALSE);
1663 /* -------------------------- */
1665 dissect_reply_afp_open_vol(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
1671 bitmap = decode_vol_bitmap(tree, tvb, offset);
1673 offset = parse_vol_bitmap(tree, tvb, offset, bitmap);
1678 /* ************************** */
1680 dissect_reply_afp_get_server_param(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
1686 proto_tree *sub_tree = NULL;
1687 proto_tree *flag_tree;
1694 print_date(tree, hf_afp_server_time,tvb, offset);
1697 num = tvb_get_guint8(tvb, offset);
1698 item = proto_tree_add_text(tree, tvb, offset, 1, "Volumes : %d", num);
1699 sub_tree = proto_item_add_subtree(item, ett_afp_server_vol);
1702 for (i = 0; i < num; i++) {
1705 item = proto_tree_add_text(sub_tree, tvb, offset, -1,"Volume");
1706 tree = proto_item_add_subtree(item, ett_afp_vol_list);
1708 flag = tvb_get_guint8(tvb, offset);
1710 ti = proto_tree_add_text(tree, tvb, offset , 1,"Flags : 0x%02x", flag);
1711 flag_tree = proto_item_add_subtree(ti, ett_afp_vol_flag);
1712 proto_tree_add_item(flag_tree, hf_afp_vol_flag_passwd, tvb, offset, 1,FALSE);
1713 proto_tree_add_item(flag_tree, hf_afp_vol_flag_unix_priv ,tvb, offset, 1,FALSE);
1716 len = tvb_get_guint8(tvb, offset) +1;
1717 rep = get_name(tvb, offset, 2);
1718 proto_item_set_text(item, rep);
1719 proto_item_set_len(item, len +1);
1721 proto_tree_add_item(tree, hf_afp_vol_name, tvb, offset, 1,FALSE);
1728 /* **************************
1729 next calls use the same format :
1737 dissect_query_afp_with_vol_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
1744 proto_tree_add_item(tree, hf_afp_vol_id, tvb, offset, 2,FALSE);
1749 /* ************************** */
1751 dissect_query_afp_open_fork(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
1753 proto_tree *sub_tree = NULL;
1756 proto_tree_add_item(tree, hf_afp_fork_type, tvb, offset, 1,FALSE);
1759 offset = decode_vol_did(tree, tvb, offset);
1761 decode_file_bitmap(tree, tvb, offset);
1764 item = proto_tree_add_item(tree, hf_afp_access_mode, tvb, offset, 2,FALSE);
1765 sub_tree = proto_item_add_subtree(item, ett_afp_access_mode);
1767 proto_tree_add_item(sub_tree, hf_afp_access_read , tvb, offset, 2,FALSE);
1768 proto_tree_add_item(sub_tree, hf_afp_access_write , tvb, offset, 2,FALSE);
1769 proto_tree_add_item(sub_tree, hf_afp_access_deny_read , tvb, offset, 2,FALSE);
1770 proto_tree_add_item(sub_tree, hf_afp_access_deny_write, tvb, offset, 2,FALSE);
1774 offset = decode_name(tree, pinfo, tvb, offset);
1779 /* -------------------------- */
1781 dissect_reply_afp_open_fork(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
1785 f_bitmap = decode_file_bitmap(tree, tvb, offset);
1788 add_info_fork(tvb, pinfo, offset);
1789 proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2,FALSE);
1792 offset = parse_file_bitmap(tree, tvb, offset, f_bitmap,0);
1797 /* ************************** */
1799 dissect_query_afp_enumerate_ext2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
1803 offset = decode_vol_did_file_dir_bitmap(tree, tvb, offset);
1805 proto_tree_add_item(tree, hf_afp_req_count, tvb, offset, 2,FALSE);
1808 proto_tree_add_item(tree, hf_afp_start_index32, tvb, offset, 4,FALSE);
1811 proto_tree_add_item(tree, hf_afp_max_reply_size32, tvb, offset, 4,FALSE);
1814 offset = decode_name(tree, pinfo, tvb, offset);
1819 /* ************************** */
1821 dissect_query_afp_enumerate(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
1825 offset = decode_vol_did_file_dir_bitmap(tree, tvb, offset);
1827 proto_tree_add_item(tree, hf_afp_req_count, tvb, offset, 2,FALSE);
1830 proto_tree_add_item(tree, hf_afp_start_index, tvb, offset, 2,FALSE);
1833 proto_tree_add_item(tree, hf_afp_max_reply_size, tvb, offset, 2,FALSE);
1836 offset = decode_name(tree, pinfo, tvb, offset);
1841 /* -------------------------- */
1843 loop_record(tvbuff_t *tvb, proto_tree *ptree, gint offset,
1844 int count, guint16 d_bitmap, guint16 f_bitmap, int add, int ext)
1846 proto_tree *tree = NULL;
1855 for (i = 0; i < count; i++) {
1858 size = tvb_get_ntohs(tvb, offset);
1862 size = tvb_get_guint8(tvb, offset) +add;
1866 return offset; /* packet is malformed */
1867 flags = tvb_get_guint8(tvb, offset +decal);
1873 name = name_in_dbitmap(tvb, offset +decal, d_bitmap);
1876 name = name_in_fbitmap(tvb, offset +decal, f_bitmap);
1879 if (!(name = g_malloc(50))) { /* no memory ! */
1881 snprintf(name, 50,"line %d", i +1);
1883 item = proto_tree_add_text(ptree, tvb, offset, size, name);
1884 tree = proto_item_add_subtree(item, ett_afp_enumerate_line);
1885 g_free((gpointer)name);
1888 proto_tree_add_item(tree, hf_afp_struct_size16, tvb, offset, 2,FALSE);
1892 proto_tree_add_item(tree, hf_afp_struct_size, tvb, offset, 1,FALSE);
1896 proto_tree_add_item(tree, hf_afp_file_flag, tvb, offset, 1,FALSE);
1902 offset = parse_dir_bitmap(tree, tvb, offset, d_bitmap);
1905 offset = parse_file_bitmap(tree, tvb, offset, f_bitmap,0);
1909 offset = org +size; /* play safe */
1913 /* ------------------------- */
1915 reply_enumerate(tvbuff_t *tvb, proto_tree *tree, gint offset, int ext)
1917 proto_tree *sub_tree = NULL;
1923 f_bitmap = decode_file_bitmap(tree, tvb, offset);
1926 d_bitmap = decode_dir_bitmap(tree, tvb, offset);
1929 count = tvb_get_ntohs(tvb, offset);
1931 item = proto_tree_add_item(tree, hf_afp_req_count, tvb, offset, 2,FALSE);
1932 sub_tree = proto_item_add_subtree(item, ett_afp_enumerate);
1936 return loop_record(tvb,sub_tree, offset, count, d_bitmap, f_bitmap,0, ext);
1939 /* ------------------------- */
1941 dissect_reply_afp_enumerate(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
1943 return reply_enumerate(tvb, tree, offset, 0);
1946 /* **************************/
1948 dissect_reply_afp_enumerate_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
1950 return reply_enumerate(tvb, tree, offset, 1);
1952 /* **************************/
1954 dissect_query_afp_cat_search(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *ptree, gint offset)
1956 proto_tree *tree = NULL;
1968 proto_tree_add_item(ptree, hf_afp_vol_id, tvb, offset, 2,FALSE);
1971 proto_tree_add_item(ptree, hf_afp_cat_req_matches, tvb, offset, 4,FALSE);
1974 proto_tree_add_item(ptree, hf_afp_reserved, tvb, offset, 4,FALSE);
1977 proto_tree_add_item(ptree, hf_afp_cat_position, tvb, offset, 16,FALSE);
1980 f_bitmap = decode_file_bitmap(ptree, tvb, offset);
1983 d_bitmap = decode_dir_bitmap(ptree, tvb, offset);
1986 /* FIXME req bitmap */
1987 item = proto_tree_add_text(ptree, tvb, offset, 4, "Request bitmap");
1988 tree = proto_item_add_subtree(item, ett_afp_cat_r_bitmap);
1989 r_bitmap = decode_file_bitmap(tree, tvb, offset+2);
1994 size = tvb_get_guint8(tvb, offset) +2;
1996 item = proto_tree_add_text(ptree, tvb, offset, size, "Spec 1");
1997 tree = proto_item_add_subtree(item, ett_afp_cat_spec);
1999 proto_tree_add_item(tree, hf_afp_struct_size, tvb, offset, 1,FALSE);
2003 offset = parse_file_bitmap(tree, tvb, offset, r_bitmap,0);
2008 size = tvb_get_guint8(tvb, offset) +2;
2010 item = proto_tree_add_text(ptree, tvb, offset, size, "Spec 2");
2011 tree = proto_item_add_subtree(item, ett_afp_cat_spec);
2013 proto_tree_add_item(tree, hf_afp_struct_size, tvb, offset, 1,FALSE);
2017 offset = parse_file_bitmap(tree, tvb, offset, r_bitmap,0);
2023 /* -------------------------- */
2025 dissect_reply_afp_cat_search(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2027 proto_tree *sub_tree = NULL;
2033 proto_tree_add_item(tree, hf_afp_cat_position, tvb, offset, 16,FALSE);
2036 f_bitmap = decode_file_bitmap(tree, tvb, offset);
2039 d_bitmap = decode_dir_bitmap(tree, tvb, offset);
2042 count = tvb_get_ntohl(tvb, offset);
2044 item = proto_tree_add_item(tree, hf_afp_cat_count, tvb, offset, 4,FALSE);
2045 sub_tree = proto_item_add_subtree(item, ett_afp_cat_search);
2049 return loop_record(tvb,sub_tree, offset, count, d_bitmap, f_bitmap, 2, 0);
2052 /* **************************/
2054 dissect_query_afp_get_vol_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2058 add_info_vol(tvb, pinfo, offset);
2060 proto_tree_add_item(tree, hf_afp_vol_id, tvb, offset, 2,FALSE);
2063 decode_vol_bitmap(tree, tvb, offset);
2069 /* ------------------------ */
2071 dissect_reply_afp_get_vol_param(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2075 bitmap = decode_vol_bitmap(tree, tvb, offset);
2078 offset = parse_vol_bitmap(tree, tvb, offset, bitmap);
2083 /* **************************/
2085 dissect_query_afp_set_vol_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2091 add_info_vol(tvb, pinfo, offset);
2092 proto_tree_add_item(tree, hf_afp_vol_id, tvb, offset, 2,FALSE);
2095 bitmap = decode_vol_bitmap(tree, tvb, offset);
2098 offset = parse_vol_bitmap(tree, tvb, offset, bitmap);
2103 /* ***************************/
2105 decode_uam_parameters(const char *uam, int len_uam, tvbuff_t *tvb, proto_tree *tree, gint offset)
2109 if (!strncasecmp(uam, "Cleartxt passwrd", len_uam)) {
2113 len = 8; /* tvb_strsize(tvb, offset);*/
2114 proto_tree_add_item(tree, hf_afp_passwd, tvb, offset, len,FALSE);
2117 else if (!strncasecmp(uam, "DHCAST128", len_uam)) {
2122 proto_tree_add_item(tree, hf_afp_random, tvb, offset, len,FALSE);
2125 else if (!strncasecmp(uam, "2-Way Randnum exchange", len_uam)) {
2132 /* ---------------- */
2134 dissect_query_afp_login(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2140 len = tvb_get_guint8(tvb, offset);
2141 proto_tree_add_item(tree, hf_afp_AFPVersion, tvb, offset, 1,FALSE);
2143 len_uam = tvb_get_guint8(tvb, offset);
2144 uam = tvb_get_ptr(tvb, offset +1, len_uam);
2145 proto_tree_add_item(tree, hf_afp_UAM, tvb, offset, 1,FALSE);
2146 offset += len_uam +1;
2148 if (!strncasecmp(uam, "No User Authent", len_uam)) {
2152 len = tvb_get_guint8(tvb, offset);
2153 proto_tree_add_item(tree, hf_afp_user, tvb, offset, 1,FALSE);
2156 return decode_uam_parameters(uam, len_uam, tvb, tree, offset);
2159 /* ***************************/
2161 dissect_query_afp_login_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2168 type = tvb_get_guint8(tvb, offset);
2171 proto_tree_add_item(tree, hf_afp_login_flags, tvb, offset, 2,FALSE);
2174 len = tvb_get_guint8(tvb, offset);
2175 proto_tree_add_item(tree, hf_afp_AFPVersion, tvb, offset, 1,FALSE);
2178 len_uam = tvb_get_guint8(tvb, offset);
2179 uam = tvb_get_ptr(tvb, offset +1, len_uam);
2180 proto_tree_add_item(tree, hf_afp_UAM, tvb, offset, 1,FALSE);
2181 offset += len_uam +1;
2183 type = tvb_get_guint8(tvb, offset);
2184 proto_tree_add_item(tree, hf_afp_user_type, tvb, offset, 1,FALSE);
2187 len = tvb_get_ntohs(tvb, offset);
2188 proto_tree_add_item(tree, hf_afp_user_len, tvb, offset, 2,FALSE);
2190 proto_tree_add_item(tree, hf_afp_user_name, tvb, offset, len,FALSE);
2193 /* directory service */
2194 type = tvb_get_guint8(tvb, offset);
2195 proto_tree_add_item(tree, hf_afp_path_type, tvb, offset, 1,FALSE);
2197 /* FIXME use 16 bit len + unicode from smb dissector */
2201 len = tvb_get_guint8(tvb, offset);
2202 proto_tree_add_item(tree, hf_afp_path_len, tvb, offset, 1,FALSE);
2204 proto_tree_add_item(tree, hf_afp_path_name, tvb, offset, len,FALSE);
2208 len = tvb_get_ntohs(tvb, offset);
2209 proto_tree_add_item( tree, hf_afp_path_unicode_len, tvb, offset, 2,FALSE);
2211 proto_tree_add_item(tree, hf_afp_path_name, tvb, offset, len,FALSE);
2218 return decode_uam_parameters(uam, len_uam, tvb, tree, offset);
2221 /* ************************** */
2223 dissect_query_afp_write(tvbuff_t *tvb, packet_info *pinfo , proto_tree *tree, gint offset)
2225 proto_tree_add_item(tree, hf_afp_flag, tvb, offset, 1,FALSE);
2228 add_info_fork(tvb, pinfo, offset);
2229 proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2,FALSE);
2232 proto_tree_add_item(tree, hf_afp_offset, tvb, offset, 4,FALSE);
2235 proto_tree_add_item(tree, hf_afp_rw_count, tvb, offset, 4,FALSE);
2242 dissect_reply_afp_write(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2244 proto_tree_add_item(tree, hf_afp_last_written, tvb, offset, 4, FALSE);
2250 /* ************************** */
2252 dissect_query_afp_write_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2254 proto_tree_add_item(tree, hf_afp_flag, tvb, offset, 1,FALSE);
2257 add_info_fork(tvb, pinfo, offset);
2258 proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2,FALSE);
2261 proto_tree_add_item(tree, hf_afp_offset64, tvb, offset, 8,FALSE);
2264 proto_tree_add_item(tree, hf_afp_rw_count64, tvb, offset, 8,FALSE);
2271 dissect_reply_afp_write_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2273 proto_tree_add_item(tree, hf_afp_last_written64, tvb, offset, 8, FALSE);
2279 /* ************************** */
2281 dissect_query_afp_read(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2285 add_info_fork(tvb, pinfo, offset);
2286 proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2,FALSE);
2289 proto_tree_add_item(tree, hf_afp_offset, tvb, offset, 4,FALSE);
2292 proto_tree_add_item(tree, hf_afp_rw_count, tvb, offset, 4,FALSE);
2295 proto_tree_add_item(tree, hf_afp_newline_mask, tvb, offset, 1,FALSE);
2298 proto_tree_add_item(tree, hf_afp_newline_char, tvb, offset, 1,FALSE);
2304 /* ************************** */
2306 dissect_query_afp_read_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2310 add_info_fork(tvb, pinfo, offset);
2311 proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2,FALSE);
2314 proto_tree_add_item(tree, hf_afp_offset64, tvb, offset, 8,FALSE);
2317 proto_tree_add_item(tree, hf_afp_rw_count64, tvb, offset, 8,FALSE);
2323 /* **************************
2325 query is the same than AFP_FLUSH, AFP_CLOSEVOL
2329 dissect_reply_afp_open_dt(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2331 proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2,FALSE);
2337 /* **************************
2341 dissect_query_afp_close_dt(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2344 proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2,FALSE);
2350 /* **************************
2351 calls using the same format :
2358 dissect_query_afp_with_fork(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2361 add_info_fork(tvb, pinfo, offset);
2362 proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2,FALSE);
2368 /* ************************** */
2370 dissect_query_afp_get_fldr_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2373 offset = decode_vol_did_file_dir_bitmap(tree, tvb, offset);
2375 offset = decode_name(tree, pinfo, tvb, offset);
2380 /* -------------------------- */
2382 dissect_reply_afp_get_fldr_param(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2385 guint16 f_bitmap, d_bitmap;
2387 f_bitmap = decode_file_bitmap(tree, tvb, offset);
2390 d_bitmap = decode_dir_bitmap(tree, tvb, offset);
2393 flags = tvb_get_guint8(tvb, offset);
2394 proto_tree_add_item(tree, hf_afp_file_flag, tvb, offset, 1,FALSE);
2398 offset = parse_dir_bitmap(tree, tvb, offset, d_bitmap);
2401 offset = parse_file_bitmap(tree, tvb, offset, f_bitmap,0);
2406 /* **************************
2410 dissect_query_afp_set_fldr_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2415 offset = decode_vol_did(tree, tvb, offset);
2417 f_bitmap = decode_file_bitmap(tree, tvb, offset);
2420 offset = decode_name(tree, pinfo, tvb, offset);
2424 /* did:name can be a file or a folder but only the intersection between
2425 * file bitmap and dir bitmap can be set.
2426 * Well it's in afp spec, but clients (Mac) are setting 'file only' bits with this call
2427 * (WriteInhibit for example).
2429 offset = parse_file_bitmap(tree, tvb, offset, f_bitmap, 1);
2434 /* **************************
2438 dissect_query_afp_set_file_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2443 offset = decode_vol_did(tree, tvb, offset);
2445 f_bitmap = decode_file_bitmap(tree, tvb, offset);
2448 offset = decode_name(tree, pinfo, tvb, offset);
2452 offset = parse_file_bitmap(tree, tvb, offset, f_bitmap, 0);
2457 /* **************************
2461 dissect_query_afp_set_dir_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2466 offset = decode_vol_did(tree, tvb, offset);
2468 d_bitmap = decode_dir_bitmap(tree, tvb, offset);
2471 offset = decode_name(tree, pinfo, tvb, offset);
2475 offset = parse_dir_bitmap(tree, tvb, offset, d_bitmap);
2481 /* **************************
2486 dissect_query_afp_create_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2489 offset = decode_vol_did(tree, tvb, offset);
2491 offset = decode_name(tree, pinfo, tvb, offset);
2495 /* --------------------------
2499 dissect_reply_afp_create_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2501 proto_tree_add_item(tree, hf_afp_file_id, tvb, offset, 4,FALSE);
2507 /* -------------------------- */
2509 dissect_reply_afp_create_dir(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2511 proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4,FALSE);
2517 /* **************************
2521 dissect_query_afp_delete_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2524 proto_tree_add_item(tree, hf_afp_vol_id, tvb, offset, 2,FALSE);
2526 proto_tree_add_item(tree, hf_afp_file_id, tvb, offset, 4,FALSE);
2532 /* **************************
2533 same reply as get_fork_param
2536 dissect_query_afp_resolve_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2539 proto_tree_add_item(tree, hf_afp_vol_id, tvb, offset, 2,FALSE);
2541 proto_tree_add_item(tree, hf_afp_file_id, tvb, offset, 4,FALSE);
2544 decode_file_bitmap(tree, tvb, offset);
2550 /* ************************** */
2552 dissect_query_afp_get_fork_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2556 add_info_fork(tvb, pinfo, offset);
2557 proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2,FALSE);
2560 decode_file_bitmap(tree, tvb, offset);
2565 /* -------------------------- */
2567 dissect_reply_afp_get_fork_param(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2571 f_bitmap = decode_file_bitmap(tree, tvb, offset);
2574 offset = parse_file_bitmap(tree, tvb, offset, f_bitmap,0);
2579 /* ************************** */
2581 dissect_query_afp_set_fork_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2586 add_info_fork(tvb, pinfo, offset);
2587 proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2,FALSE);
2590 bitmap = decode_file_bitmap(tree, tvb, offset);
2593 if ((bitmap & kFPExtDataForkLenBit) || (bitmap & kFPExtRsrcForkLenBit)) {
2594 proto_tree_add_item(tree, hf_afp_ofork_len64, tvb, offset, 8, FALSE);
2598 proto_tree_add_item(tree, hf_afp_ofork_len, tvb, offset, 4,FALSE);
2604 /* ************************** */
2606 dissect_query_afp_move(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2610 offset = decode_vol_did(tree, tvb, offset);
2612 proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4,FALSE);
2615 offset = decode_name_label(tree, pinfo, tvb, offset, "Source path: %s");
2616 offset = decode_name_label(tree, NULL, tvb, offset, "Dest dir: %s");
2617 offset = decode_name_label(tree, NULL, tvb, offset, "New name: %s");
2622 /* ************************** */
2624 dissect_query_afp_exchange_file(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2628 offset = decode_vol_did(tree, tvb, offset);
2630 proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4,FALSE);
2633 offset = decode_name_label(tree, pinfo, tvb, offset, "Source path: %s");
2634 offset = decode_name_label(tree, NULL, tvb, offset, "Dest path: %s");
2638 /* ************************** */
2640 dissect_query_afp_copy_file(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2642 proto_tree *sub_tree = NULL;
2647 item = proto_tree_add_text(tree, tvb, offset, 6,"Source volume");
2648 sub_tree = proto_item_add_subtree(item, ett_afp_vol_did);
2650 offset = decode_vol_did(sub_tree, tvb, offset);
2653 item = proto_tree_add_text(tree, tvb, offset, 6,"Dest volume");
2654 sub_tree = proto_item_add_subtree(item, ett_afp_vol_did);
2656 offset = decode_vol_did(sub_tree, tvb, offset);
2658 offset = decode_name_label(tree, pinfo, tvb, offset, "Source path: %s");
2659 offset = decode_name_label(tree, NULL, tvb, offset, "Dest dir: %s");
2660 offset = decode_name_label(tree, NULL, tvb, offset, "New name: %s");
2665 /* ************************** */
2667 dissect_query_afp_rename(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2671 offset = decode_vol_did(tree, tvb, offset);
2673 offset = decode_name_label(tree, pinfo, tvb, offset, "Old name: %s");
2674 offset = decode_name_label(tree, NULL, tvb, offset, "New name: %s");
2679 /* ************************** */
2681 dissect_query_afp_byte_lock(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2683 proto_tree *sub_tree = NULL;
2687 flag = tvb_get_guint8(tvb, offset);
2689 item = proto_tree_add_text(tree, tvb, offset, 1, "Flags: 0x%02x", flag);
2690 sub_tree = proto_item_add_subtree(item, ett_afp_lock_flags);
2693 proto_tree_add_item(sub_tree, hf_afp_lock_op, tvb, offset, 1,FALSE);
2694 proto_tree_add_item(sub_tree, hf_afp_lock_from, tvb, offset, 1,FALSE);
2697 proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2,FALSE);
2700 proto_tree_add_item(tree, hf_afp_lock_offset, tvb, offset, 4,FALSE);
2703 proto_tree_add_item(tree, hf_afp_lock_len, tvb, offset, 4,FALSE);
2708 /* -------------------------- */
2710 dissect_reply_afp_byte_lock(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2712 proto_tree_add_item(tree, hf_afp_lock_range_start, tvb, offset, 4,FALSE);
2718 /* ************************** */
2720 dissect_query_afp_byte_lock_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2722 proto_tree *sub_tree = NULL;
2726 flag = tvb_get_guint8(tvb, offset);
2728 item = proto_tree_add_text(tree, tvb, offset, 1, "Flags: 0x%02x", flag);
2729 sub_tree = proto_item_add_subtree(item, ett_afp_lock_flags);
2732 proto_tree_add_item(sub_tree, hf_afp_lock_op, tvb, offset, 1,FALSE);
2733 proto_tree_add_item(sub_tree, hf_afp_lock_from, tvb, offset, 1,FALSE);
2736 proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2,FALSE);
2739 proto_tree_add_item(tree, hf_afp_lock_offset64, tvb, offset, 8,FALSE);
2742 proto_tree_add_item(tree, hf_afp_lock_len64, tvb, offset, 8,FALSE);
2747 /* -------------------------- */
2749 dissect_reply_afp_byte_lock_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2751 proto_tree_add_item(tree, hf_afp_lock_range_start64, tvb, offset, 8,FALSE);
2757 /* ************************** */
2759 dissect_query_afp_add_cmt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2764 proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2,FALSE);
2767 proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4,FALSE);
2770 offset = decode_name(tree, pinfo, tvb, offset);
2775 len = tvb_get_guint8(tvb, offset);
2776 proto_tree_add_item(tree, hf_afp_comment, tvb, offset, 1,FALSE);
2783 /* ************************** */
2785 dissect_query_afp_get_cmt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2789 proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2,FALSE);
2792 proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4,FALSE);
2795 offset = decode_name(tree, pinfo, tvb, offset);
2799 /* -------------------------- */
2801 dissect_reply_afp_get_cmt(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2805 len = tvb_get_guint8(tvb, offset);
2806 proto_tree_add_item(tree, hf_afp_comment, tvb, offset, 1,FALSE);
2812 /* ************************** */
2814 dissect_query_afp_get_icon(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2818 proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2,FALSE);
2820 proto_tree_add_item(tree, hf_afp_file_creator, tvb, offset, 4,FALSE);
2823 proto_tree_add_item(tree, hf_afp_file_type, tvb, offset, 4,FALSE);
2826 proto_tree_add_item(tree, hf_afp_icon_type, tvb, offset, 1,FALSE);
2830 proto_tree_add_item(tree, hf_afp_icon_length, tvb, offset, 2,FALSE);
2836 /* ************************** */
2838 dissect_query_afp_get_icon_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2842 proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2,FALSE);
2844 proto_tree_add_item(tree, hf_afp_file_creator, tvb, offset, 4,FALSE);
2847 proto_tree_add_item(tree, hf_afp_icon_index, tvb, offset, 2,FALSE);
2853 /* -------------------------- */
2855 dissect_reply_afp_get_icon_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2858 proto_tree_add_item(tree, hf_afp_icon_tag, tvb, offset, 4,FALSE);
2861 proto_tree_add_item(tree, hf_afp_file_type, tvb, offset, 4,FALSE);
2864 proto_tree_add_item(tree, hf_afp_icon_type, tvb, offset, 1,FALSE);
2868 proto_tree_add_item(tree, hf_afp_icon_length, tvb, offset, 2,FALSE);
2874 /* ************************** */
2876 dissect_query_afp_add_icon(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2880 proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2,FALSE);
2882 proto_tree_add_item(tree, hf_afp_file_creator, tvb, offset, 4,FALSE);
2885 proto_tree_add_item(tree, hf_afp_file_type, tvb, offset, 4,FALSE);
2888 proto_tree_add_item(tree, hf_afp_icon_type, tvb, offset, 1,FALSE);
2892 proto_tree_add_item(tree, hf_afp_icon_tag, tvb, offset, 4,FALSE);
2895 proto_tree_add_item(tree, hf_afp_icon_length, tvb, offset, 2,FALSE);
2901 /* **************************
2905 decode_dt_did(proto_tree *tree, tvbuff_t *tvb, gint offset)
2907 /* FIXME it's not volume but dt cf decode_name*/
2908 Vol = tvb_get_ntohs(tvb, offset);
2909 proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2,FALSE);
2912 Did = tvb_get_ntohl(tvb, offset);
2913 proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4,FALSE);
2918 /* -------------------------- */
2920 dissect_query_afp_add_appl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2924 offset = decode_dt_did(tree, tvb, offset);
2926 proto_tree_add_item(tree, hf_afp_file_creator, tvb, offset, 4,FALSE);
2929 proto_tree_add_item(tree, hf_afp_appl_tag, tvb, offset, 4,FALSE);
2932 offset = decode_name(tree, pinfo, tvb, offset);
2937 /* **************************
2941 dissect_query_afp_rmv_appl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2945 offset = decode_dt_did(tree, tvb, offset);
2947 proto_tree_add_item(tree, hf_afp_file_creator, tvb, offset, 4,FALSE);
2950 offset = decode_name(tree, pinfo, tvb, offset);
2955 /* ************************** */
2957 dissect_query_afp_get_appl(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2961 proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2,FALSE);
2964 proto_tree_add_item(tree, hf_afp_file_creator, tvb, offset, 4,FALSE);
2967 proto_tree_add_item(tree, hf_afp_appl_index, tvb, offset, 2,FALSE);
2970 decode_file_bitmap(tree, tvb, offset);
2976 /* -------------------------- */
2978 dissect_reply_afp_get_appl(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2980 proto_tree_add_item(tree, hf_afp_appl_tag, tvb, offset, 4,FALSE);
2986 /* ************************** */
2988 dissect_query_afp_create_file(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2990 proto_tree_add_item(tree, hf_afp_create_flag, tvb, offset, 1,FALSE);
2993 offset = decode_vol_did(tree, tvb, offset);
2995 offset = decode_name(tree, pinfo, tvb, offset);
3000 /* ************************** */
3002 dissect_query_afp_map_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3004 proto_tree_add_item(tree, hf_afp_map_id_type, tvb, offset, 1,FALSE);
3007 proto_tree_add_item(tree, hf_afp_map_id, tvb, offset, 4,FALSE);
3013 /* -------------------------- */
3015 dissect_reply_afp_map_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3019 len = tvb_get_guint8(tvb, offset);
3020 proto_tree_add_item(tree, hf_afp_map_name, tvb, offset, 1,FALSE);
3025 /* ************************** */
3027 dissect_query_afp_map_name(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3030 proto_tree_add_item(tree, hf_afp_map_name_type, tvb, offset, 1,FALSE);
3033 len = tvb_get_guint8(tvb, offset);
3034 proto_tree_add_item(tree, hf_afp_map_name, tvb, offset, 1,FALSE);
3040 /* -------------------------- */
3042 dissect_reply_afp_map_name(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3045 proto_tree_add_item(tree, hf_afp_map_id, tvb, offset, 4,FALSE);
3050 /* ************************** */
3052 dissect_query_afp_disconnect_old_session(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3058 proto_tree_add_item(tree, hf_afp_session_token_type, tvb, offset, 2,FALSE);
3061 len = tvb_get_ntohl(tvb, offset);
3062 proto_tree_add_item(tree, hf_afp_session_token_len, tvb, offset, 4,FALSE);
3065 proto_tree_add_item(tree, hf_afp_session_token, tvb, offset, len,FALSE);
3071 /* ************************** */
3073 dissect_query_afp_get_session_token(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3079 token = tvb_get_ntohs(tvb, offset);
3080 proto_tree_add_item(tree, hf_afp_session_token_type, tvb, offset, 2,FALSE);
3082 if (token == kLoginWithoutID) /* 0 */
3085 len = tvb_get_ntohl(tvb, offset);
3086 proto_tree_add_item(tree, hf_afp_session_token_len, tvb, offset, 4,FALSE);
3090 case kLoginWithTimeAndID:
3091 case kReconnWithTimeAndID:
3092 proto_tree_add_item(tree, hf_afp_session_token_timestamp, tvb, offset, 4,FALSE);
3096 proto_tree_add_item(tree, hf_afp_session_token, tvb, offset, len,FALSE);
3102 /* -------------------------- */
3104 dissect_reply_afp_get_session_token(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3109 /* FIXME spec and capture disagree : or it's 4 bytes with no token type, or it's 2 bytes */
3112 proto_tree_add_item(tree, hf_afp_session_token_type, tvb, offset, 2,FALSE);
3115 len = tvb_get_ntohl(tvb, offset);
3116 proto_tree_add_item(tree, hf_afp_session_token_len, tvb, offset, size,FALSE);
3119 proto_tree_add_item(tree, hf_afp_session_token, tvb, offset, len,FALSE);
3125 /* ************************** */
3127 dissect_query_afp_get_user_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3129 proto_tree *sub_tree = NULL;
3134 proto_tree_add_item(tree, hf_afp_user_flag, tvb, offset, 1,FALSE);
3137 proto_tree_add_item(tree, hf_afp_user_ID, tvb, offset, 4,FALSE);
3140 bitmap = tvb_get_ntohs(tvb, offset);
3142 item = proto_tree_add_item(tree, hf_afp_user_bitmap, tvb, offset, 2,FALSE);
3143 sub_tree = proto_item_add_subtree(item, ett_afp_user_bitmap);
3144 proto_tree_add_item(sub_tree, hf_afp_user_bitmap_UID, tvb, offset, 2,FALSE);
3145 proto_tree_add_item(sub_tree, hf_afp_user_bitmap_GID, tvb, offset, 2,FALSE);
3152 /* -------------------------- */
3154 dissect_reply_afp_get_user_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3156 proto_tree *sub_tree = NULL;
3160 bitmap = tvb_get_ntohs(tvb, offset);
3162 item = proto_tree_add_item(tree, hf_afp_user_bitmap, tvb, offset, 2,FALSE);
3163 sub_tree = proto_item_add_subtree(item, ett_afp_user_bitmap);
3164 proto_tree_add_item(sub_tree, hf_afp_user_bitmap_UID, tvb, offset, 2,FALSE);
3165 proto_tree_add_item(sub_tree, hf_afp_user_bitmap_GID, tvb, offset, 2,FALSE);
3170 proto_tree_add_item(tree, hf_afp_user_ID, tvb, offset, 4,FALSE);
3175 proto_tree_add_item(tree, hf_afp_group_ID, tvb, offset, 4,FALSE);
3181 /* ************************** */
3183 dissect_afp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
3185 struct aspinfo *aspinfo = pinfo->private_data;
3186 proto_tree *afp_tree = NULL;
3188 conversation_t *conversation;
3190 afp_request_key request_key, *new_request_key;
3191 afp_request_val *request_val;
3194 int len = tvb_reported_length_remaining(tvb,0);
3196 if (check_col(pinfo->cinfo, COL_PROTOCOL))
3197 col_set_str(pinfo->cinfo, COL_PROTOCOL, "AFP");
3198 if (check_col(pinfo->cinfo, COL_INFO))
3199 col_clear(pinfo->cinfo, COL_INFO);
3201 conversation = find_conversation(&pinfo->src, &pinfo->dst, pinfo->ptype,
3202 pinfo->srcport, pinfo->destport, 0);
3204 if (conversation == NULL)
3206 conversation = conversation_new(&pinfo->src, &pinfo->dst,
3207 pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
3210 request_key.conversation = conversation->index;
3211 request_key.seq = aspinfo->seq;
3213 request_val = (afp_request_val *) g_hash_table_lookup(
3214 afp_request_hash, &request_key);
3216 if (!request_val && !aspinfo->reply) {
3217 afp_command = tvb_get_guint8(tvb, offset);
3218 new_request_key = g_mem_chunk_alloc(afp_request_keys);
3219 *new_request_key = request_key;
3221 request_val = g_mem_chunk_alloc(afp_request_vals);
3222 request_val->command = tvb_get_guint8(tvb, offset);
3224 g_hash_table_insert(afp_request_hash, new_request_key,
3228 if (!request_val) { /* missing request */
3229 if (check_col(pinfo->cinfo, COL_INFO))
3230 col_add_fstr(pinfo->cinfo, COL_INFO, "[Reply without query?]");
3234 afp_command = request_val->command;
3235 if (check_col(pinfo->cinfo, COL_INFO)) {
3236 col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s",
3237 val_to_str(afp_command, CommandCode_vals,
3238 "Unknown command (%u)"),
3239 aspinfo->reply ? "reply" : "request");
3240 if (aspinfo->reply && aspinfo->code != 0) {
3241 col_append_fstr(pinfo->cinfo, COL_INFO, ": %s (%d)",
3242 val_to_str(aspinfo->code, asp_error_vals,
3243 "Unknown error (%u)"), aspinfo->code);
3249 ti = proto_tree_add_item(tree, proto_afp, tvb, offset, -1,FALSE);
3250 afp_tree = proto_item_add_subtree(ti, ett_afp);
3252 if (!aspinfo->reply) {
3254 proto_tree_add_uint(afp_tree, hf_afp_command, tvb,offset, 1, afp_command);
3255 if (afp_command != tvb_get_guint8(tvb, offset))
3257 /* we have the same conversation for different connections eg:
3258 * ip1:2048 --> ip2:548
3259 * ip1:2048 --> ip2:548 <RST>
3261 * ip1:2048 --> ip2:548 <SYN> use the same port but it's a new session!
3263 if (check_col(pinfo->cinfo, COL_INFO)) {
3264 col_add_fstr(pinfo->cinfo, COL_INFO,
3265 "[Error!IP port reused, you need to split the capture file]");
3270 switch(afp_command) {
3272 offset = dissect_query_afp_byte_lock(tvb, pinfo, afp_tree, offset);break;
3273 case AFP_BYTELOCK_EXT:
3274 offset = dissect_query_afp_byte_lock_ext(tvb, pinfo, afp_tree, offset);break;
3275 case AFP_OPENDT: /* same as close vol */
3278 offset = dissect_query_afp_with_vol_id(tvb, pinfo, afp_tree, offset);break;
3280 /* offset = dissect_query_afp_close_dir(tvb, pinfo, afp_tree, offset);break; */
3283 offset = dissect_query_afp_close_dt(tvb, pinfo, afp_tree, offset);break;
3284 case AFP_FLUSHFORK: /* same packet as closefork */
3286 offset = dissect_query_afp_with_fork(tvb, pinfo, afp_tree, offset);break;
3288 offset = dissect_query_afp_copy_file(tvb, pinfo, afp_tree, offset);break;
3289 case AFP_CREATEFILE:
3290 offset = dissect_query_afp_create_file(tvb, pinfo, afp_tree, offset);break;
3291 case AFP_DISCTOLDSESS:
3292 offset = dissect_query_afp_disconnect_old_session(tvb, pinfo, afp_tree, offset);break;
3293 case AFP_ENUMERATE_EXT2:
3294 offset = dissect_query_afp_enumerate_ext2(tvb, pinfo, afp_tree, offset);break;
3295 case AFP_ENUMERATE_EXT:
3297 offset = dissect_query_afp_enumerate(tvb, pinfo, afp_tree, offset);break;
3298 case AFP_GETFORKPARAM:
3299 offset = dissect_query_afp_get_fork_param(tvb, pinfo, afp_tree, offset);break;
3300 case AFP_GETSESSTOKEN:
3301 offset = dissect_query_afp_get_session_token(tvb, pinfo, afp_tree, offset);break;
3302 case AFP_GETUSERINFO:
3303 offset = dissect_query_afp_get_user_info(tvb, pinfo, afp_tree, offset);break;
3304 case AFP_GETSRVINFO:
3305 /* offset = dissect_query_afp_get_server_info(tvb, pinfo, afp_tree, offset);break; */
3306 case AFP_GETSRVPARAM:
3307 break; /* no parameters */
3308 case AFP_GETVOLPARAM:
3309 offset = dissect_query_afp_get_vol_param(tvb, pinfo, afp_tree, offset);break;
3311 offset = dissect_query_afp_login_ext(tvb, pinfo, afp_tree, offset);break;
3313 offset = dissect_query_afp_login(tvb, pinfo, afp_tree, offset);break;
3318 offset = dissect_query_afp_map_id(tvb, pinfo, afp_tree, offset);break;
3320 offset = dissect_query_afp_map_name(tvb, pinfo, afp_tree, offset);break;
3322 offset = dissect_query_afp_move(tvb, pinfo, afp_tree, offset);break;
3324 offset = dissect_query_afp_open_vol(tvb, pinfo, afp_tree, offset);break;
3328 offset = dissect_query_afp_open_fork(tvb, pinfo, afp_tree, offset);break;
3330 offset = dissect_query_afp_read(tvb, pinfo, afp_tree, offset);break;
3332 offset = dissect_query_afp_read_ext(tvb, pinfo, afp_tree, offset);break;
3334 offset = dissect_query_afp_rename(tvb, pinfo, afp_tree, offset);break;
3335 case AFP_SETDIRPARAM:
3336 offset = dissect_query_afp_set_dir_param(tvb, pinfo, afp_tree, offset);break;
3337 case AFP_SETFILEPARAM:
3338 offset = dissect_query_afp_set_file_param(tvb, pinfo, afp_tree, offset);break;
3339 case AFP_SETFORKPARAM:
3340 offset = dissect_query_afp_set_fork_param(tvb, pinfo, afp_tree, offset);break;
3341 case AFP_SETVOLPARAM:
3342 offset = dissect_query_afp_set_vol_param(tvb, pinfo, afp_tree, offset);break;
3344 offset = dissect_query_afp_write(tvb, pinfo, afp_tree, offset);break;
3346 offset = dissect_query_afp_write_ext(tvb, pinfo, afp_tree, offset);break;
3347 case AFP_GETFLDRPARAM:
3348 offset = dissect_query_afp_get_fldr_param(tvb, pinfo, afp_tree, offset);break;
3349 case AFP_SETFLDRPARAM:
3350 offset = dissect_query_afp_set_fldr_param(tvb, pinfo, afp_tree, offset);break;
3352 case AFP_GETSRVRMSG:
3354 case AFP_DELETE: /* same as create_id */
3357 offset = dissect_query_afp_create_id(tvb, pinfo, afp_tree, offset);break;
3359 offset = dissect_query_afp_delete_id(tvb, pinfo, afp_tree, offset);break;
3361 offset = dissect_query_afp_resolve_id(tvb, pinfo, afp_tree, offset);break;
3362 case AFP_EXCHANGEFILE:
3363 offset = dissect_query_afp_exchange_file(tvb, pinfo, afp_tree, offset);break;
3364 case AFP_CATSEARCH_EXT:
3366 offset = dissect_query_afp_cat_search(tvb, pinfo, afp_tree, offset);break;
3368 offset = dissect_query_afp_get_icon(tvb, pinfo, afp_tree, offset);break;
3370 offset = dissect_query_afp_get_icon_info(tvb, pinfo, afp_tree, offset);break;
3372 offset = dissect_query_afp_add_appl(tvb, pinfo, afp_tree, offset);break;
3374 offset = dissect_query_afp_rmv_appl(tvb, pinfo, afp_tree, offset);break;
3376 offset = dissect_query_afp_get_appl(tvb, pinfo, afp_tree, offset);break;
3378 offset = dissect_query_afp_add_cmt(tvb, pinfo, afp_tree, offset);break;
3379 case AFP_RMVCMT: /* same as get_cmt */
3381 offset = dissect_query_afp_get_cmt(tvb, pinfo, afp_tree, offset);break;
3383 offset = dissect_query_afp_add_icon(tvb, pinfo, afp_tree, offset);break;
3388 proto_tree_add_uint(afp_tree, hf_afp_command, tvb, 0, 0, afp_command);
3390 /* for some calls if the reply is an error there's no data
3394 switch(afp_command) {
3396 offset = dissect_reply_afp_byte_lock(tvb, pinfo, afp_tree, offset);break;
3397 case AFP_BYTELOCK_EXT:
3398 offset = dissect_reply_afp_byte_lock_ext(tvb, pinfo, afp_tree, offset);break;
3399 case AFP_ENUMERATE_EXT2:
3400 case AFP_ENUMERATE_EXT:
3401 offset = dissect_reply_afp_enumerate_ext(tvb, pinfo, afp_tree, offset);break;
3403 offset = dissect_reply_afp_enumerate(tvb, pinfo, afp_tree, offset);break;
3405 offset = dissect_reply_afp_open_vol(tvb, pinfo, afp_tree, offset);break;
3407 offset = dissect_reply_afp_open_fork(tvb, pinfo, afp_tree, offset);break;
3409 case AFP_GETFORKPARAM:
3410 offset =dissect_reply_afp_get_fork_param(tvb, pinfo, afp_tree, offset);break;
3411 case AFP_GETUSERINFO:
3412 offset = dissect_reply_afp_get_user_info(tvb, pinfo, afp_tree, offset);break;
3413 case AFP_GETSRVPARAM:
3414 offset = dissect_reply_afp_get_server_param(tvb, pinfo, afp_tree, offset);break;
3416 offset = dissect_reply_afp_create_dir(tvb, pinfo, afp_tree, offset);break;
3418 offset = dissect_reply_afp_map_id(tvb, pinfo, afp_tree, offset);break;
3420 offset = dissect_reply_afp_map_name(tvb, pinfo, afp_tree, offset);break;
3421 case AFP_MOVE: /* same as create_id */
3423 offset = dissect_reply_afp_create_id(tvb, pinfo, afp_tree, offset);break;
3424 case AFP_GETSESSTOKEN:
3425 offset = dissect_reply_afp_get_session_token(tvb, pinfo, afp_tree, offset);break;
3426 case AFP_GETVOLPARAM:
3427 offset = dissect_reply_afp_get_vol_param(tvb, pinfo, afp_tree, offset);break;
3428 case AFP_GETFLDRPARAM:
3429 offset = dissect_reply_afp_get_fldr_param(tvb, pinfo, afp_tree, offset);break;
3431 offset = dissect_reply_afp_open_dt(tvb, pinfo, afp_tree, offset);break;
3433 case AFP_CATSEARCH_EXT:
3435 offset = dissect_reply_afp_cat_search(tvb, pinfo, afp_tree, offset);break;
3437 offset = dissect_reply_afp_get_icon_info(tvb, pinfo, afp_tree, offset);break;
3439 offset = dissect_reply_afp_get_appl(tvb, pinfo, afp_tree, offset);break;
3441 offset = dissect_reply_afp_get_cmt(tvb, pinfo, afp_tree, offset);break;
3443 offset = dissect_reply_afp_write(tvb, pinfo, afp_tree, offset);break;
3445 offset = dissect_reply_afp_write_ext(tvb, pinfo, afp_tree, offset);break;
3448 if (tree && offset < len) {
3449 call_dissector(data_handle, tvb_new_subset(tvb, offset, -1, -1),
3454 static void afp_reinit( void)
3457 if (afp_request_hash)
3458 g_hash_table_destroy(afp_request_hash);
3459 if (afp_request_keys)
3460 g_mem_chunk_destroy(afp_request_keys);
3461 if (afp_request_vals)
3462 g_mem_chunk_destroy(afp_request_vals);
3464 afp_request_hash = g_hash_table_new(afp_hash, afp_equal);
3466 afp_request_keys = g_mem_chunk_new("afp_request_keys",
3467 sizeof(afp_request_key),
3468 afp_packet_init_count * sizeof(afp_request_key),
3470 afp_request_vals = g_mem_chunk_new("afp_request_vals",
3471 sizeof(afp_request_val),
3472 afp_packet_init_count * sizeof(afp_request_val),
3478 proto_register_afp(void)
3481 static hf_register_info hf[] = {
3483 { "Command", "afp.command",
3484 FT_UINT8, BASE_DEC, VALS(CommandCode_vals), 0x0,
3485 "AFP function", HFILL }},
3489 FT_NONE, BASE_NONE, NULL, 0,
3490 "Pad Byte", HFILL }},
3492 { &hf_afp_AFPVersion,
3493 { "AFP Version", "afp.AFPVersion",
3494 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
3495 "Client AFP version", HFILL }},
3499 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
3500 "User Authentication Method", HFILL }},
3503 { "User", "afp.user",
3504 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
3507 { &hf_afp_user_type,
3508 { "Type", "afp.user_type",
3509 FT_UINT8, BASE_HEX, VALS(path_type_vals), 0,
3510 "Type of user name", HFILL }},
3512 { "Len", "afp.user_len",
3513 FT_UINT16, BASE_DEC, NULL, 0x0,
3514 "User name length (unicode)", HFILL }},
3515 { &hf_afp_user_name,
3516 { "User", "afp.user_name",
3517 FT_STRING, BASE_NONE, NULL, 0x0,
3518 "User name (unicode)", HFILL }},
3521 { "Password", "afp.passwd",
3522 FT_STRINGZ, BASE_NONE, NULL, 0x0,
3523 "Password", HFILL }},
3526 { "Random number", "afp.random",
3527 FT_BYTES, BASE_HEX, NULL, 0x0,
3528 "UAM random number", HFILL }},
3530 { &hf_afp_login_flags,
3531 { "Flags", "afp.afp_login_flags",
3532 FT_UINT16, BASE_HEX, NULL, 0 /* 0x0FFF*/,
3533 "Login flags", HFILL }},
3535 { &hf_afp_vol_bitmap,
3536 { "Bitmap", "afp.vol_bitmap",
3537 FT_UINT16, BASE_HEX, NULL, 0 /* 0x0FFF*/,
3538 "Volume bitmap", HFILL }},
3540 { &hf_afp_vol_bitmap_Attributes,
3541 { "Attributes", "afp.vol_bitmap.attributes",
3542 FT_BOOLEAN, 16, NULL, kFPVolAttributeBit,
3543 "Volume attributes", HFILL }},
3545 { &hf_afp_vol_attribute,
3546 { "Attributes", "afp.vol_attributes",
3547 FT_UINT16, BASE_HEX, NULL, 0,
3548 "Volume attributes", HFILL }},
3550 { &hf_afp_vol_attribute_ReadOnly,
3551 { "Read only", "afp.vol_attribute.read_only",
3552 FT_BOOLEAN, 16, NULL, kReadOnly,
3553 "Read only volume", HFILL }},
3555 { &hf_afp_vol_attribute_HasVolumePassword,
3556 { "Volume password", "afp.vol_attribute.passwd",
3557 FT_BOOLEAN, 16, NULL, kHasVolumePassword,
3558 "Has a volume password", HFILL }},
3560 { &hf_afp_vol_attribute_SupportsFileIDs,
3561 { "File IDs", "afp.vol_attribute.fileIDs",
3562 FT_BOOLEAN, 16, NULL, kSupportsFileIDs,
3563 "Supports file IDs", HFILL }},
3565 { &hf_afp_vol_attribute_SupportsCatSearch,
3566 { "Catalog search", "afp.vol_attribute.cat_search",
3567 FT_BOOLEAN, 16, NULL, kSupportsCatSearch,
3568 "Supports catalog search operations", HFILL }},
3570 { &hf_afp_vol_attribute_SupportsBlankAccessPrivs,
3571 { "Blank access privileges", "afp.vol_attribute.blank_access_privs",
3572 FT_BOOLEAN, 16, NULL, kSupportsBlankAccessPrivs,
3573 "Supports blank access privileges", HFILL }},
3575 { &hf_afp_vol_attribute_SupportsUnixPrivs,
3576 { "UNIX access privileges", "afp.vol_attribute.unix_privs",
3577 FT_BOOLEAN, 16, NULL, kSupportsUnixPrivs,
3578 "Supports UNIX access privileges", HFILL }},
3580 { &hf_afp_vol_attribute_SupportsUTF8Names,
3581 { "UTF-8 names", "afp.vol_attribute.utf8_names",
3582 FT_BOOLEAN, 16, NULL, kSupportsUTF8Names,
3583 "Supports UTF-8 names", HFILL }},
3585 { &hf_afp_vol_bitmap_Signature,
3586 { "Signature", "afp.vol_bitmap.signature",
3587 FT_BOOLEAN, 16, NULL, kFPVolSignatureBit,
3588 "Volume signature", HFILL }},
3590 { &hf_afp_vol_bitmap_CreateDate,
3591 { "Creation date", "afp.vol_bitmap.create_date",
3592 FT_BOOLEAN, 16, NULL, kFPVolCreateDateBit,
3593 "Volume creation date", HFILL }},
3595 { &hf_afp_vol_bitmap_ModDate,
3596 { "Modification date", "afp.vol_bitmap.mod_date",
3597 FT_BOOLEAN, 16, NULL, kFPVolModDateBit,
3598 "Volume modification date", HFILL }},
3600 { &hf_afp_vol_bitmap_BackupDate,
3601 { "Backup date", "afp.vol_bitmap.backup_date",
3602 FT_BOOLEAN, 16, NULL, kFPVolBackupDateBit,
3603 "Volume backup date", HFILL }},
3605 { &hf_afp_vol_bitmap_ID,
3606 { "ID", "afp.vol_bitmap.id",
3607 FT_BOOLEAN, 16, NULL, kFPVolIDBit,
3608 "Volume ID", HFILL }},
3610 { &hf_afp_vol_bitmap_BytesFree,
3611 { "Bytes free", "afp.vol_bitmap.bytes_free",
3612 FT_BOOLEAN, 16, NULL, kFPVolBytesFreeBit,
3613 "Volume free bytes", HFILL }},
3615 { &hf_afp_vol_bitmap_BytesTotal,
3616 { "Bytes total", "afp.vol_bitmap.bytes_total",
3617 FT_BOOLEAN, 16, NULL, kFPVolBytesTotalBit,
3618 "Volume total bytes", HFILL }},
3620 { &hf_afp_vol_bitmap_Name,
3621 { "Name", "afp.vol_bitmap.name",
3622 FT_BOOLEAN, 16, NULL, kFPVolNameBit,
3623 "Volume name", HFILL }},
3625 { &hf_afp_vol_bitmap_ExtBytesFree,
3626 { "Extended bytes free", "afp.vol_bitmap.ex_bytes_free",
3627 FT_BOOLEAN, 16, NULL, kFPVolExtBytesFreeBit,
3628 "Volume extended (>2GB) free bytes", HFILL }},
3630 { &hf_afp_vol_bitmap_ExtBytesTotal,
3631 { "Extended bytes total", "afp.vol_bitmap.ex_bytes_total",
3632 FT_BOOLEAN, 16, NULL, kFPVolExtBytesTotalBit,
3633 "Volume extended (>2GB) total bytes", HFILL }},
3635 { &hf_afp_vol_bitmap_BlockSize,
3636 { "Block size", "afp.vol_bitmap.block_size",
3637 FT_BOOLEAN, 16, NULL, kFPVolBlockSizeBit,
3638 "Volume block size", HFILL }},
3640 { &hf_afp_dir_bitmap_Attributes,
3641 { "Attributes", "afp.dir_bitmap.attributes",
3642 FT_BOOLEAN, 16, NULL, kFPAttributeBit,
3643 "Return attributes if directory", HFILL }},
3645 { &hf_afp_dir_bitmap_ParentDirID,
3646 { "DID", "afp.dir_bitmap.did",
3647 FT_BOOLEAN, 16, NULL, kFPParentDirIDBit,
3648 "Return parent directory ID if directory", HFILL }},
3650 { &hf_afp_dir_bitmap_CreateDate,
3651 { "Creation date", "afp.dir_bitmap.create_date",
3652 FT_BOOLEAN, 16, NULL, kFPCreateDateBit,
3653 "Return creation date if directory", HFILL }},
3655 { &hf_afp_dir_bitmap_ModDate,
3656 { "Modification date", "afp.dir_bitmap.mod_date",
3657 FT_BOOLEAN, 16, NULL, kFPModDateBit,
3658 "Return modification date if directory", HFILL }},
3660 { &hf_afp_dir_bitmap_BackupDate,
3661 { "Backup date", "afp.dir_bitmap.backup_date",
3662 FT_BOOLEAN, 16, NULL, kFPBackupDateBit,
3663 "Return backup date if directory", HFILL }},
3665 { &hf_afp_dir_bitmap_FinderInfo,
3666 { "Finder info", "afp.dir_bitmap.finder_info",
3667 FT_BOOLEAN, 16, NULL, kFPFinderInfoBit,
3668 "Return finder info if directory", HFILL }},
3670 { &hf_afp_dir_bitmap_LongName,
3671 { "Long name", "afp.dir_bitmap.long_name",
3672 FT_BOOLEAN, 16, NULL, kFPLongNameBit,
3673 "Return long name if directory", HFILL }},
3675 { &hf_afp_dir_bitmap_ShortName,
3676 { "Short name", "afp.dir_bitmap.short_name",
3677 FT_BOOLEAN, 16, NULL, kFPShortNameBit,
3678 "Return short name if directory", HFILL }},
3680 { &hf_afp_dir_bitmap_NodeID,
3681 { "File ID", "afp.dir_bitmap.fid",
3682 FT_BOOLEAN, 16, NULL, kFPNodeIDBit,
3683 "Return file ID if directory", HFILL }},
3685 { &hf_afp_dir_bitmap_OffspringCount,
3686 { "Offspring count", "afp.dir_bitmap.offspring_count",
3687 FT_BOOLEAN, 16, NULL, kFPOffspringCountBit,
3688 "Return offspring count if directory", HFILL }},
3690 { &hf_afp_dir_bitmap_OwnerID,
3691 { "Owner id", "afp.dir_bitmap.owner_id",
3692 FT_BOOLEAN, 16, NULL, kFPOwnerIDBit,
3693 "Return owner id if directory", HFILL }},
3695 { &hf_afp_dir_bitmap_GroupID,
3696 { "Group id", "afp.dir_bitmap.group_id",
3697 FT_BOOLEAN, 16, NULL, kFPGroupIDBit,
3698 "Return group id if directory", HFILL }},
3700 { &hf_afp_dir_bitmap_AccessRights,
3701 { "Access rights", "afp.dir_bitmap.access_rights",
3702 FT_BOOLEAN, 16, NULL, kFPAccessRightsBit,
3703 "Return access rights if directory", HFILL }},
3705 { &hf_afp_dir_bitmap_UTF8Name,
3706 { "UTF-8 name", "afp.dir_bitmap.UTF8_name",
3707 FT_BOOLEAN, 16, NULL, kFPUTF8NameBit,
3708 "Return UTF-8 name if diectory", HFILL }},
3710 { &hf_afp_dir_bitmap_UnixPrivs,
3711 { "UNIX privileges", "afp.dir_bitmap.unix_privs",
3712 FT_BOOLEAN, 16, NULL, kFPUnixPrivsBit,
3713 "Return UNIX privileges if directory", HFILL }},
3715 { &hf_afp_dir_attribute_Invisible,
3716 { "Invisible", "afp.dir_attribute.invisible",
3717 FT_BOOLEAN, 16, NULL, kFPInvisibleBit,
3718 "Directory is not visible", HFILL }},
3720 { &hf_afp_dir_attribute_IsExpFolder,
3721 { "Share point", "afp.dir_attribute.share",
3722 FT_BOOLEAN, 16, NULL, kFPMultiUserBit,
3723 "Directory is a share point", HFILL }},
3725 { &hf_afp_dir_attribute_System,
3726 { "System", "afp.dir_attribute.system",
3727 FT_BOOLEAN, 16, NULL, kFPSystemBit,
3728 "Directory is a system directory", HFILL }},
3730 { &hf_afp_dir_attribute_Mounted,
3731 { "Mounted", "afp.dir_attribute.mounted",
3732 FT_BOOLEAN, 16, NULL, kFPDAlreadyOpenBit,
3733 "Directory is mounted", HFILL }},
3735 { &hf_afp_dir_attribute_InExpFolder,
3736 { "Shared area", "afp.dir_attribute.in_exported_folder",
3737 FT_BOOLEAN, 16, NULL, kFPRAlreadyOpenBit,
3738 "Directory is in a shared area", HFILL }},
3740 { &hf_afp_dir_attribute_BackUpNeeded,
3741 { "Backup needed", "afp.dir_attribute.backup_needed",
3742 FT_BOOLEAN, 16, NULL, kFPBackUpNeededBit,
3743 "Directory needs to be backed up", HFILL }},
3745 { &hf_afp_dir_attribute_RenameInhibit,
3746 { "Rename inhibit", "afp.dir_attribute.rename_inhibit",
3747 FT_BOOLEAN, 16, NULL, kFPRenameInhibitBit,
3748 "Rename inhibit", HFILL }},
3750 { &hf_afp_dir_attribute_DeleteInhibit,
3751 { "Delete inhibit", "afp.dir_attribute.delete_inhibit",
3752 FT_BOOLEAN, 16, NULL, kFPDeleteInhibitBit,
3753 "Delete inhibit", HFILL }},
3755 { &hf_afp_dir_attribute_SetClear,
3756 { "Set", "afp.dir_attribute.set_clear",
3757 FT_BOOLEAN, 16, NULL, kFPSetClearBit,
3758 "Clear/set attribute", HFILL }},
3760 { &hf_afp_file_bitmap_Attributes,
3761 { "Attributes", "afp.file_bitmap.attributes",
3762 FT_BOOLEAN, 16, NULL, kFPAttributeBit,
3763 "Return attributes if file", HFILL }},
3765 { &hf_afp_file_bitmap_ParentDirID,
3766 { "DID", "afp.file_bitmap.did",
3767 FT_BOOLEAN, 16, NULL, kFPParentDirIDBit,
3768 "Return parent directory ID if file", HFILL }},
3770 { &hf_afp_file_bitmap_CreateDate,
3771 { "Creation date", "afp.file_bitmap.create_date",
3772 FT_BOOLEAN, 16, NULL, kFPCreateDateBit,
3773 "Return creation date if file", HFILL }},
3775 { &hf_afp_file_bitmap_ModDate,
3776 { "Modification date", "afp.file_bitmap.mod_date",
3777 FT_BOOLEAN, 16, NULL, kFPModDateBit,
3778 "Return modification date if file", HFILL }},
3780 { &hf_afp_file_bitmap_BackupDate,
3781 { "Backup date", "afp.file_bitmap.backup_date",
3782 FT_BOOLEAN, 16, NULL, kFPBackupDateBit,
3783 "Return backup date if file", HFILL }},
3785 { &hf_afp_file_bitmap_FinderInfo,
3786 { "Finder info", "afp.file_bitmap.finder_info",
3787 FT_BOOLEAN, 16, NULL, kFPFinderInfoBit,
3788 "Return finder info if file", HFILL }},
3790 { &hf_afp_file_bitmap_LongName,
3791 { "Long name", "afp.file_bitmap.long_name",
3792 FT_BOOLEAN, 16, NULL, kFPLongNameBit,
3793 "Return long name if file", HFILL }},
3795 { &hf_afp_file_bitmap_ShortName,
3796 { "Short name", "afp.file_bitmap.short_name",
3797 FT_BOOLEAN, 16, NULL, kFPShortNameBit,
3798 "Return short name if file", HFILL }},
3800 { &hf_afp_file_bitmap_NodeID,
3801 { "File ID", "afp.file_bitmap.fid",
3802 FT_BOOLEAN, 16, NULL, kFPNodeIDBit,
3803 "Return file ID if file", HFILL }},
3805 { &hf_afp_file_bitmap_DataForkLen,
3806 { "Data fork size", "afp.file_bitmap.data_fork_len",
3807 FT_BOOLEAN, 16, NULL, kFPDataForkLenBit,
3808 "Return data fork size if file", HFILL }},
3810 { &hf_afp_file_bitmap_RsrcForkLen,
3811 { "Resource fork size", "afp.file_bitmap.resource_fork_len",
3812 FT_BOOLEAN, 16, NULL, kFPRsrcForkLenBit,
3813 "Return resource fork size if file", HFILL }},
3815 { &hf_afp_file_bitmap_ExtDataForkLen,
3816 { "Extended data fork size", "afp.file_bitmap.ex_data_fork_len",
3817 FT_BOOLEAN, 16, NULL, kFPExtDataForkLenBit,
3818 "Return extended (>2GB) data fork size if file", HFILL }},
3820 { &hf_afp_file_bitmap_LaunchLimit,
3821 { "Launch limit", "afp.file_bitmap.launch_limit",
3822 FT_BOOLEAN, 16, NULL, kFPLaunchLimitBit,
3823 "Return launch limit if file", HFILL }},
3825 { &hf_afp_file_bitmap_UTF8Name,
3826 { "UTF-8 name", "afp.file_bitmap.UTF8_name",
3827 FT_BOOLEAN, 16, NULL, kFPUTF8NameBit,
3828 "Return UTF-8 name if file", HFILL }},
3830 { &hf_afp_file_bitmap_ExtRsrcForkLen,
3831 { "Extended resource fork size", "afp.file_bitmap.ex_resource_fork_len",
3832 FT_BOOLEAN, 16, NULL, kFPExtRsrcForkLenBit,
3833 "Return extended (>2GB) resource fork size if file", HFILL }},
3835 { &hf_afp_file_bitmap_UnixPrivs,
3836 { "UNIX privileges", "afp.file_bitmap.unix_privs",
3837 FT_BOOLEAN, 16, NULL, kFPUnixPrivsBit_file,
3838 "Return UNIX privileges if file", HFILL }},
3841 { &hf_afp_file_attribute_Invisible,
3842 { "Invisible", "afp.file_attribute.invisible",
3843 FT_BOOLEAN, 16, NULL, kFPInvisibleBit,
3844 "File is not visible", HFILL }},
3846 { &hf_afp_file_attribute_MultiUser,
3847 { "Multi user", "afp.file_attribute.multi_user",
3848 FT_BOOLEAN, 16, NULL, kFPMultiUserBit,
3849 "multi user", HFILL }},
3851 { &hf_afp_file_attribute_System,
3852 { "System", "afp.file_attribute.system",
3853 FT_BOOLEAN, 16, NULL, kFPSystemBit,
3854 "File is a system file", HFILL }},
3856 { &hf_afp_file_attribute_DAlreadyOpen,
3857 { "Data fork open", "afp.file_attribute.df_open",
3858 FT_BOOLEAN, 16, NULL, kFPDAlreadyOpenBit,
3859 "Data fork already open", HFILL }},
3861 { &hf_afp_file_attribute_RAlreadyOpen,
3862 { "Resource fork open", "afp.file_attribute.rf_open",
3863 FT_BOOLEAN, 16, NULL, kFPRAlreadyOpenBit,
3864 "Resource fork already open", HFILL }},
3866 { &hf_afp_file_attribute_WriteInhibit,
3867 { "Write inhibit", "afp.file_attribute.write_inhibit",
3868 FT_BOOLEAN, 16, NULL, kFPWriteInhibitBit,
3869 "Write inhibit", HFILL }},
3871 { &hf_afp_file_attribute_BackUpNeeded,
3872 { "Backup needed", "afp.file_attribute.backup_needed",
3873 FT_BOOLEAN, 16, NULL, kFPBackUpNeededBit,
3874 "File needs to be backed up", HFILL }},
3876 { &hf_afp_file_attribute_RenameInhibit,
3877 { "Rename inhibit", "afp.file_attribute.rename_inhibit",
3878 FT_BOOLEAN, 16, NULL, kFPRenameInhibitBit,
3879 "rename inhibit", HFILL }},
3881 { &hf_afp_file_attribute_DeleteInhibit,
3882 { "Delete inhibit", "afp.file_attribute.delete_inhibit",
3883 FT_BOOLEAN, 16, NULL, kFPDeleteInhibitBit,
3884 "delete inhibit", HFILL }},
3886 { &hf_afp_file_attribute_CopyProtect,
3887 { "Copy protect", "afp.file_attribute.copy_protect",
3888 FT_BOOLEAN, 16, NULL, kFPCopyProtectBit,
3889 "copy protect", HFILL }},
3891 { &hf_afp_file_attribute_SetClear,
3892 { "Set", "afp.file_attribute.set_clear",
3893 FT_BOOLEAN, 16, NULL, kFPSetClearBit,
3894 "Clear/set attribute", HFILL }},
3898 { "Volume", "afp.vol_name",
3899 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
3900 "Volume name", HFILL }},
3902 { &hf_afp_vol_flag_passwd,
3903 { "Password", "afp.vol_flag_passwd",
3904 FT_BOOLEAN, 8, NULL, 1,
3905 "Volume is password-protected", HFILL }},
3907 { &hf_afp_vol_flag_unix_priv,
3908 { "Unix privs", "afp.vol_flag_unix_priv",
3909 FT_BOOLEAN, 8, NULL, 2,
3910 "Volume has unix privileges", HFILL }},
3913 { "Volume id", "afp.vol_id",
3914 FT_UINT16, BASE_DEC, NULL, 0x0,
3915 "Volume id", HFILL }},
3917 { &hf_afp_vol_signature,
3918 { "Signature", "afp.vol_signature",
3919 FT_UINT16, BASE_DEC, VALS(vol_signature_vals), 0x0,
3920 "Volume signature", HFILL }},
3922 { &hf_afp_vol_name_offset,
3923 { "Volume name offset","afp.vol_name_offset",
3924 FT_UINT16, BASE_DEC, NULL, 0x0,
3925 "Volume name offset in packet", HFILL }},
3927 { &hf_afp_vol_creation_date,
3928 { "Creation date", "afp.vol_creation_date",
3929 FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x0,
3930 "Volume creation date", HFILL }},
3932 { &hf_afp_vol_modification_date,
3933 { "Modification date", "afp.vol_modification_date",
3934 FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x0,
3935 "Volume modification date", HFILL }},
3937 { &hf_afp_vol_backup_date,
3938 { "Backup date", "afp.vol_backup_date",
3939 FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x0,
3940 "Volume backup date", HFILL }},
3942 { &hf_afp_vol_bytes_free,
3943 { "Bytes free", "afp.vol_bytes_free",
3944 FT_UINT32, BASE_DEC, NULL, 0x0,
3945 "Free space", HFILL }},
3947 { &hf_afp_vol_bytes_total,
3948 { "Bytes total", "afp.vol_bytes_total",
3949 FT_UINT32, BASE_DEC, NULL, 0x0,
3950 "Volume size", HFILL }},
3952 { &hf_afp_vol_ex_bytes_free,
3953 { "Extended bytes free", "afp.vol_ex_bytes_free",
3954 FT_UINT64, BASE_DEC, NULL, 0x0,
3955 "Extended (>2GB) free space", HFILL }},
3957 { &hf_afp_vol_ex_bytes_total,
3958 { "Extended bytes total", "afp.vol_ex_bytes_total",
3959 FT_UINT64, BASE_DEC, NULL, 0x0,
3960 "Extended (>2GB) volume size", HFILL }},
3962 { &hf_afp_vol_block_size,
3963 { "Block size", "afp.vol_block_size",
3964 FT_UINT32, BASE_DEC, NULL, 0x0,
3965 "Volume block size", HFILL }},
3969 FT_UINT32, BASE_DEC, NULL, 0x0,
3970 "Parent directory ID", HFILL }},
3972 { &hf_afp_dir_bitmap,
3973 { "Directory bitmap", "afp.dir_bitmap",
3974 FT_UINT16, BASE_HEX, NULL, 0x0,
3975 "Directory bitmap", HFILL }},
3977 { &hf_afp_dir_offspring,
3978 { "Offspring", "afp.dir_offspring",
3979 FT_UINT16, BASE_DEC, NULL, 0x0,
3980 "Directory offspring", HFILL }},
3982 { &hf_afp_dir_OwnerID,
3983 { "Owner ID", "afp.dir_owner_id",
3984 FT_INT32, BASE_DEC, NULL, 0x0,
3985 "Directory owner ID", HFILL }},
3987 { &hf_afp_dir_GroupID,
3988 { "Group ID", "afp.dir_group_id",
3989 FT_INT32, BASE_DEC, NULL, 0x0,
3990 "Directory group ID", HFILL }},
3992 { &hf_afp_creation_date,
3993 { "Creation date", "afp.creation_date",
3994 FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x0,
3995 "Creation date", HFILL }},
3997 { &hf_afp_modification_date,
3998 { "Modification date", "afp.modification_date",
3999 FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x0,
4000 "Modification date", HFILL }},
4002 { &hf_afp_backup_date,
4003 { "Backup date", "afp.backup_date",
4004 FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x0,
4005 "Backup date", HFILL }},
4007 { &hf_afp_finder_info,
4008 { "Finder info", "afp.finder_info",
4009 FT_BYTES, BASE_HEX, NULL, 0x0,
4010 "Finder info", HFILL }},
4012 { &hf_afp_long_name_offset,
4013 { "Long name offset", "afp.long_name_offset",
4014 FT_UINT16, BASE_DEC, NULL, 0x0,
4015 "Long name offset in packet", HFILL }},
4017 { &hf_afp_short_name_offset,
4018 { "Short name offset", "afp.short_name_offset",
4019 FT_UINT16, BASE_DEC, NULL, 0x0,
4020 "Short name offset in packet", HFILL }},
4022 { &hf_afp_unicode_name_offset,
4023 { "Unicode name offset", "afp.unicode_name_offset",
4024 FT_UINT16, BASE_DEC, NULL, 0x0,
4025 "Unicode name offset in packet", HFILL }},
4027 { &hf_afp_unix_privs_uid,
4028 { "UID", "afp.unix_privs.uid",
4029 FT_UINT32, BASE_DEC, NULL, 0x0,
4030 "User ID", HFILL }},
4032 { &hf_afp_unix_privs_gid,
4033 { "GID", "afp.unix_privs.gid",
4034 FT_UINT32, BASE_DEC, NULL, 0x0,
4035 "Group ID", HFILL }},
4037 { &hf_afp_unix_privs_permissions,
4038 { "Permissions", "afp.unix_privs.permissions",
4039 FT_UINT32, BASE_OCT, NULL, 0x0,
4040 "Permissions", HFILL }},
4042 { &hf_afp_unix_privs_ua_permissions,
4043 { "User's access rights", "afp.unix_privs.ua_permissions",
4044 FT_UINT32, BASE_HEX, NULL, 0x0,
4045 "User's access rights", HFILL }},
4048 { "File ID", "afp.file_id",
4049 FT_UINT32, BASE_DEC, NULL, 0x0,
4050 "File/directory ID", HFILL }},
4052 { &hf_afp_file_DataForkLen,
4053 { "Data fork size", "afp.data_fork_len",
4054 FT_UINT32, BASE_DEC, NULL, 0x0,
4055 "Data fork size", HFILL }},
4057 { &hf_afp_file_RsrcForkLen,
4058 { "Resource fork size", "afp.resource_fork_len",
4059 FT_UINT32, BASE_DEC, NULL, 0x0,
4060 "Resource fork size", HFILL }},
4062 { &hf_afp_file_ExtDataForkLen,
4063 { "Extended data fork size", "afp.ext_data_fork_len",
4064 FT_UINT64, BASE_DEC, NULL, 0x0,
4065 "Extended (>2GB) data fork length", HFILL }},
4067 { &hf_afp_file_ExtRsrcForkLen,
4068 { "Extended resource fork size", "afp.ext_resource_fork_len",
4069 FT_UINT64, BASE_DEC, NULL, 0x0,
4070 "Extended (>2GB) resource fork length", HFILL }},
4072 { &hf_afp_file_bitmap,
4073 { "File bitmap", "afp.file_bitmap",
4074 FT_UINT16, BASE_HEX, NULL, 0x0,
4075 "File bitmap", HFILL }},
4077 { &hf_afp_req_count,
4078 { "Req count", "afp.req_count",
4079 FT_UINT16, BASE_DEC, NULL, 0x0,
4080 "Maximum number of structures returned", HFILL }},
4082 { &hf_afp_start_index,
4083 { "Start index", "afp.start_index",
4084 FT_UINT16, BASE_DEC, NULL, 0x0,
4085 "First structure returned", HFILL }},
4087 { &hf_afp_max_reply_size,
4088 { "Reply size", "afp.reply_size",
4089 FT_UINT16, BASE_DEC, NULL, 0x0,
4090 "Reply size", HFILL }},
4092 { &hf_afp_start_index32,
4093 { "Start index", "afp.start_index32",
4094 FT_UINT32, BASE_DEC, NULL, 0x0,
4095 "First structure returned", HFILL }},
4097 { &hf_afp_max_reply_size32,
4098 { "Reply size", "afp.reply_size32",
4099 FT_UINT32, BASE_DEC, NULL, 0x0,
4100 "Reply size", HFILL }},
4102 { &hf_afp_file_flag,
4103 { "Dir", "afp.file_flag",
4104 FT_BOOLEAN, 8, NULL, 0x80,
4105 "Is a dir", HFILL }},
4107 { &hf_afp_create_flag,
4108 { "Hard create", "afp.create_flag",
4109 FT_BOOLEAN, 8, NULL, 0x80,
4110 "Soft/hard create file", HFILL }},
4112 { &hf_afp_struct_size,
4113 { "Struct size", "afp.struct_size",
4114 FT_UINT8, BASE_DEC, NULL,0,
4115 "Sizeof of struct", HFILL }},
4117 { &hf_afp_struct_size16,
4118 { "Struct size", "afp.struct_size16",
4119 FT_UINT16, BASE_DEC, NULL,0,
4120 "Sizeof of struct", HFILL }},
4123 { "From", "afp.flag",
4124 FT_UINT8, BASE_HEX, VALS(flag_vals), 0x80,
4125 "Offset is relative to start/end of the fork", HFILL }},
4128 { "DT ref", "afp.dt_ref",
4129 FT_UINT16, BASE_DEC, NULL, 0x0,
4130 "Desktop database reference num", HFILL }},
4133 { "Fork", "afp.ofork",
4134 FT_UINT16, BASE_DEC, NULL, 0x0,
4135 "Open fork reference number", HFILL }},
4138 { "Offset", "afp.offset",
4139 FT_INT32, BASE_DEC, NULL, 0x0,
4143 { "Count", "afp.rw_count",
4144 FT_INT32, BASE_DEC, NULL, 0x0,
4145 "Number of bytes to be read/written", HFILL }},
4147 { &hf_afp_newline_mask,
4148 { "Newline mask", "afp.newline_mask",
4149 FT_UINT8, BASE_HEX, NULL, 0x0,
4150 "Value to AND bytes with when looking for newline", HFILL }},
4152 { &hf_afp_newline_char,
4153 { "Newline char", "afp.newline_char",
4154 FT_UINT8, BASE_HEX, NULL, 0x0,
4155 "Value to compare ANDed bytes with when looking for newline", HFILL }},
4157 { &hf_afp_last_written,
4158 { "Last written", "afp.last_written",
4159 FT_UINT32, BASE_DEC, NULL, 0x0,
4160 "Offset of the last byte written", HFILL }},
4162 { &hf_afp_actual_count,
4163 { "Count", "afp.actual_count",
4164 FT_INT32, BASE_DEC, NULL, 0x0,
4165 "Number of bytes returned by read/write", HFILL }},
4167 { &hf_afp_ofork_len,
4168 { "New length", "afp.ofork_len",
4169 FT_INT32, BASE_DEC, NULL, 0x0,
4170 "New length", HFILL }},
4172 { &hf_afp_path_type,
4173 { "Type", "afp.path_type",
4174 FT_UINT8, BASE_HEX, VALS(path_type_vals), 0,
4175 "Type of names", HFILL }},
4178 { "Len", "afp.path_len",
4179 FT_UINT8, BASE_DEC, NULL, 0x0,
4180 "Path length", HFILL }},
4182 { &hf_afp_path_unicode_len,
4183 { "Len", "afp.path_unicode_len",
4184 FT_UINT16, BASE_DEC, NULL, 0x0,
4185 "Path length (unicode)", HFILL }},
4187 { &hf_afp_path_unicode_hint,
4188 { "Unicode hint", "afp.path_unicode_hint",
4189 FT_UINT32, BASE_HEX, VALS(unicode_hint_vals), 0x0,
4190 "Unicode hint", HFILL }},
4192 { &hf_afp_path_name,
4193 { "Name", "afp.path_name",
4194 FT_STRING, BASE_NONE, NULL, 0x0,
4195 "Path name", HFILL }},
4197 { &hf_afp_fork_type,
4198 { "Resource fork", "afp.fork_type",
4199 FT_BOOLEAN, 8, NULL, 0x80,
4200 "Data/resource fork", HFILL }},
4202 { &hf_afp_access_mode,
4203 { "Access mode", "afp.access",
4204 FT_UINT8, BASE_HEX, NULL, 0x0,
4205 "Fork access mode", HFILL }},
4207 { &hf_afp_access_read,
4208 { "Read", "afp.access.read",
4209 FT_BOOLEAN, 8, NULL, 1,
4210 "Open for reading", HFILL }},
4212 { &hf_afp_access_write,
4213 { "Write", "afp.access.write",
4214 FT_BOOLEAN, 8, NULL, 2,
4215 "Open for writing", HFILL }},
4217 { &hf_afp_access_deny_read,
4218 { "Deny read", "afp.access.deny_read",
4219 FT_BOOLEAN, 8, NULL, 0x10,
4220 "Deny read", HFILL }},
4222 { &hf_afp_access_deny_write,
4223 { "Deny write", "afp.access.deny_write",
4224 FT_BOOLEAN, 8, NULL, 0x20,
4225 "Deny write", HFILL }},
4228 { "Comment", "afp.comment",
4229 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
4230 "File/folder comment", HFILL }},
4232 { &hf_afp_file_creator,
4233 { "File creator", "afp.file_creator",
4234 FT_STRING, BASE_NONE, NULL, 0x0,
4235 "File creator", HFILL }},
4237 { &hf_afp_file_type,
4238 { "File type", "afp.file_type",
4239 FT_STRING, BASE_NONE, NULL, 0x0,
4240 "File type", HFILL }},
4242 { &hf_afp_icon_type,
4243 { "Icon type", "afp.icon_type",
4244 FT_UINT8, BASE_HEX, NULL , 0,
4245 "Icon type", HFILL }},
4247 { &hf_afp_icon_length,
4248 { "Size", "afp.icon_length",
4249 FT_UINT16, BASE_DEC, NULL, 0x0,
4250 "Size for icon bitmap", HFILL }},
4252 { &hf_afp_icon_index,
4253 { "Index", "afp.icon_index",
4254 FT_UINT16, BASE_DEC, NULL, 0x0,
4255 "Icon index in desktop database", HFILL }},
4258 { "Tag", "afp.icon_tag",
4259 FT_UINT32, BASE_HEX, NULL, 0x0,
4260 "Icon tag", HFILL }},
4262 { &hf_afp_appl_index,
4263 { "Index", "afp.appl_index",
4264 FT_UINT16, BASE_DEC, NULL, 0x0,
4265 "Application index", HFILL }},
4268 { "Tag", "afp.appl_tag",
4269 FT_UINT32, BASE_HEX, NULL, 0x0,
4270 "Application tag", HFILL }},
4273 { "unlock", "afp.lock_op",
4274 FT_BOOLEAN, 8, NULL, 0x1,
4275 "Lock/unlock op", HFILL }},
4277 { &hf_afp_lock_from,
4278 { "End", "afp.lock_from",
4279 FT_BOOLEAN, 8, NULL, 0x80,
4280 "Offset is relative to the end of the fork", HFILL }},
4282 { &hf_afp_lock_offset,
4283 { "Offset", "afp.lock_offset",
4284 FT_INT32, BASE_DEC, NULL, 0x0,
4285 "First byte to be locked", HFILL }},
4288 { "Length", "afp.lock_len",
4289 FT_INT32, BASE_DEC, NULL, 0x0,
4290 "Number of bytes to be locked/unlocked", HFILL }},
4292 { &hf_afp_lock_range_start,
4293 { "Start", "afp.lock_range_start",
4294 FT_INT32, BASE_DEC, NULL, 0x0,
4295 "First byte locked/unlocked", HFILL }},
4298 { "Access rights", "afp.dir_ar",
4299 FT_UINT32, BASE_HEX, NULL, 0x0,
4300 "Directory access rights", HFILL }},
4302 { &hf_afp_dir_ar_o_search,
4303 { "Owner has search access", "afp.dir_ar.o_search",
4304 FT_BOOLEAN, 32, NULL, AR_O_SEARCH,
4305 "Owner has search access", HFILL }},
4307 { &hf_afp_dir_ar_o_read,
4308 { "Owner has read access", "afp.dir_ar.o_read",
4309 FT_BOOLEAN, 32, NULL, AR_O_READ,
4310 "Owner has read access", HFILL }},
4312 { &hf_afp_dir_ar_o_write,
4313 { "Owner has write access", "afp.dir_ar.o_write",
4314 FT_BOOLEAN, 32, NULL, AR_O_WRITE,
4315 "Gwner has write access", HFILL }},
4317 { &hf_afp_dir_ar_g_search,
4318 { "Group has search access", "afp.dir_ar.g_search",
4319 FT_BOOLEAN, 32, NULL, AR_G_SEARCH,
4320 "Group has search access", HFILL }},
4322 { &hf_afp_dir_ar_g_read,
4323 { "Group has read access", "afp.dir_ar.g_read",
4324 FT_BOOLEAN, 32, NULL, AR_G_READ,
4325 "Group has read access", HFILL }},
4327 { &hf_afp_dir_ar_g_write,
4328 { "Group has write access", "afp.dir_ar.g_write",
4329 FT_BOOLEAN, 32, NULL, AR_G_WRITE,
4330 "Group has write access", HFILL }},
4332 { &hf_afp_dir_ar_e_search,
4333 { "Everyone has search access", "afp.dir_ar.e_search",
4334 FT_BOOLEAN, 32, NULL, AR_E_SEARCH,
4335 "Everyone has search access", HFILL }},
4337 { &hf_afp_dir_ar_e_read,
4338 { "Everyone has read access", "afp.dir_ar.e_read",
4339 FT_BOOLEAN, 32, NULL, AR_E_READ,
4340 "Everyone has read access", HFILL }},
4342 { &hf_afp_dir_ar_e_write,
4343 { "Everyone has write access", "afp.dir_ar.e_write",
4344 FT_BOOLEAN, 32, NULL, AR_E_WRITE,
4345 "Everyone has write access", HFILL }},
4347 { &hf_afp_dir_ar_u_search,
4348 { "User has search access", "afp.dir_ar.u_search",
4349 FT_BOOLEAN, 32, NULL, AR_U_SEARCH,
4350 "User has search access", HFILL }},
4352 { &hf_afp_dir_ar_u_read,
4353 { "User has read access", "afp.dir_ar.u_read",
4354 FT_BOOLEAN, 32, NULL, AR_U_READ,
4355 "User has read access", HFILL }},
4357 { &hf_afp_dir_ar_u_write,
4358 { "User has write access", "afp.dir_ar.u_write",
4359 FT_BOOLEAN, 32, NULL, AR_U_WRITE,
4360 "User has write access", HFILL }},
4362 { &hf_afp_dir_ar_blank,
4363 { "Blank access right", "afp.dir_ar.blank",
4364 FT_BOOLEAN, 32, NULL, AR_BLANK,
4365 "Blank access right", HFILL }},
4367 { &hf_afp_dir_ar_u_own,
4368 { "User is the owner", "afp.dir_ar.u_owner",
4369 FT_BOOLEAN, 32, NULL, AR_U_OWN,
4370 "Current user is the directory owner", HFILL }},
4372 { &hf_afp_server_time,
4373 { "Server time", "afp.server_time",
4374 FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x0,
4375 "Server time", HFILL }},
4377 { &hf_afp_cat_req_matches,
4378 { "Max answers", "afp.cat_req_matches",
4379 FT_INT32, BASE_DEC, NULL, 0x0,
4380 "Maximum number of matches to return.", HFILL }},
4383 { "Reserved", "afp.reserved",
4384 FT_BYTES, BASE_HEX, NULL, 0x0,
4385 "Reserved", HFILL }},
4387 { &hf_afp_cat_count,
4388 { "Cat count", "afp.cat_count",
4389 FT_UINT32, BASE_DEC, NULL, 0x0,
4390 "Number of structures returned", HFILL }},
4392 { &hf_afp_cat_position,
4393 { "Position", "afp.cat_position",
4394 FT_BYTES, BASE_HEX, NULL, 0x0,
4395 "Reserved", HFILL }},
4398 { &hf_afp_map_name_type,
4399 { "Type", "afp.map_name_type",
4400 FT_UINT8, BASE_DEC, VALS(map_name_type_vals), 0x0,
4401 "Map name type", HFILL }},
4403 { &hf_afp_map_id_type,
4404 { "Type", "afp.map_id_type",
4405 FT_UINT8, BASE_DEC, VALS(map_id_type_vals), 0x0,
4406 "Map ID type", HFILL }},
4409 { "ID", "afp.map_id",
4410 FT_UINT32, BASE_DEC, NULL, 0x0,
4411 "User/Group ID", HFILL }},
4414 { "Name", "afp.map_name",
4415 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
4416 "User/Group name", HFILL }},
4419 { &hf_afp_lock_offset64,
4420 { "Offset", "afp.lock_offset64",
4421 FT_INT64, BASE_DEC, NULL, 0x0,
4422 "First byte to be locked (64 bits)", HFILL }},
4424 { &hf_afp_lock_len64,
4425 { "Length", "afp.lock_len64",
4426 FT_INT64, BASE_DEC, NULL, 0x0,
4427 "Number of bytes to be locked/unlocked (64 bits)", HFILL }},
4429 { &hf_afp_lock_range_start64,
4430 { "Start", "afp.lock_range_start64",
4431 FT_INT64, BASE_DEC, NULL, 0x0,
4432 "First byte locked/unlocked (64 bits)", HFILL }},
4435 { "Offset", "afp.offset64",
4436 FT_INT64, BASE_DEC, NULL, 0x0,
4437 "Offset (64 bits)", HFILL }},
4439 { &hf_afp_rw_count64,
4440 { "Count", "afp.rw_count64",
4441 FT_INT64, BASE_DEC, NULL, 0x0,
4442 "Number of bytes to be read/written (64 bits)", HFILL }},
4444 { &hf_afp_last_written64,
4445 { "Last written", "afp.last_written64",
4446 FT_UINT64, BASE_DEC, NULL, 0x0,
4447 "Offset of the last byte written (64 bits)", HFILL }},
4449 { &hf_afp_ofork_len64,
4450 { "New length", "afp.ofork_len64",
4451 FT_INT64, BASE_DEC, NULL, 0x0,
4452 "New length (64 bits)", HFILL }},
4454 { &hf_afp_session_token_type,
4455 { "Type", "afp.session_token_type",
4456 FT_UINT16, BASE_HEX, VALS(token_type_vals), 0x0,
4457 "Session token type", HFILL }},
4459 /* FIXME FT_UINT32 in specs */
4460 { &hf_afp_session_token_len,
4461 { "Len", "afp.session_token_len",
4462 FT_UINT32, BASE_DEC, NULL, 0x0,
4463 "Session token length", HFILL }},
4465 { &hf_afp_session_token_timestamp,
4466 { "Time stamp", "afp.session_token_timestamp",
4467 FT_UINT32, BASE_HEX, NULL, 0x0,
4468 "Session time stamp", HFILL }},
4470 { &hf_afp_session_token,
4471 { "Token", "afp.session_token",
4472 FT_BYTES, BASE_HEX, NULL, 0x0,
4473 "Session token", HFILL }},
4475 { &hf_afp_user_flag,
4476 { "Flag", "afp.user_flag",
4477 FT_UINT8, BASE_HEX, VALS(user_flag_vals), 0x01,
4478 "User Info flag", HFILL }},
4481 { "User ID", "afp.user_ID",
4482 FT_UINT32, BASE_DEC, NULL, 0x0,
4483 "User ID", HFILL }},
4486 { "Group ID", "afp.group_ID",
4487 FT_UINT32, BASE_DEC, NULL, 0x0,
4488 "Group ID", HFILL }},
4490 { &hf_afp_user_bitmap,
4491 { "Bitmap", "afp.user_bitmap",
4492 FT_UINT16, BASE_HEX, NULL, 0,
4493 "User Info bitmap", HFILL }},
4495 { &hf_afp_user_bitmap_UID,
4496 { "User ID", "afp.user_bitmap.UID",
4497 FT_BOOLEAN, 16, NULL, 0x01,
4498 "User ID", HFILL }},
4500 { &hf_afp_user_bitmap_GID,
4501 { "Primary group ID", "afp.user_bitmap.GID",
4502 FT_BOOLEAN, 16, NULL, 0x02,
4503 "Primary group ID", HFILL }},
4506 static gint *ett[] = {
4508 &ett_afp_server_vol,
4511 &ett_afp_vol_bitmap,
4512 &ett_afp_vol_attribute,
4513 &ett_afp_dir_bitmap,
4514 &ett_afp_file_bitmap,
4515 &ett_afp_unix_privs,
4517 &ett_afp_enumerate_line,
4518 &ett_afp_access_mode,
4519 &ett_afp_dir_attribute,
4520 &ett_afp_file_attribute,
4522 &ett_afp_lock_flags,
4524 &ett_afp_cat_search,
4525 &ett_afp_cat_r_bitmap,
4528 &ett_afp_user_bitmap,
4531 proto_afp = proto_register_protocol("AppleTalk Filing Protocol", "AFP", "afp");
4532 proto_register_field_array(proto_afp, hf, array_length(hf));
4533 proto_register_subtree_array(ett, array_length(ett));
4535 register_init_routine( &afp_reinit);
4537 register_dissector("afp", dissect_afp, proto_afp);
4538 data_handle = find_dissector("data");
4542 proto_reg_handoff_afp(void)
4544 data_handle = find_dissector("data");
4547 /* -------------------------------