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.
29 #include <epan/packet.h>
31 #include "packet-ioraw.h"
33 void proto_register_ioraw(void);
34 void proto_reg_handoff_ioraw(void);
36 /* Define the ioraw proto */
39 static int ett_ioraw = -1;
41 /* static int hf_ioraw_summary = -1; */
42 static int hf_ioraw_header = -1;
43 static int hf_ioraw_data = -1;
46 static void IoRawSummaryFormater( char *szText, int nMax)
48 g_snprintf ( szText, nMax, "Raw IO Data" );
51 static int dissect_ioraw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
54 proto_tree *ioraw_tree;
57 int nMax = sizeof(szText)-1;
59 guint ioraw_length = tvb_reported_length(tvb);
61 col_set_str(pinfo->cinfo, COL_PROTOCOL, "IO-RAW");
63 IoRawSummaryFormater(szText, nMax);
64 col_add_str(pinfo->cinfo, COL_INFO, szText);
68 ti = proto_tree_add_item(tree, proto_ioraw, tvb, 0, -1, ENC_NA);
69 ioraw_tree = proto_item_add_subtree(ti, ett_ioraw);
71 proto_item_append_text(ti,": %s",szText);
72 proto_tree_add_item(ioraw_tree, hf_ioraw_header, tvb, offset, IoRawParserHDR_Len, ENC_NA);
73 offset+=IoRawParserHDR_Len;
75 proto_tree_add_item(ioraw_tree, hf_ioraw_data, tvb, offset, ioraw_length - offset, ENC_NA);
77 return tvb_captured_length(tvb);
80 void proto_register_ioraw(void)
82 static hf_register_info hf[] =
86 { "Summary of the IoRaw Packet", "ioraw.summary",
87 FT_STRING, BASE_NONE, NULL, 0x0,
91 { &hf_ioraw_header, { "Header", "ioraw.header",
92 FT_NONE, BASE_NONE, NULL, 0x0,
95 { &hf_ioraw_data, { "VarData", "ioraw.data",
96 FT_NONE, BASE_NONE, NULL, 0x0,
106 proto_ioraw = proto_register_protocol("TwinCAT IO-RAW",
108 proto_register_field_array(proto_ioraw,hf,array_length(hf));
109 proto_register_subtree_array(ett,array_length(ett));
112 void proto_reg_handoff_ioraw(void)
114 dissector_handle_t ioraw_handle;
116 ioraw_handle = create_dissector_handle(dissect_ioraw, proto_ioraw);
118 dissector_add_uint("ecatf.type", 3, ioraw_handle);
122 * Editor modelines - http://www.wireshark.org/tools/modelines.html
127 * indent-tabs-mode: nil
130 * vi: set shiftwidth=3 tabstop=8 expandtab:
131 * :indentSize=3:tabSize=8:noTabs=true: