2 * Routines for ethercat packet disassembly
4 * Copyright (c) 2007 by Beckhoff Automation GmbH
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
31 #include <epan/packet.h>
33 #include "packet-ioraw.h"
35 void proto_register_ioraw(void);
36 void proto_reg_handoff_ioraw(void);
38 /* Define the ioraw proto */
41 static int ett_ioraw = -1;
43 /* static int hf_ioraw_summary = -1; */
44 static int hf_ioraw_header = -1;
45 static int hf_ioraw_data = -1;
48 static void IoRawSummaryFormater( char *szText, int nMax)
50 g_snprintf ( szText, nMax, "Raw IO Data" );
53 static void dissect_ioraw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
56 proto_tree *ioraw_tree;
59 int nMax = sizeof(szText)-1;
61 guint ioraw_length = tvb_reported_length(tvb);
63 col_set_str(pinfo->cinfo, COL_PROTOCOL, "IO-RAW");
65 IoRawSummaryFormater(szText, nMax);
66 col_add_str(pinfo->cinfo, COL_INFO, szText);
70 ti = proto_tree_add_item(tree, proto_ioraw, tvb, 0, -1, ENC_NA);
71 ioraw_tree = proto_item_add_subtree(ti, ett_ioraw);
73 proto_item_append_text(ti,": %s",szText);
74 proto_tree_add_item(ioraw_tree, hf_ioraw_header, tvb, offset, IoRawParserHDR_Len, ENC_NA);
75 offset+=IoRawParserHDR_Len;
77 proto_tree_add_item(ioraw_tree, hf_ioraw_data, tvb, offset, ioraw_length - offset, ENC_NA);
81 void proto_register_ioraw(void)
83 static hf_register_info hf[] =
87 { "Summary of the IoRaw Packet", "ioraw.summary",
88 FT_STRING, BASE_NONE, NULL, 0x0,
92 { &hf_ioraw_header, { "Header", "ioraw.header",
93 FT_NONE, BASE_NONE, NULL, 0x0,
96 { &hf_ioraw_data, { "VarData", "ioraw.data",
97 FT_NONE, BASE_NONE, NULL, 0x0,
107 proto_ioraw = proto_register_protocol("TwinCAT IO-RAW",
109 proto_register_field_array(proto_ioraw,hf,array_length(hf));
110 proto_register_subtree_array(ett,array_length(ett));
113 void proto_reg_handoff_ioraw(void)
115 dissector_handle_t ioraw_handle;
117 ioraw_handle = create_dissector_handle(dissect_ioraw, proto_ioraw);
119 dissector_add_uint("ecatf.type", 3, ioraw_handle);
123 * Editor modelines - http://www.wireshark.org/tools/modelines.html
128 * indent-tabs-mode: nil
131 * vi: set shiftwidth=3 tabstop=8 expandtab:
132 * :indentSize=3:tabSize=8:noTabs=true: