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 * SPDX-License-Identifier: GPL-2.0-or-later
17 #include <epan/packet.h>
19 #include "packet-ioraw.h"
21 void proto_register_ioraw(void);
22 void proto_reg_handoff_ioraw(void);
24 /* Define the ioraw proto */
29 static dissector_handle_t ioraw_handle
;
31 /* static int hf_ioraw_summary; */
32 static int hf_ioraw_header
;
33 static int hf_ioraw_data
;
36 static void IoRawSummaryFormater( char *szText
, int nMax
)
38 snprintf ( szText
, nMax
, "Raw IO Data" );
41 static int dissect_ioraw(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
44 proto_tree
*ioraw_tree
;
47 int nMax
= sizeof(szText
)-1;
49 unsigned ioraw_length
= tvb_reported_length(tvb
);
51 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "IO-RAW");
53 IoRawSummaryFormater(szText
, nMax
);
54 col_add_str(pinfo
->cinfo
, COL_INFO
, szText
);
58 ti
= proto_tree_add_item(tree
, proto_ioraw
, tvb
, 0, -1, ENC_NA
);
59 ioraw_tree
= proto_item_add_subtree(ti
, ett_ioraw
);
61 proto_item_append_text(ti
,": %s",szText
);
62 proto_tree_add_item(ioraw_tree
, hf_ioraw_header
, tvb
, offset
, IoRawParserHDR_Len
, ENC_NA
);
63 offset
+=IoRawParserHDR_Len
;
65 proto_tree_add_item(ioraw_tree
, hf_ioraw_data
, tvb
, offset
, ioraw_length
- offset
, ENC_NA
);
67 return tvb_captured_length(tvb
);
70 void proto_register_ioraw(void)
72 static hf_register_info hf
[] =
76 { "Summary of the IoRaw Packet", "ioraw.summary",
77 FT_STRING
, BASE_NONE
, NULL
, 0x0,
81 { &hf_ioraw_header
, { "Header", "ioraw.header",
82 FT_NONE
, BASE_NONE
, NULL
, 0x0,
85 { &hf_ioraw_data
, { "VarData", "ioraw.data",
86 FT_NONE
, BASE_NONE
, NULL
, 0x0,
96 proto_ioraw
= proto_register_protocol("TwinCAT IO-RAW",
98 proto_register_field_array(proto_ioraw
,hf
,array_length(hf
));
99 proto_register_subtree_array(ett
,array_length(ett
));
100 ioraw_handle
= register_dissector("ioraw", dissect_ioraw
, proto_ioraw
);
103 void proto_reg_handoff_ioraw(void)
105 dissector_add_uint("ecatf.type", 3, ioraw_handle
);
109 * Editor modelines - https://www.wireshark.org/tools/modelines.html
114 * indent-tabs-mode: nil
117 * vi: set shiftwidth=3 tabstop=8 expandtab:
118 * :indentSize=3:tabSize=8:noTabs=true: