-/* packet-klm.c 2001 Ronnie Sahlberg <rsahlber@bigpond.net.au>
+/* packet-klm.c 2001 Ronnie Sahlberg <See AUTHORS for email>
* Routines for klm dissection
*
+ * $Id: packet-klm.c,v 1.10 2002/08/28 21:00:19 jmayer Exp $
+ *
* Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
+ * By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
#endif
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
#include "packet-rpc.h"
#include "packet-nfs.h"
static gint ett_klm_lock = -1;
static gint ett_klm_holder = -1;
-const value_string names_klm_stats[] =
+static const value_string names_klm_stats[] =
{
#define KLM_GRANTED 0
{ KLM_GRANTED, "KLM_GRANTED" },
{ KLM_DENIED_NOLOCKS, "KLM_DENIED_NOLOCKS" },
#define KLM_WORKING 3
{ KLM_WORKING, "KLM_WORKING" },
+ { 0, NULL }
};
static int
-dissect_holder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
+dissect_holder(tvbuff_t *tvb, proto_tree *tree, int offset)
{
proto_item* lock_item = NULL;
proto_tree* lock_tree = NULL;
lock_item = proto_tree_add_item(tree, hf_klm_holder, tvb,
- offset, tvb_length_remaining(tvb, offset), FALSE);
+ offset, -1, FALSE);
lock_tree = proto_item_add_subtree(lock_item, ett_klm_holder);
- offset = dissect_rpc_bool_tvb( tvb, pinfo, lock_tree,
+ offset = dissect_rpc_bool( tvb, lock_tree,
hf_klm_exclusive, offset);
- offset = dissect_rpc_uint32_tvb(tvb, pinfo, lock_tree,
+ offset = dissect_rpc_uint32(tvb, lock_tree,
hf_klm_pid, offset);
- offset = dissect_rpc_uint32_tvb(tvb, pinfo, lock_tree,
+ offset = dissect_rpc_uint32(tvb, lock_tree,
hf_klm_offset, offset);
- offset = dissect_rpc_uint32_tvb(tvb, pinfo, lock_tree,
+ offset = dissect_rpc_uint32(tvb, lock_tree,
hf_klm_len, offset);
return offset;
}
-
+
static int
-dissect_lock(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
+dissect_lock(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, int offset)
{
proto_item* lock_item = NULL;
proto_tree* lock_tree = NULL;
lock_item = proto_tree_add_item(tree, hf_klm_lock, tvb,
- offset, tvb_length_remaining(tvb, offset), FALSE);
+ offset, -1, FALSE);
lock_tree = proto_item_add_subtree(lock_item, ett_klm_lock);
- offset = dissect_rpc_string_tvb(tvb, pinfo, lock_tree,
+ offset = dissect_rpc_string(tvb, lock_tree,
hf_klm_servername, offset, NULL);
offset = dissect_nfs_fh3(tvb, offset, pinfo, lock_tree,"fh");
- offset = dissect_rpc_uint32_tvb(tvb, pinfo, lock_tree,
+ offset = dissect_rpc_uint32(tvb, lock_tree,
hf_klm_pid, offset);
- offset = dissect_rpc_uint32_tvb(tvb, pinfo, lock_tree,
+ offset = dissect_rpc_uint32(tvb, lock_tree,
hf_klm_offset, offset);
- offset = dissect_rpc_uint32_tvb(tvb, pinfo, lock_tree,
+ offset = dissect_rpc_uint32(tvb, lock_tree,
hf_klm_len, offset);
return offset;
}
static int
-dissect_klm_stat_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+dissect_klm_stat_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
- offset = dissect_rpc_uint32_tvb(tvb, pinfo, tree,
+ offset = dissect_rpc_uint32(tvb, tree,
hf_klm_stats, offset);
return offset;
static int
dissect_klm_lock_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
{
- offset = dissect_rpc_bool_tvb( tvb, pinfo, tree,
+ offset = dissect_rpc_bool( tvb, tree,
hf_klm_block, offset);
- offset = dissect_rpc_bool_tvb( tvb, pinfo, tree,
+ offset = dissect_rpc_bool( tvb, tree,
hf_klm_exclusive, offset);
offset = dissect_lock(tvb, pinfo, tree, offset);
}
static int
-dissect_klm_test_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+dissect_klm_test_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
gint32 stats;
stats = tvb_get_ntohl(tvb, offset);
- offset = dissect_rpc_uint32_tvb(tvb, pinfo, tree,
+ offset = dissect_rpc_uint32(tvb, tree,
hf_klm_stats, offset);
if (stats == KLM_DENIED) {
- offset = dissect_holder(tvb, pinfo, tree, offset);
+ offset = dissect_holder(tvb, tree, offset);
}
return offset;
static int
dissect_klm_test_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
{
- offset = dissect_rpc_bool_tvb( tvb, pinfo, tree,
+ offset = dissect_rpc_bool( tvb, tree,
hf_klm_exclusive, offset);
offset = dissect_lock(tvb, pinfo, tree, offset);
static hf_register_info hf[] = {
{ &hf_klm_exclusive, {
"exclusive", "klm.exclusive", FT_BOOLEAN, BASE_NONE,
- &tfs_exclusive, 0, "Exclusive lock" }},
+ &tfs_exclusive, 0, "Exclusive lock", HFILL }},
{ &hf_klm_lock, {
"lock", "klm.lock", FT_NONE, BASE_NONE,
- NULL, 0, "KLM lock structure" }},
+ NULL, 0, "KLM lock structure", HFILL }},
{ &hf_klm_servername, {
"server name", "klm.servername", FT_STRING, BASE_NONE,
- NULL, 0, "Server name" }},
+ NULL, 0, "Server name", HFILL }},
{ &hf_klm_pid, {
"pid", "klm.pid", FT_UINT32, BASE_DEC,
- NULL, 0, "ProcessID" }},
+ NULL, 0, "ProcessID", HFILL }},
{ &hf_klm_offset, {
"offset", "klm.offset", FT_UINT32, BASE_DEC,
- NULL, 0, "File offset" }},
+ NULL, 0, "File offset", HFILL }},
{ &hf_klm_len, {
"length", "klm.len", FT_UINT32, BASE_DEC,
- NULL, 0, "Length of lock region" }},
+ NULL, 0, "Length of lock region", HFILL }},
{ &hf_klm_stats, {
"stats", "klm.stats", FT_UINT32, BASE_DEC,
- VALS(names_klm_stats), 0, "stats" }},
+ VALS(names_klm_stats), 0, "stats", HFILL }},
{ &hf_klm_holder, {
"holder", "klm.holder", FT_NONE, BASE_NONE,
- NULL, 0, "KLM lock holder" }},
+ NULL, 0, "KLM lock holder", HFILL }},
{ &hf_klm_block, {
"block", "klm.block", FT_BOOLEAN, BASE_NONE,
- &tfs_block, 0, "Block" }},
+ &tfs_block, 0, "Block", HFILL }},
};
/* Register the procedure tables */
rpc_init_proc_table(KLM_PROGRAM, 1, klm1_proc);
}
-