aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dfilter-scanner.l3
-rw-r--r--gtk/help_dlg.c6
-rw-r--r--ncp2222.h17
-rwxr-xr-xncp2222.py26
-rw-r--r--proto.c18
-rw-r--r--proto.h4
-rw-r--r--ptvcursor.c9
7 files changed, 44 insertions, 39 deletions
diff --git a/dfilter-scanner.l b/dfilter-scanner.l
index 0aa5a46d36..2cc2b429e9 100644
--- a/dfilter-scanner.l
+++ b/dfilter-scanner.l
@@ -3,7 +3,7 @@
/* dfilter-scanner.l
* Scanner for display filters
*
- * $Id: dfilter-scanner.l,v 1.31 2000/08/01 18:10:05 gram Exp $
+ * $Id: dfilter-scanner.l,v 1.32 2000/08/22 06:38:16 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -231,6 +231,7 @@ le|\<\= { dfilter_lval.operand = TOK_LE; return TOK_LE; }
retval = 0;
break;
case FT_STRING:
+ case FT_UINT_STRING:
retval = T_FT_STRING;
break;
case FT_ETHER:
diff --git a/gtk/help_dlg.c b/gtk/help_dlg.c
index c55335eb4b..de7ef1be6f 100644
--- a/gtk/help_dlg.c
+++ b/gtk/help_dlg.c
@@ -1,6 +1,6 @@
/* help_dlg.c
*
- * $Id: help_dlg.c,v 1.5 2000/08/17 08:17:38 guy Exp $
+ * $Id: help_dlg.c,v 1.6 2000/08/22 06:38:32 gram Exp $
*
* Laurent Deniel <deniel@worldnet.fr>
*
@@ -406,8 +406,8 @@ static void set_help_text(GtkWidget *w, help_type_t type)
case FT_RELATIVE_TIME:
type_name = "FT_RELATIVE_TIME";
break;
- case FT_NSTRING_UINT8:
- type_name = "FT_NSTRING_UINT8";
+ case FT_UINT_STRING:
+ type_name = "FT_UINT_STRING";
break;
case FT_STRING:
type_name = "FT_STRING";
diff --git a/ncp2222.h b/ncp2222.h
index 45d42ce900..a379e1e2fc 100644
--- a/ncp2222.h
+++ b/ncp2222.h
@@ -2,7 +2,7 @@
* Routines for NetWare Core Protocol
* Gilbert Ramirez <gram@xiexie.org>
*
- * $Id: ncp2222.h,v 1.1 2000/07/28 20:03:41 gram Exp $
+ * $Id: ncp2222.h,v 1.2 2000/08/22 06:38:16 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -221,11 +221,11 @@ dissect_ncp_reply(tvbuff_t *tvb, packet_info *pinfo,
* or ncp.subfunc will find both the requests and the replies.
*/
if (ncp_rec) {
- proto_tree_add_uint_hidden(ncp_tree, hf_ncp_func, tvb,
- 6, 1, ncp_rec->func);
+ proto_tree_add_uint(ncp_tree, hf_ncp_func, tvb,
+ 6, 0, ncp_rec->func);
if (ncp_requires_subfunc(ncp_rec->func)) {
- proto_tree_add_uint_hidden(ncp_tree, hf_ncp_subfunc,
- tvb, 6, 1, ncp_rec->subfunc);
+ proto_tree_add_uint(ncp_tree, hf_ncp_subfunc,
+ tvb, 6, 0, ncp_rec->subfunc);
}
}
@@ -248,12 +248,7 @@ dissect_ncp_reply(tvbuff_t *tvb, packet_info *pinfo,
return;
}
- if (ncp_requires_subfunc(ncp_rec->func)) {
- ptvc = ptvcursor_new(ncp_tree, tvb, 9);
- }
- else {
- ptvc = ptvcursor_new(ncp_tree, tvb, 8);
- }
+ ptvc = ptvcursor_new(ncp_tree, tvb, 8);
process_ptvc_record(ptvc, ncp_rec->reply_ptvc);
ptvcursor_free(ptvc);
}
diff --git a/ncp2222.py b/ncp2222.py
index 316977d480..70760bf213 100755
--- a/ncp2222.py
+++ b/ncp2222.py
@@ -9,7 +9,7 @@ part of the 0x2222 "family")
Data comes from "Programmer's Guide to the NetWare Core Protocol"
by Steve Conner and Dianne Conner.
-$Id: ncp2222.py,v 1.3 2000/08/09 21:24:27 deniel Exp $
+$Id: ncp2222.py,v 1.4 2000/08/22 06:38:17 gram Exp $
Copyright (c) 2000 by Gilbert Ramirez <gram@xiexie.org>
@@ -156,10 +156,14 @@ class PTVCRecord:
# Small sanity check
field_length = self.field.Length()
- if type(field_length) == type(0) and field_length > 0:
- if field_length != self.length:
- sys.stderr.write("Length %d does not match field length %d for field %s\n" % (self.length, field_length, self.field.Abbreviation()))
- sys.exit(1)
+# if type(field_length) != type(self.length):
+# sys.stderr.write("Length types do not match")
+# sys.exit(1)
+
+# if type(field_length) == type(0) and field_length > 0:
+# if field_length != self.length:
+# sys.stderr.write("Length %d does not match field length %d for field %s\n" % (self.length, field_length, self.field.Abbreviation()))
+# sys.exit(1)
# Check if an endianness override is given
try:
@@ -190,8 +194,16 @@ class PTVCRecord:
if self.endianness == LE:
endianness = 'TRUE'
+ length = -1
+
if type(self.length) == type(0):
length = self.length
+ else:
+ var_length = self.field.Length()
+ if var_length > 0:
+ length = var_length
+
+ if length > -1:
return "{ &%s, %d, %s }" % (self.field.HFName(),
length, endianness)
else:
@@ -480,9 +492,9 @@ class nstring8(Type):
the first byte."""
type = "nstring8"
- ftype = "FT_NSTRING_UINT8"
+ ftype = "FT_UINT_STRING"
def __init__(self, abbrev, descr):
- Type.__init__(self, abbrev, descr, -1)
+ Type.__init__(self, abbrev, descr, 1)
class stringz(Type):
"NUL-terminated string."
diff --git a/proto.c b/proto.c
index c26f90b24e..63ed6236b1 100644
--- a/proto.c
+++ b/proto.c
@@ -1,7 +1,7 @@
/* proto.c
* Routines for protocol tree
*
- * $Id: proto.c,v 1.77 2000/08/13 14:03:37 deniel Exp $
+ * $Id: proto.c,v 1.78 2000/08/22 06:38:18 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -232,7 +232,7 @@ proto_tree_free_node(GNode *node, gpointer data)
g_mem_chunk_free(gmc_item_labels, fi->representation);
if (fi->hfinfo->type == FT_STRING)
g_free(fi->value.string);
- else if (fi->hfinfo->type == FT_NSTRING_UINT8)
+ else if (fi->hfinfo->type == FT_UINT_STRING)
g_free(fi->value.string);
else if (fi->hfinfo->type == FT_BYTES)
g_free(fi->value.bytes);
@@ -403,6 +403,7 @@ proto_tree_add_item(proto_tree *tree, int hfindex, tvbuff_t *tvb,
proto_item *pi;
guint32 value, n;
+ /* XXX - need to free this after an exception */
new_fi = alloc_field_info(hfindex, tvb, start, length);
if (new_fi == NULL)
@@ -467,10 +468,11 @@ proto_tree_add_item(proto_tree *tree, int hfindex, tvbuff_t *tvb,
proto_tree_set_string_tvb(new_fi, tvb, start, length);
break;
- case FT_NSTRING_UINT8:
- n = tvb_get_guint8(tvb, start);
+ case FT_UINT_STRING:
/* This g_strdup'ed memory is freed in proto_tree_free_node() */
+ n = get_uint_value(tvb, start, length, little_endian);
proto_tree_set_string_tvb(new_fi, tvb, start + 1, n);
+
/* Instead of calling proto_item_set_len(), since we don't yet
* have a proto_item, we set the field_info's length ourselves. */
new_fi->length = n + 1;
@@ -1667,7 +1669,7 @@ proto_item_fill_label(field_info *fi, gchar *label_str)
break;
case FT_STRING:
- case FT_NSTRING_UINT8:
+ case FT_UINT_STRING:
snprintf(label_str, ITEM_LABEL_LENGTH,
"%s: %s", fi->hfinfo->name, fi->value.string);
break;
@@ -2116,7 +2118,7 @@ proto_registrar_get_length(int n)
case FT_BYTES:
case FT_BOOLEAN:
case FT_STRING:
- case FT_NSTRING_UINT8:
+ case FT_UINT_STRING:
case FT_DOUBLE:
case FT_ABSOLUTE_TIME:
case FT_RELATIVE_TIME:
@@ -2388,8 +2390,8 @@ proto_registrar_dump(void)
case FT_RELATIVE_TIME:
enum_name = "FT_RELATIVE_TIME";
break;
- case FT_NSTRING_UINT8:
- enum_name = "FT_NSTRING_UINT8";
+ case FT_UINT_STRING:
+ enum_name = "FT_UINT_STRING";
break;
case FT_STRING:
enum_name = "FT_STRING";
diff --git a/proto.h b/proto.h
index d93acc0caf..957e3417ed 100644
--- a/proto.h
+++ b/proto.h
@@ -1,7 +1,7 @@
/* proto.h
* Definitions for protocol display
*
- * $Id: proto.h,v 1.40 2000/08/13 14:03:38 deniel Exp $
+ * $Id: proto.h,v 1.41 2000/08/22 06:38:20 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -89,7 +89,7 @@ enum ftenum {
FT_ABSOLUTE_TIME,
FT_RELATIVE_TIME,
FT_STRING,
- FT_NSTRING_UINT8, /* String prefixed by 1 byte indicating length */
+ FT_UINT_STRING,
FT_ETHER,
FT_BYTES,
FT_IPv4,
diff --git a/ptvcursor.c b/ptvcursor.c
index 252a54f16e..ba84b9adcc 100644
--- a/ptvcursor.c
+++ b/ptvcursor.c
@@ -3,7 +3,7 @@
* Proto Tree TVBuff cursor
* Gilbert Ramirez <gram@xiexie.org>
*
- * $Id: ptvcursor.c,v 1.2 2000/08/11 13:34:32 deniel Exp $
+ * $Id: ptvcursor.c,v 1.3 2000/08/22 06:38:21 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -59,12 +59,7 @@ ptvcursor_add(ptvcursor_t *ptvc, int hf, gint length, gboolean endianness)
item = proto_tree_add_item(ptvc->tree, hf, ptvc->tvb, ptvc->offset,
length, endianness);
- if (length == PTVC_VARIABLE_LENGTH) {
- ptvc->offset += proto_item_get_len(item);
- }
- else {
- ptvc->offset += length;
- }
+ ptvc->offset += proto_item_get_len(item);
return item;
}