diff options
author | Anders Broman <anders.broman@ericsson.com> | 2010-01-12 20:15:24 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2010-01-12 20:15:24 +0000 |
commit | 8dea26e52cbe1f7c7d25a70a12da0c47d634994f (patch) | |
tree | f20109b4eb4082e1b3ecfdde21eb86a6a3e539f6 /asn1/mms | |
parent | 1f6a39eae944f8a8393a5d5161830c2e3c95dec9 (diff) |
From Gonzalo Casas:
MMS TimeOfDay display.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4387
svn path=/trunk/; revision=31508
Diffstat (limited to 'asn1/mms')
-rw-r--r-- | asn1/mms/mms.cnf | 58 | ||||
-rw-r--r-- | asn1/mms/packet-mms-template.c | 2 |
2 files changed, 60 insertions, 0 deletions
diff --git a/asn1/mms/mms.cnf b/asn1/mms/mms.cnf index 8647ccbcaf..31bdc47d1b 100644 --- a/asn1/mms/mms.cnf +++ b/asn1/mms/mms.cnf @@ -17,6 +17,9 @@ MMSpdu #.TYPE_RENAME +#.TYPE_ATTR +TimeOfDay TYPE = FT_STRING DISPLAY = BASE_NONE + #.FIELD_RENAME #.FN_BODY ApplicationReference/ap-title @@ -41,3 +44,58 @@ MMSpdu col_append_fstr(actx->pinfo->cinfo, COL_INFO, "%%s ", mms_MMSpdu_vals[branch_taken].strptr); } + + +#.FN_BODY TimeOfDay + + guint32 len; + proto_item *cause; + guint32 milliseconds; + guint16 days; + gchar * ptime; + nstime_t ts; + + len = tvb_length_remaining(tvb, offset); + + if(len == 4) + { + milliseconds = tvb_get_ntohl(tvb, offset); + ptime = time_msecs_to_str(milliseconds); + + if(hf_index >= 0) + { + proto_tree_add_string(tree, hf_index, tvb, offset, len, ptime); + } + return offset; + } + + if(len == 6) + { + milliseconds = tvb_get_ntohl(tvb, offset); + days = tvb_get_ntohs(tvb, offset+4); + + /* 5113 days between 01-01-1970 and 01-01-1984 */ + /* 86400 seconds in one day */ + + ts.secs = (days + 5113) * 86400 + milliseconds / 1000; + ts.nsecs = (milliseconds %% 1000) * G_GINT64_CONSTANT(1000000U); + + ptime = abs_time_to_str(&ts, TRUE); + if(hf_index >= 0) + { + proto_tree_add_string(tree, hf_index, tvb, offset, len, ptime); + } + + return offset; + } + + cause = proto_tree_add_text(tree, tvb, offset, len, + "BER Error: malformed TimeOfDay encoding, " + "length must be 4 or 6 bytes"); + proto_item_set_expert_flags(cause, PI_MALFORMED, PI_WARN); + expert_add_info_format(actx->pinfo, cause, PI_MALFORMED, PI_WARN, "BER Error: malformed TimeOfDay encoding"); + if(hf_index >= 0) + { + proto_tree_add_string(tree, hf_index, tvb, offset, len, "????"); + } + return offset; diff --git a/asn1/mms/packet-mms-template.c b/asn1/mms/packet-mms-template.c index 4b1642a2e4..89e713c34f 100644 --- a/asn1/mms/packet-mms-template.c +++ b/asn1/mms/packet-mms-template.c @@ -30,6 +30,8 @@ #include <glib.h> #include <epan/packet.h> #include <epan/asn1.h> +#include <epan/expert.h> +#include <epan/nstime.h> #include <stdio.h> #include <string.h> |