aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Girlich <Uwe.Girlich@philosys.de>2000-08-08 06:19:52 +0000
committerUwe Girlich <Uwe.Girlich@philosys.de>2000-08-08 06:19:52 +0000
commitb485f8e95160d5bde048c583398ec812faac634b (patch)
treee31a71f4c85f5327a9a8cbe49ab43d6df8b8ba0e
parentb762041ba3973efc59b4829b35c02242465ded10 (diff)
Several new RPC dissecting function introduced. Interface to
existing functions changed. So NFS was also necessary to change. svn path=/trunk/; revision=2225
-rw-r--r--packet-nfs.c22
-rw-r--r--packet-rpc.c82
-rw-r--r--packet-rpc.h16
3 files changed, 103 insertions, 17 deletions
diff --git a/packet-nfs.c b/packet-nfs.c
index c813701ef2..769aa0b37c 100644
--- a/packet-nfs.c
+++ b/packet-nfs.c
@@ -2,7 +2,7 @@
* Routines for nfs dissection
* Copyright 1999, Uwe Girlich <Uwe.Girlich@philosys.de>
*
- * $Id: packet-nfs.c,v 1.33 2000/08/06 07:22:35 guy Exp $
+ * $Id: packet-nfs.c,v 1.34 2000/08/08 06:19:52 girlich Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -556,7 +556,7 @@ int
dissect_unsigned_int(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
char* name)
{
- offset = dissect_rpc_uint32(pd,offset,fd,tree,name,"unsigned int");
+ offset = dissect_rpc_uint32(pd,offset,fd,tree,name);
return offset;
}
@@ -1376,7 +1376,7 @@ int
dissect_uint64(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
char* name)
{
- offset = dissect_rpc_uint64(pd,offset,fd,tree,name,"uint64");
+ offset = dissect_rpc_uint64(pd,offset,fd,tree,name);
return offset;
}
@@ -1386,7 +1386,7 @@ int
dissect_uint32(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
char* name)
{
- offset = dissect_rpc_uint32(pd,offset,fd,tree,name,"uint32");
+ offset = dissect_rpc_uint32(pd,offset,fd,tree,name);
return offset;
}
@@ -1415,7 +1415,7 @@ int
dissect_fileid3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
char* name)
{
- offset = dissect_rpc_uint64(pd,offset,fd,tree,name,"fileid3");
+ offset = dissect_rpc_uint64(pd,offset,fd,tree,name);
return offset;
}
@@ -1425,7 +1425,7 @@ int
dissect_cookie3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
char* name)
{
- offset = dissect_rpc_uint64(pd,offset,fd,tree,name,"cookie3");
+ offset = dissect_rpc_uint64(pd,offset,fd,tree,name);
return offset;
}
@@ -1471,7 +1471,7 @@ int
dissect_uid3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
char* name)
{
- offset = dissect_rpc_uint32(pd,offset,fd,tree,name,"uid3");
+ offset = dissect_rpc_uint32(pd,offset,fd,tree,name);
return offset;
}
@@ -1481,7 +1481,7 @@ int
dissect_gid3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
char* name)
{
- offset = dissect_rpc_uint32(pd,offset,fd,tree,name,"gid3");
+ offset = dissect_rpc_uint32(pd,offset,fd,tree,name);
return offset;
}
@@ -1491,7 +1491,7 @@ int
dissect_size3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
char* name)
{
- offset = dissect_rpc_uint64(pd,offset,fd,tree,name,"size3");
+ offset = dissect_rpc_uint64(pd,offset,fd,tree,name);
return offset;
}
@@ -1501,7 +1501,7 @@ int
dissect_offset3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
char* name)
{
- offset = dissect_rpc_uint64(pd,offset,fd,tree,name,"offset3");
+ offset = dissect_rpc_uint64(pd,offset,fd,tree,name);
return offset;
}
@@ -1563,7 +1563,7 @@ int
dissect_count3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
char* name)
{
- offset = dissect_rpc_uint32(pd,offset,fd,tree,name,"count3");
+ offset = dissect_rpc_uint32(pd,offset,fd,tree,name);
return offset;
}
diff --git a/packet-rpc.c b/packet-rpc.c
index d365b83348..d9988a8626 100644
--- a/packet-rpc.c
+++ b/packet-rpc.c
@@ -2,7 +2,7 @@
* Routines for rpc dissection
* Copyright 1999, Uwe Girlich <Uwe.Girlich@philosys.de>
*
- * $Id: packet-rpc.c,v 1.34 2000/08/07 03:21:05 guy Exp $
+ * $Id: packet-rpc.c,v 1.35 2000/08/08 06:19:51 girlich Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -377,8 +377,18 @@ int hfindex)
int
+dissect_rpc_bool_tvb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
+int hfindex, int offset)
+{
+ if (tree)
+ proto_tree_add_item(tree, hfindex, tvb, offset, 4, FALSE);
+ return offset + 4;
+}
+
+
+int
dissect_rpc_uint32(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
-char* name, char* type)
+char* name)
{
guint32 value;
@@ -396,8 +406,18 @@ char* name, char* type)
int
+dissect_rpc_uint32_tvb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
+int hfindex, int offset)
+{
+ if (tree)
+ proto_tree_add_item(tree, hfindex, tvb, offset, 4, FALSE);
+ return offset + 4;
+}
+
+
+int
dissect_rpc_uint64(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
-char* name, char* type)
+char* name)
{
guint32 value_low;
guint32 value_high;
@@ -420,6 +440,28 @@ char* name, char* type)
}
+int
+dissect_rpc_uint64_tvb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
+int hfindex, int offset)
+{
+ guint32 value_low;
+ guint32 value_high;
+
+ value_high = tvb_get_ntohl(tvb, offset + 0);
+ value_low = tvb_get_ntohl(tvb, offset + 4);
+
+ if (tree) {
+ if (value_high)
+ proto_tree_add_text(tree, tvb, offset, 8,
+ "%s: 0x%x%08x", proto_registrar_get_name(hfindex), value_high, value_low);
+ else
+ proto_tree_add_uint(tree, hfindex, tvb, offset, 8, value_low);
+ }
+
+ return offset + 8;
+}
+
+
static int
dissect_rpc_opaque_data(const u_char *pd, int offset, frame_data *fd,
proto_tree *tree, int hfindex, gboolean string_data,
@@ -597,6 +639,23 @@ dissect_rpc_string(const u_char *pd, int offset, frame_data *fd,
int
+dissect_rpc_string_tvb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int hfindex, int offset, char **string_buffer_ret)
+{
+ const guint8 *pd;
+ int compat_offset;
+ int compat_offset_new;
+
+ tvb_compat(tvb, &pd, &compat_offset);
+ compat_offset += offset;
+
+ compat_offset_new = dissect_rpc_string(pd, compat_offset, pinfo->fd,
+ tree, hfindex, string_buffer_ret);
+ offset += (compat_offset_new - compat_offset);
+ return offset;
+}
+
+
+int
dissect_rpc_data(const u_char *pd, int offset, frame_data *fd,
proto_tree *tree, int hfindex)
{
@@ -608,6 +667,23 @@ dissect_rpc_data(const u_char *pd, int offset, frame_data *fd,
int
+dissect_rpc_data_tvb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int hfindex, int offset)
+{
+ const guint8 *pd;
+ int compat_offset;
+ int compat_offset_new;
+
+ tvb_compat(tvb, &pd, &compat_offset);
+ compat_offset += offset;
+
+ compat_offset_new = dissect_rpc_data(pd, compat_offset, pinfo->fd,
+ tree, hfindex);
+ offset += (compat_offset_new - compat_offset);
+ return offset;
+}
+
+
+int
dissect_rpc_list(const u_char *pd, int offset, frame_data *fd,
proto_tree *tree, dissect_function_t *rpc_list_dissector)
{
diff --git a/packet-rpc.h b/packet-rpc.h
index aa29e1cc3c..ce6d429971 100644
--- a/packet-rpc.h
+++ b/packet-rpc.h
@@ -1,5 +1,5 @@
/* packet-rpc.h (c) 1999 Uwe Girlich */
-/* $Id: packet-rpc.h,v 1.15 2000/07/17 20:33:52 guy Exp $ */
+/* $Id: packet-rpc.h,v 1.16 2000/08/08 06:19:51 girlich Exp $ */
#ifndef __PACKET_RPC_H__
#define __PACKET_RPC_H__
@@ -110,16 +110,26 @@ extern unsigned int rpc_roundup(unsigned int a);
gboolean dissect_rpc(const u_char *, int, frame_data *, proto_tree *);
extern int dissect_rpc_bool(const u_char *pd, int offset, frame_data *fd,
proto_tree *tree, int hfindex);
+extern int dissect_rpc_bool_tvb(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, int hfindex, int offset);
extern int dissect_rpc_string(const u_char *pd, int offset, frame_data *fd,
proto_tree *tree, int hfindex, char **string_buffer_ret);
+extern int dissect_rpc_string_tvb(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, int hfindex, int offset, char **string_buffer_ret);
extern int dissect_rpc_data(const u_char *pd, int offset, frame_data *fd,
proto_tree *tree, int hfindex);
+extern int dissect_rpc_data_tvb(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, int hfindex, int offset);
extern int dissect_rpc_list(const u_char *pd, int offset, frame_data *fd,
proto_tree *tree, dissect_function_t *rpc_list_dissector);
extern int dissect_rpc_uint32(const u_char *pd, int offset, frame_data *fd,
- proto_tree *tree, char* name, char* type);
+ proto_tree *tree, char* name);
+extern int dissect_rpc_uint32_tvb(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, int hfindex, int offset);
extern int dissect_rpc_uint64(const u_char *pd, int offset, frame_data *fd,
- proto_tree *tree, char* name, char* type);
+ proto_tree *tree, char* name);
+extern int dissect_rpc_uint64_tvb(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, int hfindex, int offset);
#endif /* packet-rpc.h */