1999-11-10 17:23:55 +00:00
|
|
|
/* packet-bootparams.c
|
|
|
|
* Routines for bootparams dissection
|
|
|
|
*
|
2004-07-18 00:24:25 +00:00
|
|
|
* $Id$
|
1999-11-10 17:23:55 +00:00
|
|
|
*
|
2006-05-21 04:49:01 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
1999-11-10 17:23:55 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* Copied from packet-smb.c
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
1999-11-11 16:20:25 +00:00
|
|
|
#include <glib.h>
|
1999-11-10 17:23:55 +00:00
|
|
|
|
|
|
|
#include "packet-rpc.h"
|
|
|
|
#include "packet-bootparams.h"
|
|
|
|
|
|
|
|
static int proto_bootparams = -1;
|
2002-11-01 00:48:39 +00:00
|
|
|
static int hf_bootparams_procedure_v1 = -1;
|
1999-11-11 16:20:25 +00:00
|
|
|
static int hf_bootparams_host = -1;
|
1999-11-11 20:18:46 +00:00
|
|
|
static int hf_bootparams_domain = -1;
|
1999-11-11 16:20:25 +00:00
|
|
|
static int hf_bootparams_fileid = -1;
|
|
|
|
static int hf_bootparams_filepath = -1;
|
1999-11-11 20:18:46 +00:00
|
|
|
static int hf_bootparams_hostaddr = -1;
|
|
|
|
static int hf_bootparams_routeraddr = -1;
|
2001-03-18 02:07:02 +00:00
|
|
|
static int hf_bootparams_addresstype = -1;
|
1999-11-11 20:18:46 +00:00
|
|
|
|
1999-11-16 11:44:20 +00:00
|
|
|
static gint ett_bootparams = -1;
|
|
|
|
|
2001-03-18 02:07:02 +00:00
|
|
|
|
|
|
|
static const value_string addr_type[] =
|
|
|
|
{
|
|
|
|
{ 1, "IPv4-ADDR" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static int
|
2002-04-03 13:24:13 +00:00
|
|
|
dissect_bp_address(tvbuff_t *tvb, int offset, proto_tree *tree, int hfindex)
|
1999-11-11 20:18:46 +00:00
|
|
|
{
|
|
|
|
guint32 type;
|
|
|
|
guint32 ipaddr;
|
|
|
|
|
|
|
|
|
2001-03-18 02:07:02 +00:00
|
|
|
type = tvb_get_ntohl(tvb, offset);
|
2002-08-28 21:04:11 +00:00
|
|
|
|
2002-04-03 13:24:13 +00:00
|
|
|
offset = dissect_rpc_uint32(tvb, tree, hf_bootparams_addresstype, offset);
|
2001-03-18 02:07:02 +00:00
|
|
|
|
|
|
|
switch(type){
|
|
|
|
case 1:
|
2002-08-28 21:04:11 +00:00
|
|
|
ipaddr = ((tvb_get_guint8(tvb, offset+3 )&0xff)<<24)
|
2001-03-18 02:07:02 +00:00
|
|
|
|((tvb_get_guint8(tvb, offset+7 )&0xff)<<16)
|
|
|
|
|((tvb_get_guint8(tvb, offset+11)&0xff)<<8 )
|
|
|
|
|((tvb_get_guint8(tvb, offset+15)&0xff) );
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_ipv4(tree, hfindex, tvb,
|
2002-08-02 23:36:07 +00:00
|
|
|
offset, 16, g_ntohl(ipaddr));
|
2001-03-18 02:07:02 +00:00
|
|
|
offset += 16;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
1999-11-11 20:18:46 +00:00
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
1999-11-11 16:20:25 +00:00
|
|
|
|
2001-03-18 02:07:02 +00:00
|
|
|
static int
|
2002-04-03 13:24:13 +00:00
|
|
|
dissect_getfile_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
|
1999-11-11 16:20:25 +00:00
|
|
|
{
|
|
|
|
if ( tree )
|
|
|
|
{
|
2002-04-03 13:24:13 +00:00
|
|
|
offset = dissect_rpc_string(tvb, tree, hf_bootparams_host, offset, NULL);
|
|
|
|
offset = dissect_rpc_string(tvb, tree, hf_bootparams_fileid, offset, NULL);
|
1999-11-11 16:20:25 +00:00
|
|
|
}
|
2002-08-28 21:04:11 +00:00
|
|
|
|
1999-11-11 16:20:25 +00:00
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
2001-03-18 02:07:02 +00:00
|
|
|
static int
|
2002-04-03 13:24:13 +00:00
|
|
|
dissect_getfile_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
|
1999-11-11 16:20:25 +00:00
|
|
|
{
|
|
|
|
if ( tree )
|
|
|
|
{
|
2002-04-03 13:24:13 +00:00
|
|
|
offset = dissect_rpc_string(tvb, tree, hf_bootparams_host, offset, NULL);
|
|
|
|
offset = dissect_bp_address(tvb, offset, tree, hf_bootparams_hostaddr);
|
|
|
|
offset = dissect_rpc_string(tvb, tree, hf_bootparams_filepath, offset, NULL);
|
1999-11-11 20:18:46 +00:00
|
|
|
}
|
2002-08-28 21:04:11 +00:00
|
|
|
|
1999-11-11 20:18:46 +00:00
|
|
|
return offset;
|
|
|
|
}
|
1999-11-11 16:20:25 +00:00
|
|
|
|
2001-03-18 02:07:02 +00:00
|
|
|
static int
|
2002-04-03 13:24:13 +00:00
|
|
|
dissect_whoami_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
|
1999-11-11 20:18:46 +00:00
|
|
|
{
|
|
|
|
if ( tree )
|
|
|
|
{
|
2002-04-03 13:24:13 +00:00
|
|
|
offset = dissect_bp_address(tvb, offset, tree, hf_bootparams_hostaddr);
|
1999-11-11 20:18:46 +00:00
|
|
|
}
|
2002-08-28 21:04:11 +00:00
|
|
|
|
1999-11-11 20:18:46 +00:00
|
|
|
return offset;
|
|
|
|
}
|
1999-11-11 16:20:25 +00:00
|
|
|
|
2001-03-18 02:07:02 +00:00
|
|
|
static int
|
2002-04-03 13:24:13 +00:00
|
|
|
dissect_whoami_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
|
1999-11-11 20:18:46 +00:00
|
|
|
{
|
|
|
|
if ( tree )
|
|
|
|
{
|
2002-04-03 13:24:13 +00:00
|
|
|
offset = dissect_rpc_string(tvb, tree, hf_bootparams_host, offset, NULL);
|
|
|
|
offset = dissect_rpc_string(tvb, tree, hf_bootparams_domain, offset, NULL);
|
|
|
|
offset = dissect_bp_address(tvb, offset, tree, hf_bootparams_routeraddr);
|
1999-11-11 16:20:25 +00:00
|
|
|
}
|
2002-08-28 21:04:11 +00:00
|
|
|
|
1999-11-11 16:20:25 +00:00
|
|
|
return offset;
|
|
|
|
}
|
1999-11-10 17:23:55 +00:00
|
|
|
|
|
|
|
/* proc number, "proc name", dissect_request, dissect_reply */
|
2001-01-18 09:55:10 +00:00
|
|
|
/* NULL as function pointer means: type of arguments is "void". */
|
2001-03-18 02:07:02 +00:00
|
|
|
static const vsff bootparams1_proc[] = {
|
1999-11-11 16:20:25 +00:00
|
|
|
{ BOOTPARAMSPROC_NULL, "NULL",
|
|
|
|
NULL, NULL },
|
2002-08-28 21:04:11 +00:00
|
|
|
{ BOOTPARAMSPROC_WHOAMI, "WHOAMI",
|
1999-11-11 20:18:46 +00:00
|
|
|
dissect_whoami_call, dissect_whoami_reply },
|
2002-08-28 21:04:11 +00:00
|
|
|
{ BOOTPARAMSPROC_GETFILE, "GETFILE",
|
1999-11-11 16:20:25 +00:00
|
|
|
dissect_getfile_call, dissect_getfile_reply },
|
|
|
|
{ 0, NULL, NULL, NULL }
|
1999-11-10 17:23:55 +00:00
|
|
|
};
|
|
|
|
/* end of Bootparams version 1 */
|
|
|
|
|
2002-11-01 00:48:39 +00:00
|
|
|
static const value_string bootparams1_proc_vals[] = {
|
|
|
|
{ BOOTPARAMSPROC_NULL, "NULL" },
|
|
|
|
{ BOOTPARAMSPROC_WHOAMI, "WHOAMI" },
|
|
|
|
{ BOOTPARAMSPROC_GETFILE, "GETFILE" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
1999-11-10 17:23:55 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
proto_register_bootparams(void)
|
|
|
|
{
|
1999-11-11 16:20:25 +00:00
|
|
|
static hf_register_info hf[] = {
|
2002-11-01 00:48:39 +00:00
|
|
|
{ &hf_bootparams_procedure_v1, {
|
|
|
|
"V1 Procedure", "bootparams.procedure_v1", FT_UINT32, BASE_DEC,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
VALS(bootparams1_proc_vals), 0, NULL, HFILL }},
|
1999-11-11 16:20:25 +00:00
|
|
|
{ &hf_bootparams_host, {
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
"Client Host", "bootparams.host", FT_STRING, BASE_NONE,
|
|
|
|
NULL, 0, NULL, HFILL }},
|
1999-11-11 20:18:46 +00:00
|
|
|
{ &hf_bootparams_domain, {
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
"Client Domain", "bootparams.domain", FT_STRING, BASE_NONE,
|
|
|
|
NULL, 0, NULL, HFILL }},
|
1999-11-11 16:20:25 +00:00
|
|
|
{ &hf_bootparams_fileid, {
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
"File ID", "bootparams.fileid", FT_STRING, BASE_NONE,
|
|
|
|
NULL, 0, NULL, HFILL }},
|
1999-11-11 16:20:25 +00:00
|
|
|
{ &hf_bootparams_filepath, {
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
"File Path", "bootparams.filepath", FT_STRING, BASE_NONE,
|
|
|
|
NULL, 0, NULL, HFILL }},
|
1999-11-11 20:18:46 +00:00
|
|
|
{ &hf_bootparams_hostaddr, {
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
"Client Address", "bootparams.hostaddr", FT_IPv4, BASE_NONE,
|
2001-06-18 02:18:27 +00:00
|
|
|
NULL, 0, "Address", HFILL }},
|
1999-11-11 20:18:46 +00:00
|
|
|
{ &hf_bootparams_routeraddr, {
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
"Router Address", "bootparams.routeraddr", FT_IPv4, BASE_NONE,
|
|
|
|
NULL, 0, NULL, HFILL }},
|
2001-03-18 02:07:02 +00:00
|
|
|
{ &hf_bootparams_addresstype, {
|
|
|
|
"Address Type", "bootparams.type", FT_UINT32, BASE_DEC,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
VALS(addr_type), 0, NULL, HFILL }},
|
1999-11-11 16:20:25 +00:00
|
|
|
};
|
1999-11-16 11:44:20 +00:00
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_bootparams,
|
|
|
|
};
|
1999-11-11 16:20:25 +00:00
|
|
|
|
2001-01-03 06:56:03 +00:00
|
|
|
proto_bootparams = proto_register_protocol("Boot Parameters",
|
|
|
|
"BOOTPARAMS", "bootparams");
|
1999-11-11 16:20:25 +00:00
|
|
|
proto_register_field_array(proto_bootparams, hf, array_length(hf));
|
1999-11-16 11:44:20 +00:00
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
2000-04-04 06:46:41 +00:00
|
|
|
}
|
1999-11-10 17:23:55 +00:00
|
|
|
|
2000-04-04 06:46:41 +00:00
|
|
|
void
|
|
|
|
proto_reg_handoff_bootparams(void)
|
|
|
|
{
|
1999-11-10 17:23:55 +00:00
|
|
|
/* Register the protocol as RPC */
|
1999-11-16 11:44:20 +00:00
|
|
|
rpc_init_prog(proto_bootparams, BOOTPARAMS_PROGRAM, ett_bootparams);
|
1999-11-10 17:23:55 +00:00
|
|
|
/* Register the procedure tables */
|
2002-11-01 00:48:39 +00:00
|
|
|
rpc_init_proc_table(BOOTPARAMS_PROGRAM, 1, bootparams1_proc, hf_bootparams_procedure_v1);
|
1999-11-10 17:23:55 +00:00
|
|
|
}
|