/src/wireshark/epan/dissectors/packet-spray.c
Line | Count | Source |
1 | | /* packet-spray.c |
2 | | * 2001 Ronnie Sahlberg <See AUTHORS for email> |
3 | | * |
4 | | * Wireshark - Network traffic analyzer |
5 | | * By Gerald Combs <gerald@wireshark.org> |
6 | | * Copyright 1998 Gerald Combs |
7 | | * |
8 | | * SPDX-License-Identifier: GPL-2.0-or-later |
9 | | */ |
10 | | |
11 | | #include "config.h" |
12 | | |
13 | | #include "packet-rpc.h" |
14 | | |
15 | | void proto_register_spray(void); |
16 | | void proto_reg_handoff_spray(void); |
17 | | |
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; |
25 | | |
26 | | static int ett_spray; |
27 | | static int ett_spray_clock; |
28 | | |
29 | | #define PACKET_SPRAY_H |
30 | | |
31 | | #define SPRAYPROC_NULL 0 |
32 | | #define SPRAYPROC_SPRAY 1 |
33 | | #define SPRAYPROC_GET 2 |
34 | | #define SPRAYPROC_CLEAR 3 |
35 | | |
36 | 16 | #define SPRAY_PROGRAM 100012 |
37 | | |
38 | | static int |
39 | | dissect_get_reply(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_) |
40 | 0 | { |
41 | 0 | proto_item* lock_item = NULL; |
42 | 0 | proto_tree* lock_tree = NULL; |
43 | 0 | unsigned offset = 0; |
44 | |
|
45 | 0 | offset = dissect_rpc_uint32(tvb, tree, |
46 | 0 | hf_spray_counter, offset); |
47 | |
|
48 | 0 | lock_item = proto_tree_add_item(tree, hf_spray_clock, tvb, |
49 | 0 | offset, -1, ENC_NA); |
50 | |
|
51 | 0 | lock_tree = proto_item_add_subtree(lock_item, ett_spray_clock); |
52 | |
|
53 | 0 | offset = dissect_rpc_uint32(tvb, lock_tree, |
54 | 0 | hf_spray_sec, offset); |
55 | |
|
56 | 0 | offset = dissect_rpc_uint32(tvb, lock_tree, |
57 | 0 | hf_spray_usec, offset); |
58 | |
|
59 | 0 | return offset; |
60 | 0 | } |
61 | | |
62 | | static int |
63 | | dissect_spray_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) |
64 | 0 | { |
65 | 0 | return dissect_rpc_data(tvb, pinfo, tree, hf_spray_sprayarr, 0); |
66 | 0 | } |
67 | | |
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 } |
79 | | }; |
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 } |
86 | | }; |
87 | | |
88 | | static const rpc_prog_vers_info spray_vers_info[] = { |
89 | | { 1, spray1_proc, &hf_spray_procedure_v1 }, |
90 | | }; |
91 | | |
92 | | void |
93 | | proto_register_spray(void) |
94 | 16 | { |
95 | 16 | static hf_register_info hf[] = { |
96 | 16 | { &hf_spray_procedure_v1, { |
97 | 16 | "V1 Procedure", "spray.procedure_v1", FT_UINT32, BASE_DEC, |
98 | 16 | VALS(spray1_proc_vals), 0, NULL, HFILL }}, |
99 | 16 | { &hf_spray_sprayarr, { |
100 | 16 | "Data", "spray.sprayarr", FT_BYTES, BASE_NONE, |
101 | 16 | NULL, 0, "Sprayarr data", HFILL }}, |
102 | | |
103 | 16 | { &hf_spray_counter, { |
104 | 16 | "counter", "spray.counter", FT_UINT32, BASE_DEC, |
105 | 16 | NULL, 0, NULL, HFILL }}, |
106 | | |
107 | 16 | { &hf_spray_clock, { |
108 | 16 | "clock", "spray.clock", FT_NONE, BASE_NONE, |
109 | 16 | NULL, 0, NULL, HFILL }}, |
110 | | |
111 | 16 | { &hf_spray_sec, { |
112 | 16 | "sec", "spray.sec", FT_UINT32, BASE_DEC, |
113 | 16 | NULL, 0, "Seconds", HFILL }}, |
114 | | |
115 | 16 | { &hf_spray_usec, { |
116 | 16 | "usec", "spray.usec", FT_UINT32, BASE_DEC, |
117 | 16 | NULL, 0, "Microseconds", HFILL }} |
118 | | |
119 | 16 | }; |
120 | | |
121 | 16 | static int *ett[] = { |
122 | 16 | &ett_spray, |
123 | 16 | &ett_spray_clock, |
124 | 16 | }; |
125 | | |
126 | 16 | proto_spray = proto_register_protocol("SPRAY", "SPRAY", "spray"); |
127 | 16 | proto_register_field_array(proto_spray, hf, array_length(hf)); |
128 | 16 | proto_register_subtree_array(ett, array_length(ett)); |
129 | 16 | } |
130 | | |
131 | | void |
132 | | proto_reg_handoff_spray(void) |
133 | 16 | { |
134 | | /* Register the protocol as RPC */ |
135 | 16 | rpc_init_prog(proto_spray, SPRAY_PROGRAM, ett_spray, |
136 | | G_N_ELEMENTS(spray_vers_info), spray_vers_info); |
137 | 16 | } |
138 | | |
139 | | /* |
140 | | * Editor modelines - https://www.wireshark.org/tools/modelines.html |
141 | | * |
142 | | * Local variables: |
143 | | * c-basic-offset: 8 |
144 | | * tab-width: 8 |
145 | | * indent-tabs-mode: t |
146 | | * End: |
147 | | * |
148 | | * vi: set shiftwidth=8 tabstop=8 noexpandtab: |
149 | | * :indentSize=8:tabSize=8:noTabs=false: |
150 | | */ |