2 * Routines for afp packet dissection
3 * Copyright 2002, Didier Gautheron <dgautheron@magic.fr>
5 * $Id: packet-afp.c,v 1.26 2002/11/28 03:57:49 guy Exp $
7 * Ethereal - Network traffic analyzer
8 * By Gerald Combs <gerald@ethereal.com>
9 * Copyright 1998 Gerald Combs
11 * Copied from README.developer
12 * Copied from packet-dsi.c
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 #ifdef NEED_SNPRINTF_H
36 # include "snprintf.h"
41 #include <epan/packet.h>
42 #include <epan/strutil.h>
43 #include <epan/conversation.h>
45 #include "packet-afp.h"
47 /* The information in this module (AFP) comes from:
49 AFP 2.1 & 2.2.pdf contained in AppleShare_IP_6.3_SDK
50 available from http://www.apple.com
52 AFP3.0.pdf from http://www.apple.com
54 The netatalk source code by Wesley Craig & Adrian Sun
55 http://netatalk.sf.net
57 /* from netatalk/include/afp.h */
58 #define AFPTRANS_NONE 0
59 #define AFPTRANS_DDP (1 << 0)
60 #define AFPTRANS_TCP (1 << 1)
61 #define AFPTRANS_ALL (AFPTRANS_DDP | AFPTRANS_TCP)
63 /* AFP Attention Codes -- 4 bits */
64 #define AFPATTN_SHUTDOWN (1 << 15) /* shutdown/disconnect */
65 #define AFPATTN_CRASH (1 << 14) /* server crashed */
66 #define AFPATTN_MESG (1 << 13) /* server has message */
67 #define AFPATTN_NORECONNECT (1 << 12) /* don't reconnect */
68 /* server notification */
69 #define AFPATTN_NOTIFY (AFPATTN_MESG | AFPATTN_NORECONNECT)
71 /* extended bitmap -- 12 bits. volchanged is only useful w/ a server
72 * notification, and time is only useful for shutdown. */
73 #define AFPATTN_VOLCHANGED (1 << 0) /* volume has changed */
74 #define AFPATTN_TIME(x) ((x) & 0xfff) /* time in minutes */
77 #define AFP_BYTELOCK 1
78 #define AFP_CLOSEVOL 2
79 #define AFP_CLOSEDIR 3
80 #define AFP_CLOSEFORK 4
81 #define AFP_COPYFILE 5
82 #define AFP_CREATEDIR 6
83 #define AFP_CREATEFILE 7
85 #define AFP_ENUMERATE 9
87 #define AFP_FLUSHFORK 11
88 #define AFP_GETFORKPARAM 14
89 #define AFP_GETSRVINFO 15
90 #define AFP_GETSRVPARAM 16
91 #define AFP_GETVOLPARAM 17
93 #define AFP_LOGINCONT 19
96 #define AFP_MAPNAME 22
98 #define AFP_OPENVOL 24
99 #define AFP_OPENDIR 25
100 #define AFP_OPENFORK 26
102 #define AFP_RENAME 28
103 #define AFP_SETDIRPARAM 29
104 #define AFP_SETFILEPARAM 30
105 #define AFP_SETFORKPARAM 31
106 #define AFP_SETVOLPARAM 32
108 #define AFP_GETFLDRPARAM 34
109 #define AFP_SETFLDRPARAM 35
110 #define AFP_CHANGEPW 36
111 #define AFP_GETUSERINFO 37
112 #define AFP_GETSRVRMSG 38
113 #define AFP_CREATEID 39
114 #define AFP_DELETEID 40
115 #define AFP_RESOLVEID 41
116 #define AFP_EXCHANGEFILE 42
117 #define AFP_CATSEARCH 43
118 #define AFP_OPENDT 48
119 #define AFP_CLOSEDT 49
120 #define AFP_GETICON 51
121 #define AFP_GTICNINFO 52
122 #define AFP_ADDAPPL 53
123 #define AFP_RMVAPPL 54
124 #define AFP_GETAPPL 55
125 #define AFP_ADDCMT 56
126 #define AFP_RMVCMT 57
127 #define AFP_GETCMT 58
128 #define AFP_ADDICON 192
130 /* AFP 3.0 new calls */
131 #define AFP_BYTELOCK_EXT 59
132 #define AFP_CATSEARCH_EXT 67
133 #define AFP_ENUMERATE_EXT 66
134 #define AFP_READ_EXT 60
135 #define AFP_WRITE_EXT 61
136 #define AFP_LOGIN_EXT 63
137 #define AFP_GETSESSTOKEN 64
138 #define AFP_DISCTOLDSESS 65
140 /* AFP 3.1 new calls */
141 #define AFP_ENUMERATE_EXT2 68
143 /* ----------------------------- */
144 static int proto_afp = -1;
145 static int hf_afp_reserved = -1;
147 static int hf_afp_command = -1; /* CommandCode */
148 static int hf_afp_AFPVersion = -1;
149 static int hf_afp_UAM = -1;
150 static int hf_afp_user = -1;
151 static int hf_afp_passwd = -1;
152 static int hf_afp_login_flags = -1;
153 static int hf_afp_pad = -1;
155 static int hf_afp_user_type = -1;
156 static int hf_afp_user_len = -1;
157 static int hf_afp_user_name = -1;
159 static int hf_afp_vol_flag_passwd = -1;
160 static int hf_afp_vol_flag_unix_priv = -1;
161 static int hf_afp_server_time = -1;
163 static int hf_afp_vol_bitmap = -1;
164 static int hf_afp_vol_name_offset = -1;
165 static int hf_afp_vol_id = -1;
166 static int hf_afp_vol_attribute = -1;
167 static int hf_afp_vol_name = -1;
168 static int hf_afp_vol_signature = -1;
169 static int hf_afp_vol_creation_date = -1;
170 static int hf_afp_vol_modification_date = -1;
171 static int hf_afp_vol_backup_date = -1;
172 static int hf_afp_vol_bytes_free = -1;
173 static int hf_afp_vol_bytes_total = -1;
174 static int hf_afp_vol_ex_bytes_free = -1;
175 static int hf_afp_vol_ex_bytes_total = -1;
176 static int hf_afp_vol_block_size = -1;
179 static int hf_afp_comment = -1;
180 static int hf_afp_file_creator = -1;
181 static int hf_afp_file_type = -1;
182 static int hf_afp_icon_type = -1;
183 static int hf_afp_icon_length = -1;
184 static int hf_afp_icon_tag = -1;
185 static int hf_afp_icon_index = -1;
186 static int hf_afp_appl_index = -1;
187 static int hf_afp_appl_tag = -1;
189 static int hf_afp_did = -1;
190 static int hf_afp_file_id = -1;
191 static int hf_afp_file_DataForkLen = -1;
192 static int hf_afp_file_RsrcForkLen = -1;
193 static int hf_afp_file_ExtDataForkLen = -1;
194 static int hf_afp_file_ExtRsrcForkLen = -1;
196 static int hf_afp_dir_bitmap = -1;
197 static int hf_afp_dir_offspring = -1;
198 static int hf_afp_dir_OwnerID = -1;
199 static int hf_afp_dir_GroupID = -1;
201 static int hf_afp_file_bitmap = -1;
202 static int hf_afp_req_count = -1;
203 static int hf_afp_start_index = -1;
204 static int hf_afp_start_index32 = -1;
205 static int hf_afp_max_reply_size = -1;
206 static int hf_afp_max_reply_size32 = -1;
207 static int hf_afp_file_flag = -1;
208 static int hf_afp_create_flag = -1;
209 static int hf_afp_struct_size = -1;
210 static int hf_afp_struct_size16 = -1;
212 static int hf_afp_cat_count = -1;
213 static int hf_afp_cat_req_matches = -1;
214 static int hf_afp_cat_position = -1;
216 static int hf_afp_creation_date = -1;
217 static int hf_afp_modification_date = -1;
218 static int hf_afp_backup_date = -1;
219 static int hf_afp_finder_info = -1;
220 static int hf_afp_long_name_offset = -1;
221 static int hf_afp_short_name_offset = -1;
222 static int hf_afp_unicode_name_offset = -1;
223 static int hf_afp_unix_privs_uid = -1;
224 static int hf_afp_unix_privs_gid = -1;
225 static int hf_afp_unix_privs_permissions = -1;
226 static int hf_afp_unix_privs_ua_permissions = -1;
228 static int hf_afp_path_type = -1;
229 static int hf_afp_path_len = -1;
230 static int hf_afp_path_name = -1;
231 static int hf_afp_path_unicode_hint = -1;
232 static int hf_afp_path_unicode_len = -1;
234 static int hf_afp_flag = -1;
235 static int hf_afp_dt_ref = -1;
236 static int hf_afp_ofork = -1;
237 static int hf_afp_ofork_len = -1;
238 static int hf_afp_offset = -1;
239 static int hf_afp_rw_count = -1;
240 static int hf_afp_newline_mask = -1;
241 static int hf_afp_newline_char = -1;
242 static int hf_afp_last_written = -1;
243 static int hf_afp_actual_count = -1;
245 static int hf_afp_fork_type = -1;
246 static int hf_afp_access_mode = -1;
247 static int hf_afp_access_read = -1;
248 static int hf_afp_access_write = -1;
249 static int hf_afp_access_deny_read = -1;
250 static int hf_afp_access_deny_write = -1;
252 static gint hf_afp_lock_op = -1;
253 static gint hf_afp_lock_from = -1;
254 static gint hf_afp_lock_offset = -1;
255 static gint hf_afp_lock_len = -1;
256 static gint hf_afp_lock_range_start = -1;
258 static gint ett_afp = -1;
260 static gint ett_afp_vol_attribute = -1;
261 static gint ett_afp_enumerate = -1;
262 static gint ett_afp_enumerate_line = -1;
263 static gint ett_afp_access_mode = -1;
265 static gint ett_afp_vol_bitmap = -1;
266 static gint ett_afp_dir_bitmap = -1;
267 static gint ett_afp_dir_attribute = -1;
268 static gint ett_afp_file_attribute = -1;
269 static gint ett_afp_file_bitmap = -1;
270 static gint ett_afp_unix_privs = -1;
271 static gint ett_afp_path_name = -1;
272 static gint ett_afp_lock_flags = -1;
273 static gint ett_afp_dir_ar = -1;
275 static gint ett_afp_server_vol = -1;
276 static gint ett_afp_vol_list = -1;
277 static gint ett_afp_vol_flag = -1;
278 static gint ett_afp_cat_search = -1;
279 static gint ett_afp_cat_r_bitmap = -1;
280 static gint ett_afp_cat_spec = -1;
281 static gint ett_afp_vol_did = -1;
283 /* AFP 3.0 parameters */
284 static gint hf_afp_lock_offset64 = -1;
285 static gint hf_afp_lock_len64 = -1;
286 static gint hf_afp_lock_range_start64 = -1;
288 static int hf_afp_offset64 = -1;
289 static int hf_afp_rw_count64 = -1;
291 static int hf_afp_last_written64 = -1;
293 static int hf_afp_session_token_type = -1;
294 static int hf_afp_session_token_len = -1;
295 static int hf_afp_session_token = -1;
297 static dissector_handle_t data_handle;
299 static const value_string vol_signature_vals[] = {
301 {2, "Fixed Directory ID"},
302 {3, "Variable Directory ID (deprecated)"},
306 static const value_string CommandCode_vals[] = {
307 {AFP_BYTELOCK, "FPByteRangeLock" },
308 {AFP_CLOSEVOL, "FPCloseVol" },
309 {AFP_CLOSEDIR, "FPCloseDir" },
310 {AFP_CLOSEFORK, "FPCloseFork" },
311 {AFP_COPYFILE, "FPCopyFile" },
312 {AFP_CREATEDIR, "FPCreateDir" },
313 {AFP_CREATEFILE, "FPCreateFile" },
314 {AFP_DELETE, "FPDelete" },
315 {AFP_ENUMERATE, "FPEnumerate" },
316 {AFP_FLUSH, "FPFlush" },
317 {AFP_FLUSHFORK, "FPFlushFork" },
318 {AFP_GETFORKPARAM, "FPGetForkParms" },
319 {AFP_GETSRVINFO, "FPGetSrvrInfo" },
320 {AFP_GETSRVPARAM, "FPGetSrvrParms" },
321 {AFP_GETVOLPARAM, "FPGetVolParms" },
322 {AFP_LOGIN, "FPLogin" },
323 {AFP_LOGINCONT, "FPLoginCont" },
324 {AFP_LOGOUT, "FPLogout" },
325 {AFP_MAPID, "FPMapID" },
326 {AFP_MAPNAME, "FPMapName" },
327 {AFP_MOVE, "FPMoveAndRename" },
328 {AFP_OPENVOL, "FPOpenVol" },
329 {AFP_OPENDIR, "FPOpenDir" },
330 {AFP_OPENFORK, "FPOpenFork" },
331 {AFP_READ, "FPRead" },
332 {AFP_RENAME, "FPRename" },
333 {AFP_SETDIRPARAM, "FPSetDirParms" },
334 {AFP_SETFILEPARAM, "FPSetFileParms" },
335 {AFP_SETFORKPARAM, "FPSetForkParms" },
336 {AFP_SETVOLPARAM, "FPSetVolParms" },
337 {AFP_WRITE, "FPWrite" },
338 {AFP_GETFLDRPARAM, "FPGetFileDirParms" },
339 {AFP_SETFLDRPARAM, "FPSetFileDirParms" },
340 {AFP_CHANGEPW, "FPChangePassword" },
341 {AFP_GETUSERINFO, "FPGetUserInfo" },
342 {AFP_GETSRVRMSG, "FPGetSrvrMsg" },
343 {AFP_CREATEID, "FPCreateID" },
344 {AFP_DELETEID, "FPDeleteID" },
345 {AFP_RESOLVEID, "FPResolveID" },
346 {AFP_EXCHANGEFILE, "FPExchangeFiles" },
347 {AFP_CATSEARCH, "FPCatSearch" },
348 {AFP_OPENDT, "FPOpenDT" },
349 {AFP_CLOSEDT, "FPCloseDT" },
350 {AFP_GETICON, "FPGetIcon" },
351 {AFP_GTICNINFO, "FPGetIconInfo" },
352 {AFP_ADDAPPL, "FPAddAPPL" },
353 {AFP_RMVAPPL, "FPRemoveAPPL" },
354 {AFP_GETAPPL, "FPGetAPPL" },
355 {AFP_ADDCMT, "FPAddComment" },
356 {AFP_RMVCMT, "FPRemoveComment" },
357 {AFP_GETCMT, "FPGetComment" },
358 {AFP_BYTELOCK_EXT, "FPByteRangeLockExt" },
359 {AFP_CATSEARCH_EXT, "FPCatSearchExt" },
360 {AFP_ENUMERATE_EXT, "FPEnumerateExt" },
361 {AFP_ENUMERATE_EXT2, "FPEnumerateExt2" },
362 {AFP_READ_EXT, "FPReadExt" },
363 {AFP_WRITE_EXT, "FPWriteExt" },
364 {AFP_LOGIN_EXT, "FPLoginExt" },
365 {AFP_GETSESSTOKEN, "FPGetSessionToken" },
366 {AFP_DISCTOLDSESS, "FPDisconnectOldSession" },
367 {AFP_ADDICON, "FPAddIcon" },
371 static const value_string unicode_hint_vals[] = {
373 { 1, "MacJapanese" },
374 { 2, "MacChineseTrad" },
379 { 7, "MacCyrillic" },
380 { 9, "MacDevanagari" },
381 { 10, "MacGurmukhi" },
382 { 11, "MacGujarati" },
384 { 13, "MacBengali" },
387 { 16, "MacKannada" },
388 { 17, "MacMalayalam" },
389 { 18, "MacSinhalese" },
390 { 19, "MacBurmese" },
393 { 22, "MacLaotian" },
394 { 23, "MacGeorgian" },
395 { 24, "MacArmenian" },
396 { 25, "MacChineseSimp" },
397 { 26, "MacTibetan" },
398 { 27, "MacMongolian" },
399 { 28, "MacEthiopic" },
400 { 29, "MacCentralEurRoman" },
401 { 30, "MacVietnamese" },
402 { 31, "MacExtArabic" },
404 { 34, "MacDingbats" },
405 { 35, "MacTurkish" },
406 { 36, "MacCroatian" },
407 { 37, "MacIcelandic" },
408 { 38, "MacRomanian" },
411 { 41, "MacKeyboardGlyphs" },
412 { 126, "MacUnicode" },
414 { 152, "MacUkrainian" },
418 { 256, "UnicodeDefault" },
419 /* { 257, "UnicodeV1_1" }, */
420 { 257, "ISO10646_1993" },
421 { 259, "UnicodeV2_0" },
422 { 259, "UnicodeV2_1" },
423 { 260, "UnicodeV3_0" },
424 { 513, "ISOLatin1" },
425 { 514, "ISOLatin2" },
426 { 515, "ISOLatin3" },
427 { 516, "ISOLatin4" },
428 { 517, "ISOLatinCyrillic" },
429 { 518, "ISOLatinArabic" },
430 { 519, "ISOLatinGreek" },
431 { 520, "ISOLatinHebrew" },
432 { 521, "ISOLatin5" },
433 { 522, "ISOLatin6" },
434 { 525, "ISOLatin7" },
435 { 526, "ISOLatin8" },
436 { 527, "ISOLatin9" },
437 { 1024, "DOSLatinUS" },
438 { 1029, "DOSGreek" },
439 { 1030, "DOSBalticRim" },
440 { 1040, "DOSLatin1" },
441 { 1041, "DOSGreek1" },
442 { 1042, "DOSLatin2" },
443 { 1043, "DOSCyrillic" },
444 { 1044, "DOSTurkish" },
445 { 1045, "DOSPortuguese" },
446 { 1046, "DOSIcelandic" },
447 { 1047, "DOSHebrew" },
448 { 1048, "DOSCanadianFrench" },
449 { 1049, "DOSArabic" },
450 { 1050, "DOSNordic" },
451 { 1051, "DOSRussian" },
452 { 1052, "DOSGreek2" },
454 { 1056, "DOSJapanese" },
455 { 1057, "DOSChineseSimplif" },
456 { 1058, "DOSKorean" },
457 { 1059, "DOSChineseTrad" },
458 { 1280, "WindowsLatin1" },
459 /* { 1280, "WindowsANSI" }, */
460 { 1281, "WindowsLatin2" },
461 { 1282, "WindowsCyrillic" },
462 { 1283, "WindowsGreek" },
463 { 1284, "WindowsLatin5" },
464 { 1285, "WindowsHebrew" },
465 { 1286, "WindowsArabic" },
466 { 1287, "WindowsBalticRim" },
467 { 1288, "WindowsVietnamese" },
468 { 1296, "WindowsKoreanJohab" },
469 { 1536, "US_ASCII" },
470 { 1568, "JIS_X0201_76" },
471 { 1569, "JIS_X0208_83" },
472 { 1570, "JIS_X0208_90" },
477 from Apple AFP3.0.pdf
480 #define kFPVolAttributeBit (1 << 0)
481 #define kFPVolSignatureBit (1 << 1)
482 #define kFPVolCreateDateBit (1 << 2)
483 #define kFPVolModDateBit (1 << 3)
484 #define kFPVolBackupDateBit (1 << 4)
485 #define kFPVolIDBit (1 << 5)
486 #define kFPVolBytesFreeBit (1 << 6)
487 #define kFPVolBytesTotalBit (1 << 7)
488 #define kFPVolNameBit (1 << 8)
489 #define kFPVolExtBytesFreeBit (1 << 9)
490 #define kFPVolExtBytesTotalBit (1 << 10)
491 #define kFPVolBlockSizeBit (1 << 11)
493 static int hf_afp_vol_bitmap_Attributes = -1;
494 static int hf_afp_vol_bitmap_Signature = -1;
495 static int hf_afp_vol_bitmap_CreateDate = -1;
496 static int hf_afp_vol_bitmap_ModDate = -1;
497 static int hf_afp_vol_bitmap_BackupDate = -1;
498 static int hf_afp_vol_bitmap_ID = -1;
499 static int hf_afp_vol_bitmap_BytesFree = -1;
500 static int hf_afp_vol_bitmap_BytesTotal = -1;
501 static int hf_afp_vol_bitmap_Name = -1;
502 static int hf_afp_vol_bitmap_ExtBytesFree = -1;
503 static int hf_afp_vol_bitmap_ExtBytesTotal = -1;
504 static int hf_afp_vol_bitmap_BlockSize = -1;
506 static int hf_afp_vol_attribute_ReadOnly = -1;
507 static int hf_afp_vol_attribute_HasVolumePassword = -1;
508 static int hf_afp_vol_attribute_SupportsFileIDs = -1;
509 static int hf_afp_vol_attribute_SupportsCatSearch = -1;
510 static int hf_afp_vol_attribute_SupportsBlankAccessPrivs = -1;
511 static int hf_afp_vol_attribute_SupportsUnixPrivs = -1;
512 static int hf_afp_vol_attribute_SupportsUTF8Names = -1;
514 static int hf_afp_dir_bitmap_Attributes = -1;
515 static int hf_afp_dir_bitmap_ParentDirID = -1;
516 static int hf_afp_dir_bitmap_CreateDate = -1;
517 static int hf_afp_dir_bitmap_ModDate = -1;
518 static int hf_afp_dir_bitmap_BackupDate = -1;
519 static int hf_afp_dir_bitmap_FinderInfo = -1;
520 static int hf_afp_dir_bitmap_LongName = -1;
521 static int hf_afp_dir_bitmap_ShortName = -1;
522 static int hf_afp_dir_bitmap_NodeID = -1;
523 static int hf_afp_dir_bitmap_OffspringCount = -1;
524 static int hf_afp_dir_bitmap_OwnerID = -1;
525 static int hf_afp_dir_bitmap_GroupID = -1;
526 static int hf_afp_dir_bitmap_AccessRights = -1;
527 static int hf_afp_dir_bitmap_UTF8Name = -1;
528 static int hf_afp_dir_bitmap_UnixPrivs = -1;
530 static int hf_afp_dir_attribute_Invisible = -1;
531 static int hf_afp_dir_attribute_IsExpFolder = -1;
533 static int hf_afp_dir_attribute_System = -1;
534 static int hf_afp_dir_attribute_Mounted = -1;
535 static int hf_afp_dir_attribute_InExpFolder = -1;
537 static int hf_afp_dir_attribute_BackUpNeeded = -1;
538 static int hf_afp_dir_attribute_RenameInhibit = -1;
539 static int hf_afp_dir_attribute_DeleteInhibit = -1;
540 static int hf_afp_dir_attribute_SetClear = -1;
542 static int hf_afp_file_bitmap_Attributes = -1;
543 static int hf_afp_file_bitmap_ParentDirID = -1;
544 static int hf_afp_file_bitmap_CreateDate = -1;
545 static int hf_afp_file_bitmap_ModDate = -1;
546 static int hf_afp_file_bitmap_BackupDate = -1;
547 static int hf_afp_file_bitmap_FinderInfo = -1;
548 static int hf_afp_file_bitmap_LongName = -1;
549 static int hf_afp_file_bitmap_ShortName = -1;
550 static int hf_afp_file_bitmap_NodeID = -1;
551 static int hf_afp_file_bitmap_DataForkLen = -1;
552 static int hf_afp_file_bitmap_RsrcForkLen = -1;
553 static int hf_afp_file_bitmap_ExtDataForkLen = -1;
554 static int hf_afp_file_bitmap_LaunchLimit = -1;
556 static int hf_afp_file_bitmap_UTF8Name = -1;
557 static int hf_afp_file_bitmap_ExtRsrcForkLen = -1;
558 static int hf_afp_file_bitmap_UnixPrivs = -1;
560 static int hf_afp_file_attribute_Invisible = -1;
561 static int hf_afp_file_attribute_MultiUser = -1;
562 static int hf_afp_file_attribute_System = -1;
563 static int hf_afp_file_attribute_DAlreadyOpen = -1;
564 static int hf_afp_file_attribute_RAlreadyOpen = -1;
565 static int hf_afp_file_attribute_WriteInhibit = -1;
566 static int hf_afp_file_attribute_BackUpNeeded = -1;
567 static int hf_afp_file_attribute_RenameInhibit = -1;
568 static int hf_afp_file_attribute_DeleteInhibit = -1;
569 static int hf_afp_file_attribute_CopyProtect = -1;
570 static int hf_afp_file_attribute_SetClear = -1;
572 static int hf_afp_map_name_type = -1;
573 static int hf_afp_map_name = -1;
574 static int hf_afp_map_id = -1;
575 static int hf_afp_map_id_type = -1;
577 static const value_string vol_bitmap_vals[] = {
578 {kFPVolAttributeBit, "VolAttribute"},
579 {kFPVolSignatureBit, "VolSignature"},
580 {kFPVolCreateDateBit, "VolCreateDate"},
581 {kFPVolModDateBit, "VolModDate"},
582 {kFPVolBackupDateBit, "VolBackupDate"},
583 {kFPVolIDBit, "VolID"},
584 {kFPVolBytesFreeBit, "VolBytesFree"},
585 {kFPVolBytesTotalBit, "VolBytesTotal"},
586 {kFPVolNameBit, "VolNameBit"},
587 {kFPVolExtBytesFreeBit, "VolExtBytesFree"},
588 {kFPVolExtBytesTotalBit, "VolExtBytesTotal"},
589 {kFPVolBlockSizeBit, "VolBlockSize"},
592 static const value_string flag_vals[] = {
597 static const value_string path_type_vals[] = {
600 {3, "Unicode names" },
603 static const value_string map_name_type_vals[] = {
604 {1, "Unicode user name to a user ID" },
605 {2, "Unicode group name to a group ID" },
606 {3, "Macintosh roman user name to a user ID" },
607 {4, "Macintosh roman group name to a group ID" },
610 static const value_string map_id_type_vals[] = {
611 {1, "User ID to a Macintosh roman user name" },
612 {2, "Group ID to a Macintosh roman group name" },
613 {3, "User ID to a unicode user name" },
614 {4, "Group ID to a unicode group name" },
618 volume attribute from Apple AFP3.0.pdf
621 #define kReadOnly (1 << 0)
622 #define kHasVolumePassword (1 << 1)
623 #define kSupportsFileIDs (1 << 2)
624 #define kSupportsCatSearch (1 << 3)
625 #define kSupportsBlankAccessPrivs (1 << 4)
626 #define kSupportsUnixPrivs (1 << 5)
627 #define kSupportsUTF8Names (1 << 6)
629 #define kNoNetworkUserIDs (1 << 7)
632 directory bitmap from Apple AFP3.0.pdf
635 #define kFPAttributeBit (1 << 0)
636 #define kFPParentDirIDBit (1 << 1)
637 #define kFPCreateDateBit (1 << 2)
638 #define kFPModDateBit (1 << 3)
639 #define kFPBackupDateBit (1 << 4)
640 #define kFPFinderInfoBit (1 << 5)
641 #define kFPLongNameBit (1 << 6)
642 #define kFPShortNameBit (1 << 7)
643 #define kFPNodeIDBit (1 << 8)
644 #define kFPOffspringCountBit (1 << 9)
645 #define kFPOwnerIDBit (1 << 10)
646 #define kFPGroupIDBit (1 << 11)
647 #define kFPAccessRightsBit (1 << 12)
648 #define kFPUTF8NameBit (1 << 13)
649 #define kFPUnixPrivsBit (1 << 14)
652 directory Access Rights parameter AFP3.0.pdf
656 #define AR_O_SEARCH (1 << 0) /* owner has search access */
657 #define AR_O_READ (1 << 1) /* owner has read access */
658 #define AR_O_WRITE (1 << 2) /* owner has write access */
660 #define AR_G_SEARCH (1 << 8) /* group has search access */
661 #define AR_G_READ (1 << 9) /* group has read access */
662 #define AR_G_WRITE (1 << 10) /* group has write access */
664 #define AR_E_SEARCH (1 << 16) /* everyone has search access */
665 #define AR_E_READ (1 << 17) /* everyone has read access */
666 #define AR_E_WRITE (1 << 18) /* everyone has write access */
668 #define AR_U_SEARCH (1 << 24) /* user has search access */
669 #define AR_U_READ (1 << 25) /* user has read access */
670 #define AR_U_WRITE (1 << 26) /* user has write access */
672 #define AR_BLANK (1 << 28) /* Blank Access Privileges (use parent dir privileges) */
673 #define AR_U_OWN (1 << 31) /* user is the owner */
675 static int hf_afp_dir_ar = -1;
676 static int hf_afp_dir_ar_o_search = -1;
677 static int hf_afp_dir_ar_o_read = -1;
678 static int hf_afp_dir_ar_o_write = -1;
679 static int hf_afp_dir_ar_g_search = -1;
680 static int hf_afp_dir_ar_g_read = -1;
681 static int hf_afp_dir_ar_g_write = -1;
682 static int hf_afp_dir_ar_e_search = -1;
683 static int hf_afp_dir_ar_e_read = -1;
684 static int hf_afp_dir_ar_e_write = -1;
685 static int hf_afp_dir_ar_u_search = -1;
686 static int hf_afp_dir_ar_u_read = -1;
687 static int hf_afp_dir_ar_u_write = -1;
688 static int hf_afp_dir_ar_blank = -1;
689 static int hf_afp_dir_ar_u_own = -1;
691 static int hf_afp_user_flag = -1;
692 static int hf_afp_user_ID = -1;
693 static int hf_afp_group_ID = -1;
694 static int hf_afp_user_bitmap = -1;
695 static int hf_afp_user_bitmap_UID = -1;
696 static int hf_afp_user_bitmap_GID = -1;
698 static gint ett_afp_user_bitmap = -1;
700 static const value_string user_flag_vals[] = {
702 {1, "Default user" },
706 file bitmap AFP3.0.pdf
709 kFPAttributeBit (bit 0)
710 kFPParentDirIDBit (bit 1)
711 kFPCreateDateBit (bit 2)
712 kFPModDateBit (bit 3)
713 kFPBackupDateBit (bit 4)
714 kFPFinderInfoBit (bit 5)
715 kFPLongNameBit (bit 6)
716 kFPShortNameBit (bit 7)
719 kFPUTF8NameBit (bit 13)
722 #define kFPDataForkLenBit (1 << 9)
723 #define kFPRsrcForkLenBit (1 << 10)
724 #define kFPExtDataForkLenBit (1 << 11)
725 #define kFPLaunchLimitBit (1 << 12)
727 #define kFPExtRsrcForkLenBit (1 << 14)
728 #define kFPUnixPrivsBit_file (1 << 15) /* :( */
731 file attribute AFP3.0.pdf
734 #define kFPInvisibleBit (1 << 0)
735 #define kFPMultiUserBit (1 << 1)
736 #define kFPSystemBit (1 << 2)
737 #define kFPDAlreadyOpenBit (1 << 3)
738 #define kFPRAlreadyOpenBit (1 << 4)
739 #define kFPWriteInhibitBit (1 << 5)
740 #define kFPBackUpNeededBit (1 << 6)
741 #define kFPRenameInhibitBit (1 << 7)
742 #define kFPDeleteInhibitBit (1 << 8)
743 #define kFPCopyProtectBit (1 << 10)
744 #define kFPSetClearBit (1 << 15)
747 #define kIsExpFolder (1 << 1)
748 #define kMounted (1 << 3)
749 #define kInExpFolder (1 << 4)
751 #define hash_init_count 20
754 static gint afp_equal (gconstpointer v, gconstpointer v2);
755 static guint afp_hash (gconstpointer v);
757 static guint afp_packet_init_count = 200;
760 guint32 conversation;
768 static GHashTable *afp_request_hash = NULL;
769 static GMemChunk *afp_request_keys = NULL;
770 static GMemChunk *afp_request_vals = NULL;
773 static gint afp_equal (gconstpointer v, gconstpointer v2)
775 const afp_request_key *val1 = (const afp_request_key*)v;
776 const afp_request_key *val2 = (const afp_request_key*)v2;
778 if (val1->conversation == val2->conversation &&
779 val1->seq == val2->seq) {
785 static guint afp_hash (gconstpointer v)
787 const afp_request_key *afp_key = (const afp_request_key*)v;
791 /* --------------------------
793 #define PAD(x) { proto_tree_add_item(tree, hf_afp_pad, tvb, offset, x, FALSE); offset += x; }
796 decode_vol_bitmap (proto_tree *tree, tvbuff_t *tvb, gint offset)
798 proto_tree *sub_tree = NULL;
802 bitmap = tvb_get_ntohs(tvb, offset);
804 item = proto_tree_add_item(tree, hf_afp_vol_bitmap, tvb, offset, 2,FALSE);
805 sub_tree = proto_item_add_subtree(item, ett_afp_vol_bitmap);
808 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_Attributes, tvb, offset, 2,FALSE);
809 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_Signature, tvb, offset, 2,FALSE);
810 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_CreateDate, tvb, offset, 2,FALSE);
811 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_ModDate, tvb, offset, 2,FALSE);
812 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_BackupDate, tvb, offset, 2,FALSE);
813 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_ID, tvb, offset, 2,FALSE);
814 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_BytesFree, tvb, offset, 2,FALSE);
815 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_BytesTotal, tvb, offset, 2,FALSE);
816 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_Name, tvb, offset, 2,FALSE);
817 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_ExtBytesFree, tvb, offset, 2,FALSE);
818 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_ExtBytesTotal, tvb, offset, 2,FALSE);
819 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_BlockSize , tvb, offset, 2,FALSE);
824 /* -------------------------- */
826 decode_vol_attribute (proto_tree *tree, tvbuff_t *tvb, gint offset)
828 proto_tree *sub_tree = NULL;
832 bitmap = tvb_get_ntohs(tvb, offset);
834 item = proto_tree_add_item(tree, hf_afp_vol_attribute, tvb, offset, 2,FALSE);
835 sub_tree = proto_item_add_subtree(item, ett_afp_vol_attribute);
837 proto_tree_add_item(sub_tree, hf_afp_vol_attribute_ReadOnly ,tvb, offset, 2,FALSE);
838 proto_tree_add_item(sub_tree, hf_afp_vol_attribute_HasVolumePassword ,tvb, offset, 2,FALSE);
839 proto_tree_add_item(sub_tree, hf_afp_vol_attribute_SupportsFileIDs ,tvb, offset, 2,FALSE);
840 proto_tree_add_item(sub_tree, hf_afp_vol_attribute_SupportsCatSearch ,tvb, offset, 2,FALSE);
841 proto_tree_add_item(sub_tree, hf_afp_vol_attribute_SupportsBlankAccessPrivs,tvb, offset, 2,FALSE);
842 proto_tree_add_item(sub_tree, hf_afp_vol_attribute_SupportsUnixPrivs ,tvb, offset, 2,FALSE);
843 proto_tree_add_item(sub_tree, hf_afp_vol_attribute_SupportsUTF8Names ,tvb, offset, 2,FALSE);
848 /* --------------------------
849 cf AFP3.0.pdf page 38
850 date are number of seconds from 12:00am on 01.01.2000 GMT
851 backup : 0x8000000 not set
852 from netatalk adouble.h
854 #define DATE_NOT_SET 0x80000000
855 #define AD_DATE_DELTA 946684800
856 #define AD_DATE_TO_UNIX(x) (x + AD_DATE_DELTA)
858 print_date(proto_tree *tree,int id, tvbuff_t *tvb, gint offset)
860 time_t date = tvb_get_ntohl(tvb, offset);
863 tv.secs = AD_DATE_TO_UNIX(date);
865 proto_tree_add_time(tree, id, tvb, offset, 4, &tv);
870 /* -------------------------- */
872 parse_vol_bitmap (proto_tree *tree, tvbuff_t *tvb, gint offset, guint16 bitmap)
876 if ((bitmap & kFPVolAttributeBit)) {
877 decode_vol_attribute(tree,tvb,offset);
880 if ((bitmap & kFPVolSignatureBit)) {
881 proto_tree_add_item(tree, hf_afp_vol_signature,tvb, offset, 2, FALSE);
884 if ((bitmap & kFPVolCreateDateBit)) {
885 print_date(tree, hf_afp_vol_creation_date,tvb, offset);
888 if ((bitmap & kFPVolModDateBit)) {
889 print_date(tree, hf_afp_vol_modification_date,tvb, offset);
892 if ((bitmap & kFPVolBackupDateBit)) {
893 print_date(tree, hf_afp_vol_backup_date,tvb, offset);
896 if ((bitmap & kFPVolIDBit)) {
897 proto_tree_add_item(tree, hf_afp_vol_id, tvb, offset, 2,FALSE);
900 if ((bitmap & kFPVolBytesFreeBit)) {
901 proto_tree_add_item(tree, hf_afp_vol_bytes_free,tvb, offset, 4, FALSE);
904 if ((bitmap & kFPVolBytesTotalBit)) {
905 proto_tree_add_item(tree, hf_afp_vol_bytes_total,tvb, offset, 4, FALSE);
908 if ((bitmap & kFPVolNameBit)) {
909 nameoff = tvb_get_ntohs(tvb, offset);
910 proto_tree_add_item(tree, hf_afp_vol_name_offset,tvb, offset, 2, FALSE);
913 if ((bitmap & kFPVolExtBytesFreeBit)) {
914 proto_tree_add_item(tree, hf_afp_vol_ex_bytes_free,tvb, offset, 8, FALSE);
917 if ((bitmap & kFPVolExtBytesTotalBit)) {
918 proto_tree_add_item(tree, hf_afp_vol_ex_bytes_total,tvb, offset, 8, FALSE);
921 if ((bitmap & kFPVolBlockSizeBit)) {
922 proto_tree_add_item(tree, hf_afp_vol_block_size,tvb, offset, 4, FALSE);
928 len = tvb_get_guint8(tvb, offset);
929 proto_tree_add_item(tree, hf_afp_vol_name, tvb, offset, 1,FALSE);
936 /* -------------------------- */
938 decode_file_bitmap (proto_tree *tree, tvbuff_t *tvb, gint offset)
940 proto_tree *sub_tree = NULL;
944 bitmap = tvb_get_ntohs(tvb, offset);
946 item = proto_tree_add_item(tree, hf_afp_file_bitmap, tvb, offset, 2,FALSE);
947 sub_tree = proto_item_add_subtree(item, ett_afp_file_bitmap);
949 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_Attributes , tvb, offset, 2,FALSE);
950 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_ParentDirID , tvb, offset, 2,FALSE);
951 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_CreateDate , tvb, offset, 2,FALSE);
952 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_ModDate , tvb, offset, 2,FALSE);
953 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_BackupDate , tvb, offset, 2,FALSE);
954 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_FinderInfo , tvb, offset, 2,FALSE);
955 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_LongName , tvb, offset, 2,FALSE);
956 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_ShortName , tvb, offset, 2,FALSE);
957 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_NodeID , tvb, offset, 2,FALSE);
959 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_DataForkLen , tvb, offset, 2,FALSE);
960 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_RsrcForkLen , tvb, offset, 2,FALSE);
961 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_ExtDataForkLen , tvb, offset, 2,FALSE);
962 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_LaunchLimit , tvb, offset, 2,FALSE);
963 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_UTF8Name , tvb, offset, 2,FALSE);
965 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_ExtRsrcForkLen , tvb, offset, 2,FALSE);
966 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_UnixPrivs , tvb, offset, 2,FALSE);
971 /* -------------------------- */
973 decode_file_attribute(proto_tree *tree, tvbuff_t *tvb, gint offset, int shared)
975 proto_tree *sub_tree = NULL;
979 attribute = tvb_get_ntohs(tvb, offset);
981 item = proto_tree_add_text(tree, tvb, offset, 2,
982 "File Attributes: 0x%04x", attribute);
983 sub_tree = proto_item_add_subtree(item, ett_afp_file_attribute);
985 proto_tree_add_item(sub_tree, hf_afp_file_attribute_Invisible , tvb, offset, 2,FALSE);
987 proto_tree_add_item(sub_tree, hf_afp_file_attribute_MultiUser , tvb, offset, 2,FALSE);
989 proto_tree_add_item(sub_tree, hf_afp_file_attribute_System , tvb, offset, 2,FALSE);
992 proto_tree_add_item(sub_tree, hf_afp_file_attribute_DAlreadyOpen , tvb, offset, 2,FALSE);
993 proto_tree_add_item(sub_tree, hf_afp_file_attribute_RAlreadyOpen , tvb, offset, 2,FALSE);
995 /* writeinhibit is file only but Macs are setting it with FPSetFileDirParms too */
996 proto_tree_add_item(sub_tree, hf_afp_file_attribute_WriteInhibit , tvb, offset, 2,FALSE);
997 proto_tree_add_item(sub_tree, hf_afp_file_attribute_BackUpNeeded , tvb, offset, 2,FALSE);
998 proto_tree_add_item(sub_tree, hf_afp_file_attribute_RenameInhibit, tvb, offset, 2,FALSE);
999 proto_tree_add_item(sub_tree, hf_afp_file_attribute_DeleteInhibit, tvb, offset, 2,FALSE);
1002 proto_tree_add_item(sub_tree, hf_afp_file_attribute_CopyProtect , tvb, offset, 2,FALSE);
1004 proto_tree_add_item(sub_tree, hf_afp_file_attribute_SetClear , tvb, offset, 2,FALSE);
1010 decode_access_rights (proto_tree *tree, tvbuff_t *tvb, int hf, gint offset)
1012 proto_tree *sub_tree;
1016 item = proto_tree_add_item(tree, hf, tvb, offset, 4, FALSE);
1017 sub_tree = proto_item_add_subtree(item, ett_afp_dir_ar);
1019 proto_tree_add_item(sub_tree, hf_afp_dir_ar_o_search, tvb, offset, 4, FALSE);
1020 proto_tree_add_item(sub_tree, hf_afp_dir_ar_o_read , tvb, offset, 4, FALSE);
1021 proto_tree_add_item(sub_tree, hf_afp_dir_ar_o_write , tvb, offset, 4, FALSE);
1023 proto_tree_add_item(sub_tree, hf_afp_dir_ar_g_search, tvb, offset, 4, FALSE);
1024 proto_tree_add_item(sub_tree, hf_afp_dir_ar_g_read , tvb, offset, 4, FALSE);
1025 proto_tree_add_item(sub_tree, hf_afp_dir_ar_g_write , tvb, offset, 4, FALSE);
1027 proto_tree_add_item(sub_tree, hf_afp_dir_ar_e_search, tvb, offset, 4, FALSE);
1028 proto_tree_add_item(sub_tree, hf_afp_dir_ar_e_read , tvb, offset, 4, FALSE);
1029 proto_tree_add_item(sub_tree, hf_afp_dir_ar_e_write , tvb, offset, 4, FALSE);
1031 proto_tree_add_item(sub_tree, hf_afp_dir_ar_u_search, tvb, offset, 4, FALSE);
1032 proto_tree_add_item(sub_tree, hf_afp_dir_ar_u_read , tvb, offset, 4, FALSE);
1033 proto_tree_add_item(sub_tree, hf_afp_dir_ar_u_write , tvb, offset, 4, FALSE);
1035 proto_tree_add_item(sub_tree, hf_afp_dir_ar_blank , tvb, offset, 4, FALSE);
1036 proto_tree_add_item(sub_tree, hf_afp_dir_ar_u_own , tvb, offset, 4, FALSE);
1041 decode_unix_privs (proto_tree *tree, tvbuff_t *tvb, gint offset)
1043 proto_tree *sub_tree;
1047 item = proto_tree_add_text(tree, tvb, offset, 16,
1049 sub_tree = proto_item_add_subtree(item, ett_afp_unix_privs);
1051 proto_tree_add_item(sub_tree, hf_afp_unix_privs_uid, tvb, offset, 4, FALSE);
1052 proto_tree_add_item(sub_tree, hf_afp_unix_privs_gid, tvb, offset+4, 4, FALSE);
1053 proto_tree_add_item(sub_tree, hf_afp_unix_privs_permissions, tvb, offset+8, 4, FALSE);
1054 decode_access_rights(sub_tree, tvb, hf_afp_unix_privs_ua_permissions, offset+12);
1058 /* -------------------------- */
1060 parse_long_filename(proto_tree *tree, tvbuff_t *tvb, gint offset, gint org_offset)
1066 lnameoff = tvb_get_ntohs(tvb, offset);
1067 proto_tree_add_item(tree, hf_afp_long_name_offset,tvb, offset, 2, FALSE);
1069 tp_ofs = lnameoff +org_offset;
1070 len = tvb_get_guint8(tvb, tp_ofs);
1071 proto_tree_add_item(tree, hf_afp_path_len, tvb, tp_ofs, 1,FALSE);
1073 proto_tree_add_item(tree, hf_afp_path_name, tvb, tp_ofs, len,FALSE);
1079 /* -------------------------- */
1081 parse_UTF8_filename(proto_tree *tree, tvbuff_t *tvb, gint offset, gint org_offset)
1087 unameoff = tvb_get_ntohs(tvb, offset);
1088 proto_tree_add_item(tree, hf_afp_unicode_name_offset,tvb, offset, 2, FALSE);
1092 tp_ofs = unameoff +org_offset;
1093 proto_tree_add_item( tree, hf_afp_path_unicode_hint, tvb, tp_ofs, 4,FALSE);
1096 len = tvb_get_ntohs(tvb, tp_ofs);
1097 proto_tree_add_item( tree, hf_afp_path_unicode_len, tvb, tp_ofs, 2,FALSE);
1100 proto_tree_add_item(tree, hf_afp_path_name, tvb, tp_ofs, len,FALSE);
1106 /* -------------------------- */
1108 parse_file_bitmap (proto_tree *tree, tvbuff_t *tvb, gint offset, guint16 bitmap, int shared)
1110 guint16 snameoff = 0;
1111 gint max_offset = 0;
1113 gint org_offset = offset;
1115 if ((bitmap & kFPAttributeBit)) {
1116 decode_file_attribute(tree, tvb, offset, shared);
1119 if ((bitmap & kFPParentDirIDBit)) {
1120 proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4,FALSE);
1123 if ((bitmap & kFPCreateDateBit)) {
1124 print_date(tree, hf_afp_creation_date,tvb, offset);
1127 if ((bitmap & kFPModDateBit)) {
1128 print_date(tree, hf_afp_modification_date,tvb, offset);
1131 if ((bitmap & kFPBackupDateBit)) {
1132 print_date(tree, hf_afp_backup_date,tvb, offset);
1135 if ((bitmap & kFPFinderInfoBit)) {
1136 proto_tree_add_item(tree, hf_afp_finder_info,tvb, offset, 32, FALSE);
1139 if ((bitmap & kFPLongNameBit)) {
1142 tp_ofs = parse_long_filename(tree, tvb, offset, org_offset);
1143 max_offset = (tp_ofs >max_offset)?tp_ofs:max_offset;
1148 if ((bitmap & kFPShortNameBit)) {
1149 snameoff = tvb_get_ntohs(tvb, offset);
1150 proto_tree_add_item(tree, hf_afp_short_name_offset,tvb, offset, 2, FALSE);
1153 if ((bitmap & kFPNodeIDBit)) {
1154 proto_tree_add_item(tree, hf_afp_file_id, tvb, offset, 4,FALSE);
1158 if ((bitmap & kFPDataForkLenBit)) {
1159 proto_tree_add_item(tree, hf_afp_file_DataForkLen, tvb, offset, 4,FALSE);
1163 if ((bitmap & kFPRsrcForkLenBit)) {
1164 proto_tree_add_item(tree, hf_afp_file_RsrcForkLen, tvb, offset, 4,FALSE);
1168 if ((bitmap & kFPExtDataForkLenBit)) {
1169 proto_tree_add_item(tree, hf_afp_file_ExtDataForkLen, tvb, offset, 8,FALSE);
1173 if ((bitmap & kFPLaunchLimitBit)) {
1174 offset += 2; /* ? */
1177 if ((bitmap & kFPUTF8NameBit)) {
1180 tp_ofs = parse_UTF8_filename(tree, tvb, offset, org_offset);
1181 max_offset = (tp_ofs >max_offset)?tp_ofs:max_offset;
1185 if ((bitmap & kFPExtRsrcForkLenBit)) {
1186 proto_tree_add_item(tree, hf_afp_file_ExtRsrcForkLen, tvb, offset, 8,FALSE);
1190 if ((bitmap & kFPUnixPrivsBit_file)) {
1192 * XXX - the AFP 3.0 spec says this is "Four bytes", but
1193 * also says the privileges are "stored in an FPUnixPrivs
1194 * structure", which is 16 bytes long.
1196 * We assume, for now, that the latter is true.
1198 decode_unix_privs(tree, tvb, offset);
1202 return (max_offset)?max_offset:offset;
1205 /* -------------------------- */
1207 decode_dir_bitmap (proto_tree *tree, tvbuff_t *tvb, gint offset)
1209 proto_tree *sub_tree = NULL;
1213 bitmap = tvb_get_ntohs(tvb, offset);
1215 item = proto_tree_add_item(tree, hf_afp_dir_bitmap, tvb, offset, 2,FALSE);
1216 sub_tree = proto_item_add_subtree(item, ett_afp_dir_bitmap);
1219 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_Attributes , tvb, offset, 2,FALSE);
1220 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_ParentDirID , tvb, offset, 2,FALSE);
1221 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_CreateDate , tvb, offset, 2,FALSE);
1222 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_ModDate , tvb, offset, 2,FALSE);
1223 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_BackupDate , tvb, offset, 2,FALSE);
1224 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_FinderInfo , tvb, offset, 2,FALSE);
1225 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_LongName , tvb, offset, 2,FALSE);
1226 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_ShortName , tvb, offset, 2,FALSE);
1227 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_NodeID , tvb, offset, 2,FALSE);
1228 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_OffspringCount , tvb, offset, 2,FALSE);
1229 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_OwnerID , tvb, offset, 2,FALSE);
1230 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_GroupID , tvb, offset, 2,FALSE);
1231 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_AccessRights , tvb, offset, 2,FALSE);
1232 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_UTF8Name , tvb, offset, 2,FALSE);
1233 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_UnixPrivs , tvb, offset, 2,FALSE);
1238 /* -------------------------- */
1240 decode_dir_attribute(proto_tree *tree, tvbuff_t *tvb, gint offset)
1242 proto_tree *sub_tree = NULL;
1246 attribute = tvb_get_ntohs(tvb, offset);
1248 item = proto_tree_add_text(tree, tvb, offset, 2,
1249 "Directory Attributes: 0x%04x", attribute);
1250 sub_tree = proto_item_add_subtree(item, ett_afp_dir_attribute);
1252 proto_tree_add_item(sub_tree, hf_afp_dir_attribute_Invisible , tvb, offset, 2,FALSE);
1253 proto_tree_add_item(sub_tree, hf_afp_dir_attribute_IsExpFolder , tvb, offset, 2,FALSE);
1254 proto_tree_add_item(sub_tree, hf_afp_dir_attribute_System , tvb, offset, 2,FALSE);
1255 proto_tree_add_item(sub_tree, hf_afp_dir_attribute_Mounted , tvb, offset, 2,FALSE);
1256 proto_tree_add_item(sub_tree, hf_afp_dir_attribute_InExpFolder , tvb, offset, 2,FALSE);
1257 proto_tree_add_item(sub_tree, hf_afp_dir_attribute_BackUpNeeded , tvb, offset, 2,FALSE);
1258 proto_tree_add_item(sub_tree, hf_afp_dir_attribute_RenameInhibit, tvb, offset, 2,FALSE);
1259 proto_tree_add_item(sub_tree, hf_afp_dir_attribute_DeleteInhibit, tvb, offset, 2,FALSE);
1264 /* -------------------------- */
1266 parse_dir_bitmap (proto_tree *tree, tvbuff_t *tvb, gint offset, guint16 bitmap)
1268 guint16 snameoff = 0;
1269 gint max_offset = 0;
1271 gint org_offset = offset;
1273 if ((bitmap & kFPAttributeBit)) {
1274 decode_dir_attribute(tree, tvb, offset);
1277 if ((bitmap & kFPParentDirIDBit)) {
1278 proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4,FALSE);
1281 if ((bitmap & kFPCreateDateBit)) {
1282 print_date(tree, hf_afp_creation_date,tvb, offset);
1285 if ((bitmap & kFPModDateBit)) {
1286 print_date(tree, hf_afp_modification_date,tvb, offset);
1289 if ((bitmap & kFPBackupDateBit)) {
1290 print_date(tree, hf_afp_backup_date,tvb, offset);
1293 if ((bitmap & kFPFinderInfoBit)) {
1294 proto_tree_add_item(tree, hf_afp_finder_info,tvb, offset, 32, FALSE);
1297 if ((bitmap & kFPLongNameBit)) {
1300 tp_ofs = parse_long_filename(tree, tvb, offset, org_offset);
1301 max_offset = (tp_ofs >max_offset)?tp_ofs:max_offset;
1305 if ((bitmap & kFPShortNameBit)) {
1306 snameoff = tvb_get_ntohs(tvb, offset);
1307 proto_tree_add_item(tree, hf_afp_short_name_offset,tvb, offset, 2, FALSE);
1310 if ((bitmap & kFPNodeIDBit)) {
1311 proto_tree_add_item(tree, hf_afp_file_id, tvb, offset, 4,FALSE);
1314 if ((bitmap & kFPOffspringCountBit)) {
1315 proto_tree_add_item(tree, hf_afp_dir_offspring, tvb, offset, 2,FALSE);
1316 offset += 2; /* error in AFP3.0.pdf */
1318 if ((bitmap & kFPOwnerIDBit)) {
1319 proto_tree_add_item(tree, hf_afp_dir_OwnerID, tvb, offset, 4, FALSE);
1322 if ((bitmap & kFPGroupIDBit)) {
1323 proto_tree_add_item(tree, hf_afp_dir_GroupID, tvb, offset, 4, FALSE);
1326 if ((bitmap & kFPAccessRightsBit)) {
1327 decode_access_rights(tree, tvb, hf_afp_dir_ar, offset);
1330 if ((bitmap & kFPUTF8NameBit)) {
1333 tp_ofs = parse_UTF8_filename(tree, tvb, offset, org_offset);
1334 max_offset = (tp_ofs >max_offset)?tp_ofs:max_offset;
1337 if ((bitmap & kFPUnixPrivsBit)) {
1339 * XXX - the AFP 3.0 spec says this is "Four bytes", but
1340 * also says the privileges are "stored in an FPUnixPrivs
1341 * structure", which is 16 bytes long.
1343 * We assume, for now, that the latter is true.
1345 decode_unix_privs(tree, tvb, offset);
1348 return (max_offset)?max_offset:offset;
1351 /* -------------------------- */
1353 name_in_bitmap(tvbuff_t *tvb, gint offset, guint16 bitmap, int isdir)
1356 gint org_offset = offset;
1363 if ((bitmap & kFPAttributeBit)) /* 0 */
1365 if ((bitmap & kFPParentDirIDBit)) /* 1 */
1367 if ((bitmap & kFPCreateDateBit)) /* 2 */
1369 if ((bitmap & kFPModDateBit)) /* 3 */
1371 if ((bitmap & kFPBackupDateBit)) /* 4 */
1373 if ((bitmap & kFPFinderInfoBit)) /* 5 */
1376 if ((bitmap & kFPLongNameBit)) { /* 6 */
1377 nameoff = tvb_get_ntohs(tvb, offset);
1379 tp_ofs = nameoff +org_offset;
1380 len = tvb_get_guint8(tvb, tp_ofs);
1382 if (!(name = g_malloc(len +1)))
1384 tvb_memcpy(tvb, name, tp_ofs, len);
1391 if ((bitmap & kFPShortNameBit)) /* 7 */
1393 if ((bitmap & kFPNodeIDBit)) /* 8 */
1397 if ((bitmap & kFPOffspringCountBit)) /* 9 */
1399 if ((bitmap & kFPOwnerIDBit)) /* 10*/
1401 if ((bitmap & kFPGroupIDBit)) /* 11*/
1403 if ((bitmap & kFPAccessRightsBit)) /* 12*/
1407 if ((bitmap & kFPDataForkLenBit)) /* 9 */
1409 if ((bitmap & kFPRsrcForkLenBit)) /* 10*/
1411 if ((bitmap & kFPExtDataForkLenBit)) /* 11*/
1413 if ((bitmap & kFPLaunchLimitBit)) /* 12*/
1414 offset += 2; /* FIXME ? */
1417 if ((bitmap & kFPUTF8NameBit)) { /* 13 */
1418 nameoff = tvb_get_ntohs(tvb, offset);
1420 tp_ofs = nameoff +org_offset +4;
1421 len16 = tvb_get_ntohs(tvb, tp_ofs);
1423 if (!(name = g_malloc(len16 +1)))
1425 tvb_memcpy(tvb, name, tp_ofs, len16);
1433 /* -------------------------- */
1435 name_in_dbitmap(tvbuff_t *tvb, gint offset, guint16 bitmap)
1439 name = name_in_bitmap(tvb, offset, bitmap, 1);
1449 /* -------------------------- */
1451 name_in_fbitmap(tvbuff_t *tvb, gint offset, guint16 bitmap)
1455 name = name_in_bitmap(tvb, offset, bitmap, 0);
1465 /* -------------------------- */
1467 decode_vol_did(proto_tree *tree, tvbuff_t *tvb, gint offset)
1469 proto_tree_add_item(tree, hf_afp_vol_id, tvb, offset, 2,FALSE);
1472 proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4,FALSE);
1477 /* -------------------------- */
1479 decode_vol_did_file_dir_bitmap (proto_tree *tree, tvbuff_t *tvb, gint offset)
1481 offset = decode_vol_did(tree, tvb, offset);
1483 decode_file_bitmap(tree, tvb, offset);
1486 decode_dir_bitmap(tree, tvb, offset);
1492 /* ------------------------ */
1494 get_name(tvbuff_t *tvb, int offset, int type)
1502 len = tvb_get_guint8(tvb, offset);
1504 string = tvb_format_text(tvb,offset, len);
1507 len = tvb_get_ntohs(tvb, offset +4);
1509 string = tvb_format_text(tvb,offset, len);
1512 string = "unknow type";
1517 /* -------------------------- */
1519 decode_name_label (proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, gint offset, const gchar *label)
1525 proto_tree *sub_tree = NULL;
1528 type = tvb_get_guint8(tvb, offset);
1531 len = tvb_get_ntohs(tvb, offset +5);
1535 len = tvb_get_guint8(tvb, offset +1);
1537 name = get_name(tvb, offset +1, type);
1539 if (pinfo && check_col(pinfo->cinfo, COL_INFO)) {
1540 col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", name);
1544 item = proto_tree_add_text(tree, tvb, offset, len +header, label, name);
1545 sub_tree = proto_item_add_subtree(item, ett_afp_path_name);
1547 proto_tree_add_item( sub_tree, hf_afp_path_type, tvb, offset, 1,FALSE);
1550 proto_tree_add_item( sub_tree, hf_afp_path_unicode_hint, tvb, offset, 4,FALSE);
1552 proto_tree_add_item( sub_tree, hf_afp_path_unicode_len, tvb, offset, 2,FALSE);
1556 proto_tree_add_item( sub_tree, hf_afp_path_len, tvb, offset, 1,FALSE);
1560 proto_tree_add_string(sub_tree, hf_afp_path_name, tvb, offset, len,name);
1568 /* -------------------------- */
1570 decode_name (proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, gint offset)
1572 return decode_name_label(tree, pinfo, tvb, offset, "Path: %s");
1575 /* ************************** */
1577 dissect_query_afp_open_vol(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
1583 decode_vol_bitmap(tree, tvb, offset);
1586 len = tvb_get_guint8(tvb, offset);
1588 if (check_col(pinfo->cinfo, COL_INFO)) {
1590 rep = get_name(tvb, offset, 2);
1591 col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", rep);
1597 proto_tree_add_item(tree, hf_afp_vol_name, tvb, offset, 1,FALSE);
1600 len = tvb_reported_length_remaining(tvb,offset);
1602 /* optionnal password */
1603 proto_tree_add_item(tree, hf_afp_passwd, tvb, offset, 8,FALSE);
1609 /* -------------------------- */
1611 dissect_reply_afp_open_vol(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
1617 bitmap = decode_vol_bitmap(tree, tvb, offset);
1619 offset = parse_vol_bitmap(tree, tvb, offset, bitmap);
1624 /* ************************** */
1626 dissect_reply_afp_get_server_param(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
1632 proto_tree *sub_tree = NULL;
1633 proto_tree *flag_tree;
1640 print_date(tree, hf_afp_server_time,tvb, offset);
1643 num = tvb_get_guint8(tvb, offset);
1644 item = proto_tree_add_text(tree, tvb, offset, 1, "Volumes : %d", num);
1645 sub_tree = proto_item_add_subtree(item, ett_afp_server_vol);
1648 for (i = 0; i < num; i++) {
1651 item = proto_tree_add_text(sub_tree, tvb, offset, -1,"Volume");
1652 tree = proto_item_add_subtree(item, ett_afp_vol_list);
1654 flag = tvb_get_guint8(tvb, offset);
1656 ti = proto_tree_add_text(tree, tvb, offset , 1,"Flags : 0x%02x", flag);
1657 flag_tree = proto_item_add_subtree(ti, ett_afp_vol_flag);
1658 proto_tree_add_item(flag_tree, hf_afp_vol_flag_passwd, tvb, offset, 1,FALSE);
1659 proto_tree_add_item(flag_tree, hf_afp_vol_flag_unix_priv ,tvb, offset, 1,FALSE);
1662 len = tvb_get_guint8(tvb, offset) +1;
1663 rep = get_name(tvb, offset, 2);
1664 proto_item_set_text(item, rep);
1665 proto_item_set_len(item, len +1);
1667 proto_tree_add_item(tree, hf_afp_vol_name, tvb, offset, 1,FALSE);
1674 /* **************************
1675 next calls use the same format :
1683 dissect_query_afp_with_vol_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
1690 proto_tree_add_item(tree, hf_afp_vol_id, tvb, offset, 2,FALSE);
1695 /* ************************** */
1697 dissect_query_afp_open_fork(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
1699 proto_tree *sub_tree = NULL;
1702 proto_tree_add_item(tree, hf_afp_fork_type, tvb, offset, 1,FALSE);
1705 offset = decode_vol_did(tree, tvb, offset);
1707 decode_file_bitmap(tree, tvb, offset);
1710 item = proto_tree_add_item(tree, hf_afp_access_mode, tvb, offset, 2,FALSE);
1711 sub_tree = proto_item_add_subtree(item, ett_afp_access_mode);
1713 proto_tree_add_item(sub_tree, hf_afp_access_read , tvb, offset, 2,FALSE);
1714 proto_tree_add_item(sub_tree, hf_afp_access_write , tvb, offset, 2,FALSE);
1715 proto_tree_add_item(sub_tree, hf_afp_access_deny_read , tvb, offset, 2,FALSE);
1716 proto_tree_add_item(sub_tree, hf_afp_access_deny_write, tvb, offset, 2,FALSE);
1720 offset = decode_name(tree, pinfo, tvb, offset);
1725 /* -------------------------- */
1727 dissect_reply_afp_open_fork(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
1731 f_bitmap = decode_file_bitmap(tree, tvb, offset);
1734 proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2,FALSE);
1737 offset = parse_file_bitmap(tree, tvb, offset, f_bitmap,0);
1742 /* ************************** */
1744 dissect_query_afp_enumerate_ext2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
1748 offset = decode_vol_did_file_dir_bitmap(tree, tvb, offset);
1750 proto_tree_add_item(tree, hf_afp_req_count, tvb, offset, 2,FALSE);
1753 proto_tree_add_item(tree, hf_afp_start_index32, tvb, offset, 4,FALSE);
1756 proto_tree_add_item(tree, hf_afp_max_reply_size32, tvb, offset, 4,FALSE);
1759 offset = decode_name(tree, pinfo, tvb, offset);
1764 /* ************************** */
1766 dissect_query_afp_enumerate(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
1770 offset = decode_vol_did_file_dir_bitmap(tree, tvb, offset);
1772 proto_tree_add_item(tree, hf_afp_req_count, tvb, offset, 2,FALSE);
1775 proto_tree_add_item(tree, hf_afp_start_index, tvb, offset, 2,FALSE);
1778 proto_tree_add_item(tree, hf_afp_max_reply_size, tvb, offset, 2,FALSE);
1781 offset = decode_name(tree, pinfo, tvb, offset);
1786 /* -------------------------- */
1788 loop_record(tvbuff_t *tvb, proto_tree *ptree, gint offset,
1789 int count, guint16 d_bitmap, guint16 f_bitmap, int add, int ext)
1791 proto_tree *tree = NULL;
1800 for (i = 0; i < count; i++) {
1803 size = tvb_get_ntohs(tvb, offset);
1807 size = tvb_get_guint8(tvb, offset) +add;
1811 return offset; /* packet is malformed */
1812 flags = tvb_get_guint8(tvb, offset +decal);
1818 name = name_in_dbitmap(tvb, offset +decal, d_bitmap);
1821 name = name_in_fbitmap(tvb, offset +decal, f_bitmap);
1824 if (!(name = g_malloc(50))) { /* no memory ! */
1826 snprintf(name, 50,"line %d", i +1);
1828 item = proto_tree_add_text(ptree, tvb, offset, size, name);
1829 tree = proto_item_add_subtree(item, ett_afp_enumerate_line);
1830 g_free((gpointer)name);
1833 proto_tree_add_item(tree, hf_afp_struct_size16, tvb, offset, 2,FALSE);
1837 proto_tree_add_item(tree, hf_afp_struct_size, tvb, offset, 1,FALSE);
1841 proto_tree_add_item(tree, hf_afp_file_flag, tvb, offset, 1,FALSE);
1847 offset = parse_dir_bitmap(tree, tvb, offset, d_bitmap);
1850 offset = parse_file_bitmap(tree, tvb, offset, f_bitmap,0);
1854 offset = org +size; /* play safe */
1858 /* ------------------------- */
1860 reply_enumerate(tvbuff_t *tvb, proto_tree *tree, gint offset, int ext)
1862 proto_tree *sub_tree = NULL;
1868 f_bitmap = decode_file_bitmap(tree, tvb, offset);
1871 d_bitmap = decode_dir_bitmap(tree, tvb, offset);
1874 count = tvb_get_ntohs(tvb, offset);
1876 item = proto_tree_add_item(tree, hf_afp_req_count, tvb, offset, 2,FALSE);
1877 sub_tree = proto_item_add_subtree(item, ett_afp_enumerate);
1881 return loop_record(tvb,sub_tree, offset, count, d_bitmap, f_bitmap,0, ext);
1884 /* ------------------------- */
1886 dissect_reply_afp_enumerate(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
1888 return reply_enumerate(tvb, tree, offset, 0);
1891 /* **************************/
1893 dissect_reply_afp_enumerate_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
1895 return reply_enumerate(tvb, tree, offset, 1);
1897 /* **************************/
1899 dissect_query_afp_cat_search(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *ptree, gint offset)
1901 proto_tree *tree = NULL;
1913 proto_tree_add_item(ptree, hf_afp_vol_id, tvb, offset, 2,FALSE);
1916 proto_tree_add_item(ptree, hf_afp_cat_req_matches, tvb, offset, 4,FALSE);
1919 proto_tree_add_item(ptree, hf_afp_reserved, tvb, offset, 4,FALSE);
1922 proto_tree_add_item(ptree, hf_afp_cat_position, tvb, offset, 16,FALSE);
1925 f_bitmap = decode_file_bitmap(ptree, tvb, offset);
1928 d_bitmap = decode_dir_bitmap(ptree, tvb, offset);
1931 /* FIXME req bitmap */
1932 item = proto_tree_add_text(ptree, tvb, offset, 4, "Request bitmap");
1933 tree = proto_item_add_subtree(item, ett_afp_cat_r_bitmap);
1934 r_bitmap = decode_file_bitmap(tree, tvb, offset+2);
1939 size = tvb_get_guint8(tvb, offset) +2;
1941 item = proto_tree_add_text(ptree, tvb, offset, size, "Spec 1");
1942 tree = proto_item_add_subtree(item, ett_afp_cat_spec);
1944 proto_tree_add_item(tree, hf_afp_struct_size, tvb, offset, 1,FALSE);
1948 offset = parse_file_bitmap(tree, tvb, offset, r_bitmap,0);
1953 size = tvb_get_guint8(tvb, offset) +2;
1955 item = proto_tree_add_text(ptree, tvb, offset, size, "Spec 2");
1956 tree = proto_item_add_subtree(item, ett_afp_cat_spec);
1958 proto_tree_add_item(tree, hf_afp_struct_size, tvb, offset, 1,FALSE);
1962 offset = parse_file_bitmap(tree, tvb, offset, r_bitmap,0);
1968 /* -------------------------- */
1970 dissect_reply_afp_cat_search(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
1972 proto_tree *sub_tree = NULL;
1978 proto_tree_add_item(tree, hf_afp_cat_position, tvb, offset, 16,FALSE);
1981 f_bitmap = decode_file_bitmap(tree, tvb, offset);
1984 d_bitmap = decode_dir_bitmap(tree, tvb, offset);
1987 count = tvb_get_ntohl(tvb, offset);
1989 item = proto_tree_add_item(tree, hf_afp_cat_count, tvb, offset, 4,FALSE);
1990 sub_tree = proto_item_add_subtree(item, ett_afp_cat_search);
1994 return loop_record(tvb,sub_tree, offset, count, d_bitmap, f_bitmap, 2, 0);
1997 /* **************************/
1999 dissect_query_afp_get_vol_param(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2002 proto_tree_add_item(tree, hf_afp_vol_id, tvb, offset, 2,FALSE);
2005 decode_vol_bitmap(tree, tvb, offset);
2011 /* ------------------------ */
2013 dissect_reply_afp_get_vol_param(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2017 bitmap = decode_vol_bitmap(tree, tvb, offset);
2020 offset = parse_vol_bitmap(tree, tvb, offset, bitmap);
2025 /* **************************/
2027 dissect_query_afp_set_vol_param(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2032 proto_tree_add_item(tree, hf_afp_vol_id, tvb, offset, 2,FALSE);
2035 bitmap = decode_vol_bitmap(tree, tvb, offset);
2038 offset = parse_vol_bitmap(tree, tvb, offset, bitmap);
2043 /* ***************************/
2045 dissect_query_afp_login(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2050 len = tvb_get_guint8(tvb, offset);
2051 proto_tree_add_item(tree, hf_afp_AFPVersion, tvb, offset, 1,FALSE);
2053 len = tvb_get_guint8(tvb, offset);
2054 uam = tvb_get_ptr(tvb, offset +1, len);
2055 proto_tree_add_item(tree, hf_afp_UAM, tvb, offset, 1,FALSE);
2058 if (!strncasecmp(uam, "Cleartxt passwrd", len)) {
2060 len = tvb_get_guint8(tvb, offset);
2061 proto_tree_add_item(tree, hf_afp_user, tvb, offset, 1,FALSE);
2065 len = 8; /* tvb_strsize(tvb, offset);*/
2066 proto_tree_add_item(tree, hf_afp_passwd, tvb, offset, len,FALSE);
2069 else if (!strncasecmp(uam, "No User Authent", len)) {
2074 /* ***************************/
2076 dissect_query_afp_login_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2083 type = tvb_get_guint8(tvb, offset);
2086 proto_tree_add_item(tree, hf_afp_login_flags, tvb, offset, 2,FALSE);
2089 len = tvb_get_guint8(tvb, offset);
2090 proto_tree_add_item(tree, hf_afp_AFPVersion, tvb, offset, 1,FALSE);
2093 len_uam = tvb_get_guint8(tvb, offset);
2094 uam = tvb_get_ptr(tvb, offset +1, len_uam);
2095 proto_tree_add_item(tree, hf_afp_UAM, tvb, offset, 1,FALSE);
2096 offset += len_uam +1;
2098 type = tvb_get_guint8(tvb, offset);
2099 proto_tree_add_item(tree, hf_afp_user_type, tvb, offset, 1,FALSE);
2102 len = tvb_get_ntohs(tvb, offset);
2103 proto_tree_add_item(tree, hf_afp_user_len, tvb, offset, 2,FALSE);
2105 proto_tree_add_item(tree, hf_afp_user_name, tvb, offset, len,FALSE);
2108 /* directory service */
2109 type = tvb_get_guint8(tvb, offset);
2110 proto_tree_add_item(tree, hf_afp_path_type, tvb, offset, 1,FALSE);
2112 /* FIXME use 16 bit len + unicode from smb dissector */
2116 len = tvb_get_guint8(tvb, offset);
2117 proto_tree_add_item(tree, hf_afp_path_len, tvb, offset, 1,FALSE);
2119 proto_tree_add_item(tree, hf_afp_path_name, tvb, offset, len,FALSE);
2123 len = tvb_get_ntohs(tvb, offset);
2124 proto_tree_add_item( tree, hf_afp_path_unicode_len, tvb, offset, 2,FALSE);
2126 proto_tree_add_item(tree, hf_afp_path_name, tvb, offset, len,FALSE);
2134 if (!strncasecmp(uam, "Cleartxt passwrd", len_uam)) {
2135 len = 8; /* tvb_strsize(tvb, offset);*/
2136 proto_tree_add_item(tree, hf_afp_passwd, tvb, offset, len,FALSE);
2139 else if (!strncasecmp(uam, "No User Authent", len_uam)) {
2144 /* ************************** */
2146 dissect_query_afp_write(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2148 proto_tree_add_item(tree, hf_afp_flag, tvb, offset, 1,FALSE);
2151 proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2,FALSE);
2154 proto_tree_add_item(tree, hf_afp_offset, tvb, offset, 4,FALSE);
2157 proto_tree_add_item(tree, hf_afp_rw_count, tvb, offset, 4,FALSE);
2164 dissect_reply_afp_write(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2166 proto_tree_add_item(tree, hf_afp_last_written, tvb, offset, 4, FALSE);
2172 /* ************************** */
2174 dissect_query_afp_write_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2176 proto_tree_add_item(tree, hf_afp_flag, tvb, offset, 1,FALSE);
2179 proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2,FALSE);
2182 proto_tree_add_item(tree, hf_afp_offset64, tvb, offset, 8,FALSE);
2185 proto_tree_add_item(tree, hf_afp_rw_count64, tvb, offset, 8,FALSE);
2192 dissect_reply_afp_write_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2194 proto_tree_add_item(tree, hf_afp_last_written64, tvb, offset, 8, FALSE);
2200 /* ************************** */
2202 dissect_query_afp_read(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2206 proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2,FALSE);
2209 proto_tree_add_item(tree, hf_afp_offset, tvb, offset, 4,FALSE);
2212 proto_tree_add_item(tree, hf_afp_rw_count, tvb, offset, 4,FALSE);
2215 proto_tree_add_item(tree, hf_afp_newline_mask, tvb, offset, 1,FALSE);
2218 proto_tree_add_item(tree, hf_afp_newline_char, tvb, offset, 1,FALSE);
2224 /* ************************** */
2226 dissect_query_afp_read_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2230 proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2,FALSE);
2233 proto_tree_add_item(tree, hf_afp_offset64, tvb, offset, 8,FALSE);
2236 proto_tree_add_item(tree, hf_afp_rw_count64, tvb, offset, 8,FALSE);
2242 /* **************************
2244 query is the same than AFP_FLUSH, AFP_CLOSEVOL
2248 dissect_reply_afp_open_dt(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2250 proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2,FALSE);
2256 /* **************************
2260 dissect_query_afp_close_dt(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2263 proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2,FALSE);
2269 /* **************************
2270 calls using the same format :
2277 dissect_query_afp_with_fork(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2280 proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2,FALSE);
2286 /* ************************** */
2288 dissect_query_afp_get_fldr_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2291 offset = decode_vol_did_file_dir_bitmap(tree, tvb, offset);
2293 offset = decode_name(tree, pinfo, tvb, offset);
2298 /* -------------------------- */
2300 dissect_reply_afp_get_fldr_param(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2303 guint16 f_bitmap, d_bitmap;
2305 f_bitmap = decode_file_bitmap(tree, tvb, offset);
2308 d_bitmap = decode_dir_bitmap(tree, tvb, offset);
2311 flags = tvb_get_guint8(tvb, offset);
2312 proto_tree_add_item(tree, hf_afp_file_flag, tvb, offset, 1,FALSE);
2316 offset = parse_dir_bitmap(tree, tvb, offset, d_bitmap);
2319 offset = parse_file_bitmap(tree, tvb, offset, f_bitmap,0);
2324 /* **************************
2328 dissect_query_afp_set_fldr_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2333 offset = decode_vol_did(tree, tvb, offset);
2335 f_bitmap = decode_file_bitmap(tree, tvb, offset);
2338 offset = decode_name(tree, pinfo, tvb, offset);
2342 /* did:name can be a file or a folder but only the intersection between
2343 * file bitmap and dir bitmap can be set.
2344 * Well it's in afp spec, but clients (Mac) are setting 'file only' bits with this call
2345 * (WriteInhibit for example).
2347 offset = parse_file_bitmap(tree, tvb, offset, f_bitmap, 1);
2352 /* **************************
2356 dissect_query_afp_set_file_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2361 offset = decode_vol_did(tree, tvb, offset);
2363 f_bitmap = decode_file_bitmap(tree, tvb, offset);
2366 offset = decode_name(tree, pinfo, tvb, offset);
2370 offset = parse_file_bitmap(tree, tvb, offset, f_bitmap, 0);
2375 /* **************************
2379 dissect_query_afp_set_dir_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2384 offset = decode_vol_did(tree, tvb, offset);
2386 d_bitmap = decode_dir_bitmap(tree, tvb, offset);
2389 offset = decode_name(tree, pinfo, tvb, offset);
2393 offset = parse_dir_bitmap(tree, tvb, offset, d_bitmap);
2399 /* **************************
2404 dissect_query_afp_create_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2407 offset = decode_vol_did(tree, tvb, offset);
2409 offset = decode_name(tree, pinfo, tvb, offset);
2413 /* --------------------------
2417 dissect_reply_afp_create_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2419 proto_tree_add_item(tree, hf_afp_file_id, tvb, offset, 4,FALSE);
2425 /* -------------------------- */
2427 dissect_reply_afp_create_dir(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2429 proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4,FALSE);
2435 /* **************************
2439 dissect_query_afp_delete_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2442 proto_tree_add_item(tree, hf_afp_vol_id, tvb, offset, 2,FALSE);
2444 proto_tree_add_item(tree, hf_afp_file_id, tvb, offset, 4,FALSE);
2450 /* **************************
2451 same reply as get_fork_param
2454 dissect_query_afp_resolve_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2457 proto_tree_add_item(tree, hf_afp_vol_id, tvb, offset, 2,FALSE);
2459 proto_tree_add_item(tree, hf_afp_file_id, tvb, offset, 4,FALSE);
2462 decode_file_bitmap(tree, tvb, offset);
2468 /* ************************** */
2470 dissect_query_afp_get_fork_param(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2474 proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2,FALSE);
2477 decode_file_bitmap(tree, tvb, offset);
2482 /* -------------------------- */
2484 dissect_reply_afp_get_fork_param(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2488 f_bitmap = decode_file_bitmap(tree, tvb, offset);
2491 offset = parse_file_bitmap(tree, tvb, offset, f_bitmap,0);
2496 /* ************************** */
2498 dissect_query_afp_set_fork_param(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2502 proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2,FALSE);
2505 decode_file_bitmap(tree, tvb, offset);
2508 proto_tree_add_item(tree, hf_afp_ofork_len, tvb, offset, 4,FALSE);
2513 /* ************************** */
2515 dissect_query_afp_move(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2519 offset = decode_vol_did(tree, tvb, offset);
2521 proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4,FALSE);
2524 offset = decode_name_label(tree, pinfo, tvb, offset, "Source path: %s");
2525 offset = decode_name_label(tree, NULL, tvb, offset, "Dest dir: %s");
2526 offset = decode_name_label(tree, NULL, tvb, offset, "New name: %s");
2531 /* ************************** */
2533 dissect_query_afp_exchange_file(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2537 offset = decode_vol_did(tree, tvb, offset);
2539 proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4,FALSE);
2542 offset = decode_name_label(tree, pinfo, tvb, offset, "Source path: %s");
2543 offset = decode_name_label(tree, NULL, tvb, offset, "Dest path: %s");
2547 /* ************************** */
2549 dissect_query_afp_copy_file(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2551 proto_tree *sub_tree = NULL;
2556 item = proto_tree_add_text(tree, tvb, offset, 6,"Source volume");
2557 sub_tree = proto_item_add_subtree(item, ett_afp_vol_did);
2559 offset = decode_vol_did(sub_tree, tvb, offset);
2562 item = proto_tree_add_text(tree, tvb, offset, 6,"Dest volume");
2563 sub_tree = proto_item_add_subtree(item, ett_afp_vol_did);
2565 offset = decode_vol_did(sub_tree, tvb, offset);
2567 offset = decode_name_label(tree, pinfo, tvb, offset, "Source path: %s");
2568 offset = decode_name_label(tree, NULL, tvb, offset, "Dest dir: %s");
2569 offset = decode_name_label(tree, NULL, tvb, offset, "New name: %s");
2574 /* ************************** */
2576 dissect_query_afp_rename(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2580 offset = decode_vol_did(tree, tvb, offset);
2582 offset = decode_name_label(tree, pinfo, tvb, offset, "Old name: %s");
2583 offset = decode_name_label(tree, NULL, tvb, offset, "New name: %s");
2588 /* ************************** */
2590 dissect_query_afp_byte_lock(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2592 proto_tree *sub_tree = NULL;
2596 flag = tvb_get_guint8(tvb, offset);
2598 item = proto_tree_add_text(tree, tvb, offset, 1, "Flags: 0x%02x", flag);
2599 sub_tree = proto_item_add_subtree(item, ett_afp_lock_flags);
2602 proto_tree_add_item(sub_tree, hf_afp_lock_op, tvb, offset, 1,FALSE);
2603 proto_tree_add_item(sub_tree, hf_afp_lock_from, tvb, offset, 1,FALSE);
2606 proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2,FALSE);
2609 proto_tree_add_item(tree, hf_afp_lock_offset, tvb, offset, 4,FALSE);
2612 proto_tree_add_item(tree, hf_afp_lock_len, tvb, offset, 4,FALSE);
2617 /* -------------------------- */
2619 dissect_reply_afp_byte_lock(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2621 proto_tree_add_item(tree, hf_afp_lock_range_start, tvb, offset, 4,FALSE);
2627 /* ************************** */
2629 dissect_query_afp_byte_lock_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2631 proto_tree *sub_tree = NULL;
2635 flag = tvb_get_guint8(tvb, offset);
2637 item = proto_tree_add_text(tree, tvb, offset, 1, "Flags: 0x%02x", flag);
2638 sub_tree = proto_item_add_subtree(item, ett_afp_lock_flags);
2641 proto_tree_add_item(sub_tree, hf_afp_lock_op, tvb, offset, 1,FALSE);
2642 proto_tree_add_item(sub_tree, hf_afp_lock_from, tvb, offset, 1,FALSE);
2645 proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2,FALSE);
2648 proto_tree_add_item(tree, hf_afp_lock_offset64, tvb, offset, 8,FALSE);
2651 proto_tree_add_item(tree, hf_afp_lock_len64, tvb, offset, 8,FALSE);
2656 /* -------------------------- */
2658 dissect_reply_afp_byte_lock_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2660 proto_tree_add_item(tree, hf_afp_lock_range_start64, tvb, offset, 8,FALSE);
2666 /* ************************** */
2668 dissect_query_afp_add_cmt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2673 proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2,FALSE);
2676 proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4,FALSE);
2679 offset = decode_name(tree, pinfo, tvb, offset);
2684 len = tvb_get_guint8(tvb, offset);
2685 proto_tree_add_item(tree, hf_afp_comment, tvb, offset, 1,FALSE);
2692 /* ************************** */
2694 dissect_query_afp_get_cmt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2698 proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2,FALSE);
2701 proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4,FALSE);
2704 offset = decode_name(tree, pinfo, tvb, offset);
2708 /* -------------------------- */
2710 dissect_reply_afp_get_cmt(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2714 len = tvb_get_guint8(tvb, offset);
2715 proto_tree_add_item(tree, hf_afp_comment, tvb, offset, 1,FALSE);
2721 /* ************************** */
2723 dissect_query_afp_get_icon(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2727 proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2,FALSE);
2729 proto_tree_add_item(tree, hf_afp_file_creator, tvb, offset, 4,FALSE);
2732 proto_tree_add_item(tree, hf_afp_file_type, tvb, offset, 4,FALSE);
2735 proto_tree_add_item(tree, hf_afp_icon_type, tvb, offset, 1,FALSE);
2739 proto_tree_add_item(tree, hf_afp_icon_length, tvb, offset, 2,FALSE);
2745 /* ************************** */
2747 dissect_query_afp_get_icon_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2751 proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2,FALSE);
2753 proto_tree_add_item(tree, hf_afp_file_creator, tvb, offset, 4,FALSE);
2756 proto_tree_add_item(tree, hf_afp_icon_index, tvb, offset, 2,FALSE);
2762 /* -------------------------- */
2764 dissect_reply_afp_get_icon_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2767 proto_tree_add_item(tree, hf_afp_icon_tag, tvb, offset, 4,FALSE);
2770 proto_tree_add_item(tree, hf_afp_file_type, tvb, offset, 4,FALSE);
2773 proto_tree_add_item(tree, hf_afp_icon_type, tvb, offset, 1,FALSE);
2777 proto_tree_add_item(tree, hf_afp_icon_length, tvb, offset, 2,FALSE);
2783 /* ************************** */
2785 dissect_query_afp_add_icon(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2789 proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2,FALSE);
2791 proto_tree_add_item(tree, hf_afp_file_creator, tvb, offset, 4,FALSE);
2794 proto_tree_add_item(tree, hf_afp_file_type, tvb, offset, 4,FALSE);
2797 proto_tree_add_item(tree, hf_afp_icon_type, tvb, offset, 1,FALSE);
2801 proto_tree_add_item(tree, hf_afp_icon_tag, tvb, offset, 4,FALSE);
2804 proto_tree_add_item(tree, hf_afp_icon_length, tvb, offset, 2,FALSE);
2810 /* **************************
2814 dissect_query_afp_add_appl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2818 proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2,FALSE);
2821 proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4,FALSE);
2824 proto_tree_add_item(tree, hf_afp_file_creator, tvb, offset, 4,FALSE);
2827 proto_tree_add_item(tree, hf_afp_appl_tag, tvb, offset, 4,FALSE);
2830 offset = decode_name(tree, pinfo, tvb, offset);
2835 /* **************************
2839 dissect_query_afp_rmv_appl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2843 proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2,FALSE);
2846 proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4,FALSE);
2849 proto_tree_add_item(tree, hf_afp_file_creator, tvb, offset, 4,FALSE);
2852 offset = decode_name(tree, pinfo, tvb, offset);
2857 /* ************************** */
2859 dissect_query_afp_get_appl(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2863 proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2,FALSE);
2866 proto_tree_add_item(tree, hf_afp_file_creator, tvb, offset, 4,FALSE);
2869 proto_tree_add_item(tree, hf_afp_appl_index, tvb, offset, 2,FALSE);
2872 decode_file_bitmap(tree, tvb, offset);
2878 /* -------------------------- */
2880 dissect_reply_afp_get_appl(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2882 proto_tree_add_item(tree, hf_afp_appl_tag, tvb, offset, 4,FALSE);
2888 /* ************************** */
2890 dissect_query_afp_create_file(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2892 proto_tree_add_item(tree, hf_afp_create_flag, tvb, offset, 1,FALSE);
2895 offset = decode_vol_did(tree, tvb, offset);
2897 offset = decode_name(tree, pinfo, tvb, offset);
2902 /* ************************** */
2904 dissect_query_afp_map_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2906 proto_tree_add_item(tree, hf_afp_map_id_type, tvb, offset, 1,FALSE);
2909 proto_tree_add_item(tree, hf_afp_map_id, tvb, offset, 4,FALSE);
2915 /* -------------------------- */
2917 dissect_reply_afp_map_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2921 len = tvb_get_guint8(tvb, offset);
2922 proto_tree_add_item(tree, hf_afp_map_name, tvb, offset, 1,FALSE);
2927 /* ************************** */
2929 dissect_query_afp_map_name(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2932 proto_tree_add_item(tree, hf_afp_map_name_type, tvb, offset, 1,FALSE);
2935 len = tvb_get_guint8(tvb, offset);
2936 proto_tree_add_item(tree, hf_afp_map_name, tvb, offset, 1,FALSE);
2942 /* -------------------------- */
2944 dissect_reply_afp_map_name(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2947 proto_tree_add_item(tree, hf_afp_map_id, tvb, offset, 4,FALSE);
2952 /* ************************** */
2954 dissect_query_afp_disconnect_old_session(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2960 proto_tree_add_item(tree, hf_afp_session_token_type, tvb, offset, 2,FALSE);
2963 len = tvb_get_ntohl(tvb, offset);
2964 proto_tree_add_item(tree, hf_afp_session_token_len, tvb, offset, 4,FALSE);
2967 proto_tree_add_item(tree, hf_afp_session_token, tvb, offset, len,FALSE);
2973 /* ************************** */
2975 dissect_query_afp_get_session_token(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2979 proto_tree_add_item(tree, hf_afp_session_token_type, tvb, offset, 2,FALSE);
2985 /* -------------------------- */
2987 dissect_reply_afp_get_session_token(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2991 proto_tree_add_item(tree, hf_afp_session_token_type, tvb, offset, 2,FALSE);
2994 len = tvb_get_ntohl(tvb, offset);
2995 /* FIXME spec and capture differ : spec 4 bytes, capture 2 bytes? */
2996 proto_tree_add_item(tree, hf_afp_session_token_len, tvb, offset, 4,FALSE);
2999 proto_tree_add_item(tree, hf_afp_session_token, tvb, offset, len,FALSE);
3005 /* ************************** */
3007 dissect_query_afp_get_user_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3009 proto_tree *sub_tree = NULL;
3014 proto_tree_add_item(tree, hf_afp_user_flag, tvb, offset, 1,FALSE);
3017 proto_tree_add_item(tree, hf_afp_user_ID, tvb, offset, 4,FALSE);
3020 bitmap = tvb_get_ntohs(tvb, offset);
3022 item = proto_tree_add_item(tree, hf_afp_user_bitmap, tvb, offset, 2,FALSE);
3023 sub_tree = proto_item_add_subtree(item, ett_afp_user_bitmap);
3024 proto_tree_add_item(sub_tree, hf_afp_user_bitmap_UID, tvb, offset, 2,FALSE);
3025 proto_tree_add_item(sub_tree, hf_afp_user_bitmap_GID, tvb, offset, 2,FALSE);
3032 /* -------------------------- */
3034 dissect_reply_afp_get_user_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3036 proto_tree *sub_tree = NULL;
3040 bitmap = tvb_get_ntohs(tvb, offset);
3042 item = proto_tree_add_item(tree, hf_afp_user_bitmap, tvb, offset, 2,FALSE);
3043 sub_tree = proto_item_add_subtree(item, ett_afp_user_bitmap);
3044 proto_tree_add_item(sub_tree, hf_afp_user_bitmap_UID, tvb, offset, 2,FALSE);
3045 proto_tree_add_item(sub_tree, hf_afp_user_bitmap_GID, tvb, offset, 2,FALSE);
3050 proto_tree_add_item(tree, hf_afp_user_ID, tvb, offset, 4,FALSE);
3055 proto_tree_add_item(tree, hf_afp_group_ID, tvb, offset, 4,FALSE);
3061 /* ************************** */
3063 dissect_afp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
3065 struct aspinfo *aspinfo = pinfo->private_data;
3066 proto_tree *afp_tree = NULL;
3068 conversation_t *conversation;
3070 afp_request_key request_key, *new_request_key;
3071 afp_request_val *request_val;
3074 int len = tvb_reported_length_remaining(tvb,0);
3076 if (check_col(pinfo->cinfo, COL_PROTOCOL))
3077 col_set_str(pinfo->cinfo, COL_PROTOCOL, "AFP");
3078 if (check_col(pinfo->cinfo, COL_INFO))
3079 col_clear(pinfo->cinfo, COL_INFO);
3081 conversation = find_conversation(&pinfo->src, &pinfo->dst, pinfo->ptype,
3082 pinfo->srcport, pinfo->destport, 0);
3084 if (conversation == NULL)
3086 conversation = conversation_new(&pinfo->src, &pinfo->dst,
3087 pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
3090 request_key.conversation = conversation->index;
3091 request_key.seq = aspinfo->seq;
3093 request_val = (afp_request_val *) g_hash_table_lookup(
3094 afp_request_hash, &request_key);
3096 if (!request_val && !aspinfo->reply) {
3097 afp_command = tvb_get_guint8(tvb, offset);
3098 new_request_key = g_mem_chunk_alloc(afp_request_keys);
3099 *new_request_key = request_key;
3101 request_val = g_mem_chunk_alloc(afp_request_vals);
3102 request_val->command = tvb_get_guint8(tvb, offset);
3104 g_hash_table_insert(afp_request_hash, new_request_key,
3108 if (!request_val) { /* missing request */
3109 if (check_col(pinfo->cinfo, COL_INFO))
3110 col_add_fstr(pinfo->cinfo, COL_INFO, "[Reply without query?]");
3114 afp_command = request_val->command;
3115 if (check_col(pinfo->cinfo, COL_INFO)) {
3116 col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s",
3117 val_to_str(afp_command, CommandCode_vals,
3118 "Unknown command (%u)"),
3119 aspinfo->reply ? "reply" : "request");
3120 if (aspinfo->reply && aspinfo->code != 0) {
3121 col_append_fstr(pinfo->cinfo, COL_INFO, ": %s (%d)",
3122 val_to_str(aspinfo->code, asp_error_vals,
3123 "Unknown error (%u)"), aspinfo->code);
3129 ti = proto_tree_add_item(tree, proto_afp, tvb, offset, -1,FALSE);
3130 afp_tree = proto_item_add_subtree(ti, ett_afp);
3132 if (!aspinfo->reply) {
3134 proto_tree_add_uint(afp_tree, hf_afp_command, tvb,offset, 1, afp_command);
3135 if (afp_command != tvb_get_guint8(tvb, offset))
3137 /* we have the same conversation for different connections eg:
3138 * ip1:2048 --> ip2:548
3139 * ip1:2048 --> ip2:548 <RST>
3141 * ip1:2048 --> ip2:548 <SYN> use the same port but it's a new session!
3143 if (check_col(pinfo->cinfo, COL_INFO)) {
3144 col_add_fstr(pinfo->cinfo, COL_INFO,
3145 "[Error!IP port reused, you need to split the capture file]");
3150 switch(afp_command) {
3152 offset = dissect_query_afp_byte_lock(tvb, pinfo, afp_tree, offset);break;
3153 case AFP_BYTELOCK_EXT:
3154 offset = dissect_query_afp_byte_lock_ext(tvb, pinfo, afp_tree, offset);break;
3155 case AFP_OPENDT: /* same as close vol */
3158 offset = dissect_query_afp_with_vol_id(tvb, pinfo, afp_tree, offset);break;
3160 /* offset = dissect_query_afp_close_dir(tvb, pinfo, afp_tree, offset);break; */
3163 offset = dissect_query_afp_close_dt(tvb, pinfo, afp_tree, offset);break;
3164 case AFP_FLUSHFORK: /* same packet as closefork */
3166 offset = dissect_query_afp_with_fork(tvb, pinfo, afp_tree, offset);break;
3168 offset = dissect_query_afp_copy_file(tvb, pinfo, afp_tree, offset);break;
3169 case AFP_CREATEFILE:
3170 offset = dissect_query_afp_create_file(tvb, pinfo, afp_tree, offset);break;
3171 case AFP_DISCTOLDSESS:
3172 offset = dissect_query_afp_disconnect_old_session(tvb, pinfo, afp_tree, offset);break;
3173 case AFP_ENUMERATE_EXT2:
3174 offset = dissect_query_afp_enumerate_ext2(tvb, pinfo, afp_tree, offset);break;
3175 case AFP_ENUMERATE_EXT:
3177 offset = dissect_query_afp_enumerate(tvb, pinfo, afp_tree, offset);break;
3178 case AFP_GETFORKPARAM:
3179 offset = dissect_query_afp_get_fork_param(tvb, pinfo, afp_tree, offset);break;
3180 case AFP_GETSESSTOKEN:
3181 offset = dissect_query_afp_get_session_token(tvb, pinfo, afp_tree, offset);break;
3182 case AFP_GETUSERINFO:
3183 offset = dissect_query_afp_get_user_info(tvb, pinfo, afp_tree, offset);break;
3184 case AFP_GETSRVINFO:
3185 /* offset = dissect_query_afp_get_server_info(tvb, pinfo, afp_tree, offset);break; */
3186 case AFP_GETSRVPARAM:
3187 break; /* no parameters */
3188 case AFP_GETVOLPARAM:
3189 offset = dissect_query_afp_get_vol_param(tvb, pinfo, afp_tree, offset);break;
3191 offset = dissect_query_afp_login_ext(tvb, pinfo, afp_tree, offset);break;
3193 offset = dissect_query_afp_login(tvb, pinfo, afp_tree, offset);break;
3198 offset = dissect_query_afp_map_id(tvb, pinfo, afp_tree, offset);break;
3200 offset = dissect_query_afp_map_name(tvb, pinfo, afp_tree, offset);break;
3202 offset = dissect_query_afp_move(tvb, pinfo, afp_tree, offset);break;
3204 offset = dissect_query_afp_open_vol(tvb, pinfo, afp_tree, offset);break;
3208 offset = dissect_query_afp_open_fork(tvb, pinfo, afp_tree, offset);break;
3210 offset = dissect_query_afp_read(tvb, pinfo, afp_tree, offset);break;
3212 offset = dissect_query_afp_read_ext(tvb, pinfo, afp_tree, offset);break;
3214 offset = dissect_query_afp_rename(tvb, pinfo, afp_tree, offset);break;
3215 case AFP_SETDIRPARAM:
3216 offset = dissect_query_afp_set_dir_param(tvb, pinfo, afp_tree, offset);break;
3217 case AFP_SETFILEPARAM:
3218 offset = dissect_query_afp_set_file_param(tvb, pinfo, afp_tree, offset);break;
3219 case AFP_SETFORKPARAM:
3220 offset = dissect_query_afp_set_fork_param(tvb, pinfo, afp_tree, offset);break;
3221 case AFP_SETVOLPARAM:
3222 offset = dissect_query_afp_set_vol_param(tvb, pinfo, afp_tree, offset);break;
3224 offset = dissect_query_afp_write(tvb, pinfo, afp_tree, offset);break;
3226 offset = dissect_query_afp_write_ext(tvb, pinfo, afp_tree, offset);break;
3227 case AFP_GETFLDRPARAM:
3228 offset = dissect_query_afp_get_fldr_param(tvb, pinfo, afp_tree, offset);break;
3229 case AFP_SETFLDRPARAM:
3230 offset = dissect_query_afp_set_fldr_param(tvb, pinfo, afp_tree, offset);break;
3232 case AFP_GETSRVRMSG:
3234 case AFP_DELETE: /* same as create_id */
3237 offset = dissect_query_afp_create_id(tvb, pinfo, afp_tree, offset);break;
3239 offset = dissect_query_afp_delete_id(tvb, pinfo, afp_tree, offset);break;
3241 offset = dissect_query_afp_resolve_id(tvb, pinfo, afp_tree, offset);break;
3242 case AFP_EXCHANGEFILE:
3243 offset = dissect_query_afp_exchange_file(tvb, pinfo, afp_tree, offset);break;
3244 case AFP_CATSEARCH_EXT:
3246 offset = dissect_query_afp_cat_search(tvb, pinfo, afp_tree, offset);break;
3248 offset = dissect_query_afp_get_icon(tvb, pinfo, afp_tree, offset);break;
3250 offset = dissect_query_afp_get_icon_info(tvb, pinfo, afp_tree, offset);break;
3252 offset = dissect_query_afp_add_appl(tvb, pinfo, afp_tree, offset);break;
3254 offset = dissect_query_afp_rmv_appl(tvb, pinfo, afp_tree, offset);break;
3256 offset = dissect_query_afp_get_appl(tvb, pinfo, afp_tree, offset);break;
3258 offset = dissect_query_afp_add_cmt(tvb, pinfo, afp_tree, offset);break;
3259 case AFP_RMVCMT: /* same as get_cmt */
3261 offset = dissect_query_afp_get_cmt(tvb, pinfo, afp_tree, offset);break;
3263 offset = dissect_query_afp_add_icon(tvb, pinfo, afp_tree, offset);break;
3268 proto_tree_add_uint(afp_tree, hf_afp_command, tvb, 0, 0, afp_command);
3270 /* for some calls if the reply is an error there's no data
3274 switch(afp_command) {
3276 offset = dissect_reply_afp_byte_lock(tvb, pinfo, afp_tree, offset);break;
3277 case AFP_BYTELOCK_EXT:
3278 offset = dissect_reply_afp_byte_lock_ext(tvb, pinfo, afp_tree, offset);break;
3279 case AFP_ENUMERATE_EXT2:
3280 case AFP_ENUMERATE_EXT:
3281 offset = dissect_reply_afp_enumerate_ext(tvb, pinfo, afp_tree, offset);break;
3283 offset = dissect_reply_afp_enumerate(tvb, pinfo, afp_tree, offset);break;
3285 offset = dissect_reply_afp_open_vol(tvb, pinfo, afp_tree, offset);break;
3287 offset = dissect_reply_afp_open_fork(tvb, pinfo, afp_tree, offset);break;
3289 case AFP_GETFORKPARAM:
3290 offset =dissect_reply_afp_get_fork_param(tvb, pinfo, afp_tree, offset);break;
3291 case AFP_GETUSERINFO:
3292 offset = dissect_reply_afp_get_user_info(tvb, pinfo, afp_tree, offset);break;
3293 case AFP_GETSRVPARAM:
3294 offset = dissect_reply_afp_get_server_param(tvb, pinfo, afp_tree, offset);break;
3296 offset = dissect_reply_afp_create_dir(tvb, pinfo, afp_tree, offset);break;
3298 offset = dissect_reply_afp_map_id(tvb, pinfo, afp_tree, offset);break;
3300 offset = dissect_reply_afp_map_name(tvb, pinfo, afp_tree, offset);break;
3301 case AFP_MOVE: /* same as create_id */
3303 offset = dissect_reply_afp_create_id(tvb, pinfo, afp_tree, offset);break;
3304 case AFP_GETSESSTOKEN:
3305 offset = dissect_reply_afp_get_session_token(tvb, pinfo, afp_tree, offset);break;
3306 case AFP_GETVOLPARAM:
3307 offset = dissect_reply_afp_get_vol_param(tvb, pinfo, afp_tree, offset);break;
3308 case AFP_GETFLDRPARAM:
3309 offset = dissect_reply_afp_get_fldr_param(tvb, pinfo, afp_tree, offset);break;
3311 offset = dissect_reply_afp_open_dt(tvb, pinfo, afp_tree, offset);break;
3313 case AFP_CATSEARCH_EXT:
3315 offset = dissect_reply_afp_cat_search(tvb, pinfo, afp_tree, offset);break;
3317 offset = dissect_reply_afp_get_icon_info(tvb, pinfo, afp_tree, offset);break;
3319 offset = dissect_reply_afp_get_appl(tvb, pinfo, afp_tree, offset);break;
3321 offset = dissect_reply_afp_get_cmt(tvb, pinfo, afp_tree, offset);break;
3323 offset = dissect_reply_afp_write(tvb, pinfo, afp_tree, offset);break;
3325 offset = dissect_reply_afp_write_ext(tvb, pinfo, afp_tree, offset);break;
3328 if (tree && offset < len) {
3329 call_dissector(data_handle, tvb_new_subset(tvb, offset, -1, -1),
3334 static void afp_reinit( void)
3337 if (afp_request_hash)
3338 g_hash_table_destroy(afp_request_hash);
3339 if (afp_request_keys)
3340 g_mem_chunk_destroy(afp_request_keys);
3341 if (afp_request_vals)
3342 g_mem_chunk_destroy(afp_request_vals);
3344 afp_request_hash = g_hash_table_new(afp_hash, afp_equal);
3346 afp_request_keys = g_mem_chunk_new("afp_request_keys",
3347 sizeof(afp_request_key),
3348 afp_packet_init_count * sizeof(afp_request_key),
3350 afp_request_vals = g_mem_chunk_new("afp_request_vals",
3351 sizeof(afp_request_val),
3352 afp_packet_init_count * sizeof(afp_request_val),
3358 proto_register_afp(void)
3361 static hf_register_info hf[] = {
3363 { "Command", "afp.command",
3364 FT_UINT8, BASE_DEC, VALS(CommandCode_vals), 0x0,
3365 "AFP function", HFILL }},
3369 FT_NONE, BASE_NONE, NULL, 0,
3370 "Pad Byte", HFILL }},
3372 { &hf_afp_AFPVersion,
3373 { "AFP Version", "afp.AFPVersion",
3374 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
3375 "Client AFP version", HFILL }},
3379 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
3380 "User Authentication Method", HFILL }},
3383 { "User", "afp.user",
3384 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
3387 { &hf_afp_user_type,
3388 { "Type", "afp.user_type",
3389 FT_UINT8, BASE_HEX, VALS(path_type_vals), 0,
3390 "Type of user name", HFILL }},
3392 { "Len", "afp.user_len",
3393 FT_UINT16, BASE_DEC, NULL, 0x0,
3394 "User name length (unicode)", HFILL }},
3395 { &hf_afp_user_name,
3396 { "User", "afp.user_name",
3397 FT_STRING, BASE_NONE, NULL, 0x0,
3398 "User name (unicode)", HFILL }},
3401 { "Password", "afp.passwd",
3402 FT_STRINGZ, BASE_NONE, NULL, 0x0,
3403 "Password", HFILL }},
3405 { &hf_afp_login_flags,
3406 { "Flags", "afp.afp_login_flags",
3407 FT_UINT16, BASE_HEX, NULL, 0 /* 0x0FFF*/,
3408 "Login flags", HFILL }},
3410 { &hf_afp_vol_bitmap,
3411 { "Bitmap", "afp.vol_bitmap",
3412 FT_UINT16, BASE_HEX, NULL, 0 /* 0x0FFF*/,
3413 "Volume bitmap", HFILL }},
3415 { &hf_afp_vol_bitmap_Attributes,
3416 { "Attributes", "afp.vol_bitmap.attributes",
3417 FT_BOOLEAN, 16, NULL, kFPVolAttributeBit,
3418 "Volume attributes", HFILL }},
3420 { &hf_afp_vol_attribute,
3421 { "Attributes", "afp.vol_attributes",
3422 FT_UINT16, BASE_HEX, NULL, 0,
3423 "Volume attributes", HFILL }},
3425 { &hf_afp_vol_attribute_ReadOnly,
3426 { "Read only", "afp.vol_attribute.read_only",
3427 FT_BOOLEAN, 16, NULL, kReadOnly,
3428 "Read only volume", HFILL }},
3430 { &hf_afp_vol_attribute_HasVolumePassword,
3431 { "Volume password", "afp.vol_attribute.passwd",
3432 FT_BOOLEAN, 16, NULL, kHasVolumePassword,
3433 "Has a volume password", HFILL }},
3435 { &hf_afp_vol_attribute_SupportsFileIDs,
3436 { "File IDs", "afp.vol_attribute.fileIDs",
3437 FT_BOOLEAN, 16, NULL, kSupportsFileIDs,
3438 "Supports file IDs", HFILL }},
3440 { &hf_afp_vol_attribute_SupportsCatSearch,
3441 { "Catalog search", "afp.vol_attribute.cat_search",
3442 FT_BOOLEAN, 16, NULL, kSupportsCatSearch,
3443 "Supports catalog search operations", HFILL }},
3445 { &hf_afp_vol_attribute_SupportsBlankAccessPrivs,
3446 { "Blank access privileges", "afp.vol_attribute.blank_access_privs",
3447 FT_BOOLEAN, 16, NULL, kSupportsBlankAccessPrivs,
3448 "Supports blank access privileges", HFILL }},
3450 { &hf_afp_vol_attribute_SupportsUnixPrivs,
3451 { "UNIX access privileges", "afp.vol_attribute.unix_privs",
3452 FT_BOOLEAN, 16, NULL, kSupportsUnixPrivs,
3453 "Supports UNIX access privileges", HFILL }},
3455 { &hf_afp_vol_attribute_SupportsUTF8Names,
3456 { "UTF-8 names", "afp.vol_attribute.utf8_names",
3457 FT_BOOLEAN, 16, NULL, kSupportsUTF8Names,
3458 "Supports UTF-8 names", HFILL }},
3460 { &hf_afp_vol_bitmap_Signature,
3461 { "Signature", "afp.vol_bitmap.signature",
3462 FT_BOOLEAN, 16, NULL, kFPVolSignatureBit,
3463 "Volume signature", HFILL }},
3465 { &hf_afp_vol_bitmap_CreateDate,
3466 { "Creation date", "afp.vol_bitmap.create_date",
3467 FT_BOOLEAN, 16, NULL, kFPVolCreateDateBit,
3468 "Volume creation date", HFILL }},
3470 { &hf_afp_vol_bitmap_ModDate,
3471 { "Modification date", "afp.vol_bitmap.mod_date",
3472 FT_BOOLEAN, 16, NULL, kFPVolModDateBit,
3473 "Volume modification date", HFILL }},
3475 { &hf_afp_vol_bitmap_BackupDate,
3476 { "Backup date", "afp.vol_bitmap.backup_date",
3477 FT_BOOLEAN, 16, NULL, kFPVolBackupDateBit,
3478 "Volume backup date", HFILL }},
3480 { &hf_afp_vol_bitmap_ID,
3481 { "ID", "afp.vol_bitmap.id",
3482 FT_BOOLEAN, 16, NULL, kFPVolIDBit,
3483 "Volume ID", HFILL }},
3485 { &hf_afp_vol_bitmap_BytesFree,
3486 { "Bytes free", "afp.vol_bitmap.bytes_free",
3487 FT_BOOLEAN, 16, NULL, kFPVolBytesFreeBit,
3488 "Volume free bytes", HFILL }},
3490 { &hf_afp_vol_bitmap_BytesTotal,
3491 { "Bytes total", "afp.vol_bitmap.bytes_total",
3492 FT_BOOLEAN, 16, NULL, kFPVolBytesTotalBit,
3493 "Volume total bytes", HFILL }},
3495 { &hf_afp_vol_bitmap_Name,
3496 { "Name", "afp.vol_bitmap.name",
3497 FT_BOOLEAN, 16, NULL, kFPVolNameBit,
3498 "Volume name", HFILL }},
3500 { &hf_afp_vol_bitmap_ExtBytesFree,
3501 { "Extended bytes free", "afp.vol_bitmap.ex_bytes_free",
3502 FT_BOOLEAN, 16, NULL, kFPVolExtBytesFreeBit,
3503 "Volume extended (>2GB) free bytes", HFILL }},
3505 { &hf_afp_vol_bitmap_ExtBytesTotal,
3506 { "Extended bytes total", "afp.vol_bitmap.ex_bytes_total",
3507 FT_BOOLEAN, 16, NULL, kFPVolExtBytesTotalBit,
3508 "Volume extended (>2GB) total bytes", HFILL }},
3510 { &hf_afp_vol_bitmap_BlockSize,
3511 { "Block size", "afp.vol_bitmap.block_size",
3512 FT_BOOLEAN, 16, NULL, kFPVolBlockSizeBit,
3513 "Volume block size", HFILL }},
3515 { &hf_afp_dir_bitmap_Attributes,
3516 { "Attributes", "afp.dir_bitmap.attributes",
3517 FT_BOOLEAN, 16, NULL, kFPAttributeBit,
3518 "Return attributes if directory", HFILL }},
3520 { &hf_afp_dir_bitmap_ParentDirID,
3521 { "DID", "afp.dir_bitmap.did",
3522 FT_BOOLEAN, 16, NULL, kFPParentDirIDBit,
3523 "Return parent directory ID if directory", HFILL }},
3525 { &hf_afp_dir_bitmap_CreateDate,
3526 { "Creation date", "afp.dir_bitmap.create_date",
3527 FT_BOOLEAN, 16, NULL, kFPCreateDateBit,
3528 "Return creation date if directory", HFILL }},
3530 { &hf_afp_dir_bitmap_ModDate,
3531 { "Modification date", "afp.dir_bitmap.mod_date",
3532 FT_BOOLEAN, 16, NULL, kFPModDateBit,
3533 "Return modification date if directory", HFILL }},
3535 { &hf_afp_dir_bitmap_BackupDate,
3536 { "Backup date", "afp.dir_bitmap.backup_date",
3537 FT_BOOLEAN, 16, NULL, kFPBackupDateBit,
3538 "Return backup date if directory", HFILL }},
3540 { &hf_afp_dir_bitmap_FinderInfo,
3541 { "Finder info", "afp.dir_bitmap.finder_info",
3542 FT_BOOLEAN, 16, NULL, kFPFinderInfoBit,
3543 "Return finder info if directory", HFILL }},
3545 { &hf_afp_dir_bitmap_LongName,
3546 { "Long name", "afp.dir_bitmap.long_name",
3547 FT_BOOLEAN, 16, NULL, kFPLongNameBit,
3548 "Return long name if directory", HFILL }},
3550 { &hf_afp_dir_bitmap_ShortName,
3551 { "Short name", "afp.dir_bitmap.short_name",
3552 FT_BOOLEAN, 16, NULL, kFPShortNameBit,
3553 "Return short name if directory", HFILL }},
3555 { &hf_afp_dir_bitmap_NodeID,
3556 { "File ID", "afp.dir_bitmap.fid",
3557 FT_BOOLEAN, 16, NULL, kFPNodeIDBit,
3558 "Return file ID if directory", HFILL }},
3560 { &hf_afp_dir_bitmap_OffspringCount,
3561 { "Offspring count", "afp.dir_bitmap.offspring_count",
3562 FT_BOOLEAN, 16, NULL, kFPOffspringCountBit,
3563 "Return offspring count if directory", HFILL }},
3565 { &hf_afp_dir_bitmap_OwnerID,
3566 { "Owner id", "afp.dir_bitmap.owner_id",
3567 FT_BOOLEAN, 16, NULL, kFPOwnerIDBit,
3568 "Return owner id if directory", HFILL }},
3570 { &hf_afp_dir_bitmap_GroupID,
3571 { "Group id", "afp.dir_bitmap.group_id",
3572 FT_BOOLEAN, 16, NULL, kFPGroupIDBit,
3573 "Return group id if directory", HFILL }},
3575 { &hf_afp_dir_bitmap_AccessRights,
3576 { "Access rights", "afp.dir_bitmap.access_rights",
3577 FT_BOOLEAN, 16, NULL, kFPAccessRightsBit,
3578 "Return access rights if directory", HFILL }},
3580 { &hf_afp_dir_bitmap_UTF8Name,
3581 { "UTF-8 name", "afp.dir_bitmap.UTF8_name",
3582 FT_BOOLEAN, 16, NULL, kFPUTF8NameBit,
3583 "Return UTF-8 name if diectory", HFILL }},
3585 { &hf_afp_dir_bitmap_UnixPrivs,
3586 { "UNIX privileges", "afp.dir_bitmap.unix_privs",
3587 FT_BOOLEAN, 16, NULL, kFPUnixPrivsBit,
3588 "Return UNIX privileges if directory", HFILL }},
3590 { &hf_afp_dir_attribute_Invisible,
3591 { "Invisible", "afp.dir_attribute.invisible",
3592 FT_BOOLEAN, 16, NULL, kFPInvisibleBit,
3593 "Directory is not visible", HFILL }},
3595 { &hf_afp_dir_attribute_IsExpFolder,
3596 { "Share point", "afp.dir_attribute.share",
3597 FT_BOOLEAN, 16, NULL, kFPMultiUserBit,
3598 "Directory is a share point", HFILL }},
3600 { &hf_afp_dir_attribute_System,
3601 { "System", "afp.dir_attribute.system",
3602 FT_BOOLEAN, 16, NULL, kFPSystemBit,
3603 "Directory is a system directory", HFILL }},
3605 { &hf_afp_dir_attribute_Mounted,
3606 { "Mounted", "afp.dir_attribute.mounted",
3607 FT_BOOLEAN, 16, NULL, kFPDAlreadyOpenBit,
3608 "Directory is mounted", HFILL }},
3610 { &hf_afp_dir_attribute_InExpFolder,
3611 { "Shared area", "afp.dir_attribute.in_exported_folder",
3612 FT_BOOLEAN, 16, NULL, kFPRAlreadyOpenBit,
3613 "Directory is in a shared area", HFILL }},
3615 { &hf_afp_dir_attribute_BackUpNeeded,
3616 { "Backup needed", "afp.dir_attribute.backup_needed",
3617 FT_BOOLEAN, 16, NULL, kFPBackUpNeededBit,
3618 "Directory needs to be backed up", HFILL }},
3620 { &hf_afp_dir_attribute_RenameInhibit,
3621 { "Rename inhibit", "afp.dir_attribute.rename_inhibit",
3622 FT_BOOLEAN, 16, NULL, kFPRenameInhibitBit,
3623 "Rename inhibit", HFILL }},
3625 { &hf_afp_dir_attribute_DeleteInhibit,
3626 { "Delete inhibit", "afp.dir_attribute.delete_inhibit",
3627 FT_BOOLEAN, 16, NULL, kFPDeleteInhibitBit,
3628 "Delete inhibit", HFILL }},
3630 { &hf_afp_dir_attribute_SetClear,
3631 { "Set", "afp.dir_attribute.set_clear",
3632 FT_BOOLEAN, 16, NULL, kFPSetClearBit,
3633 "Clear/set attribute", HFILL }},
3635 { &hf_afp_file_bitmap_Attributes,
3636 { "Attributes", "afp.file_bitmap.attributes",
3637 FT_BOOLEAN, 16, NULL, kFPAttributeBit,
3638 "Return attributes if file", HFILL }},
3640 { &hf_afp_file_bitmap_ParentDirID,
3641 { "DID", "afp.file_bitmap.did",
3642 FT_BOOLEAN, 16, NULL, kFPParentDirIDBit,
3643 "Return parent directory ID if file", HFILL }},
3645 { &hf_afp_file_bitmap_CreateDate,
3646 { "Creation date", "afp.file_bitmap.create_date",
3647 FT_BOOLEAN, 16, NULL, kFPCreateDateBit,
3648 "Return creation date if file", HFILL }},
3650 { &hf_afp_file_bitmap_ModDate,
3651 { "Modification date", "afp.file_bitmap.mod_date",
3652 FT_BOOLEAN, 16, NULL, kFPModDateBit,
3653 "Return modification date if file", HFILL }},
3655 { &hf_afp_file_bitmap_BackupDate,
3656 { "Backup date", "afp.file_bitmap.backup_date",
3657 FT_BOOLEAN, 16, NULL, kFPBackupDateBit,
3658 "Return backup date if file", HFILL }},
3660 { &hf_afp_file_bitmap_FinderInfo,
3661 { "Finder info", "afp.file_bitmap.finder_info",
3662 FT_BOOLEAN, 16, NULL, kFPFinderInfoBit,
3663 "Return finder info if file", HFILL }},
3665 { &hf_afp_file_bitmap_LongName,
3666 { "Long name", "afp.file_bitmap.long_name",
3667 FT_BOOLEAN, 16, NULL, kFPLongNameBit,
3668 "Return long name if file", HFILL }},
3670 { &hf_afp_file_bitmap_ShortName,
3671 { "Short name", "afp.file_bitmap.short_name",
3672 FT_BOOLEAN, 16, NULL, kFPShortNameBit,
3673 "Return short name if file", HFILL }},
3675 { &hf_afp_file_bitmap_NodeID,
3676 { "File ID", "afp.file_bitmap.fid",
3677 FT_BOOLEAN, 16, NULL, kFPNodeIDBit,
3678 "Return file ID if file", HFILL }},
3680 { &hf_afp_file_bitmap_DataForkLen,
3681 { "Data fork size", "afp.file_bitmap.data_fork_len",
3682 FT_BOOLEAN, 16, NULL, kFPDataForkLenBit,
3683 "Return data fork size if file", HFILL }},
3685 { &hf_afp_file_bitmap_RsrcForkLen,
3686 { "Resource fork size", "afp.file_bitmap.resource_fork_len",
3687 FT_BOOLEAN, 16, NULL, kFPRsrcForkLenBit,
3688 "Return resource fork size if file", HFILL }},
3690 { &hf_afp_file_bitmap_ExtDataForkLen,
3691 { "Extended data fork size", "afp.file_bitmap.ex_data_fork_len",
3692 FT_BOOLEAN, 16, NULL, kFPExtDataForkLenBit,
3693 "Return extended (>2GB) data fork size if file", HFILL }},
3695 { &hf_afp_file_bitmap_LaunchLimit,
3696 { "Launch limit", "afp.file_bitmap.launch_limit",
3697 FT_BOOLEAN, 16, NULL, kFPLaunchLimitBit,
3698 "Return launch limit if file", HFILL }},
3700 { &hf_afp_file_bitmap_UTF8Name,
3701 { "UTF-8 name", "afp.file_bitmap.UTF8_name",
3702 FT_BOOLEAN, 16, NULL, kFPUTF8NameBit,
3703 "Return UTF-8 name if file", HFILL }},
3705 { &hf_afp_file_bitmap_ExtRsrcForkLen,
3706 { "Extended resource fork size", "afp.file_bitmap.ex_resource_fork_len",
3707 FT_BOOLEAN, 16, NULL, kFPExtRsrcForkLenBit,
3708 "Return extended (>2GB) resource fork size if file", HFILL }},
3710 { &hf_afp_file_bitmap_UnixPrivs,
3711 { "UNIX privileges", "afp.file_bitmap.unix_privs",
3712 FT_BOOLEAN, 16, NULL, kFPUnixPrivsBit_file,
3713 "Return UNIX privileges if file", HFILL }},
3716 { &hf_afp_file_attribute_Invisible,
3717 { "Invisible", "afp.file_attribute.invisible",
3718 FT_BOOLEAN, 16, NULL, kFPInvisibleBit,
3719 "File is not visible", HFILL }},
3721 { &hf_afp_file_attribute_MultiUser,
3722 { "Multi user", "afp.file_attribute.multi_user",
3723 FT_BOOLEAN, 16, NULL, kFPMultiUserBit,
3724 "multi user", HFILL }},
3726 { &hf_afp_file_attribute_System,
3727 { "System", "afp.file_attribute.system",
3728 FT_BOOLEAN, 16, NULL, kFPSystemBit,
3729 "File is a system file", HFILL }},
3731 { &hf_afp_file_attribute_DAlreadyOpen,
3732 { "Data fork open", "afp.file_attribute.df_open",
3733 FT_BOOLEAN, 16, NULL, kFPDAlreadyOpenBit,
3734 "Data fork already open", HFILL }},
3736 { &hf_afp_file_attribute_RAlreadyOpen,
3737 { "Resource fork open", "afp.file_attribute.rf_open",
3738 FT_BOOLEAN, 16, NULL, kFPRAlreadyOpenBit,
3739 "Resource fork already open", HFILL }},
3741 { &hf_afp_file_attribute_WriteInhibit,
3742 { "Write inhibit", "afp.file_attribute.write_inhibit",
3743 FT_BOOLEAN, 16, NULL, kFPWriteInhibitBit,
3744 "Write inhibit", HFILL }},
3746 { &hf_afp_file_attribute_BackUpNeeded,
3747 { "Backup needed", "afp.file_attribute.backup_needed",
3748 FT_BOOLEAN, 16, NULL, kFPBackUpNeededBit,
3749 "File needs to be backed up", HFILL }},
3751 { &hf_afp_file_attribute_RenameInhibit,
3752 { "Rename inhibit", "afp.file_attribute.rename_inhibit",
3753 FT_BOOLEAN, 16, NULL, kFPRenameInhibitBit,
3754 "rename inhibit", HFILL }},
3756 { &hf_afp_file_attribute_DeleteInhibit,
3757 { "Delete inhibit", "afp.file_attribute.delete_inhibit",
3758 FT_BOOLEAN, 16, NULL, kFPDeleteInhibitBit,
3759 "delete inhibit", HFILL }},
3761 { &hf_afp_file_attribute_CopyProtect,
3762 { "Copy protect", "afp.file_attribute.copy_protect",
3763 FT_BOOLEAN, 16, NULL, kFPCopyProtectBit,
3764 "copy protect", HFILL }},
3766 { &hf_afp_file_attribute_SetClear,
3767 { "Set", "afp.file_attribute.set_clear",
3768 FT_BOOLEAN, 16, NULL, kFPSetClearBit,
3769 "Clear/set attribute", HFILL }},
3773 { "Volume", "afp.vol_name",
3774 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
3775 "Volume name", HFILL }},
3777 { &hf_afp_vol_flag_passwd,
3778 { "Password", "afp.vol_flag_passwd",
3779 FT_BOOLEAN, 8, NULL, 1,
3780 "Volume is password-protected", HFILL }},
3782 { &hf_afp_vol_flag_unix_priv,
3783 { "Unix privs", "afp.vol_flag_unix_priv",
3784 FT_BOOLEAN, 8, NULL, 2,
3785 "Volume has unix privileges", HFILL }},
3788 { "Volume id", "afp.vol_id",
3789 FT_UINT16, BASE_DEC, NULL, 0x0,
3790 "Volume id", HFILL }},
3792 { &hf_afp_vol_signature,
3793 { "Signature", "afp.vol_signature",
3794 FT_UINT16, BASE_DEC, VALS(vol_signature_vals), 0x0,
3795 "Volume signature", HFILL }},
3797 { &hf_afp_vol_name_offset,
3798 { "Volume name offset","afp.vol_name_offset",
3799 FT_UINT16, BASE_DEC, NULL, 0x0,
3800 "Volume name offset in packet", HFILL }},
3802 { &hf_afp_vol_creation_date,
3803 { "Creation date", "afp.vol_creation_date",
3804 FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x0,
3805 "Volume creation date", HFILL }},
3807 { &hf_afp_vol_modification_date,
3808 { "Modification date", "afp.vol_modification_date",
3809 FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x0,
3810 "Volume modification date", HFILL }},
3812 { &hf_afp_vol_backup_date,
3813 { "Backup date", "afp.vol_backup_date",
3814 FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x0,
3815 "Volume backup date", HFILL }},
3817 { &hf_afp_vol_bytes_free,
3818 { "Bytes free", "afp.vol_bytes_free",
3819 FT_UINT32, BASE_DEC, NULL, 0x0,
3820 "Free space", HFILL }},
3822 { &hf_afp_vol_bytes_total,
3823 { "Bytes total", "afp.vol_bytes_total",
3824 FT_UINT32, BASE_DEC, NULL, 0x0,
3825 "Volume size", HFILL }},
3827 { &hf_afp_vol_ex_bytes_free,
3828 { "Extended bytes free", "afp.vol_ex_bytes_free",
3829 FT_UINT64, BASE_DEC, NULL, 0x0,
3830 "Extended (>2GB) free space", HFILL }},
3832 { &hf_afp_vol_ex_bytes_total,
3833 { "Extended bytes total", "afp.vol_ex_bytes_total",
3834 FT_UINT64, BASE_DEC, NULL, 0x0,
3835 "Extended (>2GB) volume size", HFILL }},
3837 { &hf_afp_vol_block_size,
3838 { "Block size", "afp.vol_block_size",
3839 FT_UINT32, BASE_DEC, NULL, 0x0,
3840 "Volume block size", HFILL }},
3844 FT_UINT32, BASE_DEC, NULL, 0x0,
3845 "Parent directory ID", HFILL }},
3847 { &hf_afp_dir_bitmap,
3848 { "Directory bitmap", "afp.dir_bitmap",
3849 FT_UINT16, BASE_HEX, NULL, 0x0,
3850 "Directory bitmap", HFILL }},
3852 { &hf_afp_dir_offspring,
3853 { "Offspring", "afp.dir_offspring",
3854 FT_UINT16, BASE_DEC, NULL, 0x0,
3855 "Directory offspring", HFILL }},
3857 { &hf_afp_dir_OwnerID,
3858 { "Owner ID", "afp.dir_owner_id",
3859 FT_INT32, BASE_DEC, NULL, 0x0,
3860 "Directory owner ID", HFILL }},
3862 { &hf_afp_dir_GroupID,
3863 { "Group ID", "afp.dir_group_id",
3864 FT_INT32, BASE_DEC, NULL, 0x0,
3865 "Directory group ID", HFILL }},
3867 { &hf_afp_creation_date,
3868 { "Creation date", "afp.creation_date",
3869 FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x0,
3870 "Creation date", HFILL }},
3872 { &hf_afp_modification_date,
3873 { "Modification date", "afp.modification_date",
3874 FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x0,
3875 "Modification date", HFILL }},
3877 { &hf_afp_backup_date,
3878 { "Backup date", "afp.backup_date",
3879 FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x0,
3880 "Backup date", HFILL }},
3882 { &hf_afp_finder_info,
3883 { "Finder info", "afp.finder_info",
3884 FT_BYTES, BASE_HEX, NULL, 0x0,
3885 "Finder info", HFILL }},
3887 { &hf_afp_long_name_offset,
3888 { "Long name offset", "afp.long_name_offset",
3889 FT_UINT16, BASE_DEC, NULL, 0x0,
3890 "Long name offset in packet", HFILL }},
3892 { &hf_afp_short_name_offset,
3893 { "Short name offset", "afp.short_name_offset",
3894 FT_UINT16, BASE_DEC, NULL, 0x0,
3895 "Short name offset in packet", HFILL }},
3897 { &hf_afp_unicode_name_offset,
3898 { "Unicode name offset", "afp.unicode_name_offset",
3899 FT_UINT16, BASE_DEC, NULL, 0x0,
3900 "Unicode name offset in packet", HFILL }},
3902 { &hf_afp_unix_privs_uid,
3903 { "UID", "afp.unix_privs.uid",
3904 FT_UINT32, BASE_DEC, NULL, 0x0,
3905 "User ID", HFILL }},
3907 { &hf_afp_unix_privs_gid,
3908 { "GID", "afp.unix_privs.gid",
3909 FT_UINT32, BASE_DEC, NULL, 0x0,
3910 "Group ID", HFILL }},
3912 { &hf_afp_unix_privs_permissions,
3913 { "Permissions", "afp.unix_privs.permissions",
3914 FT_UINT32, BASE_OCT, NULL, 0x0,
3915 "Permissions", HFILL }},
3917 { &hf_afp_unix_privs_ua_permissions,
3918 { "User's access rights", "afp.unix_privs.ua_permissions",
3919 FT_UINT32, BASE_HEX, NULL, 0x0,
3920 "User's access rights", HFILL }},
3923 { "File ID", "afp.file_id",
3924 FT_UINT32, BASE_DEC, NULL, 0x0,
3925 "File/directory ID", HFILL }},
3927 { &hf_afp_file_DataForkLen,
3928 { "Data fork size", "afp.data_fork_len",
3929 FT_UINT32, BASE_DEC, NULL, 0x0,
3930 "Data fork size", HFILL }},
3932 { &hf_afp_file_RsrcForkLen,
3933 { "Resource fork size", "afp.resource_fork_len",
3934 FT_UINT32, BASE_DEC, NULL, 0x0,
3935 "Resource fork size", HFILL }},
3937 { &hf_afp_file_ExtDataForkLen,
3938 { "Extended data fork size", "afp.ext_data_fork_len",
3939 FT_UINT64, BASE_DEC, NULL, 0x0,
3940 "Extended (>2GB) data fork length", HFILL }},
3942 { &hf_afp_file_ExtRsrcForkLen,
3943 { "Extended resource fork size", "afp.ext_resource_fork_len",
3944 FT_UINT64, BASE_DEC, NULL, 0x0,
3945 "Extended (>2GB) resource fork length", HFILL }},
3947 { &hf_afp_file_bitmap,
3948 { "File bitmap", "afp.file_bitmap",
3949 FT_UINT16, BASE_HEX, NULL, 0x0,
3950 "File bitmap", HFILL }},
3952 { &hf_afp_req_count,
3953 { "Req count", "afp.req_count",
3954 FT_UINT16, BASE_DEC, NULL, 0x0,
3955 "Maximum number of structures returned", HFILL }},
3957 { &hf_afp_start_index,
3958 { "Start index", "afp.start_index",
3959 FT_UINT16, BASE_DEC, NULL, 0x0,
3960 "First structure returned", HFILL }},
3962 { &hf_afp_max_reply_size,
3963 { "Reply size", "afp.reply_size",
3964 FT_UINT16, BASE_DEC, NULL, 0x0,
3965 "Reply size", HFILL }},
3967 { &hf_afp_start_index32,
3968 { "Start index", "afp.start_index32",
3969 FT_UINT32, BASE_DEC, NULL, 0x0,
3970 "First structure returned", HFILL }},
3972 { &hf_afp_max_reply_size32,
3973 { "Reply size", "afp.reply_size32",
3974 FT_UINT32, BASE_DEC, NULL, 0x0,
3975 "Reply size", HFILL }},
3977 { &hf_afp_file_flag,
3978 { "Dir", "afp.file_flag",
3979 FT_BOOLEAN, 8, NULL, 0x80,
3980 "Is a dir", HFILL }},
3982 { &hf_afp_create_flag,
3983 { "Hard create", "afp.create_flag",
3984 FT_BOOLEAN, 8, NULL, 0x80,
3985 "Soft/hard create file", HFILL }},
3987 { &hf_afp_struct_size,
3988 { "Struct size", "afp.struct_size",
3989 FT_UINT8, BASE_DEC, NULL,0,
3990 "Sizeof of struct", HFILL }},
3992 { &hf_afp_struct_size16,
3993 { "Struct size", "afp.struct_size16",
3994 FT_UINT16, BASE_DEC, NULL,0,
3995 "Sizeof of struct", HFILL }},
3998 { "From", "afp.flag",
3999 FT_UINT8, BASE_HEX, VALS(flag_vals), 0x80,
4000 "Offset is relative to start/end of the fork", HFILL }},
4003 { "DT ref", "afp.dt_ref",
4004 FT_UINT16, BASE_DEC, NULL, 0x0,
4005 "Desktop database reference num", HFILL }},
4008 { "Fork", "afp.ofork",
4009 FT_UINT16, BASE_DEC, NULL, 0x0,
4010 "Open fork reference number", HFILL }},
4013 { "Offset", "afp.offset",
4014 FT_INT32, BASE_DEC, NULL, 0x0,
4018 { "Count", "afp.rw_count",
4019 FT_INT32, BASE_DEC, NULL, 0x0,
4020 "Number of bytes to be read/written", HFILL }},
4022 { &hf_afp_newline_mask,
4023 { "Newline mask", "afp.newline_mask",
4024 FT_UINT8, BASE_HEX, NULL, 0x0,
4025 "Value to AND bytes with when looking for newline", HFILL }},
4027 { &hf_afp_newline_char,
4028 { "Newline char", "afp.newline_char",
4029 FT_UINT8, BASE_HEX, NULL, 0x0,
4030 "Value to compare ANDed bytes with when looking for newline", HFILL }},
4032 { &hf_afp_last_written,
4033 { "Last written", "afp.last_written",
4034 FT_UINT32, BASE_DEC, NULL, 0x0,
4035 "Offset of the last byte written", HFILL }},
4037 { &hf_afp_actual_count,
4038 { "Count", "afp.actual_count",
4039 FT_INT32, BASE_DEC, NULL, 0x0,
4040 "Number of bytes returned by read/write", HFILL }},
4042 { &hf_afp_ofork_len,
4043 { "New length", "afp.ofork_len",
4044 FT_INT32, BASE_DEC, NULL, 0x0,
4045 "New length", HFILL }},
4047 { &hf_afp_path_type,
4048 { "Type", "afp.path_type",
4049 FT_UINT8, BASE_HEX, VALS(path_type_vals), 0,
4050 "Type of names", HFILL }},
4053 { "Len", "afp.path_len",
4054 FT_UINT8, BASE_DEC, NULL, 0x0,
4055 "Path length", HFILL }},
4057 { &hf_afp_path_unicode_len,
4058 { "Len", "afp.path_unicode_len",
4059 FT_UINT16, BASE_DEC, NULL, 0x0,
4060 "Path length (unicode)", HFILL }},
4062 { &hf_afp_path_unicode_hint,
4063 { "Unicode hint", "afp.path_unicode_hint",
4064 FT_UINT32, BASE_HEX, VALS(unicode_hint_vals), 0x0,
4065 "Unicode hint", HFILL }},
4067 { &hf_afp_path_name,
4068 { "Name", "afp.path_name",
4069 FT_STRING, BASE_NONE, NULL, 0x0,
4070 "Path name", HFILL }},
4072 { &hf_afp_fork_type,
4073 { "Resource fork", "afp.fork_type",
4074 FT_BOOLEAN, 8, NULL, 0x80,
4075 "Data/resource fork", HFILL }},
4077 { &hf_afp_access_mode,
4078 { "Access mode", "afp.access",
4079 FT_UINT8, BASE_HEX, NULL, 0x0,
4080 "Fork access mode", HFILL }},
4082 { &hf_afp_access_read,
4083 { "Read", "afp.access.read",
4084 FT_BOOLEAN, 8, NULL, 1,
4085 "Open for reading", HFILL }},
4087 { &hf_afp_access_write,
4088 { "Write", "afp.access.write",
4089 FT_BOOLEAN, 8, NULL, 2,
4090 "Open for writing", HFILL }},
4092 { &hf_afp_access_deny_read,
4093 { "Deny read", "afp.access.deny_read",
4094 FT_BOOLEAN, 8, NULL, 0x10,
4095 "Deny read", HFILL }},
4097 { &hf_afp_access_deny_write,
4098 { "Deny write", "afp.access.deny_write",
4099 FT_BOOLEAN, 8, NULL, 0x20,
4100 "Deny write", HFILL }},
4103 { "Comment", "afp.comment",
4104 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
4105 "File/folder comment", HFILL }},
4107 { &hf_afp_file_creator,
4108 { "File creator", "afp.file_creator",
4109 FT_STRING, BASE_NONE, NULL, 0x0,
4110 "File creator", HFILL }},
4112 { &hf_afp_file_type,
4113 { "File type", "afp.file_type",
4114 FT_STRING, BASE_NONE, NULL, 0x0,
4115 "File type", HFILL }},
4117 { &hf_afp_icon_type,
4118 { "Icon type", "afp.icon_type",
4119 FT_UINT8, BASE_HEX, NULL , 0,
4120 "Icon type", HFILL }},
4122 { &hf_afp_icon_length,
4123 { "Size", "afp.icon_length",
4124 FT_UINT16, BASE_DEC, NULL, 0x0,
4125 "Size for icon bitmap", HFILL }},
4127 { &hf_afp_icon_index,
4128 { "Index", "afp.icon_index",
4129 FT_UINT16, BASE_DEC, NULL, 0x0,
4130 "Icon index in desktop database", HFILL }},
4133 { "Tag", "afp.icon_tag",
4134 FT_UINT32, BASE_HEX, NULL, 0x0,
4135 "Icon tag", HFILL }},
4137 { &hf_afp_appl_index,
4138 { "Index", "afp.appl_index",
4139 FT_UINT16, BASE_DEC, NULL, 0x0,
4140 "Application index", HFILL }},
4143 { "Tag", "afp.appl_tag",
4144 FT_UINT32, BASE_HEX, NULL, 0x0,
4145 "Application tag", HFILL }},
4148 { "unlock", "afp.lock_op",
4149 FT_BOOLEAN, 8, NULL, 0x1,
4150 "Lock/unlock op", HFILL }},
4152 { &hf_afp_lock_from,
4153 { "End", "afp.lock_from",
4154 FT_BOOLEAN, 8, NULL, 0x80,
4155 "Offset is relative to the end of the fork", HFILL }},
4157 { &hf_afp_lock_offset,
4158 { "Offset", "afp.lock_offset",
4159 FT_INT32, BASE_DEC, NULL, 0x0,
4160 "First byte to be locked", HFILL }},
4163 { "Length", "afp.lock_len",
4164 FT_INT32, BASE_DEC, NULL, 0x0,
4165 "Number of bytes to be locked/unlocked", HFILL }},
4167 { &hf_afp_lock_range_start,
4168 { "Start", "afp.lock_range_start",
4169 FT_INT32, BASE_DEC, NULL, 0x0,
4170 "First byte locked/unlocked", HFILL }},
4173 { "Access rights", "afp.dir_ar",
4174 FT_UINT32, BASE_HEX, NULL, 0x0,
4175 "Directory access rights", HFILL }},
4177 { &hf_afp_dir_ar_o_search,
4178 { "Owner has search access", "afp.dir_ar.o_search",
4179 FT_BOOLEAN, 32, NULL, AR_O_SEARCH,
4180 "Owner has search access", HFILL }},
4182 { &hf_afp_dir_ar_o_read,
4183 { "Owner has read access", "afp.dir_ar.o_read",
4184 FT_BOOLEAN, 32, NULL, AR_O_READ,
4185 "Owner has read access", HFILL }},
4187 { &hf_afp_dir_ar_o_write,
4188 { "Owner has write access", "afp.dir_ar.o_write",
4189 FT_BOOLEAN, 32, NULL, AR_O_WRITE,
4190 "Gwner has write access", HFILL }},
4192 { &hf_afp_dir_ar_g_search,
4193 { "Group has search access", "afp.dir_ar.g_search",
4194 FT_BOOLEAN, 32, NULL, AR_G_SEARCH,
4195 "Group has search access", HFILL }},
4197 { &hf_afp_dir_ar_g_read,
4198 { "Group has read access", "afp.dir_ar.g_read",
4199 FT_BOOLEAN, 32, NULL, AR_G_READ,
4200 "Group has read access", HFILL }},
4202 { &hf_afp_dir_ar_g_write,
4203 { "Group has write access", "afp.dir_ar.g_write",
4204 FT_BOOLEAN, 32, NULL, AR_G_WRITE,
4205 "Group has write access", HFILL }},
4207 { &hf_afp_dir_ar_e_search,
4208 { "Everyone has search access", "afp.dir_ar.e_search",
4209 FT_BOOLEAN, 32, NULL, AR_E_SEARCH,
4210 "Everyone has search access", HFILL }},
4212 { &hf_afp_dir_ar_e_read,
4213 { "Everyone has read access", "afp.dir_ar.e_read",
4214 FT_BOOLEAN, 32, NULL, AR_E_READ,
4215 "Everyone has read access", HFILL }},
4217 { &hf_afp_dir_ar_e_write,
4218 { "Everyone has write access", "afp.dir_ar.e_write",
4219 FT_BOOLEAN, 32, NULL, AR_E_WRITE,
4220 "Everyone has write access", HFILL }},
4222 { &hf_afp_dir_ar_u_search,
4223 { "User has search access", "afp.dir_ar.u_search",
4224 FT_BOOLEAN, 32, NULL, AR_U_SEARCH,
4225 "User has search access", HFILL }},
4227 { &hf_afp_dir_ar_u_read,
4228 { "User has read access", "afp.dir_ar.u_read",
4229 FT_BOOLEAN, 32, NULL, AR_U_READ,
4230 "User has read access", HFILL }},
4232 { &hf_afp_dir_ar_u_write,
4233 { "User has write access", "afp.dir_ar.u_write",
4234 FT_BOOLEAN, 32, NULL, AR_U_WRITE,
4235 "User has write access", HFILL }},
4237 { &hf_afp_dir_ar_blank,
4238 { "Blank access right", "afp.dir_ar.blank",
4239 FT_BOOLEAN, 32, NULL, AR_BLANK,
4240 "Blank access right", HFILL }},
4242 { &hf_afp_dir_ar_u_own,
4243 { "User is the owner", "afp.dir_ar.u_owner",
4244 FT_BOOLEAN, 32, NULL, AR_U_OWN,
4245 "Current user is the directory owner", HFILL }},
4247 { &hf_afp_server_time,
4248 { "Server time", "afp.server_time",
4249 FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x0,
4250 "Server time", HFILL }},
4252 { &hf_afp_cat_req_matches,
4253 { "Max answers", "afp.cat_req_matches",
4254 FT_INT32, BASE_DEC, NULL, 0x0,
4255 "Maximum number of matches to return.", HFILL }},
4258 { "Reserved", "afp.reserved",
4259 FT_BYTES, BASE_HEX, NULL, 0x0,
4260 "Reserved", HFILL }},
4262 { &hf_afp_cat_count,
4263 { "Cat count", "afp.cat_count",
4264 FT_UINT32, BASE_DEC, NULL, 0x0,
4265 "Number of structures returned", HFILL }},
4267 { &hf_afp_cat_position,
4268 { "Position", "afp.cat_position",
4269 FT_BYTES, BASE_HEX, NULL, 0x0,
4270 "Reserved", HFILL }},
4273 { &hf_afp_map_name_type,
4274 { "Type", "afp.map_name_type",
4275 FT_UINT8, BASE_DEC, VALS(map_name_type_vals), 0x0,
4276 "Map name type", HFILL }},
4278 { &hf_afp_map_id_type,
4279 { "Type", "afp.map_id_type",
4280 FT_UINT8, BASE_DEC, VALS(map_id_type_vals), 0x0,
4281 "Map ID type", HFILL }},
4284 { "ID", "afp.map_id",
4285 FT_UINT32, BASE_DEC, NULL, 0x0,
4286 "User/Group ID", HFILL }},
4289 { "Name", "afp.map_name",
4290 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
4291 "User/Group name", HFILL }},
4294 { &hf_afp_lock_offset64,
4295 { "Offset", "afp.lock_offset64",
4296 FT_INT64, BASE_DEC, NULL, 0x0,
4297 "First byte to be locked (64 bits)", HFILL }},
4299 { &hf_afp_lock_len64,
4300 { "Length", "afp.lock_len64",
4301 FT_INT64, BASE_DEC, NULL, 0x0,
4302 "Number of bytes to be locked/unlocked (64 bits)", HFILL }},
4304 { &hf_afp_lock_range_start64,
4305 { "Start", "afp.lock_range_start64",
4306 FT_INT64, BASE_DEC, NULL, 0x0,
4307 "First byte locked/unlocked (64 bits)", HFILL }},
4310 { "Offset", "afp.offset64",
4311 FT_INT64, BASE_DEC, NULL, 0x0,
4312 "Offset (64 bits)", HFILL }},
4314 { &hf_afp_rw_count64,
4315 { "Count", "afp.rw_count64",
4316 FT_INT64, BASE_DEC, NULL, 0x0,
4317 "Number of bytes to be read/written (64 bits)", HFILL }},
4319 { &hf_afp_last_written64,
4320 { "Last written", "afp.last_written64",
4321 FT_UINT64, BASE_DEC, NULL, 0x0,
4322 "Offset of the last byte written (64 bits)", HFILL }},
4324 { &hf_afp_session_token_type,
4325 { "Type", "afp.session_token_type",
4326 FT_UINT16, BASE_HEX, NULL, 0x0,
4327 "Session token type", HFILL }},
4329 { &hf_afp_session_token_len,
4330 { "Len", "afp.session_token_len",
4331 FT_UINT32, BASE_DEC, NULL, 0x0,
4332 "Session token length", HFILL }},
4334 { &hf_afp_session_token,
4335 { "Token", "afp.session_token",
4336 FT_BYTES, BASE_HEX, NULL, 0x0,
4337 "Session token", HFILL }},
4339 { &hf_afp_user_flag,
4340 { "Flag", "afp.user_flag",
4341 FT_UINT8, BASE_HEX, VALS(user_flag_vals), 0x01,
4342 "User Info flag", HFILL }},
4345 { "User ID", "afp.user_ID",
4346 FT_UINT32, BASE_DEC, NULL, 0x0,
4347 "User ID", HFILL }},
4350 { "Group ID", "afp.group_ID",
4351 FT_UINT32, BASE_DEC, NULL, 0x0,
4352 "Group ID", HFILL }},
4354 { &hf_afp_user_bitmap,
4355 { "Bitmap", "afp.user_bitmap",
4356 FT_UINT16, BASE_HEX, NULL, 0,
4357 "User Info bitmap", HFILL }},
4359 { &hf_afp_user_bitmap_UID,
4360 { "User ID", "afp.user_bitmap.UID",
4361 FT_BOOLEAN, 16, NULL, 0x01,
4362 "User ID", HFILL }},
4364 { &hf_afp_user_bitmap_GID,
4365 { "Primary group ID", "afp.user_bitmap.GID",
4366 FT_BOOLEAN, 16, NULL, 0x02,
4367 "Primary group ID", HFILL }},
4370 static gint *ett[] = {
4372 &ett_afp_server_vol,
4375 &ett_afp_vol_bitmap,
4376 &ett_afp_vol_attribute,
4377 &ett_afp_dir_bitmap,
4378 &ett_afp_file_bitmap,
4379 &ett_afp_unix_privs,
4381 &ett_afp_enumerate_line,
4382 &ett_afp_access_mode,
4383 &ett_afp_dir_attribute,
4384 &ett_afp_file_attribute,
4386 &ett_afp_lock_flags,
4388 &ett_afp_cat_search,
4389 &ett_afp_cat_r_bitmap,
4392 &ett_afp_user_bitmap,
4395 proto_afp = proto_register_protocol("AppleTalk Filing Protocol", "AFP", "afp");
4396 proto_register_field_array(proto_afp, hf, array_length(hf));
4397 proto_register_subtree_array(ett, array_length(ett));
4399 register_init_routine( &afp_reinit);
4401 register_dissector("afp", dissect_afp, proto_afp);
4402 data_handle = find_dissector("data");
4406 proto_reg_handoff_afp(void)
4408 data_handle = find_dissector("data");
4411 /* -------------------------------