2 * Routines for afp packet dissection
3 * Copyright 2002, Didier Gautheron <dgautheron@magic.fr>
5 * $Id: packet-afp.c,v 1.28 2003/02/12 21:50:31 guy Exp $
7 * Ethereal - Network traffic analyzer
8 * By Gerald Combs <gerald@ethereal.com>
9 * Copyright 1998 Gerald Combs
11 * Copied from README.developer
12 * Copied from packet-dsi.c
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 #ifdef NEED_SNPRINTF_H
36 # include "snprintf.h"
41 #include <epan/packet.h>
42 #include <epan/strutil.h>
43 #include <epan/conversation.h>
45 #include "packet-afp.h"
47 /* The information in this module (AFP) comes from:
49 AFP 2.1 & 2.2.pdf contained in AppleShare_IP_6.3_SDK
50 available from http://www.apple.com
52 AFP3.0.pdf from http://www.apple.com
53 AFP3.1.pdf from http://www.apple.com
55 The netatalk source code by Wesley Craig & Adrian Sun
56 http://netatalk.sf.net
58 /* from netatalk/include/afp.h */
59 #define AFPTRANS_NONE 0
60 #define AFPTRANS_DDP (1 << 0)
61 #define AFPTRANS_TCP (1 << 1)
62 #define AFPTRANS_ALL (AFPTRANS_DDP | AFPTRANS_TCP)
64 /* AFP Attention Codes -- 4 bits */
65 #define AFPATTN_SHUTDOWN (1 << 15) /* shutdown/disconnect */
66 #define AFPATTN_CRASH (1 << 14) /* server crashed */
67 #define AFPATTN_MESG (1 << 13) /* server has message */
68 #define AFPATTN_NORECONNECT (1 << 12) /* don't reconnect */
69 /* server notification */
70 #define AFPATTN_NOTIFY (AFPATTN_MESG | AFPATTN_NORECONNECT)
72 /* extended bitmap -- 12 bits. volchanged is only useful w/ a server
73 * notification, and time is only useful for shutdown. */
74 #define AFPATTN_VOLCHANGED (1 << 0) /* volume has changed */
75 #define AFPATTN_TIME(x) ((x) & 0xfff) /* time in minutes */
78 #define AFP_BYTELOCK 1
79 #define AFP_CLOSEVOL 2
80 #define AFP_CLOSEDIR 3
81 #define AFP_CLOSEFORK 4
82 #define AFP_COPYFILE 5
83 #define AFP_CREATEDIR 6
84 #define AFP_CREATEFILE 7
86 #define AFP_ENUMERATE 9
88 #define AFP_FLUSHFORK 11
89 #define AFP_GETFORKPARAM 14
90 #define AFP_GETSRVINFO 15
91 #define AFP_GETSRVPARAM 16
92 #define AFP_GETVOLPARAM 17
94 #define AFP_LOGINCONT 19
97 #define AFP_MAPNAME 22
99 #define AFP_OPENVOL 24
100 #define AFP_OPENDIR 25
101 #define AFP_OPENFORK 26
103 #define AFP_RENAME 28
104 #define AFP_SETDIRPARAM 29
105 #define AFP_SETFILEPARAM 30
106 #define AFP_SETFORKPARAM 31
107 #define AFP_SETVOLPARAM 32
109 #define AFP_GETFLDRPARAM 34
110 #define AFP_SETFLDRPARAM 35
111 #define AFP_CHANGEPW 36
112 #define AFP_GETUSERINFO 37
113 #define AFP_GETSRVRMSG 38
114 #define AFP_CREATEID 39
115 #define AFP_DELETEID 40
116 #define AFP_RESOLVEID 41
117 #define AFP_EXCHANGEFILE 42
118 #define AFP_CATSEARCH 43
119 #define AFP_OPENDT 48
120 #define AFP_CLOSEDT 49
121 #define AFP_GETICON 51
122 #define AFP_GTICNINFO 52
123 #define AFP_ADDAPPL 53
124 #define AFP_RMVAPPL 54
125 #define AFP_GETAPPL 55
126 #define AFP_ADDCMT 56
127 #define AFP_RMVCMT 57
128 #define AFP_GETCMT 58
129 #define AFP_ADDICON 192
131 /* AFP 3.0 new calls */
132 #define AFP_BYTELOCK_EXT 59
133 #define AFP_CATSEARCH_EXT 67
134 #define AFP_ENUMERATE_EXT 66
135 #define AFP_READ_EXT 60
136 #define AFP_WRITE_EXT 61
137 #define AFP_LOGIN_EXT 63
138 #define AFP_GETSESSTOKEN 64
139 #define AFP_DISCTOLDSESS 65
141 /* AFP 3.1 new calls */
142 #define AFP_ENUMERATE_EXT2 68
144 /* ----------------------------- */
145 static int proto_afp = -1;
146 static int hf_afp_reserved = -1;
148 static int hf_afp_command = -1; /* CommandCode */
149 static int hf_afp_AFPVersion = -1;
150 static int hf_afp_UAM = -1;
151 static int hf_afp_user = -1;
152 static int hf_afp_passwd = -1;
153 static int hf_afp_random = -1;
155 static int hf_afp_login_flags = -1;
156 static int hf_afp_pad = -1;
158 static int hf_afp_user_type = -1;
159 static int hf_afp_user_len = -1;
160 static int hf_afp_user_name = -1;
162 static int hf_afp_vol_flag_passwd = -1;
163 static int hf_afp_vol_flag_unix_priv = -1;
164 static int hf_afp_server_time = -1;
166 static int hf_afp_vol_bitmap = -1;
167 static int hf_afp_vol_name_offset = -1;
168 static int hf_afp_vol_id = -1;
169 static int hf_afp_vol_attribute = -1;
170 static int hf_afp_vol_name = -1;
171 static int hf_afp_vol_signature = -1;
172 static int hf_afp_vol_creation_date = -1;
173 static int hf_afp_vol_modification_date = -1;
174 static int hf_afp_vol_backup_date = -1;
175 static int hf_afp_vol_bytes_free = -1;
176 static int hf_afp_vol_bytes_total = -1;
177 static int hf_afp_vol_ex_bytes_free = -1;
178 static int hf_afp_vol_ex_bytes_total = -1;
179 static int hf_afp_vol_block_size = -1;
182 static int hf_afp_comment = -1;
183 static int hf_afp_file_creator = -1;
184 static int hf_afp_file_type = -1;
185 static int hf_afp_icon_type = -1;
186 static int hf_afp_icon_length = -1;
187 static int hf_afp_icon_tag = -1;
188 static int hf_afp_icon_index = -1;
189 static int hf_afp_appl_index = -1;
190 static int hf_afp_appl_tag = -1;
192 static int hf_afp_did = -1;
193 static int hf_afp_file_id = -1;
194 static int hf_afp_file_DataForkLen = -1;
195 static int hf_afp_file_RsrcForkLen = -1;
196 static int hf_afp_file_ExtDataForkLen = -1;
197 static int hf_afp_file_ExtRsrcForkLen = -1;
199 static int hf_afp_dir_bitmap = -1;
200 static int hf_afp_dir_offspring = -1;
201 static int hf_afp_dir_OwnerID = -1;
202 static int hf_afp_dir_GroupID = -1;
204 static int hf_afp_file_bitmap = -1;
205 static int hf_afp_req_count = -1;
206 static int hf_afp_start_index = -1;
207 static int hf_afp_start_index32 = -1;
208 static int hf_afp_max_reply_size = -1;
209 static int hf_afp_max_reply_size32 = -1;
210 static int hf_afp_file_flag = -1;
211 static int hf_afp_create_flag = -1;
212 static int hf_afp_struct_size = -1;
213 static int hf_afp_struct_size16 = -1;
215 static int hf_afp_cat_count = -1;
216 static int hf_afp_cat_req_matches = -1;
217 static int hf_afp_cat_position = -1;
219 static int hf_afp_creation_date = -1;
220 static int hf_afp_modification_date = -1;
221 static int hf_afp_backup_date = -1;
222 static int hf_afp_finder_info = -1;
223 static int hf_afp_long_name_offset = -1;
224 static int hf_afp_short_name_offset = -1;
225 static int hf_afp_unicode_name_offset = -1;
226 static int hf_afp_unix_privs_uid = -1;
227 static int hf_afp_unix_privs_gid = -1;
228 static int hf_afp_unix_privs_permissions = -1;
229 static int hf_afp_unix_privs_ua_permissions = -1;
231 static int hf_afp_path_type = -1;
232 static int hf_afp_path_len = -1;
233 static int hf_afp_path_name = -1;
234 static int hf_afp_path_unicode_hint = -1;
235 static int hf_afp_path_unicode_len = -1;
237 static int hf_afp_flag = -1;
238 static int hf_afp_dt_ref = -1;
239 static int hf_afp_ofork = -1;
240 static int hf_afp_ofork_len = -1;
241 static int hf_afp_offset = -1;
242 static int hf_afp_rw_count = -1;
243 static int hf_afp_newline_mask = -1;
244 static int hf_afp_newline_char = -1;
245 static int hf_afp_last_written = -1;
246 static int hf_afp_actual_count = -1;
248 static int hf_afp_fork_type = -1;
249 static int hf_afp_access_mode = -1;
250 static int hf_afp_access_read = -1;
251 static int hf_afp_access_write = -1;
252 static int hf_afp_access_deny_read = -1;
253 static int hf_afp_access_deny_write = -1;
255 static gint hf_afp_lock_op = -1;
256 static gint hf_afp_lock_from = -1;
257 static gint hf_afp_lock_offset = -1;
258 static gint hf_afp_lock_len = -1;
259 static gint hf_afp_lock_range_start = -1;
261 static gint ett_afp = -1;
263 static gint ett_afp_vol_attribute = -1;
264 static gint ett_afp_enumerate = -1;
265 static gint ett_afp_enumerate_line = -1;
266 static gint ett_afp_access_mode = -1;
268 static gint ett_afp_vol_bitmap = -1;
269 static gint ett_afp_dir_bitmap = -1;
270 static gint ett_afp_dir_attribute = -1;
271 static gint ett_afp_file_attribute = -1;
272 static gint ett_afp_file_bitmap = -1;
273 static gint ett_afp_unix_privs = -1;
274 static gint ett_afp_path_name = -1;
275 static gint ett_afp_lock_flags = -1;
276 static gint ett_afp_dir_ar = -1;
278 static gint ett_afp_server_vol = -1;
279 static gint ett_afp_vol_list = -1;
280 static gint ett_afp_vol_flag = -1;
281 static gint ett_afp_cat_search = -1;
282 static gint ett_afp_cat_r_bitmap = -1;
283 static gint ett_afp_cat_spec = -1;
284 static gint ett_afp_vol_did = -1;
286 /* AFP 3.0 parameters */
287 static gint hf_afp_lock_offset64 = -1;
288 static gint hf_afp_lock_len64 = -1;
289 static gint hf_afp_lock_range_start64 = -1;
291 static int hf_afp_offset64 = -1;
292 static int hf_afp_rw_count64 = -1;
294 static int hf_afp_last_written64 = -1;
296 static int hf_afp_ofork_len64 = -1;
297 static int hf_afp_session_token_type = -1;
298 static int hf_afp_session_token_len = -1;
299 static int hf_afp_session_token = -1;
301 static dissector_handle_t data_handle;
303 static const value_string vol_signature_vals[] = {
305 {2, "Fixed Directory ID"},
306 {3, "Variable Directory ID (deprecated)"},
310 static const value_string CommandCode_vals[] = {
311 {AFP_BYTELOCK, "FPByteRangeLock" },
312 {AFP_CLOSEVOL, "FPCloseVol" },
313 {AFP_CLOSEDIR, "FPCloseDir" },
314 {AFP_CLOSEFORK, "FPCloseFork" },
315 {AFP_COPYFILE, "FPCopyFile" },
316 {AFP_CREATEDIR, "FPCreateDir" },
317 {AFP_CREATEFILE, "FPCreateFile" },
318 {AFP_DELETE, "FPDelete" },
319 {AFP_ENUMERATE, "FPEnumerate" },
320 {AFP_FLUSH, "FPFlush" },
321 {AFP_FLUSHFORK, "FPFlushFork" },
322 {AFP_GETFORKPARAM, "FPGetForkParms" },
323 {AFP_GETSRVINFO, "FPGetSrvrInfo" },
324 {AFP_GETSRVPARAM, "FPGetSrvrParms" },
325 {AFP_GETVOLPARAM, "FPGetVolParms" },
326 {AFP_LOGIN, "FPLogin" },
327 {AFP_LOGINCONT, "FPLoginCont" },
328 {AFP_LOGOUT, "FPLogout" },
329 {AFP_MAPID, "FPMapID" },
330 {AFP_MAPNAME, "FPMapName" },
331 {AFP_MOVE, "FPMoveAndRename" },
332 {AFP_OPENVOL, "FPOpenVol" },
333 {AFP_OPENDIR, "FPOpenDir" },
334 {AFP_OPENFORK, "FPOpenFork" },
335 {AFP_READ, "FPRead" },
336 {AFP_RENAME, "FPRename" },
337 {AFP_SETDIRPARAM, "FPSetDirParms" },
338 {AFP_SETFILEPARAM, "FPSetFileParms" },
339 {AFP_SETFORKPARAM, "FPSetForkParms" },
340 {AFP_SETVOLPARAM, "FPSetVolParms" },
341 {AFP_WRITE, "FPWrite" },
342 {AFP_GETFLDRPARAM, "FPGetFileDirParms" },
343 {AFP_SETFLDRPARAM, "FPSetFileDirParms" },
344 {AFP_CHANGEPW, "FPChangePassword" },
345 {AFP_GETUSERINFO, "FPGetUserInfo" },
346 {AFP_GETSRVRMSG, "FPGetSrvrMsg" },
347 {AFP_CREATEID, "FPCreateID" },
348 {AFP_DELETEID, "FPDeleteID" },
349 {AFP_RESOLVEID, "FPResolveID" },
350 {AFP_EXCHANGEFILE, "FPExchangeFiles" },
351 {AFP_CATSEARCH, "FPCatSearch" },
352 {AFP_OPENDT, "FPOpenDT" },
353 {AFP_CLOSEDT, "FPCloseDT" },
354 {AFP_GETICON, "FPGetIcon" },
355 {AFP_GTICNINFO, "FPGetIconInfo" },
356 {AFP_ADDAPPL, "FPAddAPPL" },
357 {AFP_RMVAPPL, "FPRemoveAPPL" },
358 {AFP_GETAPPL, "FPGetAPPL" },
359 {AFP_ADDCMT, "FPAddComment" },
360 {AFP_RMVCMT, "FPRemoveComment" },
361 {AFP_GETCMT, "FPGetComment" },
362 {AFP_BYTELOCK_EXT, "FPByteRangeLockExt" },
363 {AFP_CATSEARCH_EXT, "FPCatSearchExt" },
364 {AFP_ENUMERATE_EXT, "FPEnumerateExt" },
365 {AFP_ENUMERATE_EXT2, "FPEnumerateExt2" },
366 {AFP_READ_EXT, "FPReadExt" },
367 {AFP_WRITE_EXT, "FPWriteExt" },
368 {AFP_LOGIN_EXT, "FPLoginExt" },
369 {AFP_GETSESSTOKEN, "FPGetSessionToken" },
370 {AFP_DISCTOLDSESS, "FPDisconnectOldSession" },
371 {AFP_ADDICON, "FPAddIcon" },
375 static const value_string unicode_hint_vals[] = {
377 { 1, "MacJapanese" },
378 { 2, "MacChineseTrad" },
383 { 7, "MacCyrillic" },
384 { 9, "MacDevanagari" },
385 { 10, "MacGurmukhi" },
386 { 11, "MacGujarati" },
388 { 13, "MacBengali" },
391 { 16, "MacKannada" },
392 { 17, "MacMalayalam" },
393 { 18, "MacSinhalese" },
394 { 19, "MacBurmese" },
397 { 22, "MacLaotian" },
398 { 23, "MacGeorgian" },
399 { 24, "MacArmenian" },
400 { 25, "MacChineseSimp" },
401 { 26, "MacTibetan" },
402 { 27, "MacMongolian" },
403 { 28, "MacEthiopic" },
404 { 29, "MacCentralEurRoman" },
405 { 30, "MacVietnamese" },
406 { 31, "MacExtArabic" },
408 { 34, "MacDingbats" },
409 { 35, "MacTurkish" },
410 { 36, "MacCroatian" },
411 { 37, "MacIcelandic" },
412 { 38, "MacRomanian" },
415 { 41, "MacKeyboardGlyphs" },
416 { 126, "MacUnicode" },
418 { 152, "MacUkrainian" },
422 { 256, "UnicodeDefault" },
423 /* { 257, "UnicodeV1_1" }, */
424 { 257, "ISO10646_1993" },
425 { 259, "UnicodeV2_0" },
426 { 259, "UnicodeV2_1" },
427 { 260, "UnicodeV3_0" },
428 { 513, "ISOLatin1" },
429 { 514, "ISOLatin2" },
430 { 515, "ISOLatin3" },
431 { 516, "ISOLatin4" },
432 { 517, "ISOLatinCyrillic" },
433 { 518, "ISOLatinArabic" },
434 { 519, "ISOLatinGreek" },
435 { 520, "ISOLatinHebrew" },
436 { 521, "ISOLatin5" },
437 { 522, "ISOLatin6" },
438 { 525, "ISOLatin7" },
439 { 526, "ISOLatin8" },
440 { 527, "ISOLatin9" },
441 { 1024, "DOSLatinUS" },
442 { 1029, "DOSGreek" },
443 { 1030, "DOSBalticRim" },
444 { 1040, "DOSLatin1" },
445 { 1041, "DOSGreek1" },
446 { 1042, "DOSLatin2" },
447 { 1043, "DOSCyrillic" },
448 { 1044, "DOSTurkish" },
449 { 1045, "DOSPortuguese" },
450 { 1046, "DOSIcelandic" },
451 { 1047, "DOSHebrew" },
452 { 1048, "DOSCanadianFrench" },
453 { 1049, "DOSArabic" },
454 { 1050, "DOSNordic" },
455 { 1051, "DOSRussian" },
456 { 1052, "DOSGreek2" },
458 { 1056, "DOSJapanese" },
459 { 1057, "DOSChineseSimplif" },
460 { 1058, "DOSKorean" },
461 { 1059, "DOSChineseTrad" },
462 { 1280, "WindowsLatin1" },
463 /* { 1280, "WindowsANSI" }, */
464 { 1281, "WindowsLatin2" },
465 { 1282, "WindowsCyrillic" },
466 { 1283, "WindowsGreek" },
467 { 1284, "WindowsLatin5" },
468 { 1285, "WindowsHebrew" },
469 { 1286, "WindowsArabic" },
470 { 1287, "WindowsBalticRim" },
471 { 1288, "WindowsVietnamese" },
472 { 1296, "WindowsKoreanJohab" },
473 { 1536, "US_ASCII" },
474 { 1568, "JIS_X0201_76" },
475 { 1569, "JIS_X0208_83" },
476 { 1570, "JIS_X0208_90" },
481 from Apple AFP3.0.pdf
484 #define kFPVolAttributeBit (1 << 0)
485 #define kFPVolSignatureBit (1 << 1)
486 #define kFPVolCreateDateBit (1 << 2)
487 #define kFPVolModDateBit (1 << 3)
488 #define kFPVolBackupDateBit (1 << 4)
489 #define kFPVolIDBit (1 << 5)
490 #define kFPVolBytesFreeBit (1 << 6)
491 #define kFPVolBytesTotalBit (1 << 7)
492 #define kFPVolNameBit (1 << 8)
493 #define kFPVolExtBytesFreeBit (1 << 9)
494 #define kFPVolExtBytesTotalBit (1 << 10)
495 #define kFPVolBlockSizeBit (1 << 11)
497 static int hf_afp_vol_bitmap_Attributes = -1;
498 static int hf_afp_vol_bitmap_Signature = -1;
499 static int hf_afp_vol_bitmap_CreateDate = -1;
500 static int hf_afp_vol_bitmap_ModDate = -1;
501 static int hf_afp_vol_bitmap_BackupDate = -1;
502 static int hf_afp_vol_bitmap_ID = -1;
503 static int hf_afp_vol_bitmap_BytesFree = -1;
504 static int hf_afp_vol_bitmap_BytesTotal = -1;
505 static int hf_afp_vol_bitmap_Name = -1;
506 static int hf_afp_vol_bitmap_ExtBytesFree = -1;
507 static int hf_afp_vol_bitmap_ExtBytesTotal = -1;
508 static int hf_afp_vol_bitmap_BlockSize = -1;
510 static int hf_afp_vol_attribute_ReadOnly = -1;
511 static int hf_afp_vol_attribute_HasVolumePassword = -1;
512 static int hf_afp_vol_attribute_SupportsFileIDs = -1;
513 static int hf_afp_vol_attribute_SupportsCatSearch = -1;
514 static int hf_afp_vol_attribute_SupportsBlankAccessPrivs = -1;
515 static int hf_afp_vol_attribute_SupportsUnixPrivs = -1;
516 static int hf_afp_vol_attribute_SupportsUTF8Names = -1;
518 static int hf_afp_dir_bitmap_Attributes = -1;
519 static int hf_afp_dir_bitmap_ParentDirID = -1;
520 static int hf_afp_dir_bitmap_CreateDate = -1;
521 static int hf_afp_dir_bitmap_ModDate = -1;
522 static int hf_afp_dir_bitmap_BackupDate = -1;
523 static int hf_afp_dir_bitmap_FinderInfo = -1;
524 static int hf_afp_dir_bitmap_LongName = -1;
525 static int hf_afp_dir_bitmap_ShortName = -1;
526 static int hf_afp_dir_bitmap_NodeID = -1;
527 static int hf_afp_dir_bitmap_OffspringCount = -1;
528 static int hf_afp_dir_bitmap_OwnerID = -1;
529 static int hf_afp_dir_bitmap_GroupID = -1;
530 static int hf_afp_dir_bitmap_AccessRights = -1;
531 static int hf_afp_dir_bitmap_UTF8Name = -1;
532 static int hf_afp_dir_bitmap_UnixPrivs = -1;
534 static int hf_afp_dir_attribute_Invisible = -1;
535 static int hf_afp_dir_attribute_IsExpFolder = -1;
537 static int hf_afp_dir_attribute_System = -1;
538 static int hf_afp_dir_attribute_Mounted = -1;
539 static int hf_afp_dir_attribute_InExpFolder = -1;
541 static int hf_afp_dir_attribute_BackUpNeeded = -1;
542 static int hf_afp_dir_attribute_RenameInhibit = -1;
543 static int hf_afp_dir_attribute_DeleteInhibit = -1;
544 static int hf_afp_dir_attribute_SetClear = -1;
546 static int hf_afp_file_bitmap_Attributes = -1;
547 static int hf_afp_file_bitmap_ParentDirID = -1;
548 static int hf_afp_file_bitmap_CreateDate = -1;
549 static int hf_afp_file_bitmap_ModDate = -1;
550 static int hf_afp_file_bitmap_BackupDate = -1;
551 static int hf_afp_file_bitmap_FinderInfo = -1;
552 static int hf_afp_file_bitmap_LongName = -1;
553 static int hf_afp_file_bitmap_ShortName = -1;
554 static int hf_afp_file_bitmap_NodeID = -1;
555 static int hf_afp_file_bitmap_DataForkLen = -1;
556 static int hf_afp_file_bitmap_RsrcForkLen = -1;
557 static int hf_afp_file_bitmap_ExtDataForkLen = -1;
558 static int hf_afp_file_bitmap_LaunchLimit = -1;
560 static int hf_afp_file_bitmap_UTF8Name = -1;
561 static int hf_afp_file_bitmap_ExtRsrcForkLen = -1;
562 static int hf_afp_file_bitmap_UnixPrivs = -1;
564 static int hf_afp_file_attribute_Invisible = -1;
565 static int hf_afp_file_attribute_MultiUser = -1;
566 static int hf_afp_file_attribute_System = -1;
567 static int hf_afp_file_attribute_DAlreadyOpen = -1;
568 static int hf_afp_file_attribute_RAlreadyOpen = -1;
569 static int hf_afp_file_attribute_WriteInhibit = -1;
570 static int hf_afp_file_attribute_BackUpNeeded = -1;
571 static int hf_afp_file_attribute_RenameInhibit = -1;
572 static int hf_afp_file_attribute_DeleteInhibit = -1;
573 static int hf_afp_file_attribute_CopyProtect = -1;
574 static int hf_afp_file_attribute_SetClear = -1;
576 static int hf_afp_map_name_type = -1;
577 static int hf_afp_map_name = -1;
578 static int hf_afp_map_id = -1;
579 static int hf_afp_map_id_type = -1;
581 static const value_string vol_bitmap_vals[] = {
582 {kFPVolAttributeBit, "VolAttribute"},
583 {kFPVolSignatureBit, "VolSignature"},
584 {kFPVolCreateDateBit, "VolCreateDate"},
585 {kFPVolModDateBit, "VolModDate"},
586 {kFPVolBackupDateBit, "VolBackupDate"},
587 {kFPVolIDBit, "VolID"},
588 {kFPVolBytesFreeBit, "VolBytesFree"},
589 {kFPVolBytesTotalBit, "VolBytesTotal"},
590 {kFPVolNameBit, "VolNameBit"},
591 {kFPVolExtBytesFreeBit, "VolExtBytesFree"},
592 {kFPVolExtBytesTotalBit, "VolExtBytesTotal"},
593 {kFPVolBlockSizeBit, "VolBlockSize"},
596 static const value_string flag_vals[] = {
601 static const value_string path_type_vals[] = {
604 {3, "Unicode names" },
607 static const value_string map_name_type_vals[] = {
608 {1, "Unicode user name to a user ID" },
609 {2, "Unicode group name to a group ID" },
610 {3, "Macintosh roman user name to a user ID" },
611 {4, "Macintosh roman group name to a group ID" },
614 static const value_string map_id_type_vals[] = {
615 {1, "User ID to a Macintosh roman user name" },
616 {2, "Group ID to a Macintosh roman group name" },
617 {3, "User ID to a unicode user name" },
618 {4, "Group ID to a unicode group name" },
622 volume attribute from Apple AFP3.0.pdf
625 #define kReadOnly (1 << 0)
626 #define kHasVolumePassword (1 << 1)
627 #define kSupportsFileIDs (1 << 2)
628 #define kSupportsCatSearch (1 << 3)
629 #define kSupportsBlankAccessPrivs (1 << 4)
630 #define kSupportsUnixPrivs (1 << 5)
631 #define kSupportsUTF8Names (1 << 6)
633 #define kNoNetworkUserIDs (1 << 7)
636 directory bitmap from Apple AFP3.0.pdf
639 #define kFPAttributeBit (1 << 0)
640 #define kFPParentDirIDBit (1 << 1)
641 #define kFPCreateDateBit (1 << 2)
642 #define kFPModDateBit (1 << 3)
643 #define kFPBackupDateBit (1 << 4)
644 #define kFPFinderInfoBit (1 << 5)
645 #define kFPLongNameBit (1 << 6)
646 #define kFPShortNameBit (1 << 7)
647 #define kFPNodeIDBit (1 << 8)
648 #define kFPOffspringCountBit (1 << 9)
649 #define kFPOwnerIDBit (1 << 10)
650 #define kFPGroupIDBit (1 << 11)
651 #define kFPAccessRightsBit (1 << 12)
652 #define kFPUTF8NameBit (1 << 13)
653 #define kFPUnixPrivsBit (1 << 14)
656 directory Access Rights parameter AFP3.0.pdf
660 #define AR_O_SEARCH (1 << 0) /* owner has search access */
661 #define AR_O_READ (1 << 1) /* owner has read access */
662 #define AR_O_WRITE (1 << 2) /* owner has write access */
664 #define AR_G_SEARCH (1 << 8) /* group has search access */
665 #define AR_G_READ (1 << 9) /* group has read access */
666 #define AR_G_WRITE (1 << 10) /* group has write access */
668 #define AR_E_SEARCH (1 << 16) /* everyone has search access */
669 #define AR_E_READ (1 << 17) /* everyone has read access */
670 #define AR_E_WRITE (1 << 18) /* everyone has write access */
672 #define AR_U_SEARCH (1 << 24) /* user has search access */
673 #define AR_U_READ (1 << 25) /* user has read access */
674 #define AR_U_WRITE (1 << 26) /* user has write access */
676 #define AR_BLANK (1 << 28) /* Blank Access Privileges (use parent dir privileges) */
677 #define AR_U_OWN (1 << 31) /* user is the owner */
679 static int hf_afp_dir_ar = -1;
680 static int hf_afp_dir_ar_o_search = -1;
681 static int hf_afp_dir_ar_o_read = -1;
682 static int hf_afp_dir_ar_o_write = -1;
683 static int hf_afp_dir_ar_g_search = -1;
684 static int hf_afp_dir_ar_g_read = -1;
685 static int hf_afp_dir_ar_g_write = -1;
686 static int hf_afp_dir_ar_e_search = -1;
687 static int hf_afp_dir_ar_e_read = -1;
688 static int hf_afp_dir_ar_e_write = -1;
689 static int hf_afp_dir_ar_u_search = -1;
690 static int hf_afp_dir_ar_u_read = -1;
691 static int hf_afp_dir_ar_u_write = -1;
692 static int hf_afp_dir_ar_blank = -1;
693 static int hf_afp_dir_ar_u_own = -1;
695 static int hf_afp_user_flag = -1;
696 static int hf_afp_user_ID = -1;
697 static int hf_afp_group_ID = -1;
698 static int hf_afp_user_bitmap = -1;
699 static int hf_afp_user_bitmap_UID = -1;
700 static int hf_afp_user_bitmap_GID = -1;
702 static gint ett_afp_user_bitmap = -1;
704 static const value_string user_flag_vals[] = {
706 {1, "Default user" },
710 file bitmap AFP3.0.pdf
713 kFPAttributeBit (bit 0)
714 kFPParentDirIDBit (bit 1)
715 kFPCreateDateBit (bit 2)
716 kFPModDateBit (bit 3)
717 kFPBackupDateBit (bit 4)
718 kFPFinderInfoBit (bit 5)
719 kFPLongNameBit (bit 6)
720 kFPShortNameBit (bit 7)
723 kFPUTF8NameBit (bit 13)
726 #define kFPDataForkLenBit (1 << 9)
727 #define kFPRsrcForkLenBit (1 << 10)
728 #define kFPExtDataForkLenBit (1 << 11)
729 #define kFPLaunchLimitBit (1 << 12)
731 #define kFPExtRsrcForkLenBit (1 << 14)
732 #define kFPUnixPrivsBit_file (1 << 15) /* :( */
735 file attribute AFP3.0.pdf
738 #define kFPInvisibleBit (1 << 0)
739 #define kFPMultiUserBit (1 << 1)
740 #define kFPSystemBit (1 << 2)
741 #define kFPDAlreadyOpenBit (1 << 3)
742 #define kFPRAlreadyOpenBit (1 << 4)
743 #define kFPWriteInhibitBit (1 << 5)
744 #define kFPBackUpNeededBit (1 << 6)
745 #define kFPRenameInhibitBit (1 << 7)
746 #define kFPDeleteInhibitBit (1 << 8)
747 #define kFPCopyProtectBit (1 << 10)
748 #define kFPSetClearBit (1 << 15)
751 #define kIsExpFolder (1 << 1)
752 #define kMounted (1 << 3)
753 #define kInExpFolder (1 << 4)
755 #define hash_init_count 20
758 static gint afp_equal (gconstpointer v, gconstpointer v2);
759 static guint afp_hash (gconstpointer v);
761 static guint afp_packet_init_count = 200;
764 guint32 conversation;
772 static GHashTable *afp_request_hash = NULL;
773 static GMemChunk *afp_request_keys = NULL;
774 static GMemChunk *afp_request_vals = NULL;
776 static guint Vol; /* volume */
777 static guint Did; /* parent directory ID */
780 static gint afp_equal (gconstpointer v, gconstpointer v2)
782 const afp_request_key *val1 = (const afp_request_key*)v;
783 const afp_request_key *val2 = (const afp_request_key*)v2;
785 if (val1->conversation == val2->conversation &&
786 val1->seq == val2->seq) {
792 static guint afp_hash (gconstpointer v)
794 const afp_request_key *afp_key = (const afp_request_key*)v;
798 /* --------------------------
800 #define PAD(x) { proto_tree_add_item(tree, hf_afp_pad, tvb, offset, x, FALSE); offset += x; }
803 decode_vol_bitmap (proto_tree *tree, tvbuff_t *tvb, gint offset)
805 proto_tree *sub_tree = NULL;
809 bitmap = tvb_get_ntohs(tvb, offset);
811 item = proto_tree_add_item(tree, hf_afp_vol_bitmap, tvb, offset, 2,FALSE);
812 sub_tree = proto_item_add_subtree(item, ett_afp_vol_bitmap);
815 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_Attributes, tvb, offset, 2,FALSE);
816 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_Signature, tvb, offset, 2,FALSE);
817 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_CreateDate, tvb, offset, 2,FALSE);
818 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_ModDate, tvb, offset, 2,FALSE);
819 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_BackupDate, tvb, offset, 2,FALSE);
820 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_ID, tvb, offset, 2,FALSE);
821 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_BytesFree, tvb, offset, 2,FALSE);
822 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_BytesTotal, tvb, offset, 2,FALSE);
823 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_Name, tvb, offset, 2,FALSE);
824 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_ExtBytesFree, tvb, offset, 2,FALSE);
825 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_ExtBytesTotal, tvb, offset, 2,FALSE);
826 proto_tree_add_item(sub_tree, hf_afp_vol_bitmap_BlockSize , tvb, offset, 2,FALSE);
831 /* -------------------------- */
833 decode_vol_attribute (proto_tree *tree, tvbuff_t *tvb, gint offset)
835 proto_tree *sub_tree = NULL;
839 bitmap = tvb_get_ntohs(tvb, offset);
841 item = proto_tree_add_item(tree, hf_afp_vol_attribute, tvb, offset, 2,FALSE);
842 sub_tree = proto_item_add_subtree(item, ett_afp_vol_attribute);
844 proto_tree_add_item(sub_tree, hf_afp_vol_attribute_ReadOnly ,tvb, offset, 2,FALSE);
845 proto_tree_add_item(sub_tree, hf_afp_vol_attribute_HasVolumePassword ,tvb, offset, 2,FALSE);
846 proto_tree_add_item(sub_tree, hf_afp_vol_attribute_SupportsFileIDs ,tvb, offset, 2,FALSE);
847 proto_tree_add_item(sub_tree, hf_afp_vol_attribute_SupportsCatSearch ,tvb, offset, 2,FALSE);
848 proto_tree_add_item(sub_tree, hf_afp_vol_attribute_SupportsBlankAccessPrivs,tvb, offset, 2,FALSE);
849 proto_tree_add_item(sub_tree, hf_afp_vol_attribute_SupportsUnixPrivs ,tvb, offset, 2,FALSE);
850 proto_tree_add_item(sub_tree, hf_afp_vol_attribute_SupportsUTF8Names ,tvb, offset, 2,FALSE);
855 /* --------------------------
856 cf AFP3.0.pdf page 38
857 date are number of seconds from 12:00am on 01.01.2000 GMT
858 backup : 0x8000000 not set
859 from netatalk adouble.h
861 #define DATE_NOT_SET 0x80000000
862 #define AD_DATE_DELTA 946684800
863 #define AD_DATE_TO_UNIX(x) (x + AD_DATE_DELTA)
865 print_date(proto_tree *tree,int id, tvbuff_t *tvb, gint offset)
867 time_t date = tvb_get_ntohl(tvb, offset);
870 tv.secs = AD_DATE_TO_UNIX(date);
872 proto_tree_add_time(tree, id, tvb, offset, 4, &tv);
877 /* -------------------------- */
879 parse_vol_bitmap (proto_tree *tree, tvbuff_t *tvb, gint offset, guint16 bitmap)
883 if ((bitmap & kFPVolAttributeBit)) {
884 decode_vol_attribute(tree,tvb,offset);
887 if ((bitmap & kFPVolSignatureBit)) {
888 proto_tree_add_item(tree, hf_afp_vol_signature,tvb, offset, 2, FALSE);
891 if ((bitmap & kFPVolCreateDateBit)) {
892 print_date(tree, hf_afp_vol_creation_date,tvb, offset);
895 if ((bitmap & kFPVolModDateBit)) {
896 print_date(tree, hf_afp_vol_modification_date,tvb, offset);
899 if ((bitmap & kFPVolBackupDateBit)) {
900 print_date(tree, hf_afp_vol_backup_date,tvb, offset);
903 if ((bitmap & kFPVolIDBit)) {
904 proto_tree_add_item(tree, hf_afp_vol_id, tvb, offset, 2,FALSE);
907 if ((bitmap & kFPVolBytesFreeBit)) {
908 proto_tree_add_item(tree, hf_afp_vol_bytes_free,tvb, offset, 4, FALSE);
911 if ((bitmap & kFPVolBytesTotalBit)) {
912 proto_tree_add_item(tree, hf_afp_vol_bytes_total,tvb, offset, 4, FALSE);
915 if ((bitmap & kFPVolNameBit)) {
916 nameoff = tvb_get_ntohs(tvb, offset);
917 proto_tree_add_item(tree, hf_afp_vol_name_offset,tvb, offset, 2, FALSE);
920 if ((bitmap & kFPVolExtBytesFreeBit)) {
921 proto_tree_add_item(tree, hf_afp_vol_ex_bytes_free,tvb, offset, 8, FALSE);
924 if ((bitmap & kFPVolExtBytesTotalBit)) {
925 proto_tree_add_item(tree, hf_afp_vol_ex_bytes_total,tvb, offset, 8, FALSE);
928 if ((bitmap & kFPVolBlockSizeBit)) {
929 proto_tree_add_item(tree, hf_afp_vol_block_size,tvb, offset, 4, FALSE);
935 len = tvb_get_guint8(tvb, offset);
936 proto_tree_add_item(tree, hf_afp_vol_name, tvb, offset, 1,FALSE);
943 /* -------------------------- */
945 decode_file_bitmap (proto_tree *tree, tvbuff_t *tvb, gint offset)
947 proto_tree *sub_tree = NULL;
951 bitmap = tvb_get_ntohs(tvb, offset);
953 item = proto_tree_add_item(tree, hf_afp_file_bitmap, tvb, offset, 2,FALSE);
954 sub_tree = proto_item_add_subtree(item, ett_afp_file_bitmap);
956 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_Attributes , tvb, offset, 2,FALSE);
957 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_ParentDirID , tvb, offset, 2,FALSE);
958 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_CreateDate , tvb, offset, 2,FALSE);
959 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_ModDate , tvb, offset, 2,FALSE);
960 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_BackupDate , tvb, offset, 2,FALSE);
961 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_FinderInfo , tvb, offset, 2,FALSE);
962 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_LongName , tvb, offset, 2,FALSE);
963 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_ShortName , tvb, offset, 2,FALSE);
964 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_NodeID , tvb, offset, 2,FALSE);
966 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_DataForkLen , tvb, offset, 2,FALSE);
967 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_RsrcForkLen , tvb, offset, 2,FALSE);
968 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_ExtDataForkLen , tvb, offset, 2,FALSE);
969 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_LaunchLimit , tvb, offset, 2,FALSE);
970 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_UTF8Name , tvb, offset, 2,FALSE);
972 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_ExtRsrcForkLen , tvb, offset, 2,FALSE);
973 proto_tree_add_item(sub_tree, hf_afp_file_bitmap_UnixPrivs , tvb, offset, 2,FALSE);
978 /* -------------------------- */
980 decode_file_attribute(proto_tree *tree, tvbuff_t *tvb, gint offset, int shared)
982 proto_tree *sub_tree = NULL;
986 attribute = tvb_get_ntohs(tvb, offset);
988 item = proto_tree_add_text(tree, tvb, offset, 2,
989 "File Attributes: 0x%04x", attribute);
990 sub_tree = proto_item_add_subtree(item, ett_afp_file_attribute);
992 proto_tree_add_item(sub_tree, hf_afp_file_attribute_Invisible , tvb, offset, 2,FALSE);
994 proto_tree_add_item(sub_tree, hf_afp_file_attribute_MultiUser , tvb, offset, 2,FALSE);
996 proto_tree_add_item(sub_tree, hf_afp_file_attribute_System , tvb, offset, 2,FALSE);
999 proto_tree_add_item(sub_tree, hf_afp_file_attribute_DAlreadyOpen , tvb, offset, 2,FALSE);
1000 proto_tree_add_item(sub_tree, hf_afp_file_attribute_RAlreadyOpen , tvb, offset, 2,FALSE);
1002 /* writeinhibit is file only but Macs are setting it with FPSetFileDirParms too */
1003 proto_tree_add_item(sub_tree, hf_afp_file_attribute_WriteInhibit , tvb, offset, 2,FALSE);
1004 proto_tree_add_item(sub_tree, hf_afp_file_attribute_BackUpNeeded , tvb, offset, 2,FALSE);
1005 proto_tree_add_item(sub_tree, hf_afp_file_attribute_RenameInhibit, tvb, offset, 2,FALSE);
1006 proto_tree_add_item(sub_tree, hf_afp_file_attribute_DeleteInhibit, tvb, offset, 2,FALSE);
1009 proto_tree_add_item(sub_tree, hf_afp_file_attribute_CopyProtect , tvb, offset, 2,FALSE);
1011 proto_tree_add_item(sub_tree, hf_afp_file_attribute_SetClear , tvb, offset, 2,FALSE);
1017 decode_access_rights (proto_tree *tree, tvbuff_t *tvb, int hf, gint offset)
1019 proto_tree *sub_tree;
1023 item = proto_tree_add_item(tree, hf, tvb, offset, 4, FALSE);
1024 sub_tree = proto_item_add_subtree(item, ett_afp_dir_ar);
1026 proto_tree_add_item(sub_tree, hf_afp_dir_ar_o_search, tvb, offset, 4, FALSE);
1027 proto_tree_add_item(sub_tree, hf_afp_dir_ar_o_read , tvb, offset, 4, FALSE);
1028 proto_tree_add_item(sub_tree, hf_afp_dir_ar_o_write , tvb, offset, 4, FALSE);
1030 proto_tree_add_item(sub_tree, hf_afp_dir_ar_g_search, tvb, offset, 4, FALSE);
1031 proto_tree_add_item(sub_tree, hf_afp_dir_ar_g_read , tvb, offset, 4, FALSE);
1032 proto_tree_add_item(sub_tree, hf_afp_dir_ar_g_write , tvb, offset, 4, FALSE);
1034 proto_tree_add_item(sub_tree, hf_afp_dir_ar_e_search, tvb, offset, 4, FALSE);
1035 proto_tree_add_item(sub_tree, hf_afp_dir_ar_e_read , tvb, offset, 4, FALSE);
1036 proto_tree_add_item(sub_tree, hf_afp_dir_ar_e_write , tvb, offset, 4, FALSE);
1038 proto_tree_add_item(sub_tree, hf_afp_dir_ar_u_search, tvb, offset, 4, FALSE);
1039 proto_tree_add_item(sub_tree, hf_afp_dir_ar_u_read , tvb, offset, 4, FALSE);
1040 proto_tree_add_item(sub_tree, hf_afp_dir_ar_u_write , tvb, offset, 4, FALSE);
1042 proto_tree_add_item(sub_tree, hf_afp_dir_ar_blank , tvb, offset, 4, FALSE);
1043 proto_tree_add_item(sub_tree, hf_afp_dir_ar_u_own , tvb, offset, 4, FALSE);
1048 decode_unix_privs (proto_tree *tree, tvbuff_t *tvb, gint offset)
1050 proto_tree *sub_tree;
1054 item = proto_tree_add_text(tree, tvb, offset, 16,
1056 sub_tree = proto_item_add_subtree(item, ett_afp_unix_privs);
1058 proto_tree_add_item(sub_tree, hf_afp_unix_privs_uid, tvb, offset, 4, FALSE);
1059 proto_tree_add_item(sub_tree, hf_afp_unix_privs_gid, tvb, offset+4, 4, FALSE);
1060 proto_tree_add_item(sub_tree, hf_afp_unix_privs_permissions, tvb, offset+8, 4, FALSE);
1061 decode_access_rights(sub_tree, tvb, hf_afp_unix_privs_ua_permissions, offset+12);
1065 /* -------------------------- */
1067 parse_long_filename(proto_tree *tree, tvbuff_t *tvb, gint offset, gint org_offset)
1073 lnameoff = tvb_get_ntohs(tvb, offset);
1074 proto_tree_add_item(tree, hf_afp_long_name_offset,tvb, offset, 2, FALSE);
1076 tp_ofs = lnameoff +org_offset;
1077 len = tvb_get_guint8(tvb, tp_ofs);
1078 proto_tree_add_item(tree, hf_afp_path_len, tvb, tp_ofs, 1,FALSE);
1080 proto_tree_add_item(tree, hf_afp_path_name, tvb, tp_ofs, len,FALSE);
1086 /* -------------------------- */
1088 parse_UTF8_filename(proto_tree *tree, tvbuff_t *tvb, gint offset, gint org_offset)
1094 unameoff = tvb_get_ntohs(tvb, offset);
1095 proto_tree_add_item(tree, hf_afp_unicode_name_offset,tvb, offset, 2, FALSE);
1099 tp_ofs = unameoff +org_offset;
1100 proto_tree_add_item( tree, hf_afp_path_unicode_hint, tvb, tp_ofs, 4,FALSE);
1103 len = tvb_get_ntohs(tvb, tp_ofs);
1104 proto_tree_add_item( tree, hf_afp_path_unicode_len, tvb, tp_ofs, 2,FALSE);
1107 proto_tree_add_item(tree, hf_afp_path_name, tvb, tp_ofs, len,FALSE);
1113 /* -------------------------- */
1115 parse_file_bitmap (proto_tree *tree, tvbuff_t *tvb, gint offset, guint16 bitmap, int shared)
1117 guint16 snameoff = 0;
1118 gint max_offset = 0;
1120 gint org_offset = offset;
1122 if ((bitmap & kFPAttributeBit)) {
1123 decode_file_attribute(tree, tvb, offset, shared);
1126 if ((bitmap & kFPParentDirIDBit)) {
1127 proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4,FALSE);
1130 if ((bitmap & kFPCreateDateBit)) {
1131 print_date(tree, hf_afp_creation_date,tvb, offset);
1134 if ((bitmap & kFPModDateBit)) {
1135 print_date(tree, hf_afp_modification_date,tvb, offset);
1138 if ((bitmap & kFPBackupDateBit)) {
1139 print_date(tree, hf_afp_backup_date,tvb, offset);
1142 if ((bitmap & kFPFinderInfoBit)) {
1143 proto_tree_add_item(tree, hf_afp_finder_info,tvb, offset, 32, FALSE);
1146 if ((bitmap & kFPLongNameBit)) {
1149 tp_ofs = parse_long_filename(tree, tvb, offset, org_offset);
1150 max_offset = (tp_ofs >max_offset)?tp_ofs:max_offset;
1155 if ((bitmap & kFPShortNameBit)) {
1156 snameoff = tvb_get_ntohs(tvb, offset);
1157 proto_tree_add_item(tree, hf_afp_short_name_offset,tvb, offset, 2, FALSE);
1160 if ((bitmap & kFPNodeIDBit)) {
1161 proto_tree_add_item(tree, hf_afp_file_id, tvb, offset, 4,FALSE);
1165 if ((bitmap & kFPDataForkLenBit)) {
1166 proto_tree_add_item(tree, hf_afp_file_DataForkLen, tvb, offset, 4,FALSE);
1170 if ((bitmap & kFPRsrcForkLenBit)) {
1171 proto_tree_add_item(tree, hf_afp_file_RsrcForkLen, tvb, offset, 4,FALSE);
1175 if ((bitmap & kFPExtDataForkLenBit)) {
1176 proto_tree_add_item(tree, hf_afp_file_ExtDataForkLen, tvb, offset, 8,FALSE);
1180 if ((bitmap & kFPLaunchLimitBit)) {
1181 offset += 2; /* ? */
1184 if ((bitmap & kFPUTF8NameBit)) {
1187 tp_ofs = parse_UTF8_filename(tree, tvb, offset, org_offset);
1188 max_offset = (tp_ofs >max_offset)?tp_ofs:max_offset;
1192 if ((bitmap & kFPExtRsrcForkLenBit)) {
1193 proto_tree_add_item(tree, hf_afp_file_ExtRsrcForkLen, tvb, offset, 8,FALSE);
1197 if ((bitmap & kFPUnixPrivsBit_file)) {
1199 * XXX - the AFP 3.0 spec says this is "Four bytes", but
1200 * also says the privileges are "stored in an FPUnixPrivs
1201 * structure", which is 16 bytes long.
1203 * We assume, for now, that the latter is true.
1205 decode_unix_privs(tree, tvb, offset);
1209 return (max_offset)?max_offset:offset;
1212 /* -------------------------- */
1214 decode_dir_bitmap (proto_tree *tree, tvbuff_t *tvb, gint offset)
1216 proto_tree *sub_tree = NULL;
1220 bitmap = tvb_get_ntohs(tvb, offset);
1222 item = proto_tree_add_item(tree, hf_afp_dir_bitmap, tvb, offset, 2,FALSE);
1223 sub_tree = proto_item_add_subtree(item, ett_afp_dir_bitmap);
1226 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_Attributes , tvb, offset, 2,FALSE);
1227 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_ParentDirID , tvb, offset, 2,FALSE);
1228 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_CreateDate , tvb, offset, 2,FALSE);
1229 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_ModDate , tvb, offset, 2,FALSE);
1230 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_BackupDate , tvb, offset, 2,FALSE);
1231 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_FinderInfo , tvb, offset, 2,FALSE);
1232 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_LongName , tvb, offset, 2,FALSE);
1233 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_ShortName , tvb, offset, 2,FALSE);
1234 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_NodeID , tvb, offset, 2,FALSE);
1235 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_OffspringCount , tvb, offset, 2,FALSE);
1236 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_OwnerID , tvb, offset, 2,FALSE);
1237 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_GroupID , tvb, offset, 2,FALSE);
1238 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_AccessRights , tvb, offset, 2,FALSE);
1239 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_UTF8Name , tvb, offset, 2,FALSE);
1240 proto_tree_add_item(sub_tree, hf_afp_dir_bitmap_UnixPrivs , tvb, offset, 2,FALSE);
1245 /* -------------------------- */
1247 decode_dir_attribute(proto_tree *tree, tvbuff_t *tvb, gint offset)
1249 proto_tree *sub_tree = NULL;
1253 attribute = tvb_get_ntohs(tvb, offset);
1255 item = proto_tree_add_text(tree, tvb, offset, 2,
1256 "Directory Attributes: 0x%04x", attribute);
1257 sub_tree = proto_item_add_subtree(item, ett_afp_dir_attribute);
1259 proto_tree_add_item(sub_tree, hf_afp_dir_attribute_Invisible , tvb, offset, 2,FALSE);
1260 proto_tree_add_item(sub_tree, hf_afp_dir_attribute_IsExpFolder , tvb, offset, 2,FALSE);
1261 proto_tree_add_item(sub_tree, hf_afp_dir_attribute_System , tvb, offset, 2,FALSE);
1262 proto_tree_add_item(sub_tree, hf_afp_dir_attribute_Mounted , tvb, offset, 2,FALSE);
1263 proto_tree_add_item(sub_tree, hf_afp_dir_attribute_InExpFolder , tvb, offset, 2,FALSE);
1264 proto_tree_add_item(sub_tree, hf_afp_dir_attribute_BackUpNeeded , tvb, offset, 2,FALSE);
1265 proto_tree_add_item(sub_tree, hf_afp_dir_attribute_RenameInhibit, tvb, offset, 2,FALSE);
1266 proto_tree_add_item(sub_tree, hf_afp_dir_attribute_DeleteInhibit, tvb, offset, 2,FALSE);
1271 /* -------------------------- */
1273 parse_dir_bitmap (proto_tree *tree, tvbuff_t *tvb, gint offset, guint16 bitmap)
1275 guint16 snameoff = 0;
1276 gint max_offset = 0;
1278 gint org_offset = offset;
1280 if ((bitmap & kFPAttributeBit)) {
1281 decode_dir_attribute(tree, tvb, offset);
1284 if ((bitmap & kFPParentDirIDBit)) {
1285 proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4,FALSE);
1288 if ((bitmap & kFPCreateDateBit)) {
1289 print_date(tree, hf_afp_creation_date,tvb, offset);
1292 if ((bitmap & kFPModDateBit)) {
1293 print_date(tree, hf_afp_modification_date,tvb, offset);
1296 if ((bitmap & kFPBackupDateBit)) {
1297 print_date(tree, hf_afp_backup_date,tvb, offset);
1300 if ((bitmap & kFPFinderInfoBit)) {
1301 proto_tree_add_item(tree, hf_afp_finder_info,tvb, offset, 32, FALSE);
1304 if ((bitmap & kFPLongNameBit)) {
1307 tp_ofs = parse_long_filename(tree, tvb, offset, org_offset);
1308 max_offset = (tp_ofs >max_offset)?tp_ofs:max_offset;
1312 if ((bitmap & kFPShortNameBit)) {
1313 snameoff = tvb_get_ntohs(tvb, offset);
1314 proto_tree_add_item(tree, hf_afp_short_name_offset,tvb, offset, 2, FALSE);
1317 if ((bitmap & kFPNodeIDBit)) {
1318 proto_tree_add_item(tree, hf_afp_file_id, tvb, offset, 4,FALSE);
1321 if ((bitmap & kFPOffspringCountBit)) {
1322 proto_tree_add_item(tree, hf_afp_dir_offspring, tvb, offset, 2,FALSE);
1323 offset += 2; /* error in AFP3.0.pdf */
1325 if ((bitmap & kFPOwnerIDBit)) {
1326 proto_tree_add_item(tree, hf_afp_dir_OwnerID, tvb, offset, 4, FALSE);
1329 if ((bitmap & kFPGroupIDBit)) {
1330 proto_tree_add_item(tree, hf_afp_dir_GroupID, tvb, offset, 4, FALSE);
1333 if ((bitmap & kFPAccessRightsBit)) {
1334 decode_access_rights(tree, tvb, hf_afp_dir_ar, offset);
1337 if ((bitmap & kFPUTF8NameBit)) {
1340 tp_ofs = parse_UTF8_filename(tree, tvb, offset, org_offset);
1341 max_offset = (tp_ofs >max_offset)?tp_ofs:max_offset;
1344 if ((bitmap & kFPUnixPrivsBit)) {
1346 * XXX - the AFP 3.0 spec says this is "Four bytes", but
1347 * also says the privileges are "stored in an FPUnixPrivs
1348 * structure", which is 16 bytes long.
1350 * We assume, for now, that the latter is true.
1352 decode_unix_privs(tree, tvb, offset);
1355 return (max_offset)?max_offset:offset;
1358 /* -------------------------- */
1360 name_in_bitmap(tvbuff_t *tvb, gint offset, guint16 bitmap, int isdir)
1363 gint org_offset = offset;
1370 if ((bitmap & kFPAttributeBit)) /* 0 */
1372 if ((bitmap & kFPParentDirIDBit)) /* 1 */
1374 if ((bitmap & kFPCreateDateBit)) /* 2 */
1376 if ((bitmap & kFPModDateBit)) /* 3 */
1378 if ((bitmap & kFPBackupDateBit)) /* 4 */
1380 if ((bitmap & kFPFinderInfoBit)) /* 5 */
1383 if ((bitmap & kFPLongNameBit)) { /* 6 */
1384 nameoff = tvb_get_ntohs(tvb, offset);
1386 tp_ofs = nameoff +org_offset;
1387 len = tvb_get_guint8(tvb, tp_ofs);
1389 if (!(name = g_malloc(len +1)))
1391 tvb_memcpy(tvb, name, tp_ofs, len);
1398 if ((bitmap & kFPShortNameBit)) /* 7 */
1400 if ((bitmap & kFPNodeIDBit)) /* 8 */
1404 if ((bitmap & kFPOffspringCountBit)) /* 9 */
1406 if ((bitmap & kFPOwnerIDBit)) /* 10*/
1408 if ((bitmap & kFPGroupIDBit)) /* 11*/
1410 if ((bitmap & kFPAccessRightsBit)) /* 12*/
1414 if ((bitmap & kFPDataForkLenBit)) /* 9 */
1416 if ((bitmap & kFPRsrcForkLenBit)) /* 10*/
1418 if ((bitmap & kFPExtDataForkLenBit)) /* 11*/
1420 if ((bitmap & kFPLaunchLimitBit)) /* 12*/
1421 offset += 2; /* FIXME ? */
1424 if ((bitmap & kFPUTF8NameBit)) { /* 13 */
1425 nameoff = tvb_get_ntohs(tvb, offset);
1427 tp_ofs = nameoff +org_offset +4;
1428 len16 = tvb_get_ntohs(tvb, tp_ofs);
1430 if (!(name = g_malloc(len16 +1)))
1432 tvb_memcpy(tvb, name, tp_ofs, len16);
1440 /* -------------------------- */
1442 name_in_dbitmap(tvbuff_t *tvb, gint offset, guint16 bitmap)
1446 name = name_in_bitmap(tvb, offset, bitmap, 1);
1456 /* -------------------------- */
1458 name_in_fbitmap(tvbuff_t *tvb, gint offset, guint16 bitmap)
1462 name = name_in_bitmap(tvb, offset, bitmap, 0);
1472 /* -------------------------- */
1474 decode_vol_did(proto_tree *tree, tvbuff_t *tvb, gint offset)
1476 Vol = tvb_get_ntohs(tvb, offset);
1477 proto_tree_add_item(tree, hf_afp_vol_id, tvb, offset, 2,FALSE);
1480 Did = tvb_get_ntohl(tvb, offset);
1481 proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4,FALSE);
1486 /* -------------------------- */
1488 decode_vol_did_file_dir_bitmap (proto_tree *tree, tvbuff_t *tvb, gint offset)
1490 offset = decode_vol_did(tree, tvb, offset);
1492 decode_file_bitmap(tree, tvb, offset);
1495 decode_dir_bitmap(tree, tvb, offset);
1501 /* ------------------------ */
1503 get_name(tvbuff_t *tvb, int offset, int type)
1511 len = tvb_get_guint8(tvb, offset);
1513 string = tvb_format_text(tvb,offset, len);
1516 len = tvb_get_ntohs(tvb, offset +4);
1518 string = tvb_format_text(tvb,offset, len);
1521 string = "unknow type";
1526 /* -------------------------- */
1528 decode_name_label (proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, gint offset, const gchar *label)
1534 proto_tree *sub_tree = NULL;
1537 type = tvb_get_guint8(tvb, offset);
1540 len = tvb_get_ntohs(tvb, offset +5);
1544 len = tvb_get_guint8(tvb, offset +1);
1546 name = get_name(tvb, offset +1, type);
1548 if (pinfo && check_col(pinfo->cinfo, COL_INFO)) {
1549 col_append_fstr(pinfo->cinfo, COL_INFO, ": Vol=%u Did=%u", Vol, Did);
1551 col_append_fstr(pinfo->cinfo, COL_INFO, " Name=%s", name);
1556 item = proto_tree_add_text(tree, tvb, offset, len +header, label, name);
1557 sub_tree = proto_item_add_subtree(item, ett_afp_path_name);
1559 proto_tree_add_item( sub_tree, hf_afp_path_type, tvb, offset, 1,FALSE);
1562 proto_tree_add_item( sub_tree, hf_afp_path_unicode_hint, tvb, offset, 4,FALSE);
1564 proto_tree_add_item( sub_tree, hf_afp_path_unicode_len, tvb, offset, 2,FALSE);
1568 proto_tree_add_item( sub_tree, hf_afp_path_len, tvb, offset, 1,FALSE);
1572 proto_tree_add_string(sub_tree, hf_afp_path_name, tvb, offset, len,name);
1580 /* -------------------------- */
1582 decode_name (proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, gint offset)
1584 return decode_name_label(tree, pinfo, tvb, offset, "Path: %s");
1587 /* -------------------------- */
1589 add_info_fork(tvbuff_t *tvb, packet_info *pinfo, gint offset)
1593 ofork = tvb_get_ntohs(tvb, offset);
1594 if (ofork && check_col(pinfo->cinfo, COL_INFO)) {
1595 col_append_fstr(pinfo->cinfo, COL_INFO, ": Fork=%u", ofork);
1599 /* -------------------------- */
1601 add_info_vol(tvbuff_t *tvb, packet_info *pinfo, gint offset)
1605 vol = tvb_get_ntohs(tvb, offset);
1606 if (check_col(pinfo->cinfo, COL_INFO)) {
1607 col_append_fstr(pinfo->cinfo, COL_INFO, ": Vol=%u", vol);
1611 /* ************************** */
1613 dissect_query_afp_open_vol(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
1619 decode_vol_bitmap(tree, tvb, offset);
1622 len = tvb_get_guint8(tvb, offset);
1624 if (check_col(pinfo->cinfo, COL_INFO)) {
1626 rep = get_name(tvb, offset, 2);
1627 col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", rep);
1633 proto_tree_add_item(tree, hf_afp_vol_name, tvb, offset, 1,FALSE);
1636 len = tvb_reported_length_remaining(tvb,offset);
1638 /* optionnal password */
1639 proto_tree_add_item(tree, hf_afp_passwd, tvb, offset, 8,FALSE);
1645 /* -------------------------- */
1647 dissect_reply_afp_open_vol(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
1653 bitmap = decode_vol_bitmap(tree, tvb, offset);
1655 offset = parse_vol_bitmap(tree, tvb, offset, bitmap);
1660 /* ************************** */
1662 dissect_reply_afp_get_server_param(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
1668 proto_tree *sub_tree = NULL;
1669 proto_tree *flag_tree;
1676 print_date(tree, hf_afp_server_time,tvb, offset);
1679 num = tvb_get_guint8(tvb, offset);
1680 item = proto_tree_add_text(tree, tvb, offset, 1, "Volumes : %d", num);
1681 sub_tree = proto_item_add_subtree(item, ett_afp_server_vol);
1684 for (i = 0; i < num; i++) {
1687 item = proto_tree_add_text(sub_tree, tvb, offset, -1,"Volume");
1688 tree = proto_item_add_subtree(item, ett_afp_vol_list);
1690 flag = tvb_get_guint8(tvb, offset);
1692 ti = proto_tree_add_text(tree, tvb, offset , 1,"Flags : 0x%02x", flag);
1693 flag_tree = proto_item_add_subtree(ti, ett_afp_vol_flag);
1694 proto_tree_add_item(flag_tree, hf_afp_vol_flag_passwd, tvb, offset, 1,FALSE);
1695 proto_tree_add_item(flag_tree, hf_afp_vol_flag_unix_priv ,tvb, offset, 1,FALSE);
1698 len = tvb_get_guint8(tvb, offset) +1;
1699 rep = get_name(tvb, offset, 2);
1700 proto_item_set_text(item, rep);
1701 proto_item_set_len(item, len +1);
1703 proto_tree_add_item(tree, hf_afp_vol_name, tvb, offset, 1,FALSE);
1710 /* **************************
1711 next calls use the same format :
1719 dissect_query_afp_with_vol_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
1726 proto_tree_add_item(tree, hf_afp_vol_id, tvb, offset, 2,FALSE);
1731 /* ************************** */
1733 dissect_query_afp_open_fork(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
1735 proto_tree *sub_tree = NULL;
1738 proto_tree_add_item(tree, hf_afp_fork_type, tvb, offset, 1,FALSE);
1741 offset = decode_vol_did(tree, tvb, offset);
1743 decode_file_bitmap(tree, tvb, offset);
1746 item = proto_tree_add_item(tree, hf_afp_access_mode, tvb, offset, 2,FALSE);
1747 sub_tree = proto_item_add_subtree(item, ett_afp_access_mode);
1749 proto_tree_add_item(sub_tree, hf_afp_access_read , tvb, offset, 2,FALSE);
1750 proto_tree_add_item(sub_tree, hf_afp_access_write , tvb, offset, 2,FALSE);
1751 proto_tree_add_item(sub_tree, hf_afp_access_deny_read , tvb, offset, 2,FALSE);
1752 proto_tree_add_item(sub_tree, hf_afp_access_deny_write, tvb, offset, 2,FALSE);
1756 offset = decode_name(tree, pinfo, tvb, offset);
1761 /* -------------------------- */
1763 dissect_reply_afp_open_fork(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
1767 f_bitmap = decode_file_bitmap(tree, tvb, offset);
1770 add_info_fork(tvb, pinfo, offset);
1771 proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2,FALSE);
1774 offset = parse_file_bitmap(tree, tvb, offset, f_bitmap,0);
1779 /* ************************** */
1781 dissect_query_afp_enumerate_ext2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
1785 offset = decode_vol_did_file_dir_bitmap(tree, tvb, offset);
1787 proto_tree_add_item(tree, hf_afp_req_count, tvb, offset, 2,FALSE);
1790 proto_tree_add_item(tree, hf_afp_start_index32, tvb, offset, 4,FALSE);
1793 proto_tree_add_item(tree, hf_afp_max_reply_size32, tvb, offset, 4,FALSE);
1796 offset = decode_name(tree, pinfo, tvb, offset);
1801 /* ************************** */
1803 dissect_query_afp_enumerate(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
1807 offset = decode_vol_did_file_dir_bitmap(tree, tvb, offset);
1809 proto_tree_add_item(tree, hf_afp_req_count, tvb, offset, 2,FALSE);
1812 proto_tree_add_item(tree, hf_afp_start_index, tvb, offset, 2,FALSE);
1815 proto_tree_add_item(tree, hf_afp_max_reply_size, tvb, offset, 2,FALSE);
1818 offset = decode_name(tree, pinfo, tvb, offset);
1823 /* -------------------------- */
1825 loop_record(tvbuff_t *tvb, proto_tree *ptree, gint offset,
1826 int count, guint16 d_bitmap, guint16 f_bitmap, int add, int ext)
1828 proto_tree *tree = NULL;
1837 for (i = 0; i < count; i++) {
1840 size = tvb_get_ntohs(tvb, offset);
1844 size = tvb_get_guint8(tvb, offset) +add;
1848 return offset; /* packet is malformed */
1849 flags = tvb_get_guint8(tvb, offset +decal);
1855 name = name_in_dbitmap(tvb, offset +decal, d_bitmap);
1858 name = name_in_fbitmap(tvb, offset +decal, f_bitmap);
1861 if (!(name = g_malloc(50))) { /* no memory ! */
1863 snprintf(name, 50,"line %d", i +1);
1865 item = proto_tree_add_text(ptree, tvb, offset, size, name);
1866 tree = proto_item_add_subtree(item, ett_afp_enumerate_line);
1867 g_free((gpointer)name);
1870 proto_tree_add_item(tree, hf_afp_struct_size16, tvb, offset, 2,FALSE);
1874 proto_tree_add_item(tree, hf_afp_struct_size, tvb, offset, 1,FALSE);
1878 proto_tree_add_item(tree, hf_afp_file_flag, tvb, offset, 1,FALSE);
1884 offset = parse_dir_bitmap(tree, tvb, offset, d_bitmap);
1887 offset = parse_file_bitmap(tree, tvb, offset, f_bitmap,0);
1891 offset = org +size; /* play safe */
1895 /* ------------------------- */
1897 reply_enumerate(tvbuff_t *tvb, proto_tree *tree, gint offset, int ext)
1899 proto_tree *sub_tree = NULL;
1905 f_bitmap = decode_file_bitmap(tree, tvb, offset);
1908 d_bitmap = decode_dir_bitmap(tree, tvb, offset);
1911 count = tvb_get_ntohs(tvb, offset);
1913 item = proto_tree_add_item(tree, hf_afp_req_count, tvb, offset, 2,FALSE);
1914 sub_tree = proto_item_add_subtree(item, ett_afp_enumerate);
1918 return loop_record(tvb,sub_tree, offset, count, d_bitmap, f_bitmap,0, ext);
1921 /* ------------------------- */
1923 dissect_reply_afp_enumerate(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
1925 return reply_enumerate(tvb, tree, offset, 0);
1928 /* **************************/
1930 dissect_reply_afp_enumerate_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
1932 return reply_enumerate(tvb, tree, offset, 1);
1934 /* **************************/
1936 dissect_query_afp_cat_search(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *ptree, gint offset)
1938 proto_tree *tree = NULL;
1950 proto_tree_add_item(ptree, hf_afp_vol_id, tvb, offset, 2,FALSE);
1953 proto_tree_add_item(ptree, hf_afp_cat_req_matches, tvb, offset, 4,FALSE);
1956 proto_tree_add_item(ptree, hf_afp_reserved, tvb, offset, 4,FALSE);
1959 proto_tree_add_item(ptree, hf_afp_cat_position, tvb, offset, 16,FALSE);
1962 f_bitmap = decode_file_bitmap(ptree, tvb, offset);
1965 d_bitmap = decode_dir_bitmap(ptree, tvb, offset);
1968 /* FIXME req bitmap */
1969 item = proto_tree_add_text(ptree, tvb, offset, 4, "Request bitmap");
1970 tree = proto_item_add_subtree(item, ett_afp_cat_r_bitmap);
1971 r_bitmap = decode_file_bitmap(tree, tvb, offset+2);
1976 size = tvb_get_guint8(tvb, offset) +2;
1978 item = proto_tree_add_text(ptree, tvb, offset, size, "Spec 1");
1979 tree = proto_item_add_subtree(item, ett_afp_cat_spec);
1981 proto_tree_add_item(tree, hf_afp_struct_size, tvb, offset, 1,FALSE);
1985 offset = parse_file_bitmap(tree, tvb, offset, r_bitmap,0);
1990 size = tvb_get_guint8(tvb, offset) +2;
1992 item = proto_tree_add_text(ptree, tvb, offset, size, "Spec 2");
1993 tree = proto_item_add_subtree(item, ett_afp_cat_spec);
1995 proto_tree_add_item(tree, hf_afp_struct_size, tvb, offset, 1,FALSE);
1999 offset = parse_file_bitmap(tree, tvb, offset, r_bitmap,0);
2005 /* -------------------------- */
2007 dissect_reply_afp_cat_search(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2009 proto_tree *sub_tree = NULL;
2015 proto_tree_add_item(tree, hf_afp_cat_position, tvb, offset, 16,FALSE);
2018 f_bitmap = decode_file_bitmap(tree, tvb, offset);
2021 d_bitmap = decode_dir_bitmap(tree, tvb, offset);
2024 count = tvb_get_ntohl(tvb, offset);
2026 item = proto_tree_add_item(tree, hf_afp_cat_count, tvb, offset, 4,FALSE);
2027 sub_tree = proto_item_add_subtree(item, ett_afp_cat_search);
2031 return loop_record(tvb,sub_tree, offset, count, d_bitmap, f_bitmap, 2, 0);
2034 /* **************************/
2036 dissect_query_afp_get_vol_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2040 add_info_vol(tvb, pinfo, offset);
2042 proto_tree_add_item(tree, hf_afp_vol_id, tvb, offset, 2,FALSE);
2045 decode_vol_bitmap(tree, tvb, offset);
2051 /* ------------------------ */
2053 dissect_reply_afp_get_vol_param(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2057 bitmap = decode_vol_bitmap(tree, tvb, offset);
2060 offset = parse_vol_bitmap(tree, tvb, offset, bitmap);
2065 /* **************************/
2067 dissect_query_afp_set_vol_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2073 add_info_vol(tvb, pinfo, offset);
2074 proto_tree_add_item(tree, hf_afp_vol_id, tvb, offset, 2,FALSE);
2077 bitmap = decode_vol_bitmap(tree, tvb, offset);
2080 offset = parse_vol_bitmap(tree, tvb, offset, bitmap);
2085 /* ***************************/
2087 decode_uam_parameters(const char *uam, int len_uam, tvbuff_t *tvb, proto_tree *tree, gint offset)
2091 if (!strncasecmp(uam, "Cleartxt passwrd", len_uam)) {
2095 len = 8; /* tvb_strsize(tvb, offset);*/
2096 proto_tree_add_item(tree, hf_afp_passwd, tvb, offset, len,FALSE);
2099 else if (!strncasecmp(uam, "DHCAST128", len_uam)) {
2104 proto_tree_add_item(tree, hf_afp_random, tvb, offset, len,FALSE);
2107 else if (!strncasecmp(uam, "2-Way Randnum exchange", len_uam)) {
2114 /* ---------------- */
2116 dissect_query_afp_login(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2122 len = tvb_get_guint8(tvb, offset);
2123 proto_tree_add_item(tree, hf_afp_AFPVersion, tvb, offset, 1,FALSE);
2125 len_uam = tvb_get_guint8(tvb, offset);
2126 uam = tvb_get_ptr(tvb, offset +1, len_uam);
2127 proto_tree_add_item(tree, hf_afp_UAM, tvb, offset, 1,FALSE);
2128 offset += len_uam +1;
2130 if (!strncasecmp(uam, "No User Authent", len_uam)) {
2134 len = tvb_get_guint8(tvb, offset);
2135 proto_tree_add_item(tree, hf_afp_user, tvb, offset, 1,FALSE);
2138 return decode_uam_parameters(uam, len_uam, tvb, tree, offset);
2141 /* ***************************/
2143 dissect_query_afp_login_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2150 type = tvb_get_guint8(tvb, offset);
2153 proto_tree_add_item(tree, hf_afp_login_flags, tvb, offset, 2,FALSE);
2156 len = tvb_get_guint8(tvb, offset);
2157 proto_tree_add_item(tree, hf_afp_AFPVersion, tvb, offset, 1,FALSE);
2160 len_uam = tvb_get_guint8(tvb, offset);
2161 uam = tvb_get_ptr(tvb, offset +1, len_uam);
2162 proto_tree_add_item(tree, hf_afp_UAM, tvb, offset, 1,FALSE);
2163 offset += len_uam +1;
2165 type = tvb_get_guint8(tvb, offset);
2166 proto_tree_add_item(tree, hf_afp_user_type, tvb, offset, 1,FALSE);
2169 len = tvb_get_ntohs(tvb, offset);
2170 proto_tree_add_item(tree, hf_afp_user_len, tvb, offset, 2,FALSE);
2172 proto_tree_add_item(tree, hf_afp_user_name, tvb, offset, len,FALSE);
2175 /* directory service */
2176 type = tvb_get_guint8(tvb, offset);
2177 proto_tree_add_item(tree, hf_afp_path_type, tvb, offset, 1,FALSE);
2179 /* FIXME use 16 bit len + unicode from smb dissector */
2183 len = tvb_get_guint8(tvb, offset);
2184 proto_tree_add_item(tree, hf_afp_path_len, tvb, offset, 1,FALSE);
2186 proto_tree_add_item(tree, hf_afp_path_name, tvb, offset, len,FALSE);
2190 len = tvb_get_ntohs(tvb, offset);
2191 proto_tree_add_item( tree, hf_afp_path_unicode_len, tvb, offset, 2,FALSE);
2193 proto_tree_add_item(tree, hf_afp_path_name, tvb, offset, len,FALSE);
2200 return decode_uam_parameters(uam, len_uam, tvb, tree, offset);
2203 /* ************************** */
2205 dissect_query_afp_write(tvbuff_t *tvb, packet_info *pinfo , proto_tree *tree, gint offset)
2207 proto_tree_add_item(tree, hf_afp_flag, tvb, offset, 1,FALSE);
2210 add_info_fork(tvb, pinfo, offset);
2211 proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2,FALSE);
2214 proto_tree_add_item(tree, hf_afp_offset, tvb, offset, 4,FALSE);
2217 proto_tree_add_item(tree, hf_afp_rw_count, tvb, offset, 4,FALSE);
2224 dissect_reply_afp_write(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2226 proto_tree_add_item(tree, hf_afp_last_written, tvb, offset, 4, FALSE);
2232 /* ************************** */
2234 dissect_query_afp_write_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2236 proto_tree_add_item(tree, hf_afp_flag, tvb, offset, 1,FALSE);
2239 add_info_fork(tvb, pinfo, offset);
2240 proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2,FALSE);
2243 proto_tree_add_item(tree, hf_afp_offset64, tvb, offset, 8,FALSE);
2246 proto_tree_add_item(tree, hf_afp_rw_count64, tvb, offset, 8,FALSE);
2253 dissect_reply_afp_write_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2255 proto_tree_add_item(tree, hf_afp_last_written64, tvb, offset, 8, FALSE);
2261 /* ************************** */
2263 dissect_query_afp_read(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2267 add_info_fork(tvb, pinfo, offset);
2268 proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2,FALSE);
2271 proto_tree_add_item(tree, hf_afp_offset, tvb, offset, 4,FALSE);
2274 proto_tree_add_item(tree, hf_afp_rw_count, tvb, offset, 4,FALSE);
2277 proto_tree_add_item(tree, hf_afp_newline_mask, tvb, offset, 1,FALSE);
2280 proto_tree_add_item(tree, hf_afp_newline_char, tvb, offset, 1,FALSE);
2286 /* ************************** */
2288 dissect_query_afp_read_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2292 add_info_fork(tvb, pinfo, offset);
2293 proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2,FALSE);
2296 proto_tree_add_item(tree, hf_afp_offset64, tvb, offset, 8,FALSE);
2299 proto_tree_add_item(tree, hf_afp_rw_count64, tvb, offset, 8,FALSE);
2305 /* **************************
2307 query is the same than AFP_FLUSH, AFP_CLOSEVOL
2311 dissect_reply_afp_open_dt(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2313 proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2,FALSE);
2319 /* **************************
2323 dissect_query_afp_close_dt(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2326 proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2,FALSE);
2332 /* **************************
2333 calls using the same format :
2340 dissect_query_afp_with_fork(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2343 add_info_fork(tvb, pinfo, offset);
2344 proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2,FALSE);
2350 /* ************************** */
2352 dissect_query_afp_get_fldr_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2355 offset = decode_vol_did_file_dir_bitmap(tree, tvb, offset);
2357 offset = decode_name(tree, pinfo, tvb, offset);
2362 /* -------------------------- */
2364 dissect_reply_afp_get_fldr_param(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2367 guint16 f_bitmap, d_bitmap;
2369 f_bitmap = decode_file_bitmap(tree, tvb, offset);
2372 d_bitmap = decode_dir_bitmap(tree, tvb, offset);
2375 flags = tvb_get_guint8(tvb, offset);
2376 proto_tree_add_item(tree, hf_afp_file_flag, tvb, offset, 1,FALSE);
2380 offset = parse_dir_bitmap(tree, tvb, offset, d_bitmap);
2383 offset = parse_file_bitmap(tree, tvb, offset, f_bitmap,0);
2388 /* **************************
2392 dissect_query_afp_set_fldr_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2397 offset = decode_vol_did(tree, tvb, offset);
2399 f_bitmap = decode_file_bitmap(tree, tvb, offset);
2402 offset = decode_name(tree, pinfo, tvb, offset);
2406 /* did:name can be a file or a folder but only the intersection between
2407 * file bitmap and dir bitmap can be set.
2408 * Well it's in afp spec, but clients (Mac) are setting 'file only' bits with this call
2409 * (WriteInhibit for example).
2411 offset = parse_file_bitmap(tree, tvb, offset, f_bitmap, 1);
2416 /* **************************
2420 dissect_query_afp_set_file_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2425 offset = decode_vol_did(tree, tvb, offset);
2427 f_bitmap = decode_file_bitmap(tree, tvb, offset);
2430 offset = decode_name(tree, pinfo, tvb, offset);
2434 offset = parse_file_bitmap(tree, tvb, offset, f_bitmap, 0);
2439 /* **************************
2443 dissect_query_afp_set_dir_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2448 offset = decode_vol_did(tree, tvb, offset);
2450 d_bitmap = decode_dir_bitmap(tree, tvb, offset);
2453 offset = decode_name(tree, pinfo, tvb, offset);
2457 offset = parse_dir_bitmap(tree, tvb, offset, d_bitmap);
2463 /* **************************
2468 dissect_query_afp_create_id(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2471 offset = decode_vol_did(tree, tvb, offset);
2473 offset = decode_name(tree, pinfo, tvb, offset);
2477 /* --------------------------
2481 dissect_reply_afp_create_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2483 proto_tree_add_item(tree, hf_afp_file_id, tvb, offset, 4,FALSE);
2489 /* -------------------------- */
2491 dissect_reply_afp_create_dir(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2493 proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4,FALSE);
2499 /* **************************
2503 dissect_query_afp_delete_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2506 proto_tree_add_item(tree, hf_afp_vol_id, tvb, offset, 2,FALSE);
2508 proto_tree_add_item(tree, hf_afp_file_id, tvb, offset, 4,FALSE);
2514 /* **************************
2515 same reply as get_fork_param
2518 dissect_query_afp_resolve_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2521 proto_tree_add_item(tree, hf_afp_vol_id, tvb, offset, 2,FALSE);
2523 proto_tree_add_item(tree, hf_afp_file_id, tvb, offset, 4,FALSE);
2526 decode_file_bitmap(tree, tvb, offset);
2532 /* ************************** */
2534 dissect_query_afp_get_fork_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2538 add_info_fork(tvb, pinfo, offset);
2539 proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2,FALSE);
2542 decode_file_bitmap(tree, tvb, offset);
2547 /* -------------------------- */
2549 dissect_reply_afp_get_fork_param(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2553 f_bitmap = decode_file_bitmap(tree, tvb, offset);
2556 offset = parse_file_bitmap(tree, tvb, offset, f_bitmap,0);
2561 /* ************************** */
2563 dissect_query_afp_set_fork_param(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2568 add_info_fork(tvb, pinfo, offset);
2569 proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2,FALSE);
2572 bitmap = decode_file_bitmap(tree, tvb, offset);
2575 if ((bitmap & kFPExtDataForkLenBit) || (bitmap & kFPExtRsrcForkLenBit)) {
2576 proto_tree_add_item(tree, hf_afp_ofork_len64, tvb, offset, 8, FALSE);
2580 proto_tree_add_item(tree, hf_afp_ofork_len, tvb, offset, 4,FALSE);
2586 /* ************************** */
2588 dissect_query_afp_move(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2592 offset = decode_vol_did(tree, tvb, offset);
2594 proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4,FALSE);
2597 offset = decode_name_label(tree, pinfo, tvb, offset, "Source path: %s");
2598 offset = decode_name_label(tree, NULL, tvb, offset, "Dest dir: %s");
2599 offset = decode_name_label(tree, NULL, tvb, offset, "New name: %s");
2604 /* ************************** */
2606 dissect_query_afp_exchange_file(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2610 offset = decode_vol_did(tree, tvb, offset);
2612 proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4,FALSE);
2615 offset = decode_name_label(tree, pinfo, tvb, offset, "Source path: %s");
2616 offset = decode_name_label(tree, NULL, tvb, offset, "Dest path: %s");
2620 /* ************************** */
2622 dissect_query_afp_copy_file(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2624 proto_tree *sub_tree = NULL;
2629 item = proto_tree_add_text(tree, tvb, offset, 6,"Source volume");
2630 sub_tree = proto_item_add_subtree(item, ett_afp_vol_did);
2632 offset = decode_vol_did(sub_tree, tvb, offset);
2635 item = proto_tree_add_text(tree, tvb, offset, 6,"Dest volume");
2636 sub_tree = proto_item_add_subtree(item, ett_afp_vol_did);
2638 offset = decode_vol_did(sub_tree, tvb, offset);
2640 offset = decode_name_label(tree, pinfo, tvb, offset, "Source path: %s");
2641 offset = decode_name_label(tree, NULL, tvb, offset, "Dest dir: %s");
2642 offset = decode_name_label(tree, NULL, tvb, offset, "New name: %s");
2647 /* ************************** */
2649 dissect_query_afp_rename(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2653 offset = decode_vol_did(tree, tvb, offset);
2655 offset = decode_name_label(tree, pinfo, tvb, offset, "Old name: %s");
2656 offset = decode_name_label(tree, NULL, tvb, offset, "New name: %s");
2661 /* ************************** */
2663 dissect_query_afp_byte_lock(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2665 proto_tree *sub_tree = NULL;
2669 flag = tvb_get_guint8(tvb, offset);
2671 item = proto_tree_add_text(tree, tvb, offset, 1, "Flags: 0x%02x", flag);
2672 sub_tree = proto_item_add_subtree(item, ett_afp_lock_flags);
2675 proto_tree_add_item(sub_tree, hf_afp_lock_op, tvb, offset, 1,FALSE);
2676 proto_tree_add_item(sub_tree, hf_afp_lock_from, tvb, offset, 1,FALSE);
2679 proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2,FALSE);
2682 proto_tree_add_item(tree, hf_afp_lock_offset, tvb, offset, 4,FALSE);
2685 proto_tree_add_item(tree, hf_afp_lock_len, tvb, offset, 4,FALSE);
2690 /* -------------------------- */
2692 dissect_reply_afp_byte_lock(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2694 proto_tree_add_item(tree, hf_afp_lock_range_start, tvb, offset, 4,FALSE);
2700 /* ************************** */
2702 dissect_query_afp_byte_lock_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2704 proto_tree *sub_tree = NULL;
2708 flag = tvb_get_guint8(tvb, offset);
2710 item = proto_tree_add_text(tree, tvb, offset, 1, "Flags: 0x%02x", flag);
2711 sub_tree = proto_item_add_subtree(item, ett_afp_lock_flags);
2714 proto_tree_add_item(sub_tree, hf_afp_lock_op, tvb, offset, 1,FALSE);
2715 proto_tree_add_item(sub_tree, hf_afp_lock_from, tvb, offset, 1,FALSE);
2718 proto_tree_add_item(tree, hf_afp_ofork, tvb, offset, 2,FALSE);
2721 proto_tree_add_item(tree, hf_afp_lock_offset64, tvb, offset, 8,FALSE);
2724 proto_tree_add_item(tree, hf_afp_lock_len64, tvb, offset, 8,FALSE);
2729 /* -------------------------- */
2731 dissect_reply_afp_byte_lock_ext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2733 proto_tree_add_item(tree, hf_afp_lock_range_start64, tvb, offset, 8,FALSE);
2739 /* ************************** */
2741 dissect_query_afp_add_cmt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2746 proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2,FALSE);
2749 proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4,FALSE);
2752 offset = decode_name(tree, pinfo, tvb, offset);
2757 len = tvb_get_guint8(tvb, offset);
2758 proto_tree_add_item(tree, hf_afp_comment, tvb, offset, 1,FALSE);
2765 /* ************************** */
2767 dissect_query_afp_get_cmt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2771 proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2,FALSE);
2774 proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4,FALSE);
2777 offset = decode_name(tree, pinfo, tvb, offset);
2781 /* -------------------------- */
2783 dissect_reply_afp_get_cmt(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2787 len = tvb_get_guint8(tvb, offset);
2788 proto_tree_add_item(tree, hf_afp_comment, tvb, offset, 1,FALSE);
2794 /* ************************** */
2796 dissect_query_afp_get_icon(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2800 proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2,FALSE);
2802 proto_tree_add_item(tree, hf_afp_file_creator, tvb, offset, 4,FALSE);
2805 proto_tree_add_item(tree, hf_afp_file_type, tvb, offset, 4,FALSE);
2808 proto_tree_add_item(tree, hf_afp_icon_type, tvb, offset, 1,FALSE);
2812 proto_tree_add_item(tree, hf_afp_icon_length, tvb, offset, 2,FALSE);
2818 /* ************************** */
2820 dissect_query_afp_get_icon_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2824 proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2,FALSE);
2826 proto_tree_add_item(tree, hf_afp_file_creator, tvb, offset, 4,FALSE);
2829 proto_tree_add_item(tree, hf_afp_icon_index, tvb, offset, 2,FALSE);
2835 /* -------------------------- */
2837 dissect_reply_afp_get_icon_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2840 proto_tree_add_item(tree, hf_afp_icon_tag, tvb, offset, 4,FALSE);
2843 proto_tree_add_item(tree, hf_afp_file_type, tvb, offset, 4,FALSE);
2846 proto_tree_add_item(tree, hf_afp_icon_type, tvb, offset, 1,FALSE);
2850 proto_tree_add_item(tree, hf_afp_icon_length, tvb, offset, 2,FALSE);
2856 /* ************************** */
2858 dissect_query_afp_add_icon(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2862 proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2,FALSE);
2864 proto_tree_add_item(tree, hf_afp_file_creator, tvb, offset, 4,FALSE);
2867 proto_tree_add_item(tree, hf_afp_file_type, tvb, offset, 4,FALSE);
2870 proto_tree_add_item(tree, hf_afp_icon_type, tvb, offset, 1,FALSE);
2874 proto_tree_add_item(tree, hf_afp_icon_tag, tvb, offset, 4,FALSE);
2877 proto_tree_add_item(tree, hf_afp_icon_length, tvb, offset, 2,FALSE);
2883 /* **************************
2887 dissect_query_afp_add_appl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2891 proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2,FALSE);
2894 proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4,FALSE);
2897 proto_tree_add_item(tree, hf_afp_file_creator, tvb, offset, 4,FALSE);
2900 proto_tree_add_item(tree, hf_afp_appl_tag, tvb, offset, 4,FALSE);
2903 offset = decode_name(tree, pinfo, tvb, offset);
2908 /* **************************
2912 dissect_query_afp_rmv_appl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2916 proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2,FALSE);
2919 proto_tree_add_item(tree, hf_afp_did, tvb, offset, 4,FALSE);
2922 proto_tree_add_item(tree, hf_afp_file_creator, tvb, offset, 4,FALSE);
2925 offset = decode_name(tree, pinfo, tvb, offset);
2930 /* ************************** */
2932 dissect_query_afp_get_appl(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2936 proto_tree_add_item(tree, hf_afp_dt_ref, tvb, offset, 2,FALSE);
2939 proto_tree_add_item(tree, hf_afp_file_creator, tvb, offset, 4,FALSE);
2942 proto_tree_add_item(tree, hf_afp_appl_index, tvb, offset, 2,FALSE);
2945 decode_file_bitmap(tree, tvb, offset);
2951 /* -------------------------- */
2953 dissect_reply_afp_get_appl(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2955 proto_tree_add_item(tree, hf_afp_appl_tag, tvb, offset, 4,FALSE);
2961 /* ************************** */
2963 dissect_query_afp_create_file(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
2965 proto_tree_add_item(tree, hf_afp_create_flag, tvb, offset, 1,FALSE);
2968 offset = decode_vol_did(tree, tvb, offset);
2970 offset = decode_name(tree, pinfo, tvb, offset);
2975 /* ************************** */
2977 dissect_query_afp_map_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2979 proto_tree_add_item(tree, hf_afp_map_id_type, tvb, offset, 1,FALSE);
2982 proto_tree_add_item(tree, hf_afp_map_id, tvb, offset, 4,FALSE);
2988 /* -------------------------- */
2990 dissect_reply_afp_map_id(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
2994 len = tvb_get_guint8(tvb, offset);
2995 proto_tree_add_item(tree, hf_afp_map_name, tvb, offset, 1,FALSE);
3000 /* ************************** */
3002 dissect_query_afp_map_name(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3005 proto_tree_add_item(tree, hf_afp_map_name_type, tvb, offset, 1,FALSE);
3008 len = tvb_get_guint8(tvb, offset);
3009 proto_tree_add_item(tree, hf_afp_map_name, tvb, offset, 1,FALSE);
3015 /* -------------------------- */
3017 dissect_reply_afp_map_name(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3020 proto_tree_add_item(tree, hf_afp_map_id, tvb, offset, 4,FALSE);
3025 /* ************************** */
3027 dissect_query_afp_disconnect_old_session(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3033 proto_tree_add_item(tree, hf_afp_session_token_type, tvb, offset, 2,FALSE);
3036 len = tvb_get_ntohl(tvb, offset);
3037 proto_tree_add_item(tree, hf_afp_session_token_len, tvb, offset, 4,FALSE);
3040 proto_tree_add_item(tree, hf_afp_session_token, tvb, offset, len,FALSE);
3046 /* ************************** */
3048 dissect_query_afp_get_session_token(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3052 proto_tree_add_item(tree, hf_afp_session_token_type, tvb, offset, 2,FALSE);
3058 /* -------------------------- */
3060 dissect_reply_afp_get_session_token(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3065 proto_tree_add_item(tree, hf_afp_session_token_type, tvb, offset, 2,FALSE);
3068 /* FIXME spec and capture disagree : spec 4 bytes, capture 2 bytes? */
3070 len = tvb_get_ntohs(tvb, offset);
3071 proto_tree_add_item(tree, hf_afp_session_token_len, tvb, offset, size,FALSE);
3074 proto_tree_add_item(tree, hf_afp_session_token, tvb, offset, len,FALSE);
3080 /* ************************** */
3082 dissect_query_afp_get_user_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3084 proto_tree *sub_tree = NULL;
3089 proto_tree_add_item(tree, hf_afp_user_flag, tvb, offset, 1,FALSE);
3092 proto_tree_add_item(tree, hf_afp_user_ID, tvb, offset, 4,FALSE);
3095 bitmap = tvb_get_ntohs(tvb, offset);
3097 item = proto_tree_add_item(tree, hf_afp_user_bitmap, tvb, offset, 2,FALSE);
3098 sub_tree = proto_item_add_subtree(item, ett_afp_user_bitmap);
3099 proto_tree_add_item(sub_tree, hf_afp_user_bitmap_UID, tvb, offset, 2,FALSE);
3100 proto_tree_add_item(sub_tree, hf_afp_user_bitmap_GID, tvb, offset, 2,FALSE);
3107 /* -------------------------- */
3109 dissect_reply_afp_get_user_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset)
3111 proto_tree *sub_tree = NULL;
3115 bitmap = tvb_get_ntohs(tvb, offset);
3117 item = proto_tree_add_item(tree, hf_afp_user_bitmap, tvb, offset, 2,FALSE);
3118 sub_tree = proto_item_add_subtree(item, ett_afp_user_bitmap);
3119 proto_tree_add_item(sub_tree, hf_afp_user_bitmap_UID, tvb, offset, 2,FALSE);
3120 proto_tree_add_item(sub_tree, hf_afp_user_bitmap_GID, tvb, offset, 2,FALSE);
3125 proto_tree_add_item(tree, hf_afp_user_ID, tvb, offset, 4,FALSE);
3130 proto_tree_add_item(tree, hf_afp_group_ID, tvb, offset, 4,FALSE);
3136 /* ************************** */
3138 dissect_afp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
3140 struct aspinfo *aspinfo = pinfo->private_data;
3141 proto_tree *afp_tree = NULL;
3143 conversation_t *conversation;
3145 afp_request_key request_key, *new_request_key;
3146 afp_request_val *request_val;
3149 int len = tvb_reported_length_remaining(tvb,0);
3151 if (check_col(pinfo->cinfo, COL_PROTOCOL))
3152 col_set_str(pinfo->cinfo, COL_PROTOCOL, "AFP");
3153 if (check_col(pinfo->cinfo, COL_INFO))
3154 col_clear(pinfo->cinfo, COL_INFO);
3156 conversation = find_conversation(&pinfo->src, &pinfo->dst, pinfo->ptype,
3157 pinfo->srcport, pinfo->destport, 0);
3159 if (conversation == NULL)
3161 conversation = conversation_new(&pinfo->src, &pinfo->dst,
3162 pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
3165 request_key.conversation = conversation->index;
3166 request_key.seq = aspinfo->seq;
3168 request_val = (afp_request_val *) g_hash_table_lookup(
3169 afp_request_hash, &request_key);
3171 if (!request_val && !aspinfo->reply) {
3172 afp_command = tvb_get_guint8(tvb, offset);
3173 new_request_key = g_mem_chunk_alloc(afp_request_keys);
3174 *new_request_key = request_key;
3176 request_val = g_mem_chunk_alloc(afp_request_vals);
3177 request_val->command = tvb_get_guint8(tvb, offset);
3179 g_hash_table_insert(afp_request_hash, new_request_key,
3183 if (!request_val) { /* missing request */
3184 if (check_col(pinfo->cinfo, COL_INFO))
3185 col_add_fstr(pinfo->cinfo, COL_INFO, "[Reply without query?]");
3189 afp_command = request_val->command;
3190 if (check_col(pinfo->cinfo, COL_INFO)) {
3191 col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s",
3192 val_to_str(afp_command, CommandCode_vals,
3193 "Unknown command (%u)"),
3194 aspinfo->reply ? "reply" : "request");
3195 if (aspinfo->reply && aspinfo->code != 0) {
3196 col_append_fstr(pinfo->cinfo, COL_INFO, ": %s (%d)",
3197 val_to_str(aspinfo->code, asp_error_vals,
3198 "Unknown error (%u)"), aspinfo->code);
3204 ti = proto_tree_add_item(tree, proto_afp, tvb, offset, -1,FALSE);
3205 afp_tree = proto_item_add_subtree(ti, ett_afp);
3207 if (!aspinfo->reply) {
3209 proto_tree_add_uint(afp_tree, hf_afp_command, tvb,offset, 1, afp_command);
3210 if (afp_command != tvb_get_guint8(tvb, offset))
3212 /* we have the same conversation for different connections eg:
3213 * ip1:2048 --> ip2:548
3214 * ip1:2048 --> ip2:548 <RST>
3216 * ip1:2048 --> ip2:548 <SYN> use the same port but it's a new session!
3218 if (check_col(pinfo->cinfo, COL_INFO)) {
3219 col_add_fstr(pinfo->cinfo, COL_INFO,
3220 "[Error!IP port reused, you need to split the capture file]");
3225 switch(afp_command) {
3227 offset = dissect_query_afp_byte_lock(tvb, pinfo, afp_tree, offset);break;
3228 case AFP_BYTELOCK_EXT:
3229 offset = dissect_query_afp_byte_lock_ext(tvb, pinfo, afp_tree, offset);break;
3230 case AFP_OPENDT: /* same as close vol */
3233 offset = dissect_query_afp_with_vol_id(tvb, pinfo, afp_tree, offset);break;
3235 /* offset = dissect_query_afp_close_dir(tvb, pinfo, afp_tree, offset);break; */
3238 offset = dissect_query_afp_close_dt(tvb, pinfo, afp_tree, offset);break;
3239 case AFP_FLUSHFORK: /* same packet as closefork */
3241 offset = dissect_query_afp_with_fork(tvb, pinfo, afp_tree, offset);break;
3243 offset = dissect_query_afp_copy_file(tvb, pinfo, afp_tree, offset);break;
3244 case AFP_CREATEFILE:
3245 offset = dissect_query_afp_create_file(tvb, pinfo, afp_tree, offset);break;
3246 case AFP_DISCTOLDSESS:
3247 offset = dissect_query_afp_disconnect_old_session(tvb, pinfo, afp_tree, offset);break;
3248 case AFP_ENUMERATE_EXT2:
3249 offset = dissect_query_afp_enumerate_ext2(tvb, pinfo, afp_tree, offset);break;
3250 case AFP_ENUMERATE_EXT:
3252 offset = dissect_query_afp_enumerate(tvb, pinfo, afp_tree, offset);break;
3253 case AFP_GETFORKPARAM:
3254 offset = dissect_query_afp_get_fork_param(tvb, pinfo, afp_tree, offset);break;
3255 case AFP_GETSESSTOKEN:
3256 offset = dissect_query_afp_get_session_token(tvb, pinfo, afp_tree, offset);break;
3257 case AFP_GETUSERINFO:
3258 offset = dissect_query_afp_get_user_info(tvb, pinfo, afp_tree, offset);break;
3259 case AFP_GETSRVINFO:
3260 /* offset = dissect_query_afp_get_server_info(tvb, pinfo, afp_tree, offset);break; */
3261 case AFP_GETSRVPARAM:
3262 break; /* no parameters */
3263 case AFP_GETVOLPARAM:
3264 offset = dissect_query_afp_get_vol_param(tvb, pinfo, afp_tree, offset);break;
3266 offset = dissect_query_afp_login_ext(tvb, pinfo, afp_tree, offset);break;
3268 offset = dissect_query_afp_login(tvb, pinfo, afp_tree, offset);break;
3273 offset = dissect_query_afp_map_id(tvb, pinfo, afp_tree, offset);break;
3275 offset = dissect_query_afp_map_name(tvb, pinfo, afp_tree, offset);break;
3277 offset = dissect_query_afp_move(tvb, pinfo, afp_tree, offset);break;
3279 offset = dissect_query_afp_open_vol(tvb, pinfo, afp_tree, offset);break;
3283 offset = dissect_query_afp_open_fork(tvb, pinfo, afp_tree, offset);break;
3285 offset = dissect_query_afp_read(tvb, pinfo, afp_tree, offset);break;
3287 offset = dissect_query_afp_read_ext(tvb, pinfo, afp_tree, offset);break;
3289 offset = dissect_query_afp_rename(tvb, pinfo, afp_tree, offset);break;
3290 case AFP_SETDIRPARAM:
3291 offset = dissect_query_afp_set_dir_param(tvb, pinfo, afp_tree, offset);break;
3292 case AFP_SETFILEPARAM:
3293 offset = dissect_query_afp_set_file_param(tvb, pinfo, afp_tree, offset);break;
3294 case AFP_SETFORKPARAM:
3295 offset = dissect_query_afp_set_fork_param(tvb, pinfo, afp_tree, offset);break;
3296 case AFP_SETVOLPARAM:
3297 offset = dissect_query_afp_set_vol_param(tvb, pinfo, afp_tree, offset);break;
3299 offset = dissect_query_afp_write(tvb, pinfo, afp_tree, offset);break;
3301 offset = dissect_query_afp_write_ext(tvb, pinfo, afp_tree, offset);break;
3302 case AFP_GETFLDRPARAM:
3303 offset = dissect_query_afp_get_fldr_param(tvb, pinfo, afp_tree, offset);break;
3304 case AFP_SETFLDRPARAM:
3305 offset = dissect_query_afp_set_fldr_param(tvb, pinfo, afp_tree, offset);break;
3307 case AFP_GETSRVRMSG:
3309 case AFP_DELETE: /* same as create_id */
3312 offset = dissect_query_afp_create_id(tvb, pinfo, afp_tree, offset);break;
3314 offset = dissect_query_afp_delete_id(tvb, pinfo, afp_tree, offset);break;
3316 offset = dissect_query_afp_resolve_id(tvb, pinfo, afp_tree, offset);break;
3317 case AFP_EXCHANGEFILE:
3318 offset = dissect_query_afp_exchange_file(tvb, pinfo, afp_tree, offset);break;
3319 case AFP_CATSEARCH_EXT:
3321 offset = dissect_query_afp_cat_search(tvb, pinfo, afp_tree, offset);break;
3323 offset = dissect_query_afp_get_icon(tvb, pinfo, afp_tree, offset);break;
3325 offset = dissect_query_afp_get_icon_info(tvb, pinfo, afp_tree, offset);break;
3327 offset = dissect_query_afp_add_appl(tvb, pinfo, afp_tree, offset);break;
3329 offset = dissect_query_afp_rmv_appl(tvb, pinfo, afp_tree, offset);break;
3331 offset = dissect_query_afp_get_appl(tvb, pinfo, afp_tree, offset);break;
3333 offset = dissect_query_afp_add_cmt(tvb, pinfo, afp_tree, offset);break;
3334 case AFP_RMVCMT: /* same as get_cmt */
3336 offset = dissect_query_afp_get_cmt(tvb, pinfo, afp_tree, offset);break;
3338 offset = dissect_query_afp_add_icon(tvb, pinfo, afp_tree, offset);break;
3343 proto_tree_add_uint(afp_tree, hf_afp_command, tvb, 0, 0, afp_command);
3345 /* for some calls if the reply is an error there's no data
3349 switch(afp_command) {
3351 offset = dissect_reply_afp_byte_lock(tvb, pinfo, afp_tree, offset);break;
3352 case AFP_BYTELOCK_EXT:
3353 offset = dissect_reply_afp_byte_lock_ext(tvb, pinfo, afp_tree, offset);break;
3354 case AFP_ENUMERATE_EXT2:
3355 case AFP_ENUMERATE_EXT:
3356 offset = dissect_reply_afp_enumerate_ext(tvb, pinfo, afp_tree, offset);break;
3358 offset = dissect_reply_afp_enumerate(tvb, pinfo, afp_tree, offset);break;
3360 offset = dissect_reply_afp_open_vol(tvb, pinfo, afp_tree, offset);break;
3362 offset = dissect_reply_afp_open_fork(tvb, pinfo, afp_tree, offset);break;
3364 case AFP_GETFORKPARAM:
3365 offset =dissect_reply_afp_get_fork_param(tvb, pinfo, afp_tree, offset);break;
3366 case AFP_GETUSERINFO:
3367 offset = dissect_reply_afp_get_user_info(tvb, pinfo, afp_tree, offset);break;
3368 case AFP_GETSRVPARAM:
3369 offset = dissect_reply_afp_get_server_param(tvb, pinfo, afp_tree, offset);break;
3371 offset = dissect_reply_afp_create_dir(tvb, pinfo, afp_tree, offset);break;
3373 offset = dissect_reply_afp_map_id(tvb, pinfo, afp_tree, offset);break;
3375 offset = dissect_reply_afp_map_name(tvb, pinfo, afp_tree, offset);break;
3376 case AFP_MOVE: /* same as create_id */
3378 offset = dissect_reply_afp_create_id(tvb, pinfo, afp_tree, offset);break;
3379 case AFP_GETSESSTOKEN:
3380 offset = dissect_reply_afp_get_session_token(tvb, pinfo, afp_tree, offset);break;
3381 case AFP_GETVOLPARAM:
3382 offset = dissect_reply_afp_get_vol_param(tvb, pinfo, afp_tree, offset);break;
3383 case AFP_GETFLDRPARAM:
3384 offset = dissect_reply_afp_get_fldr_param(tvb, pinfo, afp_tree, offset);break;
3386 offset = dissect_reply_afp_open_dt(tvb, pinfo, afp_tree, offset);break;
3388 case AFP_CATSEARCH_EXT:
3390 offset = dissect_reply_afp_cat_search(tvb, pinfo, afp_tree, offset);break;
3392 offset = dissect_reply_afp_get_icon_info(tvb, pinfo, afp_tree, offset);break;
3394 offset = dissect_reply_afp_get_appl(tvb, pinfo, afp_tree, offset);break;
3396 offset = dissect_reply_afp_get_cmt(tvb, pinfo, afp_tree, offset);break;
3398 offset = dissect_reply_afp_write(tvb, pinfo, afp_tree, offset);break;
3400 offset = dissect_reply_afp_write_ext(tvb, pinfo, afp_tree, offset);break;
3403 if (tree && offset < len) {
3404 call_dissector(data_handle, tvb_new_subset(tvb, offset, -1, -1),
3409 static void afp_reinit( void)
3412 if (afp_request_hash)
3413 g_hash_table_destroy(afp_request_hash);
3414 if (afp_request_keys)
3415 g_mem_chunk_destroy(afp_request_keys);
3416 if (afp_request_vals)
3417 g_mem_chunk_destroy(afp_request_vals);
3419 afp_request_hash = g_hash_table_new(afp_hash, afp_equal);
3421 afp_request_keys = g_mem_chunk_new("afp_request_keys",
3422 sizeof(afp_request_key),
3423 afp_packet_init_count * sizeof(afp_request_key),
3425 afp_request_vals = g_mem_chunk_new("afp_request_vals",
3426 sizeof(afp_request_val),
3427 afp_packet_init_count * sizeof(afp_request_val),
3433 proto_register_afp(void)
3436 static hf_register_info hf[] = {
3438 { "Command", "afp.command",
3439 FT_UINT8, BASE_DEC, VALS(CommandCode_vals), 0x0,
3440 "AFP function", HFILL }},
3444 FT_NONE, BASE_NONE, NULL, 0,
3445 "Pad Byte", HFILL }},
3447 { &hf_afp_AFPVersion,
3448 { "AFP Version", "afp.AFPVersion",
3449 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
3450 "Client AFP version", HFILL }},
3454 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
3455 "User Authentication Method", HFILL }},
3458 { "User", "afp.user",
3459 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
3462 { &hf_afp_user_type,
3463 { "Type", "afp.user_type",
3464 FT_UINT8, BASE_HEX, VALS(path_type_vals), 0,
3465 "Type of user name", HFILL }},
3467 { "Len", "afp.user_len",
3468 FT_UINT16, BASE_DEC, NULL, 0x0,
3469 "User name length (unicode)", HFILL }},
3470 { &hf_afp_user_name,
3471 { "User", "afp.user_name",
3472 FT_STRING, BASE_NONE, NULL, 0x0,
3473 "User name (unicode)", HFILL }},
3476 { "Password", "afp.passwd",
3477 FT_STRINGZ, BASE_NONE, NULL, 0x0,
3478 "Password", HFILL }},
3481 { "Random number", "afp.random",
3482 FT_BYTES, BASE_HEX, NULL, 0x0,
3483 "UAM random number", HFILL }},
3485 { &hf_afp_login_flags,
3486 { "Flags", "afp.afp_login_flags",
3487 FT_UINT16, BASE_HEX, NULL, 0 /* 0x0FFF*/,
3488 "Login flags", HFILL }},
3490 { &hf_afp_vol_bitmap,
3491 { "Bitmap", "afp.vol_bitmap",
3492 FT_UINT16, BASE_HEX, NULL, 0 /* 0x0FFF*/,
3493 "Volume bitmap", HFILL }},
3495 { &hf_afp_vol_bitmap_Attributes,
3496 { "Attributes", "afp.vol_bitmap.attributes",
3497 FT_BOOLEAN, 16, NULL, kFPVolAttributeBit,
3498 "Volume attributes", HFILL }},
3500 { &hf_afp_vol_attribute,
3501 { "Attributes", "afp.vol_attributes",
3502 FT_UINT16, BASE_HEX, NULL, 0,
3503 "Volume attributes", HFILL }},
3505 { &hf_afp_vol_attribute_ReadOnly,
3506 { "Read only", "afp.vol_attribute.read_only",
3507 FT_BOOLEAN, 16, NULL, kReadOnly,
3508 "Read only volume", HFILL }},
3510 { &hf_afp_vol_attribute_HasVolumePassword,
3511 { "Volume password", "afp.vol_attribute.passwd",
3512 FT_BOOLEAN, 16, NULL, kHasVolumePassword,
3513 "Has a volume password", HFILL }},
3515 { &hf_afp_vol_attribute_SupportsFileIDs,
3516 { "File IDs", "afp.vol_attribute.fileIDs",
3517 FT_BOOLEAN, 16, NULL, kSupportsFileIDs,
3518 "Supports file IDs", HFILL }},
3520 { &hf_afp_vol_attribute_SupportsCatSearch,
3521 { "Catalog search", "afp.vol_attribute.cat_search",
3522 FT_BOOLEAN, 16, NULL, kSupportsCatSearch,
3523 "Supports catalog search operations", HFILL }},
3525 { &hf_afp_vol_attribute_SupportsBlankAccessPrivs,
3526 { "Blank access privileges", "afp.vol_attribute.blank_access_privs",
3527 FT_BOOLEAN, 16, NULL, kSupportsBlankAccessPrivs,
3528 "Supports blank access privileges", HFILL }},
3530 { &hf_afp_vol_attribute_SupportsUnixPrivs,
3531 { "UNIX access privileges", "afp.vol_attribute.unix_privs",
3532 FT_BOOLEAN, 16, NULL, kSupportsUnixPrivs,
3533 "Supports UNIX access privileges", HFILL }},
3535 { &hf_afp_vol_attribute_SupportsUTF8Names,
3536 { "UTF-8 names", "afp.vol_attribute.utf8_names",
3537 FT_BOOLEAN, 16, NULL, kSupportsUTF8Names,
3538 "Supports UTF-8 names", HFILL }},
3540 { &hf_afp_vol_bitmap_Signature,
3541 { "Signature", "afp.vol_bitmap.signature",
3542 FT_BOOLEAN, 16, NULL, kFPVolSignatureBit,
3543 "Volume signature", HFILL }},
3545 { &hf_afp_vol_bitmap_CreateDate,
3546 { "Creation date", "afp.vol_bitmap.create_date",
3547 FT_BOOLEAN, 16, NULL, kFPVolCreateDateBit,
3548 "Volume creation date", HFILL }},
3550 { &hf_afp_vol_bitmap_ModDate,
3551 { "Modification date", "afp.vol_bitmap.mod_date",
3552 FT_BOOLEAN, 16, NULL, kFPVolModDateBit,
3553 "Volume modification date", HFILL }},
3555 { &hf_afp_vol_bitmap_BackupDate,
3556 { "Backup date", "afp.vol_bitmap.backup_date",
3557 FT_BOOLEAN, 16, NULL, kFPVolBackupDateBit,
3558 "Volume backup date", HFILL }},
3560 { &hf_afp_vol_bitmap_ID,
3561 { "ID", "afp.vol_bitmap.id",
3562 FT_BOOLEAN, 16, NULL, kFPVolIDBit,
3563 "Volume ID", HFILL }},
3565 { &hf_afp_vol_bitmap_BytesFree,
3566 { "Bytes free", "afp.vol_bitmap.bytes_free",
3567 FT_BOOLEAN, 16, NULL, kFPVolBytesFreeBit,
3568 "Volume free bytes", HFILL }},
3570 { &hf_afp_vol_bitmap_BytesTotal,
3571 { "Bytes total", "afp.vol_bitmap.bytes_total",
3572 FT_BOOLEAN, 16, NULL, kFPVolBytesTotalBit,
3573 "Volume total bytes", HFILL }},
3575 { &hf_afp_vol_bitmap_Name,
3576 { "Name", "afp.vol_bitmap.name",
3577 FT_BOOLEAN, 16, NULL, kFPVolNameBit,
3578 "Volume name", HFILL }},
3580 { &hf_afp_vol_bitmap_ExtBytesFree,
3581 { "Extended bytes free", "afp.vol_bitmap.ex_bytes_free",
3582 FT_BOOLEAN, 16, NULL, kFPVolExtBytesFreeBit,
3583 "Volume extended (>2GB) free bytes", HFILL }},
3585 { &hf_afp_vol_bitmap_ExtBytesTotal,
3586 { "Extended bytes total", "afp.vol_bitmap.ex_bytes_total",
3587 FT_BOOLEAN, 16, NULL, kFPVolExtBytesTotalBit,
3588 "Volume extended (>2GB) total bytes", HFILL }},
3590 { &hf_afp_vol_bitmap_BlockSize,
3591 { "Block size", "afp.vol_bitmap.block_size",
3592 FT_BOOLEAN, 16, NULL, kFPVolBlockSizeBit,
3593 "Volume block size", HFILL }},
3595 { &hf_afp_dir_bitmap_Attributes,
3596 { "Attributes", "afp.dir_bitmap.attributes",
3597 FT_BOOLEAN, 16, NULL, kFPAttributeBit,
3598 "Return attributes if directory", HFILL }},
3600 { &hf_afp_dir_bitmap_ParentDirID,
3601 { "DID", "afp.dir_bitmap.did",
3602 FT_BOOLEAN, 16, NULL, kFPParentDirIDBit,
3603 "Return parent directory ID if directory", HFILL }},
3605 { &hf_afp_dir_bitmap_CreateDate,
3606 { "Creation date", "afp.dir_bitmap.create_date",
3607 FT_BOOLEAN, 16, NULL, kFPCreateDateBit,
3608 "Return creation date if directory", HFILL }},
3610 { &hf_afp_dir_bitmap_ModDate,
3611 { "Modification date", "afp.dir_bitmap.mod_date",
3612 FT_BOOLEAN, 16, NULL, kFPModDateBit,
3613 "Return modification date if directory", HFILL }},
3615 { &hf_afp_dir_bitmap_BackupDate,
3616 { "Backup date", "afp.dir_bitmap.backup_date",
3617 FT_BOOLEAN, 16, NULL, kFPBackupDateBit,
3618 "Return backup date if directory", HFILL }},
3620 { &hf_afp_dir_bitmap_FinderInfo,
3621 { "Finder info", "afp.dir_bitmap.finder_info",
3622 FT_BOOLEAN, 16, NULL, kFPFinderInfoBit,
3623 "Return finder info if directory", HFILL }},
3625 { &hf_afp_dir_bitmap_LongName,
3626 { "Long name", "afp.dir_bitmap.long_name",
3627 FT_BOOLEAN, 16, NULL, kFPLongNameBit,
3628 "Return long name if directory", HFILL }},
3630 { &hf_afp_dir_bitmap_ShortName,
3631 { "Short name", "afp.dir_bitmap.short_name",
3632 FT_BOOLEAN, 16, NULL, kFPShortNameBit,
3633 "Return short name if directory", HFILL }},
3635 { &hf_afp_dir_bitmap_NodeID,
3636 { "File ID", "afp.dir_bitmap.fid",
3637 FT_BOOLEAN, 16, NULL, kFPNodeIDBit,
3638 "Return file ID if directory", HFILL }},
3640 { &hf_afp_dir_bitmap_OffspringCount,
3641 { "Offspring count", "afp.dir_bitmap.offspring_count",
3642 FT_BOOLEAN, 16, NULL, kFPOffspringCountBit,
3643 "Return offspring count if directory", HFILL }},
3645 { &hf_afp_dir_bitmap_OwnerID,
3646 { "Owner id", "afp.dir_bitmap.owner_id",
3647 FT_BOOLEAN, 16, NULL, kFPOwnerIDBit,
3648 "Return owner id if directory", HFILL }},
3650 { &hf_afp_dir_bitmap_GroupID,
3651 { "Group id", "afp.dir_bitmap.group_id",
3652 FT_BOOLEAN, 16, NULL, kFPGroupIDBit,
3653 "Return group id if directory", HFILL }},
3655 { &hf_afp_dir_bitmap_AccessRights,
3656 { "Access rights", "afp.dir_bitmap.access_rights",
3657 FT_BOOLEAN, 16, NULL, kFPAccessRightsBit,
3658 "Return access rights if directory", HFILL }},
3660 { &hf_afp_dir_bitmap_UTF8Name,
3661 { "UTF-8 name", "afp.dir_bitmap.UTF8_name",
3662 FT_BOOLEAN, 16, NULL, kFPUTF8NameBit,
3663 "Return UTF-8 name if diectory", HFILL }},
3665 { &hf_afp_dir_bitmap_UnixPrivs,
3666 { "UNIX privileges", "afp.dir_bitmap.unix_privs",
3667 FT_BOOLEAN, 16, NULL, kFPUnixPrivsBit,
3668 "Return UNIX privileges if directory", HFILL }},
3670 { &hf_afp_dir_attribute_Invisible,
3671 { "Invisible", "afp.dir_attribute.invisible",
3672 FT_BOOLEAN, 16, NULL, kFPInvisibleBit,
3673 "Directory is not visible", HFILL }},
3675 { &hf_afp_dir_attribute_IsExpFolder,
3676 { "Share point", "afp.dir_attribute.share",
3677 FT_BOOLEAN, 16, NULL, kFPMultiUserBit,
3678 "Directory is a share point", HFILL }},
3680 { &hf_afp_dir_attribute_System,
3681 { "System", "afp.dir_attribute.system",
3682 FT_BOOLEAN, 16, NULL, kFPSystemBit,
3683 "Directory is a system directory", HFILL }},
3685 { &hf_afp_dir_attribute_Mounted,
3686 { "Mounted", "afp.dir_attribute.mounted",
3687 FT_BOOLEAN, 16, NULL, kFPDAlreadyOpenBit,
3688 "Directory is mounted", HFILL }},
3690 { &hf_afp_dir_attribute_InExpFolder,
3691 { "Shared area", "afp.dir_attribute.in_exported_folder",
3692 FT_BOOLEAN, 16, NULL, kFPRAlreadyOpenBit,
3693 "Directory is in a shared area", HFILL }},
3695 { &hf_afp_dir_attribute_BackUpNeeded,
3696 { "Backup needed", "afp.dir_attribute.backup_needed",
3697 FT_BOOLEAN, 16, NULL, kFPBackUpNeededBit,
3698 "Directory needs to be backed up", HFILL }},
3700 { &hf_afp_dir_attribute_RenameInhibit,
3701 { "Rename inhibit", "afp.dir_attribute.rename_inhibit",
3702 FT_BOOLEAN, 16, NULL, kFPRenameInhibitBit,
3703 "Rename inhibit", HFILL }},
3705 { &hf_afp_dir_attribute_DeleteInhibit,
3706 { "Delete inhibit", "afp.dir_attribute.delete_inhibit",
3707 FT_BOOLEAN, 16, NULL, kFPDeleteInhibitBit,
3708 "Delete inhibit", HFILL }},
3710 { &hf_afp_dir_attribute_SetClear,
3711 { "Set", "afp.dir_attribute.set_clear",
3712 FT_BOOLEAN, 16, NULL, kFPSetClearBit,
3713 "Clear/set attribute", HFILL }},
3715 { &hf_afp_file_bitmap_Attributes,
3716 { "Attributes", "afp.file_bitmap.attributes",
3717 FT_BOOLEAN, 16, NULL, kFPAttributeBit,
3718 "Return attributes if file", HFILL }},
3720 { &hf_afp_file_bitmap_ParentDirID,
3721 { "DID", "afp.file_bitmap.did",
3722 FT_BOOLEAN, 16, NULL, kFPParentDirIDBit,
3723 "Return parent directory ID if file", HFILL }},
3725 { &hf_afp_file_bitmap_CreateDate,
3726 { "Creation date", "afp.file_bitmap.create_date",
3727 FT_BOOLEAN, 16, NULL, kFPCreateDateBit,
3728 "Return creation date if file", HFILL }},
3730 { &hf_afp_file_bitmap_ModDate,
3731 { "Modification date", "afp.file_bitmap.mod_date",
3732 FT_BOOLEAN, 16, NULL, kFPModDateBit,
3733 "Return modification date if file", HFILL }},
3735 { &hf_afp_file_bitmap_BackupDate,
3736 { "Backup date", "afp.file_bitmap.backup_date",
3737 FT_BOOLEAN, 16, NULL, kFPBackupDateBit,
3738 "Return backup date if file", HFILL }},
3740 { &hf_afp_file_bitmap_FinderInfo,
3741 { "Finder info", "afp.file_bitmap.finder_info",
3742 FT_BOOLEAN, 16, NULL, kFPFinderInfoBit,
3743 "Return finder info if file", HFILL }},
3745 { &hf_afp_file_bitmap_LongName,
3746 { "Long name", "afp.file_bitmap.long_name",
3747 FT_BOOLEAN, 16, NULL, kFPLongNameBit,
3748 "Return long name if file", HFILL }},
3750 { &hf_afp_file_bitmap_ShortName,
3751 { "Short name", "afp.file_bitmap.short_name",
3752 FT_BOOLEAN, 16, NULL, kFPShortNameBit,
3753 "Return short name if file", HFILL }},
3755 { &hf_afp_file_bitmap_NodeID,
3756 { "File ID", "afp.file_bitmap.fid",
3757 FT_BOOLEAN, 16, NULL, kFPNodeIDBit,
3758 "Return file ID if file", HFILL }},
3760 { &hf_afp_file_bitmap_DataForkLen,
3761 { "Data fork size", "afp.file_bitmap.data_fork_len",
3762 FT_BOOLEAN, 16, NULL, kFPDataForkLenBit,
3763 "Return data fork size if file", HFILL }},
3765 { &hf_afp_file_bitmap_RsrcForkLen,
3766 { "Resource fork size", "afp.file_bitmap.resource_fork_len",
3767 FT_BOOLEAN, 16, NULL, kFPRsrcForkLenBit,
3768 "Return resource fork size if file", HFILL }},
3770 { &hf_afp_file_bitmap_ExtDataForkLen,
3771 { "Extended data fork size", "afp.file_bitmap.ex_data_fork_len",
3772 FT_BOOLEAN, 16, NULL, kFPExtDataForkLenBit,
3773 "Return extended (>2GB) data fork size if file", HFILL }},
3775 { &hf_afp_file_bitmap_LaunchLimit,
3776 { "Launch limit", "afp.file_bitmap.launch_limit",
3777 FT_BOOLEAN, 16, NULL, kFPLaunchLimitBit,
3778 "Return launch limit if file", HFILL }},
3780 { &hf_afp_file_bitmap_UTF8Name,
3781 { "UTF-8 name", "afp.file_bitmap.UTF8_name",
3782 FT_BOOLEAN, 16, NULL, kFPUTF8NameBit,
3783 "Return UTF-8 name if file", HFILL }},
3785 { &hf_afp_file_bitmap_ExtRsrcForkLen,
3786 { "Extended resource fork size", "afp.file_bitmap.ex_resource_fork_len",
3787 FT_BOOLEAN, 16, NULL, kFPExtRsrcForkLenBit,
3788 "Return extended (>2GB) resource fork size if file", HFILL }},
3790 { &hf_afp_file_bitmap_UnixPrivs,
3791 { "UNIX privileges", "afp.file_bitmap.unix_privs",
3792 FT_BOOLEAN, 16, NULL, kFPUnixPrivsBit_file,
3793 "Return UNIX privileges if file", HFILL }},
3796 { &hf_afp_file_attribute_Invisible,
3797 { "Invisible", "afp.file_attribute.invisible",
3798 FT_BOOLEAN, 16, NULL, kFPInvisibleBit,
3799 "File is not visible", HFILL }},
3801 { &hf_afp_file_attribute_MultiUser,
3802 { "Multi user", "afp.file_attribute.multi_user",
3803 FT_BOOLEAN, 16, NULL, kFPMultiUserBit,
3804 "multi user", HFILL }},
3806 { &hf_afp_file_attribute_System,
3807 { "System", "afp.file_attribute.system",
3808 FT_BOOLEAN, 16, NULL, kFPSystemBit,
3809 "File is a system file", HFILL }},
3811 { &hf_afp_file_attribute_DAlreadyOpen,
3812 { "Data fork open", "afp.file_attribute.df_open",
3813 FT_BOOLEAN, 16, NULL, kFPDAlreadyOpenBit,
3814 "Data fork already open", HFILL }},
3816 { &hf_afp_file_attribute_RAlreadyOpen,
3817 { "Resource fork open", "afp.file_attribute.rf_open",
3818 FT_BOOLEAN, 16, NULL, kFPRAlreadyOpenBit,
3819 "Resource fork already open", HFILL }},
3821 { &hf_afp_file_attribute_WriteInhibit,
3822 { "Write inhibit", "afp.file_attribute.write_inhibit",
3823 FT_BOOLEAN, 16, NULL, kFPWriteInhibitBit,
3824 "Write inhibit", HFILL }},
3826 { &hf_afp_file_attribute_BackUpNeeded,
3827 { "Backup needed", "afp.file_attribute.backup_needed",
3828 FT_BOOLEAN, 16, NULL, kFPBackUpNeededBit,
3829 "File needs to be backed up", HFILL }},
3831 { &hf_afp_file_attribute_RenameInhibit,
3832 { "Rename inhibit", "afp.file_attribute.rename_inhibit",
3833 FT_BOOLEAN, 16, NULL, kFPRenameInhibitBit,
3834 "rename inhibit", HFILL }},
3836 { &hf_afp_file_attribute_DeleteInhibit,
3837 { "Delete inhibit", "afp.file_attribute.delete_inhibit",
3838 FT_BOOLEAN, 16, NULL, kFPDeleteInhibitBit,
3839 "delete inhibit", HFILL }},
3841 { &hf_afp_file_attribute_CopyProtect,
3842 { "Copy protect", "afp.file_attribute.copy_protect",
3843 FT_BOOLEAN, 16, NULL, kFPCopyProtectBit,
3844 "copy protect", HFILL }},
3846 { &hf_afp_file_attribute_SetClear,
3847 { "Set", "afp.file_attribute.set_clear",
3848 FT_BOOLEAN, 16, NULL, kFPSetClearBit,
3849 "Clear/set attribute", HFILL }},
3853 { "Volume", "afp.vol_name",
3854 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
3855 "Volume name", HFILL }},
3857 { &hf_afp_vol_flag_passwd,
3858 { "Password", "afp.vol_flag_passwd",
3859 FT_BOOLEAN, 8, NULL, 1,
3860 "Volume is password-protected", HFILL }},
3862 { &hf_afp_vol_flag_unix_priv,
3863 { "Unix privs", "afp.vol_flag_unix_priv",
3864 FT_BOOLEAN, 8, NULL, 2,
3865 "Volume has unix privileges", HFILL }},
3868 { "Volume id", "afp.vol_id",
3869 FT_UINT16, BASE_DEC, NULL, 0x0,
3870 "Volume id", HFILL }},
3872 { &hf_afp_vol_signature,
3873 { "Signature", "afp.vol_signature",
3874 FT_UINT16, BASE_DEC, VALS(vol_signature_vals), 0x0,
3875 "Volume signature", HFILL }},
3877 { &hf_afp_vol_name_offset,
3878 { "Volume name offset","afp.vol_name_offset",
3879 FT_UINT16, BASE_DEC, NULL, 0x0,
3880 "Volume name offset in packet", HFILL }},
3882 { &hf_afp_vol_creation_date,
3883 { "Creation date", "afp.vol_creation_date",
3884 FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x0,
3885 "Volume creation date", HFILL }},
3887 { &hf_afp_vol_modification_date,
3888 { "Modification date", "afp.vol_modification_date",
3889 FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x0,
3890 "Volume modification date", HFILL }},
3892 { &hf_afp_vol_backup_date,
3893 { "Backup date", "afp.vol_backup_date",
3894 FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x0,
3895 "Volume backup date", HFILL }},
3897 { &hf_afp_vol_bytes_free,
3898 { "Bytes free", "afp.vol_bytes_free",
3899 FT_UINT32, BASE_DEC, NULL, 0x0,
3900 "Free space", HFILL }},
3902 { &hf_afp_vol_bytes_total,
3903 { "Bytes total", "afp.vol_bytes_total",
3904 FT_UINT32, BASE_DEC, NULL, 0x0,
3905 "Volume size", HFILL }},
3907 { &hf_afp_vol_ex_bytes_free,
3908 { "Extended bytes free", "afp.vol_ex_bytes_free",
3909 FT_UINT64, BASE_DEC, NULL, 0x0,
3910 "Extended (>2GB) free space", HFILL }},
3912 { &hf_afp_vol_ex_bytes_total,
3913 { "Extended bytes total", "afp.vol_ex_bytes_total",
3914 FT_UINT64, BASE_DEC, NULL, 0x0,
3915 "Extended (>2GB) volume size", HFILL }},
3917 { &hf_afp_vol_block_size,
3918 { "Block size", "afp.vol_block_size",
3919 FT_UINT32, BASE_DEC, NULL, 0x0,
3920 "Volume block size", HFILL }},
3924 FT_UINT32, BASE_DEC, NULL, 0x0,
3925 "Parent directory ID", HFILL }},
3927 { &hf_afp_dir_bitmap,
3928 { "Directory bitmap", "afp.dir_bitmap",
3929 FT_UINT16, BASE_HEX, NULL, 0x0,
3930 "Directory bitmap", HFILL }},
3932 { &hf_afp_dir_offspring,
3933 { "Offspring", "afp.dir_offspring",
3934 FT_UINT16, BASE_DEC, NULL, 0x0,
3935 "Directory offspring", HFILL }},
3937 { &hf_afp_dir_OwnerID,
3938 { "Owner ID", "afp.dir_owner_id",
3939 FT_INT32, BASE_DEC, NULL, 0x0,
3940 "Directory owner ID", HFILL }},
3942 { &hf_afp_dir_GroupID,
3943 { "Group ID", "afp.dir_group_id",
3944 FT_INT32, BASE_DEC, NULL, 0x0,
3945 "Directory group ID", HFILL }},
3947 { &hf_afp_creation_date,
3948 { "Creation date", "afp.creation_date",
3949 FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x0,
3950 "Creation date", HFILL }},
3952 { &hf_afp_modification_date,
3953 { "Modification date", "afp.modification_date",
3954 FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x0,
3955 "Modification date", HFILL }},
3957 { &hf_afp_backup_date,
3958 { "Backup date", "afp.backup_date",
3959 FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x0,
3960 "Backup date", HFILL }},
3962 { &hf_afp_finder_info,
3963 { "Finder info", "afp.finder_info",
3964 FT_BYTES, BASE_HEX, NULL, 0x0,
3965 "Finder info", HFILL }},
3967 { &hf_afp_long_name_offset,
3968 { "Long name offset", "afp.long_name_offset",
3969 FT_UINT16, BASE_DEC, NULL, 0x0,
3970 "Long name offset in packet", HFILL }},
3972 { &hf_afp_short_name_offset,
3973 { "Short name offset", "afp.short_name_offset",
3974 FT_UINT16, BASE_DEC, NULL, 0x0,
3975 "Short name offset in packet", HFILL }},
3977 { &hf_afp_unicode_name_offset,
3978 { "Unicode name offset", "afp.unicode_name_offset",
3979 FT_UINT16, BASE_DEC, NULL, 0x0,
3980 "Unicode name offset in packet", HFILL }},
3982 { &hf_afp_unix_privs_uid,
3983 { "UID", "afp.unix_privs.uid",
3984 FT_UINT32, BASE_DEC, NULL, 0x0,
3985 "User ID", HFILL }},
3987 { &hf_afp_unix_privs_gid,
3988 { "GID", "afp.unix_privs.gid",
3989 FT_UINT32, BASE_DEC, NULL, 0x0,
3990 "Group ID", HFILL }},
3992 { &hf_afp_unix_privs_permissions,
3993 { "Permissions", "afp.unix_privs.permissions",
3994 FT_UINT32, BASE_OCT, NULL, 0x0,
3995 "Permissions", HFILL }},
3997 { &hf_afp_unix_privs_ua_permissions,
3998 { "User's access rights", "afp.unix_privs.ua_permissions",
3999 FT_UINT32, BASE_HEX, NULL, 0x0,
4000 "User's access rights", HFILL }},
4003 { "File ID", "afp.file_id",
4004 FT_UINT32, BASE_DEC, NULL, 0x0,
4005 "File/directory ID", HFILL }},
4007 { &hf_afp_file_DataForkLen,
4008 { "Data fork size", "afp.data_fork_len",
4009 FT_UINT32, BASE_DEC, NULL, 0x0,
4010 "Data fork size", HFILL }},
4012 { &hf_afp_file_RsrcForkLen,
4013 { "Resource fork size", "afp.resource_fork_len",
4014 FT_UINT32, BASE_DEC, NULL, 0x0,
4015 "Resource fork size", HFILL }},
4017 { &hf_afp_file_ExtDataForkLen,
4018 { "Extended data fork size", "afp.ext_data_fork_len",
4019 FT_UINT64, BASE_DEC, NULL, 0x0,
4020 "Extended (>2GB) data fork length", HFILL }},
4022 { &hf_afp_file_ExtRsrcForkLen,
4023 { "Extended resource fork size", "afp.ext_resource_fork_len",
4024 FT_UINT64, BASE_DEC, NULL, 0x0,
4025 "Extended (>2GB) resource fork length", HFILL }},
4027 { &hf_afp_file_bitmap,
4028 { "File bitmap", "afp.file_bitmap",
4029 FT_UINT16, BASE_HEX, NULL, 0x0,
4030 "File bitmap", HFILL }},
4032 { &hf_afp_req_count,
4033 { "Req count", "afp.req_count",
4034 FT_UINT16, BASE_DEC, NULL, 0x0,
4035 "Maximum number of structures returned", HFILL }},
4037 { &hf_afp_start_index,
4038 { "Start index", "afp.start_index",
4039 FT_UINT16, BASE_DEC, NULL, 0x0,
4040 "First structure returned", HFILL }},
4042 { &hf_afp_max_reply_size,
4043 { "Reply size", "afp.reply_size",
4044 FT_UINT16, BASE_DEC, NULL, 0x0,
4045 "Reply size", HFILL }},
4047 { &hf_afp_start_index32,
4048 { "Start index", "afp.start_index32",
4049 FT_UINT32, BASE_DEC, NULL, 0x0,
4050 "First structure returned", HFILL }},
4052 { &hf_afp_max_reply_size32,
4053 { "Reply size", "afp.reply_size32",
4054 FT_UINT32, BASE_DEC, NULL, 0x0,
4055 "Reply size", HFILL }},
4057 { &hf_afp_file_flag,
4058 { "Dir", "afp.file_flag",
4059 FT_BOOLEAN, 8, NULL, 0x80,
4060 "Is a dir", HFILL }},
4062 { &hf_afp_create_flag,
4063 { "Hard create", "afp.create_flag",
4064 FT_BOOLEAN, 8, NULL, 0x80,
4065 "Soft/hard create file", HFILL }},
4067 { &hf_afp_struct_size,
4068 { "Struct size", "afp.struct_size",
4069 FT_UINT8, BASE_DEC, NULL,0,
4070 "Sizeof of struct", HFILL }},
4072 { &hf_afp_struct_size16,
4073 { "Struct size", "afp.struct_size16",
4074 FT_UINT16, BASE_DEC, NULL,0,
4075 "Sizeof of struct", HFILL }},
4078 { "From", "afp.flag",
4079 FT_UINT8, BASE_HEX, VALS(flag_vals), 0x80,
4080 "Offset is relative to start/end of the fork", HFILL }},
4083 { "DT ref", "afp.dt_ref",
4084 FT_UINT16, BASE_DEC, NULL, 0x0,
4085 "Desktop database reference num", HFILL }},
4088 { "Fork", "afp.ofork",
4089 FT_UINT16, BASE_DEC, NULL, 0x0,
4090 "Open fork reference number", HFILL }},
4093 { "Offset", "afp.offset",
4094 FT_INT32, BASE_DEC, NULL, 0x0,
4098 { "Count", "afp.rw_count",
4099 FT_INT32, BASE_DEC, NULL, 0x0,
4100 "Number of bytes to be read/written", HFILL }},
4102 { &hf_afp_newline_mask,
4103 { "Newline mask", "afp.newline_mask",
4104 FT_UINT8, BASE_HEX, NULL, 0x0,
4105 "Value to AND bytes with when looking for newline", HFILL }},
4107 { &hf_afp_newline_char,
4108 { "Newline char", "afp.newline_char",
4109 FT_UINT8, BASE_HEX, NULL, 0x0,
4110 "Value to compare ANDed bytes with when looking for newline", HFILL }},
4112 { &hf_afp_last_written,
4113 { "Last written", "afp.last_written",
4114 FT_UINT32, BASE_DEC, NULL, 0x0,
4115 "Offset of the last byte written", HFILL }},
4117 { &hf_afp_actual_count,
4118 { "Count", "afp.actual_count",
4119 FT_INT32, BASE_DEC, NULL, 0x0,
4120 "Number of bytes returned by read/write", HFILL }},
4122 { &hf_afp_ofork_len,
4123 { "New length", "afp.ofork_len",
4124 FT_INT32, BASE_DEC, NULL, 0x0,
4125 "New length", HFILL }},
4127 { &hf_afp_path_type,
4128 { "Type", "afp.path_type",
4129 FT_UINT8, BASE_HEX, VALS(path_type_vals), 0,
4130 "Type of names", HFILL }},
4133 { "Len", "afp.path_len",
4134 FT_UINT8, BASE_DEC, NULL, 0x0,
4135 "Path length", HFILL }},
4137 { &hf_afp_path_unicode_len,
4138 { "Len", "afp.path_unicode_len",
4139 FT_UINT16, BASE_DEC, NULL, 0x0,
4140 "Path length (unicode)", HFILL }},
4142 { &hf_afp_path_unicode_hint,
4143 { "Unicode hint", "afp.path_unicode_hint",
4144 FT_UINT32, BASE_HEX, VALS(unicode_hint_vals), 0x0,
4145 "Unicode hint", HFILL }},
4147 { &hf_afp_path_name,
4148 { "Name", "afp.path_name",
4149 FT_STRING, BASE_NONE, NULL, 0x0,
4150 "Path name", HFILL }},
4152 { &hf_afp_fork_type,
4153 { "Resource fork", "afp.fork_type",
4154 FT_BOOLEAN, 8, NULL, 0x80,
4155 "Data/resource fork", HFILL }},
4157 { &hf_afp_access_mode,
4158 { "Access mode", "afp.access",
4159 FT_UINT8, BASE_HEX, NULL, 0x0,
4160 "Fork access mode", HFILL }},
4162 { &hf_afp_access_read,
4163 { "Read", "afp.access.read",
4164 FT_BOOLEAN, 8, NULL, 1,
4165 "Open for reading", HFILL }},
4167 { &hf_afp_access_write,
4168 { "Write", "afp.access.write",
4169 FT_BOOLEAN, 8, NULL, 2,
4170 "Open for writing", HFILL }},
4172 { &hf_afp_access_deny_read,
4173 { "Deny read", "afp.access.deny_read",
4174 FT_BOOLEAN, 8, NULL, 0x10,
4175 "Deny read", HFILL }},
4177 { &hf_afp_access_deny_write,
4178 { "Deny write", "afp.access.deny_write",
4179 FT_BOOLEAN, 8, NULL, 0x20,
4180 "Deny write", HFILL }},
4183 { "Comment", "afp.comment",
4184 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
4185 "File/folder comment", HFILL }},
4187 { &hf_afp_file_creator,
4188 { "File creator", "afp.file_creator",
4189 FT_STRING, BASE_NONE, NULL, 0x0,
4190 "File creator", HFILL }},
4192 { &hf_afp_file_type,
4193 { "File type", "afp.file_type",
4194 FT_STRING, BASE_NONE, NULL, 0x0,
4195 "File type", HFILL }},
4197 { &hf_afp_icon_type,
4198 { "Icon type", "afp.icon_type",
4199 FT_UINT8, BASE_HEX, NULL , 0,
4200 "Icon type", HFILL }},
4202 { &hf_afp_icon_length,
4203 { "Size", "afp.icon_length",
4204 FT_UINT16, BASE_DEC, NULL, 0x0,
4205 "Size for icon bitmap", HFILL }},
4207 { &hf_afp_icon_index,
4208 { "Index", "afp.icon_index",
4209 FT_UINT16, BASE_DEC, NULL, 0x0,
4210 "Icon index in desktop database", HFILL }},
4213 { "Tag", "afp.icon_tag",
4214 FT_UINT32, BASE_HEX, NULL, 0x0,
4215 "Icon tag", HFILL }},
4217 { &hf_afp_appl_index,
4218 { "Index", "afp.appl_index",
4219 FT_UINT16, BASE_DEC, NULL, 0x0,
4220 "Application index", HFILL }},
4223 { "Tag", "afp.appl_tag",
4224 FT_UINT32, BASE_HEX, NULL, 0x0,
4225 "Application tag", HFILL }},
4228 { "unlock", "afp.lock_op",
4229 FT_BOOLEAN, 8, NULL, 0x1,
4230 "Lock/unlock op", HFILL }},
4232 { &hf_afp_lock_from,
4233 { "End", "afp.lock_from",
4234 FT_BOOLEAN, 8, NULL, 0x80,
4235 "Offset is relative to the end of the fork", HFILL }},
4237 { &hf_afp_lock_offset,
4238 { "Offset", "afp.lock_offset",
4239 FT_INT32, BASE_DEC, NULL, 0x0,
4240 "First byte to be locked", HFILL }},
4243 { "Length", "afp.lock_len",
4244 FT_INT32, BASE_DEC, NULL, 0x0,
4245 "Number of bytes to be locked/unlocked", HFILL }},
4247 { &hf_afp_lock_range_start,
4248 { "Start", "afp.lock_range_start",
4249 FT_INT32, BASE_DEC, NULL, 0x0,
4250 "First byte locked/unlocked", HFILL }},
4253 { "Access rights", "afp.dir_ar",
4254 FT_UINT32, BASE_HEX, NULL, 0x0,
4255 "Directory access rights", HFILL }},
4257 { &hf_afp_dir_ar_o_search,
4258 { "Owner has search access", "afp.dir_ar.o_search",
4259 FT_BOOLEAN, 32, NULL, AR_O_SEARCH,
4260 "Owner has search access", HFILL }},
4262 { &hf_afp_dir_ar_o_read,
4263 { "Owner has read access", "afp.dir_ar.o_read",
4264 FT_BOOLEAN, 32, NULL, AR_O_READ,
4265 "Owner has read access", HFILL }},
4267 { &hf_afp_dir_ar_o_write,
4268 { "Owner has write access", "afp.dir_ar.o_write",
4269 FT_BOOLEAN, 32, NULL, AR_O_WRITE,
4270 "Gwner has write access", HFILL }},
4272 { &hf_afp_dir_ar_g_search,
4273 { "Group has search access", "afp.dir_ar.g_search",
4274 FT_BOOLEAN, 32, NULL, AR_G_SEARCH,
4275 "Group has search access", HFILL }},
4277 { &hf_afp_dir_ar_g_read,
4278 { "Group has read access", "afp.dir_ar.g_read",
4279 FT_BOOLEAN, 32, NULL, AR_G_READ,
4280 "Group has read access", HFILL }},
4282 { &hf_afp_dir_ar_g_write,
4283 { "Group has write access", "afp.dir_ar.g_write",
4284 FT_BOOLEAN, 32, NULL, AR_G_WRITE,
4285 "Group has write access", HFILL }},
4287 { &hf_afp_dir_ar_e_search,
4288 { "Everyone has search access", "afp.dir_ar.e_search",
4289 FT_BOOLEAN, 32, NULL, AR_E_SEARCH,
4290 "Everyone has search access", HFILL }},
4292 { &hf_afp_dir_ar_e_read,
4293 { "Everyone has read access", "afp.dir_ar.e_read",
4294 FT_BOOLEAN, 32, NULL, AR_E_READ,
4295 "Everyone has read access", HFILL }},
4297 { &hf_afp_dir_ar_e_write,
4298 { "Everyone has write access", "afp.dir_ar.e_write",
4299 FT_BOOLEAN, 32, NULL, AR_E_WRITE,
4300 "Everyone has write access", HFILL }},
4302 { &hf_afp_dir_ar_u_search,
4303 { "User has search access", "afp.dir_ar.u_search",
4304 FT_BOOLEAN, 32, NULL, AR_U_SEARCH,
4305 "User has search access", HFILL }},
4307 { &hf_afp_dir_ar_u_read,
4308 { "User has read access", "afp.dir_ar.u_read",
4309 FT_BOOLEAN, 32, NULL, AR_U_READ,
4310 "User has read access", HFILL }},
4312 { &hf_afp_dir_ar_u_write,
4313 { "User has write access", "afp.dir_ar.u_write",
4314 FT_BOOLEAN, 32, NULL, AR_U_WRITE,
4315 "User has write access", HFILL }},
4317 { &hf_afp_dir_ar_blank,
4318 { "Blank access right", "afp.dir_ar.blank",
4319 FT_BOOLEAN, 32, NULL, AR_BLANK,
4320 "Blank access right", HFILL }},
4322 { &hf_afp_dir_ar_u_own,
4323 { "User is the owner", "afp.dir_ar.u_owner",
4324 FT_BOOLEAN, 32, NULL, AR_U_OWN,
4325 "Current user is the directory owner", HFILL }},
4327 { &hf_afp_server_time,
4328 { "Server time", "afp.server_time",
4329 FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x0,
4330 "Server time", HFILL }},
4332 { &hf_afp_cat_req_matches,
4333 { "Max answers", "afp.cat_req_matches",
4334 FT_INT32, BASE_DEC, NULL, 0x0,
4335 "Maximum number of matches to return.", HFILL }},
4338 { "Reserved", "afp.reserved",
4339 FT_BYTES, BASE_HEX, NULL, 0x0,
4340 "Reserved", HFILL }},
4342 { &hf_afp_cat_count,
4343 { "Cat count", "afp.cat_count",
4344 FT_UINT32, BASE_DEC, NULL, 0x0,
4345 "Number of structures returned", HFILL }},
4347 { &hf_afp_cat_position,
4348 { "Position", "afp.cat_position",
4349 FT_BYTES, BASE_HEX, NULL, 0x0,
4350 "Reserved", HFILL }},
4353 { &hf_afp_map_name_type,
4354 { "Type", "afp.map_name_type",
4355 FT_UINT8, BASE_DEC, VALS(map_name_type_vals), 0x0,
4356 "Map name type", HFILL }},
4358 { &hf_afp_map_id_type,
4359 { "Type", "afp.map_id_type",
4360 FT_UINT8, BASE_DEC, VALS(map_id_type_vals), 0x0,
4361 "Map ID type", HFILL }},
4364 { "ID", "afp.map_id",
4365 FT_UINT32, BASE_DEC, NULL, 0x0,
4366 "User/Group ID", HFILL }},
4369 { "Name", "afp.map_name",
4370 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
4371 "User/Group name", HFILL }},
4374 { &hf_afp_lock_offset64,
4375 { "Offset", "afp.lock_offset64",
4376 FT_INT64, BASE_DEC, NULL, 0x0,
4377 "First byte to be locked (64 bits)", HFILL }},
4379 { &hf_afp_lock_len64,
4380 { "Length", "afp.lock_len64",
4381 FT_INT64, BASE_DEC, NULL, 0x0,
4382 "Number of bytes to be locked/unlocked (64 bits)", HFILL }},
4384 { &hf_afp_lock_range_start64,
4385 { "Start", "afp.lock_range_start64",
4386 FT_INT64, BASE_DEC, NULL, 0x0,
4387 "First byte locked/unlocked (64 bits)", HFILL }},
4390 { "Offset", "afp.offset64",
4391 FT_INT64, BASE_DEC, NULL, 0x0,
4392 "Offset (64 bits)", HFILL }},
4394 { &hf_afp_rw_count64,
4395 { "Count", "afp.rw_count64",
4396 FT_INT64, BASE_DEC, NULL, 0x0,
4397 "Number of bytes to be read/written (64 bits)", HFILL }},
4399 { &hf_afp_last_written64,
4400 { "Last written", "afp.last_written64",
4401 FT_UINT64, BASE_DEC, NULL, 0x0,
4402 "Offset of the last byte written (64 bits)", HFILL }},
4404 { &hf_afp_ofork_len64,
4405 { "New length", "afp.ofork_len64",
4406 FT_INT64, BASE_DEC, NULL, 0x0,
4407 "New length (64 bits)", HFILL }},
4408 { &hf_afp_session_token_type,
4409 { "Type", "afp.session_token_type",
4410 FT_UINT16, BASE_HEX, NULL, 0x0,
4411 "Session token type", HFILL }},
4413 /* FIXME FT_UINT32 in specs */
4414 { &hf_afp_session_token_len,
4415 { "Len", "afp.session_token_len",
4416 FT_UINT16, BASE_DEC, NULL, 0x0,
4417 "Session token length", HFILL }},
4419 { &hf_afp_session_token,
4420 { "Token", "afp.session_token",
4421 FT_BYTES, BASE_HEX, NULL, 0x0,
4422 "Session token", HFILL }},
4424 { &hf_afp_user_flag,
4425 { "Flag", "afp.user_flag",
4426 FT_UINT8, BASE_HEX, VALS(user_flag_vals), 0x01,
4427 "User Info flag", HFILL }},
4430 { "User ID", "afp.user_ID",
4431 FT_UINT32, BASE_DEC, NULL, 0x0,
4432 "User ID", HFILL }},
4435 { "Group ID", "afp.group_ID",
4436 FT_UINT32, BASE_DEC, NULL, 0x0,
4437 "Group ID", HFILL }},
4439 { &hf_afp_user_bitmap,
4440 { "Bitmap", "afp.user_bitmap",
4441 FT_UINT16, BASE_HEX, NULL, 0,
4442 "User Info bitmap", HFILL }},
4444 { &hf_afp_user_bitmap_UID,
4445 { "User ID", "afp.user_bitmap.UID",
4446 FT_BOOLEAN, 16, NULL, 0x01,
4447 "User ID", HFILL }},
4449 { &hf_afp_user_bitmap_GID,
4450 { "Primary group ID", "afp.user_bitmap.GID",
4451 FT_BOOLEAN, 16, NULL, 0x02,
4452 "Primary group ID", HFILL }},
4455 static gint *ett[] = {
4457 &ett_afp_server_vol,
4460 &ett_afp_vol_bitmap,
4461 &ett_afp_vol_attribute,
4462 &ett_afp_dir_bitmap,
4463 &ett_afp_file_bitmap,
4464 &ett_afp_unix_privs,
4466 &ett_afp_enumerate_line,
4467 &ett_afp_access_mode,
4468 &ett_afp_dir_attribute,
4469 &ett_afp_file_attribute,
4471 &ett_afp_lock_flags,
4473 &ett_afp_cat_search,
4474 &ett_afp_cat_r_bitmap,
4477 &ett_afp_user_bitmap,
4480 proto_afp = proto_register_protocol("AppleTalk Filing Protocol", "AFP", "afp");
4481 proto_register_field_array(proto_afp, hf, array_length(hf));
4482 proto_register_subtree_array(ett, array_length(ett));
4484 register_init_routine( &afp_reinit);
4486 register_dissector("afp", dissect_afp, proto_afp);
4487 data_handle = find_dissector("data");
4491 proto_reg_handoff_afp(void)
4493 data_handle = find_dissector("data");
4496 /* -------------------------------