2004-08-05 07:20:00 +00:00
|
|
|
/* packet-ax4000.c
|
2004-08-06 05:32:59 +00:00
|
|
|
* Routines for Spirent AX/4000 Test Block dissection
|
2004-08-05 07:20:00 +00:00
|
|
|
* Copyright 2004, SEKINE Hideki <sekineh@gf7.so-net.ne.jp>
|
|
|
|
*
|
2006-05-21 04:49:01 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2004-08-05 07:20:00 +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.
|
2009-09-24 16:54:54 +00:00
|
|
|
*
|
2004-08-05 07:20:00 +00:00
|
|
|
* 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.
|
2009-09-24 16:54:54 +00:00
|
|
|
*
|
2004-08-05 07:20:00 +00:00
|
|
|
* 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 23:18:38 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2004-08-05 07:20:00 +00:00
|
|
|
*/
|
|
|
|
|
2012-09-20 02:03:38 +00:00
|
|
|
#include "config.h"
|
2004-08-05 07:20:00 +00:00
|
|
|
|
|
|
|
#include <epan/packet.h>
|
2014-12-20 21:23:59 +00:00
|
|
|
#include <epan/ipproto.h>
|
2004-08-05 07:20:00 +00:00
|
|
|
|
2013-03-14 07:37:13 +00:00
|
|
|
void proto_register_ax4000(void);
|
|
|
|
void proto_reg_handoff_ax4000(void);
|
|
|
|
|
2004-08-05 07:20:00 +00:00
|
|
|
/* Initialize the protocol and registered fields */
|
|
|
|
static int proto_ax4000 = -1;
|
|
|
|
static int hf_ax4000_port = -1;
|
|
|
|
static int hf_ax4000_chassis = -1;
|
|
|
|
static int hf_ax4000_fill = -1;
|
|
|
|
static int hf_ax4000_index = -1;
|
|
|
|
static int hf_ax4000_timestamp = -1;
|
|
|
|
static int hf_ax4000_seq = -1;
|
|
|
|
static int hf_ax4000_crc = -1;
|
|
|
|
|
|
|
|
/* Initialize the subtree pointers */
|
|
|
|
static gint ett_ax4000 = -1;
|
|
|
|
|
|
|
|
/* Code to actually dissect the packets */
|
2015-11-15 13:00:10 +00:00
|
|
|
static int
|
|
|
|
dissect_ax4000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
|
2004-08-05 07:20:00 +00:00
|
|
|
{
|
|
|
|
proto_item *ti;
|
|
|
|
proto_tree *ax4000_tree;
|
2011-10-21 02:10:19 +00:00
|
|
|
|
2009-09-24 16:54:54 +00:00
|
|
|
guint8 ax_port;
|
|
|
|
guint8 ax_chassis;
|
2004-08-05 07:20:00 +00:00
|
|
|
guint16 ax_index;
|
|
|
|
guint32 ax_seq;
|
|
|
|
guint32 ax_timestamp;
|
|
|
|
|
|
|
|
/* Make entries in Protocol column and Info column on summary display */
|
2009-08-09 06:26:46 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "AX4000");
|
2009-09-24 16:54:54 +00:00
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
|
|
|
|
2004-08-05 07:20:00 +00:00
|
|
|
ax_port = tvb_get_guint8(tvb, 0);
|
|
|
|
ax_chassis = tvb_get_guint8(tvb, 1);
|
|
|
|
ax_index = tvb_get_ntohs(tvb, 2) & 0x0FFF;
|
|
|
|
ax_timestamp = tvb_get_letohl(tvb, 6);
|
|
|
|
ax_seq = tvb_get_letohl(tvb, 10);
|
2011-10-21 02:10:19 +00:00
|
|
|
|
2009-09-24 16:54:54 +00:00
|
|
|
col_append_fstr(pinfo->cinfo, COL_INFO,
|
2004-08-05 07:20:00 +00:00
|
|
|
"Chss:%u Prt:%u Idx:%u Seq:0x%08x TS:%.6f[msec]",
|
|
|
|
ax_chassis, ax_port, ax_index, ax_seq, ax_timestamp*1e-5);
|
2011-10-21 02:10:19 +00:00
|
|
|
|
2004-08-05 07:20:00 +00:00
|
|
|
if (tree) {
|
|
|
|
/* create display subtree for the protocol */
|
2011-10-21 02:10:19 +00:00
|
|
|
ti = proto_tree_add_item(tree, proto_ax4000, tvb, 0, -1, ENC_NA);
|
2004-08-05 07:20:00 +00:00
|
|
|
|
|
|
|
ax4000_tree = proto_item_add_subtree(ti, ett_ax4000);
|
|
|
|
|
|
|
|
proto_tree_add_uint(ax4000_tree,
|
|
|
|
hf_ax4000_port, tvb, 0, 1, ax_port);
|
|
|
|
proto_tree_add_uint(ax4000_tree,
|
|
|
|
hf_ax4000_chassis, tvb, 1, 1, ax_chassis);
|
|
|
|
proto_tree_add_item(ax4000_tree,
|
2011-10-06 03:35:44 +00:00
|
|
|
hf_ax4000_fill, tvb, 2, 1, ENC_BIG_ENDIAN);
|
2004-08-05 07:20:00 +00:00
|
|
|
proto_tree_add_uint(ax4000_tree,
|
|
|
|
hf_ax4000_index, tvb, 2, 2, ax_index);
|
|
|
|
proto_tree_add_uint(ax4000_tree,
|
|
|
|
hf_ax4000_timestamp, tvb, 6, 4, ax_timestamp);
|
|
|
|
proto_tree_add_uint(ax4000_tree,
|
|
|
|
hf_ax4000_seq, tvb, 10, 4, ax_seq);
|
|
|
|
proto_tree_add_uint(ax4000_tree,
|
|
|
|
hf_ax4000_crc, tvb, 14, 2, tvb_get_letohs(tvb, 14));
|
|
|
|
}
|
|
|
|
|
2015-11-15 13:00:10 +00:00
|
|
|
return tvb_captured_length(tvb);
|
2004-08-05 07:20:00 +00:00
|
|
|
}
|
|
|
|
|
2006-05-21 04:49:01 +00:00
|
|
|
/* Register the protocol with Wireshark */
|
2004-08-05 07:20:00 +00:00
|
|
|
|
|
|
|
/* this format is require because a script is used to build the C function
|
|
|
|
that calls all the protocol registration.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_register_ax4000(void)
|
2009-09-24 16:54:54 +00:00
|
|
|
{
|
2004-08-05 07:20:00 +00:00
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{ &hf_ax4000_port,
|
2014-10-05 19:57:05 +00:00
|
|
|
{ "Port Number", "ax4000.port",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
2004-08-05 07:20:00 +00:00
|
|
|
},
|
|
|
|
{ &hf_ax4000_chassis,
|
2014-10-05 19:57:05 +00:00
|
|
|
{ "Chassis Number", "ax4000.chassis",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
2004-08-05 07:20:00 +00:00
|
|
|
},
|
|
|
|
{ &hf_ax4000_fill,
|
2014-10-05 19:57:05 +00:00
|
|
|
{ "Fill Type", "ax4000.fill",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0xc0,
|
|
|
|
NULL, HFILL }
|
2004-08-05 07:20:00 +00:00
|
|
|
},
|
|
|
|
{ &hf_ax4000_index,
|
2014-10-05 19:57:05 +00:00
|
|
|
{ "Index", "ax4000.index",
|
|
|
|
FT_UINT16, BASE_DEC, NULL, 0x0FFF,
|
|
|
|
NULL, HFILL }
|
2004-08-05 07:20:00 +00:00
|
|
|
},
|
|
|
|
{ &hf_ax4000_timestamp,
|
2014-10-05 19:57:05 +00:00
|
|
|
{ "Timestamp", "ax4000.timestamp",
|
|
|
|
FT_UINT32, BASE_HEX, NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
2004-08-05 07:20:00 +00:00
|
|
|
},
|
|
|
|
{ &hf_ax4000_seq,
|
2014-10-05 19:57:05 +00:00
|
|
|
{ "Sequence Number", "ax4000.seq",
|
|
|
|
FT_UINT32, BASE_HEX, NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
2004-08-05 07:20:00 +00:00
|
|
|
},
|
|
|
|
{ &hf_ax4000_crc,
|
2014-10-05 19:57:05 +00:00
|
|
|
{ "CRC (unchecked)", "ax4000.crc",
|
|
|
|
FT_UINT16, BASE_HEX, NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
2004-08-05 07:20:00 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Setup protocol subtree array */
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_ax4000
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Register the protocol name and description */
|
|
|
|
proto_ax4000 = proto_register_protocol("AX/4000 Test Block",
|
2014-10-05 19:57:05 +00:00
|
|
|
"AX4000", "ax4000");
|
2004-08-05 07:20:00 +00:00
|
|
|
|
|
|
|
/* Required function calls to register the header fields and subtrees used */
|
|
|
|
proto_register_field_array(proto_ax4000, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
|
|
|
}
|
|
|
|
|
|
|
|
#define AX4000_TCP_PORT 3357 /* assigned by IANA */
|
|
|
|
#define AX4000_UDP_PORT 3357 /* assigned by IANA */
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_ax4000(void)
|
|
|
|
{
|
|
|
|
dissector_handle_t ax4000_handle;
|
|
|
|
|
2015-12-09 03:49:44 +00:00
|
|
|
ax4000_handle = create_dissector_handle(dissect_ax4000,
|
2004-08-05 07:20:00 +00:00
|
|
|
proto_ax4000);
|
2010-12-20 05:35:29 +00:00
|
|
|
dissector_add_uint("ip.proto", IP_PROTO_AX4000, ax4000_handle);
|
|
|
|
dissector_add_uint("tcp.port", AX4000_TCP_PORT, ax4000_handle);
|
|
|
|
dissector_add_uint("udp.port", AX4000_UDP_PORT, ax4000_handle);
|
2004-08-05 07:20:00 +00:00
|
|
|
}
|
2014-10-05 19:57:05 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* 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:
|
|
|
|
*/
|