Extending true_false_string support
- Separate tfs.[ch] - Add larger sample collection - Properly export DATA svn path=/trunk/; revision=20373
This commit is contained in:
parent
a68f0224c3
commit
f8422ab7db
|
@ -1594,7 +1594,7 @@ behavior collapses to the one of value_string.
|
|||
FT_BOOLEANS have a default map of 0 = "False", 1 (or anything else) = "True".
|
||||
Sometimes it is useful to change the labels for boolean values (e.g.,
|
||||
to "Yes"/"No", "Fast"/"Slow", etc.). For these mappings, a struct called
|
||||
true_false_string is used. (This struct is new as of Wireshark 0.7.6).
|
||||
true_false_string is used.
|
||||
|
||||
typedef struct true_false_string {
|
||||
char *true_string;
|
||||
|
@ -1617,6 +1617,9 @@ string representing falsehood. For FT_BOOLEAN fields that need a
|
|||
If the Boolean field is to be displayed as "False" or "True", the
|
||||
'strings' field would be set to NULL.
|
||||
|
||||
Wireshark predefines a whole range of ready made "true_false_string"s
|
||||
in tfs.h, included via packet.h.
|
||||
|
||||
bitmask
|
||||
-------
|
||||
If the field is a bitfield, then the bitmask is the mask which will
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
LIBWIRESHARK_SRC = \
|
||||
addr_and_mask.c \
|
||||
|
@ -85,6 +85,7 @@ LIBWIRESHARK_SRC = \
|
|||
tap.c \
|
||||
tcap-persistentdata.c \
|
||||
timestamp.c \
|
||||
tfs.c \
|
||||
to_str.c \
|
||||
tvbparse.c \
|
||||
tvbuff.c \
|
||||
|
@ -182,6 +183,7 @@ LIBWIRESHARK_INCLUDES = \
|
|||
tap.h \
|
||||
tcap-persistentdata.h \
|
||||
timestamp.h \
|
||||
tfs.h \
|
||||
to_str.h \
|
||||
tvbparse.h \
|
||||
tvbuff.h \
|
||||
|
|
|
@ -688,6 +688,25 @@ tap_queue_packet
|
|||
tcp_dissect_pdus
|
||||
test_for_directory
|
||||
test_for_fifo
|
||||
tfs_true_false DATA
|
||||
tfs_yes_no DATA
|
||||
tfs_set_notset DATA
|
||||
tfs_enabled_disabled DATA
|
||||
tfs_ok_error DATA
|
||||
tfs_success_fail DATA
|
||||
tfs_on_off DATA
|
||||
tfs_ack_nack DATA
|
||||
tfs_odd_even DATA
|
||||
tfs_allow_block DATA
|
||||
tfs_restricted_allowed DATA
|
||||
tfs_accept_reject DATA
|
||||
tfs_more_nomore DATA
|
||||
tfs_present_absent DATA
|
||||
tfs_active_inactive DATA
|
||||
tfs_found_not_found DATA
|
||||
tfs_command_response DATA
|
||||
tfs_capable_not_capable DATA
|
||||
tfs_supported_not_supported DATA
|
||||
time_msecs_to_str
|
||||
time_secs_to_str
|
||||
timestamp_get_precision
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
@ -61,11 +61,6 @@ static gint proto_malformed = -1;
|
|||
static dissector_handle_t frame_handle = NULL;
|
||||
static dissector_handle_t data_handle = NULL;
|
||||
|
||||
const true_false_string flags_set_truth = {
|
||||
"Set",
|
||||
"Not set"
|
||||
};
|
||||
|
||||
void
|
||||
packet_init(void)
|
||||
{
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __PACKET_H__
|
||||
|
@ -44,6 +44,7 @@
|
|||
#include "packet_info.h"
|
||||
#include "column-utils.h"
|
||||
#include "epan.h"
|
||||
#include "tfs.h"
|
||||
|
||||
#define hi_nibble(b) (((b) & 0xf0) >> 4)
|
||||
#define lo_nibble(b) ((b) & 0x0f)
|
||||
|
@ -84,18 +85,6 @@ typedef enum {
|
|||
CHAR_EBCDIC = 1 /* EBCDIC */
|
||||
} char_enc;
|
||||
|
||||
/* Struct for boolean enumerations */
|
||||
typedef struct true_false_string {
|
||||
const char *true_string;
|
||||
const char *false_string;
|
||||
} true_false_string;
|
||||
|
||||
/**
|
||||
* A default set of true/false strings that dissectors can use for
|
||||
* FT_BOOLEAN header fields.
|
||||
**/
|
||||
extern const true_false_string flags_set_truth;
|
||||
|
||||
extern void packet_init(void);
|
||||
extern void packet_cleanup(void);
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
@ -3902,8 +3902,7 @@ fill_label_boolean(field_info *fi, gchar *label_str)
|
|||
int ret; /*tmp return value */
|
||||
|
||||
header_field_info *hfinfo = fi->hfinfo;
|
||||
static const true_false_string default_tf = { "True", "False" };
|
||||
const true_false_string *tfstring = &default_tf;
|
||||
const true_false_string *tfstring = &tfs_true_false;
|
||||
|
||||
if (hfinfo->strings) {
|
||||
tfstring = (const struct true_false_string*) hfinfo->strings;
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
/* tfs.c
|
||||
* true_false strings
|
||||
* Copyright 2007, Jaap Keuter <jaap.keuter@xs4all.nl>
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* Wireshark - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@wireshark.org>
|
||||
* Copyright 1998 Gerald Combs
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "tfs.h"
|
||||
|
||||
/*
|
||||
* A default set of true/false strings that dissectors can use for
|
||||
* FT_BOOLEAN header fields.
|
||||
*/
|
||||
const true_false_string tfs_true_false = { "True", "False" };
|
||||
const true_false_string tfs_yes_no = { "Yes", "No" };
|
||||
const true_false_string tfs_set_notset = { "Set", "Not Set" };
|
||||
const true_false_string tfs_enabled_disabled = { "Enabled", "Disabled" };
|
||||
const true_false_string tfs_ok_error = { "Ok", "Error" };
|
||||
const true_false_string tfs_success_fail = { "Success", "Fail" };
|
||||
const true_false_string tfs_on_off = { "On", "Off" };
|
||||
const true_false_string tfs_ack_nack = { "Ack", "Nack" };
|
||||
const true_false_string tfs_odd_even = { "Odd", "Even" };
|
||||
const true_false_string tfs_allow_block = { "Allow", "Block" };
|
||||
const true_false_string tfs_restricted_allowed = { "Restricted", "Allowed" };
|
||||
const true_false_string tfs_accept_reject = { "Accept", "Reject" };
|
||||
const true_false_string tfs_more_nomore = { "More", "No More" };
|
||||
const true_false_string tfs_present_absent = { "Present", "Absent" };
|
||||
const true_false_string tfs_active_inactive = { "Active", "Inactive" };
|
||||
const true_false_string tfs_found_not_found = { "Found", "Not found" };
|
||||
const true_false_string tfs_command_response = { "Command", "Response" };
|
||||
const true_false_string tfs_capable_not_capable = { "Capable", "Not capable" };
|
||||
const true_false_string tfs_supported_not_supported = { "Supported", "Not supported" };
|
||||
|
||||
/*
|
||||
* Old true_false_string from packet.c
|
||||
* Retained for backward compatibility until all dissectors are updated.
|
||||
*/
|
||||
const true_false_string flags_set_truth = { "Set", "Not set" };
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
/* tfs.h
|
||||
* true_false strings
|
||||
* Copyright 2007, Jaap Keuter <jaap.keuter@xs4all.nl>
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* Wireshark - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@wireshark.org>
|
||||
* Copyright 1998 Gerald Combs
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __TFS_H__
|
||||
#define __TFS_H__
|
||||
|
||||
/* Struct for boolean enumerations */
|
||||
typedef struct true_false_string {
|
||||
const char *true_string;
|
||||
const char *false_string;
|
||||
} true_false_string;
|
||||
|
||||
/*
|
||||
* A default set of true/false strings that dissectors can use for
|
||||
* FT_BOOLEAN header fields.
|
||||
*/
|
||||
WS_VAR_IMPORT const true_false_string tfs_true_false;
|
||||
WS_VAR_IMPORT const true_false_string tfs_yes_no;
|
||||
WS_VAR_IMPORT const true_false_string tfs_set_notset;
|
||||
WS_VAR_IMPORT const true_false_string tfs_enabled_disabled;
|
||||
WS_VAR_IMPORT const true_false_string tfs_ok_error;
|
||||
WS_VAR_IMPORT const true_false_string tfs_success_fail;
|
||||
WS_VAR_IMPORT const true_false_string tfs_on_off;
|
||||
WS_VAR_IMPORT const true_false_string tfs_ack_nack;
|
||||
WS_VAR_IMPORT const true_false_string tfs_odd_even;
|
||||
WS_VAR_IMPORT const true_false_string tfs_allow_block;
|
||||
WS_VAR_IMPORT const true_false_string tfs_restricted_allowed;
|
||||
WS_VAR_IMPORT const true_false_string tfs_accept_reject;
|
||||
WS_VAR_IMPORT const true_false_string tfs_more_nomore;
|
||||
WS_VAR_IMPORT const true_false_string tfs_present_absent;
|
||||
WS_VAR_IMPORT const true_false_string tfs_active_inactive;
|
||||
WS_VAR_IMPORT const true_false_string tfs_found_not_found;
|
||||
WS_VAR_IMPORT const true_false_string tfs_command_response;
|
||||
WS_VAR_IMPORT const true_false_string tfs_capable_not_capable;
|
||||
WS_VAR_IMPORT const true_false_string tfs_supported_not_supported;
|
||||
|
||||
/*
|
||||
* Old true_false_string from packet.c
|
||||
* Retained for backward compatibility until all dissectors are updated.
|
||||
*/
|
||||
WS_VAR_IMPORT const true_false_string flags_set_truth;
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue