Author: tpot
Date: 2005-01-17 06:24:03 +0000 (Mon, 17 Jan 2005)
New Revision: 184

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=lorikeet&rev=184

Log:
Add the name of what we are pointing to when dissecting pointers.

Modified:
   trunk/ethereal/plugins/pidl/eparser.c
   trunk/ethereal/plugins/pidl/eparser.h


Changeset:
Modified: trunk/ethereal/plugins/pidl/eparser.c
===================================================================
--- trunk/ethereal/plugins/pidl/eparser.c       2005-01-17 05:42:19 UTC (rev 
183)
+++ trunk/ethereal/plugins/pidl/eparser.c       2005-01-17 06:24:03 UTC (rev 
184)
@@ -1,6 +1,7 @@
 /* ethereal/pidl glue */
 
 #include "eparser.h"
+#include <ctype.h>
 
 struct pidl_pull *pidl_pull_init(tvbuff_t *tvb, int offset, packet_info *pinfo,
                                 guint8 *drep)
@@ -27,10 +28,34 @@
        return NT_STATUS_OK;
 }
 
-NTSTATUS ndr_pull_ptr(struct pidl_pull *ndr, pidl_tree *tree, int hf, 
+NTSTATUS ndr_pull_ptr(struct pidl_pull *ndr, pidl_tree *tree, char *name,
                      guint32 *ptr)
 {
-       return ndr_pull_uint32(ndr, tree, hf, ptr);
+       char *ptr_name, *tmp;
+
+       ndr_pull_align(ndr, sizeof(guint32));
+
+       *ptr = (ndr->drep[0] & 0x10)
+               ? tvb_get_letohl(ndr->tvb, ndr->offset)
+               : tvb_get_ntohl(ndr->tvb, ndr->offset);
+       
+       ptr_name = g_strdup(name);
+
+       for (tmp = ptr_name; *tmp; tmp++) {
+               if (*tmp == '_') *tmp = ' ';
+               if (tmp == ptr_name || *(tmp - 1) == ' ')
+                       *tmp = toupper(*tmp);
+       }
+       
+       proto_tree_add_text(
+               tree->proto_tree, ndr->tvb, ndr->offset, sizeof(guint32), 
+               "Pointer to %s: 0x%08x", ptr_name, *ptr);
+
+       g_free(ptr_name);
+
+       ndr->offset += 4;
+
+       return NT_STATUS_OK;
 }
 
 NTSTATUS ndr_pull_uint8(struct pidl_pull *ndr, pidl_tree *tree, int hf, 

Modified: trunk/ethereal/plugins/pidl/eparser.h
===================================================================
--- trunk/ethereal/plugins/pidl/eparser.h       2005-01-17 05:42:19 UTC (rev 
183)
+++ trunk/ethereal/plugins/pidl/eparser.h       2005-01-17 06:24:03 UTC (rev 
184)
@@ -114,7 +114,7 @@
 NTSTATUS ndr_pull_NTTIME(struct pidl_pull *ndr, pidl_tree *tree, int hf, 
NTTIME *data);
 NTSTATUS ndr_pull_HYPER_T(struct pidl_pull *ndr, pidl_tree *tree, int hf, 
HYPER_T *data);
 void ndr_set_flags(uint32_t *pflags, uint32_t new_flags);
-NTSTATUS ndr_pull_ptr(struct pidl_pull *ndr, pidl_tree *tree, int hf, uint32_t 
*v);
+NTSTATUS ndr_pull_ptr(struct pidl_pull *ndr, pidl_tree *tree, char *name, 
uint32_t *v);
 NTSTATUS ndr_pull_error(struct pidl_pull *ndr, 
                        enum ndr_err_code err, const char *format, ...);
 NTSTATUS ndr_pull_string(struct pidl_pull *ndr, int ndr_flags, pidl_tree 
*tree, const char **s);

Reply via email to