2 * Routines for dsi packet dissection
3 * Copyright 2001, Randy McEoin <rmceoin@pe.com>
5 * $Id: packet-dsi.c,v 1.26 2003/04/15 05:45:02 guy Exp $
7 * Ethereal - Network traffic analyzer
8 * By Gerald Combs <gerald@ethereal.com>
9 * Copyright 1998 Gerald Combs
11 * Copied from packet-pop.c
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 #include <epan/packet.h>
38 #include "packet-tcp.h"
39 #include "packet-afp.h"
41 /* The information in this module (DSI) comes from:
43 AFP 2.1 & 2.2.pdf contained in AppleShare_IP_6.3_SDK
44 available from http://www.apple.com
46 The netatalk source code by Wesley Craig & Adrian Sun
48 * What a Data Stream Interface packet looks like:
50 * |-------------------------------|
51 * |flags |command| requestID |
52 * |-------------------------------|
53 * |error code/enclosed data offset|
54 * |-------------------------------|
55 * |total data length |
56 * |-------------------------------|
58 * |-------------------------------|
61 static int proto_dsi = -1;
62 static int hf_dsi_flags = -1;
63 static int hf_dsi_command = -1;
64 static int hf_dsi_requestid = -1;
65 static int hf_dsi_offset = -1;
66 static int hf_dsi_error = -1;
67 static int hf_dsi_length = -1;
68 static int hf_dsi_reserved = -1;
70 static gint ett_dsi = -1;
72 static int hf_dsi_open_type = -1;
73 static int hf_dsi_open_len = -1;
74 static int hf_dsi_open_quantum = -1;
75 static int hf_dsi_open_option = -1;
77 static int hf_dsi_attn_flag = -1;
78 static int hf_dsi_attn_flag_shutdown = -1;
79 static int hf_dsi_attn_flag_crash = -1;
80 static int hf_dsi_attn_flag_msg = -1;
81 static int hf_dsi_attn_flag_reconnect = -1;
82 static int hf_dsi_attn_flag_time = -1;
83 static int hf_dsi_attn_flag_bitmap = -1;
85 static gint ett_dsi_open = -1;
86 static gint ett_dsi_attn = -1;
87 static gint ett_dsi_attn_flag = -1;
89 static const value_string dsi_attn_flag_vals[] = {
90 {0x0, "Reserved" }, /* 0000 */
91 {0x1, "Reserved" }, /* 0001 */
92 {0x2, "Server message" }, /* 0010 */
93 {0x3, "Server notification, cf. extended bitmap" }, /* 0011 */
94 {0x4, "Server is shutting down, internal error" }, /* 0100 */
95 {0x8, "Server is shutting down" }, /* 1000 */
96 {0x9, "Server disconnects user" }, /* 1001 */
97 {0x10,"Server is shutting down, message" }, /* 1010 */
98 {0x11,"Server is shutting down, message,no reconnect"}, /* 1011 */
101 static const value_string dsi_open_type_vals[] = {
102 {0, "Server quantum" },
103 {1, "Attention quantum" },
106 /* status stuff same for asp and afp */
107 static int hf_dsi_server_name = -1;
108 static int hf_dsi_utf8_server_name_len = -1;
109 static int hf_dsi_utf8_server_name = -1;
110 static int hf_dsi_server_type = -1;
111 static int hf_dsi_server_vers = -1;
112 static int hf_dsi_server_uams = -1;
113 static int hf_dsi_server_icon = -1;
114 static int hf_dsi_server_directory = -1;
116 static int hf_dsi_server_flag = -1;
117 static int hf_dsi_server_flag_copyfile = -1;
118 static int hf_dsi_server_flag_passwd = -1;
119 static int hf_dsi_server_flag_no_save_passwd = -1;
120 static int hf_dsi_server_flag_srv_msg = -1;
121 static int hf_dsi_server_flag_srv_sig = -1;
122 static int hf_dsi_server_flag_tcpip = -1;
123 static int hf_dsi_server_flag_notify = -1;
124 static int hf_dsi_server_flag_reconnect = -1;
125 static int hf_dsi_server_flag_directory = -1;
126 static int hf_dsi_server_flag_utf8_name = -1;
127 static int hf_dsi_server_flag_fast_copy = -1;
128 static int hf_dsi_server_signature = -1;
130 static int hf_dsi_server_addr_len = -1;
131 static int hf_dsi_server_addr_type = -1;
132 static int hf_dsi_server_addr_value = -1;
134 static gint ett_dsi_status = -1;
135 static gint ett_dsi_uams = -1;
136 static gint ett_dsi_vers = -1;
137 static gint ett_dsi_addr = -1;
138 static gint ett_dsi_addr_line = -1;
139 static gint ett_dsi_directory = -1;
140 static gint ett_dsi_utf8_name = -1;
141 static gint ett_dsi_status_server_flag = -1;
143 const value_string afp_server_addr_type_vals[] = {
145 {2, "IP+port address" },
148 {5, "IP+port ssh tunnel" },
151 /* end status stuff */
153 /* desegmentation of DSI */
154 static gboolean dsi_desegment = TRUE;
156 static dissector_handle_t data_handle;
157 static dissector_handle_t afp_handle;
159 #define TCP_PORT_DSI 548
161 #define DSI_BLOCKSIZ 16
164 #define DSIFL_REQUEST 0x00
165 #define DSIFL_REPLY 0x01
166 #define DSIFL_MAX 0x01
169 #define DSIFUNC_CLOSE 1 /* DSICloseSession */
170 #define DSIFUNC_CMD 2 /* DSICommand */
171 #define DSIFUNC_STAT 3 /* DSIGetStatus */
172 #define DSIFUNC_OPEN 4 /* DSIOpenSession */
173 #define DSIFUNC_TICKLE 5 /* DSITickle */
174 #define DSIFUNC_WRITE 6 /* DSIWrite */
175 #define DSIFUNC_ATTN 8 /* DSIAttention */
176 #define DSIFUNC_MAX 8 /* largest command */
178 static const value_string flag_vals[] = {
179 {DSIFL_REQUEST, "Request" },
180 {DSIFL_REPLY, "Reply" },
183 static const value_string func_vals[] = {
184 {DSIFUNC_CLOSE, "CloseSession" },
185 {DSIFUNC_CMD, "Command" },
186 {DSIFUNC_STAT, "GetStatus" },
187 {DSIFUNC_OPEN, "OpenSession" },
188 {DSIFUNC_TICKLE, "Tickle" },
189 {DSIFUNC_WRITE, "Write" },
190 {DSIFUNC_ATTN, "Attention" },
194 dissect_dsi_open_session(tvbuff_t *tvb, proto_tree *dsi_tree, gint offset)
201 ti = proto_tree_add_text(dsi_tree, tvb, offset, -1, "Open Session");
202 tree = proto_item_add_subtree(ti, ett_dsi_open);
203 type = tvb_get_guint8(tvb, offset);
204 proto_tree_add_item(tree, hf_dsi_open_type, tvb, offset, 1, FALSE);
206 len = tvb_get_guint8(tvb, offset);
207 proto_tree_add_item(tree, hf_dsi_open_len, tvb, offset, 1, FALSE);
210 proto_tree_add_item(tree, hf_dsi_open_quantum, tvb, offset, 4, FALSE);
213 proto_tree_add_item(tree, hf_dsi_open_option, tvb, offset, len, FALSE);
220 dissect_dsi_attention(tvbuff_t *tvb, proto_tree *dsi_tree, gint offset)
226 if (!tvb_reported_length_remaining(tvb,offset))
229 flag = tvb_get_ntohs(tvb, offset);
230 ti = proto_tree_add_text(dsi_tree, tvb, offset, -1, "Attention");
231 tree = proto_item_add_subtree(ti, ett_dsi_attn);
233 ti = proto_tree_add_item(tree, hf_dsi_attn_flag, tvb, offset, 2, FALSE);
234 tree = proto_item_add_subtree(ti, ett_dsi_attn_flag);
235 proto_tree_add_item(tree, hf_dsi_attn_flag_shutdown, tvb, offset, 2, FALSE);
236 proto_tree_add_item(tree, hf_dsi_attn_flag_crash, tvb, offset, 2, FALSE);
237 proto_tree_add_item(tree, hf_dsi_attn_flag_msg, tvb, offset, 2, FALSE);
238 proto_tree_add_item(tree, hf_dsi_attn_flag_reconnect, tvb, offset, 2, FALSE);
240 if ((flag & 0xf000) != 0x3000)
241 proto_tree_add_item(tree, hf_dsi_attn_flag_time, tvb, offset, 2, FALSE);
243 proto_tree_add_item(tree, hf_dsi_attn_flag_bitmap, tvb, offset, 2, FALSE);
248 /* -----------------------------
249 from netatalk/etc/afpd/status.c
252 dissect_dsi_reply_get_status(tvbuff_t *tvb, proto_tree *tree, gint offset)
254 proto_tree *sub_tree;
259 guint16 sign_ofs = 0;
270 ti = proto_tree_add_text(tree, tvb, offset, -1, "Get Status");
271 tree = proto_item_add_subtree(ti, ett_dsi_status);
273 ofs = tvb_get_ntohs(tvb, offset +AFPSTATUS_MACHOFF);
274 proto_tree_add_text(tree, tvb, offset +AFPSTATUS_MACHOFF, 2, "Machine offset: %d", ofs);
276 ofs = tvb_get_ntohs(tvb, offset +AFPSTATUS_VERSOFF);
277 proto_tree_add_text(tree, tvb, offset +AFPSTATUS_VERSOFF, 2, "Version offset: %d", ofs);
279 ofs = tvb_get_ntohs(tvb, offset +AFPSTATUS_UAMSOFF);
280 proto_tree_add_text(tree, tvb, offset +AFPSTATUS_UAMSOFF, 2, "UAMS offset: %d", ofs);
282 ofs = tvb_get_ntohs(tvb, offset +AFPSTATUS_ICONOFF);
283 proto_tree_add_text(tree, tvb, offset +AFPSTATUS_ICONOFF, 2, "Icon offset: %d", ofs);
285 ofs = offset +AFPSTATUS_FLAGOFF;
286 ti = proto_tree_add_item(tree, hf_dsi_server_flag, tvb, ofs, 2, FALSE);
287 sub_tree = proto_item_add_subtree(ti, ett_dsi_status_server_flag);
288 proto_tree_add_item(sub_tree, hf_dsi_server_flag_copyfile , tvb, ofs, 2, FALSE);
289 proto_tree_add_item(sub_tree, hf_dsi_server_flag_passwd , tvb, ofs, 2, FALSE);
290 proto_tree_add_item(sub_tree, hf_dsi_server_flag_no_save_passwd, tvb, ofs, 2, FALSE);
291 proto_tree_add_item(sub_tree, hf_dsi_server_flag_srv_msg , tvb, ofs, 2, FALSE);
292 proto_tree_add_item(sub_tree, hf_dsi_server_flag_srv_sig , tvb, ofs, 2, FALSE);
293 proto_tree_add_item(sub_tree, hf_dsi_server_flag_tcpip , tvb, ofs, 2, FALSE);
294 proto_tree_add_item(sub_tree, hf_dsi_server_flag_notify , tvb, ofs, 2, FALSE);
295 proto_tree_add_item(sub_tree, hf_dsi_server_flag_reconnect , tvb, ofs, 2, FALSE);
296 proto_tree_add_item(sub_tree, hf_dsi_server_flag_directory , tvb, ofs, 2, FALSE);
297 proto_tree_add_item(sub_tree, hf_dsi_server_flag_utf8_name , tvb, ofs, 2, FALSE);
298 proto_tree_add_item(sub_tree, hf_dsi_server_flag_fast_copy , tvb, ofs, 2, FALSE);
300 proto_tree_add_item(tree, hf_dsi_server_name, tvb, offset +AFPSTATUS_PRELEN, 1, FALSE);
302 flag = tvb_get_ntohs(tvb, ofs);
303 if ((flag & AFPSRVRINFO_SRVSIGNATURE)) {
304 ofs = offset +AFPSTATUS_PRELEN +tvb_get_guint8(tvb, offset +AFPSTATUS_PRELEN) +1;
308 sign_ofs = tvb_get_ntohs(tvb, ofs);
309 proto_tree_add_text(tree, tvb, ofs, 2, "Signature offset: %d", sign_ofs);
312 if ((flag & AFPSRVRINFO_TCPIP)) {
314 adr_ofs = tvb_get_ntohs(tvb, ofs);
315 proto_tree_add_text(tree, tvb, ofs, 2, "Network address offset: %d", adr_ofs);
319 if ((flag & AFPSRVRINFO_SRVDIRECTORY)) {
321 dir_ofs = tvb_get_ntohs(tvb, ofs);
322 proto_tree_add_text(tree, tvb, ofs, 2, "Directory services offset: %d", dir_ofs);
325 if ((flag & AFPSRVRINFO_SRVUTF8)) {
327 utf_ofs = tvb_get_ntohs(tvb, ofs);
328 proto_tree_add_text(tree, tvb, ofs, 2, "UTF8 server name offset: %d", utf_ofs);
333 ofs = offset +tvb_get_ntohs(tvb, offset +AFPSTATUS_MACHOFF);
335 proto_tree_add_item(tree, hf_dsi_server_type, tvb, ofs, 1, FALSE);
337 ofs = offset +tvb_get_ntohs(tvb, offset +AFPSTATUS_VERSOFF);
339 nbe = tvb_get_guint8(tvb, ofs);
340 ti = proto_tree_add_text(tree, tvb, ofs, 1, "Version list: %d", nbe);
342 sub_tree = proto_item_add_subtree(ti, ett_dsi_vers);
343 for (i = 0; i < nbe; i++) {
344 len = tvb_get_guint8(tvb, ofs) +1;
345 proto_tree_add_item(sub_tree, hf_dsi_server_vers, tvb, ofs, 1, FALSE);
350 ofs = offset +tvb_get_ntohs(tvb, offset +AFPSTATUS_UAMSOFF);
352 nbe = tvb_get_guint8(tvb, ofs);
353 ti = proto_tree_add_text(tree, tvb, ofs, 1, "UAMS list: %d", nbe);
355 sub_tree = proto_item_add_subtree(ti, ett_dsi_uams);
356 for (i = 0; i < nbe; i++) {
357 len = tvb_get_guint8(tvb, ofs) +1;
358 proto_tree_add_item(sub_tree, hf_dsi_server_uams, tvb, ofs, 1, FALSE);
363 ofs = offset +tvb_get_ntohs(tvb, offset +AFPSTATUS_ICONOFF);
365 proto_tree_add_item(tree, hf_dsi_server_icon, tvb, ofs, 256, FALSE);
368 proto_tree_add_item(tree, hf_dsi_server_signature, tvb, sign_ofs, 16, FALSE);
372 proto_tree *adr_tree;
380 nbe = tvb_get_guint8(tvb, ofs);
381 ti = proto_tree_add_text(tree, tvb, ofs, 1, "Address list: %d", nbe);
383 adr_tree = proto_item_add_subtree(ti, ett_dsi_addr);
384 for (i = 0; i < nbe; i++) {
387 len = tvb_get_guint8(tvb, ofs);
388 type = tvb_get_guint8(tvb, ofs +1);
391 ip = tvb_get_ptr(tvb, ofs+2, 4);
392 ti = proto_tree_add_text(adr_tree, tvb, ofs, len, "ip: %s", ip_to_str(ip));
394 case 2: /* IP + port */
395 ip = tvb_get_ptr(tvb, ofs+2, 4);
396 port = tvb_get_ntohs(tvb, ofs+6);
397 ti = proto_tree_add_text(adr_tree, tvb, ofs, len, "ip %s:%d",ip_to_str(ip),port);
399 case 3: /* DDP, atalk_addr_to_str want host order not network */
400 net = tvb_get_ntohs(tvb, ofs+2);
401 node = tvb_get_guint8(tvb, ofs +4);
402 port = tvb_get_guint8(tvb, ofs +5);
403 ti = proto_tree_add_text(adr_tree, tvb, ofs, len, "ddp: %u.%u:%u",
407 case 5: /* SSH tunnel */
409 tmp = g_malloc( len -1);
410 tvb_memcpy(tvb, tmp, ofs +2, len -2);
412 ti = proto_tree_add_text(adr_tree, tvb, ofs, len, "%s: %s",
413 (type==4)?"dns":"ssh tunnel", tmp);
418 ti = proto_tree_add_text(adr_tree, tvb, ofs, len,"Malformed address type %d", type);
422 ti = proto_tree_add_text(adr_tree, tvb, ofs, len,"Unknow type : %d", type);
426 sub_tree = proto_item_add_subtree(ti,ett_dsi_addr_line);
427 proto_tree_add_item(sub_tree, hf_dsi_server_addr_len, tvb, ofs, 1, FALSE);
429 proto_tree_add_item(sub_tree, hf_dsi_server_addr_type, tvb, ofs, 1, FALSE);
431 proto_tree_add_item(sub_tree, hf_dsi_server_addr_value,tvb, ofs, len, FALSE);
438 nbe = tvb_get_guint8(tvb, ofs);
439 ti = proto_tree_add_text(tree, tvb, ofs, 1, "Directory services list: %d", nbe);
441 sub_tree = proto_item_add_subtree(ti, ett_dsi_directory);
442 for (i = 0; i < nbe; i++) {
443 len = tvb_get_guint8(tvb, ofs) +1;
444 proto_tree_add_item(sub_tree, hf_dsi_server_directory, tvb, ofs, 1, FALSE);
453 ulen = tvb_get_ntohs(tvb, ofs);
455 tmp = g_malloc( ulen);
456 tvb_memcpy(tvb, tmp, ofs +2, ulen);
459 ti = proto_tree_add_text(tree, tvb, ofs, ulen +2, "UTF8 server name: %s", (tmp)?tmp:"");
463 sub_tree = proto_item_add_subtree(ti, ett_dsi_utf8_name);
464 proto_tree_add_item( sub_tree, hf_dsi_utf8_server_name_len, tvb, ofs, 2,FALSE);
466 proto_tree_add_item(sub_tree, hf_dsi_utf8_server_name, tvb, ofs, ulen,FALSE);
473 dissect_dsi_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
475 proto_tree *dsi_tree;
477 guint8 dsi_flags,dsi_command;
478 guint16 dsi_requestid;
481 guint32 dsi_reserved;
482 struct aspinfo aspinfo;
484 if (check_col(pinfo->cinfo, COL_PROTOCOL))
485 col_set_str(pinfo->cinfo, COL_PROTOCOL, "DSI");
486 if (check_col(pinfo->cinfo, COL_INFO))
487 col_clear(pinfo->cinfo, COL_INFO);
489 dsi_flags = tvb_get_guint8(tvb, 0);
490 dsi_command = tvb_get_guint8(tvb, 1);
491 dsi_requestid = tvb_get_ntohs(tvb, 2);
492 dsi_code = tvb_get_ntohl(tvb, 4);
493 dsi_length = tvb_get_ntohl(tvb, 8);
494 dsi_reserved = tvb_get_ntohl(tvb, 12);
496 if (check_col(pinfo->cinfo, COL_INFO)) {
497 col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s (%u)",
498 val_to_str(dsi_flags, flag_vals,
499 "Unknown flag (0x%02x)"),
500 val_to_str(dsi_command, func_vals,
501 "Unknown function (0x%02x)"),
507 ti = proto_tree_add_item(tree, proto_dsi, tvb, 0, -1, FALSE);
508 dsi_tree = proto_item_add_subtree(ti, ett_dsi);
510 proto_tree_add_uint(dsi_tree, hf_dsi_flags, tvb,
512 proto_tree_add_uint(dsi_tree, hf_dsi_command, tvb,
514 proto_tree_add_uint(dsi_tree, hf_dsi_requestid, tvb,
515 2, 2, dsi_requestid);
519 proto_tree_add_int(dsi_tree, hf_dsi_offset, tvb,
524 proto_tree_add_int(dsi_tree, hf_dsi_error, tvb,
528 proto_tree_add_uint_format(dsi_tree, hf_dsi_length, tvb,
530 "Length: %u bytes", dsi_length);
531 proto_tree_add_uint(dsi_tree, hf_dsi_reserved, tvb,
532 12, 4, dsi_reserved);
536 switch (dsi_command) {
539 dissect_dsi_open_session(tvb, dsi_tree, DSI_BLOCKSIZ);
544 dissect_dsi_attention(tvb, dsi_tree, DSI_BLOCKSIZ);
548 if (tree && (dsi_flags == DSIFL_REPLY)) {
549 dissect_dsi_reply_get_status(tvb, dsi_tree, DSI_BLOCKSIZ);
556 int len = tvb_reported_length_remaining(tvb,DSI_BLOCKSIZ);
558 aspinfo.reply = (dsi_flags == DSIFL_REPLY);
559 aspinfo.command = dsi_command;
560 aspinfo.seq = dsi_requestid;
561 aspinfo.code = dsi_code;
562 pinfo->private_data = &aspinfo;
563 proto_item_set_len(dsi_tree, DSI_BLOCKSIZ);
565 new_tvb = tvb_new_subset(tvb, DSI_BLOCKSIZ,-1,len);
566 call_dissector(afp_handle, new_tvb, pinfo, tree);
571 call_dissector(data_handle,
572 tvb_new_subset(tvb, DSI_BLOCKSIZ, -1, -1),
580 get_dsi_pdu_len(tvbuff_t *tvb, int offset)
585 * Get the length of the DSI packet.
587 plen = tvb_get_ntohl(tvb, offset+8);
590 * That length doesn't include the length of the header itself;
597 dissect_dsi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
599 tcp_dissect_pdus(tvb, pinfo, tree, dsi_desegment, 12,
600 get_dsi_pdu_len, dissect_dsi_packet);
604 proto_register_dsi(void)
607 static hf_register_info hf[] = {
609 { "Flags", "dsi.flags",
610 FT_UINT8, BASE_HEX, VALS(flag_vals), 0x0,
611 "Indicates request or reply.", HFILL }},
614 { "Command", "dsi.command",
615 FT_UINT8, BASE_DEC, VALS(func_vals), 0x0,
616 "Represents a DSI command.", HFILL }},
619 { "Request ID", "dsi.requestid",
620 FT_UINT16, BASE_DEC, NULL, 0x0,
621 "Keeps track of which request this is. Replies must match a Request. IDs must be generated in sequential order.", HFILL }},
624 { "Data offset", "dsi.data_offset",
625 FT_INT32, BASE_DEC, NULL, 0x0,
626 "Data offset", HFILL }},
629 { "Error code", "dsi.error_code",
630 FT_INT32, BASE_DEC, VALS(asp_error_vals), 0x0,
631 "Error code", HFILL }},
634 { "Length", "dsi.length",
635 FT_UINT32, BASE_DEC, NULL, 0x0,
636 "Total length of the data that follows the DSI header.", HFILL }},
639 { "Reserved", "dsi.reserved",
640 FT_UINT32, BASE_HEX, NULL, 0x0,
641 "Reserved for future use. Should be set to zero.", HFILL }},
643 { &hf_dsi_utf8_server_name_len,
644 { "Length", "dsi.utf8_server_name_len",
645 FT_UINT16, BASE_DEC, NULL, 0x0,
646 "UTF8 server name length.", HFILL }},
647 { &hf_dsi_utf8_server_name,
648 { "UTF8 Server name", "dsi.utf8_server_name",
649 FT_STRING, BASE_NONE, NULL, 0x0,
650 "UTF8 Server name", HFILL }},
652 { &hf_dsi_server_name,
653 { "Server name", "dsi.server_name",
654 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
655 "Server name", HFILL }},
657 { &hf_dsi_server_type,
658 { "Server type", "dsi.server_type",
659 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
660 "Server type", HFILL }},
662 { &hf_dsi_server_vers,
663 { "AFP version", "dsi.server_vers",
664 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
665 "AFP version", HFILL }},
667 { &hf_dsi_server_uams,
668 { "UAM", "dsi.server_uams",
669 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
672 { &hf_dsi_server_icon,
673 { "Icon bitmap", "dsi.server_icon",
674 FT_BYTES, BASE_HEX, NULL, 0x0,
675 "Server icon bitmap", HFILL }},
677 { &hf_dsi_server_directory,
678 { "Directory service", "dsi.server_directory",
679 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
680 "Server directory service", HFILL }},
682 { &hf_dsi_server_signature,
683 { "Server signature", "dsi.server_signature",
684 FT_BYTES, BASE_HEX, NULL, 0x0,
685 "Server signature", HFILL }},
687 { &hf_dsi_server_flag,
688 { "Flag", "dsi.server_flag",
689 FT_UINT16, BASE_HEX, NULL, 0x0,
690 "Server capabilities flag", HFILL }},
691 { &hf_dsi_server_flag_copyfile,
692 { "Support copyfile", "dsi.server_flag.copyfile",
693 FT_BOOLEAN, 16, NULL, AFPSRVRINFO_COPY,
694 "Server support copyfile", HFILL }},
695 { &hf_dsi_server_flag_passwd,
696 { "Support change password", "dsi.server_flag.passwd",
697 FT_BOOLEAN, 16, NULL, AFPSRVRINFO_PASSWD,
698 "Server support change password", HFILL }},
699 { &hf_dsi_server_flag_no_save_passwd,
700 { "Don't allow save password", "dsi.server_flag.no_save_passwd",
701 FT_BOOLEAN, 16, NULL, AFPSRVRINFO_NOSAVEPASSWD,
702 "Don't allow save password", HFILL }},
703 { &hf_dsi_server_flag_srv_msg,
704 { "Support server message", "dsi.server_flag.srv_msg",
705 FT_BOOLEAN, 16, NULL, AFPSRVRINFO_SRVMSGS,
706 "Support server message", HFILL }},
707 { &hf_dsi_server_flag_srv_sig,
708 { "Support server signature", "dsi.server_flag.srv_sig",
709 FT_BOOLEAN, 16, NULL, AFPSRVRINFO_SRVSIGNATURE,
710 "Support server signature", HFILL }},
711 { &hf_dsi_server_flag_tcpip,
712 { "Support TCP/IP", "dsi.server_flag.tcpip",
713 FT_BOOLEAN, 16, NULL, AFPSRVRINFO_TCPIP,
714 "Server support TCP/IP", HFILL }},
715 { &hf_dsi_server_flag_notify,
716 { "Support server notifications", "dsi.server_flag.notify",
717 FT_BOOLEAN, 16, NULL, AFPSRVRINFO_SRVNOTIFY,
718 "Server support notifications", HFILL }},
719 { &hf_dsi_server_flag_reconnect,
720 { "Support server reconnect", "dsi.server_flag.reconnect",
721 FT_BOOLEAN, 16, NULL, AFPSRVRINFO_SRVRECONNECT,
722 "Server support reconnect", HFILL }},
723 { &hf_dsi_server_flag_directory,
724 { "Support directory services", "dsi.server_flag.directory",
725 FT_BOOLEAN, 16, NULL, AFPSRVRINFO_SRVDIRECTORY,
726 "Server support directory services", HFILL }},
727 { &hf_dsi_server_flag_utf8_name,
728 { "Support UTF8 server name", "dsi.server_flag.utf8_name",
729 FT_BOOLEAN, 16, NULL, AFPSRVRINFO_SRVUTF8,
730 "Server support UTF8 server name", HFILL }},
731 { &hf_dsi_server_flag_fast_copy,
732 { "Support fast copy", "dsi.server_flag.fast_copy",
733 FT_BOOLEAN, 16, NULL, AFPSRVRINFO_FASTBOZO,
734 "Server support fast copy", HFILL }},
737 { &hf_dsi_server_addr_len,
738 { "Length", "dsi.server_addr.len",
739 FT_UINT8, BASE_DEC, NULL, 0x0,
740 "Address length.", HFILL }},
742 { &hf_dsi_server_addr_type,
743 { "Type", "dsi.server_addr.type",
744 FT_UINT8, BASE_DEC, VALS(afp_server_addr_type_vals), 0x0,
745 "Address type.", HFILL }},
747 { &hf_dsi_server_addr_value,
748 { "Value", "dsi.server_addr.value",
749 FT_BYTES, BASE_HEX, NULL, 0x0,
750 "Address value", HFILL }},
753 { "Flags", "dsi.open_type",
754 FT_UINT8, BASE_DEC, VALS(dsi_open_type_vals), 0x0,
755 "Open session option type.", HFILL }},
758 { "Length", "dsi.open_len",
759 FT_UINT8, BASE_DEC, NULL, 0x0,
760 "Open session option len", HFILL }},
762 { &hf_dsi_open_quantum,
763 { "Quantum", "dsi.open_quantum",
764 FT_UINT32, BASE_DEC, NULL, 0x0,
765 "Server/Attention quantum", HFILL }},
767 { &hf_dsi_open_option,
768 { "Option", "dsi.open_option",
769 FT_BYTES, BASE_HEX, NULL, 0x0,
770 "Open session options (undecoded)", HFILL }},
773 { "Flags", "dsi.attn_flag",
774 FT_UINT16, BASE_HEX, VALS(dsi_attn_flag_vals), 0xf000,
775 "Server attention flag", HFILL }},
776 { &hf_dsi_attn_flag_shutdown,
777 { "Shutdown", "dsi.attn_flag.shutdown",
778 FT_BOOLEAN, 16, NULL, 1<<15,
779 "Attention flag, server is shutting down", HFILL }},
780 { &hf_dsi_attn_flag_crash,
781 { "Crash", "dsi.attn_flag.crash",
782 FT_BOOLEAN, 16, NULL, 1<<14,
783 "Attention flag, server crash bit", HFILL }},
784 { &hf_dsi_attn_flag_msg,
785 { "Message", "dsi.attn_flag.msg",
786 FT_BOOLEAN, 16, NULL, 1<<13,
787 "Attention flag, server message bit", HFILL }},
788 { &hf_dsi_attn_flag_reconnect,
789 { "Don't reconnect", "dsi.attn_flag.reconnect",
790 FT_BOOLEAN, 16, NULL, 1<<12,
791 "Attention flag, don't reconnect bit", HFILL }},
792 { &hf_dsi_attn_flag_time,
793 { "Minutes", "dsi.attn_flag.time",
794 FT_UINT16, BASE_DEC, NULL, 0xfff,
795 "Number of minutes", HFILL }},
796 { &hf_dsi_attn_flag_bitmap,
797 { "Bitmap", "dsi.attn_flag.time",
798 FT_UINT16, BASE_HEX, NULL, 0xfff,
799 "Attention extended bitmap", HFILL }},
803 static gint *ett[] = {
810 &ett_dsi_status_server_flag,
818 module_t *dsi_module;
820 proto_dsi = proto_register_protocol("Data Stream Interface", "DSI", "dsi");
821 proto_register_field_array(proto_dsi, hf, array_length(hf));
822 proto_register_subtree_array(ett, array_length(ett));
824 dsi_module = prefs_register_protocol(proto_dsi, NULL);
825 prefs_register_bool_preference(dsi_module, "desegment",
826 "Desegment all DSI messages spanning multiple TCP segments",
827 "Whether the DSI dissector should desegment all messages spanning multiple TCP segments",
832 proto_reg_handoff_dsi(void)
834 static dissector_handle_t dsi_handle;
836 dsi_handle = create_dissector_handle(dissect_dsi, proto_dsi);
837 dissector_add("tcp.port", TCP_PORT_DSI, dsi_handle);
839 data_handle = find_dissector("data");
840 afp_handle = find_dissector("afp");