wireshark/asn1/mms/mms.cnf

145 lines
3.4 KiB
INI

# mms.cnf
# mms conformation file
# $Id$
#.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;
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) * 1000000U;
ptime = abs_time_to_str(&ts, ABSOLUTE_TIME_UTC, 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;
#.FN_BODY UtcTime
guint32 len;
proto_item *cause;
guint32 seconds;
guint32 fraction;
guint32 nanoseconds;
nstime_t ts;
gchar * ptime;
len = tvb_length_remaining(tvb, offset);
if(len != 8)
{
cause = proto_tree_add_text(tree, tvb, offset, len,
"BER Error: malformed IEC61850 UTCTime encoding, "
"length must be 8 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 IEC61850 UTCTime encoding");
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_GINT64_CONSTANT(1000000000U)) / G_GINT64_CONSTANT(0x100000000U) ) ;
ts.secs = seconds;
ts.nsecs = nanoseconds;
ptime = abs_time_to_str(&ts, ABSOLUTE_TIME_UTC, TRUE);
if(hf_index >= 0)
{
proto_tree_add_string(tree, hf_index, tvb, offset, len, ptime);
}
return offset;