1# mms.cnf
2# mms conformation file
3
4#.MODULE_IMPORT
5ISO-8650-ACSE-1 acse
6
7#.IMPORT ../acse/acse-exp.cnf
8
9#.EXPORTS
10MMSpdu
11
12#.PDU
13
14#.NO_EMIT
15
16#.TYPE_RENAME
17
18#.TYPE_ATTR
19TimeOfDay	TYPE = FT_STRING DISPLAY = BASE_NONE
20UtcTime	TYPE = FT_STRING DISPLAY = BASE_NONE
21
22#.FIELD_RENAME
23ConfirmedServiceRequest/deleteEventCondition        confirmedServiceRequest_deleteEventCondition
24ConfirmedServiceResponse/deleteEventCondition       confirmedServiceResponse_deleteEventCondition
25ConfirmedServiceRequest/deleteEventAction           confirmedServiceRequest_deleteEventAction
26ConfirmedServiceRequest/deleteEventAction           confirmedServiceRequest_deleteEventAction
27ConfirmedServiceRequest/deleteEventEnrollment       confirmedServiceRequest_deleteEventEnrollment
28ConfirmedServiceResponse/deleteEventEnrollment      confirmedServiceResponse_deleteEventEnrollment
29TypeSpecification/bit-string                        typeSpecification_bit-string
30Data/bit-string                                     data_bit-string
31TypeSpecification/octet-string                      typeSpecification_octet-string
32Data/octet-string                                   data_octet-string
33TypeSpecification/visible-string                    typeSpecification_visible-string
34Data/visible-string                                 data_visible-string
35TypeSpecification/binary-time                       typeSpecification_binary-time
36Data/binary-time                                    data_binary-time
37GetNameList-Request/continueAfter                   getNameList-Request_continueAfter
38GetCapabilityList-Request/continueAfter             getCapabilityList-Request_continueAfter
39GetEventEnrollmentAttributes-Request/continueAfter  getEventEnrollmentAttributes-Request_continueAfter
40GetAlarmEnrollmentSummary-Request/continueAfter     getAlarmEnrollmentSummary-Request_continueAfter
41FileDirectory-Request/continueAfter                 fileDirectory-Request_continueAfter
42GetDomainAttributes-Response/state                  getDomainAttributes-Response_state
43GetProgramInvocationAttributes-Response/state       getProgramInvocationAttributes-Response_state
44ReportSemaphoreEntryStatus-Request/state            reportSemaphoreEntryStatus-Request_state
45AlterEventEnrollment-Response/currentState/state    alterEventEnrollment-Response_currentState_state
46
47#.FIELD_ATTR
48ConfirmedServiceRequest/deleteEventCondition        ABBREV=confirmedServiceRequest.deleteEventCondition
49ConfirmedServiceResponse/deleteEventCondition       ABBREV=confirmedServiceResponse.deleteEventCondition
50ConfirmedServiceRequest/deleteEventAction           ABBREV=confirmedServiceRequest.deleteEventAction
51ConfirmedServiceRequest/deleteEventAction           ABBREV=confirmedServiceRequest.deleteEventAction
52ConfirmedServiceRequest/deleteEventEnrollment       ABBREV=confirmedServiceRequest.deleteEventEnrollment
53ConfirmedServiceResponse/deleteEventEnrollment      ABBREV=confirmedServiceResponse.deleteEventEnrollment
54TypeSpecification/bit-string                        ABBREV=typeSpecification_bit-string
55Data/bit-string                                     ABBREV=data_bit-string
56TypeSpecification/octet-string                      ABBREV=typeSpecification.octet-string
57Data/octet-string                                   ABBREV=data.octet-string
58TypeSpecification/visible-string                    ABBREV=typeSpecification.visible-string
59Data/visible-string                                 ABBREV=data.visible-string
60TypeSpecification/binary-time                       ABBREV=typeSpecification.binary-time
61Data/binary-time                                    ABBREV=data.binary-time
62GetNameList-Request/continueAfter                   ABBREV=getNameList-Request_continueAfter
63GetCapabilityList-Request/continueAfter             ABBREV=getCapabilityList-Request_continueAfter
64GetEventEnrollmentAttributes-Request/continueAfter  ABBREV=getEventEnrollmentAttributes-Request_continueAfter
65GetAlarmEnrollmentSummary-Request/continueAfter     ABBREV=getAlarmEnrollmentSummary-Request_continueAfter
66FileDirectory-Request/continueAfter                 ABBREV=fileDirectory-Request_continueAfter
67GetDomainAttributes-Response/state                  ABBREV=getDomainAttributes-Response_state
68GetProgramInvocationAttributes-Response/state       ABBREV=getProgramInvocationAttributes-Response_state
69ReportSemaphoreEntryStatus-Request/state            ABBREV=reportSemaphoreEntryStatus-Request_state
70AlterEventEnrollment-Response/currentState/state    ABBREV=alterEventEnrollment-Response_currentState_state
71
72
73#.FN_BODY ApplicationReference/ap-title
74	offset=dissect_acse_AP_title(FALSE, tvb, offset, actx, tree, hf_mms_ap_title);
75
76#.FN_BODY ApplicationReference/ap-invocation-id
77	offset=dissect_acse_AP_invocation_identifier(FALSE, tvb, offset, actx, tree, hf_mms_ap_invocation_id);
78
79#.FN_BODY ApplicationReference/ae-qualifier
80	offset=dissect_acse_AE_qualifier(FALSE, tvb, offset, actx, tree, hf_mms_ae_qualifier);
81
82#.FN_BODY ApplicationReference/ae-invocation-id
83	offset=dissect_acse_AE_invocation_identifier(FALSE, tvb, offset, actx, tree, hf_mms_ae_invocation_id);
84
85#.FN_BODY MMSpdu VAL_PTR=&branch_taken
86	gint branch_taken;
87
88%(DEFAULT_BODY)s
89
90	if( (branch_taken!=-1) && mms_MMSpdu_vals[branch_taken].strptr ){
91		if (mms_has_private_data(actx))
92			col_append_fstr(actx->pinfo->cinfo, COL_INFO, "%%s%%s%%s",
93				private_data_get_preCinfo(actx), mms_MMSpdu_vals[branch_taken].strptr, private_data_get_moreCinfo(actx));
94		else
95			col_append_fstr(actx->pinfo->cinfo, COL_INFO, "%%s",
96				mms_MMSpdu_vals[branch_taken].strptr);
97	}
98
99#.FN_BODY TimeOfDay
100
101	guint32 len;
102	guint32 milliseconds;
103	guint16 days;
104	gchar *	ptime;
105	nstime_t ts;
106
107	len = tvb_reported_length_remaining(tvb, offset);
108
109	if(len == 4)
110	{
111		milliseconds = tvb_get_ntohl(tvb, offset);
112		ptime = signed_time_msecs_to_str(actx->pinfo->pool, milliseconds);
113
114		if(hf_index >= 0)
115		{
116			proto_tree_add_string(tree, hf_index, tvb, offset, len, ptime);
117		}
118		return offset;
119	}
120
121	if(len == 6)
122	{
123		milliseconds = tvb_get_ntohl(tvb, offset);
124		days = tvb_get_ntohs(tvb, offset+4);
125
126		/* 5113 days between 01-01-1970 and 01-01-1984 */
127		/* 86400 seconds in one day */
128
129		ts.secs = (days + 5113) * 86400 + milliseconds / 1000;
130		ts.nsecs = (milliseconds %% 1000) * 1000000U;
131
132		ptime = abs_time_to_str(actx->pinfo->pool, &ts, ABSOLUTE_TIME_UTC, TRUE);
133		if(hf_index >= 0)
134		{
135			proto_tree_add_string(tree, hf_index, tvb, offset, len, ptime);
136		}
137
138		return offset;
139	}
140
141	proto_tree_add_expert_format(tree, actx->pinfo, &ei_mms_mal_timeofday_encoding,
142			tvb, offset, len, "BER Error: malformed TimeOfDay encoding, length must be 4 or 6 bytes");
143	if(hf_index >= 0)
144	{
145		proto_tree_add_string(tree, hf_index, tvb, offset, len, "????");
146	}
147	return offset;
148
149
150#.FN_BODY UtcTime
151
152	guint32 len;
153	guint32 seconds;
154	guint32	fraction;
155	guint32 nanoseconds;
156	nstime_t ts;
157	gchar *	ptime;
158
159	len = tvb_reported_length_remaining(tvb, offset);
160
161	if(len != 8)
162	{
163		proto_tree_add_expert_format(tree, actx->pinfo, &ei_mms_mal_utctime_encoding,
164				tvb, offset, len, "BER Error: malformed IEC61850 UTCTime encoding, length must be 8 bytes");
165		if(hf_index >= 0)
166		{
167			proto_tree_add_string(tree, hf_index, tvb, offset, len, "????");
168		}
169		return offset;
170	}
171
172	seconds = tvb_get_ntohl(tvb, offset);
173	fraction = tvb_get_ntoh24(tvb, offset+4) * 0x100; /* Only 3 bytes are recommended */
174	nanoseconds = (guint32)( ((guint64)fraction * G_GUINT64_CONSTANT(1000000000)) / G_GUINT64_CONSTANT(0x100000000) ) ;
175
176	ts.secs = seconds;
177	ts.nsecs = nanoseconds;
178
179	ptime = abs_time_to_str(actx->pinfo->pool, &ts, ABSOLUTE_TIME_UTC, TRUE);
180
181	if(hf_index >= 0)
182	{
183		proto_tree_add_string(tree, hf_index, tvb, offset, len, ptime);
184	}
185
186	return offset;
187
188#.FN_BODY Unsigned32 VAL_PTR=&val
189	guint32 val;
190%(DEFAULT_BODY)s
191	if (hf_index == hf_mms_invokeID)
192		private_data_add_preCinfo(actx, val);
193
194#.FN_BODY FloatingPoint
195%(DEFAULT_BODY)s
196	private_data_add_moreCinfo_float(actx, tvb);
197
198#.FN_BODY Identifier
199	int offset_id = offset;
200%(DEFAULT_BODY)s
201	if ((hf_index == hf_mms_domainId) || (hf_index == hf_mms_itemId)) {
202		if (tvb_get_guint8(tvb, offset_id) == 0x1a)
203			private_data_add_moreCinfo_id(actx,tvb);
204	}