2 * Routines for bootparams dissection
4 * $Id: packet-bootparams.c,v 1.22 2002/08/28 21:00:08 jmayer Exp $
6 * Ethereal - Network traffic analyzer
7 * By Gerald Combs <gerald@ethereal.com>
8 * Copyright 1998 Gerald Combs
10 * Copied from packet-smb.c
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.
34 #include "packet-rpc.h"
35 #include "packet-bootparams.h"
37 static int proto_bootparams = -1;
38 static int hf_bootparams_host = -1;
39 static int hf_bootparams_domain = -1;
40 static int hf_bootparams_fileid = -1;
41 static int hf_bootparams_filepath = -1;
42 static int hf_bootparams_hostaddr = -1;
43 static int hf_bootparams_routeraddr = -1;
44 static int hf_bootparams_addresstype = -1;
46 static gint ett_bootparams = -1;
49 static const value_string addr_type[] =
56 dissect_bp_address(tvbuff_t *tvb, int offset, proto_tree *tree, int hfindex)
62 type = tvb_get_ntohl(tvb, offset);
64 offset = dissect_rpc_uint32(tvb, tree, hf_bootparams_addresstype, offset);
68 ipaddr = ((tvb_get_guint8(tvb, offset+3 )&0xff)<<24)
69 |((tvb_get_guint8(tvb, offset+7 )&0xff)<<16)
70 |((tvb_get_guint8(tvb, offset+11)&0xff)<<8 )
71 |((tvb_get_guint8(tvb, offset+15)&0xff) );
72 proto_tree_add_ipv4(tree, hfindex, tvb,
73 offset, 16, g_ntohl(ipaddr));
86 dissect_getfile_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
90 offset = dissect_rpc_string(tvb, tree, hf_bootparams_host, offset, NULL);
91 offset = dissect_rpc_string(tvb, tree, hf_bootparams_fileid, offset, NULL);
98 dissect_getfile_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
102 offset = dissect_rpc_string(tvb, tree, hf_bootparams_host, offset, NULL);
103 offset = dissect_bp_address(tvb, offset, tree, hf_bootparams_hostaddr);
104 offset = dissect_rpc_string(tvb, tree, hf_bootparams_filepath, offset, NULL);
111 dissect_whoami_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
115 offset = dissect_bp_address(tvb, offset, tree, hf_bootparams_hostaddr);
122 dissect_whoami_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
126 offset = dissect_rpc_string(tvb, tree, hf_bootparams_host, offset, NULL);
127 offset = dissect_rpc_string(tvb, tree, hf_bootparams_domain, offset, NULL);
128 offset = dissect_bp_address(tvb, offset, tree, hf_bootparams_routeraddr);
134 /* proc number, "proc name", dissect_request, dissect_reply */
135 /* NULL as function pointer means: type of arguments is "void". */
136 static const vsff bootparams1_proc[] = {
137 { BOOTPARAMSPROC_NULL, "NULL",
139 { BOOTPARAMSPROC_WHOAMI, "WHOAMI",
140 dissect_whoami_call, dissect_whoami_reply },
141 { BOOTPARAMSPROC_GETFILE, "GETFILE",
142 dissect_getfile_call, dissect_getfile_reply },
143 { 0, NULL, NULL, NULL }
145 /* end of Bootparams version 1 */
149 proto_register_bootparams(void)
151 static hf_register_info hf[] = {
152 { &hf_bootparams_host, {
153 "Client Host", "bootparams.host", FT_STRING, BASE_DEC,
154 NULL, 0, "Client Host", HFILL }},
155 { &hf_bootparams_domain, {
156 "Client Domain", "bootparams.domain", FT_STRING, BASE_DEC,
157 NULL, 0, "Client Domain", HFILL }},
158 { &hf_bootparams_fileid, {
159 "File ID", "bootparams.fileid", FT_STRING, BASE_DEC,
160 NULL, 0, "File ID", HFILL }},
161 { &hf_bootparams_filepath, {
162 "File Path", "bootparams.filepath", FT_STRING, BASE_DEC,
163 NULL, 0, "File Path", HFILL }},
164 { &hf_bootparams_hostaddr, {
165 "Client Address", "bootparams.hostaddr", FT_IPv4, BASE_DEC,
166 NULL, 0, "Address", HFILL }},
167 { &hf_bootparams_routeraddr, {
168 "Router Address", "bootparams.routeraddr", FT_IPv4, BASE_DEC,
169 NULL, 0, "Router Address", HFILL }},
170 { &hf_bootparams_addresstype, {
171 "Address Type", "bootparams.type", FT_UINT32, BASE_DEC,
172 VALS(addr_type), 0, "Address Type", HFILL }},
174 static gint *ett[] = {
178 proto_bootparams = proto_register_protocol("Boot Parameters",
179 "BOOTPARAMS", "bootparams");
180 proto_register_field_array(proto_bootparams, hf, array_length(hf));
181 proto_register_subtree_array(ett, array_length(ett));
185 proto_reg_handoff_bootparams(void)
187 /* Register the protocol as RPC */
188 rpc_init_prog(proto_bootparams, BOOTPARAMS_PROGRAM, ett_bootparams);
189 /* Register the procedure tables */
190 rpc_init_proc_table(BOOTPARAMS_PROGRAM, 1, bootparams1_proc);