MSWSP: fix dissect_mswsp_smb()
[wireshark-wip.git] / epan / dissectors / packet-spray.c
blob0a1bdceec51e1b9f05a2f3c54d966f06ee485a94
1 /* packet-spray.c
2 * 2001 Ronnie Sahlberg <See AUTHORS for email>
4 * $Id$
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 #include "config.h"
29 #include "packet-rpc.h"
30 #include "packet-spray.h"
32 static int proto_spray = -1;
33 static int hf_spray_procedure_v1 = -1;
34 static int hf_spray_sprayarr = -1;
35 static int hf_spray_counter = -1;
36 static int hf_spray_clock = -1;
37 static int hf_spray_sec = -1;
38 static int hf_spray_usec = -1;
40 static gint ett_spray = -1;
41 static gint ett_spray_clock = -1;
44 static int
45 dissect_get_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
47 proto_item* lock_item = NULL;
48 proto_tree* lock_tree = NULL;
50 offset = dissect_rpc_uint32(tvb, tree,
51 hf_spray_counter, offset);
53 lock_item = proto_tree_add_item(tree, hf_spray_clock, tvb,
54 offset, -1, ENC_NA);
56 lock_tree = proto_item_add_subtree(lock_item, ett_spray_clock);
58 offset = dissect_rpc_uint32(tvb, lock_tree,
59 hf_spray_sec, offset);
61 offset = dissect_rpc_uint32(tvb, lock_tree,
62 hf_spray_usec, offset);
64 return offset;
67 static int
68 dissect_spray_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
70 offset = dissect_rpc_data(tvb, tree,
71 hf_spray_sprayarr, offset);
73 return offset;
76 /* proc number, "proc name", dissect_request, dissect_reply */
77 /* NULL as function pointer means: type of arguments is "void". */
78 static const vsff spray1_proc[] = {
79 { SPRAYPROC_NULL, "NULL",
80 NULL, NULL },
81 { SPRAYPROC_SPRAY, "SPRAY",
82 dissect_spray_call, NULL },
83 { SPRAYPROC_GET, "GET",
84 NULL, dissect_get_reply },
85 { SPRAYPROC_CLEAR, "CLEAR",
86 NULL, NULL },
87 { 0, NULL, NULL, NULL }
89 static const value_string spray1_proc_vals[] = {
90 { SPRAYPROC_NULL, "NULL" },
91 { SPRAYPROC_SPRAY, "SPRAY" },
92 { SPRAYPROC_GET, "GET" },
93 { SPRAYPROC_CLEAR, "CLEAR" },
94 { 0, NULL }
97 void
98 proto_register_spray(void)
100 static hf_register_info hf[] = {
101 { &hf_spray_procedure_v1, {
102 "V1 Procedure", "spray.procedure_v1", FT_UINT32, BASE_DEC,
103 VALS(spray1_proc_vals), 0, NULL, HFILL }},
104 { &hf_spray_sprayarr, {
105 "Data", "spray.sprayarr", FT_BYTES, BASE_NONE,
106 NULL, 0, "Sprayarr data", HFILL }},
108 { &hf_spray_counter, {
109 "counter", "spray.counter", FT_UINT32, BASE_DEC,
110 NULL, 0, NULL, HFILL }},
112 { &hf_spray_clock, {
113 "clock", "spray.clock", FT_NONE, BASE_NONE,
114 NULL, 0, NULL, HFILL }},
116 { &hf_spray_sec, {
117 "sec", "spray.sec", FT_UINT32, BASE_DEC,
118 NULL, 0, "Seconds", HFILL }},
120 { &hf_spray_usec, {
121 "usec", "spray.usec", FT_UINT32, BASE_DEC,
122 NULL, 0, "Microseconds", HFILL }}
126 static gint *ett[] = {
127 &ett_spray,
128 &ett_spray_clock,
131 proto_spray = proto_register_protocol("SPRAY", "SPRAY", "spray");
132 proto_register_field_array(proto_spray, hf, array_length(hf));
133 proto_register_subtree_array(ett, array_length(ett));
136 void
137 proto_reg_handoff_spray(void)
139 /* Register the protocol as RPC */
140 rpc_init_prog(proto_spray, SPRAY_PROGRAM, ett_spray);
141 /* Register the procedure tables */
142 rpc_init_proc_table(SPRAY_PROGRAM, 1, spray1_proc, hf_spray_procedure_v1);