Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-vicp.c
blob7440baebef55f4d1e61fa8e4800ab401c03aedd5
1 /* packet-vicp.c
2 * LeCroy VICP (GPIB-over-Ethernet-but-lets-not-do-LXI) dissector
4 * Written by Frank Kingswood <frank.kingswood@artimi.com>
5 * Copyright 2008, Artimi Ltd.
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * SPDX-License-Identifier: GPL-2.0-or-later
14 #include "config.h"
16 #include <epan/packet.h>
17 #include <epan/ptvcursor.h>
19 /* registration object IDs */
20 static int proto_vicp;
21 static int hf_vicp_operation;
22 static int hf_vicp_version;
23 static int hf_vicp_sequence;
24 static int hf_vicp_unused;
25 static int hf_vicp_length;
26 static int hf_vicp_data;
27 static int ett_vicp;
29 #define VICP_PORT 1861
31 void proto_register_vicp(void);
32 void proto_reg_handoff_vicp(void);
34 static dissector_handle_t vicp_handle;
36 static int dissect_vicp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
38 proto_item *ti;
39 proto_tree *vicp_tree;
40 ptvcursor_t* cursor;
42 unsigned len;
44 if (tvb_reported_length_remaining(tvb, 0) < 8)
46 /* Payload too small for VICP */
47 return 0;
50 col_set_str(pinfo->cinfo, COL_PROTOCOL, "VICP");
52 col_clear(pinfo->cinfo, COL_INFO);
54 ti = proto_tree_add_item(tree, proto_vicp, tvb, 0, -1, ENC_NA);
55 vicp_tree = proto_item_add_subtree(ti, ett_vicp);
56 cursor = ptvcursor_new(pinfo->pool, vicp_tree, tvb, 0);
58 ptvcursor_add(cursor, hf_vicp_operation, 1, ENC_BIG_ENDIAN);
59 ptvcursor_add(cursor, hf_vicp_version, 1, ENC_BIG_ENDIAN);
60 ptvcursor_add(cursor, hf_vicp_sequence, 1, ENC_BIG_ENDIAN);
61 ptvcursor_add(cursor, hf_vicp_unused, 1, ENC_BIG_ENDIAN);
63 len=tvb_get_ntohl(tvb, ptvcursor_current_offset(cursor));
64 ptvcursor_add(cursor, hf_vicp_length, 4, ENC_BIG_ENDIAN);
66 ptvcursor_add(cursor, hf_vicp_data, len, ENC_NA);
68 ptvcursor_free(cursor);
69 return tvb_captured_length(tvb);
72 void proto_register_vicp(void)
74 static hf_register_info hf[] =
76 { &hf_vicp_operation,
77 { "Operation","vicp.operation",FT_UINT8,BASE_HEX,NULL,0x0,NULL,HFILL }
79 { &hf_vicp_version,
80 { "Protocol version","vicp.version",FT_UINT8,BASE_DEC,NULL,0x0,NULL,HFILL }
82 { &hf_vicp_sequence,
83 { "Sequence number","vicp.sequence",FT_UINT8,BASE_DEC,NULL,0x0,NULL,HFILL }
85 { &hf_vicp_unused,
86 { "Unused","vicp.unused",FT_UINT8,BASE_HEX,NULL,0x0,NULL,HFILL }
88 { &hf_vicp_length,
89 { "Data length","vicp.length",FT_UINT32,BASE_DEC,NULL,0x0,NULL,HFILL }
91 { &hf_vicp_data,
92 { "Data","vicp.data",FT_BYTES,BASE_NONE,NULL,0x0,NULL,HFILL }
96 static int *ett[] =
97 { &ett_vicp
100 proto_vicp = proto_register_protocol("LeCroy VICP", "VICP", "vicp");
101 proto_register_field_array(proto_vicp, hf, array_length(hf));
102 proto_register_subtree_array(ett, array_length(ett));
103 vicp_handle = register_dissector("vicp", dissect_vicp, proto_vicp);
106 void proto_reg_handoff_vicp(void)
108 dissector_add_uint_with_preference("tcp.port", VICP_PORT, vicp_handle);
112 * Editor modelines - https://www.wireshark.org/tools/modelines.html
114 * Local Variables:
115 * c-basic-offset: 3
116 * tab-width: 8
117 * indent-tabs-mode: nil
118 * End:
120 * ex: set shiftwidth=3 tabstop=8 expandtab:
121 * :indentSize=3:tabSize=8:noTabs=true: