diff options
-rw-r--r-- | epan/dissectors/Makefile.common | 3 | ||||
-rw-r--r-- | epan/dissectors/packet-3com-xns.c | 124 | ||||
-rw-r--r-- | epan/dissectors/packet-ethertype.c | 1 | ||||
-rw-r--r-- | epan/dissectors/packet-idp.c | 212 | ||||
-rw-r--r-- | epan/dissectors/packet-retix-bpdu.c | 20 | ||||
-rw-r--r-- | epan/dissectors/packet-spp.c | 279 | ||||
-rw-r--r-- | etypes.h | 4 |
7 files changed, 633 insertions, 10 deletions
diff --git a/epan/dissectors/Makefile.common b/epan/dissectors/Makefile.common index 992aae0818..a01226b421 100644 --- a/epan/dissectors/Makefile.common +++ b/epan/dissectors/Makefile.common @@ -47,6 +47,7 @@ GENERATED_FILES = $(GENERATED_HEADER_FILES) $(GENERATED_C_FILES) # the dissector sources (without any helpers) DISSECTOR_SRC = \ + packet-3com-xns.c \ packet-3g-a11.c \ packet-aarp.c \ packet-acap.c \ @@ -299,6 +300,7 @@ DISSECTOR_SRC = \ packet-icmpv6.c \ packet-icp.c \ packet-icq.c \ + packet-idp.c \ packet-ieee80211.c \ packet-ieee8023.c \ packet-ieee802a.c \ @@ -514,6 +516,7 @@ DISSECTOR_SRC = \ packet-snmp.c \ packet-socks.c \ packet-spnego.c \ + packet-spp.c \ packet-spray.c \ packet-sscf-nni.c \ packet-srvloc.c \ diff --git a/epan/dissectors/packet-3com-xns.c b/epan/dissectors/packet-3com-xns.c new file mode 100644 index 0000000000..c604c55f85 --- /dev/null +++ b/epan/dissectors/packet-3com-xns.c @@ -0,0 +1,124 @@ +/* packet-xns-llc.c + * Routines for 3Com's encapsulation of XNS over 802.2 LLC + * (and other protocols using DSAP 80) + * + * $Id$ + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * Copyright 1998 Gerald Combs + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include <glib.h> +#include <epan/packet.h> +#include "etypes.h" + +static int proto_3com_xns = -1; + +static int hf_3com_xns_type_ethertype = -1; +static int hf_3com_xns_type_retix_bpdu = -1; + +static gint ett_3com_xns = -1; + +static const value_string retix_bpdu_type_vals[] = { + { 0x0004, "Retix Spanning Tree" }, + { 0, NULL } +}; + +static dissector_handle_t retix_bpdu_handle; + +/* + * Apparently 3Com had some scheme for encapsulating XNS in 802.2 LLC, + * using a DSAP and SSAP of 0x80, and putting a 2-byte field that appeared + * to contain, at least for IPP, the Ethertype value for IPP. + * + * We assume that the value there is an Ethertype value, except for + * the Retix spanning tree protocol, which also uses a DSAP and SSAP + * of 0x80 but has, at least in one capture, 0x0004 as the type + * field. We handle that specially. + * + * XXX - I've also seen packets on 802.11 with a DSAP and SSAP of 0x80, + * but with random stuff that appears neither to be XNS nor Retix + * spanning tree. + */ +static void +dissect_3com_xns(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + proto_tree *subtree = NULL; + proto_tree *ti; + guint16 type; + + if (check_col(pinfo->cinfo, COL_PROTOCOL)) + col_set_str(pinfo->cinfo, COL_PROTOCOL, "3Com XNS"); + if (check_col(pinfo->cinfo, COL_INFO)) + col_clear(pinfo->cinfo, COL_INFO); + + if (tree) { + ti = proto_tree_add_item(tree, proto_3com_xns, tvb, 0, 4, FALSE); + subtree = proto_item_add_subtree(ti, ett_3com_xns); + } + + type = tvb_get_ntohs(tvb, 0); + if (type == 0x0004) { + proto_tree_add_uint(subtree, hf_3com_xns_type_retix_bpdu, + tvb, 0, 2, type); + call_dissector(retix_bpdu_handle, + tvb_new_subset(tvb, 2, -1, -1), pinfo, tree); + } else { + ethertype(type, tvb, 2, pinfo, tree, subtree, + hf_3com_xns_type_ethertype, -1, 0); + } +} + +void +proto_register_3com_xns(void) +{ + static hf_register_info hf[] = { + /* registered here but handled in ethertype.c */ + { &hf_3com_xns_type_ethertype, + { "Type", "xnsllc.type", FT_UINT16, BASE_HEX, + VALS(etype_vals), 0x0, "", HFILL }}, + + { &hf_3com_xns_type_retix_bpdu, + { "Type", "xnsllc.type", FT_UINT16, BASE_HEX, + VALS(retix_bpdu_type_vals), 0x0, "", HFILL }}, + }; + + static gint *ett[] ={ + &ett_3com_xns, + }; + + proto_3com_xns = proto_register_protocol("3Com XNS Encapsulation", "3COMXNS", "3comxns"); + proto_register_field_array(proto_3com_xns, hf, array_length(hf)); + proto_register_subtree_array(ett, array_length(ett)); +} + +void +proto_reg_handoff_3com_xns(void) +{ + dissector_handle_t our_xns_handle; + + retix_bpdu_handle = find_dissector("rbpdu"); + + our_xns_handle = create_dissector_handle(dissect_3com_xns, + proto_3com_xns); + dissector_add("llc.dsap", 0x80, our_xns_handle); +} diff --git a/epan/dissectors/packet-ethertype.c b/epan/dissectors/packet-ethertype.c index 87b0dc026f..4ef400fbd5 100644 --- a/epan/dissectors/packet-ethertype.c +++ b/epan/dissectors/packet-ethertype.c @@ -48,6 +48,7 @@ const value_string etype_vals[] = { {ETHERTYPE_IP, "IP" }, {ETHERTYPE_IPv6, "IPv6" }, {ETHERTYPE_CENTRINO_PROMISC, "IEEE 802.11 (Centrino promiscuous)" }, + {ETHERTYPE_XNS_IDP, "XNS Internet Datagram Protocol" }, {ETHERTYPE_X25L3, "X.25 Layer 3" }, {ETHERTYPE_ARP, "ARP" }, {ETHERTYPE_REVARP, "RARP" }, diff --git a/epan/dissectors/packet-idp.c b/epan/dissectors/packet-idp.c new file mode 100644 index 0000000000..ef150c89a9 --- /dev/null +++ b/epan/dissectors/packet-idp.c @@ -0,0 +1,212 @@ +/* packet-idp.c + * Routines for XNS IDP + * Based on the Netware IPX dissector by Gilbert Ramirez <gram@alumni.rice.edu> + * + * $Id$ + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * Copyright 1998 Gerald Combs + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include <glib.h> +#include <epan/packet.h> +#include "packet-idp.h" +#include "etypes.h" + +static int proto_idp = -1; +static int hf_idp_checksum = -1; +static int hf_idp_len = -1; +static int hf_idp_src = -1; +static int hf_idp_dst = -1; +static int hf_idp_hops = -1; +static int hf_idp_packet_type = -1; +static int hf_idp_dnet = -1; +static int hf_idp_dnode = -1; +static int hf_idp_dsocket = -1; +static int hf_idp_snet = -1; +static int hf_idp_snode = -1; +static int hf_idp_ssocket = -1; + +static gint ett_idp = -1; + +static dissector_handle_t data_handle; + +static dissector_table_t idp_type_dissector_table; + +/* + * See + * + * "Internet Transport Protocols", XSIS 028112, December 1981 + * + * if you can find it; this is based on the headers in the BSD XNS + * implementation. + */ + +#define IDP_HEADER_LEN 30 /* It's *always* 30 bytes */ + +static const value_string idp_packet_type_vals[] = { + { IDP_PACKET_TYPE_RIP, "RIP" }, + { IDP_PACKET_TYPE_ECHO, "Echo" }, + { IDP_PACKET_TYPE_ERROR, "Error" }, + { IDP_PACKET_TYPE_PEP, "PEP" }, + { IDP_PACKET_TYPE_SPP, "SPP" }, + { 0, NULL } +}; + +static const value_string idp_socket_vals[] = { + { IDP_SOCKET_SMB, "SMB" }, + { 0, NULL } +}; + +static void +dissect_idp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + proto_tree *idp_tree = NULL; + proto_item *ti = NULL; + guint16 length; + guint8 type; + tvbuff_t *next_tvb; + + if (check_col(pinfo->cinfo, COL_PROTOCOL)) + col_set_str(pinfo->cinfo, COL_PROTOCOL, "IDP"); + if (check_col(pinfo->cinfo, COL_INFO)) + col_clear(pinfo->cinfo, COL_INFO); + + if (check_col(pinfo->cinfo, COL_INFO)) + col_clear(pinfo->cinfo, COL_INFO); + + if (tree) { + ti = proto_tree_add_item(tree, proto_idp, tvb, 0, IDP_HEADER_LEN, FALSE); + idp_tree = proto_item_add_subtree(ti, ett_idp); + } + + proto_tree_add_item(idp_tree, hf_idp_checksum, tvb, 0, 2, FALSE); + length = tvb_get_ntohs(tvb, 2); + proto_tree_add_uint_format(idp_tree, hf_idp_len, tvb, 2, 2, length, + "Length: %u bytes", length); + /* Adjust the tvbuff length to include only the IDP datagram. */ + set_actual_length(tvb, length); + proto_tree_add_item(idp_tree, hf_idp_hops, tvb, 4, 1, FALSE); + type = tvb_get_guint8(tvb, 5); + proto_tree_add_uint(idp_tree, hf_idp_packet_type, tvb, 5, 1, type); + + /* Destination */ + proto_tree_add_item(idp_tree, hf_idp_dnet, tvb, 6, 4, FALSE); + proto_tree_add_item(idp_tree, hf_idp_dnode, tvb, 10, 6, FALSE); + proto_tree_add_item(idp_tree, hf_idp_dsocket, tvb, 16, 2, FALSE); + + /* Source */ + proto_tree_add_item(idp_tree, hf_idp_snet, tvb, 18, 4, FALSE); + proto_tree_add_item(idp_tree, hf_idp_snode, tvb, 22, 6, FALSE); + proto_tree_add_item(idp_tree, hf_idp_ssocket, tvb, 28, 2, FALSE); + + /* Make the next tvbuff */ + next_tvb = tvb_new_subset(tvb, IDP_HEADER_LEN, -1, -1); + + /* + * Hand off to the dissector for the packet type. + */ + if (dissector_try_port(idp_type_dissector_table, type, next_tvb, + pinfo, tree)) + return; + + call_dissector(data_handle, next_tvb, pinfo, tree); +} + +void +proto_register_idp(void) +{ + static hf_register_info hf_idp[] = { + { &hf_idp_checksum, + { "Checksum", "idp.checksum", FT_UINT16, BASE_HEX, + NULL, 0x0, "", HFILL }}, + + { &hf_idp_src, + { "Source Address", "idp.src", FT_STRING, BASE_DEC, + NULL, 0x0, "Source Address", HFILL }}, + + { &hf_idp_dst, + { "Destination Address", "idp.dst", FT_STRING, BASE_DEC, + NULL, 0x0, "Destination Address", HFILL }}, + + { &hf_idp_len, + { "Length", "idp.len", FT_UINT16, BASE_DEC, + NULL, 0x0, "", HFILL }}, + + /* XXX - does this have separate hop count and time subfields? */ + { &hf_idp_hops, + { "Transport Control (Hops)", "idp.hops", FT_UINT8, BASE_DEC, + NULL, 0x0, "", HFILL }}, + + { &hf_idp_packet_type, + { "Packet Type", "idp.packet_type", FT_UINT8, BASE_DEC, + VALS(idp_packet_type_vals), 0x0, "", HFILL }}, + + { &hf_idp_dnet, + { "Destination Network","idp.dst.net", FT_UINT32, BASE_HEX, + NULL, 0x0, "", HFILL }}, + + { &hf_idp_dnode, + { "Destination Node", "idp.dst.node", FT_ETHER, BASE_NONE, + NULL, 0x0, "", HFILL }}, + + { &hf_idp_dsocket, + { "Destination Socket", "idp.dst.socket", FT_UINT16, BASE_HEX, + VALS(idp_socket_vals), 0x0, "", HFILL }}, + + { &hf_idp_snet, + { "Source Network","idp.src.net", FT_UINT32, BASE_HEX, + NULL, 0x0, "", HFILL }}, + + { &hf_idp_snode, + { "Source Node", "idp.src.node", FT_ETHER, BASE_NONE, + NULL, 0x0, "", HFILL }}, + + { &hf_idp_ssocket, + { "Source Socket", "idp.src.socket", FT_UINT16, BASE_HEX, + VALS(idp_socket_vals), 0x0, "", HFILL }}, + }; + + static gint *ett[] = { + &ett_idp, + }; + + proto_idp = proto_register_protocol("Internetwork Datagram Protocol", + "IDP", "idp"); + proto_register_field_array(proto_idp, hf_idp, array_length(hf_idp)); + proto_register_subtree_array(ett, array_length(ett)); + + idp_type_dissector_table = register_dissector_table("idp.packet_type", + "IDP packet type", FT_UINT8, BASE_DEC); +} + +void +proto_reg_handoff_idp(void) +{ + dissector_handle_t idp_handle; + + idp_handle = create_dissector_handle(dissect_idp, proto_idp); + dissector_add("ethertype", ETHERTYPE_XNS_IDP, idp_handle); + dissector_add("chdlctype", ETHERTYPE_XNS_IDP, idp_handle); + + data_handle = find_dissector("data"); +} diff --git a/epan/dissectors/packet-retix-bpdu.c b/epan/dissectors/packet-retix-bpdu.c index 5f7a40aafe..c5e2107009 100644 --- a/epan/dissectors/packet-retix-bpdu.c +++ b/epan/dissectors/packet-retix-bpdu.c @@ -28,13 +28,17 @@ # include "config.h" #endif +#if 0 #include <stdio.h> #include <string.h> +#endif #include <glib.h> #include <epan/packet.h> +#if 0 #include "llcsaps.h" #include "ppptypes.h" #include "chdlctypes.h" +#endif #include <epan/addr_resolv.h> static gint ett_retix_bpdu = -1; @@ -67,7 +71,7 @@ dissect_retix_bpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (check_col(pinfo->cinfo, COL_INFO)) { col_clear(pinfo->cinfo, COL_INFO); } - bridge_mac_str = tvb_get_ptr(tvb, 12, 6); + bridge_mac_str = tvb_get_ptr(tvb, 10, 6); if (check_col(pinfo->cinfo, COL_INFO)){ col_add_fstr(pinfo->cinfo, COL_INFO, "Bridge MAC %s", ether_to_str(bridge_mac_str)); } @@ -80,13 +84,13 @@ dissect_retix_bpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) retix_bpdu_tree = proto_item_add_subtree(ti, ett_retix_bpdu); } - proto_tree_add_item(retix_bpdu_tree, hf_retix_bpdu_root_mac, tvb, 2, 6, FALSE); + proto_tree_add_item(retix_bpdu_tree, hf_retix_bpdu_root_mac, tvb, 0, 6, FALSE); - proto_tree_add_item(retix_bpdu_tree, hf_retix_bpdu_bridge_mac, tvb, 12, 6, FALSE); + proto_tree_add_item(retix_bpdu_tree, hf_retix_bpdu_bridge_mac, tvb, 10, 6, FALSE); - proto_tree_add_item(retix_bpdu_tree, hf_retix_bpdu_max_age, tvb, 22, 2, FALSE); - proto_tree_add_item(retix_bpdu_tree, hf_retix_bpdu_hello_time, tvb, 24, 2, FALSE); - proto_tree_add_item(retix_bpdu_tree, hf_retix_bpdu_forward_delay, tvb, 26, 2, FALSE); + proto_tree_add_item(retix_bpdu_tree, hf_retix_bpdu_max_age, tvb, 20, 2, FALSE); + proto_tree_add_item(retix_bpdu_tree, hf_retix_bpdu_hello_time, tvb, 22, 2, FALSE); + proto_tree_add_item(retix_bpdu_tree, hf_retix_bpdu_forward_delay, tvb, 24, 2, FALSE); } @@ -129,8 +133,4 @@ proto_register_retix_bpdu(void) void proto_reg_handoff_retix_bpdu(void) { - dissector_handle_t retix_bpdu_handle; - - retix_bpdu_handle = find_dissector("rbpdu"); - dissector_add("llc.dsap", 0x80, retix_bpdu_handle); } diff --git a/epan/dissectors/packet-spp.c b/epan/dissectors/packet-spp.c new file mode 100644 index 0000000000..0c77fca963 --- /dev/null +++ b/epan/dissectors/packet-spp.c @@ -0,0 +1,279 @@ +/* packet-spp.c + * Routines for XNS SPP + * Based on the Netware SPP dissector by Gilbert Ramirez <gram@alumni.rice.edu> + * + * $Id$ + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * Copyright 1998 Gerald Combs + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include <glib.h> +#include <epan/packet.h> +#include "packet-idp.h" + +static int proto_spp = -1; +static int hf_spp_connection_control = -1; +static int hf_spp_connection_control_sys = -1; +static int hf_spp_connection_control_send_ack = -1; +static int hf_spp_connection_control_attn = -1; +static int hf_spp_connection_control_eom = -1; +static int hf_spp_datastream_type = -1; +static int hf_spp_src_id = -1; +static int hf_spp_dst_id = -1; +static int hf_spp_seq_nr = -1; +static int hf_spp_ack_nr = -1; +static int hf_spp_all_nr = -1; +static int hf_spp_rexmt_frame = -1; + +static gint ett_spp = -1; +static gint ett_spp_connctrl = -1; + +static dissector_handle_t data_handle; + +/* + * See + * + * "Internet Transport Protocols", XSIS 028112, December 1981 + * + * if you can find it; this is based on the headers in the BSD XNS + * implementation. + */ + +#define SPP_SYS_PACKET 0x80 +#define SPP_SEND_ACK 0x40 +#define SPP_ATTN 0x20 +#define SPP_EOM 0x10 + +static const char* +spp_conn_ctrl(guint8 ctrl) +{ + const char *p; + + static const value_string conn_vals[] = { + { 0x00, "Data, No Ack Required" }, + { SPP_EOM, "End-of-Message" }, + { SPP_ATTN, "Attention" }, + { SPP_SEND_ACK, "Acknowledgment Required"}, + { SPP_SEND_ACK|SPP_EOM, "Send Ack: End Message"}, + { SPP_SYS_PACKET, "System Packet"}, + { SPP_SYS_PACKET|SPP_SEND_ACK, "System Packet: Send Ack"}, + { 0x00, NULL } + }; + + p = match_strval((ctrl & 0xf0), conn_vals ); + + if (p) { + return p; + } + else { + return "Unknown"; + } +} + +static const char* +spp_datastream(guint8 type) +{ + switch (type) { + case 0xfe: + return "End-of-Connection"; + case 0xff: + return "End-of-Connection Acknowledgment"; + default: + return NULL; + } +} + +#define SPP_HEADER_LEN 12 + +/* + * XXX - do reassembly, using the EOM flag. (Then do that in the Netware + * SPX implementation, too.) + * + * XXX - hand off to subdissectors based on the socket number. + */ +static void +dissect_spp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + proto_tree *spp_tree = NULL; + proto_item *ti; + tvbuff_t *next_tvb; + guint8 conn_ctrl; + proto_tree *cc_tree; + guint8 datastream_type; + const char *datastream_type_string; + guint16 spp_seq; + const char *spp_msg_string; + + if (check_col(pinfo->cinfo, COL_PROTOCOL)) + col_set_str(pinfo->cinfo, COL_PROTOCOL, "SPP"); + if (check_col(pinfo->cinfo, COL_INFO)) + col_set_str(pinfo->cinfo, COL_INFO, "SPP"); + + if (tree) { + ti = proto_tree_add_item(tree, proto_spp, tvb, 0, SPP_HEADER_LEN, FALSE); + spp_tree = proto_item_add_subtree(ti, ett_spp); + } + + conn_ctrl = tvb_get_guint8(tvb, 0); + spp_msg_string = spp_conn_ctrl(conn_ctrl); + if (check_col(pinfo->cinfo, COL_INFO)) + col_append_fstr(pinfo->cinfo, COL_INFO, " %s", spp_msg_string); + if (tree) { + ti = proto_tree_add_uint_format(spp_tree, hf_spp_connection_control, tvb, + 0, 1, conn_ctrl, + "Connection Control: %s (0x%02X)", + spp_msg_string, conn_ctrl); + cc_tree = proto_item_add_subtree(ti, ett_spp_connctrl); + proto_tree_add_boolean(cc_tree, hf_spp_connection_control_sys, tvb, + 0, 1, conn_ctrl); + proto_tree_add_boolean(cc_tree, hf_spp_connection_control_send_ack, tvb, + 0, 1, conn_ctrl); + proto_tree_add_boolean(cc_tree, hf_spp_connection_control_attn, tvb, + 0, 1, conn_ctrl); + proto_tree_add_boolean(cc_tree, hf_spp_connection_control_eom, tvb, + 0, 1, conn_ctrl); + } + + datastream_type = tvb_get_guint8(tvb, 1); + datastream_type_string = spp_datastream(datastream_type); + if (datastream_type_string != NULL) { + if (check_col(pinfo->cinfo, COL_INFO)) + col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)", + datastream_type_string); + } + if (tree) { + if (datastream_type_string != NULL) { + proto_tree_add_uint_format(spp_tree, hf_spp_datastream_type, tvb, + 1, 1, datastream_type, + "Datastream Type: %s (0x%02X)", + datastream_type_string, + datastream_type); + } else { + proto_tree_add_uint_format(spp_tree, hf_spp_datastream_type, tvb, + 1, 1, datastream_type, + "Datastream Type: 0x%02X", + datastream_type); + } + proto_tree_add_item(spp_tree, hf_spp_src_id, tvb, 2, 2, FALSE); + proto_tree_add_item(spp_tree, hf_spp_dst_id, tvb, 4, 2, FALSE); + } + spp_seq = tvb_get_ntohs(tvb, 6); + if (tree) { + proto_tree_add_uint(spp_tree, hf_spp_seq_nr, tvb, 6, 2, spp_seq); + proto_tree_add_item(spp_tree, hf_spp_ack_nr, tvb, 8, 2, FALSE); + proto_tree_add_item(spp_tree, hf_spp_all_nr, tvb, 10, 2, FALSE); + } + + if (tvb_reported_length_remaining(tvb, SPP_HEADER_LEN) > 0) { + next_tvb = tvb_new_subset(tvb, SPP_HEADER_LEN, -1, -1); + call_dissector(data_handle, next_tvb, pinfo, tree); + } +} + + +void +proto_register_spp(void) +{ + static hf_register_info hf_spp[] = { + { &hf_spp_connection_control, + { "Connection Control", "spp.ctl", + FT_UINT8, BASE_HEX, NULL, 0x0, + "", HFILL }}, + + { &hf_spp_connection_control_sys, + { "System Packet", "spp.ctl.sys", + FT_BOOLEAN, 8, NULL, SPP_SYS_PACKET, + "", HFILL }}, + + { &hf_spp_connection_control_send_ack, + { "Send Ack", "spp.ctl.send_ack", + FT_BOOLEAN, 8, NULL, SPP_SEND_ACK, + "", HFILL }}, + + { &hf_spp_connection_control_attn, + { "Attention", "spp.ctl.attn", + FT_BOOLEAN, 8, NULL, SPP_ATTN, + "", HFILL }}, + + { &hf_spp_connection_control_eom, + { "End of Message", "spp.ctl.eom", + FT_BOOLEAN, 8, NULL, SPP_EOM, + "", HFILL }}, + + { &hf_spp_datastream_type, + { "Datastream type", "spp.type", + FT_UINT8, BASE_HEX, NULL, 0x0, + "", HFILL }}, + + { &hf_spp_src_id, + { "Source Connection ID", "spp.src", + FT_UINT16, BASE_DEC, NULL, 0x0, + "", HFILL }}, + + { &hf_spp_dst_id, + { "Destination Connection ID", "spp.dst", + FT_UINT16, BASE_DEC, NULL, 0x0, + "", HFILL }}, + + { &hf_spp_seq_nr, + { "Sequence Number", "spp.seq", + FT_UINT16, BASE_DEC, NULL, 0x0, + "", HFILL }}, + + { &hf_spp_ack_nr, + { "Acknowledgment Number", "spp.ack", + FT_UINT16, BASE_DEC, NULL, 0x0, + "", HFILL }}, + + { &hf_spp_all_nr, + { "Allocation Number", "spp.alloc", + FT_UINT16, BASE_DEC, NULL, 0x0, + "", HFILL }}, + + { &hf_spp_rexmt_frame, + { "Retransmitted Frame Number", "spp.rexmt_frame", + FT_FRAMENUM, BASE_NONE, NULL, 0x0, + "", HFILL }}, + }; + + static gint *ett[] = { + &ett_spp, + &ett_spp_connctrl, + }; + + proto_spp = proto_register_protocol("Sequenced Packet Protocol", + "SPP", "spp"); + proto_register_field_array(proto_spp, hf_spp, array_length(hf_spp)); + proto_register_subtree_array(ett, array_length(ett)); +} + +void +proto_reg_handoff_spp(void) +{ + dissector_handle_t spp_handle; + + spp_handle = create_dissector_handle(dissect_spp, proto_spp); + dissector_add("idp.packet_type", IDP_PACKET_TYPE_SPP, spp_handle); + + data_handle = find_dissector("data"); +} @@ -80,6 +80,10 @@ #define ETHERTYPE_3C_NBP_DGRAM 0x3c07 #endif +#ifndef ETHERTYPE_XNS_IDP +#define ETHERTYPE_XNS_IDP 0x0600 +#endif + #ifndef ETHERTYPE_IP #define ETHERTYPE_IP 0x0800 #endif |