# mms.cnf # mms conformation file #.MODULE_IMPORT ISO-8650-ACSE-1 acse #.IMPORT ../acse/acse-exp.cnf #.EXPORTS MMSpdu #.PDU #.NO_EMIT #.TYPE_RENAME #.TYPE_ATTR TimeOfDay TYPE = FT_STRING DISPLAY = BASE_NONE UtcTime TYPE = FT_STRING DISPLAY = BASE_NONE #.FIELD_RENAME #.FN_BODY ApplicationReference/ap-title offset=dissect_acse_AP_title(FALSE, tvb, offset, actx, tree, hf_mms_ap_title); #.FN_BODY ApplicationReference/ap-invocation-id offset=dissect_acse_AP_invocation_identifier(FALSE, tvb, offset, actx, tree, hf_mms_ap_invocation_id); #.FN_BODY ApplicationReference/ae-qualifier offset=dissect_acse_AE_qualifier(FALSE, tvb, offset, actx, tree, hf_mms_ae_qualifier); #.FN_BODY ApplicationReference/ae-invocation-id offset=dissect_acse_AE_invocation_identifier(FALSE, tvb, offset, actx, tree, hf_mms_ae_invocation_id); #.FN_BODY MMSpdu VAL_PTR=&branch_taken gint branch_taken; %(DEFAULT_BODY)s if( (branch_taken!=-1) && mms_MMSpdu_vals[branch_taken].strptr ){ col_append_fstr(actx->pinfo->cinfo, COL_INFO, "%%s ", mms_MMSpdu_vals[branch_taken].strptr); } #.FN_BODY TimeOfDay guint32 len; guint32 milliseconds; guint16 days; gchar * ptime; nstime_t ts; len = tvb_reported_length_remaining(tvb, offset); if(len == 4) { milliseconds = tvb_get_ntohl(tvb, offset); ptime = time_msecs_to_str(wmem_packet_scope(), 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) * 1000000U; ptime = abs_time_to_str(wmem_packet_scope(), &ts, ABSOLUTE_TIME_UTC, TRUE); if(hf_index >= 0) { proto_tree_add_string(tree, hf_index, tvb, offset, len, ptime); } return offset; } proto_tree_add_expert_format(tree, actx->pinfo, &ei_mms_mal_timeofday_encoding, tvb, offset, len, "BER Error: malformed TimeOfDay encoding, length must be 4 or 6 bytes"); if(hf_index >= 0) { proto_tree_add_string(tree, hf_index, tvb, offset, len, "????"); } return offset; #.FN_BODY UtcTime guint32 len; guint32 seconds; guint32 fraction; guint32 nanoseconds; nstime_t ts; gchar * ptime; len = tvb_reported_length_remaining(tvb, offset); if(len != 8) { proto_tree_add_expert_format(tree, actx->pinfo, &ei_mms_mal_utctime_encoding, tvb, offset, len, "BER Error: malformed IEC61850 UTCTime encoding, length must be 8 bytes"); if(hf_index >= 0) { proto_tree_add_string(tree, hf_index, tvb, offset, len, "????"); } return offset; } seconds = tvb_get_ntohl(tvb, offset); fraction = tvb_get_ntoh24(tvb, offset+4) * 0x100; /* Only 3 bytes are recommended */ nanoseconds = (guint32)( ((guint64)fraction * G_GUINT64_CONSTANT(1000000000)) / G_GUINT64_CONSTANT(0x100000000) ) ; ts.secs = seconds; ts.nsecs = nanoseconds; ptime = abs_time_to_str(wmem_packet_scope(), &ts, ABSOLUTE_TIME_UTC, TRUE); if(hf_index >= 0) { proto_tree_add_string(tree, hf_index, tvb, offset, len, ptime); } return offset;