2004-03-23 01:02:41 +00:00
|
|
|
/* packet-ap1394.c
|
|
|
|
* Routines for Apple IP-over-IEEE 1394 packet disassembly
|
|
|
|
*
|
2006-05-21 04:49:01 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2004-03-23 01:02:41 +00:00
|
|
|
* 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
|
2012-06-28 22:56:06 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2004-03-23 01:02:41 +00:00
|
|
|
*/
|
|
|
|
|
2012-09-20 02:03:38 +00:00
|
|
|
#include "config.h"
|
2004-03-23 01:02:41 +00:00
|
|
|
|
|
|
|
#include <epan/packet.h>
|
2015-12-13 04:38:21 +00:00
|
|
|
#include <epan/capture_dissectors.h>
|
2013-11-09 15:44:29 +00:00
|
|
|
#include <wsutil/pint.h>
|
2004-08-06 19:57:49 +00:00
|
|
|
#include <epan/addr_resolv.h>
|
2004-03-23 01:02:41 +00:00
|
|
|
|
2005-09-17 00:02:31 +00:00
|
|
|
#include <epan/etypes.h>
|
2004-03-23 01:02:41 +00:00
|
|
|
|
2013-03-12 23:09:37 +00:00
|
|
|
void proto_register_ap1394(void);
|
|
|
|
void proto_reg_handoff_ap1394(void);
|
|
|
|
|
2004-03-23 01:02:41 +00:00
|
|
|
static int proto_ap1394 = -1;
|
|
|
|
static int hf_ap1394_dst = -1;
|
|
|
|
static int hf_ap1394_src = -1;
|
|
|
|
static int hf_ap1394_type = -1;
|
|
|
|
|
|
|
|
static gint ett_ap1394 = -1;
|
|
|
|
|
2009-05-05 03:50:06 +00:00
|
|
|
static dissector_table_t ethertype_subdissector_table;
|
|
|
|
|
2015-12-13 21:54:16 +00:00
|
|
|
static gboolean
|
Fix some warnings/errors of type
git/epan/dissectors/packet-a21.c:478:25: error: 'item' was marked unused but was used
[-Werror,-Wused-but-marked-unused]
proto_item_append_text(item, "%s", val_to_str_const(event_id, a21_event_vals, "Unknown"));
^
Added manual change id because file-jpeg.c forced the use of commit -n
Change-Id: Iffff53d6253758c8454d9583f0a11f317c8390cb
Fix warnings/errors of type:
git/epan/dissectors/packet-ax25-kiss.c:205:52: error: 'pseudo_header' was marked unused but was
used [-Werror,-Wused-but-marked-unused]
return capture_ax25( pd, l_offset, len, cpinfo, pseudo_header );
Fix checkhf warnings:
Unused entry: epan/dissectors/packet-artnet.c, hf_artnet_address_netswitch
Unused entry: epan/dissectors/packet-artnet.c, hf_artnet_address_subswitch
Unused entry: epan/dissectors/packet-artnet.c, hf_artnet_poll_reply_trailer
Unused entry: epan/dissectors/packet-artnet.c, hf_artnet_rdm_universe
Unused entry: epan/dissectors/packet-artnet.c, hf_artnet_tod_data_universe
Change-Id: Id1fa12afb97a8e9cd4ed0ea25351c3b2639c930e
Reviewed-on: https://code.wireshark.org/review/14667
Reviewed-by: Jörg Mayer <jmayer@loplof.de>
2016-03-28 11:37:24 +00:00
|
|
|
capture_ap1394(const guchar *pd, int offset, int len, capture_packet_info_t *cpinfo, const union wtap_pseudo_header *pseudo_header)
|
2004-03-23 01:02:41 +00:00
|
|
|
{
|
|
|
|
guint16 etype;
|
|
|
|
|
|
|
|
if (!BYTES_ARE_IN_FRAME(offset, len, 18)) {
|
2015-12-13 21:54:16 +00:00
|
|
|
return FALSE;
|
2004-03-23 01:02:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Skip destination and source addresses */
|
|
|
|
offset += 16;
|
|
|
|
|
2013-11-29 18:59:06 +00:00
|
|
|
etype = pntoh16(&pd[offset]);
|
2004-03-23 01:02:41 +00:00
|
|
|
offset += 2;
|
2015-12-15 00:25:31 +00:00
|
|
|
return try_capture_dissector("ethertype", etype, pd, offset, len, cpinfo, pseudo_header);
|
2004-03-23 01:02:41 +00:00
|
|
|
}
|
|
|
|
|
2015-11-15 13:00:10 +00:00
|
|
|
static int
|
|
|
|
dissect_ap1394(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
|
2004-03-23 01:02:41 +00:00
|
|
|
{
|
|
|
|
proto_item *ti;
|
|
|
|
proto_tree *fh_tree = NULL;
|
|
|
|
guint16 etype;
|
2009-05-05 03:50:06 +00:00
|
|
|
tvbuff_t *next_tvb;
|
2004-03-23 01:02:41 +00:00
|
|
|
|
2009-08-09 06:26:46 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "IP/IEEE1394");
|
2009-08-09 07:36:13 +00:00
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
2004-03-23 01:02:41 +00:00
|
|
|
|
2015-10-29 03:12:53 +00:00
|
|
|
set_address_tvb(&pinfo->dl_src, AT_EUI64, 8, tvb, 8);
|
2015-10-21 19:04:16 +00:00
|
|
|
copy_address_shallow(&pinfo->src, &pinfo->dl_src);
|
2015-10-29 03:12:53 +00:00
|
|
|
set_address_tvb(&pinfo->dl_dst, AT_EUI64, 8, tvb, 0);
|
2015-10-21 19:04:16 +00:00
|
|
|
copy_address_shallow(&pinfo->dst, &pinfo->dl_dst);
|
2004-03-23 01:02:41 +00:00
|
|
|
|
|
|
|
if (tree) {
|
|
|
|
ti = proto_tree_add_protocol_format(tree, proto_ap1394, tvb, 0, 18,
|
2014-09-30 23:12:26 +00:00
|
|
|
"Apple IP-over-IEEE 1394, Src: %s, Dst: %s",
|
2015-01-07 23:13:23 +00:00
|
|
|
address_to_str(wmem_packet_scope(), &pinfo->src), address_to_str(wmem_packet_scope(), &pinfo->dst));
|
2004-03-23 01:02:41 +00:00
|
|
|
fh_tree = proto_item_add_subtree(ti, ett_ap1394);
|
2015-01-06 19:54:03 +00:00
|
|
|
proto_tree_add_item(fh_tree, hf_ap1394_dst, tvb, 0, 8, ENC_NA);
|
|
|
|
proto_tree_add_item(fh_tree, hf_ap1394_src, tvb, 8, 8, ENC_NA);
|
2004-03-23 01:02:41 +00:00
|
|
|
}
|
|
|
|
etype = tvb_get_ntohs(tvb, 16);
|
2015-01-06 19:54:03 +00:00
|
|
|
proto_tree_add_uint(fh_tree, hf_ap1394_type, tvb, 16, 2, etype);
|
2009-08-16 12:36:22 +00:00
|
|
|
next_tvb = tvb_new_subset_remaining(tvb, 18);
|
2010-12-20 05:35:29 +00:00
|
|
|
if (!dissector_try_uint(ethertype_subdissector_table, etype, next_tvb,
|
2014-09-30 23:12:26 +00:00
|
|
|
pinfo, tree))
|
2015-11-15 13:00:10 +00:00
|
|
|
{
|
2016-03-20 00:33:14 +00:00
|
|
|
call_data_dissector(next_tvb, pinfo, tree);
|
2015-11-15 13:00:10 +00:00
|
|
|
}
|
|
|
|
return tvb_captured_length(tvb);
|
2004-03-23 01:02:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_register_ap1394(void)
|
|
|
|
{
|
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{ &hf_ap1394_dst,
|
|
|
|
{ "Destination", "ap1394.dst", FT_BYTES, BASE_NONE,
|
|
|
|
NULL, 0x0, "Destination address", HFILL }},
|
|
|
|
{ &hf_ap1394_src,
|
|
|
|
{ "Source", "ap1394.src", FT_BYTES, BASE_NONE,
|
|
|
|
NULL, 0x0, "Source address", HFILL }},
|
|
|
|
/* registered here but handled in ethertype.c */
|
|
|
|
{ &hf_ap1394_type,
|
2014-09-30 23:12:26 +00:00
|
|
|
{ "Type", "ap1394.type", FT_UINT16, BASE_HEX,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
VALS(etype_vals), 0x0, NULL, HFILL }},
|
2004-03-23 01:02:41 +00:00
|
|
|
};
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_ap1394,
|
|
|
|
};
|
|
|
|
|
|
|
|
proto_ap1394 = proto_register_protocol("Apple IP-over-IEEE 1394", "IP/IEEE1394", "ap1394");
|
|
|
|
proto_register_field_array(proto_ap1394, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_ap1394(void)
|
|
|
|
{
|
|
|
|
dissector_handle_t ap1394_handle;
|
2016-10-26 16:07:47 +00:00
|
|
|
capture_dissector_handle_t ap1394_cap_handle;
|
2004-03-23 01:02:41 +00:00
|
|
|
|
2009-05-05 03:50:06 +00:00
|
|
|
ethertype_subdissector_table = find_dissector_table("ethertype");
|
|
|
|
|
2015-12-09 03:49:44 +00:00
|
|
|
ap1394_handle = create_dissector_handle(dissect_ap1394, proto_ap1394);
|
2010-12-20 05:35:29 +00:00
|
|
|
dissector_add_uint("wtap_encap", WTAP_ENCAP_APPLE_IP_OVER_IEEE1394, ap1394_handle);
|
2016-10-26 16:07:47 +00:00
|
|
|
|
|
|
|
ap1394_cap_handle = create_capture_dissector_handle(capture_ap1394, proto_ap1394);
|
|
|
|
capture_dissector_add_uint("wtap_encap", WTAP_ENCAP_APPLE_IP_OVER_IEEE1394, ap1394_cap_handle);
|
2004-03-23 01:02:41 +00:00
|
|
|
}
|
2014-09-30 23:12:26 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
|
|
|
*
|
|
|
|
* Local Variables:
|
|
|
|
* c-basic-offset: 2
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: nil
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* ex: set shiftwidth=2 tabstop=8 expandtab:
|
|
|
|
* :indentSize=2:tabSize=8:noTabs=true:
|
|
|
|
*/
|