Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-spray.c
blobfc23de5687d8186ce919144575e8d6669a184a5f
1 /* packet-spray.c
2 * 2001 Ronnie Sahlberg <See AUTHORS for email>
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
8 * SPDX-License-Identifier: GPL-2.0-or-later
9 */
11 #include "config.h"
13 #include "packet-rpc.h"
15 void proto_register_spray(void);
16 void proto_reg_handoff_spray(void);
18 static int proto_spray;
19 static int hf_spray_procedure_v1;
20 static int hf_spray_sprayarr;
21 static int hf_spray_counter;
22 static int hf_spray_clock;
23 static int hf_spray_sec;
24 static int hf_spray_usec;
26 static int ett_spray;
27 static int ett_spray_clock;
29 #define PACKET_SPRAY_H
31 #define SPRAYPROC_NULL 0
32 #define SPRAYPROC_SPRAY 1
33 #define SPRAYPROC_GET 2
34 #define SPRAYPROC_CLEAR 3
36 #define SPRAY_PROGRAM 100012
38 static int
39 dissect_get_reply(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
41 proto_item* lock_item = NULL;
42 proto_tree* lock_tree = NULL;
43 int offset = 0;
45 offset = dissect_rpc_uint32(tvb, tree,
46 hf_spray_counter, offset);
48 lock_item = proto_tree_add_item(tree, hf_spray_clock, tvb,
49 offset, -1, ENC_NA);
51 lock_tree = proto_item_add_subtree(lock_item, ett_spray_clock);
53 offset = dissect_rpc_uint32(tvb, lock_tree,
54 hf_spray_sec, offset);
56 offset = dissect_rpc_uint32(tvb, lock_tree,
57 hf_spray_usec, offset);
59 return offset;
62 static int
63 dissect_spray_call(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
65 return dissect_rpc_data(tvb, tree, hf_spray_sprayarr, 0);
68 /* proc number, "proc name", dissect_request, dissect_reply */
69 static const vsff spray1_proc[] = {
70 { SPRAYPROC_NULL, "NULL",
71 dissect_rpc_void, dissect_rpc_void },
72 { SPRAYPROC_SPRAY, "SPRAY",
73 dissect_spray_call, dissect_rpc_void },
74 { SPRAYPROC_GET, "GET",
75 dissect_rpc_void, dissect_get_reply },
76 { SPRAYPROC_CLEAR, "CLEAR",
77 dissect_rpc_void, dissect_rpc_void },
78 { 0, NULL, NULL, NULL }
80 static const value_string spray1_proc_vals[] = {
81 { SPRAYPROC_NULL, "NULL" },
82 { SPRAYPROC_SPRAY, "SPRAY" },
83 { SPRAYPROC_GET, "GET" },
84 { SPRAYPROC_CLEAR, "CLEAR" },
85 { 0, NULL }
88 static const rpc_prog_vers_info spray_vers_info[] = {
89 { 1, spray1_proc, &hf_spray_procedure_v1 },
92 void
93 proto_register_spray(void)
95 static hf_register_info hf[] = {
96 { &hf_spray_procedure_v1, {
97 "V1 Procedure", "spray.procedure_v1", FT_UINT32, BASE_DEC,
98 VALS(spray1_proc_vals), 0, NULL, HFILL }},
99 { &hf_spray_sprayarr, {
100 "Data", "spray.sprayarr", FT_BYTES, BASE_NONE,
101 NULL, 0, "Sprayarr data", HFILL }},
103 { &hf_spray_counter, {
104 "counter", "spray.counter", FT_UINT32, BASE_DEC,
105 NULL, 0, NULL, HFILL }},
107 { &hf_spray_clock, {
108 "clock", "spray.clock", FT_NONE, BASE_NONE,
109 NULL, 0, NULL, HFILL }},
111 { &hf_spray_sec, {
112 "sec", "spray.sec", FT_UINT32, BASE_DEC,
113 NULL, 0, "Seconds", HFILL }},
115 { &hf_spray_usec, {
116 "usec", "spray.usec", FT_UINT32, BASE_DEC,
117 NULL, 0, "Microseconds", HFILL }}
121 static int *ett[] = {
122 &ett_spray,
123 &ett_spray_clock,
126 proto_spray = proto_register_protocol("SPRAY", "SPRAY", "spray");
127 proto_register_field_array(proto_spray, hf, array_length(hf));
128 proto_register_subtree_array(ett, array_length(ett));
131 void
132 proto_reg_handoff_spray(void)
134 /* Register the protocol as RPC */
135 rpc_init_prog(proto_spray, SPRAY_PROGRAM, ett_spray,
136 G_N_ELEMENTS(spray_vers_info), spray_vers_info);
140 * Editor modelines - https://www.wireshark.org/tools/modelines.html
142 * Local variables:
143 * c-basic-offset: 8
144 * tab-width: 8
145 * indent-tabs-mode: t
146 * End:
148 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
149 * :indentSize=8:tabSize=8:noTabs=false: