1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
|
# 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;
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_ep_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_ep_str(&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_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_GINT64_CONSTANT(1000000000U)) / G_GINT64_CONSTANT(0x100000000U) ) ;
ts.secs = seconds;
ts.nsecs = nanoseconds;
ptime = abs_time_to_ep_str(&ts, ABSOLUTE_TIME_UTC, TRUE);
if(hf_index >= 0)
{
proto_tree_add_string(tree, hf_index, tvb, offset, len, ptime);
}
return offset;
|