diff options
author | Guy Harris <guy@alum.mit.edu> | 2002-12-02 21:20:26 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2002-12-02 21:20:26 +0000 |
commit | a55fa6743a8d32cd6925282e1fee601fb94b7676 (patch) | |
tree | 6248eb6b62d6329b68281eefb69abfc0a0d2522f /packet-dcerpc-nt.c | |
parent | 066036ad0919df051db149bba0ea0dcb4facba1b (diff) |
Get rid of some no-longer-used routines; there are other routines that
have taken their places.
svn path=/trunk/; revision=6723
Diffstat (limited to 'packet-dcerpc-nt.c')
-rw-r--r-- | packet-dcerpc-nt.c | 192 |
1 files changed, 2 insertions, 190 deletions
diff --git a/packet-dcerpc-nt.c b/packet-dcerpc-nt.c index 64e3fbad2b..6ee8dcac2e 100644 --- a/packet-dcerpc-nt.c +++ b/packet-dcerpc-nt.c @@ -2,7 +2,7 @@ * Routines for DCERPC over SMB packet disassembly * Copyright 2001, Tim Potter <tpot@samba.org> * - * $Id: packet-dcerpc-nt.c,v 1.49 2002/12/02 20:01:55 guy Exp $ + * $Id: packet-dcerpc-nt.c,v 1.50 2002/12/02 21:20:26 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -49,27 +49,7 @@ int prs_align(int offset, int n) return offset; } -/* Parse a 8-bit integer */ - -int prs_uint8(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, - proto_tree *tree, guint8 *data, char *name) -{ - guint8 i; - - /* No alignment required */ - - i = tvb_get_guint8(tvb, offset); - offset++; - - if (name && tree) - proto_tree_add_text(tree, tvb, offset - 1, 1, - "%s: %u", name, i); - - if (data) - *data = i; - - return offset; -} +/* Parse a number of uint8's */ int prs_uint8s(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int count, int *data_offset, char *name) @@ -148,146 +128,6 @@ int prs_uint32(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, return offset; } -/* Parse a number of 32-bit integers */ - -int prs_uint32s(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, - proto_tree *tree, int count, int *data_offset, char *name) -{ - offset = prs_align(offset, 4); - - if (name && tree) - proto_tree_add_text(tree, tvb, offset - 4, 4, - "%s", name); - if (data_offset) - *data_offset = offset; - - offset += count * 4; - - return offset; -} - -/* Parse a NT status code */ - -int prs_ntstatus(tvbuff_t *tvb, int offset, packet_info *pinfo, - proto_tree *tree) -{ - guint32 status; - - offset = prs_uint32(tvb, offset, pinfo, tree, &status, NULL); - - if (tree) - proto_tree_add_text(tree, tvb, offset - 4, 4, "Status: %s", - val_to_str(status, NT_errors, "???")); - - return offset; -} - -/* - * We need to keep track of deferred referrents as they appear in the - * packet after all the non-pointer objects. - * to keep track of pointers as they are parsed as scalars and need to be - * remembered for the next call to the prs function. - * - * Pointers are stored in a linked list and pushed in the PARSE_SCALARS - * section of the prs function and popped in the PARSE_BUFFERS section. If - * we try to pop off a referrent that has a different name then we are - * expecting then something has gone wrong. - */ - -#undef DEBUG_PTRS - -struct ptr { - char *name; - guint32 value; -}; - -/* Create a new pointer */ - -static struct ptr *new_ptr(char *name, guint32 value) -{ - struct ptr *p; - - p = g_malloc(sizeof(struct ptr)); - - p->name = g_strdup(name); - p->value = value; - - return p; -} - -/* Free a pointer */ - -static void free_ptr(struct ptr *p) -{ - if (p) { - g_free(p->name); - g_free(p); - } -} - -/* Parse a pointer and store it's value in a linked list */ - -int prs_push_ptr(tvbuff_t *tvb, int offset, packet_info *pinfo, - proto_tree *tree, GList **ptr_list, char *name) -{ - struct ptr *p; - guint32 value; - - offset = prs_uint32(tvb, offset, pinfo, tree, &value, NULL); - - if (name && tree) - proto_tree_add_text(tree, tvb, offset - 4, 4, - "%s pointer: 0x%08x", name, value); - - p = new_ptr(name, value); - - *ptr_list = g_list_append(*ptr_list, p); - -#ifdef DEBUG_PTRS - fprintf(stderr, "DEBUG_PTRS: pushing %s ptr = 0x%08x, %d ptrs in " - "list\n", name, value, g_list_length(*ptr_list)); -#endif - - return offset; -} - -/* Pop a pointer of a given name. Return it's value. */ - -guint32 prs_pop_ptr(GList **ptr_list, char *name _U_) -{ - GList *elt; - struct ptr *p; - guint32 result; - - g_assert(g_list_length(*ptr_list) != 0); /* List too short */ - - /* Get pointer at head of list */ - - elt = g_list_first(*ptr_list); - p = (struct ptr *)elt->data; - result = p->value; - -#ifdef DEBUG_PTRS - if (strcmp(p->name, name) != 0) { - fprintf(stderr, "DEBUG_PTRS: wrong pointer (%s != %s)\n", - p->name, name); - } -#endif - - /* Free pointer record */ - - *ptr_list = g_list_remove_link(*ptr_list, elt); - -#ifdef DEBUG_PTRS - fprintf(stderr, "DEBUG_PTRS: popping %s ptr = 0x%08x, %d ptrs in " - "list\n", p->name, p->value, g_list_length(*ptr_list)); -#endif - - free_ptr(p); - - return result; -} - /* Convert a string from little-endian unicode to ascii. At the moment we fake it by taking every odd byte. )-: The caller must free the result returned. */ @@ -319,34 +159,6 @@ char *fake_unicode(tvbuff_t *tvb, int offset, int len) return buffer; } -/* Parse a UNISTR2 structure */ - -int prs_UNISTR2(tvbuff_t *tvb, int offset, packet_info *pinfo, - proto_tree *tree, int flags, char **data, char *name _U_) -{ - guint32 len = 0, unknown = 0, max_len = 0; - - if (flags & PARSE_SCALARS) { - offset = prs_uint32(tvb, offset, pinfo, tree, &len, "Length"); - offset = prs_uint32(tvb, offset, pinfo, tree, &unknown, - "Offset"); - offset = prs_uint32(tvb, offset, pinfo, tree, &max_len, - "Max length"); - } - - if (flags & PARSE_BUFFERS) { - int data16_offset; - - offset = prs_uint16s(tvb, offset, pinfo, tree, max_len, - &data16_offset, "Buffer"); - - if (data) - *data = fake_unicode(tvb, data16_offset, max_len); - } - - return offset; -} - /* following are a few functions for dissecting common structures used by NT services. These might need to be cleaned up at a later time but at least we get them out of the real service dissectors. |