2 * Stubs for Sun's remote statistics RPC service
4 * Guy Harris <guy@alum.mit.edu>
6 * $Id: packet-rstat.c,v 1.4 2002/11/01 00:48:38 sahlberg Exp $
8 * Ethereal - Network traffic analyzer
9 * By Gerald Combs <gerald@ethereal.com>
10 * Copyright 1998 Gerald Combs
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
33 #include "packet-rpc.h"
35 static int proto_rstat = -1;
36 static int hf_rstat_procedure_v1 = -1;
37 static int hf_rstat_procedure_v2 = -1;
38 static int hf_rstat_procedure_v3 = -1;
39 static int hf_rstat_procedure_v4 = -1;
41 static gint ett_rstat = -1;
43 #define RSTAT_PROGRAM 100001
45 #define RSTATPROC_NULL 0
46 #define RSTATPROC_STATS 1
47 #define RSTATPROC_HAVEDISK 2
49 /* proc number, "proc name", dissect_request, dissect_reply */
50 /* NULL as function pointer means: type of arguments is "void". */
51 static const vsff rstat1_proc[] = {
52 { RSTATPROC_NULL, "NULL",
54 { RSTATPROC_STATS, "STATS",
56 { RSTATPROC_HAVEDISK, "HAVEDISK",
58 { 0, NULL, NULL, NULL }
60 static const value_string rstat1_proc_vals[] = {
61 { RSTATPROC_NULL, "NULL" },
62 { RSTATPROC_STATS, "STATS" },
63 { RSTATPROC_HAVEDISK, "HAVEDISK" },
67 static const vsff rstat2_proc[] = {
68 { RSTATPROC_NULL, "NULL",
70 { RSTATPROC_STATS, "STATS",
72 { RSTATPROC_HAVEDISK, "HAVEDISK",
74 { 0, NULL, NULL, NULL }
76 static const value_string rstat2_proc_vals[] = {
77 { RSTATPROC_NULL, "NULL" },
78 { RSTATPROC_STATS, "STATS" },
79 { RSTATPROC_HAVEDISK, "HAVEDISK" },
83 static const vsff rstat3_proc[] = {
84 { RSTATPROC_NULL, "NULL",
86 { RSTATPROC_STATS, "STATS",
88 { RSTATPROC_HAVEDISK, "HAVEDISK",
90 { 0, NULL, NULL, NULL }
92 static const value_string rstat3_proc_vals[] = {
93 { RSTATPROC_NULL, "NULL" },
94 { RSTATPROC_STATS, "STATS" },
95 { RSTATPROC_HAVEDISK, "HAVEDISK" },
99 static const vsff rstat4_proc[] = {
100 { RSTATPROC_NULL, "NULL",
102 { RSTATPROC_STATS, "STATS",
104 { RSTATPROC_HAVEDISK, "HAVEDISK",
106 { 0, NULL, NULL, NULL }
108 static const value_string rstat4_proc_vals[] = {
109 { RSTATPROC_NULL, "NULL" },
110 { RSTATPROC_STATS, "STATS" },
111 { RSTATPROC_HAVEDISK, "HAVEDISK" },
116 proto_register_rstat(void)
118 static hf_register_info hf[] = {
119 { &hf_rstat_procedure_v1, {
120 "V1 Procedure", "rstat.procedure_v1", FT_UINT32, BASE_DEC,
121 VALS(rstat1_proc_vals), 0, "V1 Procedure", HFILL }},
122 { &hf_rstat_procedure_v2, {
123 "V2 Procedure", "rstat.procedure_v2", FT_UINT32, BASE_DEC,
124 VALS(rstat2_proc_vals), 0, "V2 Procedure", HFILL }},
125 { &hf_rstat_procedure_v3, {
126 "V3 Procedure", "rstat.procedure_v3", FT_UINT32, BASE_DEC,
127 VALS(rstat3_proc_vals), 0, "V3 Procedure", HFILL }},
128 { &hf_rstat_procedure_v4, {
129 "V4 Procedure", "rstat.procedure_v4", FT_UINT32, BASE_DEC,
130 VALS(rstat4_proc_vals), 0, "V4 Procedure", HFILL }}
133 static gint *ett[] = {
137 proto_rstat = proto_register_protocol("RSTAT", "RSTAT", "rstat");
138 proto_register_field_array(proto_rstat, hf, array_length(hf));
139 proto_register_subtree_array(ett, array_length(ett));
143 proto_reg_handoff_rstat(void)
145 /* Register the protocol as RPC */
146 rpc_init_prog(proto_rstat, RSTAT_PROGRAM, ett_rstat);
147 /* Register the procedure tables */
148 rpc_init_proc_table(RSTAT_PROGRAM, 1, rstat1_proc, hf_rstat_procedure_v1);
149 rpc_init_proc_table(RSTAT_PROGRAM, 2, rstat2_proc, hf_rstat_procedure_v2);
150 rpc_init_proc_table(RSTAT_PROGRAM, 3, rstat3_proc, hf_rstat_procedure_v3);
151 rpc_init_proc_table(RSTAT_PROGRAM, 4, rstat3_proc, hf_rstat_procedure_v4);