diff options
author | Gilbert Ramirez <gram@alumni.rice.edu> | 1999-08-01 04:28:20 +0000 |
---|---|---|
committer | Gilbert Ramirez <gram@alumni.rice.edu> | 1999-08-01 04:28:20 +0000 |
commit | b2f932c1dbb6180a3b4a86c7510ef4beff814bb0 (patch) | |
tree | 4b9c007a4f6bbfa27c0c7f9cad2a1e7800c30863 /proto.c | |
parent | c31abd81fa1fa78b0ac19d0b1de3d492a016768c (diff) |
Changed the display filter scanner from GLIB's GScanner to lex. The code
as it standed depends on your lex being flex, but that only matters if you're
a developer. The distribution will include the dfilter-scanner.c file, so
that if the user doesn't modify dfilter-scanner.l, he won't need flex to
re-create the *.c file.
The new lex scanner gives me better syntax checking for ether addresses. I
thought I could get by using GScanner, but it simply wasn't powerful enough.
All operands have English-like abbreviations and C-like syntax:
and, && ; or, || ; eq, == ; ne, != ; , etc.
I removed the ETHER_VENDOR type in favor of letting the user use the [x:y]
notation: ether.src[0:3] == 0:6:29 instead of ether.srcvendor == 00:06:29
I implemented the IPXNET field type; it had been there before, but was
not implemented. I chose to make it use integer values rather than byte
ranges, since an IPX Network is 4 bytes. So a display filter looks like this:
ipx.srcnet == 0xc0a82c00
rather than this:
ipx.srcnet == c0:a8:2c:00
I can supposrt the byte-range type IPXNET in the future, very trivially.
I still have more work to do on the parser though. It needs to check ranges
when extracting byte ranges ([x:y]) from packets. And I need to get rid
of those reduce/reduce errors from yacc!
svn path=/trunk/; revision=414
Diffstat (limited to 'proto.c')
-rw-r--r-- | proto.c | 32 |
1 files changed, 12 insertions, 20 deletions
@@ -1,7 +1,7 @@ /* proto.c * Routines for protocol tree * - * $Id: proto.c,v 1.6 1999/07/31 02:15:12 guy Exp $ + * $Id: proto.c,v 1.7 1999/08/01 04:28:09 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -369,13 +369,11 @@ NOTES case FT_VALS_UINT32: case FT_RELATIVE_TIME: case FT_IPv4: - case FT_IPXSERVER: - fi->value.numeric = va_arg(ap, guint32); + case FT_IPXNET: + fi->value.numeric = va_arg(ap, unsigned int); break; case FT_ETHER: - case FT_ETHER_VENDOR: -/* fi->value.ether = va_arg(ap, guint8*);*/ memcpy(fi->value.ether, va_arg(ap, guint8*), 6); break; @@ -385,7 +383,8 @@ NOTES break; case FT_STRING: - fi->value.string = g_strdup(va_arg(ap, char*)); /* XXX */ + /* This g_strdup'ed memory is freed in proto_tree_free_node() */ + fi->value.string = g_strdup(va_arg(ap, char*)); break; case FT_TEXT_ONLY: @@ -548,6 +547,11 @@ proto_item_fill_label(field_info *fi, gchar *label_str) (s ? s : "Unknown"), fi->value.numeric); break; + case FT_IPXNET: + snprintf(label_str, ITEM_LABEL_LENGTH, + "%s: 0x%08X", fi->hfinfo->name, fi->value.numeric); + break; + case FT_ETHER: snprintf(label_str, ITEM_LABEL_LENGTH, "%s: %s (%s)", fi->hfinfo->name, @@ -555,15 +559,6 @@ proto_item_fill_label(field_info *fi, gchar *label_str) get_ether_name(fi->value.ether)); break; - case FT_ETHER_VENDOR: - snprintf(label_str, ITEM_LABEL_LENGTH, - "%s: %02x:%02x:%02x (%s)", fi->hfinfo->name, - fi->value.ether[0], - fi->value.ether[1], - fi->value.ether[2], - get_manuf_name(fi->value.ether)); - break; - case FT_IPv4: snprintf(label_str, ITEM_LABEL_LENGTH, "%s: %s (%s)", fi->hfinfo->name, @@ -777,9 +772,6 @@ proto_registrar_dump(void) case FT_ETHER: enum_name = "FT_ETHER"; break; - case FT_ETHER_VENDOR: - enum_name = "FT_ETHER_VENDOR"; - break; case FT_BYTES: enum_name = "FT_BYTES"; break; @@ -789,8 +781,8 @@ proto_registrar_dump(void) case FT_IPv6: enum_name = "FT_IPv6"; break; - case FT_IPXSERVER: - enum_name = "FT_IPXSERVER"; + case FT_IPXNET: + enum_name = "FT_IPXNET"; break; case FT_VALS_UINT8: enum_name = "FT_VALS_UINT8"; |