diff options
author | Gilbert Ramirez <gram@alumni.rice.edu> | 1999-08-27 19:27:22 +0000 |
---|---|---|
committer | Gilbert Ramirez <gram@alumni.rice.edu> | 1999-08-27 19:27:22 +0000 |
commit | b53d4ba179ba1cb9e8bb78449b92b0d5c23a5b4c (patch) | |
tree | fb82ebc4ac88f355879fa4605ed4bcdd73b847c7 | |
parent | a14aa01462f11a1a45e755117049c3d49093b87c (diff) | |
download | wireshark-b53d4ba179ba1cb9e8bb78449b92b0d5c23a5b4c.tar.gz wireshark-b53d4ba179ba1cb9e8bb78449b92b0d5c23a5b4c.tar.bz2 wireshark-b53d4ba179ba1cb9e8bb78449b92b0d5c23a5b4c.zip |
Changed packet-tr.c to insert tr.sr, a FT_BOOLEAN field, only if tr.sr
is true. The test for truth now becomes a test for existence. The dfilter
grammar no longer recognizes 'true' and 'false', since you can now check
a boolean field via:
tr.sr
or by its negation:
!tr.sr
svn path=/trunk/; revision=591
-rw-r--r-- | dfilter-grammar.y | 58 | ||||
-rw-r--r-- | dfilter-scanner.l | 5 | ||||
-rw-r--r-- | doc/ethereal.pod.template | 15 | ||||
-rw-r--r-- | doc/proto_tree | 3 | ||||
-rw-r--r-- | packet-tr.c | 6 |
5 files changed, 19 insertions, 68 deletions
diff --git a/dfilter-grammar.y b/dfilter-grammar.y index d692267fcc..c7a631b534 100644 --- a/dfilter-grammar.y +++ b/dfilter-grammar.y @@ -3,7 +3,7 @@ /* dfilter-grammar.y * Parser for display filters * - * $Id: dfilter-grammar.y,v 1.15 1999/08/26 06:20:48 gram Exp $ + * $Id: dfilter-grammar.y,v 1.16 1999/08/27 19:27:09 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -87,8 +87,6 @@ static GNode* dfilter_mknode_ipv4_variable(gint id); static GNode* dfilter_mknode_existence(gint id); static GNode* dfilter_mknode_bytes_value(GByteArray *barray); static GNode* dfilter_mknode_bytes_variable(gint id, gint offset, guint length); -static GNode* dfilter_mknode_boolean_value(gint truth_value); -static GNode* dfilter_mknode_boolean_variable(gint id); static guint32 string_to_value(char *s); static int ether_str_to_guint8_array(const char *s, guint8 *mac); @@ -125,7 +123,6 @@ GSList *gnode_slist = NULL; %type <node> ipv4_value ipv4_variable %type <node> variable_name %type <node> bytes_value bytes_variable -%type <node> boolean_value boolean_variable %type <operand> numeric_relation %type <operand> equality_relation @@ -222,15 +219,6 @@ relation: numeric_variable numeric_relation numeric_value $$ = dfilter_mknode_join($1, relation, $2, $3); } - | boolean_variable equality_relation boolean_value - { - $$ = dfilter_mknode_join($1, relation, $2, $3); - } - | boolean_variable equality_relation boolean_variable - { - $$ = dfilter_mknode_join($1, relation, $2, $3); - } - ; @@ -283,11 +271,6 @@ bytes_value: T_VAL_BYTE_STRING ; -boolean_value: TOK_TRUE { $$ = dfilter_mknode_boolean_value($1); } - | TOK_FALSE { $$ = dfilter_mknode_boolean_value($1); } - ; - - numeric_variable: T_FT_UINT8 { $$ = dfilter_mknode_numeric_variable($1); } | T_FT_UINT16 { $$ = dfilter_mknode_numeric_variable($1); } | T_FT_UINT32 { $$ = dfilter_mknode_numeric_variable($1); } @@ -311,9 +294,6 @@ bytes_variable: any_variable_type T_VAL_BYTE_RANGE } ; -boolean_variable: T_FT_BOOLEAN { $$ = dfilter_mknode_boolean_variable($1); } - ; - any_variable_type: T_FT_UINT8 { $$ = $1; } | T_FT_UINT16 { $$ = $1; } | T_FT_UINT32 { $$ = $1; } @@ -488,24 +468,6 @@ dfilter_mknode_bytes_variable(gint id, gint offset, guint length) } static GNode* -dfilter_mknode_boolean_variable(gint id) -{ - dfilter_node *node; - GNode *gnode; - - node = g_mem_chunk_alloc(global_df->node_memchunk); - node->ntype = variable; - node->elem_size = sizeof(guint32); - node->fill_array_func = fill_array_boolean_variable; /* cheating ! */ - node->check_relation_func = check_relation_boolean; /* cheating ! */ - node->value.variable = id; - gnode = g_node_new(node); - - gnode_slist = g_slist_append(gnode_slist, gnode); - return gnode; -} - -static GNode* dfilter_mknode_numeric_value(guint32 val) { dfilter_node *node; @@ -608,24 +570,6 @@ dfilter_mknode_bytes_value(GByteArray *barray) return gnode; } -static GNode* -dfilter_mknode_boolean_value(gint truth_value) -{ - dfilter_node *node; - GNode *gnode; - - node = g_mem_chunk_alloc(global_df->node_memchunk); - node->ntype = numeric; - node->elem_size = sizeof(guint32); - node->fill_array_func = fill_array_boolean_value; - node->check_relation_func = check_relation_boolean; - node->value.boolean = truth_value == TOK_TRUE ? TRUE : FALSE; - gnode = g_node_new(node); - - gnode_slist = g_slist_append(gnode_slist, gnode); - return gnode; -} - static guint32 string_to_value(char *s) { diff --git a/dfilter-scanner.l b/dfilter-scanner.l index 53b1b13f25..cfbf9db3c3 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.10 1999/08/20 21:19:27 gram Exp $ + * $Id: dfilter-scanner.l,v 1.11 1999/08/27 19:27:10 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -105,9 +105,6 @@ ge|\>\= { dfilter_lval.operand = TOK_GE; return TOK_GE; } lt|\< { dfilter_lval.operand = TOK_LT; return TOK_LT; } le|\<\= { dfilter_lval.operand = TOK_LE; return TOK_LE; } -true { dfilter_lval.operand = TOK_TRUE; return TOK_TRUE; } -false { dfilter_lval.operand = TOK_FALSE; return TOK_FALSE; } - \[{whitespace}*-?[0-9]+{whitespace}*:{whitespace}*[0-9]+{whitespace}*\] { /* range [ x : y ] */ char *byterange_string = g_strdup(yytext); diff --git a/doc/ethereal.pod.template b/doc/ethereal.pod.template index 290e06dbcc..d41df0fccf 100644 --- a/doc/ethereal.pod.template +++ b/doc/ethereal.pod.template @@ -411,7 +411,7 @@ either through C-like symbols, or through English-like abbreviations: Furthermore, each protocol field is typed. The types are: Unsigned integer (either 8-bit, 16-bit, or 32-bit) - Boolean (true or false) + Boolean Ethernet address (6 bytes) Byte string (n-number of bytes) IPv4 address @@ -424,10 +424,17 @@ three display filters are equivalent: frame.pkt_len > 012 frame.pkt_len > 0xa -Boolean values are either true or false. For example, a token-ring packet's source route -field is boolean: +Boolean values are either true or false. However, a boolean field is present in a +protocol decode only if its value is true. If the value is false, the field is not presence. +You can therefore check the truth value of a boolean field by simply checking for its +existence, that is, by naming the field. For example, a token-ring packet's source route +field is boolean. To find any source-routed packets, the display filter is simply: - tr.sr == true + tr.sr + +Non source-routed packets can be found with the negation of that filter: + + ! tr.sr Ethernet addresses, as well as a string of bytes, are represented in hex digits. The hex digits may be separated by colons, periods, or hyphens: diff --git a/doc/proto_tree b/doc/proto_tree index 3b61d3fa25..12d322b89e 100644 --- a/doc/proto_tree +++ b/doc/proto_tree @@ -1,4 +1,4 @@ -$Id: proto_tree,v 1.3 1999/07/15 15:33:09 gram Exp $ +$Id: proto_tree,v 1.4 1999/08/27 19:27:22 gram Exp $ The Ethereal Protocol Tree ========================== @@ -154,6 +154,7 @@ enum ftenum { FT_UINT8, FT_UINT16, FT_UINT32, + FT_BOOLEAN, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME, FT_STRING, diff --git a/packet-tr.c b/packet-tr.c index 62ab02f32e..fa7023f763 100644 --- a/packet-tr.c +++ b/packet-tr.c @@ -2,7 +2,7 @@ * Routines for Token-Ring packet disassembly * Gilbert Ramirez <gram@verdict.uthscsa.edu> * - * $Id: packet-tr.c,v 1.22 1999/08/27 19:15:38 gram Exp $ + * $Id: packet-tr.c,v 1.23 1999/08/27 19:27:11 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@unicom.net> @@ -434,7 +434,9 @@ dissect_tr(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) { proto_tree_add_item(tr_tree, hf_tr_dst, offset + 2, 6, trn_dhost); proto_tree_add_item(tr_tree, hf_tr_src, offset + 8, 6, trn_shost); - proto_tree_add_item_hidden(tr_tree, hf_tr_sr, offset + 8, 1, source_routed); + + if (source_routed) + proto_tree_add_item_hidden(tr_tree, hf_tr_sr, offset + 8, 1, source_routed); /* non-source-routed version of src addr */ proto_tree_add_item_hidden(tr_tree, hf_tr_src, offset + 8, 6, trn_shost_nonsr); |