cdma2k : fix no previous prototype for function 'proto_[register|reg_handoff]_cdma2k...
[metze/wireshark/wip.git] / epan / dissectors / packet-dsi.c
index 0ac4e75e6624dc9f3ebfbc1c933b22383fb56752..d7ffc8a330ab0a122ca1633fac9e6aeba282a061 100644 (file)
@@ -8,27 +8,12 @@
  *
  * Copied from packet-pop.c
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #include "config.h"
 
-#include <glib.h>
-
 #include <epan/packet.h>
-#include <epan/to_str.h>
 #include <epan/prefs.h>
 
 #include "packet-tcp.h"
@@ -62,7 +47,6 @@ http://developer.apple.com/DOCUMENTATION/macos8/pdf/ASAppleTalkFiling2.1_2.2.pdf
  * |reserved field                 |
  * |-------------------------------|
  */
-#define INET6_ADDRLEN  16
 
 void proto_register_dsi(void);
 void proto_reg_handoff_dsi(void);
@@ -115,65 +99,13 @@ static const value_string dsi_open_type_vals[] = {
        {2,   "Replay cache size" },
        {0,                   NULL } };
 
-/* status stuff same for asp and afp */
-static int hf_dsi_server_name = -1;
-static int hf_dsi_utf8_server_name_len = -1;
-static int hf_dsi_utf8_server_name = -1;
-static int hf_dsi_server_type = -1;
-static int hf_dsi_server_vers = -1;
-static int hf_dsi_server_uams = -1;
-static int hf_dsi_server_icon = -1;
-static int hf_dsi_server_directory = -1;
-
-static int hf_dsi_server_flag = -1;
-static int hf_dsi_server_flag_copyfile = -1;
-static int hf_dsi_server_flag_passwd   = -1;
-static int hf_dsi_server_flag_no_save_passwd = -1;
-static int hf_dsi_server_flag_srv_msg   = -1;
-static int hf_dsi_server_flag_srv_sig   = -1;
-static int hf_dsi_server_flag_tcpip     = -1;
-static int hf_dsi_server_flag_notify    = -1;
-static int hf_dsi_server_flag_reconnect = -1;
-static int hf_dsi_server_flag_directory = -1;
-static int hf_dsi_server_flag_utf8_name = -1;
-static int hf_dsi_server_flag_uuid      = -1;
-static int hf_dsi_server_flag_ext_sleep = -1;
-static int hf_dsi_server_flag_fast_copy = -1;
-static int hf_dsi_server_signature      = -1;
-
-static int hf_dsi_server_addr_len       = -1;
-static int hf_dsi_server_addr_type      = -1;
-static int hf_dsi_server_addr_value     = -1;
-
-static gint ett_dsi_status = -1;
-static gint ett_dsi_uams   = -1;
-static gint ett_dsi_vers   = -1;
-static gint ett_dsi_addr   = -1;
-static gint ett_dsi_addr_line = -1;
-static gint ett_dsi_directory = -1;
-static gint ett_dsi_utf8_name = -1;
-static gint ett_dsi_status_server_flag = -1;
-
-static const value_string afp_server_addr_type_vals[] = {
-       {1,   "IP address" },
-       {2,   "IP+port address" },
-       {3,   "DDP address" },
-       {4,   "DNS name" },
-       {5,   "IP+port ssh tunnel" },
-       {6,   "IP6 address" },
-       {7,   "IP6+port address" },
-       {0,   NULL } };
-value_string_ext afp_server_addr_type_vals_ext = VALUE_STRING_EXT_INIT(afp_server_addr_type_vals);
-
-/* end status stuff */
-
 /* desegmentation of DSI */
 static gboolean dsi_desegment = TRUE;
 
-static dissector_handle_t data_handle;
 static dissector_handle_t afp_handle;
+static dissector_handle_t afp_server_status_handle;
 
-#define TCP_PORT_DSI      548
+#define TCP_PORT_DSI      548 /* Not IANA registered */
 
 #define DSI_BLOCKSIZ       16
 
@@ -213,12 +145,10 @@ static gint
 dissect_dsi_open_session(tvbuff_t *tvb, proto_tree *dsi_tree, gint offset, gint dsi_length)
 {
        proto_tree      *tree;
-       proto_item      *ti;
        guint8          type;
        guint8          len;
 
-       ti = proto_tree_add_text(dsi_tree, tvb, offset, -1, "Open Session");
-       tree = proto_item_add_subtree(ti, ett_dsi_open);
+       tree = proto_tree_add_subtree(dsi_tree, tvb, offset, -1, ett_dsi_open, NULL, "Open Session");
 
        while( dsi_length >2 ) {
 
@@ -260,8 +190,7 @@ dissect_dsi_attention(tvbuff_t *tvb, proto_tree *dsi_tree, gint offset)
                return offset;
 
        flag = tvb_get_ntohs(tvb, offset);
-       ti = proto_tree_add_text(dsi_tree, tvb, offset, -1, "Attention");
-       tree = proto_item_add_subtree(ti, ett_dsi_attn);
+       tree = proto_tree_add_subtree(dsi_tree, tvb, offset, -1, ett_dsi_attn, NULL, "Attention");
 
        ti = proto_tree_add_item(tree, hf_dsi_attn_flag, tvb, offset, 2, ENC_BIG_ENDIAN);
        tree = proto_item_add_subtree(ti, ett_dsi_attn_flag);
@@ -278,246 +207,15 @@ dissect_dsi_attention(tvbuff_t *tvb, proto_tree *dsi_tree, gint offset)
        return offset;
 }
 
-/* -----------------------------
-       from netatalk/etc/afpd/status.c
-*/
-static gint
-dissect_dsi_reply_get_status(tvbuff_t *tvb, proto_tree *tree, gint offset)
-{
-       proto_tree      *sub_tree;
-       proto_item      *ti;
-
-       guint16 ofs;
-       guint16 flag;
-       guint16 sign_ofs = 0;
-       guint16 adr_ofs = 0;
-       guint16 dir_ofs = 0;
-       guint16 utf_ofs = 0;
-       guint8  nbe;
-       guint8  len;
-       guint8  i;
-
-       if (!tree)
-               return offset;
-
-       ti = proto_tree_add_text(tree, tvb, offset, -1, "Get Status");
-       tree = proto_item_add_subtree(ti, ett_dsi_status);
-
-       ofs = tvb_get_ntohs(tvb, offset +AFPSTATUS_MACHOFF);
-       proto_tree_add_text(tree, tvb, offset +AFPSTATUS_MACHOFF, 2, "Machine offset: %d", ofs);
-
-       ofs = tvb_get_ntohs(tvb, offset +AFPSTATUS_VERSOFF);
-       proto_tree_add_text(tree, tvb, offset +AFPSTATUS_VERSOFF, 2, "Version offset: %d", ofs);
-
-       ofs = tvb_get_ntohs(tvb, offset +AFPSTATUS_UAMSOFF);
-       proto_tree_add_text(tree, tvb, offset +AFPSTATUS_UAMSOFF, 2, "UAMS offset: %d", ofs);
-
-       ofs = tvb_get_ntohs(tvb, offset +AFPSTATUS_ICONOFF);
-       proto_tree_add_text(tree, tvb, offset +AFPSTATUS_ICONOFF, 2, "Icon offset: %d", ofs);
-
-       ofs = offset +AFPSTATUS_FLAGOFF;
-       ti = proto_tree_add_item(tree, hf_dsi_server_flag, tvb, ofs, 2, ENC_BIG_ENDIAN);
-       sub_tree = proto_item_add_subtree(ti, ett_dsi_status_server_flag);
-       proto_tree_add_item(sub_tree, hf_dsi_server_flag_copyfile      , tvb, ofs, 2, ENC_BIG_ENDIAN);
-       proto_tree_add_item(sub_tree, hf_dsi_server_flag_passwd        , tvb, ofs, 2, ENC_BIG_ENDIAN);
-       proto_tree_add_item(sub_tree, hf_dsi_server_flag_no_save_passwd, tvb, ofs, 2, ENC_BIG_ENDIAN);
-       proto_tree_add_item(sub_tree, hf_dsi_server_flag_srv_msg       , tvb, ofs, 2, ENC_BIG_ENDIAN);
-       proto_tree_add_item(sub_tree, hf_dsi_server_flag_srv_sig       , tvb, ofs, 2, ENC_BIG_ENDIAN);
-       proto_tree_add_item(sub_tree, hf_dsi_server_flag_tcpip         , tvb, ofs, 2, ENC_BIG_ENDIAN);
-       proto_tree_add_item(sub_tree, hf_dsi_server_flag_notify        , tvb, ofs, 2, ENC_BIG_ENDIAN);
-       proto_tree_add_item(sub_tree, hf_dsi_server_flag_reconnect     , tvb, ofs, 2, ENC_BIG_ENDIAN);
-       proto_tree_add_item(sub_tree, hf_dsi_server_flag_directory     , tvb, ofs, 2, ENC_BIG_ENDIAN);
-       proto_tree_add_item(sub_tree, hf_dsi_server_flag_utf8_name     , tvb, ofs, 2, ENC_BIG_ENDIAN);
-       proto_tree_add_item(sub_tree, hf_dsi_server_flag_uuid          , tvb, ofs, 2, ENC_BIG_ENDIAN);
-       proto_tree_add_item(sub_tree, hf_dsi_server_flag_ext_sleep     , tvb, ofs, 2, ENC_BIG_ENDIAN);
-       proto_tree_add_item(sub_tree, hf_dsi_server_flag_fast_copy     , tvb, ofs, 2, ENC_BIG_ENDIAN);
-
-       proto_tree_add_item(tree, hf_dsi_server_name, tvb, offset +AFPSTATUS_PRELEN, 1, ENC_ASCII|ENC_NA);
-
-       flag = tvb_get_ntohs(tvb, ofs);
-       if ((flag & AFPSRVRINFO_SRVSIGNATURE)) {
-               ofs = offset +AFPSTATUS_PRELEN +tvb_get_guint8(tvb, offset +AFPSTATUS_PRELEN) +1;
-               if ((ofs & 1))
-                       ofs++;
-
-               sign_ofs = tvb_get_ntohs(tvb, ofs);
-               proto_tree_add_text(tree, tvb, ofs, 2, "Signature offset: %d", sign_ofs);
-               if (sign_ofs)
-                       sign_ofs += offset;
-
-               if ((flag & AFPSRVRINFO_TCPIP)) {
-                       ofs += 2;
-                       adr_ofs =  tvb_get_ntohs(tvb, ofs);
-                       proto_tree_add_text(tree, tvb, ofs, 2, "Network address offset: %d", adr_ofs);
-                       adr_ofs += offset;
-               }
-
-               if ((flag & AFPSRVRINFO_SRVDIRECTORY)) {
-                       ofs += 2;
-                       dir_ofs =  tvb_get_ntohs(tvb, ofs);
-                       proto_tree_add_text(tree, tvb, ofs, 2, "Directory services offset: %d", dir_ofs);
-                       dir_ofs += offset;
-               }
-               if ((flag & AFPSRVRINFO_SRVUTF8)) {
-                       ofs += 2;
-                       utf_ofs =  tvb_get_ntohs(tvb, ofs);
-                       proto_tree_add_text(tree, tvb, ofs, 2, "UTF8 server name offset: %d", utf_ofs);
-                       utf_ofs += offset;
-               }
-       }
-
-       ofs = tvb_get_ntohs(tvb, offset +AFPSTATUS_MACHOFF);
-       if (ofs) {
-               ofs += offset;
-               proto_tree_add_item(tree, hf_dsi_server_type, tvb, ofs, 1, ENC_ASCII|ENC_NA);
-       }
-
-       ofs = tvb_get_ntohs(tvb, offset +AFPSTATUS_VERSOFF);
-       if (ofs) {
-               ofs += offset;
-               nbe = tvb_get_guint8(tvb, ofs);
-               ti = proto_tree_add_text(tree, tvb, ofs, 1, "Version list: %d", nbe);
-               ofs++;
-               sub_tree = proto_item_add_subtree(ti, ett_dsi_vers);
-               for (i = 0; i < nbe; i++) {
-                       len = tvb_get_guint8(tvb, ofs);
-                       proto_tree_add_item(sub_tree, hf_dsi_server_vers, tvb, ofs, 1, ENC_ASCII|ENC_NA);
-                       ofs += len + 1;
-               }
-       }
-
-       ofs = tvb_get_ntohs(tvb, offset +AFPSTATUS_UAMSOFF);
-       if (ofs) {
-               ofs += offset;
-               nbe = tvb_get_guint8(tvb, ofs);
-               ti = proto_tree_add_text(tree, tvb, ofs, 1, "UAMS list: %d", nbe);
-               ofs++;
-               sub_tree = proto_item_add_subtree(ti, ett_dsi_uams);
-               for (i = 0; i < nbe; i++) {
-                       len = tvb_get_guint8(tvb, ofs);
-                       proto_tree_add_item(sub_tree, hf_dsi_server_uams, tvb, ofs, 1, ENC_ASCII|ENC_NA);
-                       ofs += len + 1;
-               }
-       }
-
-       ofs = tvb_get_ntohs(tvb, offset +AFPSTATUS_ICONOFF);
-       if (ofs) {
-               ofs += offset;
-               proto_tree_add_item(tree, hf_dsi_server_icon, tvb, ofs, 256, ENC_NA);
-       }
-
-       if (sign_ofs) {
-               proto_tree_add_item(tree, hf_dsi_server_signature, tvb, sign_ofs, 16, ENC_NA);
-       }
-
-       if (adr_ofs) {
-               proto_tree *adr_tree;
-               unsigned char *tmp;
-               guint16 net;
-               guint8  node;
-               guint16 port;
-
-               ofs = adr_ofs;
-               nbe = tvb_get_guint8(tvb, ofs);
-               ti = proto_tree_add_text(tree, tvb, ofs, 1, "Address list: %d", nbe);
-               ofs++;
-               adr_tree = proto_item_add_subtree(ti, ett_dsi_addr);
-               for (i = 0; i < nbe; i++) {
-                       guint8 type;
-
-                       len = tvb_get_guint8(tvb, ofs);
-                       type =  tvb_get_guint8(tvb, ofs +1);
-                       switch (type) {
-                       case 1: /* IP */
-                               ti = proto_tree_add_text(adr_tree, tvb, ofs, len, "ip: %s", tvb_ip_to_str(tvb, ofs+2));
-                               break;
-                       case 2: /* IP + port */
-                               port = tvb_get_ntohs(tvb, ofs+6);
-                               ti = proto_tree_add_text(adr_tree, tvb, ofs, len, "ip %s:%d", tvb_ip_to_str(tvb, ofs+2), port);
-                               break;
-                       case 3: /* DDP, atalk_addr_to_str want host order not network */
-                               net  = tvb_get_ntohs(tvb, ofs+2);
-                               node = tvb_get_guint8(tvb, ofs +4);
-                               port = tvb_get_guint8(tvb, ofs +5);
-                               ti = proto_tree_add_text(adr_tree, tvb, ofs, len, "ddp: %u.%u:%u",
-                                       net, node, port);
-                               break;
-                       case 4: /* DNS */
-                       case 5: /* SSH tunnel */
-                               if (len > 2) {
-                                       tmp = tvb_get_string(wmem_packet_scope(), tvb, ofs +2, len -2);
-                                       ti = proto_tree_add_text(adr_tree, tvb, ofs, len, "%s: %s",
-                                                               (type==4)?"dns":"ssh tunnel", tmp);
-                                       break;
-                               }
-                               else {
-                                       ti = proto_tree_add_text(adr_tree, tvb, ofs, len,"Malformed address type %d", type);
-                               }
-                               break;
-                       case 6: /* IP6 */
-                               ti = proto_tree_add_text(adr_tree, tvb, ofs, len, "ip6: %s",
-                                               tvb_ip6_to_str(tvb, ofs+2));
-                               break;
-                       case 7: /* IP6 + 2bytes port */
-                               port = tvb_get_ntohs(tvb, ofs+ 2+INET6_ADDRLEN);
-                               ti = proto_tree_add_text(adr_tree, tvb, ofs, len, "ip6 %s:%d",
-                                               tvb_ip6_to_str(tvb, ofs+2), port);
-                               break;
-                       default:
-                               ti = proto_tree_add_text(adr_tree, tvb, ofs, len,"Unknown type : %d", type);
-                               break;
-                       }
-                       len -= 2;
-                       sub_tree = proto_item_add_subtree(ti,ett_dsi_addr_line);
-                       proto_tree_add_item(sub_tree, hf_dsi_server_addr_len, tvb, ofs, 1, ENC_BIG_ENDIAN);
-                       ofs++;
-                       proto_tree_add_item(sub_tree, hf_dsi_server_addr_type, tvb, ofs, 1, ENC_BIG_ENDIAN);
-                       ofs++;
-                       proto_tree_add_item(sub_tree, hf_dsi_server_addr_value,tvb, ofs, len, ENC_NA);
-                       ofs += len;
-               }
-       }
-
-       if (dir_ofs) {
-               ofs = dir_ofs;
-               nbe = tvb_get_guint8(tvb, ofs);
-               ti = proto_tree_add_text(tree, tvb, ofs, 1, "Directory services list: %d", nbe);
-               ofs++;
-               sub_tree = proto_item_add_subtree(ti, ett_dsi_directory);
-               for (i = 0; i < nbe; i++) {
-                       len = tvb_get_guint8(tvb, ofs);
-                       proto_tree_add_item(sub_tree, hf_dsi_server_directory, tvb, ofs, 1, ENC_ASCII|ENC_NA);
-                       ofs += len + 1;
-               }
-       }
-       if (utf_ofs) {
-               guint16 ulen;
-               char *tmp;
-
-               ofs = utf_ofs;
-               ulen = tvb_get_ntohs(tvb, ofs);
-               tmp = tvb_get_string(wmem_packet_scope(), tvb, ofs + 2, ulen);
-               ti = proto_tree_add_text(tree, tvb, ofs, ulen + 2, "UTF8 server name: %s", tmp);
-               sub_tree = proto_item_add_subtree(ti, ett_dsi_utf8_name);
-               proto_tree_add_uint(sub_tree, hf_dsi_utf8_server_name_len, tvb, ofs, 2, ulen);
-               ofs += 2;
-               proto_tree_add_string(sub_tree, hf_dsi_utf8_server_name, tvb, ofs, ulen, tmp);
-               ofs += ulen;
-       }
-
-       return ofs;
-}
-
 static int
 dissect_dsi_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
 {
        proto_tree      *dsi_tree;
-       proto_item      *ti;
+       proto_item      *dsi_ti;
        guint8          dsi_flags,dsi_command;
        guint16         dsi_requestid;
        gint32          dsi_code;
        guint32         dsi_length;
-       guint32         dsi_reserved;
        struct          aspinfo aspinfo;
 
 
@@ -529,7 +227,6 @@ dissect_dsi_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da
        dsi_requestid = tvb_get_ntohs(tvb, 2);
        dsi_code = tvb_get_ntohl(tvb, 4);
        dsi_length = tvb_get_ntohl(tvb, 8);
-       dsi_reserved = tvb_get_ntohl(tvb, 12);
 
        col_add_fstr(pinfo->cinfo, COL_INFO, "%s %s (%u)",
                        val_to_str(dsi_flags, flag_vals,
@@ -538,8 +235,8 @@ dissect_dsi_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da
                                   "Unknown function (0x%02x)"),
                        dsi_requestid);
 
-       ti = proto_tree_add_item(tree, proto_dsi, tvb, 0, -1, ENC_NA);
-       dsi_tree = proto_item_add_subtree(ti, ett_dsi);
+       dsi_ti = proto_tree_add_item(tree, proto_dsi, tvb, 0, -1, ENC_NA);
+       dsi_tree = proto_item_add_subtree(dsi_ti, ett_dsi);
 
        if (tree) {
                proto_tree_add_uint(dsi_tree, hf_dsi_flags, tvb,
@@ -560,11 +257,10 @@ dissect_dsi_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da
                                4, 4, dsi_code);
                        break;
                }
-               proto_tree_add_uint_format_value(dsi_tree, hf_dsi_length, tvb,
-                       8, 4, dsi_length,
-                       "%u bytes", dsi_length);
-               proto_tree_add_uint(dsi_tree, hf_dsi_reserved, tvb,
-                       12, 4, dsi_reserved);
+               proto_tree_add_item(dsi_tree, hf_dsi_length, tvb,
+                       8, 4, ENC_BIG_ENDIAN);
+               proto_tree_add_item(dsi_tree, hf_dsi_reserved, tvb,
+                       12, 4, ENC_BIG_ENDIAN);
        }
 
        switch (dsi_command) {
@@ -580,37 +276,39 @@ dissect_dsi_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* da
                break;
        case DSIFUNC_STAT:
                if (tree && (dsi_flags == DSIFL_REPLY)) {
-                       dissect_dsi_reply_get_status(tvb, dsi_tree, DSI_BLOCKSIZ);
+                       tvbuff_t   *new_tvb;
+
+                       /* XXX - assumes only AFP runs atop DSI */
+                       new_tvb = tvb_new_subset_remaining(tvb, DSI_BLOCKSIZ);
+                       call_dissector(afp_server_status_handle, new_tvb, pinfo, dsi_tree);
                }
                break;
        case DSIFUNC_CMD:
        case DSIFUNC_WRITE:
                {
                        tvbuff_t   *new_tvb;
-                       int len = tvb_reported_length_remaining(tvb,DSI_BLOCKSIZ);
 
                        aspinfo.reply = (dsi_flags == DSIFL_REPLY);
                        aspinfo.command = dsi_command;
                        aspinfo.seq = dsi_requestid;
                        aspinfo.code = dsi_code;
-                       proto_item_set_len(dsi_tree, DSI_BLOCKSIZ);
+                       proto_item_set_len(dsi_ti, DSI_BLOCKSIZ);
 
-                       new_tvb = tvb_new_subset(tvb, DSI_BLOCKSIZ,-1,len);
+                       new_tvb = tvb_new_subset_remaining(tvb, DSI_BLOCKSIZ);
                        call_dissector_with_data(afp_handle, new_tvb, pinfo, tree, &aspinfo);
                }
                break;
        default:
-               call_dissector(data_handle,
-                                               tvb_new_subset_remaining(tvb, DSI_BLOCKSIZ),
+               call_data_dissector(tvb_new_subset_remaining(tvb, DSI_BLOCKSIZ),
                                                pinfo, dsi_tree);
                break;
        }
 
-       return tvb_length(tvb);
+       return tvb_captured_length(tvb);
 }
 
 static guint
-get_dsi_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+get_dsi_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
 {
        guint32 plen;
        guint8  dsi_flags,dsi_command;
@@ -620,7 +318,7 @@ get_dsi_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
        if ( dsi_flags > DSIFL_MAX || !dsi_command || dsi_command > DSIFUNC_MAX)
        {
            /* it's not a known dsi pdu start sequence */
-           return tvb_length_remaining(tvb, offset);
+           return tvb_captured_length_remaining(tvb, offset);
        }
 
        /*
@@ -641,7 +339,7 @@ dissect_dsi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
        tcp_dissect_pdus(tvb, pinfo, tree, dsi_desegment, 12,
            get_dsi_pdu_len, dissect_dsi_packet, data);
 
-       return tvb_length(tvb);
+       return tvb_captured_length(tvb);
 }
 
 void
@@ -676,130 +374,13 @@ proto_register_dsi(void)
 
                { &hf_dsi_length,
                  { "Length",           "dsi.length",
-                   FT_UINT32, BASE_DEC, NULL, 0x0,
+                   FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_byte_bytes, 0x0,
                    "Total length of the data that follows the DSI header.", HFILL }},
 
                { &hf_dsi_reserved,
                  { "Reserved",         "dsi.reserved",
                    FT_UINT32, BASE_HEX, NULL, 0x0,
                    "Reserved for future use.  Should be set to zero.", HFILL }},
-               /* asp , afp */
-               { &hf_dsi_utf8_server_name_len,
-                 { "Length",          "dsi.utf8_server_name_len",
-                   FT_UINT16, BASE_DEC, NULL, 0x0,
-                   "UTF8 server name length.", HFILL }},
-               { &hf_dsi_utf8_server_name,
-                 { "UTF8 Server name",         "dsi.utf8_server_name",
-                   FT_STRING, BASE_NONE, NULL, 0x0,
-                   NULL, HFILL }},
-
-               { &hf_dsi_server_name,
-                 { "Server name",         "dsi.server_name",
-                   FT_UINT_STRING, BASE_NONE, NULL, 0x0,
-                   NULL, HFILL }},
-
-               { &hf_dsi_server_type,
-                 { "Server type",         "dsi.server_type",
-                   FT_UINT_STRING, BASE_NONE, NULL, 0x0,
-                   NULL, HFILL }},
-
-               { &hf_dsi_server_vers,
-                 { "AFP version",         "dsi.server_vers",
-                   FT_UINT_STRING, BASE_NONE, NULL, 0x0,
-                   NULL, HFILL }},
-
-               { &hf_dsi_server_uams,
-                 { "UAM",         "dsi.server_uams",
-                   FT_UINT_STRING, BASE_NONE, NULL, 0x0,
-                   NULL, HFILL }},
-
-               { &hf_dsi_server_icon,
-                 { "Icon bitmap",         "dsi.server_icon",
-                   FT_BYTES, BASE_NONE, NULL, 0x0,
-                   "Server icon bitmap", HFILL }},
-
-               { &hf_dsi_server_directory,
-                 { "Directory service",         "dsi.server_directory",
-                   FT_UINT_STRING, BASE_NONE, NULL, 0x0,
-                   "Server directory service", HFILL }},
-
-               { &hf_dsi_server_signature,
-                 { "Server signature",         "dsi.server_signature",
-                   FT_BYTES, BASE_NONE, NULL, 0x0,
-                   NULL, HFILL }},
-
-               { &hf_dsi_server_flag,
-                 { "Flag",         "dsi.server_flag",
-                   FT_UINT16, BASE_HEX, NULL, 0x0,
-                   "Server capabilities flag", HFILL }},
-               { &hf_dsi_server_flag_copyfile,
-                 { "Support copyfile",      "dsi.server_flag.copyfile",
-                   FT_BOOLEAN, 16, NULL, AFPSRVRINFO_COPY,
-                   "Server support copyfile", HFILL }},
-               { &hf_dsi_server_flag_passwd,
-                 { "Support change password",      "dsi.server_flag.passwd",
-                   FT_BOOLEAN, 16, NULL, AFPSRVRINFO_PASSWD,
-                   "Server support change password", HFILL }},
-               { &hf_dsi_server_flag_no_save_passwd,
-                 { "Don't allow save password",      "dsi.server_flag.no_save_passwd",
-                   FT_BOOLEAN, 16, NULL, AFPSRVRINFO_NOSAVEPASSWD,
-                   NULL, HFILL }},
-               { &hf_dsi_server_flag_srv_msg,
-                 { "Support server message",      "dsi.server_flag.srv_msg",
-                   FT_BOOLEAN, 16, NULL, AFPSRVRINFO_SRVMSGS,
-                   NULL, HFILL }},
-               { &hf_dsi_server_flag_srv_sig,
-                 { "Support server signature",      "dsi.server_flag.srv_sig",
-                   FT_BOOLEAN, 16, NULL, AFPSRVRINFO_SRVSIGNATURE,
-                   NULL, HFILL }},
-               { &hf_dsi_server_flag_tcpip,
-                 { "Support TCP/IP",      "dsi.server_flag.tcpip",
-                   FT_BOOLEAN, 16, NULL, AFPSRVRINFO_TCPIP,
-                   "Server support TCP/IP", HFILL }},
-               { &hf_dsi_server_flag_notify,
-                 { "Support server notifications",      "dsi.server_flag.notify",
-                   FT_BOOLEAN, 16, NULL, AFPSRVRINFO_SRVNOTIFY,
-                   "Server support notifications", HFILL }},
-               { &hf_dsi_server_flag_reconnect,
-                 { "Support server reconnect",      "dsi.server_flag.reconnect",
-                   FT_BOOLEAN, 16, NULL, AFPSRVRINFO_SRVRECONNECT,
-                   "Server support reconnect", HFILL }},
-               { &hf_dsi_server_flag_directory,
-                 { "Support directory services",      "dsi.server_flag.directory",
-                   FT_BOOLEAN, 16, NULL, AFPSRVRINFO_SRVDIRECTORY,
-                   "Server support directory services", HFILL }},
-               { &hf_dsi_server_flag_utf8_name,
-                 { "Support UTF8 server name",      "dsi.server_flag.utf8_name",
-                   FT_BOOLEAN, 16, NULL, AFPSRVRINFO_SRVUTF8,
-                   "Server support UTF8 server name", HFILL }},
-               { &hf_dsi_server_flag_uuid,
-                 { "Support UUIDs",      "dsi.server_flag.uuids",
-                   FT_BOOLEAN, 16, NULL, AFPSRVRINFO_UUID,
-                   "Server supports UUIDs", HFILL }},
-               { &hf_dsi_server_flag_ext_sleep,
-                 { "Support extended sleep",      "dsi.server_flag.ext_sleep",
-                   FT_BOOLEAN, 16, NULL, AFPSRVRINFO_EXT_SLEEP,
-                   "Server supports extended sleep", HFILL }},
-               { &hf_dsi_server_flag_fast_copy,
-                 { "Support fast copy",      "dsi.server_flag.fast_copy",
-                   FT_BOOLEAN, 16, NULL, AFPSRVRINFO_FASTBOZO,
-                   "Server support fast copy", HFILL }},
-
-
-               { &hf_dsi_server_addr_len,
-                 { "Length",          "dsi.server_addr.len",
-                   FT_UINT8, BASE_DEC, NULL, 0x0,
-                   "Address length.", HFILL }},
-
-               { &hf_dsi_server_addr_type,
-                 { "Type",          "dsi.server_addr.type",
-                   FT_UINT8, BASE_DEC|BASE_EXT_STRING, &afp_server_addr_type_vals_ext, 0x0,
-                   "Address type.", HFILL }},
-
-               { &hf_dsi_server_addr_value,
-                 { "Value",          "dsi.server_addr.value",
-                   FT_BYTES, BASE_NONE, NULL, 0x0,
-                   "Address value", HFILL }},
 
                { &hf_dsi_open_type,
                  { "Option",          "dsi.open_type",
@@ -854,23 +435,13 @@ proto_register_dsi(void)
                  { "Bitmap",          "dsi.attn_flag.bitmap",
                    FT_UINT16, BASE_HEX, NULL, 0xfff,
                    "Attention extended bitmap", HFILL }},
-
        };
 
        static gint *ett[] = {
                &ett_dsi,
                &ett_dsi_open,
                &ett_dsi_attn,
-               &ett_dsi_attn_flag,
-               /* asp afp */
-               &ett_dsi_status,
-               &ett_dsi_status_server_flag,
-               &ett_dsi_vers,
-               &ett_dsi_uams,
-               &ett_dsi_addr,
-               &ett_dsi_addr_line,
-               &ett_dsi_directory,
-               &ett_dsi_utf8_name,
+               &ett_dsi_attn_flag
        };
        module_t *dsi_module;
 
@@ -891,9 +462,22 @@ proto_reg_handoff_dsi(void)
 {
        dissector_handle_t dsi_handle;
 
-       dsi_handle = new_create_dissector_handle(dissect_dsi, proto_dsi);
-       dissector_add_uint("tcp.port", TCP_PORT_DSI, dsi_handle);
+       dsi_handle = create_dissector_handle(dissect_dsi, proto_dsi);
+       dissector_add_uint_with_preference("tcp.port", TCP_PORT_DSI, dsi_handle);
 
-       data_handle = find_dissector("data");
-       afp_handle = find_dissector("afp");
+       afp_handle = find_dissector_add_dependency("afp", proto_dsi);
+       afp_server_status_handle = find_dissector_add_dependency("afp_server_status", proto_dsi);
 }
+
+/*
+ * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ *
+ * vi: set shiftwidth=8 tabstop=8 noexpandtab:
+ * :indentSize=8:tabSize=8:noTabs=false:
+ */