Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / plugins / epan / ethercat / packet-ioraw.c
bloba6554cfd423bb1c71c6d76bf13d5559dba824809
1 /* packet-ioraw.c
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
13 /* Include files */
15 #include "config.h"
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 */
25 int proto_ioraw;
27 static int ett_ioraw;
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;
35 /*ioraw*/
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_)
43 proto_item *ti;
44 proto_tree *ioraw_tree;
45 int offset = 0;
46 char szText[200];
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);
56 if (tree)
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[] =
74 #if 0
75 { &hf_ioraw_summary,
76 { "Summary of the IoRaw Packet", "ioraw.summary",
77 FT_STRING, BASE_NONE, NULL, 0x0,
78 NULL, HFILL }
80 #endif
81 { &hf_ioraw_header, { "Header", "ioraw.header",
82 FT_NONE, BASE_NONE, NULL, 0x0,
83 NULL, HFILL }
85 { &hf_ioraw_data, { "VarData", "ioraw.data",
86 FT_NONE, BASE_NONE, NULL, 0x0,
87 NULL, HFILL }
91 static int *ett[] =
93 &ett_ioraw
96 proto_ioraw = proto_register_protocol("TwinCAT IO-RAW",
97 "IO-RAW","ioraw");
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
111 * Local Variables:
112 * c-basic-offset: 3
113 * tab-width: 8
114 * indent-tabs-mode: nil
115 * End:
117 * vi: set shiftwidth=3 tabstop=8 expandtab:
118 * :indentSize=3:tabSize=8:noTabs=true: