aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>2011-12-05 21:53:00 +0000
committeretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>2011-12-05 21:53:00 +0000
commit9dac27a0c94fe9a6514961d7c88d7b49cc062a7e (patch)
tree77efd88c13ccbf9f29edaa6b23fd9be3f6b93f1a
parente2187f584d28729ccfd9e34188346b917460d930 (diff)
Pretify TimeStamp and TimeZone
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@40096 f5534014-38df-0310-8fa8-9805f1628bb7
-rw-r--r--asn1/gprscdr/gprscdr.cnf68
-rw-r--r--asn1/gprscdr/packet-gprscdr-template.c8
-rw-r--r--epan/dissectors/packet-gprscdr.c89
3 files changed, 156 insertions, 9 deletions
diff --git a/asn1/gprscdr/gprscdr.cnf b/asn1/gprscdr/gprscdr.cnf
index ca3ff32f88..0feac3b44d 100644
--- a/asn1/gprscdr/gprscdr.cnf
+++ b/asn1/gprscdr/gprscdr.cnf
@@ -41,9 +41,73 @@ GPRSCallEventRecord
proto_tree_add_text(tree, tvb, offset, -1, "Not dissected");
-##### FN_BODY TimeStamp VAL_PTR = &parameter_tvb
+#.FN_BODY TimeStamp VAL_PTR = &parameter_tvb
+/*
+ *
+ * The contents of this field are a compact form of the UTCTime format
+ * containing local time plus an offset to universal time. Binary coded
+ * decimal encoding is employed for the digits to reduce the storage and
+ * transmission overhead
+ * e.g. YYMMDDhhmmssShhmm
+ * where
+ * YY = Year 00 to 99 BCD encoded
+ * MM = Month 01 to 12 BCD encoded
+ * DD = Day 01 to 31 BCD encoded
+ * hh = hour 00 to 23 BCD encoded
+ * mm = minute 00 to 59 BCD encoded
+ * ss = second 00 to 59 BCD encoded
+ * S = Sign 0 = "+", "-" ASCII encoded
+ * hh = hour 00 to 23 BCD encoded
+ * mm = minute 00 to 59 BCD encoded
+ */
-
+ tvbuff_t *parameter_tvb;
+
+%(DEFAULT_BODY)s
+
+ if (!parameter_tvb)
+ return offset;
+
+ proto_item_append_text(actx->created_item, " (UTC %%x-%%x-%%x %%x:%%x:%%x %%s%%x:%%x)",
+ tvb_get_guint8(parameter_tvb,0), /* Year */
+ tvb_get_guint8(parameter_tvb,1), /* Month */
+ tvb_get_guint8(parameter_tvb,2), /* Day */
+ tvb_get_guint8(parameter_tvb,3), /* Hour */
+ tvb_get_guint8(parameter_tvb,4), /* Minute */
+ tvb_get_guint8(parameter_tvb,5), /* Second */
+ tvb_get_ephemeral_string(parameter_tvb,6,1), /* Sign */
+ tvb_get_guint8(parameter_tvb,7), /* Hour */
+ tvb_get_guint8(parameter_tvb,8) /* Minute */
+ );
+
+#.FN_BODY MSTimeZone VAL_PTR = &parameter_tvb
+/*
+ *
+ * 1.Octet: Time Zone and 2. Octet: Daylight saving time, see TS 29.060 [75]
+ */
+ tvbuff_t *parameter_tvb;
+ guint8 data, data2;
+ char sign;
+
+%(DEFAULT_BODY)s
+
+ if (!parameter_tvb)
+ return offset;
+
+ data = tvb_get_guint8(parameter_tvb, 0);
+ sign = (data & 0x08) ? '-' : '+';
+ data = (data >> 4) + (data & 0x07) * 10;
+
+ data2 = tvb_get_guint8(tvb, 1) & 0x3;
+
+ proto_item_append_text(actx->created_item, " (GMT %%c %%d hours %%d minutes %%s)",
+ sign,
+ data / 4,
+ data %% 4 * 15,
+ val_to_str_const(data2, gprscdr_daylight_saving_time_vals, "Unknown")
+ );
+
+
#.TYPE_ATTR
IPBinaryAddress/iPBinV4Address TYPE = FT_IPv4 DISPLAY = BASE_NONE
IPBinaryAddress/iPBinV6Address TYPE = FT_IPv6 DISPLAY = BASE_NONE
diff --git a/asn1/gprscdr/packet-gprscdr-template.c b/asn1/gprscdr/packet-gprscdr-template.c
index 24a0ec43d4..8528125ee1 100644
--- a/asn1/gprscdr/packet-gprscdr-template.c
+++ b/asn1/gprscdr/packet-gprscdr-template.c
@@ -48,6 +48,14 @@ static int ett_gprscdr = -1;
static int ett_gprscdr_timestamp = -1;
#include "packet-gprscdr-ett.c"
+static const value_string gprscdr_daylight_saving_time_vals[] = {
+ {0, "No adjustment"},
+ {1, "+1 hour adjustment for Daylight Saving Time"},
+ {2, "+2 hours adjustment for Daylight Saving Time"},
+ {3, "Reserved"},
+ {0, NULL}
+};
+
#include "packet-gprscdr-fn.c"
diff --git a/epan/dissectors/packet-gprscdr.c b/epan/dissectors/packet-gprscdr.c
index 425be776fc..77dc4b3409 100644
--- a/epan/dissectors/packet-gprscdr.c
+++ b/epan/dissectors/packet-gprscdr.c
@@ -239,6 +239,14 @@ static gint ett_gprscdr_MBMSInformation = -1;
/*--- End of included file: packet-gprscdr-ett.c ---*/
#line 50 "../../asn1/gprscdr/packet-gprscdr-template.c"
+static const value_string gprscdr_daylight_saving_time_vals[] = {
+ {0, "No adjustment"},
+ {1, "+1 hour adjustment for Daylight Saving Time"},
+ {2, "+2 hours adjustment for Daylight Saving Time"},
+ {3, "Reserved"},
+ {0, NULL}
+};
+
/*--- Included file: packet-gprscdr-fn.c ---*/
#line 1 "../../asn1/gprscdr/packet-gprscdr-fn.c"
@@ -411,8 +419,6 @@ dissect_gprscdr_T_information(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int
proto_tree_add_text(tree, tvb, offset, -1, "Not dissected");
-
-
return offset;
}
@@ -646,8 +652,37 @@ dissect_gprscdr_MSISDN(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
static int
dissect_gprscdr_MSTimeZone(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
+#line 84 "../../asn1/gprscdr/gprscdr.cnf"
+/*
+ *
+ * 1.Octet: Time Zone and 2. Octet: Daylight saving time, see TS 29.060 [75]
+ */
+ tvbuff_t *parameter_tvb;
+ guint8 data, data2;
+ char sign;
+
offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
- NULL);
+ &parameter_tvb);
+
+
+ if (!parameter_tvb)
+ return offset;
+
+ data = tvb_get_guint8(parameter_tvb, 0);
+ sign = (data & 0x08) ? '-' : '+';
+ data = (data >> 4) + (data & 0x07) * 10;
+
+ data2 = tvb_get_guint8(tvb, 1) & 0x3;
+
+ proto_item_append_text(actx->created_item, " (GMT %c %d hours %d minutes %s)",
+ sign,
+ data / 4,
+ data % 4 * 15,
+ val_to_str_const(data2, gprscdr_daylight_saving_time_vals, "Unknown")
+ );
+
+
+
return offset;
}
@@ -684,8 +719,48 @@ dissect_gprscdr_SmsTpDestinationNumber(gboolean implicit_tag _U_, tvbuff_t *tvb
static int
dissect_gprscdr_TimeStamp(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
+#line 45 "../../asn1/gprscdr/gprscdr.cnf"
+/*
+ *
+ * The contents of this field are a compact form of the UTCTime format
+ * containing local time plus an offset to universal time. Binary coded
+ * decimal encoding is employed for the digits to reduce the storage and
+ * transmission overhead
+ * e.g. YYMMDDhhmmssShhmm
+ * where
+ * YY = Year 00 to 99 BCD encoded
+ * MM = Month 01 to 12 BCD encoded
+ * DD = Day 01 to 31 BCD encoded
+ * hh = hour 00 to 23 BCD encoded
+ * mm = minute 00 to 59 BCD encoded
+ * ss = second 00 to 59 BCD encoded
+ * S = Sign 0 = "+", "-" ASCII encoded
+ * hh = hour 00 to 23 BCD encoded
+ * mm = minute 00 to 59 BCD encoded
+ */
+
+ tvbuff_t *parameter_tvb;
+
offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index,
- NULL);
+ &parameter_tvb);
+
+
+ if (!parameter_tvb)
+ return offset;
+
+ proto_item_append_text(actx->created_item, " (UTC %x-%x-%x %x:%x:%x %s%x:%x)",
+ tvb_get_guint8(parameter_tvb,0), /* Year */
+ tvb_get_guint8(parameter_tvb,1), /* Month */
+ tvb_get_guint8(parameter_tvb,2), /* Day */
+ tvb_get_guint8(parameter_tvb,3), /* Hour */
+ tvb_get_guint8(parameter_tvb,4), /* Minute */
+ tvb_get_guint8(parameter_tvb,5), /* Second */
+ tvb_get_ephemeral_string(parameter_tvb,6,1), /* Sign */
+ tvb_get_guint8(parameter_tvb,7), /* Hour */
+ tvb_get_guint8(parameter_tvb,8) /* Minute */
+ );
+
+
return offset;
}
@@ -1779,7 +1854,7 @@ int dissect_gprscdr_GPRSCallEventRecord_PDU(tvbuff_t *tvb _U_, packet_info *pinf
/*--- End of included file: packet-gprscdr-fn.c ---*/
-#line 52 "../../asn1/gprscdr/packet-gprscdr-template.c"
+#line 60 "../../asn1/gprscdr/packet-gprscdr-template.c"
@@ -2362,7 +2437,7 @@ proto_register_gprscdr(void)
NULL, HFILL }},
/*--- End of included file: packet-gprscdr-hfarr.c ---*/
-#line 62 "../../asn1/gprscdr/packet-gprscdr-template.c"
+#line 70 "../../asn1/gprscdr/packet-gprscdr-template.c"
};
/* List of subtrees */
@@ -2404,7 +2479,7 @@ proto_register_gprscdr(void)
&ett_gprscdr_MBMSInformation,
/*--- End of included file: packet-gprscdr-ettarr.c ---*/
-#line 69 "../../asn1/gprscdr/packet-gprscdr-template.c"
+#line 77 "../../asn1/gprscdr/packet-gprscdr-template.c"
};
proto_gprscdr = proto_register_protocol(PNAME, PSNAME, PFNAME);