summaryrefslogtreecommitdiffstats
path: root/epan/dissectors/asn1/mms/mms.cnf
blob: 68190ade0ba3b5ef99058f70b858cba4a11f4070 (plain)
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# 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
ConfirmedServiceRequest/deleteEventCondition        confirmedServiceRequest_deleteEventCondition
ConfirmedServiceResponse/deleteEventCondition       confirmedServiceResponse_deleteEventCondition
ConfirmedServiceRequest/deleteEventAction           confirmedServiceRequest_deleteEventAction
ConfirmedServiceRequest/deleteEventAction           confirmedServiceRequest_deleteEventAction
ConfirmedServiceRequest/deleteEventEnrollment       confirmedServiceRequest_deleteEventEnrollment
ConfirmedServiceResponse/deleteEventEnrollment      confirmedServiceResponse_deleteEventEnrollment
TypeSpecification/bit-string                        typeSpecification_bit-string
Data/bit-string                                     data_bit-string
TypeSpecification/octet-string                      typeSpecification_octet-string
Data/octet-string                                   data_octet-string
TypeSpecification/visible-string                    typeSpecification_visible-string
Data/visible-string                                 data_visible-string
TypeSpecification/binary-time                       typeSpecification_binary-time
Data/binary-time                                    data_binary-time
GetNameList-Request/continueAfter                   getNameList-Request_continueAfter
GetCapabilityList-Request/continueAfter             getCapabilityList-Request_continueAfter
GetEventEnrollmentAttributes-Request/continueAfter  getEventEnrollmentAttributes-Request_continueAfter
GetAlarmEnrollmentSummary-Request/continueAfter     getAlarmEnrollmentSummary-Request_continueAfter
FileDirectory-Request/continueAfter                 fileDirectory-Request_continueAfter
GetDomainAttributes-Response/state                  getDomainAttributes-Response_state
GetProgramInvocationAttributes-Response/state       getProgramInvocationAttributes-Response_state
ReportSemaphoreEntryStatus-Request/state            reportSemaphoreEntryStatus-Request_state
AlterEventEnrollment-Response/currentState/state    alterEventEnrollment-Response_currentState_state

#.FIELD_ATTR
ConfirmedServiceRequest/deleteEventCondition        ABBREV=confirmedServiceRequest.deleteEventCondition
ConfirmedServiceResponse/deleteEventCondition       ABBREV=confirmedServiceResponse.deleteEventCondition
ConfirmedServiceRequest/deleteEventAction           ABBREV=confirmedServiceRequest.deleteEventAction
ConfirmedServiceRequest/deleteEventAction           ABBREV=confirmedServiceRequest.deleteEventAction
ConfirmedServiceRequest/deleteEventEnrollment       ABBREV=confirmedServiceRequest.deleteEventEnrollment
ConfirmedServiceResponse/deleteEventEnrollment      ABBREV=confirmedServiceResponse.deleteEventEnrollment
TypeSpecification/bit-string                        ABBREV=typeSpecification_bit-string
Data/bit-string                                     ABBREV=data_bit-string
TypeSpecification/octet-string                      ABBREV=typeSpecification.octet-string
Data/octet-string                                   ABBREV=data.octet-string
TypeSpecification/visible-string                    ABBREV=typeSpecification.visible-string
Data/visible-string                                 ABBREV=data.visible-string
TypeSpecification/binary-time                       ABBREV=typeSpecification.binary-time
Data/binary-time                                    ABBREV=data.binary-time
GetNameList-Request/continueAfter                   ABBREV=getNameList-Request_continueAfter
GetCapabilityList-Request/continueAfter             ABBREV=getCapabilityList-Request_continueAfter
GetEventEnrollmentAttributes-Request/continueAfter  ABBREV=getEventEnrollmentAttributes-Request_continueAfter
GetAlarmEnrollmentSummary-Request/continueAfter     ABBREV=getAlarmEnrollmentSummary-Request_continueAfter
FileDirectory-Request/continueAfter                 ABBREV=fileDirectory-Request_continueAfter
GetDomainAttributes-Response/state                  ABBREV=getDomainAttributes-Response_state
GetProgramInvocationAttributes-Response/state       ABBREV=getProgramInvocationAttributes-Response_state
ReportSemaphoreEntryStatus-Request/state            ABBREV=reportSemaphoreEntryStatus-Request_state
AlterEventEnrollment-Response/currentState/state    ABBREV=alterEventEnrollment-Response_currentState_state


#.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 ){
		if (mms_has_private_data(actx))
			col_append_fstr(actx->pinfo->cinfo, COL_INFO, "%%s%%s%%s",
				private_data_get_preCinfo(actx), mms_MMSpdu_vals[branch_taken].strptr, private_data_get_moreCinfo(actx));
		else
			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 = signed_time_msecs_to_str(actx->pinfo->pool, 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(actx->pinfo->pool, &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, "????");
	}

#.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(actx->pinfo->pool, &ts, ABSOLUTE_TIME_UTC, TRUE);

	if(hf_index >= 0)
	{
		proto_tree_add_string(tree, hf_index, tvb, offset, len, ptime);
	}


#.FN_BODY Unsigned32 VAL_PTR=&val
	guint32 val;
%(DEFAULT_BODY)s
	if (hf_index == hf_mms_invokeID)
		private_data_add_preCinfo(actx, val);

#.FN_BODY FloatingPoint
%(DEFAULT_BODY)s
	private_data_add_moreCinfo_float(actx, tvb);

#.FN_BODY Identifier
	int offset_id = offset;
%(DEFAULT_BODY)s
	if ((hf_index == hf_mms_domainId) || (hf_index == hf_mms_itemId)) {
		if (tvb_get_guint8(tvb, offset_id) == 0x1a)
			private_data_add_moreCinfo_id(actx,tvb);
	}