summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Morriss <jeff.morriss@ulticom.com>2010-04-24 19:07:21 +0000
committerJeff Morriss <jeff.morriss@ulticom.com>2010-04-24 19:07:21 +0000
commit112fd1841001f7980c56cebdc065e0792ad1fb67 (patch)
tree97cb536c234dca81cddf3ef5b02887cad39c4982
parent6c5201f39a548fd6bf17a91149a86f9584880c4b (diff)
downloadwireshark-112fd1841001f7980c56cebdc065e0792ad1fb67.tar.gz
Make the absolute_time_display_e enum start at 1000 to avoid overlapping with
the base_display_e enum. Fix a couple of dissectors that were still using FT_ABSOLUTE_TIME with BASE_NONE. (The time format chosen is based only on an attempt to not change the behavior. I don't know that it's right.) One of these is built by Pidl. I'll send a patch upstream too. When checking hfinfos, display the absolute_time_display_e values too. Display "bit count: X" instead of "unknown" when the display value doesn't match one of the enumerated values. svn path=/trunk/; revision=32552
-rw-r--r--epan/dissectors/packet-aruba-erm.c16
-rw-r--r--epan/dissectors/packet-dcerpc-lsa.c12
-rw-r--r--epan/proto.c91
-rw-r--r--epan/time_fmt.h3
4 files changed, 72 insertions, 50 deletions
diff --git a/epan/dissectors/packet-aruba-erm.c b/epan/dissectors/packet-aruba-erm.c
index 82a4cd740c..bab9c02efc 100644
--- a/epan/dissectors/packet-aruba-erm.c
+++ b/epan/dissectors/packet-aruba-erm.c
@@ -28,12 +28,12 @@
/*
* Format:
* Use the Header of Record (Packet) Header
- *
+ *
* typedef struct pcaprec_hdr_s {
- * guint32 ts_sec; timestamp seconds
- * guint32 ts_usec; timestamp microseconds
- * guint32 incl_len; number of octets of packet saved in file
- * guint32 orig_len; actual length of packet
+ * guint32 ts_sec; timestamp seconds
+ * guint32 ts_usec; timestamp microseconds
+ * guint32 incl_len; number of octets of packet saved in file
+ * guint32 orig_len; actual length of packet
* } pcaprec_hdr_t;
*
* Following with 802.11 header
@@ -70,7 +70,7 @@ dissect_aruba_erm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree *aruba_erm_tree;
tvbuff_t *eth_tvb;
nstime_t ts;
-
+
col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTO_SHORT_NAME);
col_set_str(pinfo->cinfo, COL_INFO, PROTO_SHORT_NAME ":");
@@ -81,7 +81,7 @@ dissect_aruba_erm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
ts.secs = tvb_get_ntohl(tvb, 0);
ts.nsecs = tvb_get_ntohl(tvb,4)*1000;
proto_tree_add_time(aruba_erm_tree, hf_aruba_erm_time, tvb, 0, 8,&ts);
- proto_tree_add_item(aruba_erm_tree, hf_aruba_erm_incl_len, tvb, 8, 4, FALSE);
+ proto_tree_add_item(aruba_erm_tree, hf_aruba_erm_incl_len, tvb, 8, 4, FALSE);
proto_tree_add_item(aruba_erm_tree, hf_aruba_erm_orig_len, tvb, 12, 4, FALSE);
}
@@ -97,7 +97,7 @@ proto_register_aruba_erm(void)
static hf_register_info hf[] = {
{ &hf_aruba_erm_time,
- { "Packet Capture Timestamp", "aruba_erm.time", FT_ABSOLUTE_TIME, BASE_NONE, NULL,
+ { "Packet Capture Timestamp", "aruba_erm.time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL,
0x00, NULL, HFILL }},
{ &hf_aruba_erm_incl_len,
{ "Packet Captured Length", "aruba_erm.incl_len", FT_UINT32, BASE_DEC, NULL,
diff --git a/epan/dissectors/packet-dcerpc-lsa.c b/epan/dissectors/packet-dcerpc-lsa.c
index fec28c9124..53acffd262 100644
--- a/epan/dissectors/packet-dcerpc-lsa.c
+++ b/epan/dissectors/packet-dcerpc-lsa.c
@@ -12255,7 +12255,7 @@ void proto_register_dcerpc_lsarpc(void)
{ &hf_lsarpc_lsa_SetSecret_old_val,
{ "Old Val", "lsarpc.lsa_SetSecret.old_val", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
{ &hf_lsarpc_lsa_TrustDomainInfoBuffer_last_update_time,
- { "Last Update Time", "lsarpc.lsa_TrustDomainInfoBuffer.last_update_time", FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0, NULL, HFILL }},
+ { "Last Update Time", "lsarpc.lsa_TrustDomainInfoBuffer.last_update_time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0, NULL, HFILL }},
{ &hf_lsarpc_lsa_DnsDomainInfo_dns_forest,
{ "Dns Forest", "lsarpc.lsa_DnsDomainInfo.dns_forest", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
{ &hf_lsarpc_lsa_QueryDomainInformationPolicy_info,
@@ -12269,7 +12269,7 @@ void proto_register_dcerpc_lsarpc(void)
{ &hf_lsarpc_lsa_AuditLogInfo_unknown,
{ "Unknown", "lsarpc.lsa_AuditLogInfo.unknown", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
{ &hf_lsarpc_lsa_AuditLogInfo_retention_time,
- { "Retention Time", "lsarpc.lsa_AuditLogInfo.retention_time", FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0, NULL, HFILL }},
+ { "Retention Time", "lsarpc.lsa_AuditLogInfo.retention_time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0, NULL, HFILL }},
{ &hf_lsarpc_lsa_ObjectAttribute_sec_desc,
{ "Sec Desc", "lsarpc.lsa_ObjectAttribute.sec_desc", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
{ &hf_lsarpc_lsa_DnsDomainInfo_name,
@@ -12279,7 +12279,7 @@ void proto_register_dcerpc_lsarpc(void)
{ &hf_lsarpc_lsa_TranslatedSid2_sid_index,
{ "Sid Index", "lsarpc.lsa_TranslatedSid2.sid_index", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }},
{ &hf_lsarpc_lsa_QuerySecret_old_mtime,
- { "Old Mtime", "lsarpc.lsa_QuerySecret.old_mtime", FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0, NULL, HFILL }},
+ { "Old Mtime", "lsarpc.lsa_QuerySecret.old_mtime", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0, NULL, HFILL }},
{ &hf_lsarpc_lsa_OpenTrustedDomain_handle,
{ "Handle", "lsarpc.lsa_OpenTrustedDomain.handle", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
{ &hf_lsarpc_lsa_TransNameArray_names,
@@ -12589,7 +12589,7 @@ void proto_register_dcerpc_lsarpc(void)
{ &hf_lsarpc_lsa_TrustedDomainInfo_password,
{ "Password", "lsarpc.lsa_TrustedDomainInfo.password", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
{ &hf_lsarpc_lsa_ModificationInfo_db_create_time,
- { "Db Create Time", "lsarpc.lsa_ModificationInfo.db_create_time", FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0, NULL, HFILL }},
+ { "Db Create Time", "lsarpc.lsa_ModificationInfo.db_create_time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0, NULL, HFILL }},
{ &hf_lsarpc_lsa_PolicyAccessMask_LSA_POLICY_NOTIFICATION,
{ "Lsa Policy Notification", "lsarpc.lsa_PolicyAccessMask.LSA_POLICY_NOTIFICATION", FT_BOOLEAN, 32, TFS(&lsa_PolicyAccessMask_LSA_POLICY_NOTIFICATION_tfs), ( 0x00001000 ), NULL, HFILL }},
{ &hf_lsarpc_lsa_PolicyInformation_domain,
@@ -12669,7 +12669,7 @@ void proto_register_dcerpc_lsarpc(void)
{ &hf_lsarpc_lsa_EnumAccountRights_handle,
{ "Handle", "lsarpc.lsa_EnumAccountRights.handle", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
{ &hf_lsarpc_lsa_AuditLogInfo_time_to_shutdown,
- { "Time To Shutdown", "lsarpc.lsa_AuditLogInfo.time_to_shutdown", FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0, NULL, HFILL }},
+ { "Time To Shutdown", "lsarpc.lsa_AuditLogInfo.time_to_shutdown", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0, NULL, HFILL }},
{ &hf_lsarpc_lsa_AccountAccessMask_LSA_ACCOUNT_VIEW,
{ "Lsa Account View", "lsarpc.lsa_AccountAccessMask.LSA_ACCOUNT_VIEW", FT_BOOLEAN, 32, TFS(&lsa_AccountAccessMask_LSA_ACCOUNT_VIEW_tfs), ( 0x00000001 ), NULL, HFILL }},
{ &hf_lsarpc_lsa_TrustDomainInfoInfoEx_domain_name,
@@ -12929,7 +12929,7 @@ void proto_register_dcerpc_lsarpc(void)
{ &hf_lsarpc_lsa_ModificationInfo_modified_id,
{ "Modified Id", "lsarpc.lsa_ModificationInfo.modified_id", FT_UINT64, BASE_DEC, NULL, 0, NULL, HFILL }},
{ &hf_lsarpc_lsa_QuerySecret_new_mtime,
- { "New Mtime", "lsarpc.lsa_QuerySecret.new_mtime", FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0, NULL, HFILL }},
+ { "New Mtime", "lsarpc.lsa_QuerySecret.new_mtime", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0, NULL, HFILL }},
{ &hf_lsarpc_lsa_LookupPrivValue_handle,
{ "Handle", "lsarpc.lsa_LookupPrivValue.handle", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }},
{ &hf_lsarpc_lsa_TransSidArray2_count,
diff --git a/epan/proto.c b/epan/proto.c
index 0e03c7cbd1..49597c619c 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -4196,22 +4196,32 @@ static void tmp_fld_check_assert(header_field_info *hfinfo) {
{ FT_OID, "FT_OID" },
{ 0, NULL } };
- /* XXX - absolute_time_display enum? */
static const value_string hf_display[] = {
- { BASE_NONE, "BASE_NONE" },
- { BASE_DEC, "BASE_DEC" },
- { BASE_HEX, "BASE_HEX" },
- { BASE_OCT, "BASE_OCT" },
- { BASE_DEC_HEX, "BASE_DEC_HEX" },
- { BASE_HEX_DEC, "BASE_HEX_DEC" },
- { BASE_CUSTOM, "BASE_CUSTOM" },
- { 0, NULL } };
+ { BASE_NONE, "BASE_NONE" },
+ { BASE_DEC, "BASE_DEC" },
+ { BASE_HEX, "BASE_HEX" },
+ { BASE_OCT, "BASE_OCT" },
+ { BASE_DEC_HEX, "BASE_DEC_HEX" },
+ { BASE_HEX_DEC, "BASE_HEX_DEC" },
+ { BASE_CUSTOM, "BASE_CUSTOM" },
+ { BASE_NONE|BASE_RANGE_STRING, "BASE_NONE|BASE_RANGE_STRING" },
+ { BASE_DEC|BASE_RANGE_STRING, "BASE_DEC|BASE_RANGE_STRING" },
+ { BASE_HEX|BASE_RANGE_STRING, "BASE_HEX|BASE_RANGE_STRING" },
+ { BASE_OCT|BASE_RANGE_STRING, "BASE_OCT|BASE_RANGE_STRING" },
+ { BASE_DEC_HEX|BASE_RANGE_STRING, "BASE_DEC_HEX|BASE_RANGE_STRING" },
+ { BASE_HEX_DEC|BASE_RANGE_STRING, "BASE_HEX_DEC|BASE_RANGE_STRING" },
+ { BASE_CUSTOM|BASE_RANGE_STRING, "BASE_CUSTOM|BASE_RANGE_STRING" },
+ { ABSOLUTE_TIME_LOCAL, "ABSOLUTE_TIME_LOCAL" },
+ { ABSOLUTE_TIME_UTC, "ABSOLUTE_TIME_LOCAL" },
+ { ABSOLUTE_TIME_DOY_UTC, "ABSOLUTE_TIME_LOCAL" },
+ { 0, NULL } };
/* The field must have a name (with length > 0) */
if (!hfinfo->name || !hfinfo->name[0]) {
if (hfinfo->abbrev)
/* Try to identify the field */
- g_error("Field (abbrev='%s') does not have a name\n", hfinfo->abbrev);
+ g_error("Field (abbrev='%s') does not have a name\n",
+ hfinfo->abbrev);
else
/* Hum, no luck */
g_error("Field does not have a name (nor an abbreviation)\n");
@@ -4222,7 +4232,9 @@ static void tmp_fld_check_assert(header_field_info *hfinfo) {
if (!hfinfo->abbrev)
g_error("Field '%s' does not have an abbreviation\n", hfinfo->name);
- /* These types of fields are allowed to have value_strings, true_false_strings or a protocol_t struct*/
+ /* These types of fields are allowed to have value_strings,
+ * true_false_strings or a protocol_t struct
+ */
if (hfinfo->strings != NULL && !(
(hfinfo->type == FT_UINT8) ||
(hfinfo->type == FT_UINT16) ||
@@ -4236,7 +4248,8 @@ static void tmp_fld_check_assert(header_field_info *hfinfo) {
(hfinfo->type == FT_PROTOCOL) ||
(hfinfo->type == FT_FRAMENUM) ))
g_error("Field '%s' (%s) has a 'strings' value but is of type %s (which is not allowed to have strings)\n",
- hfinfo->name, hfinfo->abbrev, val_to_str(hfinfo->type, hf_types, "(Unknown: %d)"));
+ hfinfo->name, hfinfo->abbrev,
+ val_to_str(hfinfo->type, hf_types, "(Unknown: %d)"));
switch (hfinfo->type) {
@@ -4245,10 +4258,10 @@ static void tmp_fld_check_assert(header_field_info *hfinfo) {
case FT_INT24:
case FT_INT32:
case FT_INT64:
- /* Hexadecimal and octal are, in printf() and everywhere else,
- * unsigned so don't allow dissectors to register a signed
- * field to be displayed unsigned. (Else how would we
- * display values negative values?)
+ /* Hexadecimal and octal are, in printf() and everywhere
+ * else, unsigned so don't allow dissectors to register a
+ * signed field to be displayed unsigned. (Else how would
+ * we display negative values?)
*
* If you want to take out this check, be sure to fix
* hfinfo_numeric_format() so that it does not assert out
@@ -4260,68 +4273,76 @@ static void tmp_fld_check_assert(header_field_info *hfinfo) {
hfinfo->display == BASE_DEC_HEX ||
hfinfo->display == BASE_OCT)
g_error("Field '%s' (%s) is signed (%s) but is being displayed unsigned (%s)\n",
- hfinfo->name, hfinfo->abbrev, val_to_str(hfinfo->type, hf_types, "(Unknown: %d)"),
- val_to_str(hfinfo->display, hf_display, "(Unknown: %d)"));
+ hfinfo->name, hfinfo->abbrev,
+ val_to_str(hfinfo->type, hf_types, "(Unknown: %d)"),
+ val_to_str(hfinfo->display, hf_display, "(Bit count: %d)"));
/* FALL THROUGH */
case FT_UINT8:
case FT_UINT16:
case FT_UINT24:
case FT_UINT32:
if (hfinfo->strings == NULL) {
- /* Require integral types (other than frame number, which is
- always displayed in decimal) to have a number base */
+ /* Require integral types (other than frame number,
+ * which is always displayed in decimal) to have a
+ * number base */
if (hfinfo->display == BASE_NONE)
g_error("Field '%s' (%s) is an integral value (%s) without strings but is being displayed as BASE_NONE\n",
- hfinfo->name, hfinfo->abbrev, val_to_str(hfinfo->type, hf_types, "(Unknown: %d)"));
+ hfinfo->name, hfinfo->abbrev,
+ val_to_str(hfinfo->type, hf_types, "(Unknown: %d)"));
}
break;
case FT_UINT64:
if (hfinfo->display == BASE_NONE)
g_error("Field '%s' (%s) is an integral value (%s) but is being displayed as BASE_NONE\n",
- hfinfo->name, hfinfo->abbrev, val_to_str(hfinfo->type, hf_types, "(Unknown: %d)"));
+ hfinfo->name, hfinfo->abbrev,
+ val_to_str(hfinfo->type, hf_types, "(Unknown: %d)"));
break;
case FT_PROTOCOL:
case FT_FRAMENUM:
if (hfinfo->display != BASE_NONE)
g_error("Field '%s' (%s) is an %s but is being displayed as %s instead of BASE_NONE\n",
- hfinfo->name, hfinfo->abbrev, val_to_str(hfinfo->type, hf_types, "(Unknown: %d)"),
- val_to_str(hfinfo->display, hf_display, "(Unknown: %d)"));
+ hfinfo->name, hfinfo->abbrev,
+ val_to_str(hfinfo->type, hf_types, "(Unknown: %d)"),
+ val_to_str(hfinfo->display, hf_display, "(Bit count: %d)"));
if (hfinfo->bitmask != 0)
g_error("Field '%s' (%s) is an %s but has a bitmask\n",
- hfinfo->name, hfinfo->abbrev, val_to_str(hfinfo->type, hf_types, "(Unknown: %d)"));
+ hfinfo->name, hfinfo->abbrev,
+ val_to_str(hfinfo->type, hf_types, "(Unknown: %d)"));
break;
case FT_BOOLEAN:
break;
case FT_ABSOLUTE_TIME:
- /* Note: ABSOLUTE_TIME enum values overlap with the BASE_
- * values so this doesn't catch every problem.
- */
if (!(hfinfo->display == ABSOLUTE_TIME_LOCAL ||
hfinfo->display == ABSOLUTE_TIME_UTC ||
hfinfo->display == ABSOLUTE_TIME_DOY_UTC))
g_error("Field '%s' (%s) is a %s but is being displayed as %s instead of as a time\n",
- hfinfo->name, hfinfo->abbrev, val_to_str(hfinfo->type, hf_types, "(Unknown: %d)"),
- val_to_str(hfinfo->display, hf_display, "(Unknown: %d)"));
+ hfinfo->name, hfinfo->abbrev,
+ val_to_str(hfinfo->type, hf_types, "(Unknown: %d)"),
+ val_to_str(hfinfo->display, hf_display, "(Bit count: %d)"));
if (hfinfo->bitmask != 0)
g_error("Field '%s' (%s) is an %s but has a bitmask\n",
- hfinfo->name, hfinfo->abbrev, val_to_str(hfinfo->type, hf_types, "(Unknown: %d)"));
+ hfinfo->name, hfinfo->abbrev,
+ val_to_str(hfinfo->type, hf_types, "(Unknown: %d)"));
break;
default:
if (hfinfo->display != BASE_NONE)
g_error("Field '%s' (%s) is an %s but is being displayed as %s instead of BASE_NONE\n",
- hfinfo->name, hfinfo->abbrev, val_to_str(hfinfo->type, hf_types, "(Unknown: %d)"),
- val_to_str(hfinfo->display, hf_display, "(Unknown: %d)"));
+ hfinfo->name, hfinfo->abbrev,
+ val_to_str(hfinfo->type, hf_types, "(Unknown: %d)"),
+ val_to_str(hfinfo->display, hf_display, "(Bit count: %d)"));
if (hfinfo->bitmask != 0)
g_error("Field '%s' (%s) is an %s but has a bitmask\n",
- hfinfo->name, hfinfo->abbrev, val_to_str(hfinfo->type, hf_types, "(Unknown: %d)"));
+ hfinfo->name, hfinfo->abbrev,
+ val_to_str(hfinfo->type, hf_types, "(Unknown: %d)"));
if (hfinfo->strings != NULL)
g_error("Field '%s' (%s) is an %s but has a strings value\n",
- hfinfo->name, hfinfo->abbrev, val_to_str(hfinfo->type, hf_types, "(Unknown: %d)"));
+ hfinfo->name, hfinfo->abbrev,
+ val_to_str(hfinfo->type, hf_types, "(Unknown: %d)"));
break;
}
}
diff --git a/epan/time_fmt.h b/epan/time_fmt.h
index d8bf151be3..d6aadd5cf2 100644
--- a/epan/time_fmt.h
+++ b/epan/time_fmt.h
@@ -41,7 +41,8 @@ typedef enum {
* Display format of an absolute-time time stamp.
*/
typedef enum {
- ABSOLUTE_TIME_LOCAL, /* local time in our time zone, with month and day */
+ /* Start at 1000 to avoid duplicating the values used in base_display_e */
+ ABSOLUTE_TIME_LOCAL = 1000, /* local time in our time zone, with month and day */
ABSOLUTE_TIME_UTC, /* UTC, with month and day */
ABSOLUTE_TIME_DOY_UTC /* UTC, with 1-origin day-of-year */
} absolute_time_display_e;