2 * Routines for afp packet dissection
3 * Copyright 2002, Didier Gautheron <dgautheron@magic.fr>
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
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.
36 #include <epan/packet.h>
37 /* #include <epan/strutil.h> */
38 #include <epan/conversation.h>
39 #include <epan/emem.h>
41 #include <epan/expert.h>
43 #include "packet-afp.h"
45 /* The information in this module (AFP) comes from:
47 AFP 2.1 & 2.2 documentation, in PDF form, at
49 http://developer.apple.com/DOCUMENTATION/macos8/pdf/ASAppleTalkFiling2.1_2.2.pdf
51 AFP3.0.pdf from http://www.apple.com (still available?)
53 AFP 3.1 programming guide, in PDF form, at
55 http://developer.apple.com/documentation/Networking/Conceptual/AFP/AFP3_1.pdf
59 http://developer.apple.com/documentation/Networking/Conceptual/AFP/index.html
61 Current AFP 3.x specfication, in HTML form, at
62 http://developer.apple.com/mac/library/documentation/Networking/Reference/AFP_Reference/Reference/reference.html
64 Current AFP 3.x programming guide, in HTML form, at
65 http://developer.apple.com/mac/library/documentation/Networking/Conceptual/AFP/Introduction/Introduction.html
67 The netatalk source code by Wesley Craig & Adrian Sun
68 http://netatalk.sf.net
70 /* from netatalk/include/afp.h */
71 #define AFPTRANS_NONE 0
72 #define AFPTRANS_DDP (1 << 0)
73 #define AFPTRANS_TCP (1 << 1)
74 #define AFPTRANS_ALL (AFPTRANS_DDP | AFPTRANS_TCP)
76 /* AFP Attention Codes -- 4 bits */
77 #define AFPATTN_SHUTDOWN (1 << 15) /* shutdown/disconnect */
78 #define AFPATTN_CRASH (1 << 14) /* server crashed */
79 #define AFPATTN_MESG (1 << 13) /* server has message */
80 #define AFPATTN_NORECONNECT (1 << 12) /* don't reconnect */
81 /* server notification */
82 #define AFPATTN_NOTIFY (AFPATTN_MESG | AFPATTN_NORECONNECT)
84 /* extended bitmap -- 12 bits. volchanged is only useful w/ a server
85 * notification, and time is only useful for shutdown. */
86 #define AFPATTN_VOLCHANGED (1 << 0) /* volume has changed */
87 #define AFPATTN_TIME(x) ((x) & 0xfff) /* time in minutes */
90 #define AFP_BYTELOCK 1
91 #define AFP_CLOSEVOL 2
92 #define AFP_CLOSEDIR 3
93 #define AFP_CLOSEFORK 4
94 #define AFP_COPYFILE 5
95 #define AFP_CREATEDIR 6
96 #define AFP_CREATEFILE 7
98 #define AFP_ENUMERATE 9
100 #define AFP_FLUSHFORK 11
101 #define AFP_GETFORKPARAM 14
102 #define AFP_GETSRVINFO 15
103 #define AFP_GETSRVPARAM 16
104 #define AFP_GETVOLPARAM 17
106 #define AFP_LOGINCONT 19
107 #define AFP_LOGOUT 20
109 #define AFP_MAPNAME 22
111 #define AFP_OPENVOL 24
112 #define AFP_OPENDIR 25
113 #define AFP_OPENFORK 26
115 #define AFP_RENAME 28
116 #define AFP_SETDIRPARAM 29
117 #define AFP_SETFILEPARAM 30
118 #define AFP_SETFORKPARAM 31
119 #define AFP_SETVOLPARAM 32
121 #define AFP_GETFLDRPARAM 34
122 #define AFP_SETFLDRPARAM 35
123 #define AFP_CHANGEPW 36
124 #define AFP_GETUSERINFO 37
125 #define AFP_GETSRVRMSG 38
126 #define AFP_CREATEID 39
127 #define AFP_DELETEID 40
128 #define AFP_RESOLVEID 41
129 #define AFP_EXCHANGEFILE 42
130 #define AFP_CATSEARCH 43
131 #define AFP_OPENDT 48
132 #define AFP_CLOSEDT 49
133 #define AFP_GETICON 51
134 #define AFP_GTICNINFO 52
135 #define AFP_ADDAPPL 53
136 #define AFP_RMVAPPL 54
137 #define AFP_GETAPPL 55
138 #define AFP_ADDCMT 56
139 #define AFP_RMVCMT 57
140 #define AFP_GETCMT 58
143 #define AFP_ADDICON 192
145 /* AFP 3.0 new calls */
146 #define AFP_BYTELOCK_EXT 59
147 #define AFP_READ_EXT 60
148 #define AFP_WRITE_EXT 61
149 #define AFP_LOGIN_EXT 63
150 #define AFP_GETSESSTOKEN 64
151 #define AFP_DISCTOLDSESS 65
152 #define AFP_ENUMERATE_EXT 66
153 #define AFP_CATSEARCH_EXT 67
155 /* AFP 3.1 new calls */
156 #define AFP_ENUMERATE_EXT2 68
158 /* AFP 3.2 new calls */
159 #define AFP_GETEXTATTR 69
160 #define AFP_SETEXTATTR 70
161 #define AFP_REMOVEATTR 71
162 #define AFP_LISTEXTATTR 72
163 #define AFP_GETACL 73
164 #define AFP_SETACL 74
165 #define AFP_ACCESS 75
167 /* AFP 3.2 calls added in 10.5 */
168 #define AFP_SPOTLIGHTRPC 76
169 #define AFP_SYNCDIR 78
170 #define AFP_SYNCFORK 79
172 /* FPSpotlightRPC subcommand codes */
173 #define SPOTLIGHT_CMD_GET_VOLPATH 1
174 #define SPOTLIGHT_CMD_GET_VOLID 2
175 #define SPOTLIGHT_CMD_GET_THREE 3
177 /* ----------------------------- */
178 static int proto_afp = -1;
179 static int hf_afp_reserved = -1;
180 static int hf_afp_unknown = -1;
182 static int hf_afp_command = -1; /* CommandCode */
183 static int hf_afp_AFPVersion = -1;
184 static int hf_afp_UAM = -1;
185 static int hf_afp_user = -1;
186 static int hf_afp_passwd = -1;
187 static int hf_afp_random = -1;
189 static int hf_afp_response_to = -1;
190 static int hf_afp_time = -1;
191 static int hf_afp_response_in = -1;
193 static int hf_afp_login_flags = -1;
194 static int hf_afp_pad = -1;
196 static int hf_afp_user_type = -1;
197 static int hf_afp_user_len = -1;
198 static int hf_afp_user_name = -1;
200 static int hf_afp_vol_flag_passwd = -1;
201 static int hf_afp_vol_flag_has_config = -1;
202 static int hf_afp_server_time = -1;
204 static int hf_afp_vol_bitmap = -1;
205 static int hf_afp_vol_name_offset = -1;
206 static int hf_afp_vol_id = -1;
207 static int hf_afp_vol_attribute = -1;
208 static int hf_afp_vol_name = -1;
209 static int hf_afp_vol_signature = -1;
210 static int hf_afp_vol_creation_date = -1;
211 static int hf_afp_vol_modification_date = -1;
212 static int hf_afp_vol_backup_date = -1;
213 static int hf_afp_vol_bytes_free = -1;
214 static int hf_afp_vol_bytes_total = -1;
215 static int hf_afp_vol_ex_bytes_free = -1;
216 static int hf_afp_vol_ex_bytes_total = -1;
217 static int hf_afp_vol_block_size = -1;
220 static int hf_afp_comment = -1;
221 static int hf_afp_file_creator = -1;
222 static int hf_afp_file_type = -1;
223 static int hf_afp_icon_type = -1;
224 static int hf_afp_icon_length = -1;
225 static int hf_afp_icon_tag = -1;
226 static int hf_afp_icon_index = -1;
227 static int hf_afp_appl_index = -1;
228 static int hf_afp_appl_tag = -1;
230 static int hf_afp_did = -1;
231 static int hf_afp_file_id = -1;
232 static int hf_afp_file_DataForkLen = -1;
233 static int hf_afp_file_RsrcForkLen = -1;
234 static int hf_afp_file_ExtDataForkLen = -1;
235 static int hf_afp_file_ExtRsrcForkLen = -1;
237 static int hf_afp_dir_bitmap = -1;
238 static int hf_afp_dir_offspring = -1;
239 static int hf_afp_dir_OwnerID = -1;
240 static int hf_afp_dir_GroupID = -1;
242 static int hf_afp_file_bitmap = -1;
243 static int hf_afp_req_count = -1;
244 static int hf_afp_start_index = -1;
245 static int hf_afp_start_index32 = -1;
246 static int hf_afp_max_reply_size = -1;
247 static int hf_afp_max_reply_size32 = -1;
248 static int hf_afp_file_flag = -1;
249 static int hf_afp_create_flag = -1;
250 static int hf_afp_struct_size = -1;
251 static int hf_afp_struct_size16 = -1;
253 static int hf_afp_request_bitmap = -1;
255 static int hf_afp_cat_count = -1;
256 static int hf_afp_cat_req_matches = -1;
257 static int hf_afp_cat_position = -1;
259 static int hf_afp_creation_date = -1;
260 static int hf_afp_modification_date = -1;
261 static int hf_afp_backup_date = -1;
262 static int hf_afp_finder_info = -1;
263 static int hf_afp_long_name_offset = -1;
264 static int hf_afp_short_name_offset = -1;
265 static int hf_afp_unicode_name_offset = -1;
266 static int hf_afp_unix_privs_uid = -1;
267 static int hf_afp_unix_privs_gid = -1;
268 static int hf_afp_unix_privs_permissions = -1;
269 static int hf_afp_unix_privs_ua_permissions = -1;
271 static int hf_afp_path_type = -1;
272 static int hf_afp_path_len = -1;
273 static int hf_afp_path_name = -1;
274 static int hf_afp_path_unicode_hint = -1;
275 static int hf_afp_path_unicode_len = -1;
277 static int hf_afp_flag = -1;
278 static int hf_afp_dt_ref = -1;
279 static int hf_afp_ofork = -1;
280 static int hf_afp_ofork_len = -1;
281 static int hf_afp_offset = -1;
282 static int hf_afp_rw_count = -1;
283 static int hf_afp_newline_mask = -1;
284 static int hf_afp_newline_char = -1;
285 static int hf_afp_last_written = -1;
286 static int hf_afp_actual_count = -1;
288 static int hf_afp_fork_type = -1;
289 static int hf_afp_access_mode = -1;
290 static int hf_afp_access_read = -1;
291 static int hf_afp_access_write = -1;
292 static int hf_afp_access_deny_read = -1;
293 static int hf_afp_access_deny_write = -1;
295 static gint hf_afp_lock_op = -1;
296 static gint hf_afp_lock_from = -1;
297 static gint hf_afp_lock_offset = -1;
298 static gint hf_afp_lock_len = -1;
299 static gint hf_afp_lock_range_start = -1;
301 static gint ett_afp = -1;
303 static gint ett_afp_vol_attribute = -1;
304 static gint ett_afp_enumerate = -1;
305 static gint ett_afp_enumerate_line = -1;
306 static gint ett_afp_access_mode = -1;
308 static gint ett_afp_vol_bitmap = -1;
309 static gint ett_afp_dir_bitmap = -1;
310 static gint ett_afp_dir_attribute = -1;
311 static gint ett_afp_file_attribute = -1;
312 static gint ett_afp_file_bitmap = -1;
313 static gint ett_afp_unix_privs = -1;
314 static gint ett_afp_path_name = -1;
315 static gint ett_afp_lock_flags = -1;
316 static gint ett_afp_dir_ar = -1;
318 static gint ett_afp_server_vol = -1;
319 static gint ett_afp_vol_list = -1;
320 static gint ett_afp_vol_flag = -1;
321 static gint ett_afp_cat_search = -1;
322 static gint ett_afp_cat_r_bitmap = -1;
323 static gint ett_afp_cat_spec = -1;
324 static gint ett_afp_vol_did = -1;
326 /* AFP 3.0 parameters */
327 static gint hf_afp_lock_offset64 = -1;
328 static gint hf_afp_lock_len64 = -1;
329 static gint hf_afp_lock_range_start64 = -1;
331 static int hf_afp_offset64 = -1;
332 static int hf_afp_rw_count64 = -1;
333 static int hf_afp_reqcount64 = -1;
335 static int hf_afp_last_written64 = -1;
337 static int hf_afp_ofork_len64 = -1;
338 static int hf_afp_session_token_type = -1;
339 static int hf_afp_session_token_len = -1;
340 static int hf_afp_session_token = -1;
341 static int hf_afp_session_token_timestamp = -1;
345 static int hf_afp_extattr_bitmap = -1;
346 static int hf_afp_extattr_bitmap_NoFollow = -1;
347 static int hf_afp_extattr_bitmap_Create = -1;
348 static int hf_afp_extattr_bitmap_Replace = -1;
349 static int ett_afp_extattr_bitmap = -1;
350 static int hf_afp_extattr_namelen = -1;
351 static int hf_afp_extattr_name = -1;
352 static int hf_afp_extattr_len = -1;
353 static int hf_afp_extattr_data = -1;
354 static int hf_afp_extattr_req_count = -1;
355 static int hf_afp_extattr_start_index = -1;
356 static int hf_afp_extattr_reply_size = -1;
357 static int ett_afp_extattr_names = -1;
359 static int afp_tap = -1;
361 static dissector_handle_t data_handle;
363 static const value_string vol_signature_vals[] = {
365 {2, "Fixed Directory ID"},
366 {3, "Variable Directory ID (deprecated)"},
370 static const value_string CommandCode_vals[] = {
371 {AFP_BYTELOCK, "FPByteRangeLock" },
372 {AFP_CLOSEVOL, "FPCloseVol" },
373 {AFP_CLOSEDIR, "FPCloseDir" },
374 {AFP_CLOSEFORK, "FPCloseFork" },
375 {AFP_COPYFILE, "FPCopyFile" },
376 {AFP_CREATEDIR, "FPCreateDir" },
377 {AFP_CREATEFILE, "FPCreateFile" },
378 {AFP_DELETE, "FPDelete" },
379 {AFP_ENUMERATE, "FPEnumerate" },
380 {AFP_FLUSH, "FPFlush" },
381 {AFP_FLUSHFORK, "FPFlushFork" },
382 {AFP_GETFORKPARAM, "FPGetForkParms" },
383 {AFP_GETSRVINFO, "FPGetSrvrInfo" },
384 {AFP_GETSRVPARAM, "FPGetSrvrParms" },
385 {AFP_GETVOLPARAM, "FPGetVolParms" },
386 {AFP_LOGIN, "FPLogin" },
387 {AFP_LOGINCONT, "FPLoginCont" },
388 {AFP_LOGOUT, "FPLogout" },
389 {AFP_MAPID, "FPMapID" },
390 {AFP_MAPNAME, "FPMapName" },
391 {AFP_MOVE, "FPMoveAndRename" },
392 {AFP_OPENVOL, "FPOpenVol" },
393 {AFP_OPENDIR, "FPOpenDir" },
394 {AFP_OPENFORK, "FPOpenFork" },
395 {AFP_READ, "FPRead" },
396 {AFP_RENAME, "FPRename" },
397 {AFP_SETDIRPARAM, "FPSetDirParms" },
398 {AFP_SETFILEPARAM, "FPSetFileParms" },
399 {AFP_SETFORKPARAM, "FPSetForkParms" },
400 {AFP_SETVOLPARAM, "FPSetVolParms" },
401 {AFP_WRITE, "FPWrite" },
402 {AFP_GETFLDRPARAM, "FPGetFileDirParms" },
403 {AFP_SETFLDRPARAM, "FPSetFileDirParms" },
404 {AFP_CHANGEPW, "FPChangePassword" },
405 {AFP_GETUSERINFO, "FPGetUserInfo" },
406 {AFP_GETSRVRMSG, "FPGetSrvrMsg" },
407 {AFP_CREATEID, "FPCreateID" },
408 {AFP_DELETEID, "FPDeleteID" },
409 {AFP_RESOLVEID, "FPResolveID" },
410 {AFP_EXCHANGEFILE, "FPExchangeFiles" },
411 {AFP_CATSEARCH, "FPCatSearch" },
412 {AFP_OPENDT, "FPOpenDT" },
413 {AFP_CLOSEDT, "FPCloseDT" },
414 {AFP_GETICON, "FPGetIcon" },
415 {AFP_GTICNINFO, "FPGetIconInfo" },
416 {AFP_ADDAPPL, "FPAddAPPL" },
417 {AFP_RMVAPPL, "FPRemoveAPPL" },
418 {AFP_GETAPPL, "FPGetAPPL" },
419 {AFP_ADDCMT, "FPAddComment" },
420 {AFP_RMVCMT, "FPRemoveComment" },
421 {AFP_GETCMT, "FPGetComment" },
422 {AFP_BYTELOCK_EXT, "FPByteRangeLockExt" },
423 {AFP_READ_EXT, "FPReadExt" },
424 {AFP_WRITE_EXT, "FPWriteExt" },
425 {AFP_LOGIN_EXT, "FPLoginExt" },
426 {AFP_GETSESSTOKEN, "FPGetSessionToken" },
427 {AFP_DISCTOLDSESS, "FPDisconnectOldSession" },
428 {AFP_ENUMERATE_EXT, "FPEnumerateExt" },
429 {AFP_CATSEARCH_EXT, "FPCatSearchExt" },
430 {AFP_ENUMERATE_EXT2, "FPEnumerateExt2" },
431 {AFP_GETEXTATTR, "FPGetExtAttr" },
432 {AFP_SETEXTATTR, "FPSetExtAttr" },
433 {AFP_REMOVEATTR, "FPRemoveExtAttr" },
434 {AFP_LISTEXTATTR, "FPListExtAttrs" },
435 {AFP_GETACL, "FPGetACL" },
436 {AFP_SETACL, "FPSetACL" },
437 {AFP_ACCESS, "FPAccess" },
438 {AFP_SPOTLIGHTRPC, "FPSpotlightRPC" },
439 {AFP_SYNCDIR, "FPSyncDir" },
440 {AFP_SYNCFORK, "FPSyncFork" },
441 {AFP_ZZZ, "FPZzzzz" },
442 {AFP_ADDICON, "FPAddIcon" },
445 value_string_ext CommandCode_vals_ext = VALUE_STRING_EXT_INIT(CommandCode_vals);
447 static const value_string unicode_hint_vals[] = {
449 { 1, "MacJapanese" },
450 { 2, "MacChineseTrad" },
455 { 7, "MacCyrillic" },
456 { 9, "MacDevanagari" },
457 { 10, "MacGurmukhi" },
458 { 11, "MacGujarati" },
460 { 13, "MacBengali" },
463 { 16, "MacKannada" },
464 { 17, "MacMalayalam" },
465 { 18, "MacSinhalese" },
466 { 19, "MacBurmese" },
469 { 22, "MacLaotian" },
470 { 23, "MacGeorgian" },
471 { 24, "MacArmenian" },
472 { 25, "MacChineseSimp" },
473 { 26, "MacTibetan" },
474 { 27, "MacMongolian" },
475 { 28, "MacEthiopic" },
476 { 29, "MacCentralEurRoman" },
477 { 30, "MacVietnamese" },
478 { 31, "MacExtArabic" },
480 { 34, "MacDingbats" },
481 { 35, "MacTurkish" },
482 { 36, "MacCroatian" },
483 { 37, "MacIcelandic" },
484 { 38, "MacRomanian" },
487 { 41, "MacKeyboardGlyphs" },
488 { 126, "MacUnicode" },
490 { 152, "MacUkrainian" },
494 { 256, "UnicodeDefault" },
495 /* { 257, "UnicodeV1_1" }, */
496 { 257, "ISO10646_1993" },
497 { 259, "UnicodeV2_0" },
498 { 259, "UnicodeV2_1" },
499 { 260, "UnicodeV3_0" },
500 { 513, "ISOLatin1" },
501 { 514, "ISOLatin2" },
502 { 515, "ISOLatin3" },
503 { 516, "ISOLatin4" },
504 { 517, "ISOLatinCyrillic" },
505 { 518, "ISOLatinArabic" },
506 { 519, "ISOLatinGreek" },
507 { 520, "ISOLatinHebrew" },
508 { 521, "ISOLatin5" },
509 { 522, "ISOLatin6" },
510 { 525, "ISOLatin7" },
511 { 526, "ISOLatin8" },
512 { 527, "ISOLatin9" },
513 { 1024, "DOSLatinUS" },
514 { 1029, "DOSGreek" },
515 { 1030, "DOSBalticRim" },
516 { 1040, "DOSLatin1" },
517 { 1041, "DOSGreek1" },
518 { 1042, "DOSLatin2" },
519 { 1043, "DOSCyrillic" },
520 { 1044, "DOSTurkish" },
521 { 1045, "DOSPortuguese" },
522 { 1046, "DOSIcelandic" },
523 { 1047, "DOSHebrew" },
524 { 1048, "DOSCanadianFrench" },
525 { 1049, "DOSArabic" },
526 { 1050, "DOSNordic" },
527 { 1051, "DOSRussian" },
528 { 1052, "DOSGreek2" },
530 { 1056, "DOSJapanese" },
531 { 1057, "DOSChineseSimplif" },
532 { 1058, "DOSKorean" },
533 { 1059, "DOSChineseTrad" },
534 { 1280, "WindowsLatin1" },
535 /* { 1280, "WindowsANSI" }, */
536 { 1281, "WindowsLatin2" },
537 { 1282, "WindowsCyrillic" },
538 { 1283, "WindowsGreek" },
539 { 1284, "WindowsLatin5" },
540 { 1285, "WindowsHebrew" },
541 { 1286, "WindowsArabic" },
542 { 1287, "WindowsBalticRim" },
543 { 1288, "WindowsVietnamese" },
544 { 1296, "WindowsKoreanJohab" },
545 { 1536, "US_ASCII" },
546 { 1568, "JIS_X0201_76" },
547 { 1569, "JIS_X0208_83" },
548 { 1570, "JIS_X0208_90" },
551 static value_string_ext unicode_hint_vals_ext = VALUE_STRING_EXT_INIT(unicode_hint_vals);
554 from Apple AFP3.0.pdf
557 #define kFPVolAttributeBit (1 << 0)
558 #define kFPVolSignatureBit (1 << 1)
559 #define kFPVolCreateDateBit (1 << 2)
560 #define kFPVolModDateBit (1 << 3)
561 #define kFPVolBackupDateBit (1 << 4)
562 #define kFPVolIDBit (1 << 5)
563 #define kFPVolBytesFreeBit (1 << 6)
564 #define kFPVolBytesTotalBit (1 << 7)
565 #define kFPVolNameBit (1 << 8)
566 #define kFPVolExtBytesFreeBit (1 << 9)
567 #define kFPVolExtBytesTotalBit (1 << 10)
568 #define kFPVolBlockSizeBit (1 << 11)
570 static int hf_afp_vol_bitmap_Attributes = -1;
571 static int hf_afp_vol_bitmap_Signature = -1;
572 static int hf_afp_vol_bitmap_CreateDate = -1;
573 static int hf_afp_vol_bitmap_ModDate = -1;
574 static int hf_afp_vol_bitmap_BackupDate = -1;
575 static int hf_afp_vol_bitmap_ID = -1;
576 static int hf_afp_vol_bitmap_BytesFree = -1;
577 static int hf_afp_vol_bitmap_BytesTotal = -1;
578 static int hf_afp_vol_bitmap_Name = -1;
579 static int hf_afp_vol_bitmap_ExtBytesFree = -1;
580 static int hf_afp_vol_bitmap_ExtBytesTotal = -1;
581 static int hf_afp_vol_bitmap_BlockSize = -1;
583 static int hf_afp_vol_attribute_ReadOnly = -1;
584 static int hf_afp_vol_attribute_HasVolumePassword = -1;
585 static int hf_afp_vol_attribute_SupportsFileIDs = -1;
586 static int hf_afp_vol_attribute_SupportsCatSearch = -1;
587 static int hf_afp_vol_attribute_SupportsBlankAccessPrivs = -1;
588 static int hf_afp_vol_attribute_SupportsUnixPrivs = -1;
589 static int hf_afp_vol_attribute_SupportsUTF8Names = -1;
590 static int hf_afp_vol_attribute_NoNetworkUserID = -1;
591 static int hf_afp_vol_attribute_DefaultPrivsFromParent = -1;
592 static int hf_afp_vol_attribute_NoExchangeFiles = -1;
593 static int hf_afp_vol_attribute_SupportsExtAttrs = -1;
594 static int hf_afp_vol_attribute_SupportsACLs = -1;
595 static int hf_afp_vol_attribute_CaseSensitive = -1;
596 static int hf_afp_vol_attribute_SupportsTMLockSteal = -1;
598 static int hf_afp_dir_bitmap_Attributes = -1;
599 static int hf_afp_dir_bitmap_ParentDirID = -1;
600 static int hf_afp_dir_bitmap_CreateDate = -1;
601 static int hf_afp_dir_bitmap_ModDate = -1;
602 static int hf_afp_dir_bitmap_BackupDate = -1;
603 static int hf_afp_dir_bitmap_FinderInfo = -1;
604 static int hf_afp_dir_bitmap_LongName = -1;
605 static int hf_afp_dir_bitmap_ShortName = -1;
606 static int hf_afp_dir_bitmap_NodeID = -1;
607 static int hf_afp_dir_bitmap_OffspringCount = -1;
608 static int hf_afp_dir_bitmap_OwnerID = -1;
609 static int hf_afp_dir_bitmap_GroupID = -1;
610 static int hf_afp_dir_bitmap_AccessRights = -1;
611 static int hf_afp_dir_bitmap_UTF8Name = -1;
612 static int hf_afp_dir_bitmap_UnixPrivs = -1;
614 static int hf_afp_dir_attribute_Invisible = -1;
615 static int hf_afp_dir_attribute_IsExpFolder = -1;
617 static int hf_afp_dir_attribute_System = -1;
618 static int hf_afp_dir_attribute_Mounted = -1;
619 static int hf_afp_dir_attribute_InExpFolder = -1;
621 static int hf_afp_dir_attribute_BackUpNeeded = -1;
622 static int hf_afp_dir_attribute_RenameInhibit = -1;
623 static int hf_afp_dir_attribute_DeleteInhibit = -1;
624 static int hf_afp_dir_attribute_SetClear = -1;
626 static int hf_afp_file_bitmap_Attributes = -1;
627 static int hf_afp_file_bitmap_ParentDirID = -1;
628 static int hf_afp_file_bitmap_CreateDate = -1;
629 static int hf_afp_file_bitmap_ModDate = -1;
630 static int hf_afp_file_bitmap_BackupDate = -1;
631 static int hf_afp_file_bitmap_FinderInfo = -1;
632 static int hf_afp_file_bitmap_LongName = -1;
633 static int hf_afp_file_bitmap_ShortName = -1;
634 static int hf_afp_file_bitmap_NodeID = -1;
635 static int hf_afp_file_bitmap_DataForkLen = -1;
636 static int hf_afp_file_bitmap_RsrcForkLen = -1;
637 static int hf_afp_file_bitmap_ExtDataForkLen = -1;
638 static int hf_afp_file_bitmap_LaunchLimit = -1;
640 static int hf_afp_file_bitmap_UTF8Name = -1;
641 static int hf_afp_file_bitmap_ExtRsrcForkLen = -1;
642 static int hf_afp_file_bitmap_UnixPrivs = -1;
644 static int hf_afp_file_attribute_Invisible = -1;
645 static int hf_afp_file_attribute_MultiUser = -1;
646 static int hf_afp_file_attribute_System = -1;
647 static int hf_afp_file_attribute_DAlreadyOpen = -1;
648 static int hf_afp_file_attribute_RAlreadyOpen = -1;
649 static int hf_afp_file_attribute_WriteInhibit = -1;
650 static int hf_afp_file_attribute_BackUpNeeded = -1;
651 static int hf_afp_file_attribute_RenameInhibit = -1;
652 static int hf_afp_file_attribute_DeleteInhibit = -1;
653 static int hf_afp_file_attribute_CopyProtect = -1;
654 static int hf_afp_file_attribute_SetClear = -1;
656 static int hf_afp_map_name_type = -1;
657 static int hf_afp_map_name = -1;
658 static int hf_afp_map_id = -1;
659 static int hf_afp_map_id_type = -1;
660 static int hf_afp_map_id_reply_type = -1;
662 static int hf_afp_request_bitmap_Attributes = -1;
663 static int hf_afp_request_bitmap_ParentDirID = -1;
664 static int hf_afp_request_bitmap_CreateDate = -1;
665 static int hf_afp_request_bitmap_ModDate = -1;
666 static int hf_afp_request_bitmap_BackupDate = -1;
667 static int hf_afp_request_bitmap_FinderInfo = -1;
668 static int hf_afp_request_bitmap_LongName = -1;
669 static int hf_afp_request_bitmap_DataForkLen = -1;
670 static int hf_afp_request_bitmap_OffspringCount = -1;
671 static int hf_afp_request_bitmap_RsrcForkLen = -1;
672 static int hf_afp_request_bitmap_ExtDataForkLen = -1;
673 static int hf_afp_request_bitmap_UTF8Name = -1;
674 static int hf_afp_request_bitmap_ExtRsrcForkLen = -1;
675 static int hf_afp_request_bitmap_PartialNames = -1;
677 static int ett_afp_spotlight_queries = -1;
678 static int ett_afp_spotlight_query_line = -1;
679 static int ett_afp_spotlight_query = -1;
680 static int ett_afp_spotlight_data = -1;
681 static int ett_afp_spotlight_toc = -1;
683 static int hf_afp_spotlight_request_flags = -1;
684 static int hf_afp_spotlight_request_command = -1;
685 static int hf_afp_spotlight_request_reserved = -1;
686 static int hf_afp_spotlight_volpath_server = -1;
687 static int hf_afp_spotlight_volpath_client = -1;
688 static int hf_afp_spotlight_returncode = -1;
689 static int hf_afp_spotlight_volflags = -1;
690 static int hf_afp_spotlight_reqlen = -1;
691 static int hf_afp_spotlight_toc_query_end = -1;
692 static int hf_afp_spotlight_mdstring = -1;
694 static const value_string flag_vals[] = {
699 static const value_string path_type_vals[] = {
702 {3, "Unicode names" },
705 static const value_string map_name_type_vals[] = {
706 {1, "Unicode user name to a user ID" },
707 {2, "Unicode group name to a group ID" },
708 {3, "Macintosh roman user name to a user ID" },
709 {4, "Macintosh roman group name to a group ID" },
710 {5, "Unicode user name to a user UUID" },
711 {6, "Unicode group name to a group UUID" },
713 static value_string_ext map_name_type_vals_ext = VALUE_STRING_EXT_INIT(map_name_type_vals);
715 static const value_string map_id_type_vals[] = {
716 {1, "User ID to a Macintosh roman user name" },
717 {2, "Group ID to a Macintosh roman group name" },
718 {3, "User ID to a unicode user name" },
719 {4, "Group ID to a unicode group name" },
720 {5, "User UUID to a unicode user name" },
721 {6, "Group UUID to a unicode group name" },
723 static value_string_ext map_id_type_vals_ext = VALUE_STRING_EXT_INIT(map_id_type_vals);
725 /* map_id subfunctions 5,6: reply type */
726 static const value_string map_id_reply_type_vals[] = {
732 volume attribute from Apple AFP3.0.pdf
735 #define kReadOnly (1 << 0)
736 #define kHasVolumePassword (1 << 1)
737 #define kSupportsFileIDs (1 << 2)
738 #define kSupportsCatSearch (1 << 3)
739 #define kSupportsBlankAccessPrivs (1 << 4)
740 #define kSupportsUnixPrivs (1 << 5)
741 #define kSupportsUTF8Names (1 << 6)
743 #define kNoNetworkUserIDs (1 << 7)
745 #define kDefaultPrivsFromParent (1 << 8)
746 #define kNoExchangeFiles (1 << 9)
747 #define kSupportsExtAttrs (1 << 10)
748 #define kSupportsACLs (1 << 11)
750 #define kCaseSensitive (1 << 12)
751 #define kSupportsTMLockSteal (1 << 13)
754 directory bitmap from Apple AFP3.1.pdf
757 #define kFPAttributeBit (1 << 0)
758 #define kFPParentDirIDBit (1 << 1)
759 #define kFPCreateDateBit (1 << 2)
760 #define kFPModDateBit (1 << 3)
761 #define kFPBackupDateBit (1 << 4)
762 #define kFPFinderInfoBit (1 << 5)
763 #define kFPLongNameBit (1 << 6)
764 #define kFPShortNameBit (1 << 7)
765 #define kFPNodeIDBit (1 << 8)
766 #define kFPOffspringCountBit (1 << 9)
767 #define kFPOwnerIDBit (1 << 10)
768 #define kFPGroupIDBit (1 << 11)
769 #define kFPAccessRightsBit (1 << 12)
770 #define kFPUTF8NameBit (1 << 13)
772 /* FIXME AFP3.0 bit 14, AFP3.1 bit 15 */
774 #define kFPUnixPrivsBit (1 << 15)
777 directory Access Rights parameter AFP3.1.pdf
781 #define AR_O_SEARCH (1 << 0) /* owner has search access */
782 #define AR_O_READ (1 << 1) /* owner has read access */
783 #define AR_O_WRITE (1 << 2) /* owner has write access */
785 #define AR_G_SEARCH (1 << 8) /* group has search access */
786 #define AR_G_READ (1 << 9) /* group has read access */
787 #define AR_G_WRITE (1 << 10) /* group has write access */
789 #define AR_E_SEARCH (1 << 16) /* everyone has search access */
790 #define AR_E_READ (1 << 17) /* everyone has read access */
791 #define AR_E_WRITE (1 << 18) /* everyone has write access */
793 #define AR_U_SEARCH (1 << 24) /* user has search access */
794 #define AR_U_READ (1 << 25) /* user has read access */
795 #define AR_U_WRITE (1 << 26) /* user has write access */
797 #define AR_BLANK (1 << 28) /* Blank Access Privileges (use parent dir privileges) */
798 #define AR_U_OWN (1UL << 31) /* user is the owner */
800 static int hf_afp_dir_ar = -1;
801 static int hf_afp_dir_ar_o_search = -1;
802 static int hf_afp_dir_ar_o_read = -1;
803 static int hf_afp_dir_ar_o_write = -1;
804 static int hf_afp_dir_ar_g_search = -1;
805 static int hf_afp_dir_ar_g_read = -1;
806 static int hf_afp_dir_ar_g_write = -1;
807 static int hf_afp_dir_ar_e_search = -1;
808 static int hf_afp_dir_ar_e_read = -1;
809 static int hf_afp_dir_ar_e_write = -1;
810 static int hf_afp_dir_ar_u_search = -1;
811 static int hf_afp_dir_ar_u_read = -1;
812 static int hf_afp_dir_ar_u_write = -1;
813 static int hf_afp_dir_ar_blank = -1;
814 static int hf_afp_dir_ar_u_own = -1;
816 static int hf_afp_user_flag = -1;
817 static int hf_afp_user_ID = -1;
818 static int hf_afp_group_ID = -1;
819 static int hf_afp_UUID = -1;
820 static int hf_afp_GRPUUID = -1;
821 static int hf_afp_user_bitmap = -1;
822 static int hf_afp_user_bitmap_UID = -1;
823 static int hf_afp_user_bitmap_GID = -1;
824 static int hf_afp_user_bitmap_UUID = -1;
826 static gint ett_afp_user_bitmap = -1;
828 static const value_string user_flag_vals[] = {
830 {1, "Default user" },
833 static int hf_afp_message = -1;
834 static int hf_afp_message_type = -1;
835 static int hf_afp_message_bitmap = -1;
836 static int hf_afp_message_bitmap_REQ = -1;
837 static int hf_afp_message_bitmap_UTF = -1;
838 static int hf_afp_message_len = -1;
840 static gint ett_afp_message_bitmap = -1;
842 static const value_string server_message_type[] = {
843 {0, "Login message" },
844 {1, "Server message" },
848 file bitmap AFP3.1.pdf
851 kFPAttributeBit (bit 0)
852 kFPParentDirIDBit (bit 1)
853 kFPCreateDateBit (bit 2)
854 kFPModDateBit (bit 3)
855 kFPBackupDateBit (bit 4)
856 kFPFinderInfoBit (bit 5)
857 kFPLongNameBit (bit 6)
858 kFPShortNameBit (bit 7)
861 kFPUTF8NameBit (bit 13)
864 #define kFPDataForkLenBit (1 << 9)
865 #define kFPRsrcForkLenBit (1 << 10)
866 #define kFPExtDataForkLenBit (1 << 11)
867 #define kFPLaunchLimitBit (1 << 12)
869 #define kFPExtRsrcForkLenBit (1 << 14)
872 file attribute AFP3.1.pdf
875 #define kFPInvisibleBit (1 << 0)
876 #define kFPMultiUserBit (1 << 1)
877 #define kFPSystemBit (1 << 2)
878 #define kFPDAlreadyOpenBit (1 << 3)
879 #define kFPRAlreadyOpenBit (1 << 4)
880 #define kFPWriteInhibitBit (1 << 5)
881 #define kFPBackUpNeededBit (1 << 6)
882 #define kFPRenameInhibitBit (1 << 7)
883 #define kFPDeleteInhibitBit (1 << 8)
884 #define kFPCopyProtectBit (1 << 10)
885 #define kFPSetClearBit (1 << 15)
888 #define kIsExpFolder (1 << 1)
889 #define kMounted (1 << 3)
890 #define kInExpFolder (1 << 4)
892 /* AFP 3.1 getsession token type */
893 #define kLoginWithoutID 0
894 #define kLoginWithID 1
895 #define kReconnWithID 2
896 #define kLoginWithTimeAndID 3
897 #define kReconnWithTimeAndID 4
899 /* modified AFP 3.1 token type cf. page 327 */
900 #define kRecon1Login 5
901 #define kRecon1ReconnectLogin 6
902 #define kRecon1Refresh 7
903 #define kGetKerberosSessionKey 8
905 static const value_string token_type_vals[] = {
906 {kLoginWithoutID, "LoginWithoutID"},
907 {kLoginWithID, "LoginWithID"},
908 {kReconnWithID, "ReconnWithID"},
909 {kLoginWithTimeAndID, "LoginWithTimeAndID"},
910 {kReconnWithTimeAndID, "ReconnWithTimeAndID"},
911 {kRecon1Login, "Recon1Login"},
912 {kRecon1ReconnectLogin, "Recon1ReconnectLogin"},
913 {kRecon1Refresh, "Recon1Refresh"},
914 {kGetKerberosSessionKey, "GetKerberosSessionKey"},
917 static value_string_ext token_type_vals_ext = VALUE_STRING_EXT_INIT(token_type_vals);
919 /* AFP 3.2 ACL bitmap */
920 #define kFileSec_UUID (1 << 0)
921 #define kFileSec_GRPUUID (1 << 1)
922 #define kFileSec_ACL (1 << 2)
923 #define kFileSec_REMOVEACL (1 << 3)
924 #define kFileSec_Inherit (1 << 4)
926 static int hf_afp_acl_list_bitmap = -1;
927 static int hf_afp_acl_list_bitmap_UUID = -1;
928 static int hf_afp_acl_list_bitmap_GRPUUID = -1;
929 static int hf_afp_acl_list_bitmap_ACL = -1;
930 static int hf_afp_acl_list_bitmap_REMOVEACL = -1;
931 static int hf_afp_acl_list_bitmap_Inherit = -1;
932 static int ett_afp_acl_list_bitmap = -1;
934 static int hf_afp_access_bitmap = -1;
936 static int hf_afp_acl_entrycount = -1;
937 static int hf_afp_acl_flags = -1;
939 static int hf_afp_ace_applicable = -1;
940 static int hf_afp_ace_flags = -1;
941 static int hf_afp_ace_rights = -1;
943 static int ett_afp_ace_flags = -1;
944 static int hf_afp_ace_flags_allow = -1;
945 static int hf_afp_ace_flags_deny = -1;
946 static int hf_afp_ace_flags_inherited = -1;
947 static int hf_afp_ace_flags_fileinherit = -1;
948 static int hf_afp_ace_flags_dirinherit = -1;
949 static int hf_afp_ace_flags_limitinherit = -1;
950 static int hf_afp_ace_flags_onlyinherit = -1;
952 /* AFP 3.2 ACE flags */
953 #define ACE_ALLOW (1 << 0)
954 #define ACE_DENY (1 << 1)
955 #define ACE_INHERITED (1 << 4)
956 #define ACE_FILE_INHERIT (1 << 5)
957 #define ACE_DIR_INHERIT (1 << 6)
958 #define ACE_LIMIT_INHERIT (1 << 7)
959 #define ACE_ONLY_INHERIT (1 << 8)
961 static int ett_afp_ace_entries = -1;
962 static int ett_afp_ace_entry = -1;
964 /* AFP 3.2 ACL access right cf page 248*/
965 #define KAUTH_VNODE_READ_DATA (1 << 1)
966 #define KAUTH_VNODE_LIST_DIRECTORY KAUTH_VNODE_READ_DATA
967 #define KAUTH_VNODE_WRITE_DATA (1 << 2)
968 #define KAUTH_VNODE_ADD_FILE KAUTH_VNODE_WRITE_DATA
969 #define KAUTH_VNODE_EXECUTE (1 << 3)
970 #define KAUTH_VNODE_SEARCH KAUTH_VNODE_EXECUTE
971 #define KAUTH_VNODE_DELETE (1 << 4)
972 #define KAUTH_VNODE_APPEND_DATA (1 << 5)
973 #define KAUTH_VNODE_ADD_SUBDIRECTORY KAUTH_VNODE_APPEND_DATA
974 #define KAUTH_VNODE_DELETE_CHILD (1 << 6)
975 #define KAUTH_VNODE_READ_ATTRIBUTES (1 << 7)
976 #define KAUTH_VNODE_WRITE_ATTRIBUTES (1 << 8)
977 #define KAUTH_VNODE_READ_EXTATTRIBUTES (1 << 9)
978 #define KAUTH_VNODE_WRITE_EXTATTRIBUTES (1 << 10)
979 #define KAUTH_VNODE_READ_SECURITY (1 << 11)
980 #define KAUTH_VNODE_WRITE_SECURITY (1 << 12)
981 #define KAUTH_VNODE_CHANGE_OWNER (1 << 13)
982 #define KAUTH_VNODE_SYNCHRONIZE (1 << 20)
983 #define KAUTH_VNODE_GENERIC_ALL (1 << 21)
984 #define KAUTH_VNODE_GENERIC_EXECUTE (1 << 22)
985 #define KAUTH_VNODE_GENERIC_WRITE (1 << 23)
986 #define KAUTH_VNODE_GENERIC_READ (1 << 24)
989 static int hf_afp_acl_access_bitmap = -1;
990 static int ett_afp_acl_access_bitmap = -1;
991 static int hf_afp_acl_access_bitmap_read_data = -1;
992 static int hf_afp_acl_access_bitmap_write_data = -1;
993 static int hf_afp_acl_access_bitmap_execute = -1;
994 static int hf_afp_acl_access_bitmap_delete = -1;
995 static int hf_afp_acl_access_bitmap_append_data = -1;
996 static int hf_afp_acl_access_bitmap_delete_child = -1;
997 static int hf_afp_acl_access_bitmap_read_attrs = -1;
998 static int hf_afp_acl_access_bitmap_write_attrs = -1;
999 static int hf_afp_acl_access_bitmap_read_extattrs = -1;
1000 static int hf_afp_acl_access_bitmap_write_extattrs = -1;
1001 static int hf_afp_acl_access_bitmap_read_security = -1;
1002 static int hf_afp_acl_access_bitmap_write_security = -1;
1003 static int hf_afp_acl_access_bitmap_change_owner = -1;
1004 static int hf_afp_acl_access_bitmap_synchronize = -1;
1005 static int hf_afp_acl_access_bitmap_generic_all = -1;
1006 static int hf_afp_acl_access_bitmap_generic_execute = -1;
1007 static int hf_afp_acl_access_bitmap_generic_write = -1;
1008 static int hf_afp_acl_access_bitmap_generic_read = -1;
1011 #define hash_init_count 20
1013 /* Hash functions */
1014 static gint afp_equal (gconstpointer v, gconstpointer v2);
1015 static guint afp_hash (gconstpointer v);
1018 guint32 conversation;
1022 static GHashTable *afp_request_hash = NULL;
1024 static guint Vol; /* volume */
1025 static guint Did; /* parent directory ID */
1027 #define SPOTLIGHT_BIG_ENDIAN 0
1028 #define SPOTLIGHT_LITTLE_ENDIAN 1
1030 static gint spotlight_endianess;
1033 spotlight_ntoh64(tvbuff_t *tvb, gint offset)
1035 if (spotlight_endianess == SPOTLIGHT_LITTLE_ENDIAN)
1036 return tvb_get_letoh64(tvb, offset);
1038 return tvb_get_ntoh64(tvb, offset);
1041 /* Hash Functions */
1042 static gint afp_equal (gconstpointer v, gconstpointer v2)
1044 const afp_request_key *val1 = (const afp_request_key*)v;
1045 const afp_request_key *val2 = (const afp_request_key*)v2;
1047 if (val1->conversation == val2->conversation &&
1048 val1->seq == val2->seq) {
1054 static guint afp_hash (gconstpointer v)
1056 const afp_request_key *afp_key = (const afp_request_key*)v;
1057 return afp_key->seq;
1060 /* --------------------------
1062 #define PAD(x) { proto_tree_add_item(tree, hf_afp_pad, tvb, offset, x, FALSE); offset += x; }
1065 decode_vol_bitmap (proto_tree *tree, tvbuff_t *tvb, gint offset)
1067 proto_tree *sub_tree = NULL;
1071 bitmap = tvb_get_ntohs(tvb, offset);
1073 item = proto_tree_add_item(tree, hf_afp_vol_bitmap, tvb, offset, 2,FALSE);
1074 sub_tree = proto_item_add_subtree(item, ett_afp_vol_bitmap);
1076 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_Attributes, tvb, offset, 2,FALSE);
1077 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_Signature, tvb, offset, 2,FALSE);
1078 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_CreateDate, tvb, offset, 2,FALSE);
1079 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_ModDate, tvb, offset, 2,FALSE);
1080 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_BackupDate, tvb, offset, 2,FALSE);
1081 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_ID, tvb, offset, 2,FALSE);
1082 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_BytesFree, tvb, offset, 2,FALSE);
1083 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_BytesTotal, tvb, offset, 2,FALSE);
1084 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_Name, tvb, offset, 2,FALSE);
1085 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_ExtBytesFree, tvb, offset, 2,FALSE);
1086 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_ExtBytesTotal, tvb, offset, 2,FALSE);
1087 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_BlockSize , tvb, offset, 2,FALSE);
1093 /* -------------------------- */
1095 decode_vol_attribute (proto_tree *tree, tvbuff_t *tvb, gint offset)
1097 proto_tree *sub_tree = NULL;
1101 bitmap = tvb_get_ntohs(tvb, offset);
1103 item = proto_tree_add_item(tree, hf_afp_vol_attribute, tvb, offset, 2,FALSE);
1104 sub_tree = proto_item_add_subtree(item, ett_afp_vol_attribute);
1106 proto_tree_add_item(sub_tree, hf_afp_vol_attribute_ReadOnly ,tvb, offset, 2,FALSE);
1107 proto_tree_add_item(sub_tree, hf_afp_vol_attribute_HasVolumePassword ,tvb, offset, 2,FALSE);
1108 proto_tree_add_item(sub_tree, hf_afp_vol_attribute_SupportsFileIDs ,tvb, offset, 2,FALSE);
1109 proto_tree_add_item(sub_tree, hf_afp_vol_attribute_SupportsCatSearch ,tvb, offset, 2,FALSE);
1110 proto_tree_add_item(sub_tree, hf_afp_vol_attribute_SupportsBlankAccessPrivs,tvb, offset, 2,FALSE);
1111 proto_tree_add_item(sub_tree, hf_afp_vol_attribute_SupportsUnixPrivs ,tvb, offset, 2,FALSE);
1112 proto_tree_add_item(sub_tree, hf_afp_vol_attribute_SupportsUTF8Names ,tvb, offset, 2,FALSE);
1113 proto_tree_add_item(sub_tree, hf_afp_vol_attribute_NoNetworkUserID ,tvb, offset, 2,FALSE);
1114 proto_tree_add_item(sub_tree, hf_afp_vol_attribute_DefaultPrivsFromParent ,tvb, offset, 2,FALSE);
1115 proto_tree_add_item(sub_tree, hf_afp_vol_attribute_NoExchangeFiles ,tvb, offset, 2,FALSE);
1116 proto_tree_add_item(sub_tree, hf_afp_vol_attribute_SupportsExtAttrs ,tvb, offset, 2,FALSE);
1117 proto_tree_add_item(sub_tree, hf_afp_vol_attribute_SupportsACLs ,tvb, offset, 2,FALSE);
1118 proto_tree_add_item(sub_tree, hf_afp_vol_attribute_CaseSensitive ,tvb, offset, 2,FALSE);
1119 proto_tree_add_item(sub_tree, hf_afp_vol_attribute_SupportsTMLockSteal ,tvb, offset, 2,FALSE);
1125 /* --------------------------
1126 cf AFP3.0.pdf page 38
1127 date are number of seconds from 12:00am on 01.01.2000 GMT
1128 backup : 0x8000000 not set
1129 from netatalk adouble.h
1131 #define DATE_NOT_SET 0x80000000
1132 #define AD_DATE_DELTA 946684800
1133 #define AD_DATE_TO_UNIX(x) (x + AD_DATE_DELTA)
1135 print_date(proto_tree *tree,int id, tvbuff_t *tvb, gint offset)
1137 time_t date = tvb_get_ntohl(tvb, offset);
1140 tv.secs = AD_DATE_TO_UNIX(date);
1142 proto_tree_add_time(tree, id, tvb, offset, 4, &tv);
1145 /* -------------------------- */
1147 parse_vol_bitmap (proto_tree *tree, tvbuff_t *tvb, gint offset, guint16 bitmap)
1149 guint16 nameoff = 0;
1151 if ((bitmap & kFPVolAttributeBit)) {
1152 decode_vol_attribute(tree,tvb,offset);
1155 if ((bitmap & kFPVolSignatureBit)) {
1156 proto_tree_add_item(tree, hf_afp_vol_signature,tvb, offset, 2, FALSE);
1159 if ((bitmap & kFPVolCreateDateBit)) {
1160 print_date(tree, hf_afp_vol_creation_date,tvb, offset);
1163 if ((bitmap & kFPVolModDateBit)) {
1164 print_date(tree, hf_afp_vol_modification_date,tvb, offset);
1167 if ((bitmap & kFPVolBackupDateBit)) {
1168 print_date(tree, hf_afp_vol_backup_date,tvb, offset);
1171 if ((bitmap & kFPVolIDBit)) {
1172 proto_tree_add_item(tree, hf_afp_vol_id, tvb, offset, 2,FALSE);
1175 if ((bitmap & kFPVolBytesFreeBit)) {
1176 proto_tree_add_item(tree, hf_afp_vol_bytes_free,tvb, offset, 4, FALSE);
1179 if ((bitmap & kFPVolBytesTotalBit)) {
1180 proto_tree_add_item(tree, hf_afp_vol_bytes_total,tvb, offset, 4, FALSE);
1183 if ((bitmap & kFPVolNameBit)) {
1184 nameoff = tvb_get_ntohs(tvb, offset);
1185 proto_tree_add_item(tree, hf_afp_vol_name_offset,tvb, offset, 2, FALSE);
1188 if ((bitmap & kFPVolExtBytesFreeBit)) {
1189 proto_tree_add_item(tree, hf_afp_vol_ex_bytes_free,tvb, offset, 8, FALSE);
1192 if ((bitmap & kFPVolExtBytesTotalBit)) {
1193 proto_tree_add_item(tree, hf_afp_vol_ex_bytes_total,tvb, offset, 8, FALSE);
1196 if ((bitmap & kFPVolBlockSizeBit)) {
1197 proto_tree_add_item(tree, hf_afp_vol_block_size,tvb, offset, 4, FALSE);
1203 len = tvb_get_guint8(tvb, offset);
1204 proto_tree_add_item(tree, hf_afp_vol_name, tvb, offset, 1,FALSE);
1211 /* -------------------------- */
1213 decode_file_bitmap (proto_tree *tree, tvbuff_t *tvb, gint offset)
1215 proto_tree *sub_tree = NULL;
1219 bitmap = tvb_get_ntohs(tvb, offset);
1221 item = proto_tree_add_item(tree, hf_afp_file_bitmap, tvb, offset, 2,FALSE);
1222 sub_tree = proto_item_add_subtree(item, ett_afp_file_bitmap);
1224 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_Attributes , tvb, offset, 2,FALSE);
1225 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_ParentDirID , tvb, offset, 2,FALSE);
1226 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_CreateDate , tvb, offset, 2,FALSE);
1227 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_ModDate , tvb, offset, 2,FALSE);
1228 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_BackupDate , tvb, offset, 2,FALSE);
1229 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_FinderInfo , tvb, offset, 2,FALSE);
1230 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_LongName , tvb, offset, 2,FALSE);
1231 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_ShortName , tvb, offset, 2,FALSE);
1232 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_NodeID , tvb, offset, 2,FALSE);
1234 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_DataForkLen , tvb, offset, 2,FALSE);
1235 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_RsrcForkLen , tvb, offset, 2,FALSE);
1236 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_ExtDataForkLen , tvb, offset, 2,FALSE);
1237 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_LaunchLimit , tvb, offset, 2,FALSE);
1238 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_UTF8Name , tvb, offset, 2,FALSE);
1240 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_ExtRsrcForkLen , tvb, offset, 2,FALSE);
1241 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_UnixPrivs , tvb, offset, 2,FALSE);
1247 /* -------------------------- */
1249 decode_file_attribute(proto_tree *tree, tvbuff_t *tvb, gint offset, int shared)
1251 proto_tree *sub_tree = NULL;
1255 attribute = tvb_get_ntohs(tvb, offset);
1259 item = proto_tree_add_text(tree, tvb, offset, 2,
1260 "File Attributes: 0x%04x", attribute);
1261 sub_tree = proto_item_add_subtree(item, ett_afp_file_attribute);
1262 proto_tree_add_item(sub_tree, hf_afp_file_attribute_Invisible , tvb, offset, 2,FALSE);
1264 proto_tree_add_item(sub_tree, hf_afp_file_attribute_MultiUser , tvb, offset, 2,FALSE);
1266 proto_tree_add_item(sub_tree, hf_afp_file_attribute_System , tvb, offset, 2,FALSE);
1269 proto_tree_add_item(sub_tree, hf_afp_file_attribute_DAlreadyOpen , tvb, offset, 2,FALSE);
1270 proto_tree_add_item(sub_tree, hf_afp_file_attribute_RAlreadyOpen , tvb, offset, 2,FALSE);
1272 /* writeinhibit is file only but Macs are setting it with FPSetFileDirParms too */
1273 proto_tree_add_item(sub_tree, hf_afp_file_attribute_WriteInhibit , tvb, offset, 2,FALSE);
1274 proto_tree_add_item(sub_tree, hf_afp_file_attribute_BackUpNeeded , tvb, offset, 2,FALSE);
1275 proto_tree_add_item(sub_tree, hf_afp_file_attribute_RenameInhibit, tvb, offset, 2,FALSE);
1276 proto_tree_add_item(sub_tree, hf_afp_file_attribute_DeleteInhibit, tvb, offset, 2,FALSE);
1279 proto_tree_add_item(sub_tree, hf_afp_file_attribute_CopyProtect , tvb, offset, 2,FALSE);
1281 proto_tree_add_item(sub_tree, hf_afp_file_attribute_SetClear , tvb, offset, 2,FALSE);
1287 decode_access_rights (proto_tree *tree, tvbuff_t *tvb, int hf, gint offset)
1289 proto_tree *sub_tree;
1293 item = proto_tree_add_item(tree, hf, tvb, offset, 4, FALSE);
1294 sub_tree = proto_item_add_subtree(item, ett_afp_dir_ar);
1296 proto_tree_add_item(sub_tree, hf_afp_dir_ar_o_search, tvb, offset, 4, FALSE);
1297 proto_tree_add_item(sub_tree, hf_afp_dir_ar_o_read , tvb, offset, 4, FALSE);
1298 proto_tree_add_item(sub_tree, hf_afp_dir_ar_o_write , tvb, offset, 4, FALSE);
1300 proto_tree_add_item(sub_tree, hf_afp_dir_ar_g_search, tvb, offset, 4, FALSE);
1301 proto_tree_add_item(sub_tree, hf_afp_dir_ar_g_read , tvb, offset, 4, FALSE);
1302 proto_tree_add_item(sub_tree, hf_afp_dir_ar_g_write , tvb, offset, 4, FALSE);
1304 proto_tree_add_item(sub_tree, hf_afp_dir_ar_e_search, tvb, offset, 4, FALSE);
1305 proto_tree_add_item(sub_tree, hf_afp_dir_ar_e_read , tvb, offset, 4, FALSE);
1306 proto_tree_add_item(sub_tree, hf_afp_dir_ar_e_write , tvb, offset, 4, FALSE);
1308 proto_tree_add_item(sub_tree, hf_afp_dir_ar_u_search, tvb, offset, 4, FALSE);
1309 proto_tree_add_item(sub_tree, hf_afp_dir_ar_u_read , tvb, offset, 4, FALSE);
1310 proto_tree_add_item(sub_tree, hf_afp_dir_ar_u_write , tvb, offset, 4, FALSE);
1312 proto_tree_add_item(sub_tree, hf_afp_dir_ar_blank , tvb, offset, 4, FALSE);
1313 proto_tree_add_item(sub_tree, hf_afp_dir_ar_u_own , tvb, offset, 4, FALSE);
1318 decode_unix_privs (proto_tree *tree, tvbuff_t *tvb, gint offset)
1320 proto_tree *sub_tree;
1324 item = proto_tree_add_text(tree, tvb, offset, 16,
1326 sub_tree = proto_item_add_subtree(item, ett_afp_unix_privs);
1328 proto_tree_add_item(sub_tree, hf_afp_unix_privs_uid, tvb, offset, 4, FALSE);
1329 proto_tree_add_item(sub_tree, hf_afp_unix_privs_gid, tvb, offset+4, 4, FALSE);
1330 proto_tree_add_item(sub_tree, hf_afp_unix_privs_permissions, tvb, offset+8, 4, FALSE);
1331 decode_access_rights(sub_tree, tvb, hf_afp_unix_privs_ua_permissions, offset+12);
1335 /* -------------------------- */
1337 parse_long_filename(proto_tree *tree, tvbuff_t *tvb, gint offset, gint org_offset)
1343 lnameoff = tvb_get_ntohs(tvb, offset);
1344 proto_tree_add_item(tree, hf_afp_long_name_offset,tvb, offset, 2, FALSE);
1346 tp_ofs = lnameoff +org_offset;
1347 len = tvb_get_guint8(tvb, tp_ofs);
1348 proto_tree_add_item(tree, hf_afp_path_len, tvb, tp_ofs, 1,FALSE);
1350 proto_tree_add_item(tree, hf_afp_path_name, tvb, tp_ofs, len,FALSE);
1356 /* -------------------------- */
1358 parse_UTF8_filename(proto_tree *tree, tvbuff_t *tvb, gint offset, gint org_offset)
1364 unameoff = tvb_get_ntohs(tvb, offset);
1365 proto_tree_add_item(tree, hf_afp_unicode_name_offset,tvb, offset, 2, FALSE);
1368 /* FIXME AFP3.x reuses PDINFO bit for UTF8.
1369 * In enumerate_ext it's pad with 4 bytes, PDINFO was 6 bytes,
1370 * but not in catsearch_ext.
1371 * Last but not least there's a bug in OSX catsearch_ext for spec2
1372 * offset is off by 2 bytes.
1375 tp_ofs = unameoff +org_offset;
1376 if (tp_ofs > offset) {
1379 else if (tp_ofs < offset) {
1382 proto_tree_add_item( tree, hf_afp_path_unicode_hint, tvb, tp_ofs, 4,FALSE);
1385 len = tvb_get_ntohs(tvb, tp_ofs);
1386 proto_tree_add_item( tree, hf_afp_path_unicode_len, tvb, tp_ofs, 2,FALSE);
1389 proto_tree_add_item(tree, hf_afp_path_name, tvb, tp_ofs, len,FALSE);
1395 /* -------------------------- */
1397 parse_file_bitmap (proto_tree *tree, tvbuff_t *tvb, gint offset, guint16 bitmap, int shared)
1399 /* guint16 snameoff = 0; */
1400 gint max_offset = 0;
1402 gint org_offset = offset;
1404 if ((bitmap & kFPAttributeBit)) {
1405 decode_file_attribute(tree, tvb, offset, shared);
1408 if ((bitmap & kFPParentDirIDBit)) {
1409 proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4,FALSE);
1412 if ((bitmap & kFPCreateDateBit)) {
1413 print_date(tree, hf_afp_creation_date,tvb, offset);
1416 if ((bitmap & kFPModDateBit)) {
1417 print_date(tree, hf_afp_modification_date,tvb, offset);
1420 if ((bitmap & kFPBackupDateBit)) {
1421 print_date(tree, hf_afp_backup_date,tvb, offset);
1424 if ((bitmap & kFPFinderInfoBit)) {
1425 proto_tree_add_item(tree, hf_afp_finder_info,tvb, offset, 32, FALSE);
1428 if ((bitmap & kFPLongNameBit)) {
1431 tp_ofs = parse_long_filename(tree, tvb, offset, org_offset);
1432 max_offset = (tp_ofs >max_offset)?tp_ofs:max_offset;
1437 if ((bitmap & kFPShortNameBit)) {
1438 /* snameoff = tvb_get_ntohs(tvb, offset); */
1439 proto_tree_add_item(tree, hf_afp_short_name_offset,tvb, offset, 2, FALSE);
1442 if ((bitmap & kFPNodeIDBit)) {
1443 proto_tree_add_item(tree, hf_afp_file_id, tvb, offset, 4,FALSE);
1447 if ((bitmap & kFPDataForkLenBit)) {
1448 proto_tree_add_item(tree, hf_afp_file_DataForkLen, tvb, offset, 4,FALSE);
1452 if ((bitmap & kFPRsrcForkLenBit)) {
1453 proto_tree_add_item(tree, hf_afp_file_RsrcForkLen, tvb, offset, 4,FALSE);
1457 if ((bitmap & kFPExtDataForkLenBit)) {
1458 proto_tree_add_item(tree, hf_afp_file_ExtDataForkLen, tvb, offset, 8,FALSE);
1462 if ((bitmap & kFPLaunchLimitBit)) {
1463 offset += 2; /* ? */
1466 if ((bitmap & kFPUTF8NameBit)) {
1469 tp_ofs = parse_UTF8_filename(tree, tvb, offset, org_offset);
1470 max_offset = (tp_ofs >max_offset)?tp_ofs:max_offset;
1474 if ((bitmap & kFPExtRsrcForkLenBit)) {
1475 proto_tree_add_item(tree, hf_afp_file_ExtRsrcForkLen, tvb, offset, 8,FALSE);
1479 if ((bitmap & kFPUnixPrivsBit)) {
1481 * XXX - the AFP 3.0 spec says this is "Four bytes", but
1482 * also says the privileges are "stored in an FPUnixPrivs
1483 * structure", which is 16 bytes long.
1485 * We assume, for now, that the latter is true.
1487 decode_unix_privs(tree, tvb, offset);
1491 return (max_offset)?max_offset:offset;
1494 /* -------------------------- */
1496 decode_dir_bitmap (proto_tree *tree, tvbuff_t *tvb, gint offset)
1498 proto_tree *sub_tree = NULL;
1502 bitmap = tvb_get_ntohs(tvb, offset);
1504 item = proto_tree_add_item(tree, hf_afp_dir_bitmap, tvb, offset, 2,FALSE);
1505 sub_tree = proto_item_add_subtree(item, ett_afp_dir_bitmap);
1507 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_Attributes , tvb, offset, 2,FALSE);
1508 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_ParentDirID , tvb, offset, 2,FALSE);
1509 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_CreateDate , tvb, offset, 2,FALSE);
1510 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_ModDate , tvb, offset, 2,FALSE);
1511 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_BackupDate , tvb, offset, 2,FALSE);
1512 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_FinderInfo , tvb, offset, 2,FALSE);
1513 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_LongName , tvb, offset, 2,FALSE);
1514 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_ShortName , tvb, offset, 2,FALSE);
1515 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_NodeID , tvb, offset, 2,FALSE);
1516 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_OffspringCount , tvb, offset, 2,FALSE);
1517 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_OwnerID , tvb, offset, 2,FALSE);
1518 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_GroupID , tvb, offset, 2,FALSE);
1519 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_AccessRights , tvb, offset, 2,FALSE);
1520 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_UTF8Name , tvb, offset, 2,FALSE);
1521 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_UnixPrivs , tvb, offset, 2,FALSE);
1527 /* -------------------------- */
1529 decode_dir_attribute(proto_tree *tree, tvbuff_t *tvb, gint offset)
1531 proto_tree *sub_tree = NULL;
1535 attribute = tvb_get_ntohs(tvb, offset);
1537 item = proto_tree_add_text(tree, tvb, offset, 2,
1538 "Directory Attributes: 0x%04x", attribute);
1539 sub_tree = proto_item_add_subtree(item, ett_afp_dir_attribute);
1541 proto_tree_add_item(sub_tree, hf_afp_dir_attribute_Invisible , tvb, offset, 2,FALSE);
1542 proto_tree_add_item(sub_tree, hf_afp_dir_attribute_IsExpFolder , tvb, offset, 2,FALSE);
1543 proto_tree_add_item(sub_tree, hf_afp_dir_attribute_System , tvb, offset, 2,FALSE);
1544 proto_tree_add_item(sub_tree, hf_afp_dir_attribute_Mounted , tvb, offset, 2,FALSE);
1545 proto_tree_add_item(sub_tree, hf_afp_dir_attribute_InExpFolder , tvb, offset, 2,FALSE);
1546 proto_tree_add_item(sub_tree, hf_afp_dir_attribute_BackUpNeeded , tvb, offset, 2,FALSE);
1547 proto_tree_add_item(sub_tree, hf_afp_dir_attribute_RenameInhibit, tvb, offset, 2,FALSE);
1548 proto_tree_add_item(sub_tree, hf_afp_dir_attribute_DeleteInhibit, tvb, offset, 2,FALSE);
1554 /* -------------------------- */
1556 parse_dir_bitmap (proto_tree *tree, tvbuff_t *tvb, gint offset, guint16 bitmap)
1558 /* guint16 snameoff = 0; */
1559 gint max_offset = 0;
1561 gint org_offset = offset;
1563 if ((bitmap & kFPAttributeBit)) {
1564 decode_dir_attribute(tree, tvb, offset);
1567 if ((bitmap & kFPParentDirIDBit)) {
1568 proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4,FALSE);
1571 if ((bitmap & kFPCreateDateBit)) {
1572 print_date(tree, hf_afp_creation_date,tvb, offset);
1575 if ((bitmap & kFPModDateBit)) {
1576 print_date(tree, hf_afp_modification_date,tvb, offset);
1579 if ((bitmap & kFPBackupDateBit)) {
1580 print_date(tree, hf_afp_backup_date,tvb, offset);
1583 if ((bitmap & kFPFinderInfoBit)) {
1584 proto_tree_add_item(tree, hf_afp_finder_info,tvb, offset, 32, FALSE);
1587 if ((bitmap & kFPLongNameBit)) {
1590 tp_ofs = parse_long_filename(tree, tvb, offset, org_offset);
1591 max_offset = (tp_ofs >max_offset)?tp_ofs:max_offset;
1595 if ((bitmap & kFPShortNameBit)) {
1596 /* snameoff = tvb_get_ntohs(tvb, offset); */
1597 proto_tree_add_item(tree, hf_afp_short_name_offset,tvb, offset, 2, FALSE);
1600 if ((bitmap & kFPNodeIDBit)) {
1601 proto_tree_add_item(tree, hf_afp_file_id, tvb, offset, 4,FALSE);
1604 if ((bitmap & kFPOffspringCountBit)) {
1605 proto_tree_add_item(tree, hf_afp_dir_offspring, tvb, offset, 2,FALSE);
1606 offset += 2; /* error in AFP3.0.pdf */
1608 if ((bitmap & kFPOwnerIDBit)) {
1609 proto_tree_add_item(tree, hf_afp_dir_OwnerID, tvb, offset, 4, FALSE);
1612 if ((bitmap & kFPGroupIDBit)) {
1613 proto_tree_add_item(tree, hf_afp_dir_GroupID, tvb, offset, 4, FALSE);
1616 if ((bitmap & kFPAccessRightsBit)) {
1617 decode_access_rights(tree, tvb, hf_afp_dir_ar, offset);
1620 if ((bitmap & kFPUTF8NameBit)) {
1623 tp_ofs = parse_UTF8_filename(tree, tvb, offset, org_offset);
1624 max_offset = (tp_ofs >max_offset)?tp_ofs:max_offset;
1627 if ((bitmap & kFPUnixPrivsBit)) {
1629 * XXX - the AFP 3.0 spec says this is "Four bytes", but
1630 * also says the privileges are "stored in an FPUnixPrivs
1631 * structure", which is 16 bytes long.
1633 * We assume, for now, that the latter is true.
1635 decode_unix_privs(tree, tvb, offset);
1638 return (max_offset)?max_offset:offset;
1641 /* -------------------------- */
1643 name_in_bitmap(tvbuff_t *tvb, gint offset, guint16 bitmap, int isdir)
1646 gint org_offset = offset;
1652 if ((bitmap & kFPAttributeBit)) /* 0 */
1654 if ((bitmap & kFPParentDirIDBit)) /* 1 */
1656 if ((bitmap & kFPCreateDateBit)) /* 2 */
1658 if ((bitmap & kFPModDateBit)) /* 3 */
1660 if ((bitmap & kFPBackupDateBit)) /* 4 */
1662 if ((bitmap & kFPFinderInfoBit)) /* 5 */
1665 if ((bitmap & kFPLongNameBit)) { /* 6 */
1666 nameoff = tvb_get_ntohs(tvb, offset);
1668 tp_ofs = nameoff +org_offset;
1669 len = tvb_get_guint8(tvb, tp_ofs);
1671 name = tvb_get_ephemeral_string(tvb, tp_ofs, len);
1677 if ((bitmap & kFPShortNameBit)) /* 7 */
1679 if ((bitmap & kFPNodeIDBit)) /* 8 */
1683 if ((bitmap & kFPOffspringCountBit)) /* 9 */
1685 if ((bitmap & kFPOwnerIDBit)) /* 10*/
1687 if ((bitmap & kFPGroupIDBit)) /* 11*/
1689 if ((bitmap & kFPAccessRightsBit)) /* 12*/
1693 if ((bitmap & kFPDataForkLenBit)) /* 9 */
1695 if ((bitmap & kFPRsrcForkLenBit)) /* 10*/
1697 if ((bitmap & kFPExtDataForkLenBit)) /* 11*/
1699 if ((bitmap & kFPLaunchLimitBit)) /* 12*/
1700 offset += 2; /* FIXME ? */
1703 if ((bitmap & kFPUTF8NameBit)) { /* 13 */
1704 nameoff = tvb_get_ntohs(tvb, offset);
1706 tp_ofs = nameoff +org_offset +4;
1707 len16 = tvb_get_ntohs(tvb, tp_ofs);
1709 name = tvb_get_ephemeral_string(tvb, tp_ofs, len16);
1716 /* -------------------------- */
1718 name_in_dbitmap(tvbuff_t *tvb, gint offset, guint16 bitmap)
1722 name = name_in_bitmap(tvb, offset, bitmap, 1);
1732 /* -------------------------- */
1734 name_in_fbitmap(tvbuff_t *tvb, gint offset, guint16 bitmap)
1738 name = name_in_bitmap(tvb, offset, bitmap, 0);
1748 /* -------------------------- */
1750 decode_vol(proto_tree *tree, tvbuff_t *tvb, gint offset)
1752 Vol = tvb_get_ntohs(tvb, offset);
1753 proto_tree_add_item(tree, hf_afp_vol_id, tvb, offset, 2,FALSE);
1757 /* -------------------------- */
1759 decode_vol_did(proto_tree *tree, tvbuff_t *tvb, gint offset)
1761 Vol = tvb_get_ntohs(tvb, offset);
1762 proto_tree_add_item(tree, hf_afp_vol_id, tvb, offset, 2,FALSE);
1765 Did = tvb_get_ntohl(tvb, offset);
1766 proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4,FALSE);
1771 /* -------------------------- */
1773 decode_vol_did_file_dir_bitmap (proto_tree *tree, tvbuff_t *tvb, gint offset)
1775 offset = decode_vol_did(tree, tvb, offset);
1777 decode_file_bitmap(tree, tvb, offset);
1780 decode_dir_bitmap(tree, tvb, offset);
1786 /* ------------------------ */
1787 static const gchar *
1788 get_name(tvbuff_t *tvb, int offset, int type)
1791 const gchar *string;
1796 len = tvb_get_guint8(tvb, offset);
1798 string = tvb_format_text(tvb,offset, len);
1801 len = tvb_get_ntohs(tvb, offset +4);
1803 string = tvb_format_text(tvb,offset, len);
1806 string = "Unknown type";
1811 /* -------------------------- */
1813 decode_name_label (proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, gint offset, const gchar *label)
1819 proto_tree *sub_tree = NULL;
1822 type = tvb_get_guint8(tvb, offset);
1825 len = tvb_get_ntohs(tvb, offset +5);
1829 len = tvb_get_guint8(tvb, offset +1);
1831 name = get_name(tvb, offset +1, type);
1834 col_append_fstr(pinfo->cinfo, COL_INFO, ": Vol=%u Did=%u", Vol, Did);
1836 col_append_fstr(pinfo->cinfo, COL_INFO, " Name=%s", name);
1841 item = proto_tree_add_text(tree, tvb, offset, len +header, label, name);
1842 sub_tree = proto_item_add_subtree(item, ett_afp_path_name);
1844 proto_tree_add_item( sub_tree, hf_afp_path_type, tvb, offset, 1,FALSE);
1847 proto_tree_add_item( sub_tree, hf_afp_path_unicode_hint, tvb, offset, 4,FALSE);
1849 proto_tree_add_item( sub_tree, hf_afp_path_unicode_len, tvb, offset, 2,FALSE);
1853 proto_tree_add_item( sub_tree, hf_afp_path_len, tvb, offset, 1,FALSE);
1857 proto_tree_add_string(sub_tree, hf_afp_path_name, tvb, offset, len,name);
1865 /* -------------------------- */
1867 decode_name (proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, gint offset)
1869 return decode_name_label(tree, pinfo, tvb, offset, "Path: %s");
1872 /* -------------------------- */
1874 add_info_fork(tvbuff_t *tvb, packet_info *pinfo, gint offset)
1878 ofork = tvb_get_ntohs(tvb, offset);
1880 col_append_fstr(pinfo->cinfo, COL_INFO, ": Fork=%u", ofork);
1884 /* -------------------------- */
1886 add_info_vol(tvbuff_t *tvb, packet_info *pinfo, gint offset)
1890 vol = tvb_get_ntohs(tvb, offset);
1891 col_append_fstr(pinfo->cinfo, COL_INFO, ": Vol=%u", vol);
1894 /* ************************** */
1896 dissect_query_afp_open_vol(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
1903 decode_vol_bitmap(tree, tvb, offset);
1906 len = tvb_get_guint8(tvb, offset);
1908 rep = get_name(tvb, offset, 2);
1909 col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", rep);
1914 proto_tree_add_item(tree, hf_afp_vol_name, tvb, offset, 1,FALSE);
1917 len = tvb_reported_length_remaining(tvb,offset);
1919 /* optionnal password */
1920 proto_tree_add_item(tree, hf_afp_passwd, tvb, offset, 8,FALSE);
1926 /* -------------------------- */
1928 dissect_reply_afp_open_vol(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
1934 bitmap = decode_vol_bitmap(tree, tvb, offset);
1936 offset = parse_vol_bitmap(tree, tvb, offset, bitmap);
1941 /* ************************** */
1943 dissect_reply_afp_get_server_param(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
1949 proto_tree *sub_tree = NULL;
1950 proto_tree *flag_tree;
1957 print_date(tree, hf_afp_server_time,tvb, offset);
1960 num = tvb_get_guint8(tvb, offset);
1961 item = proto_tree_add_text(tree, tvb, offset, 1, "Volumes : %d", num);
1962 sub_tree = proto_item_add_subtree(item, ett_afp_server_vol);
1965 for (i = 0; i < num; i++) {
1968 item = proto_tree_add_text(sub_tree, tvb, offset, -1,"Volume");
1969 tree = proto_item_add_subtree(item, ett_afp_vol_list);
1971 flag = tvb_get_guint8(tvb, offset);
1973 ti = proto_tree_add_text(tree, tvb, offset , 1,"Flags : 0x%02x", flag);
1974 flag_tree = proto_item_add_subtree(ti, ett_afp_vol_flag);
1975 proto_tree_add_item(flag_tree, hf_afp_vol_flag_passwd, tvb, offset, 1,FALSE);
1976 proto_tree_add_item(flag_tree, hf_afp_vol_flag_has_config, tvb, offset, 1,FALSE);
1979 len = tvb_get_guint8(tvb, offset) +1;
1980 rep = get_name(tvb, offset, 2);
1981 proto_item_set_text(item, "%s", rep);
1982 proto_item_set_len(item, len +1);
1984 proto_tree_add_item(tree, hf_afp_vol_name, tvb, offset, 1,FALSE);
1991 /* **************************
1992 next calls use the same format :
2000 dissect_query_afp_with_vol_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2007 proto_tree_add_item(tree, hf_afp_vol_id, tvb, offset, 2,FALSE);
2012 /* ************************** */
2014 dissect_query_afp_open_fork(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2016 proto_tree *sub_tree = NULL;
2019 proto_tree_add_item(tree, hf_afp_fork_type, tvb, offset, 1,FALSE);
2022 offset = decode_vol_did(tree, tvb, offset);
2024 decode_file_bitmap(tree, tvb, offset);
2027 item = proto_tree_add_item(tree, hf_afp_access_mode, tvb, offset, 2,FALSE);
2028 sub_tree = proto_item_add_subtree(item, ett_afp_access_mode);
2030 proto_tree_add_item(sub_tree, hf_afp_access_read , tvb, offset, 2,FALSE);
2031 proto_tree_add_item(sub_tree, hf_afp_access_write , tvb, offset, 2,FALSE);
2032 proto_tree_add_item(sub_tree, hf_afp_access_deny_read , tvb, offset, 2,FALSE);
2033 proto_tree_add_item(sub_tree, hf_afp_access_deny_write, tvb, offset, 2,FALSE);
2037 offset = decode_name(tree, pinfo, tvb, offset);
2042 /* -------------------------- */
2044 dissect_reply_afp_open_fork(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2048 f_bitmap = decode_file_bitmap(tree, tvb, offset);
2051 add_info_fork(tvb, pinfo, offset);
2052 proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2,FALSE);
2055 offset = parse_file_bitmap(tree, tvb, offset, f_bitmap,0);
2060 /* ************************** */
2062 dissect_query_afp_enumerate_ext2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2066 offset = decode_vol_did_file_dir_bitmap(tree, tvb, offset);
2068 proto_tree_add_item(tree, hf_afp_req_count, tvb, offset, 2,FALSE);
2071 proto_tree_add_item(tree, hf_afp_start_index32, tvb, offset, 4,FALSE);
2074 proto_tree_add_item(tree, hf_afp_max_reply_size32, tvb, offset, 4,FALSE);
2077 offset = decode_name(tree, pinfo, tvb, offset);
2082 /* ************************** */
2084 dissect_query_afp_enumerate(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2088 offset = decode_vol_did_file_dir_bitmap(tree, tvb, offset);
2090 proto_tree_add_item(tree, hf_afp_req_count, tvb, offset, 2,FALSE);
2093 proto_tree_add_item(tree, hf_afp_start_index, tvb, offset, 2,FALSE);
2096 proto_tree_add_item(tree, hf_afp_max_reply_size, tvb, offset, 2,FALSE);
2099 offset = decode_name(tree, pinfo, tvb, offset);
2104 /* -------------------------- */
2106 loop_record(tvbuff_t *tvb, proto_tree *ptree, gint offset,
2107 int count, guint16 d_bitmap, guint16 f_bitmap, int add, int ext)
2109 proto_tree *tree = NULL;
2118 for (i = 0; i < count; i++) {
2121 size = tvb_get_ntohs(tvb, offset) +add *2;
2125 size = tvb_get_guint8(tvb, offset) +add;
2129 return offset; /* packet is malformed */
2130 flags = tvb_get_guint8(tvb, offset +decal);
2136 name = name_in_dbitmap(tvb, offset +decal, d_bitmap);
2139 name = name_in_fbitmap(tvb, offset +decal, f_bitmap);
2142 item = proto_tree_add_text(ptree, tvb, offset, size, "%s", name);
2145 item = proto_tree_add_text(ptree, tvb, offset, size, "line %d", i+1);
2147 tree = proto_item_add_subtree(item, ett_afp_enumerate_line);
2150 proto_tree_add_item(tree, hf_afp_struct_size16, tvb, offset, 2,FALSE);
2154 proto_tree_add_item(tree, hf_afp_struct_size, tvb, offset, 1,FALSE);
2158 proto_tree_add_item(tree, hf_afp_file_flag, tvb, offset, 1,FALSE);
2164 offset = parse_dir_bitmap(tree, tvb, offset, d_bitmap);
2167 offset = parse_file_bitmap(tree, tvb, offset, f_bitmap,0);
2171 offset = org +size; /* play safe */
2175 /* ------------------------- */
2177 reply_enumerate(tvbuff_t *tvb, proto_tree *tree, gint offset, int ext)
2179 proto_tree *sub_tree = NULL;
2185 f_bitmap = decode_file_bitmap(tree, tvb, offset);
2188 d_bitmap = decode_dir_bitmap(tree, tvb, offset);
2191 count = tvb_get_ntohs(tvb, offset);
2193 item = proto_tree_add_item(tree, hf_afp_req_count, tvb, offset, 2,FALSE);
2194 sub_tree = proto_item_add_subtree(item, ett_afp_enumerate);
2198 return loop_record(tvb,sub_tree, offset, count, d_bitmap, f_bitmap,0, ext);
2201 /* ------------------------- */
2203 dissect_reply_afp_enumerate(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2205 return reply_enumerate(tvb, tree, offset, 0);
2208 /* **************************/
2210 dissect_reply_afp_enumerate_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2212 return reply_enumerate(tvb, tree, offset, 1);
2215 /* **************************/
2217 catsearch_spec(tvbuff_t *tvb, proto_tree *ptree, gint offset, int ext, guint32 bitmap, const gchar *label)
2219 proto_tree *tree = NULL;
2227 size = tvb_get_ntohs(tvb, offset) +2;
2230 size = tvb_get_guint8(tvb, offset) +2;
2233 item = proto_tree_add_text(ptree, tvb, offset, size, "%s", label);
2234 tree = proto_item_add_subtree(item, ett_afp_cat_spec);
2237 proto_tree_add_item(tree, hf_afp_struct_size16, tvb, offset, 2,FALSE);
2241 proto_tree_add_item(tree, hf_afp_struct_size, tvb, offset, 1,FALSE);
2246 offset = parse_file_bitmap(tree, tvb, offset, (guint16) bitmap,0);
2252 /* ------------------------- */
2254 query_catsearch(tvbuff_t *tvb, proto_tree *ptree, gint offset, int ext)
2256 proto_tree *tree = NULL, *sub_tree;
2266 proto_tree_add_item(ptree, hf_afp_vol_id, tvb, offset, 2,FALSE);
2269 proto_tree_add_item(ptree, hf_afp_cat_req_matches, tvb, offset, 4,FALSE);
2272 proto_tree_add_item(ptree, hf_afp_reserved, tvb, offset, 4,FALSE);
2275 proto_tree_add_item(ptree, hf_afp_cat_position, tvb, offset, 16,FALSE);
2278 f_bitmap = decode_file_bitmap(ptree, tvb, offset);
2281 d_bitmap = decode_dir_bitmap(ptree, tvb, offset);
2284 r_bitmap = tvb_get_ntohl(tvb, offset);
2285 /* Already checked this above: if (ptree) */ {
2286 item = proto_tree_add_item(ptree, hf_afp_file_bitmap, tvb, offset, 4,FALSE);
2287 sub_tree = proto_item_add_subtree(item, ett_afp_cat_r_bitmap);
2289 proto_tree_add_item(sub_tree, hf_afp_request_bitmap_Attributes , tvb, offset, 4,FALSE);
2290 proto_tree_add_item(sub_tree, hf_afp_request_bitmap_ParentDirID , tvb, offset, 4,FALSE);
2291 proto_tree_add_item(sub_tree, hf_afp_request_bitmap_CreateDate , tvb, offset, 4,FALSE);
2292 proto_tree_add_item(sub_tree, hf_afp_request_bitmap_ModDate , tvb, offset, 4,FALSE);
2293 proto_tree_add_item(sub_tree, hf_afp_request_bitmap_BackupDate , tvb, offset, 4,FALSE);
2294 proto_tree_add_item(sub_tree, hf_afp_request_bitmap_FinderInfo , tvb, offset, 4,FALSE);
2295 proto_tree_add_item(sub_tree, hf_afp_request_bitmap_LongName , tvb, offset, 4,FALSE);
2297 if (d_bitmap == 0) {
2298 /* Only for file-only searches */
2299 proto_tree_add_item(sub_tree, hf_afp_request_bitmap_DataForkLen , tvb, offset, 4,FALSE);
2300 proto_tree_add_item(sub_tree, hf_afp_request_bitmap_RsrcForkLen , tvb, offset, 4,FALSE);
2301 proto_tree_add_item(sub_tree, hf_afp_request_bitmap_ExtDataForkLen , tvb, offset, 4,FALSE);
2303 if (f_bitmap == 0) {
2304 /* Only for directory-only searches */
2305 proto_tree_add_item(sub_tree, hf_afp_request_bitmap_OffspringCount , tvb, offset, 4,FALSE);
2308 proto_tree_add_item(sub_tree, hf_afp_request_bitmap_UTF8Name , tvb, offset, 4,FALSE);
2310 if (d_bitmap == 0) {
2311 /* Only for file-only searches */
2312 proto_tree_add_item(sub_tree, hf_afp_request_bitmap_ExtRsrcForkLen , tvb, offset, 4,FALSE);
2314 proto_tree_add_item(sub_tree, hf_afp_request_bitmap_PartialNames , tvb, offset, 4,FALSE);
2319 offset = catsearch_spec(tvb, ptree, offset, ext, r_bitmap, "Spec 1");
2322 offset = catsearch_spec(tvb, ptree, offset, ext, r_bitmap, "Spec 2");
2327 /* ------------------------- */
2329 dissect_query_afp_cat_search(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *ptree, gint offset)
2331 return query_catsearch(tvb, ptree, offset, 0);
2334 /* **************************/
2336 dissect_query_afp_cat_search_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *ptree, gint offset)
2338 return query_catsearch(tvb, ptree, offset, 1);
2342 /* **************************/
2344 reply_catsearch(tvbuff_t *tvb, proto_tree *tree, gint offset, int ext)
2346 proto_tree *sub_tree = NULL;
2352 proto_tree_add_item(tree, hf_afp_cat_position, tvb, offset, 16,FALSE);
2355 f_bitmap = decode_file_bitmap(tree, tvb, offset);
2358 d_bitmap = decode_dir_bitmap(tree, tvb, offset);
2361 count = tvb_get_ntohl(tvb, offset);
2363 item = proto_tree_add_item(tree, hf_afp_cat_count, tvb, offset, 4,FALSE);
2364 sub_tree = proto_item_add_subtree(item, ett_afp_cat_search);
2368 return loop_record(tvb,sub_tree, offset, count, d_bitmap, f_bitmap, 2, ext);
2371 /* -------------------------- */
2373 dissect_reply_afp_cat_search(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2375 return reply_catsearch(tvb, tree, offset, 0);
2378 /* **************************/
2380 dissect_reply_afp_cat_search_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2382 return reply_catsearch(tvb, tree, offset, 1);
2385 /* **************************/
2387 dissect_query_afp_get_vol_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2391 add_info_vol(tvb, pinfo, offset);
2393 proto_tree_add_item(tree, hf_afp_vol_id, tvb, offset, 2,FALSE);
2396 decode_vol_bitmap(tree, tvb, offset);
2402 /* ------------------------ */
2404 dissect_reply_afp_get_vol_param(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2408 bitmap = decode_vol_bitmap(tree, tvb, offset);
2411 offset = parse_vol_bitmap(tree, tvb, offset, bitmap);
2416 /* **************************/
2418 dissect_query_afp_set_vol_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2424 add_info_vol(tvb, pinfo, offset);
2425 proto_tree_add_item(tree, hf_afp_vol_id, tvb, offset, 2,FALSE);
2428 bitmap = decode_vol_bitmap(tree, tvb, offset);
2431 offset = parse_vol_bitmap(tree, tvb, offset, bitmap);
2436 /* ***************************/
2438 decode_uam_parameters(const guint8 *uam, int len_uam, tvbuff_t *tvb, proto_tree *tree, gint offset)
2442 if (!g_ascii_strncasecmp(uam, "Cleartxt passwrd", len_uam)) {
2446 len = 8; /* tvb_strsize(tvb, offset);*/
2447 proto_tree_add_item(tree, hf_afp_passwd, tvb, offset, len,FALSE);
2450 else if (!g_ascii_strncasecmp(uam, "DHCAST128", len_uam)) {
2455 proto_tree_add_item(tree, hf_afp_random, tvb, offset, len,FALSE);
2458 else if (!g_ascii_strncasecmp(uam, "2-Way Randnum exchange", len_uam)) {
2465 /* ---------------- */
2467 dissect_query_afp_login(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2473 len = tvb_get_guint8(tvb, offset);
2474 proto_tree_add_item(tree, hf_afp_AFPVersion, tvb, offset, 1,FALSE);
2476 len_uam = tvb_get_guint8(tvb, offset);
2477 uam = tvb_get_ptr(tvb, offset +1, len_uam);
2478 proto_tree_add_item(tree, hf_afp_UAM, tvb, offset, 1,FALSE);
2479 offset += len_uam +1;
2481 if (!g_ascii_strncasecmp(uam, "No User Authent", len_uam)) {
2485 len = tvb_get_guint8(tvb, offset);
2486 proto_tree_add_item(tree, hf_afp_user, tvb, offset, 1,FALSE);
2489 return decode_uam_parameters(uam, len_uam, tvb, tree, offset);
2492 /* ***************************/
2494 dissect_query_afp_login_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2501 type = tvb_get_guint8(tvb, offset);
2504 proto_tree_add_item(tree, hf_afp_login_flags, tvb, offset, 2,FALSE);
2507 len = tvb_get_guint8(tvb, offset);
2508 proto_tree_add_item(tree, hf_afp_AFPVersion, tvb, offset, 1,FALSE);
2511 len_uam = tvb_get_guint8(tvb, offset);
2512 uam = tvb_get_ptr(tvb, offset +1, len_uam);
2513 proto_tree_add_item(tree, hf_afp_UAM, tvb, offset, 1,FALSE);
2514 offset += len_uam +1;
2516 type = tvb_get_guint8(tvb, offset);
2517 proto_tree_add_item(tree, hf_afp_user_type, tvb, offset, 1,FALSE);
2520 len = tvb_get_ntohs(tvb, offset);
2521 proto_tree_add_item(tree, hf_afp_user_len, tvb, offset, 2,FALSE);
2523 proto_tree_add_item(tree, hf_afp_user_name, tvb, offset, len,FALSE);
2526 /* directory service */
2527 type = tvb_get_guint8(tvb, offset);
2528 proto_tree_add_item(tree, hf_afp_path_type, tvb, offset, 1,FALSE);
2530 /* FIXME use 16 bit len + unicode from smb dissector */
2534 len = tvb_get_guint8(tvb, offset);
2535 proto_tree_add_item(tree, hf_afp_path_len, tvb, offset, 1,FALSE);
2537 proto_tree_add_item(tree, hf_afp_path_name, tvb, offset, len,FALSE);
2541 len = tvb_get_ntohs(tvb, offset);
2542 proto_tree_add_item( tree, hf_afp_path_unicode_len, tvb, offset, 2,FALSE);
2544 proto_tree_add_item(tree, hf_afp_path_name, tvb, offset, len,FALSE);
2551 return decode_uam_parameters(uam, len_uam, tvb, tree, offset);
2554 /* ************************** */
2556 dissect_query_afp_write(tvbuff_t *tvb, packet_info *pinfo , proto_tree *tree, gint offset)
2561 proto_tree_add_item(tree, hf_afp_flag, tvb, offset, 1,FALSE);
2564 add_info_fork(tvb, pinfo, offset);
2565 proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2,FALSE);
2568 proto_tree_add_item(tree, hf_afp_offset, tvb, offset, 4,FALSE);
2569 param = tvb_get_ntohl(tvb, offset);
2570 col_append_fstr(pinfo->cinfo, COL_INFO, " Offset=%d", param);
2573 proto_tree_add_item(tree, hf_afp_rw_count, tvb, offset, 4,FALSE);
2574 param = tvb_get_ntohl(tvb, offset);
2575 col_append_fstr(pinfo->cinfo, COL_INFO, " Size=%d", param);
2582 dissect_reply_afp_write(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2584 proto_tree_add_item(tree, hf_afp_last_written, tvb, offset, 4, FALSE);
2590 /* ************************** */
2592 dissect_query_afp_write_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2594 proto_tree_add_item(tree, hf_afp_flag, tvb, offset, 1,FALSE);
2597 add_info_fork(tvb, pinfo, offset);
2598 proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2,FALSE);
2601 proto_tree_add_item(tree, hf_afp_offset64, tvb, offset, 8,FALSE);
2604 proto_tree_add_item(tree, hf_afp_rw_count64, tvb, offset, 8,FALSE);
2611 dissect_reply_afp_write_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2613 proto_tree_add_item(tree, hf_afp_last_written64, tvb, offset, 8, FALSE);
2619 /* ************************** */
2621 dissect_query_afp_read(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2627 add_info_fork(tvb, pinfo, offset);
2628 proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2,FALSE);
2631 proto_tree_add_item(tree, hf_afp_offset, tvb, offset, 4,FALSE);
2632 param = tvb_get_ntohl(tvb, offset);
2633 col_append_fstr(pinfo->cinfo, COL_INFO, " Offset=%d", param);
2636 proto_tree_add_item(tree, hf_afp_rw_count, tvb, offset, 4,FALSE);
2637 param = tvb_get_ntohl(tvb, offset);
2638 col_append_fstr(pinfo->cinfo, COL_INFO, " Size=%d", param);
2641 proto_tree_add_item(tree, hf_afp_newline_mask, tvb, offset, 1,FALSE);
2644 proto_tree_add_item(tree, hf_afp_newline_char, tvb, offset, 1,FALSE);
2650 /* ************************** */
2652 dissect_query_afp_read_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2656 add_info_fork(tvb, pinfo, offset);
2657 proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2,FALSE);
2660 proto_tree_add_item(tree, hf_afp_offset64, tvb, offset, 8,FALSE);
2663 proto_tree_add_item(tree, hf_afp_rw_count64, tvb, offset, 8,FALSE);
2669 /* **************************
2671 query is the same than AFP_FLUSH, AFP_CLOSEVOL
2675 dissect_reply_afp_open_dt(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2677 proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2,FALSE);
2683 /* **************************
2687 dissect_query_afp_close_dt(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2690 proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2,FALSE);
2696 /* **************************
2697 calls using the same format :
2705 dissect_query_afp_with_fork(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2708 add_info_fork(tvb, pinfo, offset);
2709 proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2,FALSE);
2715 /* ************************** */
2717 dissect_query_afp_get_fldr_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2720 offset = decode_vol_did_file_dir_bitmap(tree, tvb, offset);
2722 offset = decode_name(tree, pinfo, tvb, offset);
2727 /* -------------------------- */
2729 dissect_reply_afp_get_fldr_param(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2732 guint16 f_bitmap, d_bitmap;
2734 f_bitmap = decode_file_bitmap(tree, tvb, offset);
2737 d_bitmap = decode_dir_bitmap(tree, tvb, offset);
2740 flags = tvb_get_guint8(tvb, offset);
2741 proto_tree_add_item(tree, hf_afp_file_flag, tvb, offset, 1,FALSE);
2745 offset = parse_dir_bitmap(tree, tvb, offset, d_bitmap);
2748 offset = parse_file_bitmap(tree, tvb, offset, f_bitmap,0);
2753 /* **************************
2757 dissect_query_afp_set_fldr_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2762 offset = decode_vol_did(tree, tvb, offset);
2764 f_bitmap = decode_file_bitmap(tree, tvb, offset);
2767 offset = decode_name(tree, pinfo, tvb, offset);
2771 /* did:name can be a file or a folder but only the intersection between
2772 * file bitmap and dir bitmap can be set.
2773 * Well it's in afp spec, but clients (Mac) are setting 'file only' bits with this call
2774 * (WriteInhibit for example).
2776 offset = parse_file_bitmap(tree, tvb, offset, f_bitmap, 1);
2781 /* **************************
2785 dissect_query_afp_set_file_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2790 offset = decode_vol_did(tree, tvb, offset);
2792 f_bitmap = decode_file_bitmap(tree, tvb, offset);
2795 offset = decode_name(tree, pinfo, tvb, offset);
2799 offset = parse_file_bitmap(tree, tvb, offset, f_bitmap, 0);
2804 /* **************************
2808 dissect_query_afp_set_dir_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2813 offset = decode_vol_did(tree, tvb, offset);
2815 d_bitmap = decode_dir_bitmap(tree, tvb, offset);
2818 offset = decode_name(tree, pinfo, tvb, offset);
2822 offset = parse_dir_bitmap(tree, tvb, offset, d_bitmap);
2828 /* **************************
2833 dissect_query_afp_create_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2836 offset = decode_vol_did(tree, tvb, offset);
2838 offset = decode_name(tree, pinfo, tvb, offset);
2842 /* --------------------------
2846 dissect_reply_afp_create_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2848 proto_tree_add_item(tree, hf_afp_file_id, tvb, offset, 4,FALSE);
2854 /* -------------------------- */
2856 dissect_reply_afp_create_dir(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2858 proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4,FALSE);
2864 /* **************************
2868 dissect_query_afp_delete_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2871 proto_tree_add_item(tree, hf_afp_vol_id, tvb, offset, 2,FALSE);
2873 proto_tree_add_item(tree, hf_afp_file_id, tvb, offset, 4,FALSE);
2879 /* **************************
2880 same reply as get_fork_param
2883 dissect_query_afp_resolve_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2886 proto_tree_add_item(tree, hf_afp_vol_id, tvb, offset, 2,FALSE);
2888 proto_tree_add_item(tree, hf_afp_file_id, tvb, offset, 4,FALSE);
2891 decode_file_bitmap(tree, tvb, offset);
2897 /* ************************** */
2899 dissect_query_afp_get_fork_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2903 add_info_fork(tvb, pinfo, offset);
2904 proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2,FALSE);
2907 decode_file_bitmap(tree, tvb, offset);
2912 /* -------------------------- */
2914 dissect_reply_afp_get_fork_param(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2918 f_bitmap = decode_file_bitmap(tree, tvb, offset);
2921 offset = parse_file_bitmap(tree, tvb, offset, f_bitmap,0);
2926 /* ************************** */
2928 dissect_query_afp_set_fork_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2934 add_info_fork(tvb, pinfo, offset);
2935 proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2,FALSE);
2938 bitmap = decode_file_bitmap(tree, tvb, offset);
2941 if ((bitmap & kFPExtDataForkLenBit) || (bitmap & kFPExtRsrcForkLenBit)) {
2942 proto_tree_add_item(tree, hf_afp_ofork_len64, tvb, offset, 8, FALSE);
2946 proto_tree_add_item(tree, hf_afp_ofork_len, tvb, offset, 4,FALSE);
2947 param = tvb_get_ntohl(tvb, offset);
2948 col_append_fstr(pinfo->cinfo, COL_INFO, " Size=%d", param);
2954 /* ************************** */
2956 dissect_query_afp_move(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2960 offset = decode_vol_did(tree, tvb, offset);
2962 proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4,FALSE);
2965 offset = decode_name_label(tree, pinfo, tvb, offset, "Source path: %s");
2966 offset = decode_name_label(tree, NULL, tvb, offset, "Dest dir: %s");
2967 offset = decode_name_label(tree, NULL, tvb, offset, "New name: %s");
2972 /* ************************** */
2974 dissect_query_afp_exchange_file(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2978 offset = decode_vol_did(tree, tvb, offset);
2980 proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4,FALSE);
2983 offset = decode_name_label(tree, pinfo, tvb, offset, "Source path: %s");
2984 offset = decode_name_label(tree, NULL, tvb, offset, "Dest path: %s");
2988 /* ************************** */
2990 dissect_query_afp_copy_file(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2992 proto_tree *sub_tree = NULL;
2997 item = proto_tree_add_text(tree, tvb, offset, 6,"Source volume");
2998 sub_tree = proto_item_add_subtree(item, ett_afp_vol_did);
3000 offset = decode_vol_did(sub_tree, tvb, offset);
3003 item = proto_tree_add_text(tree, tvb, offset, 6,"Dest volume");
3004 sub_tree = proto_item_add_subtree(item, ett_afp_vol_did);
3006 offset = decode_vol_did(sub_tree, tvb, offset);
3008 offset = decode_name_label(tree, pinfo, tvb, offset, "Source path: %s");
3009 offset = decode_name_label(tree, NULL, tvb, offset, "Dest dir: %s");
3010 offset = decode_name_label(tree, NULL, tvb, offset, "New name: %s");
3015 /* ************************** */
3017 dissect_query_afp_rename(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
3021 offset = decode_vol_did(tree, tvb, offset);
3023 offset = decode_name_label(tree, pinfo, tvb, offset, "Old name: %s");
3024 offset = decode_name_label(tree, NULL, tvb, offset, "New name: %s");
3029 /* ************************** */
3031 dissect_query_afp_byte_lock(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3033 proto_tree *sub_tree = NULL;
3037 flag = tvb_get_guint8(tvb, offset);
3039 item = proto_tree_add_text(tree, tvb, offset, 1, "Flags: 0x%02x", flag);
3040 sub_tree = proto_item_add_subtree(item, ett_afp_lock_flags);
3043 proto_tree_add_item(sub_tree, hf_afp_lock_op, tvb, offset, 1,FALSE);
3044 proto_tree_add_item(sub_tree, hf_afp_lock_from, tvb, offset, 1,FALSE);
3047 proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2,FALSE);
3050 proto_tree_add_item(tree, hf_afp_lock_offset, tvb, offset, 4,FALSE);
3053 proto_tree_add_item(tree, hf_afp_lock_len, tvb, offset, 4,FALSE);
3058 /* -------------------------- */
3060 dissect_reply_afp_byte_lock(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3062 proto_tree_add_item(tree, hf_afp_lock_range_start, tvb, offset, 4,FALSE);
3068 /* ************************** */
3070 dissect_query_afp_byte_lock_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3072 proto_tree *sub_tree = NULL;
3076 flag = tvb_get_guint8(tvb, offset);
3078 item = proto_tree_add_text(tree, tvb, offset, 1, "Flags: 0x%02x", flag);
3079 sub_tree = proto_item_add_subtree(item, ett_afp_lock_flags);
3082 proto_tree_add_item(sub_tree, hf_afp_lock_op, tvb, offset, 1,FALSE);
3083 proto_tree_add_item(sub_tree, hf_afp_lock_from, tvb, offset, 1,FALSE);
3086 proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2,FALSE);
3089 proto_tree_add_item(tree, hf_afp_lock_offset64, tvb, offset, 8,FALSE);
3092 proto_tree_add_item(tree, hf_afp_lock_len64, tvb, offset, 8,FALSE);
3097 /* -------------------------- */
3099 dissect_reply_afp_byte_lock_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3101 proto_tree_add_item(tree, hf_afp_lock_range_start64, tvb, offset, 8,FALSE);
3107 /* ************************** */
3109 dissect_query_afp_add_cmt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
3114 proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2,FALSE);
3117 proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4,FALSE);
3120 offset = decode_name(tree, pinfo, tvb, offset);
3125 len = tvb_get_guint8(tvb, offset);
3126 proto_tree_add_item(tree, hf_afp_comment, tvb, offset, 1,FALSE);
3133 /* ************************** */
3135 dissect_query_afp_get_cmt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
3139 proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2,FALSE);
3142 proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4,FALSE);
3145 offset = decode_name(tree, pinfo, tvb, offset);
3149 /* -------------------------- */
3151 dissect_reply_afp_get_cmt(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3155 len = tvb_get_guint8(tvb, offset);
3156 proto_tree_add_item(tree, hf_afp_comment, tvb, offset, 1,FALSE);
3162 /* ************************** */
3164 dissect_query_afp_get_icon(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3168 proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2,FALSE);
3170 proto_tree_add_item(tree, hf_afp_file_creator, tvb, offset, 4,FALSE);
3173 proto_tree_add_item(tree, hf_afp_file_type, tvb, offset, 4,FALSE);
3176 proto_tree_add_item(tree, hf_afp_icon_type, tvb, offset, 1,FALSE);
3180 proto_tree_add_item(tree, hf_afp_icon_length, tvb, offset, 2,FALSE);
3186 /* ************************** */
3188 dissect_query_afp_get_icon_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3192 proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2,FALSE);
3194 proto_tree_add_item(tree, hf_afp_file_creator, tvb, offset, 4,FALSE);
3197 proto_tree_add_item(tree, hf_afp_icon_index, tvb, offset, 2,FALSE);
3203 /* -------------------------- */
3205 dissect_reply_afp_get_icon_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3208 proto_tree_add_item(tree, hf_afp_icon_tag, tvb, offset, 4,FALSE);
3211 proto_tree_add_item(tree, hf_afp_file_type, tvb, offset, 4,FALSE);
3214 proto_tree_add_item(tree, hf_afp_icon_type, tvb, offset, 1,FALSE);
3218 proto_tree_add_item(tree, hf_afp_icon_length, tvb, offset, 2,FALSE);
3224 /* ************************** */
3226 dissect_query_afp_add_icon(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3230 proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2,FALSE);
3232 proto_tree_add_item(tree, hf_afp_file_creator, tvb, offset, 4,FALSE);
3235 proto_tree_add_item(tree, hf_afp_file_type, tvb, offset, 4,FALSE);
3238 proto_tree_add_item(tree, hf_afp_icon_type, tvb, offset, 1,FALSE);
3242 proto_tree_add_item(tree, hf_afp_icon_tag, tvb, offset, 4,FALSE);
3245 proto_tree_add_item(tree, hf_afp_icon_length, tvb, offset, 2,FALSE);
3251 /* **************************
3255 decode_dt_did(proto_tree *tree, tvbuff_t *tvb, gint offset)
3257 /* FIXME it's not volume but dt cf decode_name*/
3258 Vol = tvb_get_ntohs(tvb, offset);
3259 proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2,FALSE);
3262 Did = tvb_get_ntohl(tvb, offset);
3263 proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4,FALSE);
3268 /* -------------------------- */
3270 dissect_query_afp_add_appl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
3274 offset = decode_dt_did(tree, tvb, offset);
3276 proto_tree_add_item(tree, hf_afp_file_creator, tvb, offset, 4,FALSE);
3279 proto_tree_add_item(tree, hf_afp_appl_tag, tvb, offset, 4,FALSE);
3282 offset = decode_name(tree, pinfo, tvb, offset);
3287 /* **************************
3291 dissect_query_afp_rmv_appl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
3295 offset = decode_dt_did(tree, tvb, offset);
3297 proto_tree_add_item(tree, hf_afp_file_creator, tvb, offset, 4,FALSE);
3300 offset = decode_name(tree, pinfo, tvb, offset);
3305 /* ************************** */
3307 dissect_query_afp_get_appl(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3311 proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2,FALSE);
3314 proto_tree_add_item(tree, hf_afp_file_creator, tvb, offset, 4,FALSE);
3317 proto_tree_add_item(tree, hf_afp_appl_index, tvb, offset, 2,FALSE);
3320 decode_file_bitmap(tree, tvb, offset);
3326 /* -------------------------- */
3328 dissect_reply_afp_get_appl(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3330 proto_tree_add_item(tree, hf_afp_appl_tag, tvb, offset, 4,FALSE);
3336 /* ************************** */
3338 dissect_query_afp_create_file(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
3340 proto_tree_add_item(tree, hf_afp_create_flag, tvb, offset, 1,FALSE);
3343 offset = decode_vol_did(tree, tvb, offset);
3345 offset = decode_name(tree, pinfo, tvb, offset);
3350 /* ************************** */
3352 dissect_query_afp_map_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3356 type = tvb_get_guint8(tvb, offset);
3357 proto_tree_add_item(tree, hf_afp_map_id_type, tvb, offset, 1,FALSE);
3361 proto_tree_add_item(tree, hf_afp_map_id, tvb, offset, 4,FALSE);
3365 proto_tree_add_item(tree, hf_afp_UUID, tvb, offset, 16,FALSE);
3372 /* -------------------------- */
3374 dissect_reply_afp_map_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3379 len = tvb_get_guint8(tvb, offset);
3380 /* for type 3 and 4 len is 16 bits but we don't keep the type from the request
3381 * XXX assume name < 256, ie the first byte is zero.
3384 len = tvb_get_guint8(tvb, offset +1);
3386 /* assume it's undocumented type 5 or 6 reply */
3387 proto_tree_add_item(tree, hf_afp_map_id_reply_type, tvb, offset, 4,FALSE);
3390 proto_tree_add_item(tree, hf_afp_map_id, tvb, offset, 4,FALSE);
3394 len = tvb_get_guint8(tvb, offset +1);
3398 gint remain = tvb_reported_length_remaining(tvb,offset);
3399 if (remain == len +2) {
3410 proto_tree_add_item(tree, hf_afp_map_name, tvb, offset, size, FALSE);
3413 proto_tree_add_item(tree, hf_afp_unknown, tvb, offset, len, FALSE);
3415 offset += len +size;
3419 /* ************************** */
3421 dissect_query_afp_map_name(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3427 type = tvb_get_guint8(tvb, offset);
3428 proto_tree_add_item(tree, hf_afp_map_name_type, tvb, offset, 1,FALSE);
3431 case 5: /* use 16 bits length */
3434 len = tvb_get_ntohs(tvb, offset);
3438 len = tvb_get_guint8(tvb, offset);
3441 proto_tree_add_item(tree, hf_afp_map_name, tvb, offset, size, FALSE);
3442 offset += len +size;
3447 /* -------------------------- */
3449 dissect_reply_afp_map_name(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3453 /* We don't keep the type from the request */
3454 /* If remain == 16, assume UUID */
3455 remain = tvb_reported_length(tvb);
3457 proto_tree_add_item(tree, hf_afp_UUID, tvb, offset, 16, FALSE);
3461 proto_tree_add_item(tree, hf_afp_map_id, tvb, offset, 4, FALSE);
3468 /* ************************** */
3470 dissect_query_afp_disconnect_old_session(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3472 int len, orig_offset = offset;
3476 proto_tree_add_item(tree, hf_afp_session_token_type, tvb, offset, 2,FALSE);
3479 len = tvb_get_ntohl(tvb, offset);
3480 proto_tree_add_item(tree, hf_afp_session_token_len, tvb, offset, 4,FALSE);
3483 proto_tree_add_item(tree, hf_afp_session_token, tvb, offset, len,FALSE);
3486 if (offset <= orig_offset)
3487 THROW(ReportedBoundsError);
3492 /* ************************** */
3494 dissect_query_afp_get_session_token(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3497 int len, orig_offset = offset;
3500 token = tvb_get_ntohs(tvb, offset);
3501 proto_tree_add_item(tree, hf_afp_session_token_type, tvb, offset, 2,FALSE);
3503 if (token == kLoginWithoutID || token == kGetKerberosSessionKey) /* 0 || 8 */
3506 len = tvb_get_ntohl(tvb, offset);
3507 proto_tree_add_item(tree, hf_afp_session_token_len, tvb, offset, 4,FALSE);
3511 case kLoginWithTimeAndID:
3512 case kReconnWithTimeAndID:
3513 proto_tree_add_item(tree, hf_afp_session_token_timestamp, tvb, offset, 4,FALSE);
3517 proto_tree_add_item(tree, hf_afp_session_token, tvb, offset, len,FALSE);
3520 if (offset <= orig_offset)
3521 THROW(ReportedBoundsError);
3526 /* -------------------------- */
3528 dissect_reply_afp_get_session_token(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3530 int len, orig_offset = offset;
3533 /* FIXME spec and capture disagree : or it's 4 bytes with no token type, or it's 2 bytes */
3535 /* [cm]: FIXME continued: Since size is set to 4, this test is never true.
3537 proto_tree_add_item(tree, hf_afp_session_token_type, tvb, offset, 2,FALSE);
3541 len = tvb_get_ntohl(tvb, offset);
3542 proto_tree_add_item(tree, hf_afp_session_token_len, tvb, offset, size,FALSE);
3545 proto_tree_add_item(tree, hf_afp_session_token, tvb, offset, len,FALSE);
3548 if (offset <= orig_offset)
3549 THROW(ReportedBoundsError);
3554 /* ************************** */
3556 dissect_query_afp_get_server_message(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3560 proto_tree_add_item(tree, hf_afp_message_type, tvb, offset, 2, FALSE);
3564 proto_tree *sub_tree;
3567 item = proto_tree_add_item(tree, hf_afp_message_bitmap, tvb, offset, 2, FALSE);
3568 sub_tree = proto_item_add_subtree(item, ett_afp_message_bitmap);
3569 proto_tree_add_item(sub_tree, hf_afp_message_bitmap_REQ, tvb, offset, 2,FALSE);
3570 proto_tree_add_item(sub_tree, hf_afp_message_bitmap_UTF, tvb, offset, 2,FALSE);
3577 /* ************************** */
3579 dissect_reply_afp_get_server_message(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3584 /* FIXME: APF 3.1 specs also specify a long reply format, yet unused */
3586 proto_tree_add_item(tree, hf_afp_message_type, tvb, offset, 2, FALSE);
3589 bitmap = tvb_get_ntohs(tvb, offset);
3591 proto_tree *sub_tree;
3594 item = proto_tree_add_item(tree, hf_afp_message_bitmap, tvb, offset, 2, FALSE);
3595 sub_tree = proto_item_add_subtree(item, ett_afp_message_bitmap);
3596 proto_tree_add_item(sub_tree, hf_afp_message_bitmap_REQ, tvb, offset, 2,FALSE);
3597 proto_tree_add_item(sub_tree, hf_afp_message_bitmap_UTF, tvb, offset, 2,FALSE);
3601 /* FIXME: Not in the specs, but for UTF8 message length is 2 bytes */
3602 if ((bitmap & 3) == 3) {
3603 len = tvb_get_ntohs(tvb, offset);
3604 proto_tree_add_item(tree, hf_afp_message_len, tvb, offset, 2,FALSE);
3607 else if ((bitmap & 1)) {
3608 len = tvb_get_guint8(tvb, offset);
3609 proto_tree_add_item(tree, hf_afp_message_len, tvb, offset, 1,FALSE);
3614 proto_tree_add_item(tree, hf_afp_message, tvb, offset, len ,FALSE);
3621 /* ************************** */
3623 dissect_query_afp_get_user_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3626 proto_tree_add_item(tree, hf_afp_user_flag, tvb, offset, 1,FALSE);
3629 proto_tree_add_item(tree, hf_afp_user_ID, tvb, offset, 4,FALSE);
3633 proto_tree *sub_tree;
3636 item = proto_tree_add_item(tree, hf_afp_user_bitmap, tvb, offset, 2,FALSE);
3637 sub_tree = proto_item_add_subtree(item, ett_afp_user_bitmap);
3638 proto_tree_add_item(sub_tree, hf_afp_user_bitmap_UID, tvb, offset, 2,FALSE);
3639 proto_tree_add_item(sub_tree, hf_afp_user_bitmap_GID, tvb, offset, 2,FALSE);
3640 proto_tree_add_item(sub_tree, hf_afp_user_bitmap_UUID, tvb, offset, 2,FALSE);
3647 /* -------------------------- */
3649 dissect_reply_afp_get_user_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3653 bitmap = tvb_get_ntohs(tvb, offset);
3655 proto_tree *sub_tree;
3658 item = proto_tree_add_item(tree, hf_afp_user_bitmap, tvb, offset, 2,FALSE);
3659 sub_tree = proto_item_add_subtree(item, ett_afp_user_bitmap);
3660 proto_tree_add_item(sub_tree, hf_afp_user_bitmap_UID, tvb, offset, 2,FALSE);
3661 proto_tree_add_item(sub_tree, hf_afp_user_bitmap_GID, tvb, offset, 2,FALSE);
3662 proto_tree_add_item(sub_tree, hf_afp_user_bitmap_UUID, tvb, offset, 2,FALSE);
3667 proto_tree_add_item(tree, hf_afp_user_ID, tvb, offset, 4,FALSE);
3672 proto_tree_add_item(tree, hf_afp_group_ID, tvb, offset, 4,FALSE);
3677 proto_tree_add_item(tree, hf_afp_UUID, tvb, offset, 16,FALSE);
3684 /* ************************** */
3686 decode_attr_name (proto_tree *tree, packet_info *pinfo _U_, tvbuff_t *tvb, gint offset, const gchar *label)
3693 len = tvb_get_ntohs(tvb, offset);
3697 proto_tree *sub_tree;
3700 name = tvb_format_text(tvb,offset+2, len);
3701 item = proto_tree_add_text(tree, tvb, offset, len + 2, label, name);
3702 sub_tree = proto_item_add_subtree(item, ett_afp_extattr_names);
3704 proto_tree_add_item(sub_tree, hf_afp_extattr_namelen, tvb, offset, 2,FALSE);
3705 proto_tree_add_item(sub_tree, hf_afp_extattr_name, tvb, offset +2, len, FALSE);
3712 /* ************************** */
3714 decode_attr_bitmap (proto_tree *tree, tvbuff_t *tvb, gint offset)
3718 proto_tree *sub_tree;
3721 item = proto_tree_add_item(tree, hf_afp_extattr_bitmap, tvb, offset, 2,FALSE);
3722 sub_tree = proto_item_add_subtree(item, ett_afp_extattr_bitmap);
3723 proto_tree_add_item(sub_tree, hf_afp_extattr_bitmap_NoFollow, tvb, offset, 2,FALSE);
3724 proto_tree_add_item(sub_tree, hf_afp_extattr_bitmap_Create, tvb, offset, 2,FALSE);
3725 proto_tree_add_item(sub_tree, hf_afp_extattr_bitmap_Replace, tvb, offset, 2,FALSE);
3731 /* ************************** */
3733 dissect_query_afp_get_ext_attr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
3736 offset = decode_vol_did(tree, tvb, offset);
3738 offset = decode_attr_bitmap(tree, tvb, offset);
3741 proto_tree_add_item(tree, hf_afp_offset64, tvb, offset, 8,FALSE);
3743 /* 8byte reqcount */
3744 proto_tree_add_item(tree, hf_afp_reqcount64, tvb, offset, 8,FALSE);
3748 proto_tree_add_item(tree, hf_afp_extattr_reply_size, tvb, offset, 4, FALSE);
3751 offset = decode_name(tree, pinfo, tvb, offset);
3753 offset = decode_attr_name(tree, pinfo, tvb, offset, "Attribute: %s");
3758 /* -------------------------- */
3760 dissect_reply_afp_get_ext_attr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3764 int orig_offset = offset;
3766 offset = decode_attr_bitmap(tree, tvb, offset);
3768 len = tvb_get_ntohl(tvb, offset);
3769 proto_tree_add_item(tree, hf_afp_extattr_len, tvb, offset, 4,FALSE);
3772 remain = tvb_reported_length_remaining(tvb, offset);
3773 if (len && remain >= len ) {
3774 proto_tree_add_item(tree, hf_afp_extattr_data, tvb, offset, len, FALSE);
3778 if (offset <= orig_offset)
3779 THROW(ReportedBoundsError);
3784 /* ************************** */
3786 dissect_query_afp_set_ext_attr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
3791 offset = decode_vol_did(tree, tvb, offset);
3793 offset = decode_attr_bitmap(tree, tvb, offset);
3796 proto_tree_add_item(tree, hf_afp_offset64, tvb, offset, 8,FALSE);
3799 offset = decode_name(tree, pinfo, tvb, offset);
3801 offset = decode_attr_name(tree, pinfo, tvb, offset, "Attribute: %s");
3803 len = tvb_get_ntohl(tvb, offset);
3804 proto_tree_add_item(tree, hf_afp_extattr_len, tvb, offset, 4,FALSE);
3807 proto_tree_add_item(tree, hf_afp_extattr_data, tvb, offset, len, FALSE);
3813 /* ************************** */
3815 dissect_query_afp_list_ext_attrs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
3818 offset = decode_vol_did(tree, tvb, offset);
3820 /* for this command only kXAttrNoFollow is valid */
3821 offset = decode_attr_bitmap(tree, tvb, offset);
3823 proto_tree_add_item(tree, hf_afp_extattr_req_count, tvb, offset, 2, FALSE);
3826 proto_tree_add_item(tree, hf_afp_extattr_start_index, tvb, offset, 4, FALSE);
3829 proto_tree_add_item(tree, hf_afp_extattr_reply_size, tvb, offset, 4, FALSE);
3832 offset = decode_name(tree, pinfo, tvb, offset);
3837 /* -------------------------- */
3839 dissect_reply_afp_list_ext_attrs(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3842 proto_tree *sub_tree;
3843 gint length = 0, orig_offset = offset;
3846 offset = decode_attr_bitmap(tree, tvb, offset);
3848 length = tvb_get_ntohl(tvb, offset);
3849 proto_tree_add_item(tree, hf_afp_extattr_reply_size, tvb, offset, 4, FALSE);
3852 /* If reply_size was 0 on request, server only reports the size of
3853 the entries without actually adding any entries */
3854 remain = tvb_reported_length_remaining(tvb, offset);
3855 if (remain >= length) {
3857 item = proto_tree_add_text(tree, tvb, offset, remain , "Attributes");
3858 sub_tree = proto_item_add_subtree(item, ett_afp_extattr_names);
3859 while ( remain > 0) {
3860 tvb_get_ephemeral_stringz(tvb, offset, &length);
3861 proto_tree_add_item(sub_tree, hf_afp_extattr_name, tvb, offset, length, FALSE);
3868 if (offset <= orig_offset)
3869 THROW(ReportedBoundsError);
3874 /* ************************** */
3876 dissect_query_afp_remove_ext_attr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
3879 offset = decode_vol_did(tree, tvb, offset);
3881 offset = decode_attr_bitmap(tree, tvb, offset);
3883 offset = decode_name(tree, pinfo, tvb, offset);
3885 offset = decode_attr_name(tree, pinfo, tvb, offset, "Attribute: %s");
3890 /* ************************** */
3892 decode_acl_access_bitmap(tvbuff_t *tvb, proto_tree *tree, gint offset)
3896 bitmap = tvb_get_ntohl(tvb, offset);
3898 proto_tree *sub_tree;
3901 item = proto_tree_add_item(tree, hf_afp_acl_access_bitmap, tvb, offset, 4, FALSE);
3902 sub_tree = proto_item_add_subtree(item, ett_afp_acl_access_bitmap);
3904 proto_tree_add_item(sub_tree, hf_afp_acl_access_bitmap_read_data , tvb, offset, 4,FALSE);
3905 proto_tree_add_item(sub_tree, hf_afp_acl_access_bitmap_write_data , tvb, offset, 4,FALSE);
3906 proto_tree_add_item(sub_tree, hf_afp_acl_access_bitmap_execute , tvb, offset, 4,FALSE);
3907 proto_tree_add_item(sub_tree, hf_afp_acl_access_bitmap_delete , tvb, offset, 4,FALSE);
3908 proto_tree_add_item(sub_tree, hf_afp_acl_access_bitmap_append_data , tvb, offset, 4,FALSE);
3909 proto_tree_add_item(sub_tree, hf_afp_acl_access_bitmap_delete_child , tvb, offset, 4,FALSE);
3910 proto_tree_add_item(sub_tree, hf_afp_acl_access_bitmap_read_attrs , tvb, offset, 4,FALSE);
3911 proto_tree_add_item(sub_tree, hf_afp_acl_access_bitmap_write_attrs , tvb, offset, 4,FALSE);
3912 proto_tree_add_item(sub_tree, hf_afp_acl_access_bitmap_read_extattrs , tvb, offset, 4,FALSE);
3913 proto_tree_add_item(sub_tree, hf_afp_acl_access_bitmap_write_extattrs , tvb, offset, 4,FALSE);
3914 proto_tree_add_item(sub_tree, hf_afp_acl_access_bitmap_read_security , tvb, offset, 4,FALSE);
3915 proto_tree_add_item(sub_tree, hf_afp_acl_access_bitmap_write_security , tvb, offset, 4,FALSE);
3916 proto_tree_add_item(sub_tree, hf_afp_acl_access_bitmap_change_owner , tvb, offset, 4,FALSE);
3917 proto_tree_add_item(sub_tree, hf_afp_acl_access_bitmap_synchronize , tvb, offset, 4,FALSE);
3918 proto_tree_add_item(sub_tree, hf_afp_acl_access_bitmap_generic_all , tvb, offset, 4,FALSE);
3919 proto_tree_add_item(sub_tree, hf_afp_acl_access_bitmap_generic_execute, tvb, offset, 4,FALSE);
3920 proto_tree_add_item(sub_tree, hf_afp_acl_access_bitmap_generic_write , tvb, offset, 4,FALSE);
3921 proto_tree_add_item(sub_tree, hf_afp_acl_access_bitmap_generic_read , tvb, offset, 4,FALSE);
3927 /* ************************** */
3929 dissect_query_afp_access(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
3932 offset = decode_vol_did(tree, tvb, offset);
3934 proto_tree_add_item(tree, hf_afp_access_bitmap, tvb, offset, 2, FALSE);
3937 proto_tree_add_item(tree, hf_afp_UUID, tvb, offset, 16, FALSE);
3940 decode_acl_access_bitmap(tvb, tree, offset);
3943 offset = decode_name(tree, pinfo, tvb, offset);
3948 /* ************************** */
3950 dissect_query_afp_with_did(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3953 offset = decode_vol_did(tree, tvb, offset);
3955 proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4,FALSE);
3961 /* ************************** */
3963 dissect_spotlight(tvbuff_t *tvb, proto_tree *tree, gint offset)
3968 gint query_offset_next;
3972 gint query_data_len;
3973 guint64 query_data64;
3977 proto_item *item_queries_data;
3978 proto_tree *sub_tree_queries;
3979 proto_item *item_toc;
3980 proto_tree *sub_tree_toc;
3981 proto_item *item_query;
3982 proto_tree *sub_tree_query;
3983 proto_item *item_data;
3984 proto_tree *sub_tree_data;
3986 if (strncmp(tvb_get_ephemeral_string(tvb, offset, 8), "md031234", 8) == 0)
3987 spotlight_endianess = SPOTLIGHT_BIG_ENDIAN;
3989 spotlight_endianess = SPOTLIGHT_LITTLE_ENDIAN;
3990 proto_tree_add_text(tree,
3995 spotlight_endianess == SPOTLIGHT_BIG_ENDIAN ?
3996 "Big Endian" : "Litte Endian");
3999 toc_offset = (spotlight_ntoh64(tvb, offset) >> 32) * 8 - 8;
4000 querylen = (spotlight_ntoh64(tvb, offset) & 0xffffffff) * 8 - 8;
4001 proto_tree_add_text(tree,
4005 "ToC Offset: %u Bytes, Query length: %u Bytes",
4010 num_queries = (gint)(spotlight_ntoh64(tvb, offset + toc_offset) & 0xffff) - 1;
4012 item_queries_data = proto_tree_add_text(tree,
4016 "Query data (%u queries)",
4019 sub_tree_queries = proto_item_add_subtree(item_queries_data, ett_afp_spotlight_queries);
4021 query_offset_next = (spotlight_ntoh64(tvb, offset + toc_offset + 8) & 0xff) * 8 - 16;
4022 for (i = 0; i < num_queries; i++) {
4023 query_offset = query_offset_next;
4024 if (i == num_queries - 1)
4026 query_offset_next = toc_offset;
4028 /* peek at next offset */
4029 query_offset_next = (spotlight_ntoh64(tvb, offset + toc_offset + 8 + (i+1)*8) & 0xff) * 8 - 16;
4031 /* this is obviously the length of one query */
4032 query_data_len = query_offset_next - query_offset;
4034 if (query_data_len > 8)
4035 item_query = proto_tree_add_text(sub_tree_queries,
4037 offset + query_offset,
4042 item_query = proto_tree_add_text(sub_tree_queries,
4044 offset + query_offset,
4046 "Query %u (empty?)",
4049 /* tree per query */
4050 sub_tree_query = proto_item_add_subtree(item_query, ett_afp_spotlight_query_line);
4051 query_data64 = spotlight_ntoh64(tvb, offset + query_offset);
4053 /* print the query line */
4054 proto_tree_add_text(sub_tree_query,
4056 offset + query_offset,
4058 "Index: %" G_GINT64_MODIFIER "u, ?: 0x%08" G_GINT64_MODIFIER "x",
4060 query_data64 & 0xffffffff);
4062 /* really any data in the query */
4063 if (query_data_len > 8) {
4064 /* populate the query tree */
4065 query_data64 = spotlight_ntoh64(tvb, offset + query_offset + 8);
4066 mdlen = ((query_data64 & 0xffff) - 1) * 8;
4067 proto_tree_add_text(sub_tree_query,
4069 offset + query_offset + 8,
4071 "?(reappears in ToC): 0x%08" G_GINT64_MODIFIER "x, ?: 0x%04" G_GINT64_MODIFIER "x, strlen: ((%u-1)*8 = ) %u",
4073 (query_data64 & 0xffff0000) >> 16,
4077 mds = tvb_get_ephemeral_string(tvb, offset + query_offset + 16, mdlen);
4078 proto_item_append_text(item_query, ": \"%s\"", mds);
4080 proto_tree_add_text(sub_tree_query,
4082 offset + query_offset + 16,
4084 "mdstring: \"%s\" (%u bytes)",
4088 item_data = proto_tree_add_text(sub_tree_query,
4090 offset + query_offset + 16 + mdlen,
4091 query_data_len - 16 - mdlen,
4093 query_data_len - 16 - mdlen);
4095 /* If there are more then 8 bytes theres at least x*8+8 bytes */
4096 if ((query_data_len - 16 - mdlen) >= 16) {
4097 sub_tree_data = proto_item_add_subtree(item_data, ett_afp_spotlight_data);
4098 query_data64 = spotlight_ntoh64(tvb, offset + query_offset + 16 + mdlen);
4100 proto_tree_add_text(sub_tree_data,
4102 offset + query_offset + 16 + mdlen,
4104 "data: %" G_GINT64_MODIFIER "u * 8 (= %" G_GINT64_MODIFIER "u) bytes, ?: 0x%04" G_GINT64_MODIFIER "x",
4105 (query_data64 & G_GINT64_CONSTANT(0xffffffff00000000)) >> 32,
4106 ((query_data64 & G_GINT64_CONSTANT(0xffffffff00000000)) >> 32) * 8,
4107 query_data64 & 0xffffffff);
4108 proto_tree_add_text(sub_tree_data,
4110 offset + query_offset + 16 + mdlen + 8,
4111 query_data_len - 16 - mdlen - 8,
4113 query_data_len - 16 - mdlen - 8);
4118 offset += toc_offset;
4121 item_toc = proto_tree_add_text(tree,
4124 querylen - toc_offset,
4127 sub_tree_toc = proto_item_add_subtree(item_toc, ett_afp_spotlight_toc);
4128 proto_tree_add_text(sub_tree_toc,
4132 "Number of entries (%u)",
4134 for (i = 0; i < num_queries; i++) {
4135 toc_entry = spotlight_ntoh64(tvb, offset + 8 + i*8);
4136 proto_tree_add_text(sub_tree_toc,
4140 "Index: %u, ?(reappears in queries): 0x%08" G_GINT64_MODIFIER "x, ?: 0x%04" G_GINT64_MODIFIER "x, Offset: %" G_GINT64_MODIFIER "u",
4143 (toc_entry & 0xffff0000) >> 16,
4144 (toc_entry & 0xffff) * 8);
4147 offset += querylen - toc_offset;
4152 dissect_query_afp_spotlight(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset, afp_request_val *request_val)
4157 offset = decode_vol(tree, tvb, offset);
4159 proto_tree_add_item(tree, hf_afp_spotlight_request_flags, tvb, offset, 4, FALSE);
4162 proto_tree_add_item(tree, hf_afp_spotlight_request_command, tvb, offset, 4, FALSE);
4165 proto_tree_add_item(tree, hf_afp_spotlight_request_reserved, tvb, offset, 4, FALSE);
4168 switch (request_val->spotlight_req_command) {
4170 case SPOTLIGHT_CMD_GET_VOLPATH:
4171 tvb_get_ephemeral_stringz(tvb, offset, &len);
4172 proto_tree_add_item(tree, hf_afp_spotlight_volpath_client, tvb, offset, len, FALSE);
4176 case SPOTLIGHT_CMD_GET_VOLID:
4180 case SPOTLIGHT_CMD_GET_THREE:
4181 proto_tree_add_item(tree, hf_afp_spotlight_volflags, tvb, offset, 4,FALSE);
4184 proto_tree_add_item(tree, hf_afp_spotlight_reqlen, tvb, offset, 4,FALSE);
4187 offset = dissect_spotlight(tvb, tree, offset);
4194 /* ************************** */
4196 decode_acl_list_bitmap(tvbuff_t *tvb, proto_tree *tree, gint offset)
4200 bitmap = tvb_get_ntohs(tvb, offset);
4202 proto_tree *sub_tree;
4205 item = proto_tree_add_item(tree, hf_afp_acl_list_bitmap, tvb, offset, 2,FALSE);
4206 sub_tree = proto_item_add_subtree(item, ett_afp_acl_list_bitmap);
4207 proto_tree_add_item(sub_tree, hf_afp_acl_list_bitmap_UUID, tvb, offset, 2,FALSE);
4208 proto_tree_add_item(sub_tree, hf_afp_acl_list_bitmap_GRPUUID, tvb, offset, 2,FALSE);
4209 proto_tree_add_item(sub_tree, hf_afp_acl_list_bitmap_ACL, tvb, offset, 2,FALSE);
4210 proto_tree_add_item(sub_tree, hf_afp_acl_list_bitmap_REMOVEACL, tvb, offset, 2,FALSE);
4211 proto_tree_add_item(sub_tree, hf_afp_acl_list_bitmap_Inherit, tvb, offset, 2,FALSE);
4218 /* ************************** */
4220 decode_ace_flags_bitmap(tvbuff_t *tvb, proto_tree *tree, gint offset)
4224 bitmap = tvb_get_ntohl(tvb, offset);
4226 proto_tree *sub_tree;
4229 item = proto_tree_add_item(tree, hf_afp_ace_flags, tvb, offset, 4,FALSE);
4230 sub_tree = proto_item_add_subtree(item, ett_afp_ace_flags);
4231 proto_tree_add_item(sub_tree, hf_afp_ace_flags_allow, tvb, offset, 4,FALSE);
4232 proto_tree_add_item(sub_tree, hf_afp_ace_flags_deny, tvb, offset, 4,FALSE);
4233 proto_tree_add_item(sub_tree, hf_afp_ace_flags_inherited, tvb, offset, 4,FALSE);
4234 proto_tree_add_item(sub_tree, hf_afp_ace_flags_fileinherit, tvb, offset, 4,FALSE);
4235 proto_tree_add_item(sub_tree, hf_afp_ace_flags_dirinherit, tvb, offset, 4,FALSE);
4236 proto_tree_add_item(sub_tree, hf_afp_ace_flags_limitinherit, tvb, offset, 4,FALSE);
4237 proto_tree_add_item(sub_tree, hf_afp_ace_flags_onlyinherit, tvb, offset, 4,FALSE);
4244 decode_kauth_ace(tvbuff_t *tvb, proto_tree *tree, gint offset)
4246 /* FIXME: preliminary decoding... */
4248 proto_tree_add_item(tree, hf_afp_UUID, tvb, offset, 16,FALSE);
4251 decode_ace_flags_bitmap(tvb, tree, offset);
4254 decode_acl_access_bitmap(tvb, tree, offset);
4264 decode_kauth_acl(tvbuff_t *tvb, proto_tree *tree, gint offset)
4268 proto_tree *sub_tree;
4269 proto_tree *ace_tree;
4272 /* FIXME: preliminary decoding... */
4273 entries = tvb_get_ntohl(tvb, offset);
4275 item = proto_tree_add_text(tree, tvb, offset, 4, "ACEs : %d", entries);
4276 sub_tree = proto_item_add_subtree(item, ett_afp_ace_entries);
4279 proto_tree_add_item(tree, hf_afp_acl_flags, tvb, offset, 4,FALSE);
4282 for (i = 0; i < entries; i++) {
4283 item = proto_tree_add_text(sub_tree, tvb, offset, 24, "ACE: %u", i);
4284 ace_tree = proto_item_add_subtree(item, ett_afp_ace_entry);
4286 offset = decode_kauth_ace(tvb, ace_tree, offset);
4293 decode_uuid_acl(tvbuff_t *tvb, proto_tree *tree, gint offset, guint16 bitmap)
4298 if ((bitmap & kFileSec_UUID)) {
4299 proto_tree_add_item(tree, hf_afp_UUID, tvb, offset, 16, FALSE);
4303 if ((bitmap & kFileSec_GRPUUID)) {
4304 proto_tree_add_item(tree, hf_afp_UUID, tvb, offset, 16, FALSE);
4308 if ((bitmap & kFileSec_ACL)) {
4309 offset = decode_kauth_acl(tvb, tree, offset);
4315 /* ************************** */
4317 dissect_query_afp_set_acl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
4322 offset = decode_vol_did(tree, tvb, offset);
4324 bitmap = decode_acl_list_bitmap(tvb, tree, offset);
4327 offset = decode_name(tree, pinfo, tvb, offset);
4329 offset = decode_uuid_acl(tvb, tree, offset, bitmap);
4334 /* ************************** */
4336 dissect_query_afp_get_acl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
4339 offset = decode_vol_did(tree, tvb, offset);
4341 decode_acl_list_bitmap(tvb, tree, offset);
4344 proto_tree_add_item(tree, hf_afp_max_reply_size32, tvb, offset, 4,FALSE);
4347 offset = decode_name(tree, pinfo, tvb, offset);
4352 /* -------------------------- */
4354 dissect_reply_afp_get_acl(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
4358 bitmap = decode_acl_list_bitmap(tvb, tree, offset);
4361 offset = decode_uuid_acl(tvb, tree, offset, bitmap);
4366 /* ************************** */
4368 dissect_reply_afp_spotlight(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset, afp_request_val *request_val)
4372 switch (request_val->spotlight_req_command) {
4374 case SPOTLIGHT_CMD_GET_VOLPATH:
4375 proto_tree_add_item(tree, hf_afp_spotlight_returncode, tvb, offset, 4,FALSE);
4378 tvb_get_ephemeral_stringz(tvb, offset, &len);;
4379 proto_tree_add_item(tree, hf_afp_spotlight_volpath_server, tvb, offset, len, FALSE);
4383 case SPOTLIGHT_CMD_GET_VOLID:
4384 proto_tree_add_item(tree, hf_afp_spotlight_volflags, tvb, offset, 4,FALSE);
4388 case SPOTLIGHT_CMD_GET_THREE:
4389 proto_tree_add_item(tree, hf_afp_spotlight_returncode, tvb, offset, 4,FALSE);
4392 offset = dissect_spotlight(tvb, tree, offset);
4399 /* ************************** */
4401 dissect_afp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
4403 struct aspinfo *aspinfo = pinfo->private_data;
4404 proto_tree *afp_tree = NULL;
4406 conversation_t *conversation;
4408 afp_request_key request_key, *new_request_key;
4409 afp_request_val *request_val;
4413 int len = tvb_reported_length(tvb);
4415 col_set_str(pinfo->cinfo, COL_PROTOCOL, "AFP");
4416 col_clear(pinfo->cinfo, COL_INFO);
4418 conversation = find_or_create_conversation(pinfo);
4420 request_key.conversation = conversation->index;
4421 request_key.seq = aspinfo->seq;
4423 request_val = (afp_request_val *) g_hash_table_lookup(
4424 afp_request_hash, &request_key);
4426 if (!request_val && !aspinfo->reply) {
4427 afp_command = tvb_get_guint8(tvb, offset);
4428 new_request_key = se_alloc(sizeof(afp_request_key));
4429 *new_request_key = request_key;
4431 request_val = se_alloc(sizeof(afp_request_val));
4432 request_val->command = afp_command;
4434 if (afp_command == AFP_SPOTLIGHTRPC)
4435 request_val->spotlight_req_command = tvb_get_ntohl(tvb, offset + 2 + 2 + 4);
4437 request_val->spotlight_req_command = -1;
4439 request_val->frame_req = pinfo->fd->num;
4440 request_val->frame_res = 0;
4441 request_val->req_time=pinfo->fd->abs_ts;
4443 g_hash_table_insert(afp_request_hash, new_request_key,
4447 if (!request_val) { /* missing request */
4448 col_set_str(pinfo->cinfo, COL_INFO, "[Reply without query?]");
4452 afp_command = request_val->command;
4453 col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s",
4454 val_to_str_ext(afp_command, &CommandCode_vals_ext,
4455 "Unknown command (%u)"),
4456 aspinfo->reply ? "reply" : "request");
4457 if (aspinfo->reply && aspinfo->code != 0) {
4458 col_append_fstr(pinfo->cinfo, COL_INFO, ": %s (%d)",
4459 val_to_str_ext(aspinfo->code, &asp_error_vals_ext,
4460 "Unknown error (%u)"), aspinfo->code);
4465 ti = proto_tree_add_item(tree, proto_afp, tvb, offset, -1,FALSE);
4466 afp_tree = proto_item_add_subtree(ti, ett_afp);
4468 if (!aspinfo->reply) {
4470 ti = proto_tree_add_uint(afp_tree, hf_afp_command, tvb,offset, 1, afp_command);
4471 if (afp_command != tvb_get_guint8(tvb, offset))
4473 /* we have the same conversation for different connections eg:
4474 * ip1:2048 --> ip2:548
4475 * ip1:2048 --> ip2:548 <RST>
4477 * ip1:2048 --> ip2:548 <SYN> use the same port but it's a new session!
4479 col_set_str(pinfo->cinfo, COL_INFO,
4480 "[Error!IP port reused, you need to split the capture file]");
4481 expert_add_info_format(pinfo, ti, PI_SEQUENCE, PI_WARN,
4482 "IP port reused, you need to split the capture file");
4487 * Put in a field for the frame number of the frame to which
4488 * this is a response if we know that frame number (i.e.,
4491 if (request_val->frame_res != 0) {
4492 ti = proto_tree_add_uint(afp_tree, hf_afp_response_in,
4493 tvb, 0, 0, request_val->frame_res);
4494 PROTO_ITEM_SET_GENERATED(ti);
4498 switch(afp_command) {
4500 offset = dissect_query_afp_byte_lock(tvb, pinfo, afp_tree, offset);break;
4501 case AFP_BYTELOCK_EXT:
4502 offset = dissect_query_afp_byte_lock_ext(tvb, pinfo, afp_tree, offset);break;
4503 case AFP_OPENDT: /* same as close vol */
4506 offset = dissect_query_afp_with_vol_id(tvb, pinfo, afp_tree, offset);break;
4508 /* offset = dissect_query_afp_close_dir(tvb, pinfo, afp_tree, offset);break; */
4511 offset = dissect_query_afp_close_dt(tvb, pinfo, afp_tree, offset);break;
4512 case AFP_FLUSHFORK: /* same packet as closefork */
4515 offset = dissect_query_afp_with_fork(tvb, pinfo, afp_tree, offset);break;
4517 offset = dissect_query_afp_copy_file(tvb, pinfo, afp_tree, offset);break;
4518 case AFP_CREATEFILE:
4519 offset = dissect_query_afp_create_file(tvb, pinfo, afp_tree, offset);break;
4520 case AFP_DISCTOLDSESS:
4521 offset = dissect_query_afp_disconnect_old_session(tvb, pinfo, afp_tree, offset);break;
4522 case AFP_ENUMERATE_EXT2:
4523 offset = dissect_query_afp_enumerate_ext2(tvb, pinfo, afp_tree, offset);break;
4524 case AFP_ENUMERATE_EXT:
4526 offset = dissect_query_afp_enumerate(tvb, pinfo, afp_tree, offset);break;
4527 case AFP_GETFORKPARAM:
4528 offset = dissect_query_afp_get_fork_param(tvb, pinfo, afp_tree, offset);break;
4529 case AFP_GETSESSTOKEN:
4530 offset = dissect_query_afp_get_session_token(tvb, pinfo, afp_tree, offset);break;
4531 case AFP_GETUSERINFO:
4532 offset = dissect_query_afp_get_user_info(tvb, pinfo, afp_tree, offset);break;
4533 case AFP_GETSRVINFO:
4534 /* offset = dissect_query_afp_get_server_info(tvb, pinfo, afp_tree, offset);break; */
4535 case AFP_GETSRVPARAM:
4536 break; /* no parameters */
4537 case AFP_GETVOLPARAM:
4538 offset = dissect_query_afp_get_vol_param(tvb, pinfo, afp_tree, offset);break;
4540 offset = dissect_query_afp_login_ext(tvb, pinfo, afp_tree, offset);break;
4542 offset = dissect_query_afp_login(tvb, pinfo, afp_tree, offset);break;
4547 offset = dissect_query_afp_map_id(tvb, pinfo, afp_tree, offset);break;
4549 offset = dissect_query_afp_map_name(tvb, pinfo, afp_tree, offset);break;
4551 offset = dissect_query_afp_move(tvb, pinfo, afp_tree, offset);break;
4553 offset = dissect_query_afp_open_vol(tvb, pinfo, afp_tree, offset);break;
4557 offset = dissect_query_afp_open_fork(tvb, pinfo, afp_tree, offset);break;
4559 offset = dissect_query_afp_read(tvb, pinfo, afp_tree, offset);break;
4561 offset = dissect_query_afp_read_ext(tvb, pinfo, afp_tree, offset);break;
4563 offset = dissect_query_afp_rename(tvb, pinfo, afp_tree, offset);break;
4564 case AFP_SETDIRPARAM:
4565 offset = dissect_query_afp_set_dir_param(tvb, pinfo, afp_tree, offset);break;
4566 case AFP_SETFILEPARAM:
4567 offset = dissect_query_afp_set_file_param(tvb, pinfo, afp_tree, offset);break;
4568 case AFP_SETFORKPARAM:
4569 offset = dissect_query_afp_set_fork_param(tvb, pinfo, afp_tree, offset);break;
4570 case AFP_SETVOLPARAM:
4571 offset = dissect_query_afp_set_vol_param(tvb, pinfo, afp_tree, offset);break;
4573 offset = dissect_query_afp_write(tvb, pinfo, afp_tree, offset);break;
4575 offset = dissect_query_afp_write_ext(tvb, pinfo, afp_tree, offset);break;
4576 case AFP_GETFLDRPARAM:
4577 offset = dissect_query_afp_get_fldr_param(tvb, pinfo, afp_tree, offset);break;
4578 case AFP_SETFLDRPARAM:
4579 offset = dissect_query_afp_set_fldr_param(tvb, pinfo, afp_tree, offset);break;
4582 case AFP_GETSRVRMSG:
4583 offset = dissect_query_afp_get_server_message(tvb, pinfo, afp_tree, offset);break;
4584 case AFP_DELETE: /* same as create_id */
4587 offset = dissect_query_afp_create_id(tvb, pinfo, afp_tree, offset);break;
4589 offset = dissect_query_afp_delete_id(tvb, pinfo, afp_tree, offset);break;
4591 offset = dissect_query_afp_resolve_id(tvb, pinfo, afp_tree, offset);break;
4592 case AFP_EXCHANGEFILE:
4593 offset = dissect_query_afp_exchange_file(tvb, pinfo, afp_tree, offset);break;
4594 case AFP_CATSEARCH_EXT:
4595 offset = dissect_query_afp_cat_search_ext(tvb, pinfo, afp_tree, offset);break;
4597 offset = dissect_query_afp_cat_search(tvb, pinfo, afp_tree, offset);break;
4599 offset = dissect_query_afp_get_icon(tvb, pinfo, afp_tree, offset);break;
4601 offset = dissect_query_afp_get_icon_info(tvb, pinfo, afp_tree, offset);break;
4603 offset = dissect_query_afp_add_appl(tvb, pinfo, afp_tree, offset);break;
4605 offset = dissect_query_afp_rmv_appl(tvb, pinfo, afp_tree, offset);break;
4607 offset = dissect_query_afp_get_appl(tvb, pinfo, afp_tree, offset);break;
4609 offset = dissect_query_afp_add_cmt(tvb, pinfo, afp_tree, offset);break;
4610 case AFP_RMVCMT: /* same as get_cmt */
4612 offset = dissect_query_afp_get_cmt(tvb, pinfo, afp_tree, offset);break;
4614 offset = dissect_query_afp_add_icon(tvb, pinfo, afp_tree, offset);break;
4615 case AFP_GETEXTATTR:
4616 offset = dissect_query_afp_get_ext_attr(tvb, pinfo, afp_tree, offset);break;
4617 case AFP_SETEXTATTR:
4618 offset = dissect_query_afp_set_ext_attr(tvb, pinfo, afp_tree, offset);break;
4619 case AFP_LISTEXTATTR:
4620 offset = dissect_query_afp_list_ext_attrs(tvb, pinfo, afp_tree, offset);break;
4621 case AFP_REMOVEATTR:
4622 offset = dissect_query_afp_remove_ext_attr(tvb, pinfo, afp_tree, offset);break;
4624 offset = dissect_query_afp_get_acl(tvb, pinfo, afp_tree, offset);break;
4626 offset = dissect_query_afp_set_acl(tvb, pinfo, afp_tree, offset);break;
4628 offset = dissect_query_afp_access(tvb, pinfo, afp_tree, offset);break;
4630 offset = dissect_query_afp_with_did(tvb, pinfo, afp_tree, offset);break;
4631 case AFP_SPOTLIGHTRPC:
4632 offset = dissect_query_afp_spotlight(tvb, pinfo, afp_tree, offset, request_val);
4637 proto_tree_add_uint(afp_tree, hf_afp_command, tvb, 0, 0, afp_command);
4640 * Put in fields for the frame with the response to this
4641 * frame - if we know the frame number (i.e., it's not 0).
4643 if (request_val->frame_req != 0) {
4644 ti = proto_tree_add_uint(afp_tree, hf_afp_response_to,
4645 tvb, 0, 0, request_val->frame_req);
4646 PROTO_ITEM_SET_GENERATED(ti);
4647 nstime_delta(&delta_ts, &pinfo->fd->abs_ts, &request_val->req_time);
4648 ti = proto_tree_add_time(afp_tree, hf_afp_time, tvb,
4650 PROTO_ITEM_SET_GENERATED(ti);
4654 * Set "frame_res" if it's not already known.
4656 if (request_val->frame_res == 0)
4657 request_val->frame_res = pinfo->fd->num;
4660 * Tap the packet before the dissectors are called so we
4661 * still get the tap listener called even if there is an
4664 tap_queue_packet(afp_tap, pinfo, request_val);
4667 /* for some calls if the reply is an error there's no data
4672 switch(afp_command) {
4674 offset = dissect_reply_afp_byte_lock(tvb, pinfo, afp_tree, offset);break;
4675 case AFP_BYTELOCK_EXT:
4676 offset = dissect_reply_afp_byte_lock_ext(tvb, pinfo, afp_tree, offset);break;
4677 case AFP_ENUMERATE_EXT2:
4678 case AFP_ENUMERATE_EXT:
4679 offset = dissect_reply_afp_enumerate_ext(tvb, pinfo, afp_tree, offset);break;
4681 offset = dissect_reply_afp_enumerate(tvb, pinfo, afp_tree, offset);break;
4683 offset = dissect_reply_afp_open_vol(tvb, pinfo, afp_tree, offset);break;
4685 offset = dissect_reply_afp_open_fork(tvb, pinfo, afp_tree, offset);break;
4687 case AFP_GETFORKPARAM:
4688 offset =dissect_reply_afp_get_fork_param(tvb, pinfo, afp_tree, offset);break;
4689 case AFP_GETUSERINFO:
4690 offset = dissect_reply_afp_get_user_info(tvb, pinfo, afp_tree, offset);break;
4691 case AFP_GETSRVPARAM:
4692 offset = dissect_reply_afp_get_server_param(tvb, pinfo, afp_tree, offset);break;
4693 case AFP_GETSRVRMSG:
4694 offset = dissect_reply_afp_get_server_message(tvb, pinfo, afp_tree, offset);break;
4696 offset = dissect_reply_afp_create_dir(tvb, pinfo, afp_tree, offset);break;
4698 offset = dissect_reply_afp_map_id(tvb, pinfo, afp_tree, offset);break;
4700 offset = dissect_reply_afp_map_name(tvb, pinfo, afp_tree, offset);break;
4701 case AFP_MOVE: /* same as create_id */
4703 offset = dissect_reply_afp_create_id(tvb, pinfo, afp_tree, offset);break;
4704 case AFP_GETSESSTOKEN:
4705 offset = dissect_reply_afp_get_session_token(tvb, pinfo, afp_tree, offset);break;
4706 case AFP_GETVOLPARAM:
4707 offset = dissect_reply_afp_get_vol_param(tvb, pinfo, afp_tree, offset);break;
4708 case AFP_GETFLDRPARAM:
4709 offset = dissect_reply_afp_get_fldr_param(tvb, pinfo, afp_tree, offset);break;
4711 offset = dissect_reply_afp_open_dt(tvb, pinfo, afp_tree, offset);break;
4712 case AFP_CATSEARCH_EXT:
4713 offset = dissect_reply_afp_cat_search_ext(tvb, pinfo, afp_tree, offset);break;
4715 offset = dissect_reply_afp_cat_search(tvb, pinfo, afp_tree, offset);break;
4717 offset = dissect_reply_afp_get_icon_info(tvb, pinfo, afp_tree, offset);break;
4719 offset = dissect_reply_afp_get_appl(tvb, pinfo, afp_tree, offset);break;
4721 offset = dissect_reply_afp_get_cmt(tvb, pinfo, afp_tree, offset);break;
4723 offset = dissect_reply_afp_write(tvb, pinfo, afp_tree, offset);break;
4725 offset = dissect_reply_afp_write_ext(tvb, pinfo, afp_tree, offset);break;
4726 case AFP_GETEXTATTR:
4727 offset = dissect_reply_afp_get_ext_attr(tvb, pinfo, afp_tree, offset);break;
4728 case AFP_LISTEXTATTR:
4729 offset = dissect_reply_afp_list_ext_attrs(tvb, pinfo, afp_tree, offset);break;
4731 offset = dissect_reply_afp_get_acl(tvb, pinfo, afp_tree, offset);break;
4732 case AFP_SPOTLIGHTRPC:
4733 offset = dissect_reply_afp_spotlight(tvb, pinfo, afp_tree, offset, request_val);break;
4737 call_dissector(data_handle, tvb_new_subset_remaining(tvb, offset),
4742 static void afp_reinit( void)
4745 if (afp_request_hash)
4746 g_hash_table_destroy(afp_request_hash);
4748 afp_request_hash = g_hash_table_new(afp_hash, afp_equal);
4753 proto_register_afp(void)
4756 static hf_register_info hf[] = {
4758 { "Command", "afp.command",
4759 FT_UINT8, BASE_DEC|BASE_EXT_STRING, &CommandCode_vals_ext, 0x0,
4760 "AFP function", HFILL }},
4764 FT_NONE, BASE_NONE, NULL, 0,
4765 "Pad Byte", HFILL }},
4767 { &hf_afp_AFPVersion,
4768 { "AFP Version", "afp.AFPVersion",
4769 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
4770 "Client AFP version", HFILL }},
4774 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
4775 "User Authentication Method", HFILL }},
4778 { "User", "afp.user",
4779 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
4782 { &hf_afp_user_type,
4783 { "Type", "afp.user_type",
4784 FT_UINT8, BASE_HEX, VALS(path_type_vals), 0,
4785 "Type of user name", HFILL }},
4787 { "Len", "afp.user_len",
4788 FT_UINT16, BASE_DEC, NULL, 0x0,
4789 "User name length (unicode)", HFILL }},
4790 { &hf_afp_user_name,
4791 { "User", "afp.user_name",
4792 FT_STRING, BASE_NONE, NULL, 0x0,
4793 "User name (unicode)", HFILL }},
4796 { "Password", "afp.passwd",
4797 FT_STRINGZ, BASE_NONE, NULL, 0x0,
4801 { "Random number", "afp.random",
4802 FT_BYTES, BASE_NONE, NULL, 0x0,
4803 "UAM random number", HFILL }},
4805 { &hf_afp_response_to,
4806 { "Response to", "afp.response_to",
4807 FT_FRAMENUM, BASE_NONE, NULL, 0x0,
4808 "This packet is a response to the packet in this frame", HFILL }},
4811 { "Time from request", "afp.time",
4812 FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
4813 "Time between Request and Response for AFP cmds", HFILL }},
4815 { &hf_afp_response_in,
4816 { "Response in", "afp.response_in",
4817 FT_FRAMENUM, BASE_NONE, NULL, 0x0,
4818 "The response to this packet is in this packet", HFILL }},
4820 { &hf_afp_login_flags,
4821 { "Flags", "afp.afp_login_flags",
4822 FT_UINT16, BASE_HEX, NULL, 0 /* 0x0FFF*/,
4823 "Login flags", HFILL }},
4825 { &hf_afp_vol_bitmap,
4826 { "Bitmap", "afp.vol_bitmap",
4827 FT_UINT16, BASE_HEX, NULL, 0 /* 0x0FFF*/,
4828 "Volume bitmap", HFILL }},
4830 { &hf_afp_vol_bitmap_Attributes,
4831 { "Attributes", "afp.vol_bitmap.attributes",
4832 FT_BOOLEAN, 16, NULL, kFPVolAttributeBit,
4833 "Volume attributes", HFILL }},
4835 { &hf_afp_vol_attribute,
4836 { "Attributes", "afp.vol_attributes",
4837 FT_UINT16, BASE_HEX, NULL, 0,
4838 "Volume attributes", HFILL }},
4840 { &hf_afp_vol_attribute_ReadOnly,
4841 { "Read only", "afp.vol_attribute.read_only",
4842 FT_BOOLEAN, 16, NULL, kReadOnly,
4843 "Read only volume", HFILL }},
4845 { &hf_afp_vol_attribute_HasVolumePassword,
4846 { "Volume password", "afp.vol_attribute.passwd",
4847 FT_BOOLEAN, 16, NULL, kHasVolumePassword,
4848 "Has a volume password", HFILL }},
4850 { &hf_afp_vol_attribute_SupportsFileIDs,
4851 { "File IDs", "afp.vol_attribute.fileIDs",
4852 FT_BOOLEAN, 16, NULL, kSupportsFileIDs,
4853 "Supports file IDs", HFILL }},
4855 { &hf_afp_vol_attribute_SupportsCatSearch,
4856 { "Catalog search", "afp.vol_attribute.cat_search",
4857 FT_BOOLEAN, 16, NULL, kSupportsCatSearch,
4858 "Supports catalog search operations", HFILL }},
4860 { &hf_afp_vol_attribute_SupportsBlankAccessPrivs,
4861 { "Blank access privileges", "afp.vol_attribute.blank_access_privs",
4862 FT_BOOLEAN, 16, NULL, kSupportsBlankAccessPrivs,
4863 "Supports blank access privileges", HFILL }},
4865 { &hf_afp_vol_attribute_SupportsUnixPrivs,
4866 { "UNIX access privileges", "afp.vol_attribute.unix_privs",
4867 FT_BOOLEAN, 16, NULL, kSupportsUnixPrivs,
4868 "Supports UNIX access privileges", HFILL }},
4870 { &hf_afp_vol_attribute_SupportsUTF8Names,
4871 { "UTF-8 names", "afp.vol_attribute.utf8_names",
4872 FT_BOOLEAN, 16, NULL, kSupportsUTF8Names,
4873 "Supports UTF-8 names", HFILL }},
4875 { &hf_afp_vol_attribute_NoNetworkUserID,
4876 { "No Network User ID", "afp.vol_attribute.network_user_id",
4877 FT_BOOLEAN, 16, NULL, kNoNetworkUserIDs,
4880 { &hf_afp_vol_attribute_DefaultPrivsFromParent,
4881 { "Inherit parent privileges", "afp.vol_attribute.inherit_parent_privs",
4882 FT_BOOLEAN, 16, NULL, kDefaultPrivsFromParent,
4885 { &hf_afp_vol_attribute_NoExchangeFiles,
4886 { "No exchange files", "afp.vol_attribute.no_exchange_files",
4887 FT_BOOLEAN, 16, NULL, kNoExchangeFiles,
4888 "Exchange files not supported", HFILL }},
4890 { &hf_afp_vol_attribute_SupportsExtAttrs,
4891 { "Extended Attributes", "afp.vol_attribute.extended_attributes",
4892 FT_BOOLEAN, 16, NULL, kSupportsExtAttrs,
4893 "Supports Extended Attributes", HFILL }},
4895 { &hf_afp_vol_attribute_SupportsACLs,
4896 { "ACLs", "afp.vol_attribute.acls",
4897 FT_BOOLEAN, 16, NULL, kSupportsACLs,
4898 "Supports access control lists", HFILL }},
4900 { &hf_afp_vol_attribute_CaseSensitive,
4901 { "Case sensitive", "afp.vol_attribute.case_sensitive",
4902 FT_BOOLEAN, 16, NULL, kCaseSensitive,
4903 "Supports case-sensitive filenames", HFILL }},
4905 { &hf_afp_vol_attribute_SupportsTMLockSteal,
4906 { "TM lock steal", "afp.vol_attribute.TM_lock_steal",
4907 FT_BOOLEAN, 16, NULL, kSupportsTMLockSteal,
4908 "Supports Time Machine lock stealing", HFILL }},
4910 { &hf_afp_vol_bitmap_Signature,
4911 { "Signature", "afp.vol_bitmap.signature",
4912 FT_BOOLEAN, 16, NULL, kFPVolSignatureBit,
4913 "Volume signature", HFILL }},
4915 { &hf_afp_vol_bitmap_CreateDate,
4916 { "Creation date", "afp.vol_bitmap.create_date",
4917 FT_BOOLEAN, 16, NULL, kFPVolCreateDateBit,
4918 "Volume creation date", HFILL }},
4920 { &hf_afp_vol_bitmap_ModDate,
4921 { "Modification date", "afp.vol_bitmap.mod_date",
4922 FT_BOOLEAN, 16, NULL, kFPVolModDateBit,
4923 "Volume modification date", HFILL }},
4925 { &hf_afp_vol_bitmap_BackupDate,
4926 { "Backup date", "afp.vol_bitmap.backup_date",
4927 FT_BOOLEAN, 16, NULL, kFPVolBackupDateBit,
4928 "Volume backup date", HFILL }},
4930 { &hf_afp_vol_bitmap_ID,
4931 { "ID", "afp.vol_bitmap.id",
4932 FT_BOOLEAN, 16, NULL, kFPVolIDBit,
4933 "Volume ID", HFILL }},
4935 { &hf_afp_vol_bitmap_BytesFree,
4936 { "Bytes free", "afp.vol_bitmap.bytes_free",
4937 FT_BOOLEAN, 16, NULL, kFPVolBytesFreeBit,
4938 "Volume free bytes", HFILL }},
4940 { &hf_afp_vol_bitmap_BytesTotal,
4941 { "Bytes total", "afp.vol_bitmap.bytes_total",
4942 FT_BOOLEAN, 16, NULL, kFPVolBytesTotalBit,
4943 "Volume total bytes", HFILL }},
4945 { &hf_afp_vol_bitmap_Name,
4946 { "Name", "afp.vol_bitmap.name",
4947 FT_BOOLEAN, 16, NULL, kFPVolNameBit,
4948 "Volume name", HFILL }},
4950 { &hf_afp_vol_bitmap_ExtBytesFree,
4951 { "Extended bytes free", "afp.vol_bitmap.ex_bytes_free",
4952 FT_BOOLEAN, 16, NULL, kFPVolExtBytesFreeBit,
4953 "Volume extended (>2GB) free bytes", HFILL }},
4955 { &hf_afp_vol_bitmap_ExtBytesTotal,
4956 { "Extended bytes total", "afp.vol_bitmap.ex_bytes_total",
4957 FT_BOOLEAN, 16, NULL, kFPVolExtBytesTotalBit,
4958 "Volume extended (>2GB) total bytes", HFILL }},
4960 { &hf_afp_vol_bitmap_BlockSize,
4961 { "Block size", "afp.vol_bitmap.block_size",
4962 FT_BOOLEAN, 16, NULL, kFPVolBlockSizeBit,
4963 "Volume block size", HFILL }},
4965 { &hf_afp_dir_bitmap_Attributes,
4966 { "Attributes", "afp.dir_bitmap.attributes",
4967 FT_BOOLEAN, 16, NULL, kFPAttributeBit,
4968 "Return attributes if directory", HFILL }},
4970 { &hf_afp_dir_bitmap_ParentDirID,
4971 { "DID", "afp.dir_bitmap.did",
4972 FT_BOOLEAN, 16, NULL, kFPParentDirIDBit,
4973 "Return parent directory ID if directory", HFILL }},
4975 { &hf_afp_dir_bitmap_CreateDate,
4976 { "Creation date", "afp.dir_bitmap.create_date",
4977 FT_BOOLEAN, 16, NULL, kFPCreateDateBit,
4978 "Return creation date if directory", HFILL }},
4980 { &hf_afp_dir_bitmap_ModDate,
4981 { "Modification date", "afp.dir_bitmap.mod_date",
4982 FT_BOOLEAN, 16, NULL, kFPModDateBit,
4983 "Return modification date if directory", HFILL }},
4985 { &hf_afp_dir_bitmap_BackupDate,
4986 { "Backup date", "afp.dir_bitmap.backup_date",
4987 FT_BOOLEAN, 16, NULL, kFPBackupDateBit,
4988 "Return backup date if directory", HFILL }},
4990 { &hf_afp_dir_bitmap_FinderInfo,
4991 { "Finder info", "afp.dir_bitmap.finder_info",
4992 FT_BOOLEAN, 16, NULL, kFPFinderInfoBit,
4993 "Return finder info if directory", HFILL }},
4995 { &hf_afp_dir_bitmap_LongName,
4996 { "Long name", "afp.dir_bitmap.long_name",
4997 FT_BOOLEAN, 16, NULL, kFPLongNameBit,
4998 "Return long name if directory", HFILL }},
5000 { &hf_afp_dir_bitmap_ShortName,
5001 { "Short name", "afp.dir_bitmap.short_name",
5002 FT_BOOLEAN, 16, NULL, kFPShortNameBit,
5003 "Return short name if directory", HFILL }},
5005 { &hf_afp_dir_bitmap_NodeID,
5006 { "File ID", "afp.dir_bitmap.fid",
5007 FT_BOOLEAN, 16, NULL, kFPNodeIDBit,
5008 "Return file ID if directory", HFILL }},
5010 { &hf_afp_dir_bitmap_OffspringCount,
5011 { "Offspring count", "afp.dir_bitmap.offspring_count",
5012 FT_BOOLEAN, 16, NULL, kFPOffspringCountBit,
5013 "Return offspring count if directory", HFILL }},
5015 { &hf_afp_dir_bitmap_OwnerID,
5016 { "Owner id", "afp.dir_bitmap.owner_id",
5017 FT_BOOLEAN, 16, NULL, kFPOwnerIDBit,
5018 "Return owner id if directory", HFILL }},
5020 { &hf_afp_dir_bitmap_GroupID,
5021 { "Group id", "afp.dir_bitmap.group_id",
5022 FT_BOOLEAN, 16, NULL, kFPGroupIDBit,
5023 "Return group id if directory", HFILL }},
5025 { &hf_afp_dir_bitmap_AccessRights,
5026 { "Access rights", "afp.dir_bitmap.access_rights",
5027 FT_BOOLEAN, 16, NULL, kFPAccessRightsBit,
5028 "Return access rights if directory", HFILL }},
5030 { &hf_afp_dir_bitmap_UTF8Name,
5031 { "UTF-8 name", "afp.dir_bitmap.UTF8_name",
5032 FT_BOOLEAN, 16, NULL, kFPUTF8NameBit,
5033 "Return UTF-8 name if directory", HFILL }},
5035 { &hf_afp_dir_bitmap_UnixPrivs,
5036 { "UNIX privileges", "afp.dir_bitmap.unix_privs",
5037 FT_BOOLEAN, 16, NULL, kFPUnixPrivsBit,
5038 "Return UNIX privileges if directory", HFILL }},
5040 { &hf_afp_dir_attribute_Invisible,
5041 { "Invisible", "afp.dir_attribute.invisible",
5042 FT_BOOLEAN, 16, NULL, kFPInvisibleBit,
5043 "Directory is not visible", HFILL }},
5045 { &hf_afp_dir_attribute_IsExpFolder,
5046 { "Share point", "afp.dir_attribute.share",
5047 FT_BOOLEAN, 16, NULL, kFPMultiUserBit,
5048 "Directory is a share point", HFILL }},
5050 { &hf_afp_dir_attribute_System,
5051 { "System", "afp.dir_attribute.system",
5052 FT_BOOLEAN, 16, NULL, kFPSystemBit,
5053 "Directory is a system directory", HFILL }},
5055 { &hf_afp_dir_attribute_Mounted,
5056 { "Mounted", "afp.dir_attribute.mounted",
5057 FT_BOOLEAN, 16, NULL, kFPDAlreadyOpenBit,
5058 "Directory is mounted", HFILL }},
5060 { &hf_afp_dir_attribute_InExpFolder,
5061 { "Shared area", "afp.dir_attribute.in_exported_folder",
5062 FT_BOOLEAN, 16, NULL, kFPRAlreadyOpenBit,
5063 "Directory is in a shared area", HFILL }},
5065 { &hf_afp_dir_attribute_BackUpNeeded,
5066 { "Backup needed", "afp.dir_attribute.backup_needed",
5067 FT_BOOLEAN, 16, NULL, kFPBackUpNeededBit,
5068 "Directory needs to be backed up", HFILL }},
5070 { &hf_afp_dir_attribute_RenameInhibit,
5071 { "Rename inhibit", "afp.dir_attribute.rename_inhibit",
5072 FT_BOOLEAN, 16, NULL, kFPRenameInhibitBit,
5075 { &hf_afp_dir_attribute_DeleteInhibit,
5076 { "Delete inhibit", "afp.dir_attribute.delete_inhibit",
5077 FT_BOOLEAN, 16, NULL, kFPDeleteInhibitBit,
5080 { &hf_afp_dir_attribute_SetClear,
5081 { "Set", "afp.dir_attribute.set_clear",
5082 FT_BOOLEAN, 16, NULL, kFPSetClearBit,
5083 "Clear/set attribute", HFILL }},
5085 { &hf_afp_file_bitmap_Attributes,
5086 { "Attributes", "afp.file_bitmap.attributes",
5087 FT_BOOLEAN, 16, NULL, kFPAttributeBit,
5088 "Return attributes if file", HFILL }},
5090 { &hf_afp_file_bitmap_ParentDirID,
5091 { "DID", "afp.file_bitmap.did",
5092 FT_BOOLEAN, 16, NULL, kFPParentDirIDBit,
5093 "Return parent directory ID if file", HFILL }},
5095 { &hf_afp_file_bitmap_CreateDate,
5096 { "Creation date", "afp.file_bitmap.create_date",
5097 FT_BOOLEAN, 16, NULL, kFPCreateDateBit,
5098 "Return creation date if file", HFILL }},
5100 { &hf_afp_file_bitmap_ModDate,
5101 { "Modification date", "afp.file_bitmap.mod_date",
5102 FT_BOOLEAN, 16, NULL, kFPModDateBit,
5103 "Return modification date if file", HFILL }},
5105 { &hf_afp_file_bitmap_BackupDate,
5106 { "Backup date", "afp.file_bitmap.backup_date",
5107 FT_BOOLEAN, 16, NULL, kFPBackupDateBit,
5108 "Return backup date if file", HFILL }},
5110 { &hf_afp_file_bitmap_FinderInfo,
5111 { "Finder info", "afp.file_bitmap.finder_info",
5112 FT_BOOLEAN, 16, NULL, kFPFinderInfoBit,
5113 "Return finder info if file", HFILL }},
5115 { &hf_afp_file_bitmap_LongName,
5116 { "Long name", "afp.file_bitmap.long_name",
5117 FT_BOOLEAN, 16, NULL, kFPLongNameBit,
5118 "Return long name if file", HFILL }},
5120 { &hf_afp_file_bitmap_ShortName,
5121 { "Short name", "afp.file_bitmap.short_name",
5122 FT_BOOLEAN, 16, NULL, kFPShortNameBit,
5123 "Return short name if file", HFILL }},
5125 { &hf_afp_file_bitmap_NodeID,
5126 { "File ID", "afp.file_bitmap.fid",
5127 FT_BOOLEAN, 16, NULL, kFPNodeIDBit,
5128 "Return file ID if file", HFILL }},
5130 { &hf_afp_file_bitmap_DataForkLen,
5131 { "Data fork size", "afp.file_bitmap.data_fork_len",
5132 FT_BOOLEAN, 16, NULL, kFPDataForkLenBit,
5133 "Return data fork size if file", HFILL }},
5135 { &hf_afp_file_bitmap_RsrcForkLen,
5136 { "Resource fork size", "afp.file_bitmap.resource_fork_len",
5137 FT_BOOLEAN, 16, NULL, kFPRsrcForkLenBit,
5138 "Return resource fork size if file", HFILL }},
5140 { &hf_afp_file_bitmap_ExtDataForkLen,
5141 { "Extended data fork size", "afp.file_bitmap.ex_data_fork_len",
5142 FT_BOOLEAN, 16, NULL, kFPExtDataForkLenBit,
5143 "Return extended (>2GB) data fork size if file", HFILL }},
5145 { &hf_afp_file_bitmap_LaunchLimit,
5146 { "Launch limit", "afp.file_bitmap.launch_limit",
5147 FT_BOOLEAN, 16, NULL, kFPLaunchLimitBit,
5148 "Return launch limit if file", HFILL }},
5150 { &hf_afp_file_bitmap_UTF8Name,
5151 { "UTF-8 name", "afp.file_bitmap.UTF8_name",
5152 FT_BOOLEAN, 16, NULL, kFPUTF8NameBit,
5153 "Return UTF-8 name if file", HFILL }},
5155 { &hf_afp_file_bitmap_ExtRsrcForkLen,
5156 { "Extended resource fork size", "afp.file_bitmap.ex_resource_fork_len",
5157 FT_BOOLEAN, 16, NULL, kFPExtRsrcForkLenBit,
5158 "Return extended (>2GB) resource fork size if file", HFILL }},
5160 { &hf_afp_file_bitmap_UnixPrivs,
5161 { "UNIX privileges", "afp.file_bitmap.unix_privs",
5162 FT_BOOLEAN, 16, NULL, kFPUnixPrivsBit,
5163 "Return UNIX privileges if file", HFILL }},
5166 { &hf_afp_file_attribute_Invisible,
5167 { "Invisible", "afp.file_attribute.invisible",
5168 FT_BOOLEAN, 16, NULL, kFPInvisibleBit,
5169 "File is not visible", HFILL }},
5171 { &hf_afp_file_attribute_MultiUser,
5172 { "Multi user", "afp.file_attribute.multi_user",
5173 FT_BOOLEAN, 16, NULL, kFPMultiUserBit,
5176 { &hf_afp_file_attribute_System,
5177 { "System", "afp.file_attribute.system",
5178 FT_BOOLEAN, 16, NULL, kFPSystemBit,
5179 "File is a system file", HFILL }},
5181 { &hf_afp_file_attribute_DAlreadyOpen,
5182 { "Data fork open", "afp.file_attribute.df_open",
5183 FT_BOOLEAN, 16, NULL, kFPDAlreadyOpenBit,
5184 "Data fork already open", HFILL }},
5186 { &hf_afp_file_attribute_RAlreadyOpen,
5187 { "Resource fork open", "afp.file_attribute.rf_open",
5188 FT_BOOLEAN, 16, NULL, kFPRAlreadyOpenBit,
5189 "Resource fork already open", HFILL }},
5191 { &hf_afp_file_attribute_WriteInhibit,
5192 { "Write inhibit", "afp.file_attribute.write_inhibit",
5193 FT_BOOLEAN, 16, NULL, kFPWriteInhibitBit,
5196 { &hf_afp_file_attribute_BackUpNeeded,
5197 { "Backup needed", "afp.file_attribute.backup_needed",
5198 FT_BOOLEAN, 16, NULL, kFPBackUpNeededBit,
5199 "File needs to be backed up", HFILL }},
5201 { &hf_afp_file_attribute_RenameInhibit,
5202 { "Rename inhibit", "afp.file_attribute.rename_inhibit",
5203 FT_BOOLEAN, 16, NULL, kFPRenameInhibitBit,
5206 { &hf_afp_file_attribute_DeleteInhibit,
5207 { "Delete inhibit", "afp.file_attribute.delete_inhibit",
5208 FT_BOOLEAN, 16, NULL, kFPDeleteInhibitBit,
5211 { &hf_afp_file_attribute_CopyProtect,
5212 { "Copy protect", "afp.file_attribute.copy_protect",
5213 FT_BOOLEAN, 16, NULL, kFPCopyProtectBit,
5216 { &hf_afp_file_attribute_SetClear,
5217 { "Set", "afp.file_attribute.set_clear",
5218 FT_BOOLEAN, 16, NULL, kFPSetClearBit,
5219 "Clear/set attribute", HFILL }},
5223 { "Volume", "afp.vol_name",
5224 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
5225 "Volume name", HFILL }},
5227 { &hf_afp_vol_flag_passwd,
5228 { "Password", "afp.vol_flag_passwd",
5229 FT_BOOLEAN, 8, NULL, 128,
5230 "Volume is password-protected", HFILL }},
5232 { &hf_afp_vol_flag_has_config,
5233 { "Has config", "afp.vol_flag_has_config",
5234 FT_BOOLEAN, 8, NULL, 1,
5235 "Volume has Apple II config info", HFILL }},
5238 { "Volume id", "afp.vol_id",
5239 FT_UINT16, BASE_DEC, NULL, 0x0,
5242 { &hf_afp_vol_signature,
5243 { "Signature", "afp.vol_signature",
5244 FT_UINT16, BASE_DEC, VALS(vol_signature_vals), 0x0,
5245 "Volume signature", HFILL }},
5247 { &hf_afp_vol_name_offset,
5248 { "Volume name offset","afp.vol_name_offset",
5249 FT_UINT16, BASE_DEC, NULL, 0x0,
5250 "Volume name offset in packet", HFILL }},
5252 { &hf_afp_vol_creation_date,
5253 { "Creation date", "afp.vol_creation_date",
5254 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0,
5255 "Volume creation date", HFILL }},
5257 { &hf_afp_vol_modification_date,
5258 { "Modification date", "afp.vol_modification_date",
5259 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0,
5260 "Volume modification date", HFILL }},
5262 { &hf_afp_vol_backup_date,
5263 { "Backup date", "afp.vol_backup_date",
5264 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0,
5265 "Volume backup date", HFILL }},
5267 { &hf_afp_vol_bytes_free,
5268 { "Bytes free", "afp.vol_bytes_free",
5269 FT_UINT32, BASE_DEC, NULL, 0x0,
5270 "Free space", HFILL }},
5272 { &hf_afp_vol_bytes_total,
5273 { "Bytes total", "afp.vol_bytes_total",
5274 FT_UINT32, BASE_DEC, NULL, 0x0,
5275 "Volume size", HFILL }},
5277 { &hf_afp_vol_ex_bytes_free,
5278 { "Extended bytes free", "afp.vol_ex_bytes_free",
5279 FT_UINT64, BASE_DEC, NULL, 0x0,
5280 "Extended (>2GB) free space", HFILL }},
5282 { &hf_afp_vol_ex_bytes_total,
5283 { "Extended bytes total", "afp.vol_ex_bytes_total",
5284 FT_UINT64, BASE_DEC, NULL, 0x0,
5285 "Extended (>2GB) volume size", HFILL }},
5287 { &hf_afp_vol_block_size,
5288 { "Block size", "afp.vol_block_size",
5289 FT_UINT32, BASE_DEC, NULL, 0x0,
5290 "Volume block size", HFILL }},
5294 FT_UINT32, BASE_DEC, NULL, 0x0,
5295 "Parent directory ID", HFILL }},
5297 { &hf_afp_dir_bitmap,
5298 { "Directory bitmap", "afp.dir_bitmap",
5299 FT_UINT16, BASE_HEX, NULL, 0x0,
5302 { &hf_afp_dir_offspring,
5303 { "Offspring", "afp.dir_offspring",
5304 FT_UINT16, BASE_DEC, NULL, 0x0,
5305 "Directory offspring", HFILL }},
5307 { &hf_afp_dir_OwnerID,
5308 { "Owner ID", "afp.dir_owner_id",
5309 FT_INT32, BASE_DEC, NULL, 0x0,
5310 "Directory owner ID", HFILL }},
5312 { &hf_afp_dir_GroupID,
5313 { "Group ID", "afp.dir_group_id",
5314 FT_INT32, BASE_DEC, NULL, 0x0,
5315 "Directory group ID", HFILL }},
5317 { &hf_afp_creation_date,
5318 { "Creation date", "afp.creation_date",
5319 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0,
5322 { &hf_afp_modification_date,
5323 { "Modification date", "afp.modification_date",
5324 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0,
5327 { &hf_afp_backup_date,
5328 { "Backup date", "afp.backup_date",
5329 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0,
5332 { &hf_afp_finder_info,
5333 { "Finder info", "afp.finder_info",
5334 FT_BYTES, BASE_NONE, NULL, 0x0,
5337 { &hf_afp_long_name_offset,
5338 { "Long name offset", "afp.long_name_offset",
5339 FT_UINT16, BASE_DEC, NULL, 0x0,
5340 "Long name offset in packet", HFILL }},
5342 { &hf_afp_short_name_offset,
5343 { "Short name offset", "afp.short_name_offset",
5344 FT_UINT16, BASE_DEC, NULL, 0x0,
5345 "Short name offset in packet", HFILL }},
5347 { &hf_afp_unicode_name_offset,
5348 { "Unicode name offset", "afp.unicode_name_offset",
5349 FT_UINT16, BASE_DEC, NULL, 0x0,
5350 "Unicode name offset in packet", HFILL }},
5352 { &hf_afp_unix_privs_uid,
5353 { "UID", "afp.unix_privs.uid",
5354 FT_UINT32, BASE_DEC, NULL, 0x0,
5355 "User ID", HFILL }},
5357 { &hf_afp_unix_privs_gid,
5358 { "GID", "afp.unix_privs.gid",
5359 FT_UINT32, BASE_DEC, NULL, 0x0,
5360 "Group ID", HFILL }},
5362 { &hf_afp_unix_privs_permissions,
5363 { "Permissions", "afp.unix_privs.permissions",
5364 FT_UINT32, BASE_OCT, NULL, 0x0,
5367 { &hf_afp_unix_privs_ua_permissions,
5368 { "User's access rights", "afp.unix_privs.ua_permissions",
5369 FT_UINT32, BASE_HEX, NULL, 0x0,
5373 { "File ID", "afp.file_id",
5374 FT_UINT32, BASE_DEC, NULL, 0x0,
5375 "File/directory ID", HFILL }},
5377 { &hf_afp_file_DataForkLen,
5378 { "Data fork size", "afp.data_fork_len",
5379 FT_UINT32, BASE_DEC, NULL, 0x0,
5382 { &hf_afp_file_RsrcForkLen,
5383 { "Resource fork size", "afp.resource_fork_len",
5384 FT_UINT32, BASE_DEC, NULL, 0x0,
5387 { &hf_afp_file_ExtDataForkLen,
5388 { "Extended data fork size", "afp.ext_data_fork_len",
5389 FT_UINT64, BASE_DEC, NULL, 0x0,
5390 "Extended (>2GB) data fork length", HFILL }},
5392 { &hf_afp_file_ExtRsrcForkLen,
5393 { "Extended resource fork size", "afp.ext_resource_fork_len",
5394 FT_UINT64, BASE_DEC, NULL, 0x0,
5395 "Extended (>2GB) resource fork length", HFILL }},
5397 { &hf_afp_file_bitmap,
5398 { "File bitmap", "afp.file_bitmap",
5399 FT_UINT16, BASE_HEX, NULL, 0x0,
5402 { &hf_afp_req_count,
5403 { "Req count", "afp.req_count",
5404 FT_UINT16, BASE_DEC, NULL, 0x0,
5405 "Maximum number of structures returned", HFILL }},
5407 { &hf_afp_start_index,
5408 { "Start index", "afp.start_index",
5409 FT_UINT16, BASE_DEC, NULL, 0x0,
5410 "First structure returned", HFILL }},
5412 { &hf_afp_max_reply_size,
5413 { "Reply size", "afp.reply_size",
5414 FT_UINT16, BASE_DEC, NULL, 0x0,
5417 { &hf_afp_start_index32,
5418 { "Start index", "afp.start_index32",
5419 FT_UINT32, BASE_DEC, NULL, 0x0,
5420 "First structure returned", HFILL }},
5422 { &hf_afp_max_reply_size32,
5423 { "Reply size", "afp.reply_size32",
5424 FT_UINT32, BASE_DEC, NULL, 0x0,
5427 { &hf_afp_file_flag,
5428 { "Dir", "afp.file_flag",
5429 FT_BOOLEAN, 8, NULL, 0x80,
5430 "Is a dir", HFILL }},
5432 { &hf_afp_create_flag,
5433 { "Hard create", "afp.create_flag",
5434 FT_BOOLEAN, 8, NULL, 0x80,
5435 "Soft/hard create file", HFILL }},
5437 { &hf_afp_request_bitmap_Attributes,
5438 { "Attributes", "afp.request_bitmap.attributes",
5439 FT_BOOLEAN, 32, NULL, kFPAttributeBit,
5440 "Search attributes", HFILL }},
5442 { &hf_afp_request_bitmap_ParentDirID,
5443 { "DID", "afp.request_bitmap.did",
5444 FT_BOOLEAN, 32, NULL, kFPParentDirIDBit,
5445 "Search parent directory ID", HFILL }},
5447 { &hf_afp_request_bitmap_CreateDate,
5448 { "Creation date", "afp.request_bitmap.create_date",
5449 FT_BOOLEAN, 32, NULL, kFPCreateDateBit,
5450 "Search creation date", HFILL }},
5452 { &hf_afp_request_bitmap_ModDate,
5453 { "Modification date", "afp.request_bitmap.mod_date",
5454 FT_BOOLEAN, 32, NULL, kFPModDateBit,
5455 "Search modification date", HFILL }},
5457 { &hf_afp_request_bitmap_BackupDate,
5458 { "Backup date", "afp.request_bitmap.backup_date",
5459 FT_BOOLEAN, 32, NULL, kFPBackupDateBit,
5460 "Search backup date", HFILL }},
5462 { &hf_afp_request_bitmap_FinderInfo,
5463 { "Finder info", "afp.request_bitmap.finder_info",
5464 FT_BOOLEAN, 32, NULL, kFPFinderInfoBit,
5465 "Search finder info", HFILL }},
5467 { &hf_afp_request_bitmap_LongName,
5468 { "Long name", "afp.request_bitmap.long_name",
5469 FT_BOOLEAN, 32, NULL, kFPLongNameBit,
5470 "Search long name", HFILL }},
5472 { &hf_afp_request_bitmap_DataForkLen,
5473 { "Data fork size", "afp.request_bitmap.data_fork_len",
5474 FT_BOOLEAN, 32, NULL, kFPDataForkLenBit,
5475 "Search data fork size", HFILL }},
5477 { &hf_afp_request_bitmap_OffspringCount,
5478 { "Offspring count", "afp.request_bitmap.offspring_count",
5479 FT_BOOLEAN, 32, NULL, kFPOffspringCountBit,
5480 "Search offspring count", HFILL }},
5482 { &hf_afp_request_bitmap_RsrcForkLen,
5483 { "Resource fork size", "afp.request_bitmap.resource_fork_len",
5484 FT_BOOLEAN, 32, NULL, kFPRsrcForkLenBit,
5485 "Search resource fork size", HFILL }},
5487 { &hf_afp_request_bitmap_ExtDataForkLen,
5488 { "Extended data fork size", "afp.request_bitmap.ex_data_fork_len",
5489 FT_BOOLEAN, 32, NULL, kFPExtDataForkLenBit,
5490 "Search extended (>2GB) data fork size", HFILL }},
5492 { &hf_afp_request_bitmap_UTF8Name,
5493 { "UTF-8 name", "afp.request_bitmap.UTF8_name",
5494 FT_BOOLEAN, 32, NULL, kFPUTF8NameBit,
5495 "Search UTF-8 name", HFILL }},
5497 { &hf_afp_request_bitmap_ExtRsrcForkLen,
5498 { "Extended resource fork size", "afp.request_bitmap.ex_resource_fork_len",
5499 FT_BOOLEAN, 32, NULL, kFPExtRsrcForkLenBit,
5500 "Search extended (>2GB) resource fork size", HFILL }},
5502 { &hf_afp_request_bitmap_PartialNames,
5503 { "Match on partial names", "afp.request_bitmap.partial_names",
5504 FT_BOOLEAN, 32, NULL, 0x80000000,
5507 { &hf_afp_request_bitmap,
5508 { "Request bitmap", "afp.request_bitmap",
5509 FT_UINT32, BASE_HEX, NULL, 0x0,
5512 { &hf_afp_struct_size,
5513 { "Struct size", "afp.struct_size",
5514 FT_UINT8, BASE_DEC, NULL,0,
5515 "Sizeof of struct", HFILL }},
5517 { &hf_afp_struct_size16,
5518 { "Struct size", "afp.struct_size16",
5519 FT_UINT16, BASE_DEC, NULL,0,
5520 "Sizeof of struct", HFILL }},
5523 { "From", "afp.flag",
5524 FT_UINT8, BASE_HEX, VALS(flag_vals), 0x80,
5525 "Offset is relative to start/end of the fork", HFILL }},
5528 { "DT ref", "afp.dt_ref",
5529 FT_UINT16, BASE_DEC, NULL, 0x0,
5530 "Desktop database reference num", HFILL }},
5533 { "Fork", "afp.ofork",
5534 FT_UINT16, BASE_DEC, NULL, 0x0,
5535 "Open fork reference number", HFILL }},
5538 { "Offset", "afp.offset",
5539 FT_INT32, BASE_DEC, NULL, 0x0,
5543 { "Count", "afp.rw_count",
5544 FT_INT32, BASE_DEC, NULL, 0x0,
5545 "Number of bytes to be read/written", HFILL }},
5547 { &hf_afp_newline_mask,
5548 { "Newline mask", "afp.newline_mask",
5549 FT_UINT8, BASE_HEX, NULL, 0x0,
5550 "Value to AND bytes with when looking for newline", HFILL }},
5552 { &hf_afp_newline_char,
5553 { "Newline char", "afp.newline_char",
5554 FT_UINT8, BASE_HEX, NULL, 0x0,
5555 "Value to compare ANDed bytes with when looking for newline", HFILL }},
5557 { &hf_afp_last_written,
5558 { "Last written", "afp.last_written",
5559 FT_UINT32, BASE_DEC, NULL, 0x0,
5560 "Offset of the last byte written", HFILL }},
5562 { &hf_afp_actual_count,
5563 { "Count", "afp.actual_count",
5564 FT_INT32, BASE_DEC, NULL, 0x0,
5565 "Number of bytes returned by read/write", HFILL }},
5567 { &hf_afp_ofork_len,
5568 { "New length", "afp.ofork_len",
5569 FT_INT32, BASE_DEC, NULL, 0x0,
5572 { &hf_afp_path_type,
5573 { "Type", "afp.path_type",
5574 FT_UINT8, BASE_HEX, VALS(path_type_vals), 0,
5575 "Type of names", HFILL }},
5578 { "Len", "afp.path_len",
5579 FT_UINT8, BASE_DEC, NULL, 0x0,
5580 "Path length", HFILL }},
5582 { &hf_afp_path_unicode_len,
5583 { "Len", "afp.path_unicode_len",
5584 FT_UINT16, BASE_DEC, NULL, 0x0,
5585 "Path length (unicode)", HFILL }},
5587 { &hf_afp_path_unicode_hint,
5588 { "Unicode hint", "afp.path_unicode_hint",
5589 FT_UINT32, BASE_HEX|BASE_EXT_STRING, &unicode_hint_vals_ext, 0x0,
5592 { &hf_afp_path_name,
5593 { "Name", "afp.path_name",
5594 FT_STRING, BASE_NONE, NULL, 0x0,
5595 "Path name", HFILL }},
5597 { &hf_afp_fork_type,
5598 { "Resource fork", "afp.fork_type",
5599 FT_BOOLEAN, 8, NULL, 0x80,
5600 "Data/resource fork", HFILL }},
5602 { &hf_afp_access_mode,
5603 { "Access mode", "afp.access",
5604 FT_UINT8, BASE_HEX, NULL, 0x0,
5605 "Fork access mode", HFILL }},
5607 { &hf_afp_access_read,
5608 { "Read", "afp.access.read",
5609 FT_BOOLEAN, 8, NULL, 1,
5610 "Open for reading", HFILL }},
5612 { &hf_afp_access_write,
5613 { "Write", "afp.access.write",
5614 FT_BOOLEAN, 8, NULL, 2,
5615 "Open for writing", HFILL }},
5617 { &hf_afp_access_deny_read,
5618 { "Deny read", "afp.access.deny_read",
5619 FT_BOOLEAN, 8, NULL, 0x10,
5622 { &hf_afp_access_deny_write,
5623 { "Deny write", "afp.access.deny_write",
5624 FT_BOOLEAN, 8, NULL, 0x20,
5628 { "Comment", "afp.comment",
5629 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
5630 "File/folder comment", HFILL }},
5632 { &hf_afp_file_creator,
5633 { "File creator", "afp.file_creator",
5634 FT_STRING, BASE_NONE, NULL, 0x0,
5637 { &hf_afp_file_type,
5638 { "File type", "afp.file_type",
5639 FT_STRING, BASE_NONE, NULL, 0x0,
5642 { &hf_afp_icon_type,
5643 { "Icon type", "afp.icon_type",
5644 FT_UINT8, BASE_HEX, NULL , 0,
5647 { &hf_afp_icon_length,
5648 { "Size", "afp.icon_length",
5649 FT_UINT16, BASE_DEC, NULL, 0x0,
5650 "Size for icon bitmap", HFILL }},
5652 { &hf_afp_icon_index,
5653 { "Index", "afp.icon_index",
5654 FT_UINT16, BASE_DEC, NULL, 0x0,
5655 "Icon index in desktop database", HFILL }},
5658 { "Tag", "afp.icon_tag",
5659 FT_UINT32, BASE_HEX, NULL, 0x0,
5660 "Icon tag", HFILL }},
5662 { &hf_afp_appl_index,
5663 { "Index", "afp.appl_index",
5664 FT_UINT16, BASE_DEC, NULL, 0x0,
5665 "Application index", HFILL }},
5668 { "Tag", "afp.appl_tag",
5669 FT_UINT32, BASE_HEX, NULL, 0x0,
5670 "Application tag", HFILL }},
5673 { "unlock", "afp.lock_op",
5674 FT_BOOLEAN, 8, NULL, 0x1,
5675 "Lock/unlock op", HFILL }},
5677 { &hf_afp_lock_from,
5678 { "End", "afp.lock_from",
5679 FT_BOOLEAN, 8, NULL, 0x80,
5680 "Offset is relative to the end of the fork", HFILL }},
5682 { &hf_afp_lock_offset,
5683 { "Offset", "afp.lock_offset",
5684 FT_INT32, BASE_DEC, NULL, 0x0,
5685 "First byte to be locked", HFILL }},
5688 { "Length", "afp.lock_len",
5689 FT_INT32, BASE_DEC, NULL, 0x0,
5690 "Number of bytes to be locked/unlocked", HFILL }},
5692 { &hf_afp_lock_range_start,
5693 { "Start", "afp.lock_range_start",
5694 FT_INT32, BASE_DEC, NULL, 0x0,
5695 "First byte locked/unlocked", HFILL }},
5698 { "Access rights", "afp.dir_ar",
5699 FT_UINT32, BASE_HEX, NULL, 0x0,
5700 "Directory access rights", HFILL }},
5702 { &hf_afp_dir_ar_o_search,
5703 { "Owner has search access", "afp.dir_ar.o_search",
5704 FT_BOOLEAN, 32, NULL, AR_O_SEARCH,
5707 { &hf_afp_dir_ar_o_read,
5708 { "Owner has read access", "afp.dir_ar.o_read",
5709 FT_BOOLEAN, 32, NULL, AR_O_READ,
5712 { &hf_afp_dir_ar_o_write,
5713 { "Owner has write access", "afp.dir_ar.o_write",
5714 FT_BOOLEAN, 32, NULL, AR_O_WRITE,
5717 { &hf_afp_dir_ar_g_search,
5718 { "Group has search access", "afp.dir_ar.g_search",
5719 FT_BOOLEAN, 32, NULL, AR_G_SEARCH,
5722 { &hf_afp_dir_ar_g_read,
5723 { "Group has read access", "afp.dir_ar.g_read",
5724 FT_BOOLEAN, 32, NULL, AR_G_READ,
5727 { &hf_afp_dir_ar_g_write,
5728 { "Group has write access", "afp.dir_ar.g_write",
5729 FT_BOOLEAN, 32, NULL, AR_G_WRITE,
5732 { &hf_afp_dir_ar_e_search,
5733 { "Everyone has search access", "afp.dir_ar.e_search",
5734 FT_BOOLEAN, 32, NULL, AR_E_SEARCH,
5737 { &hf_afp_dir_ar_e_read,
5738 { "Everyone has read access", "afp.dir_ar.e_read",
5739 FT_BOOLEAN, 32, NULL, AR_E_READ,
5742 { &hf_afp_dir_ar_e_write,
5743 { "Everyone has write access", "afp.dir_ar.e_write",
5744 FT_BOOLEAN, 32, NULL, AR_E_WRITE,
5747 { &hf_afp_dir_ar_u_search,
5748 { "User has search access", "afp.dir_ar.u_search",
5749 FT_BOOLEAN, 32, NULL, AR_U_SEARCH,
5752 { &hf_afp_dir_ar_u_read,
5753 { "User has read access", "afp.dir_ar.u_read",
5754 FT_BOOLEAN, 32, NULL, AR_U_READ,
5757 { &hf_afp_dir_ar_u_write,
5758 { "User has write access", "afp.dir_ar.u_write",
5759 FT_BOOLEAN, 32, NULL, AR_U_WRITE,
5762 { &hf_afp_dir_ar_blank,
5763 { "Blank access right", "afp.dir_ar.blank",
5764 FT_BOOLEAN, 32, NULL, AR_BLANK,
5767 { &hf_afp_dir_ar_u_own,
5768 { "User is the owner", "afp.dir_ar.u_owner",
5769 FT_BOOLEAN, 32, NULL, AR_U_OWN,
5770 "Current user is the directory owner", HFILL }},
5772 { &hf_afp_server_time,
5773 { "Server time", "afp.server_time",
5774 FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0,
5777 { &hf_afp_cat_req_matches,
5778 { "Max answers", "afp.cat_req_matches",
5779 FT_INT32, BASE_DEC, NULL, 0x0,
5780 "Maximum number of matches to return.", HFILL }},
5783 { "Reserved", "afp.reserved",
5784 FT_BYTES, BASE_NONE, NULL, 0x0,
5787 { &hf_afp_cat_count,
5788 { "Cat count", "afp.cat_count",
5789 FT_UINT32, BASE_DEC, NULL, 0x0,
5790 "Number of structures returned", HFILL }},
5792 { &hf_afp_cat_position,
5793 { "Position", "afp.cat_position",
5794 FT_BYTES, BASE_NONE, NULL, 0x0,
5795 "Reserved", HFILL }},
5797 { &hf_afp_map_name_type,
5798 { "Type", "afp.map_name_type",
5799 FT_UINT8, BASE_DEC|BASE_EXT_STRING, &map_name_type_vals_ext, 0x0,
5800 "Map name type", HFILL }},
5802 { &hf_afp_map_id_type,
5803 { "Type", "afp.map_id_type",
5804 FT_UINT8, BASE_DEC|BASE_EXT_STRING, &map_id_type_vals_ext, 0x0,
5805 "Map ID type", HFILL }},
5808 { "ID", "afp.map_id",
5809 FT_UINT32, BASE_DEC, NULL, 0x0,
5810 "User/Group ID", HFILL }},
5812 { &hf_afp_map_id_reply_type,
5813 { "Reply type", "afp.map_id_reply_type",
5814 FT_UINT32, BASE_DEC, VALS(map_id_reply_type_vals), 0x0,
5815 "Map ID reply type", HFILL }},
5818 { "Name", "afp.map_name",
5819 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
5820 "User/Group name", HFILL }},
5823 { &hf_afp_lock_offset64,
5824 { "Offset", "afp.lock_offset64",
5825 FT_INT64, BASE_DEC, NULL, 0x0,
5826 "First byte to be locked (64 bits)", HFILL }},
5828 { &hf_afp_lock_len64,
5829 { "Length", "afp.lock_len64",
5830 FT_INT64, BASE_DEC, NULL, 0x0,
5831 "Number of bytes to be locked/unlocked (64 bits)", HFILL }},
5833 { &hf_afp_lock_range_start64,
5834 { "Start", "afp.lock_range_start64",
5835 FT_INT64, BASE_DEC, NULL, 0x0,
5836 "First byte locked/unlocked (64 bits)", HFILL }},
5839 { "Offset", "afp.offset64",
5840 FT_INT64, BASE_DEC, NULL, 0x0,
5841 "Offset (64 bits)", HFILL }},
5843 { &hf_afp_rw_count64,
5844 { "Count", "afp.rw_count64",
5845 FT_INT64, BASE_DEC, NULL, 0x0,
5846 "Number of bytes to be read/written (64 bits)", HFILL }},
5848 { &hf_afp_last_written64,
5849 { "Last written", "afp.last_written64",
5850 FT_UINT64, BASE_DEC, NULL, 0x0,
5851 "Offset of the last byte written (64 bits)", HFILL }},
5853 { &hf_afp_ofork_len64,
5854 { "New length", "afp.ofork_len64",
5855 FT_INT64, BASE_DEC, NULL, 0x0,
5856 "New length (64 bits)", HFILL }},
5858 { &hf_afp_session_token_type,
5859 { "Type", "afp.session_token_type",
5860 FT_UINT16, BASE_HEX|BASE_EXT_STRING, &token_type_vals_ext, 0x0,
5861 "Session token type", HFILL }},
5863 /* FIXME FT_UINT32 in specs */
5864 { &hf_afp_session_token_len,
5865 { "Len", "afp.session_token_len",
5866 FT_UINT32, BASE_DEC, NULL, 0x0,
5867 "Session token length", HFILL }},
5869 { &hf_afp_session_token_timestamp,
5870 { "Time stamp", "afp.session_token_timestamp",
5871 FT_UINT32, BASE_HEX, NULL, 0x0,
5872 "Session time stamp", HFILL }},
5874 { &hf_afp_session_token,
5875 { "Token", "afp.session_token",
5876 FT_BYTES, BASE_NONE, NULL, 0x0,
5877 "Session token", HFILL }},
5879 { &hf_afp_user_flag,
5880 { "Flag", "afp.user_flag",
5881 FT_UINT8, BASE_HEX, VALS(user_flag_vals), 0x01,
5882 "User Info flag", HFILL }},
5885 { "User ID", "afp.user_ID",
5886 FT_UINT32, BASE_DEC, NULL, 0x0,
5890 { "Group ID", "afp.group_ID",
5891 FT_UINT32, BASE_DEC, NULL, 0x0,
5895 { "UUID", "afp.uuid",
5896 FT_BYTES, BASE_NONE, NULL, 0x0,
5900 { "GRPUUID", "afp.grpuuid",
5901 FT_BYTES, BASE_NONE, NULL, 0x0,
5902 "Group UUID", HFILL }},
5904 { &hf_afp_user_bitmap,
5905 { "Bitmap", "afp.user_bitmap",
5906 FT_UINT16, BASE_HEX, NULL, 0,
5907 "User Info bitmap", HFILL }},
5909 { &hf_afp_user_bitmap_UID,
5910 { "User ID", "afp.user_bitmap.UID",
5911 FT_BOOLEAN, 16, NULL, 0x01,
5914 { &hf_afp_user_bitmap_GID,
5915 { "Primary group ID", "afp.user_bitmap.GID",
5916 FT_BOOLEAN, 16, NULL, 0x02,
5919 { &hf_afp_user_bitmap_UUID,
5920 { "UUID", "afp.user_bitmap.UUID",
5921 FT_BOOLEAN, 16, NULL, 0x04,
5924 { &hf_afp_message_type,
5925 { "Type", "afp.message_type",
5926 FT_UINT16, BASE_HEX, VALS(server_message_type), 0,
5927 "Type of server message", HFILL }},
5929 { &hf_afp_message_bitmap,
5930 { "Bitmap", "afp.message_bitmap",
5931 FT_UINT16, BASE_HEX, NULL, 0,
5932 "Message bitmap", HFILL }},
5934 { &hf_afp_message_bitmap_REQ,
5935 { "Request message", "afp.message_bitmap.requested",
5936 FT_BOOLEAN, 16, NULL, 0x01,
5937 "Message Requested", HFILL }},
5939 { &hf_afp_message_bitmap_UTF,
5940 { "Message is UTF8", "afp.message_bitmap.utf8",
5941 FT_BOOLEAN, 16, NULL, 0x02,
5944 { &hf_afp_message_len,
5945 { "Len", "afp.message_length",
5946 FT_UINT32, BASE_DEC, NULL, 0x0,
5947 "Message length", HFILL }},
5950 { "Message", "afp.message",
5951 FT_STRING, BASE_NONE, NULL, 0x0,
5954 { &hf_afp_reqcount64,
5955 { "Count", "afp.reqcount64",
5956 FT_INT64, BASE_DEC, NULL, 0x0,
5957 "Request Count (64 bits)", HFILL }},
5959 { &hf_afp_extattr_bitmap,
5960 { "Bitmap", "afp.extattr_bitmap",
5961 FT_UINT16, BASE_HEX, NULL, 0,
5962 "Extended attributes bitmap", HFILL }},
5964 { &hf_afp_extattr_bitmap_NoFollow,
5965 { "No follow symlinks", "afp.extattr_bitmap.nofollow",
5966 FT_BOOLEAN, 16, NULL, 0x01,
5967 "Do not follow symlink", HFILL }},
5969 { &hf_afp_extattr_bitmap_Create,
5970 { "Create", "afp.extattr_bitmap.create",
5971 FT_BOOLEAN, 16, NULL, 0x02,
5972 "Create extended attribute", HFILL }},
5974 { &hf_afp_extattr_bitmap_Replace,
5975 { "Replace", "afp.extattr_bitmap.replace",
5976 FT_BOOLEAN, 16, NULL, 0x04,
5977 "Replace extended attribute", HFILL }},
5979 { &hf_afp_extattr_namelen,
5980 { "Length", "afp.extattr.namelen",
5981 FT_UINT16, BASE_DEC, NULL, 0x0,
5982 "Extended attribute name length", HFILL }},
5984 { &hf_afp_extattr_name,
5985 { "Name", "afp.extattr.name",
5986 FT_STRING, BASE_NONE, NULL, 0x0,
5987 "Extended attribute name", HFILL }},
5989 { &hf_afp_extattr_len,
5990 { "Length", "afp.extattr.len",
5991 FT_UINT32, BASE_DEC, NULL, 0x0,
5992 "Extended attribute length", HFILL }},
5994 { &hf_afp_extattr_data,
5995 { "Data", "afp.extattr.data",
5996 FT_BYTES, BASE_NONE, NULL, 0x0,
5997 "Extended attribute data", HFILL }},
5999 { &hf_afp_extattr_req_count,
6000 { "Request Count", "afp.extattr.req_count",
6001 FT_UINT16, BASE_DEC, NULL, 0x0,
6002 "Request Count.", HFILL }},
6004 { &hf_afp_extattr_start_index,
6005 { "Index", "afp.extattr.start_index",
6006 FT_UINT32, BASE_DEC, NULL, 0x0,
6007 "Start index", HFILL }},
6009 { &hf_afp_extattr_reply_size,
6010 { "Reply size", "afp.extattr.reply_size",
6011 FT_UINT32, BASE_DEC, NULL, 0x0,
6014 /* ACL control list bitmap */
6015 { &hf_afp_access_bitmap,
6016 { "Bitmap", "afp.access_bitmap",
6017 FT_UINT16, BASE_HEX, NULL, 0,
6018 "Bitmap (reserved)", HFILL }},
6020 { &hf_afp_acl_list_bitmap,
6021 { "ACL bitmap", "afp.acl_list_bitmap",
6022 FT_UINT16, BASE_HEX, NULL, 0,
6023 "ACL control list bitmap", HFILL }},
6025 { &hf_afp_acl_list_bitmap_UUID,
6026 { "UUID", "afp.acl_list_bitmap.UUID",
6027 FT_BOOLEAN, 16, NULL, kFileSec_UUID,
6028 "User UUID", HFILL }},
6030 { &hf_afp_acl_list_bitmap_GRPUUID,
6031 { "GRPUUID", "afp.acl_list_bitmap.GRPUUID",
6032 FT_BOOLEAN, 16, NULL, kFileSec_GRPUUID,
6033 "Group UUID", HFILL }},
6035 { &hf_afp_acl_list_bitmap_ACL,
6036 { "ACL", "afp.acl_list_bitmap.ACL",
6037 FT_BOOLEAN, 16, NULL, kFileSec_ACL,
6040 { &hf_afp_acl_list_bitmap_REMOVEACL,
6041 { "Remove ACL", "afp.acl_list_bitmap.REMOVEACL",
6042 FT_BOOLEAN, 16, NULL, kFileSec_REMOVEACL,
6045 { &hf_afp_acl_list_bitmap_Inherit,
6046 { "Inherit", "afp.acl_list_bitmap.Inherit",
6047 FT_BOOLEAN, 16, NULL, kFileSec_Inherit,
6048 "Inherit ACL", HFILL }},
6050 { &hf_afp_acl_entrycount,
6051 { "Count", "afp.acl_entrycount",
6052 FT_UINT32, BASE_HEX, NULL, 0,
6053 "Number of ACL entries", HFILL }},
6055 { &hf_afp_acl_flags,
6056 { "ACL flags", "afp.acl_flags",
6057 FT_UINT32, BASE_HEX, NULL, 0,
6060 { &hf_afp_ace_applicable,
6061 { "ACE", "afp.ace_applicable",
6062 FT_BYTES, BASE_NONE, NULL, 0x0,
6063 "ACE applicable", HFILL }},
6065 { &hf_afp_ace_rights,
6066 { "Rights", "afp.ace_rights",
6067 FT_UINT32, BASE_HEX, NULL, 0,
6068 "ACE flags", HFILL }},
6070 { &hf_afp_acl_access_bitmap,
6071 { "Bitmap", "afp.acl_access_bitmap",
6072 FT_UINT32, BASE_HEX, NULL, 0,
6073 "ACL access bitmap", HFILL }},
6075 { &hf_afp_acl_access_bitmap_read_data,
6076 { "Read/List", "afp.acl_access_bitmap.read_data",
6077 FT_BOOLEAN, 32, NULL, KAUTH_VNODE_READ_DATA,
6078 "Read data / list directory", HFILL }},
6080 { &hf_afp_acl_access_bitmap_write_data,
6081 { "Write/Add file", "afp.acl_access_bitmap.write_data",
6082 FT_BOOLEAN, 32, NULL, KAUTH_VNODE_WRITE_DATA,
6083 "Write data to a file / add a file to a directory", HFILL }},
6085 { &hf_afp_acl_access_bitmap_execute,
6086 { "Execute/Search", "afp.acl_access_bitmap.execute",
6087 FT_BOOLEAN, 32, NULL, KAUTH_VNODE_EXECUTE,
6088 "Execute a program", HFILL }},
6090 { &hf_afp_acl_access_bitmap_delete,
6091 { "Delete", "afp.acl_access_bitmap.delete",
6092 FT_BOOLEAN, 32, NULL, KAUTH_VNODE_DELETE,
6095 { &hf_afp_acl_access_bitmap_append_data,
6096 { "Append data/create subdir", "afp.acl_access_bitmap.append_data",
6097 FT_BOOLEAN, 32, NULL, KAUTH_VNODE_APPEND_DATA,
6098 "Append data to a file / create a subdirectory", HFILL }},
6100 { &hf_afp_acl_access_bitmap_delete_child,
6101 { "Delete dir", "afp.acl_access_bitmap.delete_child",
6102 FT_BOOLEAN, 32, NULL, KAUTH_VNODE_DELETE_CHILD,
6103 "Delete directory", HFILL }},
6105 { &hf_afp_acl_access_bitmap_read_attrs,
6106 { "Read attributes", "afp.acl_access_bitmap.read_attrs",
6107 FT_BOOLEAN, 32, NULL, KAUTH_VNODE_READ_ATTRIBUTES,
6110 { &hf_afp_acl_access_bitmap_write_attrs,
6111 { "Write attributes", "afp.acl_access_bitmap.write_attrs",
6112 FT_BOOLEAN, 32, NULL, KAUTH_VNODE_WRITE_ATTRIBUTES,
6115 { &hf_afp_acl_access_bitmap_read_extattrs,
6116 { "Read extended attributes", "afp.acl_access_bitmap.read_extattrs",
6117 FT_BOOLEAN, 32, NULL, KAUTH_VNODE_READ_EXTATTRIBUTES,
6120 { &hf_afp_acl_access_bitmap_write_extattrs,
6121 { "Write extended attributes", "afp.acl_access_bitmap.write_extattrs",
6122 FT_BOOLEAN, 32, NULL, KAUTH_VNODE_WRITE_EXTATTRIBUTES,
6125 { &hf_afp_acl_access_bitmap_read_security,
6126 { "Read security", "afp.acl_access_bitmap.read_security",
6127 FT_BOOLEAN, 32, NULL, KAUTH_VNODE_READ_SECURITY,
6128 "Read access rights", HFILL }},
6130 { &hf_afp_acl_access_bitmap_write_security,
6131 { "Write security", "afp.acl_access_bitmap.write_security",
6132 FT_BOOLEAN, 32, NULL, KAUTH_VNODE_WRITE_SECURITY,
6133 "Write access rights", HFILL }},
6135 { &hf_afp_acl_access_bitmap_change_owner,
6136 { "Change owner", "afp.acl_access_bitmap.change_owner",
6137 FT_BOOLEAN, 32, NULL, KAUTH_VNODE_CHANGE_OWNER,
6140 { &hf_afp_acl_access_bitmap_synchronize,
6141 { "Synchronize", "afp.acl_access_bitmap.synchronize",
6142 FT_BOOLEAN, 32, NULL, KAUTH_VNODE_SYNCHRONIZE,
6145 { &hf_afp_acl_access_bitmap_generic_all,
6146 { "Generic all", "afp.acl_access_bitmap.generic_all",
6147 FT_BOOLEAN, 32, NULL, KAUTH_VNODE_GENERIC_ALL,
6150 { &hf_afp_acl_access_bitmap_generic_execute,
6151 { "Generic execute", "afp.acl_access_bitmap.generic_execute",
6152 FT_BOOLEAN, 32, NULL, KAUTH_VNODE_GENERIC_EXECUTE,
6155 { &hf_afp_acl_access_bitmap_generic_write,
6156 { "Generic write", "afp.acl_access_bitmap.generic_write",
6157 FT_BOOLEAN, 32, NULL, KAUTH_VNODE_GENERIC_WRITE,
6160 { &hf_afp_acl_access_bitmap_generic_read,
6161 { "Generic read", "afp.acl_access_bitmap.generic_read",
6162 FT_BOOLEAN, 32, NULL, KAUTH_VNODE_GENERIC_READ,
6165 { &hf_afp_ace_flags,
6166 { "Flags", "afp.ace_flags",
6167 FT_UINT32, BASE_HEX, NULL, 0,
6168 "ACE flags", HFILL }},
6170 { &hf_afp_ace_flags_allow,
6171 { "Allow", "afp.ace_flags.allow",
6172 FT_BOOLEAN, 32, NULL, ACE_ALLOW,
6173 "Allow rule", HFILL }},
6175 { &hf_afp_ace_flags_deny,
6176 { "Deny", "afp.ace_flags.deny",
6177 FT_BOOLEAN, 32, NULL, ACE_DENY,
6178 "Deny rule", HFILL }},
6180 { &hf_afp_ace_flags_inherited,
6181 { "Inherited", "afp.ace_flags.inherited",
6182 FT_BOOLEAN, 32, NULL, ACE_INHERITED,
6185 { &hf_afp_ace_flags_fileinherit,
6186 { "File inherit", "afp.ace_flags.file_inherit",
6187 FT_BOOLEAN, 32, NULL, ACE_FILE_INHERIT,
6190 { &hf_afp_ace_flags_dirinherit,
6191 { "Dir inherit", "afp.ace_flags.directory_inherit",
6192 FT_BOOLEAN, 32, NULL, ACE_DIR_INHERIT,
6195 { &hf_afp_ace_flags_limitinherit,
6196 { "Limit inherit", "afp.ace_flags.limit_inherit",
6197 FT_BOOLEAN, 32, NULL, ACE_LIMIT_INHERIT,
6200 { &hf_afp_ace_flags_onlyinherit,
6201 { "Only inherit", "afp.ace_flags.only_inherit",
6202 FT_BOOLEAN, 32, NULL, ACE_ONLY_INHERIT,
6205 { &hf_afp_spotlight_request_flags,
6206 { "Flags", "afp.spotlight.flags",
6207 FT_UINT32, BASE_HEX, NULL, 0x0,
6208 "Spotlight RPC Flags", HFILL }},
6210 { &hf_afp_spotlight_request_command,
6211 { "Command", "afp.spotlight.command",
6212 FT_UINT32, BASE_HEX, NULL, 0x0,
6213 "Spotlight RPC Command", HFILL }},
6215 { &hf_afp_spotlight_request_reserved,
6216 { "Padding", "afp.spotlight.reserved",
6217 FT_UINT32, BASE_HEX, NULL, 0x0,
6218 "Spotlight RPC Padding", HFILL }},
6220 { &hf_afp_spotlight_volpath_client,
6221 { "Client's volume path", "afp.spotlight.volpath_client",
6222 FT_STRING, BASE_NONE, NULL, 0x0,
6225 { &hf_afp_spotlight_volpath_server,
6226 { "Server's volume path", "afp.spotlight.volpath_server",
6227 FT_STRING, BASE_NONE, NULL, 0x0,
6228 "Servers's volume path", HFILL }},
6230 { &hf_afp_spotlight_returncode,
6231 { "Return code", "afp.spotlight.return",
6232 FT_INT32, BASE_DEC, NULL, 0x0,
6235 { &hf_afp_spotlight_volflags,
6236 { "Volume flags", "afp.spotlight.volflags",
6237 FT_UINT32, BASE_HEX, NULL, 0x0,
6240 { &hf_afp_spotlight_reqlen,
6241 { "Length", "afp.spotlight.reqlen",
6242 FT_UINT32, BASE_DEC, NULL, 0x0,
6245 { &hf_afp_spotlight_toc_query_end,
6246 { "End marker", "afp.spotlight.query_end",
6247 FT_UINT32, BASE_HEX, NULL, 0x0,
6250 { &hf_afp_spotlight_mdstring,
6251 { "mdquery string", "afp.spotlight.mds",
6252 FT_STRINGZ, BASE_NONE, NULL, 0x0,
6256 { "Unknown parameter", "afp.unknown",
6257 FT_BYTES, BASE_NONE, NULL, 0x0,
6261 static gint *ett[] = {
6263 &ett_afp_server_vol,
6266 &ett_afp_vol_bitmap,
6267 &ett_afp_vol_attribute,
6268 &ett_afp_dir_bitmap,
6269 &ett_afp_file_bitmap,
6270 &ett_afp_unix_privs,
6272 &ett_afp_enumerate_line,
6273 &ett_afp_access_mode,
6274 &ett_afp_dir_attribute,
6275 &ett_afp_file_attribute,
6277 &ett_afp_lock_flags,
6279 &ett_afp_cat_search,
6280 &ett_afp_cat_r_bitmap,
6283 &ett_afp_user_bitmap,
6284 &ett_afp_message_bitmap,
6285 &ett_afp_extattr_bitmap,
6286 &ett_afp_extattr_names,
6287 &ett_afp_acl_list_bitmap,
6288 &ett_afp_acl_access_bitmap,
6289 &ett_afp_ace_entries,
6292 &ett_afp_spotlight_queries,
6293 &ett_afp_spotlight_query_line,
6294 &ett_afp_spotlight_query,
6295 &ett_afp_spotlight_data,
6296 &ett_afp_spotlight_toc
6299 proto_afp = proto_register_protocol("Apple Filing Protocol", "AFP", "afp");
6300 proto_register_field_array(proto_afp, hf, array_length(hf));
6301 proto_register_subtree_array(ett, array_length(ett));
6303 register_init_routine(afp_reinit);
6305 register_dissector("afp", dissect_afp, proto_afp);
6307 afp_tap = register_tap("afp");
6311 proto_reg_handoff_afp(void)
6313 data_handle = find_dissector("data");
6316 /* -------------------------------