1%%
2%% %CopyrightBegin%
3%%
4%% Copyright Ericsson AB 2007-2016. All Rights Reserved.
5%%
6%% Licensed under the Apache License, Version 2.0 (the "License");
7%% you may not use this file except in compliance with the License.
8%% You may obtain a copy of the License at
9%%
10%%     http://www.apache.org/licenses/LICENSE-2.0
11%%
12%% Unless required by applicable law or agreed to in writing, software
13%% distributed under the License is distributed on an "AS IS" BASIS,
14%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15%% See the License for the specific language governing permissions and
16%% limitations under the License.
17%%
18%% %CopyrightEnd%
19%%
20
21%%
22%%----------------------------------------------------------------------
23%% Purpose: Utility functions for creating the megaco types
24%%          This file is originally a copy of megaco_test_msg_v2_lib.erl
25%%          which is why so much of it is commented out.
26%%----------------------------------------------------------------------
27
28-module(megaco_test_msg_v1_lib).
29
30%% ----
31
32-compile({no_auto_import,[error/1]}).
33
34%% ----
35
36-include_lib("megaco/include/megaco_message_v1.hrl").
37-include_lib("megaco/include/megaco.hrl").
38
39%% ----
40
41-export([
42 	 cre_MegacoMessage/1, cre_MegacoMessage/2,
43%% 	 cre_AuthenticationHeader/3,
44 	 cre_Message/3,
45%% 	 cre_ErrorDescriptor/1, cre_ErrorDescriptor/2,
46%% 	 cre_ErrorCode/1,
47%% 	 cre_ErrorText/1,
48 	 cre_ContextID/1,
49 	 cre_Transaction/1,
50 	 cre_TransactionId/1,
51 	 cre_TransactionRequest/2,
52%% 	 cre_TransactionPending/1,
53%% 	 cre_TransactionReply/2, cre_TransactionReply/3,
54%% 	 cre_TransactionAck/1, cre_TransactionAck/2,
55 	 cre_ActionRequest/2, cre_ActionRequest/3, cre_ActionRequest/4,
56%% 	 cre_ActionReply/2, cre_ActionReply/3, cre_ActionReply/4,
57%% 	 cre_ContextRequest/0, cre_ContextRequest/1, cre_ContextRequest/2,
58%% 	 cre_ContextRequest/3,
59%% 	 cre_ContextAttrAuditRequest/0, cre_ContextAttrAuditRequest/3,
60%% 	 cre_CommandRequest/1, cre_CommandRequest/2, cre_CommandRequest/3,
61%% 	 cre_Command/2,
62%% 	 cre_CommandReply/2,
63%% 	 cre_TopologyRequest/3, cre_TopologyRequest/4,
64%% 	 cre_AmmRequest/2,
65 	 cre_AmmDescriptor/1,
66%% 	 cre_AmmsReply/1, cre_AmmsReply/2,
67%% 	 cre_SubtractRequest/1, cre_SubtractRequest/2,
68%% 	 cre_AuditRequest/2,
69%% 	 cre_AuditReply/1,
70%% 	 cre_AuditResult/2,
71%% 	 cre_AuditReturnParameter/1,
72%% 	 cre_AuditDescriptor/0, cre_AuditDescriptor/1, cre_AuditDescriptor/2,
73%% 	 cre_IndAuditParameter/1,
74%% 	 cre_IndAudMediaDescriptor/0, cre_IndAudMediaDescriptor/1,
75%% 	 cre_IndAudMediaDescriptor/2,
76%% 	 cre_IndAudStreamDescriptor/2,
77%% 	 cre_IndAudStreamParms/0, cre_IndAudStreamParms/1,
78%% 	 cre_IndAudStreamParms/3,
79%% 	 cre_IndAudLocalControlDescriptor/0,
80%% 	 cre_IndAudLocalControlDescriptor/4,
81%% 	 cre_IndAudPropertyParm/1,
82%% 	 cre_IndAudLocalRemoteDescriptor/1,
83%% 	 cre_IndAudLocalRemoteDescriptor/2,
84%% 	 cre_IndAudPropertyGroup/1,
85%% 	 cre_IndAudTerminationStateDescriptor/1,
86%% 	 cre_IndAudTerminationStateDescriptor/3,
87%% 	 cre_IndAudEventsDescriptor/1, cre_IndAudEventsDescriptor/2,
88%% 	 cre_IndAudEventsDescriptor/3,
89%% 	 cre_IndAudEventBufferDescriptor/1,
90%% 	 cre_IndAudEventBufferDescriptor/2,
91%% 	 cre_IndAudSignalsDescriptor/1,
92%% 	 cre_IndAudSeqSigList/1,
93%% 	 cre_IndAudSeqSigList/2,
94%% 	 cre_IndAudSignal/1, cre_IndAudSignal/2,
95%% 	 cre_IndAudDigitMapDescriptor/0, cre_IndAudDigitMapDescriptor/1,
96%% 	 cre_IndAudStatisticsDescriptor/1,
97%% 	 cre_IndAudPackagesDescriptor/2,
98%% 	 cre_NotifyRequest/2, cre_NotifyRequest/3,
99%% 	 cre_NotifyReply/1, cre_NotifyReply/2,
100%% 	 cre_ObservedEventsDescriptor/2,
101%% 	 cre_ObservedEvent/2, cre_ObservedEvent/3, cre_ObservedEvent/4,
102 	 cre_EventName/1,
103 	 cre_EventParameter/2, cre_EventParameter/4,
104%% 	 cre_ServiceChangeRequest/2,
105%% 	 cre_ServiceChangeReply/2,
106%% 	 cre_ServiceChangeResult/1,
107%% 	 %% cre_WildcardField/1,
108%% 	 cre_TerminationID/2,
109%% 	 cre_TerminationIDList/1,
110%% 	 cre_MediaDescriptor/0, cre_MediaDescriptor/1, cre_MediaDescriptor/2,
111%% 	 cre_StreamDescriptor/2,
112%% 	 cre_StreamParms/0, cre_StreamParms/1, cre_StreamParms/2,
113%% 	 cre_StreamParms/3,
114%% 	 cre_LocalControlDescriptor/1, cre_LocalControlDescriptor/2,
115%% 	 cre_LocalControlDescriptor/4,
116%% 	 cre_StreamMode/1,
117%% 	 cre_PropertyParm/2, cre_PropertyParm/4,
118%% 	 cre_Name/1,
119 	 cre_PkgdName/1,
120 	 cre_PkgdName/2,
121%% 	 cre_Relation/1,
122%% 	 cre_LocalRemoteDescriptor/1,
123%% 	 cre_PropertyGroup/1,
124%% 	 cre_TerminationStateDescriptor/1,
125%% 	 cre_TerminationStateDescriptor/2,
126%% 	 cre_TerminationStateDescriptor/3,
127%% 	 cre_EventBufferControl/1,
128%% 	 cre_ServiceState/1,
129%% 	 cre_MuxDescriptor/2, %% cre_MuxDescriptor/3,
130%% 	 cre_MuxType/1,
131%% 	 cre_StreamID/1,
132%% 	 cre_EventsDescriptor/0, cre_EventsDescriptor/2,
133%% 	 cre_RequestedEvent/1,
134%% 	 cre_RequestedEvent/2, cre_RequestedEvent/3, cre_RequestedEvent/4,
135%% 	 cre_RequestedActions/0,
136%% 	 cre_RequestedActions/1, cre_RequestedActions/4,
137%% 	 cre_EventDM/1,
138%% 	 cre_SecondEventsDescriptor/1, cre_SecondEventsDescriptor/2,
139%% 	 cre_SecondRequestedEvent/2, cre_SecondRequestedEvent/3,
140%% 	 cre_SecondRequestedEvent/4,
141%% 	 cre_SecondRequestedActions/0, cre_SecondRequestedActions/1,
142%% 	 cre_SecondRequestedActions/2, cre_SecondRequestedActions/3,
143 	 cre_EventBufferDescriptor/1,
144 	 cre_EventSpec/2,
145 	 cre_EventSpec/3,
146%% 	 cre_SignalsDescriptor/1,
147%% 	 cre_SignalRequest/1,
148%% 	 cre_SeqSigList/2,
149%% 	 cre_Signal/1, cre_Signal/2, cre_Signal/7,
150%% 	 cre_SignalType/1,
151%% 	 cre_SignalName/1,
152%% 	 cre_NotifyCompletion/1,
153%% 	 cre_SigParameter/2, cre_SigParameter/4,
154%% 	 cre_RequestID/1,
155%% 	 cre_ModemDescriptor/2, %% cre_ModemDescriptor/3,
156%% 	 cre_ModemType/1,
157%% 	 cre_DigitMapDescriptor/0, cre_DigitMapDescriptor/1,
158%% 	 cre_DigitMapDescriptor/2,
159%% 	 cre_DigitMapName/1,
160%% 	 cre_DigitMapValue/1, cre_DigitMapValue/4, cre_DigitMapValue/5,
161%% 	 cre_ServiceChangeParm/2, cre_ServiceChangeParm/4,
162%% 	 cre_ServiceChangeParm/9,
163%% 	 cre_ServiceChangeAddress/2,
164%% 	 cre_ServiceChangeResParm/0, cre_ServiceChangeResParm/2,
165%% 	 cre_ServiceChangeResParm/5,
166%% 	 cre_ServiceChangeMethod/1,
167%% 	 cre_ServiceChangeProfile/1, cre_ServiceChangeProfile/2,
168%% 	 cre_PackagesDescriptor/1,
169%% 	 cre_PackagesItem/2,
170%% 	 cre_StatisticsDescriptor/1,
171%% 	 cre_StatisticsParameter/1, cre_StatisticsParameter/2,
172%% %% 	 cre_NonStandardData/2,
173%% %% 	 cre_NonStandardIdentifier/1,
174%% %% 	 cre_H221NonStandard/4,
175%% 	 cre_TimeNotation/2,
176%% 	 cre_Value/1,
177 	 cre_BOOLEAN/1
178	]).
179
180
181%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
182
183cre_MegacoMessage(M) when is_record(M, 'Message') ->
184    #'MegacoMessage'{mess = M}.
185
186cre_MegacoMessage(AH, M)
187  when is_record(AH, 'AuthenticationHeader') andalso
188       is_record(M, 'Message') ->
189    #'MegacoMessage'{authHeader = AH,
190		     mess       = M}.
191
192%% cre_AuthenticationHeader(SPI, SN, AD) ->
193%%     #'AuthenticationHeader'{secParmIndex = SPI,
194%% 			    seqNum       = SN,
195%% 			    ad           = AD}.
196
197cre_Message(V, Mid, ED) when is_record(ED, 'ErrorDescriptor') ->
198    Body = {errorDescriptor, ED},
199    #'Message'{version     = V,
200	       mId         = Mid,
201	       messageBody = Body};
202cre_Message(V, Mid, Transactions) when is_list(Transactions) ->
203    Body = {transactions, Transactions},
204    #'Message'{version     = V,
205	       mId         = Mid,
206	       messageBody = Body};
207cre_Message(V, Mid, {transactions, T} = Body) when is_list(T) ->
208    #'Message'{version     = V,
209	       mId         = Mid,
210	       messageBody = Body};
211cre_Message(V, Mid, {errorDescriptor, ED} = Body)
212  when is_record(ED, 'ErrorDescriptor') ->
213    #'Message'{version     = V,
214	       mId         = Mid,
215	       messageBody = Body}.
216
217
218%% cre_ErrorDescriptor(EC) when integer(EC) ->
219%%     #'ErrorDescriptor'{errorCode = EC}.
220
221%% cre_ErrorDescriptor(EC, ET) when integer(EC), list(ET) ->
222%%     #'ErrorDescriptor'{errorCode = EC, errorText = ET}.
223
224%% cre_ErrorCode(C) when integer(C), 0 =< C, C =< 65535 ->
225%%     C;
226%% cre_ErrorCode(C) ->
227%%     exit({invalid_ErrorCode, C}).
228
229%% cre_ErrorText(T) when list(T) ->
230%%     T.
231
232cre_ContextID(Val) when (0 =< Val) and (Val =< 4294967295) ->
233    Val;
234cre_ContextID(Val) ->
235    exit({invalid_ContextID, Val}).
236
237cre_Transaction(TR) when is_record(TR, 'TransactionRequest') ->
238    {transactionRequest, TR};
239cre_Transaction(TP) when is_record(TP, 'TransactionPending') ->
240    {transactionPending, TP};
241cre_Transaction(TR) when is_record(TR, 'TransactionReply') ->
242    {transactionReply, TR};
243cre_Transaction(TRA) when is_list(TRA) ->
244    {transactionResponseAck, TRA}.
245
246cre_TransactionId(Val) when (0 =< Val) andalso (Val =< 4294967295) ->
247    Val;
248cre_TransactionId(Val) ->
249    exit({invalid_TransactionId, Val}).
250
251cre_TransactionRequest(TransID, ARs) when is_integer(TransID) andalso is_list(ARs) ->
252    #'TransactionRequest'{transactionId = TransID,
253			  actions       = ARs}.
254
255%% cre_TransactionPending(TransID) when integer(TransID) ->
256%%     #'TransactionPending'{transactionId = TransID}.
257
258%% cre_TransactionReply(TransID, ED)
259%%   when integer(TransID), record(ED, 'ErrorDescriptor') ->
260%%     Res = {transactionError, ED},
261%%     #'TransactionReply'{transactionId     = TransID,
262%% 			transactionResult = Res};
263%% cre_TransactionReply(TransID, ARs)
264%%   when integer(TransID), list(ARs) ->
265%%     Res = {actionReplies, ARs},
266%%     #'TransactionReply'{transactionId     = TransID,
267%% 			transactionResult = Res}.
268
269%% cre_TransactionReply(TransID, IAR, ED)
270%%   when is_integer(TransID) and
271%%        ((IAR == 'NULL') or (IAR == asn1_NOVALUE)) and
272%%        is_record(ED, 'ErrorDescriptor') ->
273%%     Res = {transactionError, ED},
274%%     #'TransactionReply'{transactionId     = TransID,
275%% 			transactionResult = Res};
276%% cre_TransactionReply(TransID, IAR, ARs)
277%%   when is_integer(TransID) and
278%%        ((IAR == 'NULL') or (IAR == asn1_NOVALUE)) and
279%%        is_list(ARs) ->
280%%     Res = {actionReplies, ARs},
281%%     #'TransactionReply'{transactionId     = TransID,
282%% 			transactionResult = Res}.
283
284%% cre_TransactionAck(FirstAck) ->
285%%     #'TransactionAck'{firstAck = FirstAck}.
286
287%% cre_TransactionAck(FirstAck, FirstAck) ->
288%%     #'TransactionAck'{firstAck = FirstAck};
289%% cre_TransactionAck(FirstAck, LastAck) ->
290%%     #'TransactionAck'{firstAck = FirstAck,
291%% 		      lastAck  = LastAck}.
292
293cre_ActionRequest(CtxID, CmdReqs)
294  when is_integer(CtxID) and is_list(CmdReqs) ->
295    #'ActionRequest'{contextId       = CtxID,
296		     commandRequests = CmdReqs}.
297
298cre_ActionRequest(CtxID, CtxReq, CmdReqs)
299  when is_integer(CtxID) and
300       is_record(CtxReq, 'ContextRequest') and
301       is_list(CmdReqs) ->
302    #'ActionRequest'{contextId       = CtxID,
303		     contextRequest  = CtxReq,
304		     commandRequests = CmdReqs};
305cre_ActionRequest(CtxID, CAAR, CmdReqs)
306  when is_integer(CtxID) and
307       is_record(CAAR, 'ContextAttrAuditRequest') and
308       is_list(CmdReqs) ->
309    #'ActionRequest'{contextId           = CtxID,
310		     contextAttrAuditReq = CAAR,
311		     commandRequests     = CmdReqs}.
312
313cre_ActionRequest(CtxID, CtxReq, CAAR, CmdReqs)
314  when is_integer(CtxID) and
315       is_record(CtxReq, 'ContextRequest') and
316       is_record(CAAR, 'ContextAttrAuditRequest') and
317       is_list(CmdReqs) ->
318    #'ActionRequest'{contextId           = CtxID,
319		     contextRequest      = CtxReq,
320		     contextAttrAuditReq = CAAR,
321		     commandRequests     = CmdReqs}.
322
323%% cre_ActionReply(CtxID, CmdReps)
324%%   when integer(CtxID),
325%%        list(CmdReps) ->
326%%     #'ActionReply'{contextId    = CtxID,
327%% 		   commandReply = CmdReps}.
328
329%% cre_ActionReply(CtxID, ED, CmdReps)
330%%   when integer(CtxID),
331%%        record(ED, 'ErrorDescriptor'),
332%%        list(CmdReps) ->
333%%     #'ActionReply'{contextId       = CtxID,
334%% 		   errorDescriptor = ED,
335%% 		   commandReply    = CmdReps};
336%% cre_ActionReply(CtxID, CtxReq, CmdReps)
337%%   when integer(CtxID),
338%%        record(CtxReq, 'ContextRequest'),
339%%        list(CmdReps) ->
340%%     #'ActionReply'{contextId    = CtxID,
341%% 		   contextReply = CtxReq,
342%% 		   commandReply = CmdReps}.
343
344%% cre_ActionReply(CtxID, ED, CtxReq, CmdReps)
345%%   when integer(CtxID),
346%%        record(ED, 'ErrorDescriptor'),
347%%        record(CtxReq, 'ContextRequest'),
348%%        list(CmdReps) ->
349%%     #'ActionReply'{contextId       = CtxID,
350%% 		   errorDescriptor = ED,
351%% 		   contextReply    = CtxReq,
352%% 		   commandReply    = CmdReps}.
353
354%% cre_ContextRequest() ->
355%%     #'ContextRequest'{}.
356
357%% cre_ContextRequest(Prio) when integer(Prio), 0 =< Prio, Prio =< 15 ->
358%%     #'ContextRequest'{priority = Prio};
359%% cre_ContextRequest(Em) when Em == true; Em == false; Em == asn1_NOVALUE ->
360%%     #'ContextRequest'{emergency = Em};
361%% cre_ContextRequest(Top) when list(Top) ->
362%%     #'ContextRequest'{topologyReq = Top}.
363
364%% cre_ContextRequest(Prio, Em)
365%%   when (is_integer(Prio) and (0 =< Prio) and (Prio =< 15)) and
366%%        ((Em == true) or (Em == false) or (Em == asn1_NOVALUE)) ->
367%%     #'ContextRequest'{priority  = Prio,
368%% 		      emergency = Em};
369%% cre_ContextRequest(Prio, Top)
370%%   when integer(Prio), 0 =< Prio, Prio =< 15, list(Top) ->
371%%     #'ContextRequest'{priority    = Prio,
372%% 		      topologyReq = Top}.
373
374%% cre_ContextRequest(Prio, Em, Top)
375%%   when (is_integer(Prio) and (0 =< Prio) and (Prio =< 15)) and
376%%        ((Em == true) or (Em == false) or (Em == asn1_NOVALUE)) and
377%%        is_list(Top) ->
378%%     #'ContextRequest'{priority    = Prio,
379%% 		      emergency   = Em,
380%% 		      topologyReq = Top}.
381
382%% cre_ContextAttrAuditRequest() ->
383%%     #'ContextAttrAuditRequest'{}.
384
385%% cre_ContextAttrAuditRequest(Top, Em, Prio)
386%%   when ((Top  == 'NULL') or (Top  == asn1_NOVALUE)) and
387%%        ((Em   == 'NULL') or (Em   == asn1_NOVALUE)) and
388%%        ((Prio == 'NULL') or (Prio == asn1_NOVALUE)) ->
389%%     #'ContextAttrAuditRequest'{topology  = Top,
390%% 			       emergency = Em,
391%% 			       priority  = Prio}.
392
393%% cre_CommandRequest(Cmd) ->
394%%     #'CommandRequest'{command = Cmd}.
395
396%% cre_CommandRequest(Cmd, Opt)
397%%   when ((Opt == 'NULL') or (Opt == asn1_NOVALUE)) ->
398%%     #'CommandRequest'{command  = Cmd,
399%% 		      optional = Opt}.
400
401%% cre_CommandRequest(Cmd, Opt, WR)
402%%   when ((Opt == 'NULL') or (Opt == asn1_NOVALUE)) and
403%%        ((WR  == 'NULL') or (WR  == asn1_NOVALUE)) ->
404%%     #'CommandRequest'{command        = Cmd,
405%% 		      optional       = Opt,
406%%  		      wildcardReturn = WR}.
407
408%% cre_Command(addReq = Tag, Req)
409%%   when record(Req, 'AmmRequest') ->
410%%     {Tag, Req};
411%% cre_Command(moveReq = Tag, Req)
412%%   when record(Req, 'AmmRequest') ->
413%%     {Tag, Req};
414%% cre_Command(modReq = Tag, Req)
415%%   when record(Req, 'AmmRequest') ->
416%%     {Tag, Req};
417%% cre_Command(subtractReq = Tag, Req)
418%%   when record(Req, 'SubtractRequest') ->
419%%     {Tag, Req};
420%% cre_Command(auditCapRequest = Tag, Req)
421%%   when record(Req, 'AuditRequest') ->
422%%     {Tag, Req};
423%% cre_Command(auditValueRequest = Tag, Req)
424%%   when record(Req, 'AuditRequest') ->
425%%     {Tag, Req};
426%% cre_Command(notifyReq = Tag, Req)
427%%   when record(Req, 'NotifyRequest') ->
428%%     {Tag, Req};
429%% cre_Command(serviceChangeReq = Tag, Req)
430%%   when record(Req, 'ServiceChangeRequest') ->
431%%     {Tag, Req}.
432
433%% cre_CommandReply(addReply = Tag, Rep)
434%%   when record(Rep, 'AmmsReply') ->
435%%     {Tag, Rep};
436%% cre_CommandReply(moveReply = Tag, Rep)
437%%   when record(Rep, 'AmmsReply') ->
438%%     {Tag, Rep};
439%% cre_CommandReply(modReply = Tag, Rep)
440%%   when record(Rep, 'AmmsReply') ->
441%%     {Tag, Rep};
442%% cre_CommandReply(subtractReply = Tag, Rep)
443%%   when record(Rep, 'AmmsReply') ->
444%%     {Tag, Rep};
445%% cre_CommandReply(auditCapReply = Tag, Rep)
446%%   when tuple(Rep) ->
447%%     {Tag, Rep};
448%% cre_CommandReply(auditValueReply = Tag, Rep)
449%%   when tuple(Rep) ->
450%%     {Tag, Rep};
451%% cre_CommandReply(notifyReply = Tag, Rep)
452%%   when record(Rep, 'NotifyReply') ->
453%%     {Tag, Rep};
454%% cre_CommandReply(serviceChangeReply = Tag, Rep)
455%%   when record(Rep, 'ServiceChangeReply') ->
456%%     {Tag, Rep}.
457
458%% cre_TopologyRequest(From, To, Dir)
459%%   when is_record(From, 'TerminationID') and
460%%        is_record(To, 'TerminationID') and
461%%        ((Dir == bothway) or (Dir == isolate) or (Dir == oneway)) ->
462%%     #'TopologyRequest'{terminationFrom   = From,
463%% 		       terminationTo     = To,
464%% 		       topologyDirection = Dir}.
465
466%% cre_TopologyRequest(From, To, Dir, SID)
467%%   when is_record(From, 'TerminationID') and
468%%        is_record(To, 'TerminationID') and
469%%        ((Dir == bothway) or (Dir == isolate) or (Dir == oneway)) and
470%%        (is_integer(SID) or (SID == asn1_NOVALUE)) ->
471%%     #'TopologyRequest'{terminationFrom   = From,
472%% 		       terminationTo     = To,
473%% 		       topologyDirection = Dir,
474%% 		       streamID          = SID}.
475
476%% cre_AmmRequest(TermIDs, Descs) when list(TermIDs), list(Descs) ->
477%%     #'AmmRequest'{terminationID = TermIDs,
478%% 		  descriptors   = Descs}.
479
480cre_AmmDescriptor(D) when is_record(D, 'MediaDescriptor') ->
481    {mediaDescriptor, D};
482cre_AmmDescriptor(D) when is_record(D, 'ModemDescriptor') ->
483    {modemDescriptor, D};
484cre_AmmDescriptor(D) when is_record(D, 'MuxDescriptor') ->
485    {muxDescriptor, D};
486cre_AmmDescriptor(D) when is_record(D, 'EventsDescriptor') ->
487    {eventsDescriptor, D};
488cre_AmmDescriptor(D) when is_record(D, 'DigitMapDescriptor') ->
489    {digitMapDescriptor, D};
490cre_AmmDescriptor(D) when is_record(D, 'AuditDescriptor') ->
491    {auditDescriptor, D};
492cre_AmmDescriptor(D) when is_list(D) ->
493    case is_EventBufferDescriptor(D) of
494	true ->
495	    {eventBufferDescriptor, D};
496	false ->
497	    case is_SignalsDescriptor(D) of
498		true ->
499		    {signalsDescriptor, D};
500		false ->
501		    error({invalid_AmmDescriptor, D})
502	    end
503    end.
504
505%% cre_AmmsReply(TermIDs) when list(TermIDs) ->
506%%     #'AmmsReply'{terminationID = TermIDs}.
507
508%% cre_AmmsReply(TermIDs, TAs) when list(TermIDs), list(TAs) ->
509%%     #'AmmsReply'{terminationID    = TermIDs,
510%% 		 terminationAudit = TAs}.
511
512%% cre_SubtractRequest(TermIDs) when list(TermIDs) ->
513%%     #'SubtractRequest'{terminationID = TermIDs}.
514
515%% cre_SubtractRequest(TermIDs, Audit)
516%%   when list(TermIDs), record(Audit, 'AuditDescriptor') ->
517%%     #'SubtractRequest'{terminationID   = TermIDs,
518%% 		       auditDescriptor = Audit}.
519
520%% cre_AuditRequest(TermID, Audit)
521%%   when record(TermID, megaco_term_id), record(Audit, 'AuditDescriptor') ->
522%%     #'AuditRequest'{terminationID   = TermID,
523%% 		    auditDescriptor = Audit}.
524
525%% cre_AuditReply(TermIDs) when list(TermIDs) ->
526%%     {contextAuditResult, TermIDs};
527%% cre_AuditReply(ED) when record(ED, 'ErrorDescriptor') ->
528%%     {error, ED};
529%% cre_AuditReply(Audit) when record(Audit, 'AuditResult') ->
530%%     {auditResult, Audit}.
531
532%% cre_AuditResult(TermID, TAs)
533%%   when record(TermID, megaco_term_id), list(TAs) ->
534%%     #'AuditResult'{terminationID          = TermID,
535%% 		   terminationAuditResult = TAs}.
536
537%% cre_AuditReturnParameter(D) when record(D, 'ErrorDescriptor') ->
538%%     {errorDescriptor, D};
539%% cre_AuditReturnParameter(D) when record(D, 'MediaDescriptor') ->
540%%     {mediaDescriptor, D};
541%% cre_AuditReturnParameter(D) when record(D, 'ModemDescriptor') ->
542%%     {modemDescriptor, D};
543%% cre_AuditReturnParameter(D) when record(D, 'MuxDescriptor') ->
544%%     {muxDescriptor, D};
545%% cre_AuditReturnParameter(D) when record(D, 'EventsDescriptor') ->
546%%     {eventsDescriptor, D};
547%% cre_AuditReturnParameter([H|_] = D) when record(H, 'EventSpec') ->
548%%     {eventBufferDescriptor, D};
549%% cre_AuditReturnParameter(D) when record(D, 'DigitMapDescriptor') ->
550%%     {digitMapDescriptor, D};
551%% cre_AuditReturnParameter(D) when record(D, 'ObservedEventsDescriptor') ->
552%%     {observedEventsDescriptor, D};
553%% cre_AuditReturnParameter([H|_] = D) when record(H, 'StatisticsParameter') ->
554%%     {statisticsDescriptor, D};
555%% cre_AuditReturnParameter([H|_] = D) when record(H, 'PackagesItem') ->
556%%     {packagesDescriptor, D};
557%% cre_AuditReturnParameter(D) when record(D, 'AuditDescriptor') ->
558%%     {emptyDescriptors, D};
559%% cre_AuditReturnParameter([H|_] = D) when tuple(H) ->
560%%     {signalsDescriptor, D}.
561
562%% cre_AuditDescriptor() ->
563%%     #'AuditDescriptor'{}.
564
565%% cre_AuditDescriptor([H|_] = AT) when atom(H) ->
566%%     #'AuditDescriptor'{auditToken = AT};
567%% cre_AuditDescriptor(APT) ->
568%%     #'AuditDescriptor'{auditPropertyToken = APT}.
569
570%% cre_AuditDescriptor(AT, APT) ->
571%%     #'AuditDescriptor'{auditToken         = AT,
572%% 		       auditPropertyToken = APT}.
573
574%% cre_IndAuditParameter(D) when record(D, 'IndAudMediaDescriptor') ->
575%%     {indAudMediaDescriptor, D};
576%% cre_IndAuditParameter(D) when record(D, 'IndAudEventsDescriptor') ->
577%%     {indAudEventsDescriptor, D};
578%% cre_IndAuditParameter(D) when record(D, 'IndAudEventBufferDescriptor') ->
579%%     {indAudEventBufferDescriptor, D};
580%% cre_IndAuditParameter({signal, _} = D) ->
581%%     {indAudSignalsDescriptor, D};
582%% cre_IndAuditParameter({seqSigList, _} = D) ->
583%%     {indAudSignalsDescriptor, D};
584%% cre_IndAuditParameter(D) when record(D, 'IndAudDigitMapDescriptor') ->
585%%     {indAudDigitMapDescriptor, D};
586%% cre_IndAuditParameter(D) when record(D, 'IndAudStatisticsDescriptor') ->
587%%     {indAudStatisticsDescriptor, D};
588%% cre_IndAuditParameter(D) when record(D, 'IndAudPackagesDescriptor') ->
589%%     {indAudPackagesDescriptor, D}.
590
591%% cre_IndAudMediaDescriptor() ->
592%%     #'IndAudMediaDescriptor'{}.
593
594%% cre_IndAudMediaDescriptor(TSD)
595%%   when record(TSD, 'IndAudTerminationStateDescriptor') ->
596%%     #'IndAudMediaDescriptor'{termStateDescr = TSD};
597%% cre_IndAudMediaDescriptor(Parms) when record(Parms, 'IndAudStreamParms') ->
598%%     Streams = {oneStream, Parms},
599%%     #'IndAudMediaDescriptor'{streams = Streams};
600%% cre_IndAudMediaDescriptor(Descs) when list(Descs) ->
601%%     Streams = {multiStream, Descs},
602%%     #'IndAudMediaDescriptor'{streams = Streams}.
603
604%% cre_IndAudMediaDescriptor(TSD, Parms)
605%%   when record(TSD, 'IndAudTerminationStateDescriptor'),
606%%        record(Parms, 'IndAudStreamParms') ->
607%%     Streams = {oneStream, Parms},
608%%     #'IndAudMediaDescriptor'{termStateDescr = TSD,
609%% 			     streams        = Streams};
610%% cre_IndAudMediaDescriptor(TSD, Descs)
611%%   when record(TSD, 'IndAudTerminationStateDescriptor'), list(Descs) ->
612%%     Streams = {multiStream, Descs},
613%%     #'IndAudMediaDescriptor'{termStateDescr = TSD,
614%% 			     streams        = Streams}.
615
616%% cre_IndAudStreamDescriptor(SID, Parms)
617%%   when integer(SID), record(Parms, 'IndAudStreamParms') ->
618%%     #'IndAudStreamDescriptor'{streamID    = SID,
619%% 			      streamParms = Parms}.
620
621%% cre_IndAudStreamParms() ->
622%%     #'IndAudStreamParms'{}.
623
624%% cre_IndAudStreamParms(LCD) when record(LCD, 'IndAudLocalControlDescriptor') ->
625%%     #'IndAudStreamParms'{localControlDescriptor = LCD}.
626
627%% cre_IndAudStreamParms(LCD, L, R)
628%%   when record(LCD, 'IndAudLocalControlDescriptor'),
629%%        record(L, 'IndAudLocalRemoteDescriptor'),
630%%        record(R, 'IndAudLocalRemoteDescriptor') ->
631%%     #'IndAudStreamParms'{localControlDescriptor = LCD,
632%% 			 localDescriptor        = L,
633%% 			 remoteDescriptor       = R}.
634
635%% cre_IndAudLocalControlDescriptor() ->
636%%     #'IndAudLocalControlDescriptor'{}.
637
638%% cre_IndAudLocalControlDescriptor(SM, RV, RG, PP)
639%%   when ((SM == 'NULL') or (SM == asn1_NOVALUE)) and
640%%        ((RV == 'NULL') or (RV == asn1_NOVALUE)) and
641%%        ((RG == 'NULL') or (RG == asn1_NOVALUE)) and
642%%        (is_list(PP) or (PP == asn1_NOVALUE)) ->
643%%     #'IndAudLocalControlDescriptor'{streamMode    = SM,
644%% 				    reserveValue  = RV,
645%% 				    reserveGroup  = RG,
646%% 				    propertyParms = PP}.
647
648%% cre_IndAudPropertyParm(PkgdName) when list(PkgdName) ->
649%%     #'IndAudPropertyParm'{name = PkgdName}.
650
651%% cre_IndAudLocalRemoteDescriptor(Grps)
652%%   when list(Grps) ->
653%%     #'IndAudLocalRemoteDescriptor'{propGrps = Grps}.
654
655%% cre_IndAudLocalRemoteDescriptor(GrpID, Grps)
656%%   when integer(GrpID), 0 =< GrpID, GrpID =< 65535, list(Grps) ->
657%%     #'IndAudLocalRemoteDescriptor'{propGroupID = GrpID,
658%% 				   propGrps    = Grps}.
659
660%% cre_IndAudPropertyGroup([]) ->
661%%     [];
662%% cre_IndAudPropertyGroup([H|_] = PG)
663%%   when record(H, 'IndAudPropertyParm') ->
664%%     PG.
665
666%% cre_IndAudTerminationStateDescriptor([] = PP) ->
667%%     #'IndAudTerminationStateDescriptor'{propertyParms = PP};
668%% cre_IndAudTerminationStateDescriptor([H|_] = PP)
669%%   when record(H, 'IndAudPropertyParm') ->
670%%     #'IndAudTerminationStateDescriptor'{propertyParms = PP}.
671
672%% cre_IndAudTerminationStateDescriptor([] = PP, EBC, SS)
673%%   when ((EBC == 'NULL') or (EBC == asn1_NOVALUE)) and
674%%        ((SS  == 'NULL') or (SS  == asn1_NOVALUE)) ->
675%%     #'IndAudTerminationStateDescriptor'{propertyParms      = PP,
676%% 					eventBufferControl = EBC,
677%% 					serviceState       = SS};
678%% cre_IndAudTerminationStateDescriptor([H|_] = PP, EBC, SS)
679%%   when is_record(H, 'IndAudPropertyParm') and
680%%        ((EBC == 'NULL') or (EBC == asn1_NOVALUE)) and
681%%        ((SS  == 'NULL') or (SS  == asn1_NOVALUE)) ->
682%%     #'IndAudTerminationStateDescriptor'{propertyParms      = PP,
683%% 					eventBufferControl = EBC,
684%% 					serviceState       = SS}.
685
686%% cre_IndAudEventsDescriptor(PkgdName)
687%%   when list(PkgdName) ->
688%%     #'IndAudEventsDescriptor'{pkgdName = PkgdName}.
689
690%% cre_IndAudEventsDescriptor(RID, PkgdName)
691%%   when integer(RID), list(PkgdName) ->
692%%     #'IndAudEventsDescriptor'{requestID = RID, pkgdName = PkgdName};
693%% cre_IndAudEventsDescriptor(PkgdName, SID)
694%%   when list(PkgdName), integer(SID) ->
695%%     #'IndAudEventsDescriptor'{pkgdName = PkgdName, streamID = SID}.
696
697%% cre_IndAudEventsDescriptor(RID, PkgdName, SID)
698%%   when integer(RID), list(PkgdName), integer(SID)  ->
699%%     #'IndAudEventsDescriptor'{requestID = RID,
700%% 			      pkgdName  = PkgdName,
701%% 			      streamID  = SID}.
702
703%% cre_IndAudEventBufferDescriptor(EventName) when list(EventName) ->
704%%     #'IndAudEventBufferDescriptor'{eventName = EventName}.
705
706%% cre_IndAudEventBufferDescriptor(EventName, SID)
707%%   when list(EventName), integer(SID)  ->
708%%     #'IndAudEventBufferDescriptor'{eventName = EventName, streamID = SID}.
709
710%% cre_IndAudSignalsDescriptor(S) when record(S, 'IndAudSignal') ->
711%%     {signal, S};
712%% cre_IndAudSignalsDescriptor(S) when record(S, 'IndAudSeqSigList') ->
713%%     {seqSigList, S}.
714
715%% cre_IndAudSeqSigList(ID) when integer(ID), 0=< ID, ID =< 65535 ->
716%%     #'IndAudSeqSigList'{id = ID}.
717
718%% cre_IndAudSeqSigList(ID, S)
719%%   when integer(ID), 0=< ID, ID =< 65535,
720%%        record(S, 'IndAudSignal') ->
721%%     #'IndAudSeqSigList'{id = ID, signalList = S}.
722
723%% cre_IndAudSignal(SigName) when list(SigName) ->
724%%     #'IndAudSignal'{signalName = SigName}.
725
726%% cre_IndAudSignal(SigName, SID) when list(SigName), integer(SID) ->
727%%     #'IndAudSignal'{signalName = SigName, streamID = SID}.
728
729%% cre_IndAudDigitMapDescriptor() ->
730%%     #'IndAudDigitMapDescriptor'{}.
731
732%% cre_IndAudDigitMapDescriptor(DMN) when list(DMN) ->
733%%     #'IndAudDigitMapDescriptor'{digitMapName = DMN}.
734
735%% cre_IndAudStatisticsDescriptor(StatName) when list(StatName) ->
736%%     #'IndAudStatisticsDescriptor'{statName = StatName}.
737
738%% cre_IndAudPackagesDescriptor(N, V)
739%%   when list(N),
740%%        integer(V), 0 =< V, V =< 99 ->
741%%     #'IndAudPackagesDescriptor'{packageName    = N,
742%% 				packageVersion = V}.
743
744%% cre_NotifyRequest(TermIDs, D)
745%%   when list(TermIDs), record(D, 'ObservedEventsDescriptor') ->
746%%     #'NotifyRequest'{terminationID            = TermIDs,
747%% 		     observedEventsDescriptor = D}.
748
749%% cre_NotifyRequest(TermIDs, D, ED)
750%%   when list(TermIDs),
751%%        record(D, 'ObservedEventsDescriptor'),
752%%        record(ED, 'ErrorDescriptor') ->
753%%     #'NotifyRequest'{terminationID            = TermIDs,
754%% 		     observedEventsDescriptor = D,
755%% 		     errorDescriptor          = ED}.
756
757%% cre_NotifyReply(TermIDs) when list(TermIDs) ->
758%%     #'NotifyReply'{terminationID = TermIDs}.
759
760%% cre_NotifyReply(TermIDs, ED)
761%%   when list(TermIDs),
762%%        record(ED, 'ErrorDescriptor') ->
763%%     #'NotifyReply'{terminationID   = TermIDs,
764%% 		   errorDescriptor = ED}.
765
766%% cre_ObservedEventsDescriptor(RID, [H|_] = L)
767%%   when integer(RID), record(H, 'ObservedEvent') ->
768%%     #'ObservedEventsDescriptor'{requestId        = RID,
769%% 				observedEventLst = L}.
770
771%% cre_ObservedEvent(EN, EPL) when list(EN), list(EPL) ->
772%%     #'ObservedEvent'{eventName    = EN,
773%% 		     eventParList = EPL};
774%% cre_ObservedEvent(EN, TN) when list(EN), record(TN, 'TimeNotation') ->
775%%     #'ObservedEvent'{eventName    = EN,
776%% 		     timeNotation = TN}.
777
778%% cre_ObservedEvent(EN, SID, EPL) when list(EN), integer(SID), list(EPL) ->
779%%     #'ObservedEvent'{eventName    = EN,
780%% 		     streamID     = SID,
781%% 		     eventParList = EPL};
782%% cre_ObservedEvent(EN, EPL, TN)
783%%   when list(EN), list(EPL), record(TN, 'TimeNotation') ->
784%%     #'ObservedEvent'{eventName    = EN,
785%% 		     eventParList = EPL,
786%% 		     timeNotation = TN}.
787
788%% cre_ObservedEvent(EN, SID, EPL, TN)
789%%   when list(EN), integer(SID), list(EPL), record(TN, 'TimeNotation') ->
790%%     #'ObservedEvent'{eventName    = EN,
791%% 		     streamID     = SID,
792%% 		     eventParList = EPL,
793%% 		     timeNotation = TN}.
794
795cre_EventName(N) when is_list(N) ->
796    N.
797
798cre_EventParameter(N, V) when is_list(N) andalso is_list(V) ->
799    #'EventParameter'{eventParameterName = N,
800		      value              = V}.
801
802cre_EventParameter(N, V, relation = Tag, R)
803  when is_list(N) andalso is_list(V) andalso is_atom(R) ->
804    EI = {Tag, R},
805    #'EventParameter'{eventParameterName = N,
806		      value              = V,
807		      extraInfo          = EI};
808cre_EventParameter(N, V, range = Tag, B)
809  when is_list(N) andalso is_list(V) andalso is_atom(B) ->
810    EI = {Tag, B},
811    #'EventParameter'{eventParameterName = N,
812		      value              = V,
813		      extraInfo          = EI};
814cre_EventParameter(N, V, sublist = Tag, B)
815  when is_list(N) andalso is_list(V) andalso is_atom(B) ->
816    EI = {Tag, B},
817    #'EventParameter'{eventParameterName = N,
818		      value              = V,
819		      extraInfo          = EI}.
820
821%% cre_ServiceChangeRequest(TermIDs, SCP)
822%%   when list(TermIDs),
823%%        record(SCP, 'ServiceChangeParm') ->
824%%     #'ServiceChangeRequest'{terminationID      = TermIDs,
825%% 			    serviceChangeParms = SCP}.
826
827%% cre_ServiceChangeReply(TermIDs, {Tag, R} = SCR)
828%%   when list(TermIDs), atom(Tag), tuple(R) ->
829%%     #'ServiceChangeReply'{terminationID       = TermIDs,
830%% 			  serviceChangeResult = SCR}.
831
832%% cre_ServiceChangeResult(ED) when record(ED, 'ErrorDescriptor') ->
833%%     {errorDescriptor, ED};
834%% cre_ServiceChangeResult(SCRP) when record(SCRP, 'ServiceChangeResParm') ->
835%%     {serviceChangeResParms, SCRP}.
836
837%% %% cre_WildcardField(L) when list(L), length(L) == 1 -> L.
838
839%% cre_TerminationID(W, ID)
840%%   when list(W),
841%%        list(ID), 1 =< length(ID), length(ID) =< 8 ->
842%%     #'TerminationID'{wildcard = W,
843%% 		     id       = ID}.
844
845%% cre_TerminationIDList(L) when list(L) ->
846%%     L.
847
848%% cre_MediaDescriptor() ->
849%%     #'MediaDescriptor'{}.
850
851%% cre_MediaDescriptor(TSD) when record(TSD, 'TerminationStateDescriptor') ->
852%%     #'MediaDescriptor'{termStateDescr = TSD};
853%% cre_MediaDescriptor(SP) when record(SP, 'StreamParms') ->
854%%     Streams = {oneStream, SP},
855%%     #'MediaDescriptor'{streams = Streams};
856%% cre_MediaDescriptor([H|_] = SDs) when record(H, 'StreamDescriptor') ->
857%%     Streams = {multiStream, SDs},
858%%     #'MediaDescriptor'{streams = Streams}.
859
860%% cre_MediaDescriptor(TSD, SP)
861%%   when record(TSD, 'TerminationStateDescriptor'),
862%%        record(SP, 'StreamParms') ->
863%%     Streams = {oneStream, SP},
864%%     #'MediaDescriptor'{termStateDescr = TSD,
865%% 		       streams        = Streams};
866%% cre_MediaDescriptor(TSD, [H|_] = SDs)
867%%   when record(TSD, 'TerminationStateDescriptor'),
868%%        record(H, 'StreamDescriptor') ->
869%%     Streams = {multiStream, SDs},
870%%     #'MediaDescriptor'{termStateDescr = TSD,
871%% 		       streams        = Streams}.
872
873%% cre_StreamDescriptor(SID, SP) when integer(SID), record(SP, 'StreamParms') ->
874%%     #'StreamDescriptor'{streamID    = SID,
875%% 			streamParms = SP}.
876
877%% cre_StreamParms() ->
878%%     #'StreamParms'{}.
879
880%% cre_StreamParms(LCD) when record(LCD, 'LocalControlDescriptor') ->
881%%     #'StreamParms'{localControlDescriptor = LCD};
882%% cre_StreamParms(LD) when record(LD, 'LocalRemoteDescriptor') ->
883%%     #'StreamParms'{localDescriptor = LD}.
884
885%% cre_StreamParms(LCD, LD)
886%%   when (is_record(LCD, 'LocalControlDescriptor') or (LCD == asn1_NOVALUE)) and
887%%        (is_record(LD,  'LocalRemoteDescriptor')  or (LD  == asn1_NOVALUE)) ->
888%%     #'StreamParms'{localControlDescriptor = LCD,
889%% 		   localDescriptor        = LD}.
890
891%% cre_StreamParms(LCD, LD, RD)
892%%   when (is_record(LCD, 'LocalControlDescriptor') or (LCD == asn1_NOVALUE)) and
893%%        (is_record(LD,  'LocalRemoteDescriptor')  or (LD  == asn1_NOVALUE)) and
894%%        (is_record(RD,  'LocalRemoteDescriptor')  or (RD  == asn1_NOVALUE)) ->
895%%     #'StreamParms'{localControlDescriptor = LCD,
896%% 		   localDescriptor        = LD,
897%% 		   remoteDescriptor       = RD}.
898
899%% cre_LocalControlDescriptor(SM) when atom(SM) ->
900%%     #'LocalControlDescriptor'{streamMode = SM, propertyParms = []};
901%% cre_LocalControlDescriptor([H|_] = PP) when record(H, 'PropertyParm') ->
902%%     #'LocalControlDescriptor'{propertyParms = PP}.
903
904%% cre_LocalControlDescriptor(SM, [H|_] = PP)
905%%   when atom(SM), record(H, 'PropertyParm') ->
906%%     #'LocalControlDescriptor'{streamMode    = SM,
907%% 			      propertyParms = PP}.
908
909%% cre_LocalControlDescriptor(SM, RV, RG, [H|_] = PP)
910%%   when is_atom(SM) and
911%%      ((RV == true) or (RV == false) or (RV == asn1_NOVALUE)) and
912%%      ((RG == true) or (RG == false) or (RG == asn1_NOVALUE)) and
913%%      is_record(H, 'PropertyParm') ->
914%%     #'LocalControlDescriptor'{streamMode    = SM,
915%% 			      reserveValue  = RV,
916%% 			      reserveGroup  = RG,
917%% 			      propertyParms = PP}.
918
919%% cre_StreamMode(sendOnly = M) ->
920%%     M;
921%% cre_StreamMode(recvOnly = M) ->
922%%     M;
923%% cre_StreamMode(sendRecv = M) ->
924%%     M;
925%% cre_StreamMode(inactive = M) ->
926%%     M;
927%% cre_StreamMode(loopBack = M) ->
928%%     M.
929
930%% cre_PropertyParm(N, [H|_] = V) when list(N), list(H) ->
931%%     #'PropertyParm'{name = N, value = V}.
932
933%% cre_PropertyParm(N, [H|_] = V, relation = Tag, R)
934%%   when list(N), list(H), atom(R) ->
935%%     EI = {Tag, R},
936%%     #'PropertyParm'{name = N, value = V, extraInfo = EI};
937%% cre_PropertyParm(N, [H|_] = V, range = Tag, B)
938%%   when list(N), list(H), atom(B) ->
939%%     EI = {Tag, B},
940%%     #'PropertyParm'{name = N, value = V, extraInfo = EI};
941%% cre_PropertyParm(N, [H|_] = V, sublist = Tag, B)
942%%   when list(N), list(H), atom(B) ->
943%%     EI = {Tag, B},
944%%     #'PropertyParm'{name = N, value = V, extraInfo = EI}.
945
946
947%% cre_Name(N) when list(N), length(N) == 2 ->
948%%     N.
949
950cre_PkgdName(N) when is_list(N) ->
951    case string:tokens(N, [$\\]) of
952	[_PkgName, _ItemID] ->
953	    N;
954	_ ->
955	    error({invalid_PkgdName, N})
956    end.
957cre_PkgdName(root, root) ->
958    "*/*";
959cre_PkgdName(PackageName, root)
960  when is_list(PackageName) and (length(PackageName) =< 64) ->
961    PackageName ++ "/*";
962cre_PkgdName(PackageName, ItemID)
963  when ((is_list(PackageName) and (length(PackageName) =< 64)) and
964	(is_list(ItemID)      and (length(ItemID) =< 64))) ->
965    PackageName ++ "/" ++ ItemID;
966cre_PkgdName(PackageName, ItemID) ->
967    error({invalid_PkgdName, {PackageName, ItemID}}).
968
969%% cre_Relation(greaterThan = R) ->
970%%     R;
971%% cre_Relation(smallerThan = R) ->
972%%     R;
973%% cre_Relation(unequalTo = R) ->
974%%     R.
975
976%% cre_LocalRemoteDescriptor([H|_] = PGs) when list(H) ->
977%%     #'LocalRemoteDescriptor'{propGrps = PGs}.
978
979%% cre_PropertyGroup([H|_] = PG) when record(H, 'PropertyParm') ->
980%%     PG.
981
982%% cre_TerminationStateDescriptor([H|_] = PPs) when record(H, 'PropertyParm') ->
983%%     #'TerminationStateDescriptor'{propertyParms = PPs}.
984
985%% cre_TerminationStateDescriptor([H|_] = PPs, off = EBC)
986%%   when record(H, 'PropertyParm') ->
987%%     #'TerminationStateDescriptor'{propertyParms      = PPs,
988%% 				  eventBufferControl = EBC};
989%% cre_TerminationStateDescriptor([H|_] = PPs, lockStep = EBC)
990%%   when record(H, 'PropertyParm') ->
991%%     #'TerminationStateDescriptor'{propertyParms      = PPs,
992%% 				  eventBufferControl = EBC};
993%% cre_TerminationStateDescriptor([H|_] = PPs, test = SS)
994%%   when record(H, 'PropertyParm') ->
995%%     #'TerminationStateDescriptor'{propertyParms = PPs,
996%% 				  serviceState  = SS};
997%% cre_TerminationStateDescriptor([H|_] = PPs, outOfSvc = SS)
998%%   when record(H, 'PropertyParm') ->
999%%     #'TerminationStateDescriptor'{propertyParms = PPs,
1000%% 				  serviceState  = SS};
1001%% cre_TerminationStateDescriptor([H|_] = PPs, inSvc = SS)
1002%%   when record(H, 'PropertyParm') ->
1003%%     #'TerminationStateDescriptor'{propertyParms = PPs,
1004%% 				  serviceState  = SS}.
1005
1006%% cre_TerminationStateDescriptor([H|_] = PPs, EMC, SS)
1007%%   when record(H, 'PropertyParm'),
1008%%        ((EMC == off)  or (EMC == lockStep)) and
1009%%        ((SS  == test) or (SS  == outOfSvc) or (SS == inSvc)) ->
1010%%     #'TerminationStateDescriptor'{propertyParms      = PPs,
1011%% 				  eventBufferControl = EMC,
1012%% 				  serviceState       = SS}.
1013
1014%% cre_EventBufferControl(off = EBC) ->
1015%%     EBC;
1016%% cre_EventBufferControl(lockStep = EBC) ->
1017%%     EBC.
1018
1019%% cre_ServiceState(test = SS) ->
1020%%     SS;
1021%% cre_ServiceState(outOfSvc = SS) ->
1022%%     SS;
1023%% cre_ServiceState(inSvc = SS) ->
1024%%     SS.
1025
1026%% cre_MuxDescriptor(MT, [H|_] = TL)
1027%%   when atom(MT), record(H, 'TerminationID') ->
1028%%     #'MuxDescriptor'{muxType = MT, termList = TL}.
1029
1030%% %% cre_MuxDescriptor(MT, [H|_] = TL, NSD)
1031%% %%   when atom(MT), record(H, 'TerminationID'), record(NSD, 'NonStandardData') ->
1032%% %%     #'MuxDescriptor'{muxType = MT, termList = TL, nonStandardData = NSD}.
1033
1034%% cre_MuxType(h221 = MT) ->
1035%%     MT;
1036%% cre_MuxType(h223 = MT) ->
1037%%     MT;
1038%% cre_MuxType(h226 = MT) ->
1039%%     MT;
1040%% cre_MuxType(v76 = MT) ->
1041%%     MT;
1042%% cre_MuxType(nx64k = MT) ->
1043%%     MT.
1044
1045%% cre_StreamID(Val) when 0 =< Val, Val =< 65535 ->
1046%%     Val;
1047%% cre_StreamID(Val) ->
1048%%     exit({invalid_ContextID, Val}).
1049
1050%% %% RequestID must be present if eventList is non empty
1051%% cre_EventsDescriptor() ->
1052%%     #'EventsDescriptor'{eventList = []}.
1053
1054%% cre_EventsDescriptor(RID, [H|_] = EL)
1055%%   when integer(RID), record(H, 'RequestedEvent') ->
1056%%     #'EventsDescriptor'{requestID = RID, eventList = EL}.
1057
1058%% cre_RequestedEvent(N) ->
1059%%     #'RequestedEvent'{pkgdName = N}.
1060
1061%% cre_RequestedEvent(N, [H|_] = EPL)
1062%%   when list(N),
1063%%        record(H, 'EventParameter') ->
1064%%     #'RequestedEvent'{pkgdName  = N,
1065%% 		      evParList = EPL};
1066%% cre_RequestedEvent(N, EA)
1067%%   when list(N),
1068%%        record(EA, 'RequestedActions')->
1069%%     #'RequestedEvent'{pkgdName    = N,
1070%% 		      eventAction = EA}.
1071
1072
1073%% cre_RequestedEvent(N, SID, [H|_] = EPL)
1074%%   when list(N),
1075%%        integer(SID),
1076%%        record(H, 'EventParameter') ->
1077%%     #'RequestedEvent'{pkgdName  = N,
1078%% 		      streamID  = SID,
1079%% 		      evParList = EPL};
1080%% cre_RequestedEvent(N, EA, [H|_] = EPL)
1081%%   when list(N),
1082%%        record(EA, 'RequestedActions'),
1083%%        record(H, 'EventParameter') ->
1084%%     #'RequestedEvent'{pkgdName     = N,
1085%% 		      eventAction  = EA,
1086%% 		      evParList    = EPL}.
1087
1088%% cre_RequestedEvent(N, SID, EA, [H|_] = EPL)
1089%%   when list(N),
1090%%        integer(SID),
1091%%        record(EA, 'RequestedActions'),
1092%%        record(H, 'EventParameter') ->
1093%%     #'RequestedEvent'{pkgdName     = N,
1094%% 		      streamID     = SID,
1095%% 		      eventAction  = EA,
1096%% 		      evParList    = EPL}.
1097
1098%% cre_RequestedActions() ->
1099%%     #'RequestedActions'{}.
1100
1101%% cre_RequestedActions(KA)
1102%%   when (KA == true) or (KA == true) or (KA == asn1_NOVALUE) ->
1103%%     #'RequestedActions'{keepActive = KA};
1104%% cre_RequestedActions(SE)
1105%%   when is_record(SE, 'SecondEventsDescriptor') or (SE == asn1_NOVALUE) ->
1106%%     #'RequestedActions'{secondEvent = SE};
1107%% cre_RequestedActions(SD)
1108%%   when is_list(SD) or (SD == asn1_NOVALUE) ->
1109%%     #'RequestedActions'{signalsDescriptor = SD};
1110%% cre_RequestedActions({Tag, _} = EDM)
1111%%   when is_atom(Tag) or (EDM == asn1_NOVALUE) ->
1112%%     #'RequestedActions'{eventDM = EDM}.
1113
1114%% cre_RequestedActions(KA, {Tag, _} = EDM, SE, SD)
1115%%   when ((KA == true) or (KA == true) or (KA == asn1_NOVALUE)) and
1116%%        (is_atom(Tag) or (EDM == asn1_NOVALUE)) and
1117%%        (is_record(SE, 'SecondEventsDescriptor') or (SE == asn1_NOVALUE)) and
1118%%        (is_list(SD) or (SD == asn1_NOVALUE)) ->
1119%%     #'RequestedActions'{keepActive        = KA,
1120%% 			eventDM           = EDM,
1121%% 			secondEvent       = SE,
1122%% 			signalsDescriptor = SD}.
1123
1124%% cre_EventDM(N) when list(N) ->
1125%%     {digitMapName, N};
1126%% cre_EventDM(V) when record(V, 'DigitMapValue') ->
1127%%     {digitMapValue, V}.
1128
1129%% cre_SecondEventsDescriptor([H|_] = EL)
1130%%   when record(H, 'SecondRequestedEvent') ->
1131%%     #'SecondEventsDescriptor'{eventList = EL}.
1132
1133%% cre_SecondEventsDescriptor(RID, [H|_] = EL)
1134%%   when integer(RID), record(H, 'SecondRequestedEvent') ->
1135%%     #'SecondEventsDescriptor'{requestID = RID, eventList = EL}.
1136
1137%% cre_SecondRequestedEvent(N, [H|_] = EPL)
1138%%   when list(N),
1139%%        record(H, 'EventParameter') ->
1140%%     #'SecondRequestedEvent'{pkgdName  = N,
1141%% 			    evParList = EPL}.
1142
1143%% cre_SecondRequestedEvent(N, SID, [H|_] = EPL)
1144%%   when list(N),
1145%%        integer(SID),
1146%%        record(H, 'EventParameter') ->
1147%%     #'SecondRequestedEvent'{pkgdName  = N,
1148%% 			    streamID  = SID,
1149%% 			    evParList = EPL};
1150%% cre_SecondRequestedEvent(N, EA, [H|_] = EPL)
1151%%   when list(N),
1152%%        record(EA, 'SecondRequestedActions'),
1153%%        record(H, 'EventParameter') ->
1154%%     #'SecondRequestedEvent'{pkgdName     = N,
1155%% 			    eventAction  = EA,
1156%% 			    evParList    = EPL}.
1157
1158%% cre_SecondRequestedEvent(N, SID, EA, [H|_] = EPL)
1159%%   when list(N),
1160%%        integer(SID),
1161%%        record(EA, 'SecondRequestedActions'),
1162%%        record(H, 'EventParameter') ->
1163%%     #'SecondRequestedEvent'{pkgdName     = N,
1164%% 			    streamID     = SID,
1165%% 			    eventAction  = EA,
1166%% 			    evParList    = EPL}.
1167
1168%% cre_SecondRequestedActions() ->
1169%%     #'SecondRequestedActions'{}.
1170
1171%% cre_SecondRequestedActions(KA)
1172%%   when ((KA == true) or (KA == false) or (KA == asn1_NOVALUE)) ->
1173%%     #'SecondRequestedActions'{keepActive = KA};
1174%% cre_SecondRequestedActions(SD) when list(SD) ->
1175%%     #'SecondRequestedActions'{signalsDescriptor = SD};
1176%% cre_SecondRequestedActions({Tag, _} = EDM) when atom(Tag) ->
1177%%     #'SecondRequestedActions'{eventDM = EDM}.
1178
1179%% cre_SecondRequestedActions(KA, SD)
1180%%   when ((KA == true) or (KA == false) or (KA == asn1_NOVALUE)) and
1181%%        is_list(SD) ->
1182%%     #'SecondRequestedActions'{keepActive = KA, signalsDescriptor = SD};
1183%% cre_SecondRequestedActions(KA, {Tag, _} = EDM)
1184%%   when ((KA == true) or (KA == false) or (KA == asn1_NOVALUE)) and
1185%%        is_atom(Tag) ->
1186%%     #'SecondRequestedActions'{keepActive = KA, eventDM = EDM}.
1187
1188%% cre_SecondRequestedActions(KA, {Tag, _} = EDM, SD)
1189%%   when ((KA == true) or (KA == false) or (KA == asn1_NOVALUE)) and
1190%%        is_atom(Tag),
1191%%        is_list(SD) ->
1192%%     #'SecondRequestedActions'{keepActive        = KA,
1193%% 			      eventDM           = EDM,
1194%% 			      signalsDescriptor = SD}.
1195
1196cre_EventBufferDescriptor([H|_] = D)
1197  when is_record(H, 'EventSpec') ->
1198    D.
1199
1200cre_EventSpec(N, [H|_] = EPL)
1201  when is_list(N) andalso is_record(H, 'EventParameter') ->
1202    #'EventSpec'{eventName = N, eventParList = EPL}.
1203
1204cre_EventSpec(N, SID, [H|_] = EPL)
1205  when is_list(N) andalso is_integer(SID) andalso is_record(H, 'EventParameter') ->
1206    #'EventSpec'{eventName = N, streamID = SID, eventParList = EPL}.
1207
1208%% cre_SignalsDescriptor(D) when list(D) ->
1209%%     D.
1210
1211%% cre_SignalRequest(S) when record(S, 'Signal') ->
1212%%     {signal, S};
1213%% cre_SignalRequest(S) when record(S, 'SeqSigList') ->
1214%%     {seqSigList, S}.
1215
1216%% cre_SeqSigList(ID, [H|_] = SL)
1217%%   when integer(ID), 0 =< ID, ID =< 65535, record(H, 'Signal') ->
1218%%     #'SeqSigList'{id = ID, signalList = SL}.
1219
1220%% cre_Signal(N) when list(N) ->
1221%%     #'Signal'{signalName = N}.
1222
1223%% cre_Signal(N, [H|_] = SPL) when list(N), record(H, 'SigParameter') ->
1224%%     #'Signal'{signalName = N,
1225%% 	      sigParList = SPL}.
1226
1227%% cre_Signal(N, SID, ST, Dur, NC, KA, [H|_] = SPL)
1228%%   when is_list(N) and
1229%%        (is_integer(SID) or (SID == asn1_NOVALUE)) and
1230%%        ((ST == brief) or (ST == onOff) or (ST == timeOut) or
1231%% 	(ST == asn1_NOVALUE)) and
1232%%        ((is_integer(Dur) and (0 =< Dur) and (Dur =< 65535)) or
1233%% 	(Dur == asm1_NOVALUE)) and
1234%%        is_list(NC) and
1235%%        ((KA == true) or (KA == false) or (KA == asn1_NOVALUE)) and
1236%%        is_record(H, 'SigParameter') ->
1237%%     #'Signal'{signalName       = N,
1238%% 	      streamID         = SID,
1239%% 	      sigType          = ST,
1240%% 	      duration         = Dur,
1241%% 	      notifyCompletion = NC,
1242%% 	      keepActive       = KA,
1243%% 	      sigParList       = SPL}.
1244
1245%% cre_SignalType(brief = ST) ->
1246%%     ST;
1247%% cre_SignalType(onOff = ST) ->
1248%%     ST;
1249%% cre_SignalType(timeOut = ST) ->
1250%%     ST.
1251
1252%% cre_SignalName(N) ->
1253%%     cre_PkgdName(N).
1254
1255%% cre_NotifyCompletion(L) when list(L) ->
1256%%     Vals = [onTimeOut, onInterruptByEvent,
1257%% 	    onInterruptByNewSignalDescr, otherReason],
1258%%     F = fun(E) -> case lists:member(E, Vals) of
1259%% 		      true ->
1260%% 			  ok;
1261%% 		      false ->
1262%% 			  exit({invalid_NotifyCompletion, E})
1263%% 		  end
1264%% 	end,
1265%%     lists:foreach(F, L),
1266%%     L.
1267
1268%% cre_SigParameter(N, V) when list(N), list(V) ->
1269%%     #'SigParameter'{sigParameterName = N, value = V}.
1270
1271%% cre_SigParameter(N, V, relation = Tag, R)
1272%%   when is_list(N) and is_list(V) and is_atom(R) ->
1273%%     EI = {Tag, R},
1274%%     #'SigParameter'{sigParameterName = N, value = V, extraInfo = EI};
1275%% cre_SigParameter(N, V, range = Tag, B)
1276%%   when is_list(N) and is_list(V) and is_atom(B) ->
1277%%     EI = {Tag, B},
1278%%     #'SigParameter'{sigParameterName = N, value = V, extraInfo = EI};
1279%% cre_SigParameter(N, V, sublist = Tag, B)
1280%%   when is_list(N) and is_list(V) and is_atom(B) ->
1281%%     EI = {Tag, B},
1282%%     #'SigParameter'{sigParameterName = N, value = V, extraInfo = EI}.
1283
1284%% cre_RequestID(Val) when 0 =< Val, Val =< 4294967295 ->
1285%%     Val;
1286%% cre_RequestID(Val) ->
1287%%     exit({invalid_RequestID, Val}).
1288
1289%% cre_ModemDescriptor(MTL, MPL) when list(MTL), list(MPL) ->
1290%%     #'ModemDescriptor'{mtl = MTL, mpl = MPL}.
1291
1292%% %% cre_ModemDescriptor(MTL, MPL, NSD)
1293%% %%   when list(MTL), list(MPL), record(NSD, 'NonStandardData') ->
1294%% %%     #'ModemDescriptor'{mtl = MTL, mpl = MPL}.
1295
1296%% cre_ModemType(v18 = MT) ->
1297%%     MT;
1298%% cre_ModemType(v22 = MT) ->
1299%%     MT;
1300%% cre_ModemType(v22bis = MT) ->
1301%%     MT;
1302%% cre_ModemType(v32 = MT) ->
1303%%     MT;
1304%% cre_ModemType(v32bis = MT) ->
1305%%     MT;
1306%% cre_ModemType(v34 = MT) ->
1307%%     MT;
1308%% cre_ModemType(v90 = MT) ->
1309%%     MT;
1310%% cre_ModemType(v91 = MT) ->
1311%%     MT;
1312%% cre_ModemType(synchISDN = MT) ->
1313%%     MT.
1314
1315%% cre_DigitMapDescriptor() ->
1316%%     #'DigitMapDescriptor'{}.
1317
1318%% cre_DigitMapDescriptor(N) when list(N) ->
1319%%     #'DigitMapDescriptor'{digitMapName = N};
1320%% cre_DigitMapDescriptor(V) when record(V, 'DigitMapValue') ->
1321%%     #'DigitMapDescriptor'{digitMapValue = V}.
1322
1323%% cre_DigitMapDescriptor(N, V) when list(N), record(V, 'DigitMapValue') ->
1324%%     #'DigitMapDescriptor'{digitMapName = N, digitMapValue = V}.
1325
1326%% cre_DigitMapName(N) ->
1327%%     cre_Name(N).
1328
1329%% cre_DigitMapValue(DMB) when list(DMB) ->
1330%%     #'DigitMapValue'{digitMapBody = DMB}.
1331
1332%% cre_DigitMapValue(Start, Short, Long, DMB) ->
1333%%     cre_DigitMapValue(Start, Short, Long, DMB, asn1_NOVALUE).
1334
1335%% cre_DigitMapValue(Start, Short, Long, DMB, Dur)
1336%%   when ((is_integer(Start) and (0 =< Start) and (Start =< 99)) or
1337%% 	(Start == asn1_NOVALUE)) and
1338%%        ((is_integer(Short) and (0 =< Short) and (Short =< 99)) or
1339%% 	(Short == asn1_NOVALUE)) and
1340%%        ((is_integer(Long) and (0 =< Long) and (Long =< 99)) or
1341%% 	(Long == asn1_NOVALUE)) and
1342%%        is_list(DMB) and
1343%%        ((is_integer(Dur) and (0 =< Dur) and (Dur =< 99)) or
1344%% 	(Dur == asn1_NOVALUE)) ->
1345%%     #'DigitMapValue'{startTimer    = Start,
1346%% 		     shortTimer    = Short,
1347%% 		     longTimer     = Long,
1348%% 		     digitMapBody  = DMB,
1349%% 		     durationTimer = Dur}.
1350
1351%% cre_ServiceChangeParm(M, R) when atom(M), list(R) ->
1352%%     #'ServiceChangeParm'{serviceChangeMethod = M,
1353%% 			 serviceChangeReason = R}.
1354
1355%% cre_ServiceChangeParm(M, Addr, Prof, Reason) ->
1356%%     cre_ServiceChangeParm(M, Addr, asn1_NOVALUE, Prof, Reason, asn1_NOVALUE,
1357%% 			  asn1_NOVALUE, asn1_NOVALUE, asn1_NOVALUE).
1358
1359%% %% Addr = asn1_NOVALUE | {AddrTag, AddrVal}
1360%% cre_ServiceChangeParm(M, Addr, Ver, Prof, R, D, Mid, TS, I)
1361%%   when is_atom(M) and
1362%%        ((is_integer(Ver) and (0 =< Ver) and (Ver =< 99)) or
1363%% 	(Ver == asn1_NOVALUE)) and
1364%%        (is_record(Prof, 'ServiceChangeProfile') or (Prof == asn1_NOVALUE)) and
1365%%        is_list(R) and
1366%%        ((is_integer(D) and (0 =< D) and (D =< 4294967295)) or
1367%% 	(D == asn1_NOVALUE)) and
1368%%        (is_record(TS, 'TimeNotation') or (TS == asn1_NOVALUE)) and
1369%%        (is_record(I, 'AuditDescriptor') or (I == asn1_NOVALUE)) ->
1370%%     F = fun(A) ->
1371%% 		(A == asn1_NOVALUE) orelse
1372%% 				      (is_tuple(A)
1373%% 				       andalso is_atom(element(1, A)))
1374%% 	end,
1375%%     case (F(Addr) andalso F(Mid)) of
1376%% 	true ->
1377%% 	    #'ServiceChangeParm'{serviceChangeMethod  = M,
1378%% 				 serviceChangeAddress = Addr,
1379%% 				 serviceChangeVersion = Ver,
1380%% 				 serviceChangeProfile = Prof,
1381%% 				 serviceChangeReason  = R,
1382%% 				 serviceChangeDelay   = D,
1383%% 				 serviceChangeMgcId   = Mid,
1384%% 				 timeStamp            = TS,
1385%% 				 serviceChangeInfo    = I};
1386%% 	_ ->
1387%% 	    exit({invalid_ServiceChangeParm_args, {Addr, Mid}})
1388%%     end.
1389
1390%% cre_ServiceChangeAddress(portNumber = Tag, P)
1391%%   when integer(P), 0 =< P, P =< 65535 ->
1392%%     {Tag, P};
1393%% cre_ServiceChangeAddress(ip4Address = Tag, A) when record(A, 'IP4Address') ->
1394%%     {Tag, A};
1395%% cre_ServiceChangeAddress(ip6Address = Tag, A) when record(A, 'IP6Address') ->
1396%%     {Tag, A};
1397%% cre_ServiceChangeAddress(domainName = Tag, N) when record(N, 'DomainName') ->
1398%%     {Tag, N};
1399%% cre_ServiceChangeAddress(deviceName = Tag, N) when list(N) ->
1400%%     {Tag, N};
1401%% cre_ServiceChangeAddress(mtpAddress = Tag, A) when list(A) ->
1402%%     {Tag, A}.
1403
1404%% cre_ServiceChangeResParm() ->
1405%%     #'ServiceChangeResParm'{}.
1406%% cre_ServiceChangeResParm(Addr, Prof) ->
1407%%     cre_ServiceChangeResParm(asn1_NOVALUE, Addr, asn1_NOVALUE,
1408%% 			     Prof, asn1_NOVALUE).
1409%% cre_ServiceChangeResParm(Mid, Addr, Ver, Prof, TS)
1410%%   when ((is_integer(Ver) and (0 =< Ver) and (Ver =< 99)) or
1411%% 	(Ver == asn1_NOVALUE)) and
1412%%        (is_record(Prof, 'ServiceChangeProfile') or (Prof == asn1_NOVALUE)) and
1413%%        (is_record(TS, 'TimeNotation') or (TS == asn1_NOVALUE)) ->
1414%%     F = fun(A) ->
1415%% 		(A == asn1_NOVALUE) orelse
1416%% 				      (is_tuple(A)
1417%% 				       andalso is_atom(element(1, A)))
1418%% 	end,
1419%%     case (F(Addr) andalso F(Mid)) of
1420%% 	true ->
1421%% 	    #'ServiceChangeResParm'{serviceChangeMgcId   = Mid,
1422%% 				    serviceChangeAddress = Addr,
1423%% 				    serviceChangeVersion = Ver,
1424%% 				    serviceChangeProfile = Prof,
1425%% 				    timeStamp            = TS};
1426%% 	_ ->
1427%% 	    exit({invalid_ServiceChangeResParm_args, {Addr, Mid}})
1428%%     end.
1429
1430%% cre_ServiceChangeMethod(failover = M) ->
1431%%     M;
1432%% cre_ServiceChangeMethod(forced = M) ->
1433%%     M;
1434%% cre_ServiceChangeMethod(graceful = M) ->
1435%%     M;
1436%% cre_ServiceChangeMethod(restart = M) ->
1437%%     M;
1438%% cre_ServiceChangeMethod(disconnected = M) ->
1439%%     M;
1440%% cre_ServiceChangeMethod(handOff = M) ->
1441%%     M.
1442
1443%% %% The version field is added to make it look more like ABNF
1444%% cre_ServiceChangeProfile(N) ->
1445%%     cre_ServiceChangeProfile(N, 1).
1446
1447%% cre_ServiceChangeProfile(N, V)
1448%%   when is_list(N) and is_integer(V) and (0 =< V) and (V =< 99) ->
1449%%     #'ServiceChangeProfile'{profileName = N, version = V}.
1450
1451%% cre_PackagesDescriptor([H|_] = D) when record(H, 'PackagesItem') ->
1452%%     D.
1453
1454%% cre_PackagesItem(N, Ver) when list(N), integer(Ver), 0 =< Ver, Ver =< 99 ->
1455%%     #'PackagesItem'{packageName    = N,
1456%% 		    packageVersion = Ver}.
1457
1458%% cre_StatisticsDescriptor([H|_] = D) when record(H, 'StatisticsParameter') ->
1459%%     D.
1460
1461%% cre_StatisticsParameter(N) when list(N) ->
1462%%     #'StatisticsParameter'{statName = N}.
1463
1464%% cre_StatisticsParameter(N, V) when list(N), list(V) ->
1465%%     #'StatisticsParameter'{statName = N, statValue = V}.
1466
1467%% %% cre_NonStandardData({Tag, _} = Id, Data) when atom(Tag), list(Data) ->
1468%% %%     #'NonStandardData'{nonStandardIdentifier = Id, data = Data}.
1469
1470%% %% cre_NonStandardIdentifier(H221) when record(H221, 'H221NonStandard') ->
1471%% %%     {h221NonStandard, H221};
1472%% %% cre_NonStandardIdentifier(Obj) when tuple(Obj) ->
1473%% %%     {object, Obj};
1474%% %% cre_NonStandardIdentifier(Exp) when list(Exp), length(Exp) == 8 ->
1475%% %%     {experimental, Exp}.
1476
1477%% %% cre_H221NonStandard(CC1, CC2, Ext, MC)
1478%% %%   when (is_integer(CC1) and (0 =< CC1) and (CC1 =< 255)) and
1479%% %%        (is_integer(CC2) and (0 =< CC2) and (CC2 =< 255)) and
1480%% %%        (is_integer(Ext) and (0 =< Ext) and (Ext =< 255)) and
1481%% %%        (is_integer(MC)  and (0 =< MC)  and (MC =< 255)) ->
1482%% %%     #'H221NonStandard'{t35CountryCode1  = CC1,
1483%% %% 		       t35CountryCode2  = CC2,
1484%% %% 		       t35Extension     = Ext,
1485%% %% 		       manufacturerCode = MC}.
1486
1487%% cre_TimeNotation(D, T)
1488%%   when list(D), length(D) == 8, list(T), length(T) == 8 ->
1489%%     #'TimeNotation'{date = D, time = T}.
1490
1491%% cre_Value([H|_] = V) when list(H) ->
1492%%     V.
1493
1494cre_BOOLEAN(true = B) ->
1495    B;
1496cre_BOOLEAN(false = B) ->
1497    B.
1498
1499
1500%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1501
1502%% %% -- MegacoMessage --
1503
1504%% is_MegacoMessage(#'MegacoMessage'{authHeader = Auth,
1505%% 				  mess       = Mess}) ->
1506%%     is_opt_AuthenticationHeader(Auth) andalso is_Message(Mess);
1507%% is_MegacoMessage(_) ->
1508%%     false.
1509
1510
1511%% chk_MegacoMessage(M, M) ->
1512%%     chk_type(fun is_MegacoMessage/1, 'MegacoMessage', M);
1513%% chk_MegacoMessage(#'MegacoMessage'{authHeader = Auth1,
1514%% 				   mess       = Mess1},
1515%% 		  #'MegacoMessage'{authHeader = Auth2,
1516%% 				   mess       = Mess2}) ->
1517%%     chk_opt_AuthenticationHeader(Auth1,Auth2),
1518%%     chk_Message(Mess1,Mess2),
1519%%     ok;
1520%% chk_MegacoMessage(M1, M2) ->
1521%%     wrong_type('MegacoMessage', M1, M2).
1522
1523
1524%% %% -- AuthenticationHeader --
1525
1526%% is_opt_AuthenticationHeader(AH) ->
1527%%     is_OPTIONAL(fun is_AuthenticationHeader/1, AH).
1528
1529%% is_AuthenticationHeader(#'AuthenticationHeader'{secParmIndex = SPI,
1530%% 						seqNum       = SN,
1531%% 						ad           = AD}) ->
1532%%     is_SecurityParmIndex(SPI) andalso
1533%% 	is_SequenceNum(SN) andalso
1534%% 	is_AuthData(AD);
1535%% is_AuthenticationHeader(_) ->
1536%%     false.
1537
1538%% %% This stuff is not really used, so make it simple...
1539%% chk_opt_AuthenticationHeader(A1, A2) ->
1540%%     chk_OPTIONAL('AuthenticationHeader', A1, A2,
1541%% 		 fun is_AuthenticationHeader/1,
1542%% 		 fun chk_AuthenticationHeader/2).
1543
1544%% chk_AuthenticationHeader(A, A) ->
1545%%     chk_type(fun is_AuthenticationHeader/1, 'AuthenticationHeader', A);
1546%% chk_AuthenticationHeader(A1, A2) ->
1547%%     case (is_AuthenticationHeader(A1) andalso is_AuthenticationHeader(A2)) of
1548%% 	true ->
1549%% 	    not_equal('AuthenticationHeader', A1, A2);
1550%% 	false ->
1551%% 	    wrong_type('AuthenticationHeader', A1, A2)
1552%%     end.
1553
1554
1555%% %% -- SecurityParmIndex --
1556
1557%% is_SecurityParmIndex(V) -> is_OCTET_STRING(V, {exact, 4}).
1558
1559
1560%% %% -- SequenceNum --
1561
1562%% is_SequenceNum(V) -> is_OCTET_STRING(V, {exact, 4}).
1563
1564
1565%% %% -- AuthData --
1566
1567%% is_AuthData(V) -> is_OCTET_STRING(V, {range, 12, 32}).
1568
1569
1570%% %% -- Message --
1571
1572%% is_Message(#'Message'{version     = V,
1573%% 		      mId         = MID,
1574%% 		      messageBody = Body}) ->
1575%%     is_INTEGER(V, {range, 0, 99}) andalso
1576%% 	is_MId(MID) andalso
1577%% 	is_Message_messageBody(Body);
1578%% is_Message(_) ->
1579%%     false.
1580
1581%% chk_Message(M,M) when record(M,'Message') ->
1582%%     ok;
1583%% chk_Message(#'Message'{version     = V1,
1584%% 		       mId         = MID1,
1585%% 		       messageBody = Body1},
1586%% 	    #'Message'{version     = V2,
1587%% 		       mId         = MID2,
1588%% 		       messageBody = Body2}) ->
1589%%     validate(fun() -> chk_INTEGER(V1, V2, {range, 0, 99}) end, 'Message'),
1590%%     validate(fun() -> chk_MId(MID1, MID2) end, 'Message'),
1591%%     chk_Message_messageBody(Body1, Body2),
1592%%     ok;
1593%% chk_Message(M1, M2) ->
1594%%     wrong_type('Message', M1, M2).
1595
1596
1597%% is_Message_messageBody({Tag, Val}) ->
1598%%     is_Message_messageBody_tag(Tag) andalso
1599%% 	is_Message_messageBody_val(Tag, Val);
1600%% is_Message_messageBody(_) ->
1601%%     false.
1602
1603%% is_Message_messageBody_tag(Tag) ->
1604%%     Tags = [messageError, transactions],
1605%%     lists:member(Tag, Tags).
1606
1607%% is_Message_messageBody_val(messageError, Val) ->
1608%%     is_ErrorDescriptor(Val);
1609%% is_Message_messageBody_val(transactions, Val) ->
1610%%     is_Message_messageBody_transactions(Val).
1611
1612%% is_Message_messageBody_transactions([]) ->
1613%%     true;
1614%% is_Message_messageBody_transactions([H|T]) ->
1615%%     is_Transaction(H) andalso is_Message_messageBody_transactions(T);
1616%% is_Message_messageBody_transactions(_) ->
1617%%     false.
1618
1619%% chk_Message_messageBody(B, B) ->
1620%%     chk_type(fun is_Message_messageBody/1, 'Message_messageBody', B);
1621%% chk_Message_messageBody({Tag, Val1} = B1, {Tag, Val2} = B2) ->
1622%%     case (is_Message_messageBody_tag(Tag) andalso
1623%% 	  is_Message_messageBody_val(Tag, Val1) andalso
1624%% 	  is_Message_messageBody_val(Tag, Val2)) of
1625%% 	true ->
1626%% 	    chk_Message_messageBody_val(Tag, Val1, Val2);
1627%% 	false ->
1628%% 	    wrong_type('Message_messageBody', B1, B2)
1629%%     end;
1630%% chk_Message_messageBody({Tag1, Val1} = B1, {Tag2, Val2} = B2) ->
1631%%     case ((is_Message_messageBody_tag(Tag1) andalso
1632%% 	   is_Message_messageBody_val(Tag1, Val1)) andalso
1633%% 	  (is_Message_messageBody_tag(Tag2) andalso
1634%% 	   is_Message_messageBody_val(Tag2, Val2))) of
1635%% 	true ->
1636%% 	    not_equal('Message_messageBody', B1, B2);
1637%% 	false ->
1638%% 	    wrong_type('Message_messageBody', B1, B2)
1639%%     end;
1640%% chk_Message_messageBody(B1, B2) ->
1641%%     wrong_type('Message_messageBody', B1, B2).
1642
1643%% chk_Message_messageBody_val(messageError, Val1, Val2) ->
1644%%     validate(fun() -> chk_ErrorDescriptor(Val1, Val2) end,
1645%% 	     'Message_messageBody');
1646%% chk_Message_messageBody_val(transactions, Val1, Val2) ->
1647%%     chk_Message_messageBody_transactions(Val1, Val2).
1648
1649%% chk_Message_messageBody_transactions([], []) ->
1650%%     ok;
1651%% chk_Message_messageBody_transactions([] = T1, T2) ->
1652%%     not_equal('Message_messageBody_transactions', T1, T2);
1653%% chk_Message_messageBody_transactions(T1, [] = T2) ->
1654%%     not_equal('Message_messageBody_transactions', T1, T2);
1655%% chk_Message_messageBody_transactions([H|T1], [H|T2]) ->
1656%%     case is_Transaction(H) of
1657%% 	true ->
1658%% 	    chk_Message_messageBody_transactions(T1, T2);
1659%% 	false ->
1660%% 	    wrong_type('Message_messageBody_transactions_val', H)
1661%%     end;
1662%% chk_Message_messageBody_transactions([H1|T1], [H2|T2]) ->
1663%%     validate(fun() -> chk_Transaction(H1, H2) end,
1664%% 	     'Message_messageBody_transactions_val'),
1665%%     chk_Message_messageBody_transactions(T1, T2);
1666%% chk_Message_messageBody_transactions(T1, T2) ->
1667%%     wrong_type('Message_messageBody_transactions', T1, T2).
1668
1669
1670%% %% -- MId --
1671
1672%% is_opt_MId(M) ->
1673%%     is_OPTIONAL(fun is_MId/1, M).
1674
1675%% is_MId({Tag, Val}) ->
1676%%     is_MId_tag(Tag) andalso is_MId_val(Tag, Val);
1677%% is_MId(_) ->
1678%%     false.
1679
1680%% is_MId_tag(Tag) ->
1681%%     Tags = [ip4Address, ip6Address, domainName, deviceName, mtpAddress],
1682%%     lists:member(Tag, Tags).
1683
1684%% is_MId_val(ip4Address, Val) -> is_IP4Address(Val);
1685%% is_MId_val(ip6Address, Val) -> is_IP6Address(Val);
1686%% is_MId_val(domainName, Val) -> is_DomainName(Val);
1687%% is_MId_val(deviceName, Val) -> is_PathName(Val);
1688%% is_MId_val(mtpAddress, Val) -> is_OCTET_STRING(Val, {range, 2, 4}).
1689
1690%% chk_opt_MId(M1, M2) ->
1691%%     chk_OPTIONAL('MId', M1, M2, fun is_MId/1, fun chk_MId/2).
1692
1693%% chk_MId(M, M) ->
1694%%     chk_type(fun is_MId/1, 'MId', M);
1695%% chk_MId({Tag, Val1} = M1, {Tag, Val2} = M2) ->
1696%%     case (is_MId_tag(Tag) andalso
1697%% 	  is_MId_val(Tag, Val1) andalso
1698%% 	  is_MId_val(Tag, Val2)) of
1699%% 	true ->
1700%% 	    chk_MId_val(Tag, Val1, Val2);
1701%% 	false ->
1702%% 	    wrong_type('MId', M1, M2)
1703%%     end;
1704%% chk_MId({Tag1, Val1} = M1, {Tag2, Val2} = M2) ->
1705%%     case ((is_MId_tag(Tag1) andalso
1706%% 	   is_MId_val(Tag1, Val1)) andalso
1707%% 	  (is_MId_tag(Tag2) andalso
1708%% 	   is_MId_val(Tag2, Val2))) of
1709%% 	true ->
1710%% 	    not_equal('MId', M1, M2);
1711%% 	false ->
1712%% 	    wrong_type('MId', M1, M2)
1713%%     end;
1714%% chk_MId(M1, M2) ->
1715%%     wrong_type('MId', M1, M2).
1716
1717%% chk_MId_val(ip4Address, M1, M2) -> chk_IP4Address(M1, M2);
1718%% chk_MId_val(ip6Address, M1, M2) -> chk_IP6Address(M1, M2);
1719%% chk_MId_val(domainName, M1, M2) -> chk_DomainName(M1, M2);
1720%% chk_MId_val(deviceName, M1, M2) -> chk_PathName(M1,   M2);
1721%% chk_MId_val(mtpAddress, M1, M2) -> chk_OCTET_STRING(M1, M2, {range, 2, 4}).
1722
1723
1724%% %% -- DomainName --
1725
1726%% is_DomainName(#'DomainName'{name = N, portNumber = PN}) ->
1727%%     is_IA5String(N) andalso is_opt_INTEGER(PN, {range, 0, 65535});
1728%% is_DomainName(_) ->
1729%%     false.
1730
1731%% chk_DomainName(N, N) ->
1732%%     ok;
1733%% chk_DomainName(N1, N2) ->
1734%%     not_equal('DomainName', N1, N2).
1735
1736
1737%% %% -- IP4Address --
1738
1739%% is_IP4Address(#'IP4Address'{address = A, portNumber = PN}) ->
1740%%     is_OCTET_STRING(A, {exact, 4}) andalso
1741%% 	is_opt_INTEGER(PN, {range, 0, 65535});
1742%% is_IP4Address(_) ->
1743%%     false.
1744
1745%% chk_IP4Address(A, A) ->
1746%%     ok;
1747%% chk_IP4Address(A1, A2) ->
1748%%     not_equal('IP4Address', A1, A2).
1749
1750
1751%% %% -- IP6Address --
1752
1753%% is_IP6Address(#'IP6Address'{address = A, portNumber = PN}) ->
1754%%     is_OCTET_STRING(A, {exact, 16}) andalso
1755%% 	is_opt_INTEGER(PN, {range, 0, 65535});
1756%% is_IP6Address(_) ->
1757%%     false.
1758
1759%% chk_IP6Address(A, A) ->
1760%%     ok;
1761%% chk_IP6Address(A1, A2) ->
1762%%     not_equal('IP6Address', A1, A2).
1763
1764
1765%% %% -- PathName --
1766
1767%% is_PathName(N) -> is_IA5String(N, {range, 1, 64}).
1768
1769%% chk_PathName(N, N) ->
1770%%     ok;
1771%% chk_PathName(N1, N2) ->
1772%%     not_equal('PathName', N1, N2).
1773
1774
1775%% %% -- Transaction --
1776
1777%% is_Transaction({Tag, Val}) ->
1778%%     is_Transaction_tag(Tag) andalso is_Transaction_val(Tag, Val);
1779%% is_Transaction(_) ->
1780%%     false.
1781
1782%% is_Transaction_tag(Tag) ->
1783%%     Tags = [transactionRequest,
1784%% 	    transactionPending,
1785%% 	    transactionReply,
1786%% 	    transactionResponseAck],
1787%%     lists:member(Tag, Tags).
1788
1789%% is_Transaction_val(transactionRequest, V)     -> is_TransactionRequest(V);
1790%% is_Transaction_val(transactionPending, V)     -> is_TransactionPending(V);
1791%% is_Transaction_val(transactionReply, V)       -> is_TransactionReply(V);
1792%% is_Transaction_val(transactionResponseAck, V) -> is_TransactionResponseAck(V).
1793
1794
1795%% chk_Transaction({Tag, Val} = Trans, {Tag, Val}) ->
1796%%     case (is_Transaction_tag(Tag) andalso is_Transaction_val(Tag, Val)) of
1797%% 	true ->
1798%% 	    ok;
1799%% 	false ->
1800%% 	    wrong_type('Transaction', Trans, Trans)
1801%%     end;
1802%% chk_Transaction({Tag, Val1} = Trans1, {Tag, Val2} = Trans2) ->
1803%%     case (is_Transaction_tag(Tag) and
1804%% 	  is_Transaction_val(Tag, Val1) and
1805%% 	  is_Transaction_val(Tag, Val2)) of
1806%% 	true ->
1807%% 	    chk_Transaction_val(Tag, Val1, Val2);
1808%% 	false ->
1809%% 	    wrong_type('Transaction', Trans1, Trans2)
1810%%     end;
1811%% chk_Transaction({Tag1, Val1} = Trans1, {Tag2, Val2} = Trans2) ->
1812%%     case ((is_Transaction_tag(Tag1) andalso
1813%% 	   is_Transaction_val(Tag1, Val1)) andalso
1814%% 	  (is_Transaction_tag(Tag2) andalso
1815%% 	   is_Transaction_val(Tag2, Val2))) of
1816%% 	true ->
1817%% 	    not_equal('Transaction', Trans1, Trans2);
1818%% 	false ->
1819%% 	    wrong_type('Transaction', Trans1, Trans2)
1820%%     end;
1821%% chk_Transaction(Trans1, Trans2) ->
1822%%     wrong_type('Transaction', Trans1, Trans2).
1823
1824%% chk_Transaction_val(transactionRequest, T1, T2) ->
1825%%     chk_TransactionRequest(T1, T2);
1826%% chk_Transaction_val(transactionPending, T1, T2) ->
1827%%     chk_TransactionPending(T1, T2);
1828%% chk_Transaction_val(transactionReply, T1, T2) ->
1829%%     chk_TransactionReply(T1,T2);
1830%% chk_Transaction_val(transactionResponseAck, T1, T2) ->
1831%%     chk_TransactionResponseAck(T1, T2).
1832
1833
1834%% %% -- TransactionId --
1835
1836%% is_opt_TransactionId(TID) ->
1837%%     is_OPTIONAL(fun is_TransactionId/1, TID).
1838
1839%% is_TransactionId(TID) -> is_INTEGER(TID, {range, 0, 4294967295}).
1840
1841%% chk_opt_TransactionId(TID1, TID2) ->
1842%%     chk_OPTIONAL('TransactionId', TID1, TID2,
1843%% 		 fun is_TransactionId/1, fun chk_TransactionId/2).
1844
1845%% chk_TransactionId(TID, TID) ->
1846%%     chk_type(fun is_TransactionId/1, 'TransactionId', TID);
1847%% chk_TransactionId(TID1, TID2) ->
1848%%     case (is_TransactionId(TID1) andalso is_TransactionId(TID2)) of
1849%% 	true ->
1850%% 	    not_equal('TransactionId', TID1, TID2);
1851%% 	false ->
1852%% 	    wrong_type('TransactionId', TID1, TID2)
1853%%     end.
1854
1855
1856%% %% -- TransactionRequest --
1857
1858%% is_TransactionRequest(#'TransactionRequest'{transactionId = TID,
1859%% 					    actions       = Acts}) ->
1860%%     is_TransactionId(TID) andalso is_TransactionRequest_actions(Acts);
1861%% is_TransactionRequest(_) ->
1862%%     false.
1863
1864%% chk_TransactionRequest(T, T) ->
1865%%     chk_type(fun is_TransactionRequest/1, 'TransactionRequest', T);
1866%% chk_TransactionRequest(#'TransactionRequest'{transactionId = TID1,
1867%% 					     actions       = Acts1},
1868%% 		       #'TransactionRequest'{transactionId = TID2,
1869%% 					     actions       = Acts2}) ->
1870%%     validate(fun() -> chk_TransactionId(TID1, TID2) end, 'TransactionRequest'),
1871%%     chk_TransactionRequest_actions(Acts1, Acts2),
1872%%     ok;
1873%% chk_TransactionRequest(T1, T2) ->
1874%%     wrong_type('TransactionRequest', T1, T2).
1875
1876%% is_TransactionRequest_actions([]) ->
1877%%     true;
1878%% is_TransactionRequest_actions([H|T]) ->
1879%%     is_ActionRequest(H) andalso is_TransactionRequest_actions(T);
1880%% is_TransactionRequest_actions(_) ->
1881%%     false.
1882
1883%% chk_TransactionRequest_actions([], []) ->
1884%%     ok;
1885%% chk_TransactionRequest_actions([] = Acts1, Acts2) ->
1886%%     not_equal('TransactionRequest_actions', Acts1, Acts2);
1887%% chk_TransactionRequest_actions(Acts1, [] = Acts2) ->
1888%%     not_equal('TransactionRequest_actions', Acts1, Acts2);
1889%% chk_TransactionRequest_actions([H|T1], [H|T2]) ->
1890%%     case is_ActionRequest(H) of
1891%% 	true ->
1892%% 	    chk_TransactionRequest_actions(T1, T2);
1893%% 	false ->
1894%% 	    wrong_type('TransactionRequest_actions_val', H)
1895%%     end;
1896%% chk_TransactionRequest_actions([H1|T1], [H2|T2]) ->
1897%%     validate(fun() -> chk_ActionRequest(H1, H2) end,
1898%% 	     'TransactionRequest_actions_val'),
1899%%     chk_TransactionRequest_actions(T1, T2);
1900%% chk_TransactionRequest_actions(Acts1, Acts2) ->
1901%%     wrong_type('TransactionRequest_actions', Acts1, Acts2).
1902
1903
1904%% %% -- TransactionPending --
1905
1906%% is_TransactionPending(#'TransactionPending'{transactionId = TID}) ->
1907%%     is_TransactionId(TID);
1908%% is_TransactionPending(_) ->
1909%%     false.
1910
1911%% chk_TransactionPending(T, T) ->
1912%%     chk_type(fun is_TransactionPending/1, 'TransactionPending', T);
1913%% chk_TransactionPending(#'TransactionPending'{transactionId = TID1},
1914%% 		       #'TransactionPending'{transactionId = TID2}) ->
1915%%     validate(fun() -> chk_TransactionId(TID1, TID2) end, 'TransactionPending'),
1916%%     ok;
1917%% chk_TransactionPending(T1, T2) ->
1918%%     wrong_type('TransactionPending', T1, T2).
1919
1920
1921%% %% -- TransactionReply --
1922
1923%% is_TransactionReply(#'TransactionReply'{transactionId     = TID,
1924%% 					immAckRequired    = IAR,
1925%% 					transactionResult = TR}) ->
1926%%     is_TransactionId(TID) andalso
1927%% 	is_opt_NULL(IAR) andalso
1928%% 	is_TransactionReply_transactionResult(TR);
1929%% is_TransactionReply(_) ->
1930%%     false.
1931
1932%% chk_TransactionReply(T, T) ->
1933%%     chk_type(fun is_TransactionReply/1, 'TransactionReply', T);
1934%% chk_TransactionReply(#'TransactionReply'{transactionId     = TID1,
1935%% 					 immAckRequired    = IAR1,
1936%% 					 transactionResult = TR1},
1937%% 		     #'TransactionReply'{transactionId     = TID2,
1938%% 					 immAckRequired    = IAR2,
1939%% 					 transactionResult = TR2}) ->
1940%%     validate(fun() -> chk_TransactionId(TID1, TID2) end, 'TransactionReply'),
1941%%     validate(fun() -> chk_opt_NULL(IAR1, IAR2) end, 'TransactionReply'),
1942%%     chk_TransactionReply_transactionResult(TR1, TR2),
1943%%     ok;
1944%% chk_TransactionReply(T1, T2) ->
1945%%     wrong_type('TransactionReply', T1, T2).
1946
1947%% is_TransactionReply_transactionResult({Tag, Val}) ->
1948%%     is_TransactionReply_transactionResult_tag(Tag) andalso
1949%% 	is_TransactionReply_transactionResult_val(Tag, Val);
1950%% is_TransactionReply_transactionResult(_) ->
1951%%     false.
1952
1953%% is_TransactionReply_transactionResult_tag(T) ->
1954%%     lists:member(T, [transactionError, actionReplies]).
1955
1956%% is_TransactionReply_transactionResult_val(transactionError, V) ->
1957%%     is_ErrorDescriptor(V);
1958%% is_TransactionReply_transactionResult_val(actionReplies, V) ->
1959%%     is_TransactionReply_actionReplies(V).
1960
1961%% chk_TransactionReply_transactionResult(Res, Res) ->
1962%%     chk_type(fun is_TransactionReply_transactionResult/1,
1963%% 	     'TransactionReply_transactionResult', Res);
1964%% chk_TransactionReply_transactionResult({Tag, Val1} = Res1,
1965%% 				       {Tag, Val2} = Res2) ->
1966%%     case (is_TransactionReply_transactionResult_tag(Tag) and
1967%% 	  is_TransactionReply_transactionResult_val(Tag, Val1) and
1968%% 	  is_TransactionReply_transactionResult_val(Tag, Val2)) of
1969%% 	true ->
1970%% 	    chk_TransactionReply_transactionResult_val(Tag, Val1, Val2);
1971%% 	false ->
1972%% 	    wrong_type('TransactionReply_transactionResult', Res1, Res2)
1973%%     end;
1974%% chk_TransactionReply_transactionResult({Tag1, Val1} = Res1,
1975%% 				       {Tag2, Val2} = Res2) ->
1976%%     case ((is_TransactionReply_transactionResult_tag(Tag1) and
1977%% 	   is_TransactionReply_transactionResult_val(Tag1, Val1)) and
1978%% 	  (is_TransactionReply_transactionResult_tag(Tag2) and
1979%% 	   is_TransactionReply_transactionResult_val(Tag2, Val2))) of
1980%% 	true ->
1981%% 	    not_equal('TransactionReply_transactionResult', Res1, Res2);
1982%% 	false ->
1983%% 	    wrong_type('TransactionReply_transactionResult', Res1, Res2)
1984%%     end;
1985%% chk_TransactionReply_transactionResult(Res1, Res2) ->
1986%%     wrong_type('TransactionReply_transactionResult', Res1, Res2).
1987
1988%% chk_TransactionReply_transactionResult_val(transactionError, E1, E2) ->
1989%%     validate(fun() -> chk_ErrorDescriptor(E1, E2) end,
1990%% 	     'TransactionReply_transactionResult');
1991%% chk_TransactionReply_transactionResult_val(actionReplies, R1, R2) ->
1992%%     validate(fun() -> chk_TransactionReply_actionReplies(R1, R2) end,
1993%% 	     'TransactionReply_transactionResult').
1994
1995%% is_TransactionReply_actionReplies([]) ->
1996%%     true;
1997%% is_TransactionReply_actionReplies([H|T]) ->
1998%%     is_ActionReply(H) andalso is_TransactionReply_actionReplies(T);
1999%% is_TransactionReply_actionReplies(_) ->
2000%%     false.
2001
2002%% chk_TransactionReply_actionReplies([], []) ->
2003%%     ok;
2004%% chk_TransactionReply_actionReplies([] = AR1, AR2) ->
2005%%     not_equal('TransactionReply_actionReplies', AR1, AR2);
2006%% chk_TransactionReply_actionReplies(AR1, [] = AR2) ->
2007%%     not_equal('TransactionReply_actionReplies', AR1, AR2);
2008%% chk_TransactionReply_actionReplies([H|T1], [H|T2]) ->
2009%%     case is_ActionReply(H) of
2010%% 	true ->
2011%% 	    chk_TransactionReply_actionReplies(T1, T2);
2012%% 	false ->
2013%% 	    wrong_type('TransactionReply_actionReplies_val', H)
2014%%     end;
2015%% chk_TransactionReply_actionReplies([H1|T1], [H2|T2]) ->
2016%%     validate(fun() -> chk_ActionReply(H1, H2) end,
2017%% 	     'TransactionReply_actionReplies_val'),
2018%%     chk_TransactionReply_actionReplies(T1, T2);
2019%% chk_TransactionReply_actionReplies(AR1, AR2) ->
2020%%     wrong_type('TransactionReply_actionReplies', AR1, AR2).
2021
2022
2023%% %% -- TransactionResponseAck --
2024
2025%% is_TransactionResponseAck([]) ->
2026%%     true;
2027%% is_TransactionResponseAck([H|T]) ->
2028%%     is_TransactionAck(H) andalso is_TransactionResponseAck(T);
2029%% is_TransactionResponseAck(_) ->
2030%%     false.
2031
2032%% chk_TransactionResponseAck([], []) ->
2033%%     ok;
2034%% chk_TransactionResponseAck([] = AR1, AR2) ->
2035%%     not_equal('TransactionResponseAck', AR1, AR2);
2036%% chk_TransactionResponseAck(AR1, [] = AR2) ->
2037%%     not_equal('TransactionResponseAck', AR1, AR2);
2038%% chk_TransactionResponseAck([H|T1], [H|T2]) ->
2039%%     case is_TransactionAck(H) of
2040%% 	true ->
2041%% 	    chk_TransactionResponseAck(T1, T2);
2042%% 	false ->
2043%% 	    wrong_type('TransactionResponseAck_val', H)
2044%%     end;
2045%% chk_TransactionResponseAck([H1|T1], [H2|T2]) ->
2046%%     validate(fun() -> chk_TransactionAck(H1, H2) end,
2047%% 	     'TransactionResponseAck'),
2048%%     chk_TransactionResponseAck(T1, T2);
2049%% chk_TransactionResponseAck(AR1, AR2) ->
2050%%     wrong_type('TransactionResponseAck', AR1, AR2).
2051
2052
2053%% %% -- TransactionAck --
2054
2055%% is_TransactionAck(#'TransactionAck'{firstAck = F,
2056%% 				    lastAck  = L}) ->
2057%%     is_TransactionId(F) andalso is_opt_TransactionId(L);
2058%% is_TransactionAck(_) ->
2059%%     false.
2060
2061%% chk_TransactionAck(T, T) ->
2062%%     chk_type(fun is_TransactionAck/1, 'TransactionAck', T);
2063%% chk_TransactionAck(#'TransactionAck'{firstAck = F1,
2064%% 				     lastAck  = L1},
2065%% 		   #'TransactionAck'{firstAck = F2,
2066%% 				     lastAck  = L2}) ->
2067%%     validate(fun() -> chk_TransactionId(F1, F2) end, 'TransactionAck'),
2068%%     validate(fun() -> chk_opt_TransactionId(L1, L2) end, 'TransactionAck'),
2069%%     ok;
2070%% chk_TransactionAck(T1, T2) ->
2071%%     wrong_type('TransactionAck', T1, T2).
2072
2073
2074%% %% -- ErrorDescriptor --
2075
2076%% is_opt_ErrorDescriptor(V) ->
2077%%     is_OPTIONAL(fun is_ErrorDescriptor/1, V).
2078
2079%% is_ErrorDescriptor(#'ErrorDescriptor'{errorCode = Code,
2080%% 				      errorText = Text}) ->
2081%%     is_ErrorCode(Code) andalso is_opt_ErrorText(Text);
2082%% is_ErrorDescriptor(_) ->
2083%%     false.
2084
2085%% chk_opt_ErrorDescriptor(E1, E2) ->
2086%%     chk_OPTIONAL('ErrorDescriptor', E1, E2,
2087%% 		 fun is_ErrorDescriptor/1, fun chk_ErrorDescriptor/2).
2088
2089%% chk_ErrorDescriptor(E, E) ->
2090%%     chk_type(fun is_ErrorDescriptor/1, 'ErrorDescriptor', E);
2091%% chk_ErrorDescriptor(#'ErrorDescriptor'{errorCode = Code1,
2092%%                                        errorText = Text1},
2093%%                     #'ErrorDescriptor'{errorCode = Code2,
2094%%                                        errorText = Text2}) ->
2095%%     chk_ErrorCode(Code1, Code2),
2096%%     chk_opt_ErrorText(Text1, Text2),
2097%%     ok;
2098%% chk_ErrorDescriptor(E1, E2) ->
2099%%     wrong_type('ErrorDescriptor', E1, E2).
2100
2101
2102%% %% -- ErrorCode --
2103
2104%% is_ErrorCode(C) -> is_INTEGER(C, {range, 0, 65535}).
2105
2106%% chk_ErrorCode(C, C) ->
2107%%     case is_ErrorCode(C) of
2108%% 	true ->
2109%% 	    ok;
2110%% 	false ->
2111%% 	    wrong_type(errorCode, C, C)
2112%%     end;
2113%% chk_ErrorCode(C1, C2) ->
2114%%     case (is_ErrorCode(C1) andalso is_ErrorCode(C2)) of
2115%% 	true ->
2116%% 	    not_equal(errorCode, C1, C2);
2117%% 	false ->
2118%% 	    wrong_type(errorCode, C1, C2)
2119%%     end.
2120
2121
2122%% %% -- ErrorText --
2123
2124%% is_opt_ErrorText(V) ->
2125%%     is_OPTIONAL(fun is_ErrorText/1, V).
2126
2127%% is_ErrorText(V) -> is_IA5String(V).
2128
2129%% chk_opt_ErrorText(T1, T2) ->
2130%%     chk_OPTIONAL('ErrorText', T1, T2, fun is_ErrorText/1, fun chk_ErrorText/2).
2131
2132%% chk_ErrorText(T, T) ->
2133%%     chk_type(fun is_ErrorText/1, 'ErrorText', T);
2134%% chk_ErrorText(T1, T2) ->
2135%%     case (is_ErrorText(T1) andalso is_ErrorText(T2)) of
2136%% 	true ->
2137%% 	    case {to_lower(T1), to_lower(T2)} of
2138%% 		{T, T} ->
2139%% 		    ok;
2140%% 		_ ->
2141%% 		    not_equal('ErrorText', T1, T2)
2142%% 	    end;
2143%% 	false ->
2144%% 	    wrong_type('ErrorText', T1, T2)
2145%%     end.
2146
2147
2148%% %% -- ContextID --
2149
2150%% is_ContextID(Id) -> is_INTEGER(Id, {range, 0, 4294967295}).
2151
2152%% chk_ContextID(Id, Id) ->
2153%%     chk_type(fun is_ContextID/1, 'ContextID', Id);
2154%% chk_ContextID(Id1, Id2) ->
2155%%     case (is_ContextID(Id1) andalso is_ContextID(Id2)) of
2156%% 	true ->
2157%% 	    not_equal('ContextID', Id1, Id2);
2158%% 	false ->
2159%% 	    wrong_type('ContextID', Id1, Id2)
2160%%     end.
2161
2162
2163%% %% -- ActionRequest --
2164
2165%% is_ActionRequest(#'ActionRequest'{contextId           = Id,
2166%% 				  contextRequest      = CtxReq,
2167%% 				  contextAttrAuditReq = AuditReq,
2168%% 				  commandRequests     = CmdReqs}) ->
2169%%     is_ContextID(Id) andalso
2170%% 	is_opt_ContextRequest(CtxReq) andalso
2171%% 	is_opt_ContextAttrAuditRequest(AuditReq) andalso
2172%% 	is_ActionRequest_commandRequests(CmdReqs);
2173%% is_ActionRequest(_) ->
2174%%     false.
2175
2176%% chk_ActionRequest(A, A) ->
2177%%     chk_type(fun is_ActionRequest/1, 'ActionRequest', A);
2178%% chk_ActionRequest(#'ActionRequest'{contextId           = Id1,
2179%%                                    contextRequest      = Req1,
2180%%                                    contextAttrAuditReq = AuditReq1,
2181%%                                    commandRequests     = CmdReqs1},
2182%%                   #'ActionRequest'{contextId           = Id2,
2183%%                                    contextRequest      = Req2,
2184%%                                    contextAttrAuditReq = AuditReq2,
2185%%                                    commandRequests     = CmdReqs2}) ->
2186%%     validate(fun() -> chk_ContextID(Id1, Id2) end, 'ActionRequest'),
2187%%     validate(fun() -> chk_opt_ContextRequest(Req1, Req2) end, 'ActionRequest'),
2188%%     validate(fun() ->
2189%% 		     chk_opt_ContextAttrAuditRequest(AuditReq1, AuditReq2)
2190%% 	     end,
2191%% 	     'ActionRequest'),
2192%%     chk_ActionRequest_commandRequests(CmdReqs1, CmdReqs2),
2193%%     ok.
2194
2195
2196%% is_ActionRequest_commandRequests([]) ->
2197%%     true;
2198%% is_ActionRequest_commandRequests([H|T]) ->
2199%%     is_CommandRequest(H) andalso is_ActionRequest_commandRequests(T);
2200%% is_ActionRequest_commandRequests(_) ->
2201%%     false.
2202
2203%% chk_ActionRequest_commandRequests([], []) ->
2204%%     ok;
2205%% chk_ActionRequest_commandRequests([] = CmdReqs1, CmdReqs2) ->
2206%%     not_equal('ActionRequest_commandRequests', CmdReqs1, CmdReqs2);
2207%% chk_ActionRequest_commandRequests(CmdReqs1, [] = CmdReqs2) ->
2208%%     not_equal('ActionRequest_commandRequests', CmdReqs1, CmdReqs2);
2209%% chk_ActionRequest_commandRequests([H|T1], [H|T2]) ->
2210%%     case is_CommandRequest(H) of
2211%% 	true ->
2212%% 	    chk_ActionRequest_commandRequests(T1, T2);
2213%% 	false ->
2214%% 	    wrong_type('ActionRequest_commandRequest_val', H)
2215%%     end;
2216%% chk_ActionRequest_commandRequests([H1|T1], [H2|T2]) ->
2217%%     validate(fun() -> chk_CommandRequest(H1, H2) end,
2218%% 	     'ActionRequest_commandRequests_val'),
2219%%     chk_ActionRequest_commandRequests(T1, T2);
2220%% chk_ActionRequest_commandRequests(R1, R2) ->
2221%%     wrong_type('ActionRequest_commandRequests', R1, R2).
2222
2223
2224%% %% -- ActionReply --
2225
2226%% is_ActionReply(#'ActionReply'{contextId       = Id,
2227%% 			      errorDescriptor = ED,
2228%% 			      contextReply    = CtxRep,
2229%% 			      commandReply    = CmdRep}) ->
2230%%     is_ContextID(Id) andalso
2231%% 	is_opt_ErrorDescriptor(ED) andalso
2232%% 	is_opt_ContextRequest(CtxRep) andalso
2233%% 	is_ActionReply_commandReply(CmdRep);
2234%% is_ActionReply(_) ->
2235%%     false.
2236
2237%% is_ActionReply_commandReply([]) ->
2238%%     true;
2239%% is_ActionReply_commandReply([H|T]) ->
2240%%     is_CommandReply(H) andalso is_ActionReply_commandReply(T);
2241%% is_ActionReply_commandReply(_) ->
2242%%     false.
2243
2244%% chk_ActionReply(A, A) ->
2245%%     chk_type(fun is_ActionReply/1, 'ActionReply', A);
2246%% chk_ActionReply(#'ActionReply'{contextId       = Id1,
2247%% 			       errorDescriptor = ED1,
2248%% 			       contextReply    = CtxRep1,
2249%% 			       commandReply    = CmdRep1},
2250%% 		#'ActionReply'{contextId       = Id2,
2251%% 			       errorDescriptor = ED2,
2252%% 			       contextReply    = CtxRep2,
2253%% 			       commandReply    = CmdRep2}) ->
2254%%     chk_ContextID(Id1, Id2),
2255%%     chk_opt_ErrorDescriptor(ED1, ED2),
2256%%     chk_opt_ContextRequest(CtxRep1, CtxRep2),
2257%%     chk_ActionReply_commandReply(CmdRep1, CmdRep2).
2258
2259%% chk_ActionReply_commandReply([], []) ->
2260%%     ok;
2261%% chk_ActionReply_commandReply([] = Reps1, Reps2) ->
2262%%     not_equal('ActionReply_commandReply', Reps1, Reps2);
2263%% chk_ActionReply_commandReply(Reps1, [] = Reps2) ->
2264%%     not_equal('ActionReply_commandReply', Reps1, Reps2);
2265%% chk_ActionReply_commandReply([H|T1], [H|T2]) ->
2266%%     case is_CommandReply(H) of
2267%% 	true ->
2268%% 	    chk_ActionReply_commandReply(T1, T2);
2269%% 	false ->
2270%% 	    wrong_type('ActionReply_commandReply_val', H)
2271%%     end;
2272%% chk_ActionReply_commandReply([H1|T1], [H2|T2]) ->
2273%%     validate(fun() -> chk_CommandReply(H1, H2) end,
2274%% 	     'ActionReply_commandReply_val'),
2275%%     chk_ActionReply_commandReply(T1, T2);
2276%% chk_ActionReply_commandReply(R1, R2) ->
2277%%     wrong_type('ActionReply_commandReply', R1, R2).
2278
2279
2280%% %% -- ContextRequest --
2281
2282%% is_opt_ContextRequest(asn1_NOVALUE) ->
2283%%     true;
2284%% is_opt_ContextRequest(V) ->
2285%%     is_ContextRequest(V).
2286
2287%% is_ContextRequest(#'ContextRequest'{priority    = Prio,
2288%% 				    emergency   = Em,
2289%% 				    topologyReq = TopReq}) ->
2290%%     is_ContextRequest_priority(Prio) andalso
2291%%     is_ContextRequest_emergency(Em) andalso
2292%%     is_ContextRequest_topologyReq(TopReq);
2293%% is_ContextRequest(_) ->
2294%%     false.
2295
2296%% is_ContextRequest_priority(asn1_NOVALUE) ->
2297%%     true;
2298%% is_ContextRequest_priority(V) ->
2299%%     is_INTEGER(V, {range, 1, 15}).
2300
2301%% is_ContextRequest_emergency(asn1_NOVALUE) ->
2302%%     true;
2303%% is_ContextRequest_emergency(V) ->
2304%%     is_BOOLEAN(V).
2305
2306%% is_ContextRequest_topologyReq(asn1_NOVALUE) ->
2307%%     true;
2308%% is_ContextRequest_topologyReq([]) ->
2309%%     true;
2310%% is_ContextRequest_topologyReq([H|T]) ->
2311%%     is_TopologyRequest(H) andalso is_ContextRequest_topologyReq(T);
2312%% is_ContextRequest_topologyReq(_) ->
2313%%     false.
2314
2315%% chk_opt_ContextRequest(asn1_NOVALUE, asn1_NOVALUE) ->
2316%%     ok;
2317%% chk_opt_ContextRequest(R, R) ->
2318%%     chk_ContextRequest(R, R).
2319
2320%% chk_ContextRequest(R, R) ->
2321%%     chk_type(fun is_ContextRequest/1, 'ContextRequest', R);
2322%% chk_ContextRequest(#'ContextRequest'{priority    = Prio1,
2323%% 				     emergency   = Em1,
2324%% 				     topologyReq = TopReq1},
2325%% 		   #'ContextRequest'{priority    = Prio2,
2326%% 				     emergency   = Em2,
2327%% 				     topologyReq = TopReq2}) ->
2328%%     chk_ContextRequest_priority(Prio1, Prio2),
2329%%     chk_ContextRequest_emergency(Em1, Em2),
2330%%     chk_ContextRequest_topologyReq(TopReq1, TopReq2),
2331%%     ok;
2332%% chk_ContextRequest(R1, R2) ->
2333%%     wrong_type('ContextRequest', R1, R2).
2334
2335
2336%% chk_ContextRequest_priority(asn1_NOVALUE,asn1_NOVALUE) ->
2337%%     ok;
2338%% chk_ContextRequest_priority(P, P) ->
2339%%     chk_type(fun is_ContextRequest_priority/1, 'ContextRequest_priority', P);
2340%% chk_ContextRequest_priority(P1, P2) ->
2341%%     case (is_ContextRequest_priority(P1) andalso
2342%% 	  is_ContextRequest_priority(P2)) of
2343%% 	true ->
2344%% 	    not_equal('ContextRequest_priority', P1, P2);
2345%% 	false ->
2346%% 	    wrong_type(contextRequest_priority, P1, P2)
2347%%     end.
2348
2349
2350%% chk_ContextRequest_emergency(asn1_NOVALUE, asn1_NOVALUE) ->
2351%%     ok;
2352%% chk_ContextRequest_emergency(E, E) ->
2353%%     chk_type(fun is_ContextRequest_emergency/1, 'ContextRequest_emergency', E);
2354%% chk_ContextRequest_emergency(E1, E2) ->
2355%%     case (is_ContextRequest_emergency(E1) andalso
2356%% 	  is_ContextRequest_emergency(E2)) of
2357%% 	true ->
2358%% 	    not_equal('ContextRequest_emergency', E1, E2);
2359%% 	false ->
2360%% 	    wrong_type('ContextRequest_emergency', E1, E2)
2361%%     end.
2362
2363%% chk_ContextRequest_topologyReq(asn1_NOVALUE, asn1_NOVALUE) ->
2364%%     ok;
2365%% chk_ContextRequest_topologyReq([], []) ->
2366%%     ok;
2367%% chk_ContextRequest_topologyReq([] = T1, T2) ->
2368%%     not_equal('ContextRequest_topologyReq', T1, T2);
2369%% chk_ContextRequest_topologyReq(T1, [] = T2) ->
2370%%     not_equal('ContextRequest_topologyReq', T1, T2);
2371%% chk_ContextRequest_topologyReq([H|T1], [H|T2]) ->
2372%%     case is_TopologyRequest(H) of
2373%% 	true ->
2374%% 	    chk_ContextRequest_topologyReq(T1, T2);
2375%% 	false ->
2376%% 	    wrong_type('ContextRequest_topologyReq_val', H)
2377%%     end;
2378%% chk_ContextRequest_topologyReq([H1|T1], [H2|T2]) ->
2379%%     validate(fun() -> chk_TopologyRequest(H1, H2) end,
2380%% 	     'ContextRequest_topologyReq_val'),
2381%%     chk_ContextRequest_topologyReq(T1, T2);
2382%% chk_ContextRequest_topologyReq(T1, T2) ->
2383%%     wrong_type('ContextRequest_topologyReq', T1, T2).
2384
2385
2386%% %% -- ContextAttrAuditRequest --
2387
2388%% is_opt_ContextAttrAuditRequest(asn1_NOVALUE) ->
2389%%     true;
2390%% is_opt_ContextAttrAuditRequest(V) ->
2391%%     is_ContextAttrAuditRequest(V).
2392
2393%% is_ContextAttrAuditRequest(#'ContextAttrAuditRequest'{topology  = T,
2394%% 						      emergency = E,
2395%% 						      priority  = P}) ->
2396%%     is_opt_NULL(T) andalso is_opt_NULL(E) andalso is_opt_NULL(P);
2397%% is_ContextAttrAuditRequest(_) ->
2398%%     false.
2399
2400%% chk_opt_ContextAttrAuditRequest(asn1_NOVALUE, asn1_NOVALUE) ->
2401%%     ok;
2402%% chk_opt_ContextAttrAuditRequest(R1, R2) ->
2403%%     chk_ContextAttrAuditRequest(R1, R2).
2404
2405%% chk_ContextAttrAuditRequest(R, R) ->
2406%%     chk_type(fun is_ContextAttrAuditRequest/1, 'ContextAttrAuditRequest', R);
2407%% chk_ContextAttrAuditRequest(#'ContextAttrAuditRequest'{topology  = T1,
2408%% 						       emergency = E1,
2409%% 						       priority  = P1},
2410%% 			    #'ContextAttrAuditRequest'{topology  = T2,
2411%% 						       emergency = E2,
2412%% 						       priority  = P2}) ->
2413%%     validate(fun() -> chk_opt_NULL(T1, T2) end,
2414%% 	     'ContextAttrAuditRequest_topology'),
2415%%     validate(fun() -> chk_opt_NULL(E1, E2) end,
2416%% 	     'ContextAttrAuditRequest_emergency'),
2417%%     validate(fun() -> chk_opt_NULL(P1, P2) end,
2418%% 	     'ContextAttrAuditRequest_priority'),
2419%%     ok.
2420
2421
2422%% %% -- CommandRequest --
2423
2424%% is_CommandRequest(#'CommandRequest'{command        = Cmd,
2425%% 				    optional       = Opt,
2426%% 				    wildcardReturn = WR}) ->
2427%%     is_Command(Cmd) andalso is_opt_NULL(Opt) andalso is_opt_NULL(WR);
2428%% is_CommandRequest(_) ->
2429%%     false.
2430
2431%% chk_CommandRequest(C, C) ->
2432%%     chk_type(fun is_CommandRequest/1, 'CommandRequest', C);
2433%% chk_CommandRequest(#'CommandRequest'{command        = Cmd1,
2434%% 				     optional       = Opt1,
2435%% 				     wildcardReturn = WR1},
2436%% 		   #'CommandRequest'{command        = Cmd2,
2437%% 				     optional       = Opt2,
2438%% 				     wildcardReturn = WR2}) ->
2439%%     validate(fun() -> chk_Command(Cmd1, Cmd2) end, 'CommandRequest'),
2440%%     validate(fun() -> chk_opt_NULL(Opt1, Opt2) end, 'CommandRequest'),
2441%%     validate(fun() -> chk_opt_NULL(WR1, WR2) end, 'CommandRequest'),
2442%%     ok;
2443%% chk_CommandRequest(R1, R2) ->
2444%%     wrong_type('CommandRequest', R1, R2).
2445
2446
2447%% %% -- Command --
2448
2449%% is_Command({Tag, Val}) ->
2450%%     is_Command_tag(Tag) andalso is_Command_val(Tag, Val);
2451%% is_Command(_) ->
2452%%     false.
2453
2454%% is_Command_tag(Tag) ->
2455%%     Tags = [addReq, moveReq, modReq, subtractReq, auditCapRequest,
2456%% 	    auditValueRequest, notifyReq, serviceChangeReq],
2457%%     lists:member(Tag, Tags).
2458
2459%% is_Command_val(addReq,  V)           -> is_AmmRequest(V);
2460%% is_Command_val(moveReq, V)           -> is_AmmRequest(V);
2461%% is_Command_val(modReq,  V)           -> is_AmmRequest(V);
2462%% is_Command_val(subtractReq, V)       -> is_SubtractRequest(V);
2463%% is_Command_val(auditCapRequest, V)   -> is_AuditRequest(V);
2464%% is_Command_val(auditValueRequest, V) -> is_AuditRequest(V);
2465%% is_Command_val(notifyReq, V)         -> is_NotifyRequest(V);
2466%% is_Command_val(serviceChangeReq, V)  -> is_ServiceChangeRequest(V).
2467
2468%% chk_Command(Cmd, Cmd) ->
2469%%     chk_type(fun is_Command/1, 'Command', Cmd);
2470%% chk_Command({Tag, Val1} = Cmd1, {Tag, Val2} = Cmd2) ->
2471%%     case (is_Command_tag(Tag) andalso
2472%% 	  is_Command_val(Tag, Val1) andalso
2473%% 	  is_Command_val(Tag, Val2)) of
2474%% 	true ->
2475%% 	    chk_Command_val(Tag, Val1, Val2);
2476%% 	false ->
2477%% 	    wrong_type('Command', Cmd1, Cmd2)
2478%%     end;
2479%% chk_Command({Tag1, Val1} = Cmd1, {Tag2, Val2} = Cmd2) ->
2480%%     case ((is_Command_tag(Tag1) andalso is_Command_val(Tag1, Val1)) andalso
2481%% 	  (is_Command_tag(Tag2) andalso is_Command_val(Tag2, Val2))) of
2482%% 	true ->
2483%% 	    not_equal('Command', Cmd1, Cmd2);
2484%% 	false ->
2485%% 	    wrong_type('Command', Cmd1, Cmd2)
2486%%     end;
2487%% chk_Command(Cmd1, Cmd2) ->
2488%%     wrong_type('Command', Cmd1, Cmd2).
2489
2490
2491%% chk_Command_val(addReq, R1, R2) ->
2492%%     validate(fun() -> chk_AmmRequest(R1, R2) end, 'Command_addReq');
2493%% chk_Command_val(moveReq, R1, R2) ->
2494%%     validate(fun() -> chk_AmmRequest(R1, R2) end, 'Command_moveReq');
2495%% chk_Command_val(modReq, R1, R2) ->
2496%%     validate(fun() -> chk_AmmRequest(R1, R2) end, 'Command_modReq');
2497%% chk_Command_val(subtractReq, R1, R2) ->
2498%%     validate(fun() -> chk_SubtractRequest(R1, R2) end, 'Command_subtractReq');
2499%% chk_Command_val(auditCapRequest, R1, R2) ->
2500%%     validate(fun() -> chk_AuditRequest(R1, R2) end, 'Command_auditCapRequest');
2501%% chk_Command_val(auditValueRequest, R1, R2) ->
2502%%     validate(fun() -> chk_AuditRequest(R1, R2) end,
2503%% 	     'Command_auditValueRequest');
2504%% chk_Command_val(notifyReq, R1, R2) ->
2505%%     validate(fun() -> chk_NotifyRequest(R1, R2) end, 'Command_notifyReq');
2506%% chk_Command_val(serviceChangeReq, R1, R2) ->
2507%%     validate(fun() -> chk_ServiceChangeRequest(R1, R2) end,
2508%% 	     'Command_serviceChangeReq').
2509
2510
2511%% %% -- CommandReply --
2512
2513%% is_CommandReply({Tag, Val}) ->
2514%%     is_CommandReply_tag(Tag) andalso is_CommandReply_val(Tag, Val);
2515%% is_CommandReply(_) ->
2516%%     false.
2517
2518%% is_CommandReply_tag(Tag) ->
2519%%     Tags = [addReply, moveReply, modReply, subtractReply,
2520%% 	    auditCapReply, auditValueReply, notifyReply, serviceChangeReply],
2521%%     lists:member(Tag, Tags).
2522
2523%% is_CommandReply_val(addReply, V)           -> is_AmmsReply(V);
2524%% is_CommandReply_val(moveReply, V)          -> is_AmmsReply(V);
2525%% is_CommandReply_val(modReply, V)           -> is_AmmsReply(V);
2526%% is_CommandReply_val(subtractReply, V)      -> is_AmmsReply(V);
2527%% is_CommandReply_val(auditCapReply, V)      -> is_AuditReply(V);
2528%% is_CommandReply_val(auditValueReply, V)    -> is_AuditReply(V);
2529%% is_CommandReply_val(notifyReply, V)        -> is_NotifyReply(V);
2530%% is_CommandReply_val(serviceChangeReply, V) -> is_ServiceChangeReply(V).
2531
2532%% chk_CommandReply({Tag, Val} = Cmd, Cmd) ->
2533%%     case (is_CommandReply_tag(Tag) andalso is_CommandReply_val(Tag, Val)) of
2534%% 	true ->
2535%% 	    ok;
2536%% 	false ->
2537%% 	    wrong_type('CommandReply', Cmd)
2538%%     end;
2539%% chk_CommandReply({Tag, Val1} = Cmd1, {Tag, Val2} = Cmd2) ->
2540%%     case (is_CommandReply_tag(Tag) andalso
2541%% 	  is_CommandReply_val(Tag, Val1) andalso
2542%% 	  is_CommandReply_val(Tag, Val2)) of
2543%% 	true ->
2544%% 	    chk_CommandReply_val(Tag, Val1, Val2);
2545%% 	false ->
2546%% 	    wrong_type('CommandReply', Cmd1, Cmd2)
2547%%     end;
2548%% chk_CommandReply({Tag1, Val1} = Cmd1, {Tag2, Val2} = Cmd2) ->
2549%%     case ((is_CommandReply_tag(Tag1) andalso
2550%% 	   is_CommandReply_val(Tag1, Val1)) andalso
2551%% 	  (is_CommandReply_tag(Tag2) andalso
2552%% 	   is_CommandReply_val(Tag2, Val2))) of
2553%% 	true ->
2554%% 	    not_equal('CommandReply', Cmd1, Cmd2);
2555%% 	false ->
2556%% 	    wrong_type('CommandReply', Cmd1, Cmd2)
2557%%     end;
2558%% chk_CommandReply(Cmd1, Cmd2) ->
2559%%     wrong_type('CommandReply', Cmd1, Cmd2).
2560
2561%% chk_CommandReply_val(addReply, V1, V2) ->
2562%%     validate(fun() -> chk_AmmsReply(V1, V2) end, 'CommandReply_addReply');
2563%% chk_CommandReply_val(moveReply, V1, V2) ->
2564%%     validate(fun() -> chk_AmmsReply(V1, V2) end, 'CommandReply_moveReply');
2565%% chk_CommandReply_val(modReply, V1, V2) ->
2566%%     validate(fun() -> chk_AmmsReply(V1, V2) end, 'CommandReply_modReply');
2567%% chk_CommandReply_val(subtractReply, V1, V2) ->
2568%%     validate(fun() -> chk_AmmsReply(V1, V2) end, 'CommandReply_subtractReply');
2569%% chk_CommandReply_val(auditCapReply, V1, V2) ->
2570%%     validate(fun() -> chk_AuditReply(V1, V2) end,
2571%% 	     'CommandReply_auditCapReply');
2572%% chk_CommandReply_val(auditValueReply, V1, V2) ->
2573%%     validate(fun() -> chk_AuditReply(V1, V2) end,
2574%% 	     'CommandReply_auditValueReply');
2575%% chk_CommandReply_val(notifyReply, V1, V2) ->
2576%%     validate(fun() -> chk_NotifyReply(V1, V2) end, 'CommandReply_notifyReply');
2577%% chk_CommandReply_val(serviceChangeReply, V1, V2) ->
2578%%     validate(fun() -> chk_ServiceChangeReply(V1, V2) end,
2579%% 	     'CommandReply_serviceChangeReply').
2580
2581
2582%% %% -- TopologyRequest --
2583
2584%% is_TopologyRequest(#'TopologyRequest'{terminationFrom   = F,
2585%% 				      terminationTo     = T,
2586%% 				      topologyDirection = D,
2587%% 				      streamID          = S}) ->
2588%%     is_TerminationID(F) andalso
2589%% 	is_TerminationID(T) andalso
2590%% 	is_TopologyRequest_topologyDirection(D) andalso
2591%% 	is_opt_StreamID(S);
2592%% is_TopologyRequest(_) ->
2593%%     false.
2594
2595%% is_TopologyRequest_topologyDirection(D) ->
2596%%     lists:member(D, [bothway, isolate, oneway]).
2597
2598
2599%% chk_TopologyRequest(T, T) when record(T,'TopologyRequest') ->
2600%%     ok;
2601%% chk_TopologyRequest(#'TopologyRequest'{terminationFrom   = F1,
2602%%                                        terminationTo     = T1,
2603%%                                        topologyDirection = D1,
2604%% 				       streamID          = S1},
2605%%                     #'TopologyRequest'{terminationFrom   = F2,
2606%%                                        terminationTo     = T2,
2607%%                                        topologyDirection = D2,
2608%% 				       streamID          = S2}) ->
2609%%     validate(fun() -> chk_TerminationID(F1, F2) end,
2610%% 	     'TopologyRequest_terminationFrom'),
2611%%     validate(fun() -> chk_TerminationID(T1, T2) end,
2612%% 	     'TopologyRequest_terminationTo'),
2613%%     chk_TopologyRequest_topologyDirection(D1,D2),
2614%%     validate(fun() -> chk_StreamID(S1, S2) end, 'TopologyRequest_streamID'),
2615%%     ok.
2616
2617%% chk_TopologyRequest_topologyDirection(D, D) ->
2618%%     case is_TopologyRequest_topologyDirection(D) of
2619%% 	true ->
2620%% 	    ok;
2621%% 	false ->
2622%% 	    wrong_type('TopologyRequest_topologyDirection', D)
2623%%     end;
2624%% chk_TopologyRequest_topologyDirection(D1, D2) ->
2625%%     case (is_TopologyRequest_topologyDirection(D1) andalso
2626%% 	  is_TopologyRequest_topologyDirection(D1)) of
2627%% 	true ->
2628%% 	    not_equal('TopologyRequest_topologyDirection', D1, D2);
2629%% 	false ->
2630%% 	    wrong_type('TopologyRequest_topologyDirection', D1, D2)
2631%%     end.
2632
2633
2634%% %% -- AmmRequest --
2635
2636%% is_AmmRequest(#'AmmRequest'{terminationID = Tids,
2637%% 			    descriptors   = Descs}) ->
2638%%     d("is_AmmRequest -> entry with"
2639%%       "~n   Tids:  ~p", [Tids]),
2640%%     is_TerminationIDList(Tids) andalso is_AmmRequest_descriptors(Descs);
2641%% is_AmmRequest(_) ->
2642%%     false.
2643
2644%% is_AmmRequest_descriptors(Descs) ->
2645%%     is_AmmRequest_descriptors(Descs, []).
2646
2647%% is_AmmRequest_descriptors([], _) ->
2648%%     true;
2649%% is_AmmRequest_descriptors([{Tag, _} = Desc|Descs], FoundDescs) ->
2650%%     d("is_AmmRequest_descriptors -> entry with"
2651%%       "~n   Tag:        ~p"
2652%%       "~n   FoundDescs: ~p", [Tag, FoundDescs]),
2653%%     case lists:member(Tag, FoundDescs) of
2654%% 	true ->
2655%% 	    atmost_once('AmmRequest_descriptors', Tag);
2656%% 	false ->
2657%% 	    case is_AmmDescriptor(Desc) of
2658%% 		true ->
2659%% 		    is_AmmRequest_descriptors(Descs, [Tag|FoundDescs]);
2660%% 		false ->
2661%% 		    wrong_type('AmmRequest_descriptors', Desc)
2662%% 	    end
2663%%     end;
2664%% is_AmmRequest_descriptors(Descs, _) ->
2665%%     d("is_AmmRequest_descriptors -> entry with WRONG TYPE"
2666%%       "~n   Descs: ~p", [Descs]),
2667%%     wrong_type('AmmRequest_descriptors', Descs).
2668
2669
2670%% chk_AmmRequest(R, R) when record(R, 'AmmRequest') ->
2671%%     d("chk_AmmRequest -> entry when equal"),
2672%%     chk_type(fun is_AmmRequest/1, 'AmmRequest', R);
2673%% chk_AmmRequest(#'AmmRequest'{terminationID = Tids1,
2674%% 			     descriptors   = Descs1},
2675%% 	       #'AmmRequest'{terminationID = Tids2,
2676%% 			     descriptors   = Descs2}) ->
2677%%     d("chk_AmmRequest -> entry with not equal"
2678%%       "~n   Tids1:  ~p"
2679%%       "~n   Tids2:  ~p", [Tids1, Tids2]),
2680%%     validate(
2681%%       fun() -> chk_TerminationIDList(Tids1, Tids2) end,
2682%%       'AmmRequest'),
2683%%     validate(
2684%%       fun() -> chk_AmmRequest_descriptors(Descs1, Descs2) end,
2685%%       'AmmRequest'),
2686%%     ok.
2687
2688
2689%% chk_AmmRequest_descriptors([], []) ->
2690%%     d("chk_AmmRequest_descriptors -> done when OK"),
2691%%     ok;
2692%% chk_AmmRequest_descriptors([] = Descs1, Descs2) ->
2693%%     d("chk_AmmRequest_descriptors -> done when NOT EQUAL:"
2694%%       "~n   Descs1: ~p"
2695%%       "~n   Descs1: ~p", [Descs1, Descs2]),
2696%%     not_equal('AmmRequest_descriptors', Descs1, Descs2);
2697%% chk_AmmRequest_descriptors(Descs1, [] = Descs2) ->
2698%%     d("chk_AmmRequest_descriptors -> done when NOT EQUAL:"
2699%%       "~n   Descs1: ~p"
2700%%       "~n   Descs1: ~p", [Descs1, Descs2]),
2701%%     not_equal('AmmRequest_descriptors', Descs1, Descs2);
2702%% chk_AmmRequest_descriptors([H|T1], [H|T2]) ->
2703%%     d("chk_AmmRequest_descriptors -> entry when equal"),
2704%%     case is_AmmDescriptor(H) of
2705%% 	true ->
2706%% 	    chk_AmmRequest_descriptors(T1, T2);
2707%% 	false ->
2708%% 	    wrong_type('AmmRequest_descriptors_val', H)
2709%%     end;
2710%% chk_AmmRequest_descriptors([H1|T1], [H2|T2]) ->
2711%%     d("chk_AmmRequest_descriptors -> entry when not equal"),
2712%%     validate(fun() -> chk_AmmDescriptor(H1, H2) end,
2713%% 	     'AmmRequest_descriptors_val'),
2714%%     chk_AmmRequest_descriptors(T1, T2);
2715%% chk_AmmRequest_descriptors(Descs1, Descs2) ->
2716%%     d("chk_AmmRequest_descriptors -> done when WRONG TYPE:"
2717%%       "~n   Descs1: ~p"
2718%%       "~n   Descs1: ~p", [Descs1, Descs2]),
2719%%     wrong_type('AmmRequest_descriptors', Descs1, Descs2).
2720
2721
2722%% %% -- AmmDescriptor --
2723
2724%% is_AmmDescriptor({Tag, Val}) ->
2725%%     d("is_AmmDescriptor -> entry with"
2726%%       "~n   Tag: ~p"
2727%%       "~n   Val: ~p",[Tag, Val]),
2728%%     is_AmmDescriptor_tag(Tag) andalso is_AmmDescriptor_val(Tag, Val);
2729%% is_AmmDescriptor(_) ->
2730%%     false.
2731
2732%% is_AmmDescriptor_tag(Tag) ->
2733%%     Tags = [mediaDescriptor, modemDescriptor, muxDescriptor, eventsDescriptor,
2734%% 	    eventBufferDescriptor, signalsDescriptor, digitMapDescriptor,
2735%% 	    auditDescriptor],
2736%%     lists:member(Tag, Tags).
2737
2738%% is_AmmDescriptor_val(mediaDescriptor, D) ->
2739%%     is_MediaDescriptor(D);
2740%% is_AmmDescriptor_val(modemDescriptor, D) ->
2741%%     is_ModemDescriptor(D);
2742%% is_AmmDescriptor_val(muxDescriptor, D) ->
2743%%     is_MuxDescriptor(D);
2744%% is_AmmDescriptor_val(eventsDescriptor, D) ->
2745%%     is_EventsDescriptor(D);
2746%% is_AmmDescriptor_val(eventBufferDescriptor, D) ->
2747%%     is_EventBufferDescriptor(D);
2748%% is_AmmDescriptor_val(signalsDescriptor, D) ->
2749%%     is_SignalsDescriptor(D);
2750%% is_AmmDescriptor_val(digitMapDescriptor, D) ->
2751%%     is_DigitMapDescriptor(D);
2752%% is_AmmDescriptor_val(auditDescriptor, D) ->
2753%%     is_AuditDescriptor(D).
2754
2755%% chk_AmmDescriptor(D, D) ->
2756%%     chk_type(fun is_AmmDescriptor_tag/1, 'AmmDescriptor', D);
2757%% chk_AmmDescriptor({Tag, Val1} = Cmd1, {Tag, Val2} = Cmd2) ->
2758%%     case (is_AmmDescriptor_tag(Tag) andalso
2759%% 	  is_AmmDescriptor_val(Tag, Val1) andalso
2760%% 	  is_AmmDescriptor_val(Tag, Val2)) of
2761%% 	true ->
2762%% 	    chk_AmmDescriptor_val(Tag, Val1, Val2);
2763%% 	false ->
2764%% 	    wrong_type('AmmDescriptor', Cmd1, Cmd2)
2765%%     end;
2766%% chk_AmmDescriptor({Tag1, Val1} = Cmd1, {Tag2, Val2} = Cmd2) ->
2767%%     case ((is_AmmDescriptor_tag(Tag1) andalso
2768%% 	   is_AmmDescriptor_val(Tag1, Val1)) andalso
2769%% 	  (is_AmmDescriptor_tag(Tag2) andalso
2770%% 	   is_AmmDescriptor_val(Tag2, Val2))) of
2771%% 	true ->
2772%% 	    not_equal('AmmDescriptor', Cmd1, Cmd2);
2773%% 	false ->
2774%% 	    wrong_type('AmmDescriptor', Cmd1, Cmd2)
2775%%     end;
2776%% chk_AmmDescriptor(Cmd1, Cmd2) ->
2777%%     wrong_type('AmmDescriptor', Cmd1, Cmd2).
2778
2779%% chk_AmmDescriptor_val(mediaDescriptor, D1, D2) ->
2780%%     validate(fun() -> chk_MediaDescriptor(D1, D2) end, 'AmmDescriptor');
2781%% chk_AmmDescriptor_val(modemDescriptor, D1, D2) ->
2782%%     validate(fun() -> chk_ModemDescriptor(D1, D2) end, 'AmmDescriptor');
2783%% chk_AmmDescriptor_val(muxDescriptor, D1, D2) ->
2784%%     validate(fun() -> chk_MuxDescriptor(D1, D2) end, 'AmmDescriptor');
2785%% chk_AmmDescriptor_val(eventsDescriptor, D1, D2) ->
2786%%     validate(fun() -> chk_EventsDescriptor(D1, D2) end, 'AmmDescriptor');
2787%% chk_AmmDescriptor_val(eventBufferDescriptor, D1, D2) ->
2788%%     validate(fun() -> chk_EventBufferDescriptor(D1, D2) end, 'AmmDescriptor');
2789%% chk_AmmDescriptor_val(signalsDescriptor, D1, D2) ->
2790%%     validate(fun() -> chk_SignalsDescriptor(D1, D2) end, 'AmmDescriptor');
2791%% chk_AmmDescriptor_val(digitMapDescriptor, D1, D2) ->
2792%%     validate(fun() -> chk_DigitMapDescriptor(D1, D2) end, 'AmmDescriptor');
2793%% chk_AmmDescriptor_val(auditDescriptor, D1, D2) ->
2794%%     validate(fun() -> chk_AuditDescriptor(D1, D2) end, 'AmmDescriptor').
2795
2796
2797%% %% -- AmmsReply --
2798
2799%% is_AmmsReply(#'AmmsReply'{terminationID    = Tids,
2800%% 			  terminationAudit = TA}) ->
2801%%     is_TerminationIDList(Tids) andalso is_opt_TerminationAudit(TA);
2802%% is_AmmsReply(_) ->
2803%%     false.
2804
2805%% chk_AmmsReply(R, R) ->
2806%%     is_AmmsReply(R);
2807%% chk_AmmsReply(#'AmmsReply'{terminationID    = TID1,
2808%% 			   terminationAudit = TA1},
2809%% 	      #'AmmsReply'{terminationID    = TID2,
2810%% 			   terminationAudit = TA2}) ->
2811%%     validate(fun() -> chk_TerminationIDList(TID1, TID2) end, 'AmmsReply'),
2812%%     validate(fun() -> chk_opt_TerminationAudit(TA1, TA2) end, 'AmmsReply'),
2813%%     ok;
2814%% chk_AmmsReply(R1, R2) ->
2815%%     wrong_type('AmmsReply', R1, R2).
2816
2817
2818%% %% -- SubtractRequest --
2819
2820%% is_SubtractRequest(#'SubtractRequest'{terminationID   = Tids,
2821%% 				      auditDescriptor = AD}) ->
2822%%     is_TerminationIDList(Tids) andalso is_opt_AuditDescriptor(AD);
2823%% is_SubtractRequest(_) ->
2824%%     false.
2825
2826%% chk_SubtractRequest(R, R) ->
2827%%     chk_type(fun is_SubtractRequest/1, 'SubtractRequest', R);
2828%% chk_SubtractRequest(#'SubtractRequest'{terminationID   = Tids1,
2829%% 				       auditDescriptor = AD1},
2830%% 		    #'SubtractRequest'{terminationID   = Tids2,
2831%% 				       auditDescriptor = AD2}) ->
2832%%     validate(fun() -> chk_TerminationIDList(Tids1, Tids2) end,
2833%% 	     'SubtractRequest'),
2834%%     validate(fun() -> chk_opt_AuditDescriptor(AD1, AD2) end,
2835%% 	     'SubtractRequest'),
2836%%     ok;
2837%% chk_SubtractRequest(SR1, SR2) ->
2838%%     wrong_type('SubtractRequest', SR1, SR2).
2839
2840
2841%% %% -- AuditRequest --
2842
2843%% is_AuditRequest(#'AuditRequest'{terminationID   = Tid,
2844%% 				auditDescriptor = AD}) ->
2845%%     is_TerminationID(Tid) andalso is_AuditDescriptor(AD);
2846%% is_AuditRequest(_) ->
2847%%     false.
2848
2849%% chk_AuditRequest(R, R) ->
2850%%     chk_type(fun is_AuditRequest/1, 'AuditRequest', R);
2851%% chk_AuditRequest(#'AuditRequest'{terminationID   = Tids1,
2852%% 				 auditDescriptor = AD1},
2853%% 		 #'AuditRequest'{terminationID   = Tids2,
2854%% 				 auditDescriptor = AD2}) ->
2855%%     validate(fun() -> chk_TerminationID(Tids1, Tids2) end,
2856%% 	     'AuditRequest'),
2857%%     validate(fun() -> chk_AuditDescriptor(AD1, AD2) end,
2858%% 	     'AuditRequest'),
2859%%     ok;
2860%% chk_AuditRequest(AR1, AR2) ->
2861%%     wrong_type('AuditRequest', AR1, AR2).
2862
2863
2864%% %% -- AuditReply --
2865
2866%% is_AuditReply({Tag, Val}) ->
2867%%     is_AuditReply_tag(Tag) andalso is_AuditReply_val(Tag, Val);
2868%% is_AuditReply(_) ->
2869%%     false.
2870
2871%% is_AuditReply_tag(Tag) ->
2872%%     Tags = [contextAuditResult, error, auditResult],
2873%%     lists:member(Tag, Tags).
2874
2875%% is_AuditReply_val(contextAuditResult, Val) ->
2876%%     is_TerminationIDList(Val);
2877%% is_AuditReply_val(error, Val) ->
2878%%     is_ErrorDescriptor(Val);
2879%% is_AuditReply_val(auditResult, Val) ->
2880%%     is_AuditResult(Val).
2881
2882%% chk_AuditReply(R, R) ->
2883%%     chk_type(fun is_AuditReply/1, 'AuditReply', R);
2884%% chk_AuditReply({Tag, Val1} = R1, {Tag, Val2} = R2) ->
2885%%     case (is_AuditReply_tag(Tag) andalso
2886%% 	  is_AuditReply_val(Tag, Val1)andalso
2887%% 	  is_AuditReply_val(Tag, Val2)) of
2888%% 	true ->
2889%% 	    chk_AuditReply_val(Tag, Val1, Val2);
2890%% 	false ->
2891%% 	    wrong_type('AuditReply', R1, R2)
2892%%     end;
2893%% chk_AuditReply({Tag1, Val1} = R1, {Tag2, Val2} = R2) ->
2894%%     case ((is_AuditReply_tag(Tag1) andalso
2895%% 	   is_AuditReply_val(Tag1, Val1)) andalso
2896%% 	  (is_AuditReply_tag(Tag2) andalso
2897%% 	   is_AuditReply_val(Tag2, Val2))) of
2898%% 	true ->
2899%% 	    not_equal('AuditReply', R1, R2);
2900%% 	false ->
2901%% 	    wrong_type('AuditReply', R1, R2)
2902%%     end;
2903%% chk_AuditReply(AR1, AR2) ->
2904%%     wrong_type('AuditReply', AR1, AR2).
2905
2906%% chk_AuditReply_val(contextAuditResult, Val1, Val2) ->
2907%%     chk_TerminationIDList(Val1, Val2);
2908%% chk_AuditReply_val(error, Val1, Val2) ->
2909%%     chk_ErrorDescriptor(Val1, Val2);
2910%% chk_AuditReply_val(auditResult, Val1, Val2) ->
2911%%     chk_AuditResult(Val1, Val2).
2912
2913
2914%% %% -- AuditResult --
2915
2916%% is_AuditResult(#'AuditResult'{terminationID          = TID,
2917%% 			      terminationAuditResult = TAR}) ->
2918%%     is_TerminationID(TID) andalso is_TerminationAudit(TAR);
2919%% is_AuditResult(_) ->
2920%%     false.
2921
2922%% chk_AuditResult(R, R) ->
2923%%     chk_type(fun is_AuditResult/1, 'AuditResult', R);
2924%% chk_AuditResult(#'AuditResult'{terminationID          = TID1,
2925%% 			       terminationAuditResult = TAR1},
2926%% 		#'AuditResult'{terminationID          = TID2,
2927%% 			       terminationAuditResult = TAR2}) ->
2928%%     validate(fun() -> chk_TerminationID(TID1, TID2) end, 'AuditResult'),
2929%%     validate(fun() -> chk_TerminationAudit(TAR1, TAR2) end, 'AuditResult'),
2930%%     ok;
2931%% chk_AuditResult(AR1, AR2) ->
2932%%     wrong_type('AuditResult', AR1, AR2).
2933
2934
2935%% %% -- TerminationAudit --
2936
2937%% is_opt_TerminationAudit(TA) ->
2938%%     is_OPTIONAL(fun is_TerminationAudit/1, TA).
2939
2940%% is_TerminationAudit([]) ->
2941%%     true;
2942%% is_TerminationAudit([H|T]) ->
2943%%     is_AuditReturnParameter(H) andalso is_TerminationAudit(T);
2944%% is_TerminationAudit(_) ->
2945%%     false.
2946
2947%% chk_opt_TerminationAudit(TA1, TA2) ->
2948%%     chk_OPTIONAL('TerminationAudit', TA1, TA2,
2949%% 		 fun is_TerminationAudit/1, fun chk_TerminationAudit/2).
2950
2951%% chk_TerminationAudit([], []) ->
2952%%     ok;
2953%% chk_TerminationAudit([] = TA1, TA2) ->
2954%%     not_equal('TerminationAudit', TA1, TA2);
2955%% chk_TerminationAudit(TA1, [] = TA2) ->
2956%%     not_equal('TerminationAudit', TA1, TA2);
2957%% chk_TerminationAudit([H|T1], [H|T2]) ->
2958%%     case is_AuditReturnParameter(H) of
2959%% 	true ->
2960%% 	    chk_TerminationAudit(T1, T2);
2961%% 	false ->
2962%% 	    wrong_type('TerminationAudit', H)
2963%%     end;
2964%% chk_TerminationAudit([H1|_], [H2|_]) ->
2965%%     chk_AuditReturnParameter(H1, H2),
2966%%     not_equal('TerminationAudit_val', H1, H2);
2967%% chk_TerminationAudit(TA1, TA2) ->
2968%%     not_equal('TerminationAudit', TA1, TA2).
2969
2970
2971%% %% -- AuditReturnParameter --
2972
2973%% is_AuditReturnParameter({Tag, Val}) ->
2974%%     is_AuditReturnParameter_tag(Tag) andalso
2975%% 	is_AuditReturnParameter_val(Tag, Val);
2976%% is_AuditReturnParameter(_) ->
2977%%     false.
2978
2979%% is_AuditReturnParameter_tag(Tag) ->
2980%%     Tags = [errorDescriptor,
2981%% 	    mediaDescriptor,
2982%% 	    modemDescriptor,
2983%% 	    muxDescriptor,
2984%% 	    eventsDescriptor,
2985%% 	    eventBufferDescriptor,
2986%% 	    signalsDescriptor,
2987%% 	    digitMapDescriptor,
2988%% 	    observedEventsDescriptor,
2989%% 	    statisticsDescriptor,
2990%% 	    packagesDescriptor,
2991%% 	    emptyDescriptors],
2992%%     lists:member(Tag, Tags).
2993
2994%% is_AuditReturnParameter_val(errorDescriptor, V) ->
2995%%     is_ErrorDescriptor(V);
2996%% is_AuditReturnParameter_val(mediaDescriptor, V) ->
2997%%     is_MediaDescriptor(V);
2998%% is_AuditReturnParameter_val(modemDescriptor, V) ->
2999%%     is_ModemDescriptor(V);
3000%% is_AuditReturnParameter_val(muxDescriptor, V) ->
3001%%     is_MuxDescriptor(V);
3002%% is_AuditReturnParameter_val(eventsDescriptor, V) ->
3003%%     is_EventsDescriptor(V);
3004%% is_AuditReturnParameter_val(eventBufferDescriptor, V) ->
3005%%     is_EventBufferDescriptor(V);
3006%% is_AuditReturnParameter_val(signalsDescriptor, V) ->
3007%%     is_SignalsDescriptor(V);
3008%% is_AuditReturnParameter_val(digitMapDescriptor, V) ->
3009%%     is_DigitMapDescriptor(V);
3010%% is_AuditReturnParameter_val(observedEventsDescriptor, V) ->
3011%%     is_ObservedEventsDescriptor(V);
3012%% is_AuditReturnParameter_val(statisticsDescriptor, V) ->
3013%%     is_StatisticsDescriptor(V);
3014%% is_AuditReturnParameter_val(packagesDescriptor, V) ->
3015%%     is_PackagesDescriptor(V);
3016%% is_AuditReturnParameter_val(emptyDescriptors, V) ->
3017%%     is_AuditDescriptor(V).
3018
3019%% chk_AuditReturnParameter(ARP, ARP) ->
3020%%     chk_type(fun is_AuditReturnParameter/1, 'AuditReturnParameter', ARP);
3021%% chk_AuditReturnParameter({Tag, Val1} = ARP1, {Tag, Val2} = ARP2) ->
3022%%     case (is_AuditReturnParameter_tag(Tag) andalso
3023%% 	  is_AuditReturnParameter_val(Tag, Val1) andalso
3024%% 	  is_AuditReturnParameter_val(Tag, Val2)) of
3025%% 	true ->
3026%% 	    chk_AuditReturnParameter_val(Tag, Val1, Val2);
3027%% 	false ->
3028%% 	    wrong_type('AuditReturnParameter', ARP1, ARP2)
3029%%     end;
3030%% chk_AuditReturnParameter({Tag1, Val1} = ARP1, {Tag2, Val2} = ARP2) ->
3031%%     case ((is_AuditReturnParameter_tag(Tag1) andalso
3032%% 	   is_AuditReturnParameter_val(Tag1, Val1)) andalso
3033%% 	  (is_AuditReturnParameter_tag(Tag2) andalso
3034%% 	   is_AuditReturnParameter_val(Tag2, Val2))) of
3035%% 	true ->
3036%% 	    not_equal('AuditReturnParameter', ARP1, ARP2);
3037%% 	false ->
3038%% 	    wrong_type('AuditReturnParameter', ARP1, ARP2)
3039%%     end;
3040%% chk_AuditReturnParameter(ARP1, ARP2) ->
3041%%     wrong_type('AuditReturnParameter', ARP1, ARP2).
3042
3043%% chk_AuditReturnParameter_val(errorDescriptor, V1, V2) ->
3044%%     validate(fun() -> chk_ErrorDescriptor(V1, V2) end,
3045%% 	     'AuditReturnParameter');
3046%% chk_AuditReturnParameter_val(mediaDescriptor, V1, V2) ->
3047%%     validate(fun() -> chk_MediaDescriptor(V1, V2) end,
3048%% 	     'AuditReturnParameter');
3049%% chk_AuditReturnParameter_val(modemDescriptor, V1, V2) ->
3050%%     validate(fun() -> chk_ModemDescriptor(V1, V2) end,
3051%% 	     'AuditReturnParameter');
3052%% chk_AuditReturnParameter_val(muxDescriptor, V1, V2) ->
3053%%     validate(fun() -> chk_MuxDescriptor(V1, V2) end,
3054%% 	     'AuditReturnParameter');
3055%% chk_AuditReturnParameter_val(eventsDescriptor, V1, V2) ->
3056%%     validate(fun() -> chk_EventsDescriptor(V1, V2) end,
3057%% 	     'AuditReturnParameter');
3058%% chk_AuditReturnParameter_val(eventBufferDescriptor, V1, V2) ->
3059%%     validate(fun() -> chk_EventBufferDescriptor(V1, V2) end,
3060%% 	     'AuditReturnParameter');
3061%% chk_AuditReturnParameter_val(signalsDescriptor, V1, V2) ->
3062%%     validate(fun() -> chk_SignalsDescriptor(V1, V2) end,
3063%% 	     'AuditReturnParameter');
3064%% chk_AuditReturnParameter_val(digitMapDescriptor, V1, V2) ->
3065%%     validate(fun() -> chk_DigitMapDescriptor(V1, V2) end,
3066%% 	     'AuditReturnParameter');
3067%% chk_AuditReturnParameter_val(observedEventsDescriptor, V1, V2) ->
3068%%     validate(fun() -> chk_ObservedEventsDescriptor(V1, V2) end,
3069%% 	     'AuditReturnParameter');
3070%% chk_AuditReturnParameter_val(statisticsDescriptor, V1, V2) ->
3071%%     validate(fun() -> chk_StatisticsDescriptor(V1, V2) end,
3072%% 	     'AuditReturnParameter');
3073%% chk_AuditReturnParameter_val(packagesDescriptor, V1, V2) ->
3074%%     validate(fun() -> chk_PackagesDescriptor(V1, V2) end,
3075%% 	     'AuditReturnParameter');
3076%% chk_AuditReturnParameter_val(emptyDescriptors, V1, V2) ->
3077%%     validate(fun() -> chk_AuditDescriptor(V1, V2) end,
3078%% 	     'AuditReturnParameter').
3079
3080
3081%% %% -- AuditDescriptor --
3082
3083%% is_opt_AuditDescriptor(asn1_NOVALUE) ->
3084%%     true;
3085%% is_opt_AuditDescriptor(V) ->
3086%%     is_AuditDescriptor(V).
3087
3088%% is_AuditDescriptor(#'AuditDescriptor'{auditToken         = AT,
3089%% 				      auditPropertyToken = APT}) ->
3090%%     is_AuditDescriptor_auditToken(AT) andalso
3091%% 	is_AuditDescriptor_auditPropertyToken(APT);
3092%% is_AuditDescriptor(_) ->
3093%%     false.
3094
3095%% is_AuditDescriptor_auditToken(asn1_NOVALUE) ->
3096%%     true;
3097%% is_AuditDescriptor_auditToken([]) ->
3098%%     true;
3099%% is_AuditDescriptor_auditToken([H|T]) ->
3100%%     is_AuditDescriptor_auditToken_val(H) andalso
3101%% 	is_AuditDescriptor_auditToken(T);
3102%% is_AuditDescriptor_auditToken(_) ->
3103%%     false.
3104
3105%% is_AuditDescriptor_auditToken_val(V) ->
3106%%     Toks = [muxToken, modemToken, mediaToken, eventsToken, signalsToken,
3107%% 	    digitMapToken, statsToken, observedEventsToken,
3108%% 	    packagesToken, eventBufferToken],
3109%%     lists:member(V, Toks).
3110
3111%% is_AuditDescriptor_auditPropertyToken(asn1_NOVALUE) ->
3112%%     true;
3113%% is_AuditDescriptor_auditPropertyToken([]) ->
3114%%     true;
3115%% is_AuditDescriptor_auditPropertyToken([H|T]) ->
3116%%     is_IndAuditParameter(H) andalso is_AuditDescriptor_auditPropertyToken(T);
3117%% is_AuditDescriptor_auditPropertyToken(_) ->
3118%%     false.
3119
3120%% chk_opt_AuditDescriptor(asn1_NOVALUE, asn1_NOVALUE) ->
3121%%     ok;
3122%% chk_opt_AuditDescriptor(AD1, AD2) ->
3123%%     chk_AuditDescriptor(AD1, AD2).
3124
3125%% chk_AuditDescriptor(AD, AD) ->
3126%%     chk_type(fun is_AuditDescriptor/1, 'AuditDescriptor', AD);
3127%% chk_AuditDescriptor(#'AuditDescriptor'{auditToken         = AT1,
3128%% 				       auditPropertyToken = APT1},
3129%% 		    #'AuditDescriptor'{auditToken         = AT2,
3130%% 				       auditPropertyToken = APT2}) ->
3131%%     chk_AuditDescriptor_auditToken(AT1, AT2),
3132%%     chk_AuditDescriptor_auditPropertyToken(APT1, APT2),
3133%%     ok;
3134%% chk_AuditDescriptor(AD1, AD2) ->
3135%%     wrong_type('AuditDescriptor', AD1, AD2).
3136
3137%% chk_AuditDescriptor_auditToken(asn1_NOVALUE, asn1_NOVALUE) ->
3138%%     ok;
3139%% chk_AuditDescriptor_auditToken([], []) ->
3140%%     ok;
3141%% chk_AuditDescriptor_auditToken([] = AT1, AT2) ->
3142%%     not_equal('AuditDescriptor_auditToken', AT1, AT2);
3143%% chk_AuditDescriptor_auditToken(AT1, [] = AT2) ->
3144%%     not_equal('AuditDescriptor_auditToken', AT1, AT2);
3145%% chk_AuditDescriptor_auditToken([H|T1], [H|T2]) ->
3146%%     case is_AuditDescriptor_auditToken_val(H) of
3147%% 	true ->
3148%% 	    chk_AuditDescriptor_auditToken(T1, T2);
3149%% 	false ->
3150%% 	    wrong_type('AuditDescriptor_auditToken_val', H)
3151%%     end;
3152%% chk_AuditDescriptor_auditToken([H1|_T1], [H2|_T2]) ->
3153%%     case (is_AuditDescriptor_auditToken_val(H1) andalso
3154%% 	  is_AuditDescriptor_auditToken_val(H2)) of
3155%% 	true ->
3156%% 	    not_equal('AuditDescriptor_auditToken_val', H1, H2);
3157%% 	false ->
3158%% 	    wrong_type('AuditDescriptor_auditToken_val', H1, H2)
3159%%     end;
3160%% chk_AuditDescriptor_auditToken(AT1, AT2) ->
3161%%     wrong_type('AuditDescriptor_auditToken', AT1, AT2).
3162
3163%% chk_AuditDescriptor_auditPropertyToken(asn1_NOVALUE, asn1_NOVALUE) ->
3164%%     ok;
3165%% chk_AuditDescriptor_auditPropertyToken([], []) ->
3166%%     ok;
3167%% chk_AuditDescriptor_auditPropertyToken([] = AT1, AT2) ->
3168%%     not_equal('AuditDescriptor_auditPropertyToken', AT1, AT2);
3169%% chk_AuditDescriptor_auditPropertyToken(AT1, [] = AT2) ->
3170%%     not_equal('AuditDescriptor_auditPropertyToken', AT1, AT2);
3171%% chk_AuditDescriptor_auditPropertyToken([H|T1], [H|T2]) ->
3172%%     case is_IndAuditParameter(H) of
3173%% 	true ->
3174%% 	    chk_AuditDescriptor_auditPropertyToken(T1, T2);
3175%% 	false ->
3176%% 	    wrong_type('AuditDescriptor_auditPropertyToken_val', H)
3177%%     end;
3178%% chk_AuditDescriptor_auditPropertyToken([H1|_], [H2|_]) ->
3179%%     chk_IndAuditParameter(H1, H2),
3180%%     not_equal('AuditDescriptor_auditPropertyToken_val', H1, H2);
3181%% chk_AuditDescriptor_auditPropertyToken(AT1, AT2) ->
3182%%     wrong_type('AuditDescriptor_auditPropertyToken', AT1, AT2).
3183
3184
3185%% %% -- IndAuditParameter --
3186
3187%% is_IndAuditParameter({Tag, Val}) ->
3188%%     is_IndAuditParameter_tag(Tag) andalso is_IndAuditParameter_val(Tag, Val);
3189%% is_IndAuditParameter(_) ->
3190%%     false.
3191
3192%% is_IndAuditParameter_tag(Tag) ->
3193%%     Tags = [indAudMediaDescriptor,
3194%% 	    indAudEventsDescriptor,
3195%% 	    indAudEventBufferDescriptor,
3196%% 	    indAudSignalsDescriptor,
3197%% 	    indAudDigitMapDescriptor,
3198%% 	    indAudStatisticsDescriptor,
3199%% 	    indAudPackagesDescriptor],
3200%%     lists:member(Tag, Tags).
3201
3202%% is_IndAuditParameter_val(indAudMediaDescriptor, Val) ->
3203%%     is_IndAudMediaDescriptor(Val);
3204%% is_IndAuditParameter_val(indAudEventsDescriptor, Val) ->
3205%%     is_IndAudEventsDescriptor(Val);
3206%% is_IndAuditParameter_val(indAudEventBufferDescriptor, Val) ->
3207%%     is_IndAudEventBufferDescriptor(Val);
3208%% is_IndAuditParameter_val(indAudSignalsDescriptor, Val) ->
3209%%     is_IndAudSignalsDescriptor(Val);
3210%% is_IndAuditParameter_val(indAudDigitMapDescriptor, Val) ->
3211%%     is_IndAudDigitMapDescriptor(Val);
3212%% is_IndAuditParameter_val(indAudStatisticsDescriptor, Val) ->
3213%%     is_IndAudStatisticsDescriptor(Val);
3214%% is_IndAuditParameter_val(indAudPackagesDescriptor, Val) ->
3215%%     is_IndAudPackagesDescriptor(Val).
3216
3217%% chk_IndAuditParameter(IAP, IAP) ->
3218%%     chk_type(fun is_IndAuditParameter/1, 'IndAuditParameter', IAP);
3219%% chk_IndAuditParameter({Tag, Val1} = IAP1, {Tag, Val2} = IAP2) ->
3220%%     case (is_IndAuditParameter_tag(Tag) andalso
3221%% 	  is_IndAuditParameter_val(Tag, Val1) andalso
3222%% 	  is_IndAuditParameter_val(Tag, Val2)) of
3223%% 	true ->
3224%% 	    chk_IndAuditParameter_val(Tag, Val1, Val2);
3225%% 	false ->
3226%% 	    wrong_type('IndAuditParameter', IAP1, IAP2)
3227%%     end;
3228%% chk_IndAuditParameter({Tag1, Val1} = IAP1, {Tag2, Val2} = IAP2) ->
3229%%     case ((is_IndAuditParameter_tag(Tag1) andalso
3230%% 	   is_IndAuditParameter_val(Tag1, Val1)) andalso
3231%% 	  (is_IndAuditParameter_tag(Tag2) andalso
3232%% 	   is_IndAuditParameter_val(Tag2, Val2))) of
3233%% 	true ->
3234%% 	    not_equal('IndAuditParameter', IAP1, IAP2);
3235%% 	false ->
3236%% 	    wrong_type('IndAuditParameter', IAP1, IAP2)
3237%%     end;
3238%% chk_IndAuditParameter(IAP1, IAP2) ->
3239%%     wrong_type('IndAuditParameter', IAP1, IAP2).
3240
3241%% chk_IndAuditParameter_val(indAudMediaDescriptor, Val1, Val2) ->
3242%%     validate(fun() -> chk_IndAudMediaDescriptor(Val1, Val2) end,
3243%% 	     'IndAuditParameter');
3244%% chk_IndAuditParameter_val(indAudEventsDescriptor, Val1, Val2) ->
3245%%     validate(fun() -> chk_IndAudEventsDescriptor(Val1, Val2) end,
3246%% 	     'IndAuditParameter');
3247%% chk_IndAuditParameter_val(indAudEventBufferDescriptor, Val1, Val2) ->
3248%%     validate(fun() -> chk_IndAudEventBufferDescriptor(Val1, Val2) end,
3249%% 	     'IndAuditParameter');
3250%% chk_IndAuditParameter_val(indAudSignalsDescriptor, Val1, Val2) ->
3251%%     validate(fun() -> chk_IndAudSignalsDescriptor(Val1, Val2) end,
3252%% 	     'IndAuditParameter');
3253%% chk_IndAuditParameter_val(indAudDigitMapDescriptor, Val1, Val2) ->
3254%%     validate(fun() -> chk_IndAudDigitMapDescriptor(Val1, Val2) end,
3255%% 	     'IndAuditParameter');
3256%% chk_IndAuditParameter_val(indAudStatisticsDescriptor, Val1, Val2) ->
3257%%     validate(fun() -> chk_IndAudStatisticsDescriptor(Val1, Val2) end,
3258%% 	     'IndAuditParameter');
3259%% chk_IndAuditParameter_val(indAudPackagesDescriptor, Val1, Val2) ->
3260%%     validate(fun() -> chk_IndAudPackagesDescriptor(Val1, Val2) end,
3261%% 	     'IndAuditParameter').
3262
3263
3264%% %% -- IndAudMediaDescriptor --
3265
3266%% is_IndAudMediaDescriptor(#'IndAudMediaDescriptor'{termStateDescr = TSD,
3267%% 						  streams        = S}) ->
3268%%     is_opt_IndAudTerminationStateDescriptor(TSD) andalso
3269%% 	is_IndAudMediaDescriptor_streams(S);
3270%% is_IndAudMediaDescriptor(_) ->
3271%%     false.
3272
3273%% is_IndAudMediaDescriptor_streams(asn1_NOVALUE) ->
3274%%     true;
3275%% is_IndAudMediaDescriptor_streams({Tag, Val}) ->
3276%%     is_IndAudMediaDescriptor_streams_tag(Tag) andalso
3277%% 	is_IndAudMediaDescriptor_streams_val(Tag, Val);
3278%% is_IndAudMediaDescriptor_streams(_) ->
3279%%     false.
3280
3281%% is_IndAudMediaDescriptor_streams_tag(Tag) ->
3282%%     Tags = [oneStream, multiStream],
3283%%     lists:member(Tag, Tags).
3284
3285%% is_IndAudMediaDescriptor_streams_val(oneStream, Val) ->
3286%%     is_IndAudStreamParms(Val);
3287%% is_IndAudMediaDescriptor_streams_val(multiStream, Val) ->
3288%%     is_IndAudMediaDescriptor_multiStream(Val).
3289
3290%% is_IndAudMediaDescriptor_multiStream([]) ->
3291%%     true;
3292%% is_IndAudMediaDescriptor_multiStream([H|T]) ->
3293%%     is_IndAudStreamDescriptor(H) andalso
3294%% 	is_IndAudMediaDescriptor_multiStream(T);
3295%% is_IndAudMediaDescriptor_multiStream(_) ->
3296%%     false.
3297
3298%% chk_IndAudMediaDescriptor(IAMD, IAMD) ->
3299%%     chk_type(fun is_IndAudMediaDescriptor/1, 'IndAudMediaDescriptor', IAMD);
3300%% chk_IndAudMediaDescriptor(#'IndAudMediaDescriptor'{termStateDescr = TSD1,
3301%% 						   streams        = S1},
3302%% 			  #'IndAudMediaDescriptor'{termStateDescr = TSD2,
3303%% 						   streams        = S2}) ->
3304%%     validate(fun() -> chk_opt_IndAudTerminationStateDescriptor(TSD1, TSD2) end,
3305%% 	     'IndAudMediaDescriptor'),
3306%%     validate(fun() -> chk_IndAudMediaDescriptor_streams(S1, S2) end,
3307%% 	     'IndAudMediaDescriptor'),
3308%%     ok;
3309%% chk_IndAudMediaDescriptor(IAMD1, IAMD2) ->
3310%%     wrong_type('IndAudMediaDescriptor', IAMD1, IAMD2).
3311
3312%% chk_IndAudMediaDescriptor_streams(asn1_NOVALUE, asn1_NOVALUE) ->
3313%%     ok;
3314%% chk_IndAudMediaDescriptor_streams({Tag, Val1} = S1,
3315%% 					     {Tag, Val2} = S2) ->
3316%%     case (is_IndAudMediaDescriptor_streams_tag(Tag) andalso
3317%% 	  is_IndAudMediaDescriptor_streams_val(Tag, Val1) andalso
3318%% 	  is_IndAudMediaDescriptor_streams_val(Tag, Val2)) of
3319%% 	true ->
3320%% 	    chk_IndAudMediaDescriptor_streams_val(Tag, Val1, Val2);
3321%% 	false ->
3322%% 	    wrong_type('IndAudMediaDescriptor_streams', S1, S2)
3323%%     end;
3324%% chk_IndAudMediaDescriptor_streams({Tag1, Val1} = S1,
3325%% 					     {Tag2, Val2} = S2) ->
3326%%     case ((is_IndAudMediaDescriptor_streams_tag(Tag1) andalso
3327%% 	   is_IndAudMediaDescriptor_streams_val(Tag1, Val1)) andalso
3328%% 	  (is_IndAudMediaDescriptor_streams_tag(Tag2) andalso
3329%% 	   is_IndAudMediaDescriptor_streams_val(Tag2, Val2))) of
3330%% 	true ->
3331%% 	    not_equal('IndAudMediaDescriptor_streams', S1, S2);
3332%% 	false ->
3333%% 	    wrong_type('IndAudMediaDescriptor_streams', S1, S2)
3334%%     end;
3335%% chk_IndAudMediaDescriptor_streams(S1, S2) ->
3336%%     wrong_type('IndAudMediaDescriptor_streams', S1, S2).
3337
3338%% chk_IndAudMediaDescriptor_streams_val(oneStream, Val1, Val2) ->
3339%%     validate(fun() -> chk_IndAudStreamParms(Val1, Val2) end,
3340%% 	     'IndAudMediaDescriptor_streams');
3341%% chk_IndAudMediaDescriptor_streams_val(multiStream, Val1, Val2) ->
3342%%     validate(fun() -> chk_IndAudMediaDescriptor_multiStream(Val1, Val2) end,
3343%% 	     'IndAudMediaDescriptor_streams').
3344
3345%% chk_IndAudMediaDescriptor_multiStream([], []) ->
3346%%     ok;
3347%% chk_IndAudMediaDescriptor_multiStream([] = MS1, MS2) ->
3348%%     not_equal('IndAudMediaDescriptor_multiStream', MS1, MS2);
3349%% chk_IndAudMediaDescriptor_multiStream(MS1, [] = MS2) ->
3350%%     not_equal('IndAudMediaDescriptor_multiStream', MS1, MS2);
3351%% chk_IndAudMediaDescriptor_multiStream([H|T1], [H|T2]) ->
3352%%     case is_IndAudStreamDescriptor(H) of
3353%% 	true ->
3354%% 	    chk_IndAudMediaDescriptor_multiStream(T1, T2);
3355%% 	false ->
3356%% 	    wrong_type('IndAudMediaDescriptor_multiStream_val', H)
3357%%     end;
3358%% chk_IndAudMediaDescriptor_multiStream([H1|T1], [H2|T2]) ->
3359%%     validate(fun() -> chk_IndAudStreamDescriptor(H1, H2) end,
3360%% 	     'IndAudMediaDescriptor_multiStream_val'),
3361%%     chk_IndAudMediaDescriptor_multiStream(T1, T2);
3362%% chk_IndAudMediaDescriptor_multiStream(MS1, MS2) ->
3363%%     wrong_type('IndAudMediaDescriptor_multiStream', MS1, MS2).
3364
3365
3366%% %% -- IndAudStreamDescriptor --
3367
3368%% is_IndAudStreamDescriptor(#'IndAudStreamDescriptor'{streamID    = SID,
3369%% 						    streamParms = Parms}) ->
3370%%     is_StreamID(SID) andalso is_IndAudStreamParms(Parms);
3371%% is_IndAudStreamDescriptor(_) ->
3372%%     false.
3373
3374%% chk_IndAudStreamDescriptor(D, D) ->
3375%%     chk_type(fun is_IndAudStreamDescriptor/1, 'IndAudStreamDescriptor', D);
3376%% chk_IndAudStreamDescriptor(#'IndAudStreamDescriptor'{streamID    = SID1,
3377%% 						     streamParms = Parms1},
3378%% 			   #'IndAudStreamDescriptor'{streamID    = SID2,
3379%% 						     streamParms = Parms2}) ->
3380%%     validate(fun() -> chk_StreamID(SID1, SID2) end, 'IndAudStreamDescriptor'),
3381%%     validate(fun() -> chk_IndAudStreamParms(Parms1, Parms2) end,
3382%% 	     'IndAudStreamDescriptor'),
3383%%     ok;
3384%% chk_IndAudStreamDescriptor(D1, D2) ->
3385%%     wrong_type('IndAudStreamDescriptor', D1, D2).
3386
3387
3388%% %% -- IndAudStreamParms --
3389
3390%% is_IndAudStreamParms(#'IndAudStreamParms'{localControlDescriptor = LCD,
3391%% 					  localDescriptor        = LD,
3392%% 					  remoteDescriptor       = RD}) ->
3393%%     is_opt_IndAudLocalControlDescriptor(LCD) andalso
3394%% 	is_opt_IndAudLocalRemoteDescriptor(LD) andalso
3395%% 	is_opt_IndAudLocalRemoteDescriptor(RD);
3396%% is_IndAudStreamParms(_) ->
3397%%     false.
3398
3399%% chk_IndAudStreamParms(#'IndAudStreamParms'{localControlDescriptor = LCD1,
3400%% 					   localDescriptor        = LD1,
3401%% 					   remoteDescriptor       = RD1},
3402%% 		      #'IndAudStreamParms'{localControlDescriptor = LCD2,
3403%% 					   localDescriptor        = LD2,
3404%% 					   remoteDescriptor       = RD2}) ->
3405%%     validate(fun() -> chk_opt_IndAudLocalControlDescriptor(LCD1, LCD2) end,
3406%% 	     'IndAudStreamParms'),
3407%%     validate(fun() -> chk_opt_IndAudLocalRemoteDescriptor(LD1, LD2) end,
3408%% 	     'IndAudStreamParms'),
3409%%     validate(fun() -> chk_opt_IndAudLocalRemoteDescriptor(RD1, RD2) end,
3410%% 	     'IndAudStreamParms'),
3411%%     ok;
3412%% chk_IndAudStreamParms(D1, D2) ->
3413%%     wrong_type('IndAudStreamParms', D1, D2).
3414
3415
3416%% %% -- IndAudLocalControlDescriptor --
3417
3418%% is_opt_IndAudLocalControlDescriptor(asn1_NOVALUE) ->
3419%%     true;
3420%% is_opt_IndAudLocalControlDescriptor(D) ->
3421%%     is_IndAudLocalControlDescriptor(D).
3422
3423%% is_IndAudLocalControlDescriptor(
3424%%   #'IndAudLocalControlDescriptor'{streamMode    = SM,
3425%% 				  reserveValue  = RV,
3426%% 				  reserveGroup  = RG,
3427%% 				  propertyParms = PPs}) ->
3428%%     is_opt_NULL(SM) andalso is_opt_NULL(RV) andalso is_opt_NULL(RG) andalso
3429%% 	is_IndAudLocalControlDescriptor_propertyParms(PPs);
3430%% is_IndAudLocalControlDescriptor(_) ->
3431%%     false.
3432
3433%% is_IndAudLocalControlDescriptor_propertyParms(asn1_NOVALUE) ->
3434%%     true;
3435%% is_IndAudLocalControlDescriptor_propertyParms([]) ->
3436%%     true;
3437%% is_IndAudLocalControlDescriptor_propertyParms([H|T]) ->
3438%%     is_IndAudPropertyParm(H) andalso
3439%% 	is_IndAudLocalControlDescriptor_propertyParms(T);
3440%% is_IndAudLocalControlDescriptor_propertyParms(_) ->
3441%%     false.
3442
3443%% chk_opt_IndAudLocalControlDescriptor(asn1_NOVALUE, asn1_NOVALUE) ->
3444%%     ok;
3445%% chk_opt_IndAudLocalControlDescriptor(
3446%%   #'IndAudLocalControlDescriptor'{streamMode    = SM1,
3447%% 				  reserveValue  = RV1,
3448%% 				  reserveGroup  = RG1,
3449%% 				  propertyParms = PPs1},
3450%%   #'IndAudLocalControlDescriptor'{streamMode    = SM2,
3451%% 				  reserveValue  = RV2,
3452%% 				  reserveGroup  = RG2,
3453%% 				  propertyParms = PPs2}) ->
3454%%     chk_opt_NULL(SM1, SM2),
3455%%     chk_opt_NULL(RV1, RV2),
3456%%     chk_opt_NULL(RG1, RG2),
3457%%     chk_IndAudLocalControlDescriptor_propertyParms(PPs1, PPs2),
3458%%     ok;
3459%% chk_opt_IndAudLocalControlDescriptor(D1, D2) ->
3460%%     wrong_type('IndAudLocalControlDescriptor', D1, D2).
3461
3462%% chk_IndAudLocalControlDescriptor_propertyParms(asn1_NOVALUE, asn1_NOVALUE) ->
3463%%     ok;
3464%% chk_IndAudLocalControlDescriptor_propertyParms([], []) ->
3465%%     ok;
3466%% chk_IndAudLocalControlDescriptor_propertyParms([] = PPs1, PPs2) ->
3467%%     not_equal('IndAudLocalControlDescriptor_propertyParms', PPs1, PPs2);
3468%% chk_IndAudLocalControlDescriptor_propertyParms(PPs1, [] = PPs2) ->
3469%%     not_equal('IndAudLocalControlDescriptor_propertyParms', PPs1, PPs2);
3470%% chk_IndAudLocalControlDescriptor_propertyParms([H|T1], [H|T2]) ->
3471%%     case is_IndAudPropertyParm(H) of
3472%% 	true ->
3473%% 	    chk_IndAudLocalControlDescriptor_propertyParms(T1, T2);
3474%% 	false ->
3475%% 	    wrong_type('IndAudLocalControlDescriptor_propertyParms_val', H)
3476%%     end;
3477%% chk_IndAudLocalControlDescriptor_propertyParms([H1|T1], [H2|T2]) ->
3478%%     validate(fun() -> chk_IndAudPropertyParm(H1, H2) end,
3479%% 	     'IndAudLocalControlDescriptor_propertyParms_val'),
3480%%     chk_IndAudLocalControlDescriptor_propertyParms(T1, T2);
3481%% chk_IndAudLocalControlDescriptor_propertyParms(PPs1, PPs2) ->
3482%%     wrong_type('IndAudLocalControlDescriptor_propertyParms', PPs1, PPs2).
3483
3484
3485%% %% -- IndAudPropertyParm --
3486
3487%% is_IndAudPropertyParm(#'IndAudPropertyParm'{name = Name}) ->
3488%%     is_PkgdName(Name);
3489%% is_IndAudPropertyParm(_) ->
3490%%     false.
3491
3492%% chk_IndAudPropertyParm(#'IndAudPropertyParm'{name = Name1},
3493%% 		       #'IndAudPropertyParm'{name = Name2}) ->
3494%%     chk_PkgdName(Name1, Name2),
3495%%     ok;
3496%% chk_IndAudPropertyParm(P1, P2) ->
3497%%     wrong_type('IndAudPropertyParm', P1, P2).
3498
3499
3500%% %% -- IndAudLocalRemoteDescriptor --
3501
3502%% is_opt_IndAudLocalRemoteDescriptor(asn1_NOVALUE) ->
3503%%     true;
3504%% is_opt_IndAudLocalRemoteDescriptor(D) ->
3505%%     is_IndAudLocalRemoteDescriptor(D).
3506
3507%% is_IndAudLocalRemoteDescriptor(
3508%%   #'IndAudLocalRemoteDescriptor'{propGroupID = ID,
3509%% 				 propGrps    = Grps}) ->
3510%%     is_IndAudLocalRemoteDescriptor_propGroupID(ID) andalso
3511%% 	is_IndAudPropertyGroup(Grps);
3512%% is_IndAudLocalRemoteDescriptor(_) ->
3513%%     false.
3514
3515%% is_IndAudLocalRemoteDescriptor_propGroupID(asn1_NOVALUE) ->
3516%%     true;
3517%% is_IndAudLocalRemoteDescriptor_propGroupID(V) ->
3518%%     is_INTEGER(V, {range, 0, 65535}).
3519
3520%% chk_opt_IndAudLocalRemoteDescriptor(asn1_NOVALUE, asn1_NOVALUE) ->
3521%%     ok;
3522%% chk_opt_IndAudLocalRemoteDescriptor(D1, D2) ->
3523%%     chk_IndAudLocalRemoteDescriptor(D1, D2).
3524
3525%% chk_IndAudLocalRemoteDescriptor(D, D) ->
3526%%     chk_type(fun is_IndAudLocalRemoteDescriptor/1,
3527%% 	     'IndAudLocalRemoteDescriptor', D);
3528%% chk_IndAudLocalRemoteDescriptor(
3529%%   #'IndAudLocalRemoteDescriptor'{propGroupID = ID1,
3530%% 				 propGrps    = Grps1},
3531%%   #'IndAudLocalRemoteDescriptor'{propGroupID = ID2,
3532%% 				 propGrps    = Grps2}) ->
3533%%     chk_IndAudLocalRemoteDescriptor_propGroupID(ID1, ID2),
3534%%     chk_IndAudPropertyGroup(Grps1, Grps2),
3535%%     ok;
3536%% chk_IndAudLocalRemoteDescriptor(D1, D2) ->
3537%%     wrong_type('IndAudLocalRemoteDescriptor', D1, D2).
3538
3539%% chk_IndAudLocalRemoteDescriptor_propGroupID(ID, ID) ->
3540%%     chk_type(fun is_IndAudLocalRemoteDescriptor_propGroupID/1,
3541%% 	     'IndAudLocalRemoteDescriptor_propGroupID', ID);
3542%% chk_IndAudLocalRemoteDescriptor_propGroupID(ID1, ID2) ->
3543%%     case (is_IndAudLocalRemoteDescriptor_propGroupID(ID1) andalso
3544%% 	  is_IndAudLocalRemoteDescriptor_propGroupID(ID2)) of
3545%% 	true ->
3546%% 	    not_equal('IndAudLocalRemoteDescriptor_propGroupID', ID1, ID2);
3547%% 	false ->
3548%% 	    wrong_type('IndAudLocalRemoteDescriptor_propGroupID', ID1, ID2)
3549%%     end.
3550
3551
3552%% %% -- IndAudPropertyGroup --
3553
3554%% is_IndAudPropertyGroup([]) ->
3555%%     true;
3556%% is_IndAudPropertyGroup([H|T]) ->
3557%%     is_IndAudPropertyParm(H) andalso is_IndAudPropertyGroup(T);
3558%% is_IndAudPropertyGroup(_) ->
3559%%     false.
3560
3561%% chk_IndAudPropertyGroup([], []) ->
3562%%     ok;
3563%% chk_IndAudPropertyGroup([] = PG1, PG2) ->
3564%%     not_equal('IndAudPropertyGroup', PG1, PG2);
3565%% chk_IndAudPropertyGroup(PG1, [] = PG2) ->
3566%%     not_equal('IndAudPropertyGroup', PG1, PG2);
3567%% chk_IndAudPropertyGroup([H|T1], [H|T2]) ->
3568%%     case is_IndAudPropertyParm(H) of
3569%% 	true ->
3570%% 	    chk_IndAudPropertyGroup(T1, T2);
3571%% 	false ->
3572%% 	    wrong_type('IndAudPropertyGroup_val', H)
3573%%     end;
3574%% chk_IndAudPropertyGroup([H1|T1], [H2|T2]) ->
3575%%     validate(fun() -> chk_IndAudPropertyParm(H1, H2) end,
3576%% 	     'IndAudPropertyGroup_val'),
3577%%     chk_IndAudPropertyGroup(T1, T2);
3578%% chk_IndAudPropertyGroup(P1, P2) ->
3579%%     wrong_type('IndAudPropertyGroup', P1, P2).
3580
3581
3582%% %% -- IndAudTerminationStateDescriptor --
3583
3584%% is_opt_IndAudTerminationStateDescriptor(asn1_NOVALUE) ->
3585%%     true;
3586%% is_opt_IndAudTerminationStateDescriptor(D) ->
3587%%     is_IndAudTerminationStateDescriptor(D).
3588
3589%% is_IndAudTerminationStateDescriptor(
3590%%   #'IndAudTerminationStateDescriptor'{propertyParms      = Parms,
3591%% 				      eventBufferControl = EBC,
3592%% 				      serviceState       = SS}) ->
3593%%     is_IndAudTerminationStateDescriptor_propertyParms(Parms) andalso
3594%% 	is_opt_NULL(EBC) andalso is_opt_NULL(SS);
3595%% is_IndAudTerminationStateDescriptor(_) ->
3596%%     false.
3597
3598%% is_IndAudTerminationStateDescriptor_propertyParms([]) ->
3599%%     true;
3600%% is_IndAudTerminationStateDescriptor_propertyParms([H|T]) ->
3601%%     is_IndAudPropertyParm(H) andalso
3602%% 	is_IndAudTerminationStateDescriptor_propertyParms(T);
3603%% is_IndAudTerminationStateDescriptor_propertyParms(_) ->
3604%%     false.
3605
3606%% chk_opt_IndAudTerminationStateDescriptor(asn1_NOVALUE, asn1_NOVALUE) ->
3607%%     ok;
3608%% chk_opt_IndAudTerminationStateDescriptor(D1, D2) ->
3609%%     chk_IndAudTerminationStateDescriptor(D1, D2).
3610
3611%% chk_IndAudTerminationStateDescriptor(
3612%%   #'IndAudTerminationStateDescriptor'{propertyParms      = Parms1,
3613%% 				      eventBufferControl = EBC1,
3614%% 				      serviceState       = SS1},
3615%%   #'IndAudTerminationStateDescriptor'{propertyParms      = Parms2,
3616%% 				      eventBufferControl = EBC2,
3617%% 				      serviceState       = SS2}) ->
3618%%     chk_IndAudTerminationStateDescriptor_propertyParms(Parms1, Parms2),
3619%%     validate(fun() -> chk_opt_NULL(EBC1, EBC2) end,
3620%% 	     'IndAudTerminationStateDescriptor'),
3621%%     validate(fun() -> chk_opt_NULL(SS1, SS2) end,
3622%% 	     'IndAudTerminationStateDescriptor'),
3623%%     ok;
3624%% chk_IndAudTerminationStateDescriptor(D1, D2) ->
3625%%     wrong_type('IndAudTerminationStateDescriptor', D1, D2).
3626
3627%% chk_IndAudTerminationStateDescriptor_propertyParms([], []) ->
3628%%     ok;
3629%% chk_IndAudTerminationStateDescriptor_propertyParms([] = PP1, PP2) ->
3630%%     not_equal('IndAudTerminationStateDescriptor_propertyParms', PP1, PP2);
3631%% chk_IndAudTerminationStateDescriptor_propertyParms(PP1, [] = PP2) ->
3632%%     not_equal('IndAudTerminationStateDescriptor_propertyParms', PP1, PP2);
3633%% chk_IndAudTerminationStateDescriptor_propertyParms([H|T1], [H|T2]) ->
3634%%     case is_IndAudPropertyParm(H) of
3635%% 	true ->
3636%% 	    chk_IndAudTerminationStateDescriptor_propertyParms(T1, T2);
3637%% 	false ->
3638%% 	    wrong_type('IndAudTerminationStateDescriptor_propertyParms', H)
3639%%     end;
3640%% chk_IndAudTerminationStateDescriptor_propertyParms([H1|T1], [H2|T2]) ->
3641%%     validate(fun() -> chk_IndAudPropertyParm(H1, H2) end,
3642%% 	     'IndAudTerminationStateDescriptor_propertyParms'),
3643%%     chk_IndAudTerminationStateDescriptor_propertyParms(T1, T2);
3644%% chk_IndAudTerminationStateDescriptor_propertyParms(PP1, PP2) ->
3645%%     wrong_type('IndAudTerminationStateDescriptor_propertyParms', PP1, PP2).
3646
3647
3648%% %% -- IndAudEventsDescriptor --
3649
3650%% is_IndAudEventsDescriptor(#'IndAudEventsDescriptor'{requestID = RID,
3651%% 						    pkgdName  = Name,
3652%% 						    streamID  = SID}) ->
3653%%     is_opt_RequestID(RID) andalso
3654%% 	is_PkgdName(Name) andalso
3655%% 	is_opt_StreamID(SID);
3656%% is_IndAudEventsDescriptor(_) ->
3657%%     false.
3658
3659%% chk_IndAudEventsDescriptor(#'IndAudEventsDescriptor'{requestID = RID1,
3660%% 						     pkgdName  = Name1,
3661%% 						     streamID  = SID1},
3662%% 			   #'IndAudEventsDescriptor'{requestID = RID2,
3663%% 						     pkgdName  = Name2,
3664%% 						     streamID  = SID2}) ->
3665%%     chk_opt_RequestID(RID1, RID2),
3666%%     chk_PkgdName(Name1, Name2),
3667%%     chk_opt_StreamID(SID1, SID2),
3668%%     ok;
3669%% chk_IndAudEventsDescriptor(D1, D2) ->
3670%%     wrong_type('IndAudEventsDescriptor', D1, D2).
3671
3672
3673%% %% -- IndAudEventBufferDescriptor --
3674
3675%% is_IndAudEventBufferDescriptor(
3676%%   #'IndAudEventBufferDescriptor'{eventName = Name,
3677%% 				 streamID  = SID}) ->
3678%%     is_PkgdName(Name) andalso is_opt_StreamID(SID);
3679%% is_IndAudEventBufferDescriptor(_) ->
3680%%     false.
3681
3682%% chk_IndAudEventBufferDescriptor(
3683%%   #'IndAudEventBufferDescriptor'{eventName = Name1,
3684%% 				 streamID  = SID1},
3685%%   #'IndAudEventBufferDescriptor'{eventName = Name2,
3686%% 				 streamID  = SID2}) ->
3687%%     chk_PkgdName(Name1, Name2),
3688%%     chk_opt_StreamID(SID1, SID2),
3689%%     ok;
3690%% chk_IndAudEventBufferDescriptor(D1, D2) ->
3691%%     wrong_type('IndAudEventBufferDescriptor', D1, D2).
3692
3693
3694%% %% -- IndAudSignalsDescriptor --
3695
3696%% is_IndAudSignalsDescriptor({Tag, Val}) ->
3697%%     is_IndAudSignalsDescriptor_tag(Tag) andalso
3698%% 	is_IndAudSignalsDescriptor_val(Tag, Val);
3699%% is_IndAudSignalsDescriptor(_) ->
3700%%     false.
3701
3702%% is_IndAudSignalsDescriptor_tag(Tag) ->
3703%%     Tags = [signal, seqSigList],
3704%%     lists:member(Tag, Tags).
3705
3706%% is_IndAudSignalsDescriptor_val(signal, Val) ->
3707%%     is_IndAudSignal(Val);
3708%% is_IndAudSignalsDescriptor_val(seqSigList, Val) ->
3709%%     is_IndAudSeqSigList(Val).
3710
3711%% chk_IndAudSignalsDescriptor(D, D) ->
3712%%     chk_type(fun is_IndAudSignalsDescriptor/1, 'IndAudSignalsDescriptor', D);
3713%% chk_IndAudSignalsDescriptor({Tag, Val1} = D1, {Tag, Val2} = D2) ->
3714%%     case (is_IndAudSignalsDescriptor_tag(Tag) andalso
3715%% 	  is_IndAudSignalsDescriptor_val(Tag, Val1) andalso
3716%% 	  is_IndAudSignalsDescriptor_val(Tag, Val2)) of
3717%% 	true ->
3718%% 	    chk_IndAudSignalsDescriptor_val(Tag, Val1, Val2);
3719%% 	false ->
3720%% 	    wrong_type('IndAudSignalsDescriptor', D1, D2)
3721%%     end;
3722%% chk_IndAudSignalsDescriptor({Tag1, Val1} = D1, {Tag2, Val2} = D2) ->
3723%%     case ((is_IndAudSignalsDescriptor_tag(Tag1) andalso
3724%% 	   is_IndAudSignalsDescriptor_val(Tag1, Val1)) andalso
3725%% 	  (is_IndAudSignalsDescriptor_tag(Tag2) andalso
3726%% 	   is_IndAudSignalsDescriptor_val(Tag2, Val2))) of
3727%% 	true ->
3728%% 	    not_equal('IndAudSignalsDescriptor', D1, D2);
3729%% 	false ->
3730%% 	    wrong_type('IndAudSignalsDescriptor', D1, D2)
3731%%     end;
3732%% chk_IndAudSignalsDescriptor(D1, D2) ->
3733%%     wrong_type('IndAudSignalsDescriptor', D1, D2).
3734
3735%% chk_IndAudSignalsDescriptor_val(signal, Val1, Val2) ->
3736%%     chk_IndAudSignal(Val1, Val2);
3737%% chk_IndAudSignalsDescriptor_val(seqSigList, Val1, Val2) ->
3738%%     chk_IndAudSeqSigList(Val1, Val2).
3739
3740
3741%% %% -- IndAudSeqSigList --
3742
3743%% is_IndAudSeqSigList(#'IndAudSeqSigList'{id         = ID,
3744%% 					signalList = SL}) ->
3745%%     is_IndAudSeqSigList_id(ID) andalso is_opt_IndAudSignal(SL);
3746%% is_IndAudSeqSigList(_) ->
3747%%     false.
3748
3749%% is_IndAudSeqSigList_id(ID) -> is_INTEGER(ID, {range, 0, 65535}).
3750
3751%% chk_IndAudSeqSigList(L, L) ->
3752%%     chk_type(fun is_IndAudSeqSigList/1, 'IndAudSeqSigList', L);
3753%% chk_IndAudSeqSigList(#'IndAudSeqSigList'{id         = ID1,
3754%% 					 signalList = SL1},
3755%% 		     #'IndAudSeqSigList'{id         = ID2,
3756%% 					 signalList = SL2}) ->
3757%%     chk_IndAudSeqSigList_id(ID1, ID2),
3758%%     chk_opt_IndAudSignal(SL1, SL2),
3759%%     ok;
3760%% chk_IndAudSeqSigList(L1, L2) ->
3761%%     wrong_type('IndAudSeqSigList', L1, L2).
3762
3763%% chk_IndAudSeqSigList_id(ID, ID) ->
3764%%     chk_type(fun is_IndAudSeqSigList_id/1, 'IndAudSeqSigList_id', ID);
3765%% chk_IndAudSeqSigList_id(ID1, ID2) ->
3766%%     case (is_IndAudSeqSigList_id(ID1) andalso
3767%% 	  is_IndAudSeqSigList_id(ID2)) of
3768%% 	true ->
3769%% 	    not_equal('IndAudSeqSigList_id', ID1, ID2);
3770%% 	false ->
3771%% 	    wrong_type('IndAudSeqSigList_id', ID1, ID2)
3772%%     end.
3773
3774
3775%% %% -- IndAudSignal --
3776
3777%% is_opt_IndAudSignal(asn1_NOVALUE) ->
3778%%     true;
3779%% is_opt_IndAudSignal(V) ->
3780%%     is_IndAudSignal(V).
3781
3782%% is_IndAudSignal(#'IndAudSignal'{signalName = Name,
3783%% 				streamID   = SID}) ->
3784%%     is_PkgdName(Name) andalso is_opt_StreamID(SID);
3785%% is_IndAudSignal(_) ->
3786%%     false.
3787
3788%% chk_opt_IndAudSignal(asn1_NOVALUE, asn1_NOVALUE) ->
3789%%     ok;
3790%% chk_opt_IndAudSignal(S1, S2) ->
3791%%     chk_IndAudSignal(S1, S2).
3792
3793%% chk_IndAudSignal(S, S) ->
3794%%     chk_type(fun is_IndAudSignal/1, 'IndAudSignal', S);
3795%% chk_IndAudSignal(#'IndAudSignal'{signalName = Name1,
3796%% 				 streamID   = SID1},
3797%% 		 #'IndAudSignal'{signalName = Name2,
3798%% 				 streamID   = SID2}) ->
3799%%     chk_PkgdName(Name1, Name2),
3800%%     chk_opt_StreamID(SID1, SID2),
3801%%     ok;
3802%% chk_IndAudSignal(S1, S2) ->
3803%%     wrong_type('IndAudSignal', S1, S2).
3804
3805
3806%% %% -- IndAudDigitMapDescriptor --
3807
3808%% is_IndAudDigitMapDescriptor(
3809%%   #'IndAudDigitMapDescriptor'{digitMapName = Name}) ->
3810%%     is_opt_DigitMapName(Name);
3811%% is_IndAudDigitMapDescriptor(_) ->
3812%%     false.
3813
3814%% chk_IndAudDigitMapDescriptor(D, D) ->
3815%%     chk_type(fun is_IndAudDigitMapDescriptor/1, 'IndAudDigitMapDescriptor', D);
3816%% chk_IndAudDigitMapDescriptor(
3817%%   #'IndAudDigitMapDescriptor'{digitMapName = Name1},
3818%%   #'IndAudDigitMapDescriptor'{digitMapName = Name2}) ->
3819%%     validate(fun() -> chk_opt_DigitMapName(Name1, Name2) end,
3820%% 	     'IndAudDigitMapDescriptor'),
3821%%     ok;
3822%% chk_IndAudDigitMapDescriptor(D1, D2) ->
3823%%     wrong_type('IndAudDigitMapDescriptor', D1, D2).
3824
3825
3826%% %% -- IndAudStatisticsDescriptor --
3827
3828%% is_IndAudStatisticsDescriptor(
3829%%   #'IndAudStatisticsDescriptor'{statName = Name}) ->
3830%%     is_PkgdName(Name);
3831%% is_IndAudStatisticsDescriptor(_) ->
3832%%     false.
3833
3834%% chk_IndAudStatisticsDescriptor(D, D) ->
3835%%     chk_type(fun is_IndAudStatisticsDescriptor/1,
3836%% 	     'IndAudStatisticsDescriptor', D);
3837%% chk_IndAudStatisticsDescriptor(
3838%%   #'IndAudStatisticsDescriptor'{statName = Name1},
3839%%   #'IndAudStatisticsDescriptor'{statName = Name2}) ->
3840%%     validate(fun() -> chk_PkgdName(Name1, Name2) end,
3841%% 	     'IndAudStatisticsDescriptor'),
3842%%     ok;
3843%% chk_IndAudStatisticsDescriptor(D1, D2) ->
3844%%     wrong_type('IndAudStatisticsDescriptor', D1, D2).
3845
3846
3847%% %% -- IndAudPackagesDescriptor --
3848
3849%% is_IndAudPackagesDescriptor(
3850%%   #'IndAudPackagesDescriptor'{packageName    = Name,
3851%% 			      packageVersion = Ver}) ->
3852%%     is_Name(Name) andalso is_IndAudPackagesDescriptor_packageVersion(Ver);
3853%% is_IndAudPackagesDescriptor(_) ->
3854%%     false.
3855
3856%% is_IndAudPackagesDescriptor_packageVersion(V) ->
3857%%      is_INTEGER(V, {range, 0, 99}).
3858
3859%% chk_IndAudPackagesDescriptor(
3860%%   #'IndAudPackagesDescriptor'{packageName    = Name1,
3861%% 			      packageVersion = Ver1},
3862%%   #'IndAudPackagesDescriptor'{packageName    = Name2,
3863%% 			      packageVersion = Ver2}) ->
3864%%     validate(fun() -> chk_Name(Name1, Name2) end, 'IndAudPackagesDescriptor'),
3865%%     chk_IndAudPackagesDescriptor_packageVersion(Ver1, Ver2),
3866%%     ok;
3867%% chk_IndAudPackagesDescriptor(D1, D2) ->
3868%%     wrong_type('IndAudPackagesDescriptor', D1, D2).
3869
3870%% chk_IndAudPackagesDescriptor_packageVersion(V, V) ->
3871%%     chk_type(fun is_IndAudPackagesDescriptor_packageVersion/1,
3872%% 	     'IndAudPackagesDescriptor_packageVersion', V);
3873%% chk_IndAudPackagesDescriptor_packageVersion(V1, V2) ->
3874%%     case (is_IndAudPackagesDescriptor_packageVersion(V1) andalso
3875%% 	  is_IndAudPackagesDescriptor_packageVersion(V2)) of
3876%% 	true ->
3877%% 	    not_equal('IndAudPackagesDescriptor_packageVersion', V1, V2);
3878%% 	false ->
3879%% 	    wrong_type('IndAudPackagesDescriptor_packageVersion', V1, V2)
3880%%     end.
3881
3882
3883%% %% -- NotifyRequest --
3884
3885%% is_NotifyRequest(#'NotifyRequest'{terminationID            = Tids,
3886%% 				  observedEventsDescriptor = OED,
3887%% 				  errorDescriptor          = ED}) ->
3888%%     is_TerminationIDList(Tids) andalso
3889%% 	is_ObservedEventsDescriptor(OED) andalso
3890%% 	is_opt_ErrorDescriptor(ED);
3891%% is_NotifyRequest(_) ->
3892%%     false.
3893
3894%% chk_NotifyRequest(#'NotifyRequest'{terminationID            = Tids1,
3895%% 				   observedEventsDescriptor = OED1,
3896%% 				   errorDescriptor          = ED1},
3897%% 		  #'NotifyRequest'{terminationID            = Tids2,
3898%% 				   observedEventsDescriptor = OED2,
3899%% 				   errorDescriptor          = ED2}) ->
3900%%     validate(fun() -> chk_TerminationIDList(Tids1, Tids2) end,
3901%% 	     'NotifyRequest'),
3902%%     validate(fun() -> chk_ObservedEventsDescriptor(OED1, OED2) end,
3903%% 	     'NotifyRequest'),
3904%%     validate(fun() -> chk_opt_ErrorDescriptor(ED1, ED2) end,
3905%% 	     'NotifyRequest'),
3906%%     ok;
3907%% chk_NotifyRequest(NR1, NR2) ->
3908%%     wrong_type('NotifyRequest', NR1, NR2).
3909
3910
3911%% %% -- NotifyReply --
3912
3913%% is_NotifyReply(#'NotifyReply'{terminationID   = Tids,
3914%% 			      errorDescriptor = ED}) ->
3915%%     is_TerminationIDList(Tids) andalso is_opt_ErrorDescriptor(ED);
3916%% is_NotifyReply(_) ->
3917%%     false.
3918
3919%% chk_NotifyReply(#'NotifyReply'{terminationID   = Tids1,
3920%% 			       errorDescriptor = ED1},
3921%% 		#'NotifyReply'{terminationID   = Tids2,
3922%% 			       errorDescriptor = ED2}) ->
3923%%     validate(fun() -> chk_TerminationIDList(Tids1, Tids2) end, 'NotifyReply'),
3924%%     validate(fun() -> chk_opt_ErrorDescriptor(ED1, ED2) end, 'NotifyReply'),
3925%%     ok;
3926%% chk_NotifyReply(NR1, NR2) ->
3927%%     wrong_type('NotifyReply', NR1, NR2).
3928
3929
3930%% %% -- ObservedEventsDescriptor --
3931
3932%% is_ObservedEventsDescriptor(
3933%%   #'ObservedEventsDescriptor'{requestId        = RID,
3934%% 			      observedEventLst = OEL}) ->
3935%%     is_RequestID(RID) andalso
3936%% 	is_ObservedEventsDescriptor_observedEventLst(OEL);
3937%% is_ObservedEventsDescriptor(_) ->
3938%%     false.
3939
3940%% is_ObservedEventsDescriptor_observedEventLst([]) ->
3941%%     true;
3942%% is_ObservedEventsDescriptor_observedEventLst([H|T]) ->
3943%%     is_ObservedEvent(H) andalso
3944%% 	is_ObservedEventsDescriptor_observedEventLst(T);
3945%% is_ObservedEventsDescriptor_observedEventLst(_) ->
3946%%     false.
3947
3948%% chk_ObservedEventsDescriptor(
3949%%   #'ObservedEventsDescriptor'{requestId        = RID1,
3950%% 			      observedEventLst = OEL1},
3951%%   #'ObservedEventsDescriptor'{requestId        = RID2,
3952%% 			      observedEventLst = OEL2}) ->
3953%%     validate(fun() -> chk_RequestID(RID1, RID2) end,
3954%% 	     'ObservedEventsDescriptor'),
3955%%     validate(
3956%%       fun() ->
3957%% 	      chk_ObservedEventsDescriptor_observedEventLst(OEL1, OEL2)
3958%%       end,
3959%%       'ObservedEventsDescriptor'),
3960%%     ok;
3961%% chk_ObservedEventsDescriptor(D1, D2) ->
3962%%     wrong_type('ObservedEventsDescriptor', D1, D2).
3963
3964%% chk_ObservedEventsDescriptor_observedEventLst([], []) ->
3965%%     ok;
3966%% chk_ObservedEventsDescriptor_observedEventLst([] = L1, L2) ->
3967%%     not_equal('ObservedEventsDescriptor_observedEventLst', L1, L2);
3968%% chk_ObservedEventsDescriptor_observedEventLst(L1, [] = L2) ->
3969%%     not_equal('ObservedEventsDescriptor_observedEventLst', L1, L2);
3970%% chk_ObservedEventsDescriptor_observedEventLst([H|T1], [H|T2]) ->
3971%%     case is_ObservedEvent(H) of
3972%% 	true ->
3973%% 	    chk_ObservedEventsDescriptor_observedEventLst(T1, T2);
3974%% 	false ->
3975%% 	    wrong_type('ObservedEventsDescriptor_observedEventLst_val', H)
3976%%     end;
3977%% chk_ObservedEventsDescriptor_observedEventLst([H1|T1], [H2|T2]) ->
3978%%     validate(fun() -> chk_ObservedEvent(H1, H2) end,
3979%% 	     'ObservedEventsDescriptor_observedEventLst_val'),
3980%%     chk_ObservedEventsDescriptor_observedEventLst(T1, T2);
3981%% chk_ObservedEventsDescriptor_observedEventLst(L1, L2) ->
3982%%     wrong_type('ObservedEventsDescriptor_observedEventLst', L1, L2).
3983
3984
3985%% %% -- ObservedEvent --
3986
3987%% is_ObservedEvent(#'ObservedEvent'{eventName    = Name,
3988%% 				  streamID     = SID,
3989%% 				  eventParList = EPL,
3990%% 				  timeNotation = TN}) ->
3991%%     is_EventName(Name) andalso
3992%% 	is_opt_StreamID(SID) andalso
3993%% 	is_ObservedEvent_eventParList(EPL) andalso
3994%% 	is_opt_TimeNotation(TN);
3995%% is_ObservedEvent(_) ->
3996%%     false.
3997
3998%% is_ObservedEvent_eventParList([]) ->
3999%%     true;
4000%% is_ObservedEvent_eventParList([H|T]) ->
4001%%     is_EventParameter(H) andalso is_ObservedEvent_eventParList(T);
4002%% is_ObservedEvent_eventParList(_) ->
4003%%     false.
4004
4005%% chk_ObservedEvent(E, E) ->
4006%%     chk_type(fun is_ObservedEvent/1, 'ObservedEvent', E);
4007%% chk_ObservedEvent(#'ObservedEvent'{eventName    = Name1,
4008%% 				   streamID     = SID1,
4009%% 				   eventParList = EPL1,
4010%% 				   timeNotation = TN1},
4011%% 		  #'ObservedEvent'{eventName    = Name2,
4012%% 				   streamID     = SID2,
4013%% 				   eventParList = EPL2,
4014%% 				   timeNotation = TN2}) ->
4015%%     validate(fun() -> chk_EventName(Name1, Name2) end, 'ObservedEvent'),
4016%%     validate(fun() -> chk_opt_StreamID(SID1, SID2) end, 'ObservedEvent'),
4017%%     chk_ObservedEvent_eventParList(EPL1, EPL2),
4018%%     validate(fun() -> chk_opt_TimeNotation(TN1, TN2) end, 'ObservedEvent'),
4019%%     ok;
4020%% chk_ObservedEvent(E1, E2) ->
4021%%     wrong_type('ObservedEvent', E1, E2).
4022
4023%% chk_ObservedEvent_eventParList([], []) ->
4024%%     ok;
4025%% chk_ObservedEvent_eventParList([] = EPL1, EPL2) ->
4026%%     not_equal('ObservedEvent_eventParList', EPL1, EPL2);
4027%% chk_ObservedEvent_eventParList(EPL1, [] = EPL2) ->
4028%%     not_equal('ObservedEvent_eventParList', EPL1, EPL2);
4029%% chk_ObservedEvent_eventParList([H|T1], [H|T2]) ->
4030%%     case is_EventParameter(H) of
4031%% 	true ->
4032%% 	    chk_ObservedEvent_eventParList(T1, T2);
4033%% 	false ->
4034%% 	    wrong_type('ObservedEvent_eventParList_val', H)
4035%%     end;
4036%% chk_ObservedEvent_eventParList([H1|T1], [H2|T2]) ->
4037%%     validate(fun() -> chk_EventParameter(H1, H2) end,
4038%% 	     'ObservedEvent_eventParList'),
4039%%     chk_ObservedEvent_eventParList(T1, T2);
4040%% chk_ObservedEvent_eventParList(L1, L2) ->
4041%%     wrong_type('ObservedEvent_eventParList', L1, L2).
4042
4043
4044%% %% -- EventName --
4045
4046is_EventName(N) -> is_PkgdName(N).
4047
4048%% chk_EventName(N, N) ->
4049%%     chk_type(fun is_EventName/1, 'EventName', N);
4050%% chk_EventName(N1, N2) ->
4051%%     case (is_EventName(N1) andalso is_EventName(N2)) of
4052%% 	true ->
4053%% 	    not_equal('EventName', N1, N2);
4054%% 	false ->
4055%% 	    wrong_type('EventName', N1, N2)
4056%%     end.
4057
4058
4059%% %% -- EventParameter --
4060
4061is_EventParameter(#'EventParameter'{eventParameterName = Name,
4062				    value              = Val,
4063				    extraInfo          = EI}) ->
4064    d("is_EventParameter -> entery with"
4065      "~n   Name: ~p"
4066      "~n   Val:  ~p"
4067      "~n   EI:   ~p", [Name, Val, EI]),
4068    is_Name(Name) andalso
4069	is_Value(Val) andalso
4070	is_EventParameter_extraInfo(EI);
4071is_EventParameter(_) ->
4072    false.
4073
4074is_EventParameter_extraInfo(asn1_NOVALUE) ->
4075    true;
4076is_EventParameter_extraInfo({Tag, Val}) ->
4077    is_EventParameter_extraInfo_tag(Tag) andalso
4078	is_EventParameter_extraInfo_val(Tag, Val);
4079is_EventParameter_extraInfo(_) ->
4080    false.
4081
4082is_EventParameter_extraInfo_tag(Tag) ->
4083    Tags = [relation, range, sublist],
4084    lists:member(Tag, Tags).
4085
4086is_EventParameter_extraInfo_val(relation, Val) ->
4087    is_Relation(Val);
4088is_EventParameter_extraInfo_val(range, Val) ->
4089    is_BOOLEAN(Val);
4090is_EventParameter_extraInfo_val(sublist, Val) ->
4091    is_BOOLEAN(Val).
4092
4093%% chk_EventParameter(#'EventParameter'{eventParameterName = Name1,
4094%% 				     value              = Val1,
4095%% 				     extraInfo          = EI1},
4096%% 		   #'EventParameter'{eventParameterName = Name2,
4097%% 				     value              = Val2,
4098%% 				     extraInfo          = EI2}) ->
4099%%     validate(fun() -> chk_Name(Name1, Name2) end, 'EventParameter'),
4100%%     validate(fun() -> chk_Value(Val1, Val2)  end, 'EventParameter'),
4101%%     chk_EventParameter_extraInfo(EI1, EI2),
4102%%     ok;
4103%% chk_EventParameter(P1, P2) ->
4104%%     wrong_type('EventParameter', P1, P2).
4105
4106%% chk_EventParameter_extraInfo(asn1_NOVALUE, asn1_NOVALUE) ->
4107%%     ok;
4108%% chk_EventParameter_extraInfo(EI, EI) ->
4109%%     chk_type(fun is_EventParameter_extraInfo/1,
4110%% 	     'EventParameter_extraInfo', EI);
4111%% chk_EventParameter_extraInfo({Tag, Val1} = EI1, {Tag, Val2} = EI2) ->
4112%%     case (is_EventParameter_extraInfo_tag(Tag) andalso
4113%% 	  is_EventParameter_extraInfo_val(Tag, Val1) andalso
4114%% 	  is_EventParameter_extraInfo_val(Tag, Val2)) of
4115%% 	true ->
4116%% 	    chk_EventParameter_extraInfo_val(Tag, Val1, Val2);
4117%% 	false ->
4118%% 	    wrong_type('EventParameter_extraInfo', EI1, EI2)
4119%%     end;
4120%% chk_EventParameter_extraInfo({Tag1, Val1} = EI1, {Tag2, Val2} = EI2) ->
4121%%     case ((is_EventParameter_extraInfo_tag(Tag1) andalso
4122%% 	   is_EventParameter_extraInfo_val(Tag1, Val1)) andalso
4123%% 	  (is_EventParameter_extraInfo_tag(Tag2) andalso
4124%% 	   is_EventParameter_extraInfo_val(Tag2, Val2))) of
4125%% 	true ->
4126%% 	    not_equal('EventParameter_extraInfo', EI1, EI2);
4127%% 	false ->
4128%% 	    wrong_type('EventParameter_extraInfo', EI1, EI2)
4129%%     end;
4130%% chk_EventParameter_extraInfo(EI1, EI2) ->
4131%%     wrong_type('EventParameter_extraInfo', EI1, EI2).
4132
4133%% chk_EventParameter_extraInfo_val(relation, Val1, Val2) ->
4134%%     validate(fun() -> chk_Relation(Val1, Val2) end,
4135%% 	     'EventParameter_extraInfo_val');
4136%% chk_EventParameter_extraInfo_val(range, Val1, Val2) ->
4137%%     validate(fun() -> chk_BOOLEAN(Val1, Val2) end,
4138%% 	     'EventParameter_extraInfo_val');
4139%% chk_EventParameter_extraInfo_val(sublist, Val1, Val2) ->
4140%%     validate(fun() -> chk_BOOLEAN(Val1, Val2) end,
4141%% 	     'EventParameter_extraInfo_val').
4142
4143
4144%% %% -- ServiceChangeRequest --
4145
4146%% is_ServiceChangeRequest(#'ServiceChangeRequest'{terminationID      = Tids,
4147%% 						serviceChangeParms = Parms}) ->
4148%%     is_TerminationIDList(Tids) andalso is_ServiceChangeParm(Parms);
4149%% is_ServiceChangeRequest(_) ->
4150%%     false.
4151
4152%% chk_ServiceChangeRequest(R, R) ->
4153%%     chk_type(fun is_ServiceChangeRequest/1, 'ServiceChangeRequest', R);
4154%% chk_ServiceChangeRequest(
4155%%   #'ServiceChangeRequest'{terminationID      = Tids1,
4156%% 			  serviceChangeParms = Parms1},
4157%%   #'ServiceChangeRequest'{terminationID      = Tids2,
4158%% 			  serviceChangeParms = Parms2}) ->
4159%%     validate(fun() -> chk_TerminationIDList(Tids1, Tids2) end,
4160%% 	     'ServiceChangeRequest'),
4161%%     validate(fun() -> chk_ServiceChangeParm(Parms1, Parms2) end,
4162%% 	     'ServiceChangeRequest'),
4163%%     ok;
4164%% chk_ServiceChangeRequest(R1, R2) ->
4165%%     wrong_type('ServiceChangeRequest', R1, R2).
4166
4167
4168%% %% -- ServiceChangeReply --
4169
4170%% is_ServiceChangeReply(#'ServiceChangeReply'{terminationID       = Tids,
4171%% 					    serviceChangeResult = Res}) ->
4172%%     is_TerminationIDList(Tids) andalso is_ServiceChangeResult(Res);
4173%% is_ServiceChangeReply(_) ->
4174%%     false.
4175
4176%% chk_ServiceChangeReply(R, R) ->
4177%%     chk_type(fun is_ServiceChangeReply/1, 'ServiceChangeReply', R);
4178%% chk_ServiceChangeReply(
4179%%   #'ServiceChangeReply'{terminationID       = Tids1,
4180%% 			serviceChangeResult = Res1},
4181%%   #'ServiceChangeReply'{terminationID       = Tids2,
4182%% 			serviceChangeResult = Res2}) ->
4183%%     validate(fun() -> chk_TerminationIDList(Tids1, Tids2) end,
4184%% 	     'ServiceChangeReply'),
4185%%     validate(fun() -> chk_ServiceChangeResult(Res1, Res2) end,
4186%% 	     'ServiceChangeReply'),
4187%%     ok;
4188%% chk_ServiceChangeReply(R1, R2) ->
4189%%     wrong_type('ServiceChangeReply', R1, R2).
4190
4191
4192%% %% -- ServiceChangeResult --
4193
4194%% is_ServiceChangeResult({Tag, Val}) ->
4195%%     is_ServiceChangeResult_tag(Tag) andalso
4196%% 	is_ServiceChangeResult_val(Tag, Val);
4197%% is_ServiceChangeResult(_) ->
4198%%     false.
4199
4200%% is_ServiceChangeResult_tag(Tag) ->
4201%%     Tags = [errorDescriptor, serviceChangeResParms],
4202%%     lists:member(Tag, Tags).
4203
4204%% is_ServiceChangeResult_val(errorDescriptor, Val) ->
4205%%     is_ErrorDescriptor(Val);
4206%% is_ServiceChangeResult_val(serviceChangeResParms, Val) ->
4207%%     is_ServiceChangeResParm(Val).
4208
4209%% chk_ServiceChangeResult(Res, Res) ->
4210%%     chk_type(fun is_ServiceChangeResult/1, 'ServiceChangeResult', Res);
4211%% chk_ServiceChangeResult({Tag, Val1} = Res1, {Tag, Val2} = Res2) ->
4212%%     case (is_ServiceChangeResult_tag(Tag) andalso
4213%% 	  is_ServiceChangeResult_val(Tag, Val1) andalso
4214%% 	  is_ServiceChangeResult_val(Tag, Val2)) of
4215%% 	true ->
4216%% 	    chk_ServiceChangeResult_val(Tag, Val1, Val2);
4217%% 	false ->
4218%% 	    wrong_type('ServiceChangeResult', Res1, Res2)
4219%%     end;
4220%% chk_ServiceChangeResult({Tag1, Val1} = Res1, {Tag2, Val2} = Res2) ->
4221%%     case ((is_ServiceChangeResult_tag(Tag1) andalso
4222%% 	   is_ServiceChangeResult_val(Tag1, Val1)) andalso
4223%% 	  (is_ServiceChangeResult_tag(Tag2) andalso
4224%% 	   is_ServiceChangeResult_val(Tag2, Val2))) of
4225%% 	true ->
4226%% 	    not_equal('ServiceChangeResult', Res1, Res2);
4227%% 	false ->
4228%% 	    wrong_type('ServiceChangeResult', Res1, Res2)
4229%%     end;
4230%% chk_ServiceChangeResult(Res1, Res2) ->
4231%%     wrong_type('ServiceChangeResult', Res1, Res2).
4232
4233%% chk_ServiceChangeResult_val(errorDescriptor, Val1, Val2) ->
4234%%     validate(fun() -> chk_ErrorDescriptor(Val1, Val2) end,
4235%% 	     'ServiceChangeResult');
4236%% chk_ServiceChangeResult_val(serviceChangeResParms, Val1, Val2) ->
4237%%     validate(fun() -> chk_ServiceChangeResParm(Val1, Val2) end,
4238%% 	     'ServiceChangeResult').
4239
4240
4241%% %% -- WildcardField --
4242
4243%% is_WildcardField(WF) -> is_OCTET_STRING(WF, {exact, 1}).
4244
4245%% chk_WildcardField(WF, WF) ->
4246%%     case is_WildcardField(WF) of
4247%% 	true ->
4248%% 	    ok;
4249%% 	false ->
4250%% 	    wrong_type('WildcardField', WF)
4251%%     end;
4252%% chk_WildcardField(WF1, WF2) ->
4253%%     case (is_WildcardField(WF1) andalso is_WildcardField(WF2)) of
4254%% 	true ->
4255%% 	    not_equal('WildcardField', WF1, WF2);
4256%% 	false ->
4257%% 	    wrong_type('WildcardField', WF1, WF2)
4258%%     end.
4259
4260
4261%% %% -- TerminationID --
4262
4263%% is_TerminationID(#'TerminationID'{wildcard = W,
4264%% 				  id       = ID}) ->
4265%%     is_TerminationID_wildcard(W) andalso is_TerminationID_id(ID);
4266%% is_TerminationID(#megaco_term_id{contains_wildcards = _W,
4267%% 				 id                 = _ID}) ->
4268%%     true; % What are the types?
4269%% is_TerminationID(_) ->
4270%%     false.
4271
4272%% is_TerminationID_wildcard([]) ->
4273%%     true;
4274%% is_TerminationID_wildcard([H|T]) ->
4275%%     is_WildcardField(H) andalso is_TerminationID_wildcard(T);
4276%% is_TerminationID_wildcard(_) ->
4277%%     false.
4278
4279%% is_TerminationID_id(ID) -> is_OCTET_STRING(ID, {range, 1, 8}).
4280
4281%% chk_TerminationID(Id,Id) ->
4282%%     chk_type(fun is_TerminationID/1, 'TerminationID', Id);
4283%% chk_TerminationID(#'TerminationID'{wildcard = W1,
4284%%                                    id       = I1},
4285%%                   #'TerminationID'{wildcard = W2,
4286%%                                    id       = I2}) ->
4287%%     chk_TerminationID_wildcard(W1, W2),
4288%%     chk_TerminationID_id(I1, I2),
4289%%     ok;
4290%% chk_TerminationID(#megaco_term_id{contains_wildcards = W1,
4291%%                                   id                 = I1},
4292%%                   #megaco_term_id{contains_wildcards = W2,
4293%%                                   id                 = I2}) ->
4294%%     chk_TerminationID_wildcard(W1, W2),
4295%%     chk_TerminationID_id(I1, I2),
4296%%     ok;
4297%% chk_TerminationID(Tid1, Tid2) ->
4298%%     wrong_type('TerminationID', Tid1, Tid2).
4299
4300%% chk_TerminationID_wildcard([], []) ->
4301%%     ok;
4302%% chk_TerminationID_wildcard([] = WF1, WF2) ->
4303%%     not_equal('TerminationID_wildcard', WF1, WF2);
4304%% chk_TerminationID_wildcard(WF1, [] = WF2) ->
4305%%     not_equal('TerminationID_wildcard', WF1, WF2);
4306%% chk_TerminationID_wildcard([H|T1], [H|T2]) ->
4307%%     case is_WildcardField(H) of
4308%% 	true ->
4309%% 	    chk_TerminationID_wildcard(T1, T2);
4310%% 	false ->
4311%% 	    wrong_type('TerminationID_wildcard_val', H)
4312%%     end;
4313%% chk_TerminationID_wildcard([H1|T1], [H2|T2]) ->
4314%%     validate(fun() -> chk_WildcardField(H1, H2) end,
4315%% 	     'TerminationID_wildcard_val'),
4316%%     chk_TerminationID_wildcard(T1, T2);
4317%% chk_TerminationID_wildcard(WF1,WF2) ->
4318%%     not_equal('TerminationId_wildcard', WF1, WF2).
4319
4320%% chk_TerminationID_id(Id, Id) ->
4321%%     case is_OCTET_STRING(Id, {range, 1, 8}) of
4322%% 	true ->
4323%% 	    ok;
4324%% 	false ->
4325%% 	    wrong_type('TerminationID_id', Id, Id)
4326%%     end;
4327%% chk_TerminationID_id(Id1, Id2) ->
4328%%     not_equal(terminationId_id, Id1, Id2).
4329
4330
4331%% %% -- TerminationIDList --
4332
4333%% is_TerminationIDList([]) ->
4334%%     true;
4335%% is_TerminationIDList([H|T]) ->
4336%%     is_TerminationID(H) andalso is_TerminationIDList(T);
4337%% is_TerminationIDList(_) ->
4338%%     false.
4339
4340%% chk_TerminationIDList([], []) ->
4341%%     ok;
4342%% chk_TerminationIDList([] = L1, L2) ->
4343%%     not_equal('TerminationIDList', L1, L2);
4344%% chk_TerminationIDList(L1, [] = L2) ->
4345%%     not_equal('TerminationIDList', L1, L2);
4346%% chk_TerminationIDList([H|T1], [H|T2]) ->
4347%%     case is_TerminationID(H) of
4348%% 	true ->
4349%% 	    chk_TerminationIDList(T1, T2);
4350%% 	false ->
4351%% 	    wrong_type('TerminationIDList', H)
4352%%     end;
4353%% chk_TerminationIDList([H1|T1], [H2|T2]) ->
4354%%     validate(fun() -> chk_TerminationID(H1, H2) end, 'TerminationIDList'),
4355%%     chk_TerminationIDList(T1, T2);
4356%% chk_TerminationIDList(L1, L2) ->
4357%%     wrong_type('TerminationIDList', L1, L2).
4358
4359
4360%% %% -- MediaDescriptor --
4361
4362%% is_MediaDescriptor(#'MediaDescriptor'{termStateDescr = TSD,
4363%% 				      streams        = S}) ->
4364%%     is_opt_TerminationStateDescriptor(TSD) andalso
4365%% 	is_MediaDescriptor_streams(S);
4366%% is_MediaDescriptor(_) ->
4367%%     false.
4368
4369%% is_MediaDescriptor_streams(asn1_NOVALUE) ->
4370%%     true;
4371%% is_MediaDescriptor_streams({Tag, Val}) ->
4372%%     is_MediaDescriptor_streams_tag(Tag) andalso
4373%% 	is_MediaDescriptor_streams_val(Tag, Val);
4374%% is_MediaDescriptor_streams(_) ->
4375%%     false.
4376
4377%% is_MediaDescriptor_streams_tag(Tag) ->
4378%%     Tags = [oneStream, multiStream],
4379%%     lists:member(Tag, Tags).
4380
4381%% is_MediaDescriptor_streams_val(oneStream, SP) ->
4382%%     is_StreamParms(SP);
4383%% is_MediaDescriptor_streams_val(multiStream, SDL) ->
4384%%     is_MediaDescriptor_multiStream(SDL).
4385
4386%% is_MediaDescriptor_multiStream([]) ->
4387%%     true;
4388%% is_MediaDescriptor_multiStream([H|T]) ->
4389%%     is_StreamDescriptor(H) andalso is_MediaDescriptor_multiStream(T);
4390%% is_MediaDescriptor_multiStream(_) ->
4391%%     false.
4392
4393%% chk_MediaDescriptor(D, D) ->
4394%%     chk_type(fun is_MediaDescriptor/1, 'MediaDescriptor', D);
4395%% chk_MediaDescriptor(#'MediaDescriptor'{termStateDescr = TSD1,
4396%% 				       streams        = S1},
4397%% 		    #'MediaDescriptor'{termStateDescr = TSD2,
4398%% 				       streams        = S2}) ->
4399%%     validate(
4400%%       fun() ->
4401%% 	      chk_opt_TerminationStateDescriptor(TSD1, TSD2)
4402%%       end,
4403%%       'MediaDescriptor'),
4404%%     validate(
4405%%       fun() ->
4406%% 	      chk_MediaDescriptor_streams(S1, S2)
4407%%       end,
4408%%       'MediaDescriptor'),
4409%%     ok;
4410%% chk_MediaDescriptor(D1, D2) ->
4411%%     wrong_type('MediaDescriptor', D1, D2).
4412
4413
4414%% chk_MediaDescriptor_streams(asn1_NOVALUE, asn1_NOVALUE) ->
4415%%     ok;
4416%% chk_MediaDescriptor_streams({oneStream, SP1}, {oneStream, SP2}) ->
4417%%     validate(fun() ->
4418%% 		     chk_StreamParms(SP1, SP2)
4419%% 	     end,
4420%% 	     'MediaDescriptor_streams');
4421%% chk_MediaDescriptor_streams({multiStream, SDs1}, {multiStream, SDs2}) ->
4422%%     validate(fun() ->
4423%% 		     chk_MediaDescriptor_multiStream(SDs1, SDs2)
4424%% 	     end,
4425%% 	     'MediaDescriptor_streams');
4426%% chk_MediaDescriptor_streams(S1, S2) ->
4427%%     wrong_type('MediaDescriptor_streams', S1, S2).
4428
4429%% chk_MediaDescriptor_multiStream([], []) ->
4430%%     ok;
4431%% chk_MediaDescriptor_multiStream([] = MS1, MS2) ->
4432%%     not_equal('MediaDescriptor_multiStream', MS1, MS2);
4433%% chk_MediaDescriptor_multiStream(MS1, [] = MS2) ->
4434%%     not_equal('MediaDescriptor_multiStream', MS1, MS2);
4435%% chk_MediaDescriptor_multiStream([H|T1], [H|T2]) ->
4436%%     case is_StreamDescriptor(H) of
4437%% 	true ->
4438%% 	    chk_MediaDescriptor_multiStream(T1, T2);
4439%% 	false ->
4440%% 	    wrong_type('MediaDescriptor_multiStream_val', H)
4441%%     end;
4442%% chk_MediaDescriptor_multiStream([H1|T1], [H2|T2]) ->
4443%%     validate(fun() -> chk_StreamDescriptor(H1, H2) end,
4444%% 	     'MediaDescriptor_multiStream_val'),
4445%%     chk_MediaDescriptor_multiStream(T1, T2);
4446%% chk_MediaDescriptor_multiStream(MS1, MS2) ->
4447%%     wrong_type('MediaDescriptor_multiStream_val', MS1, MS2).
4448
4449
4450%% %% -- StreamDescriptor --
4451
4452%% is_StreamDescriptor(#'StreamDescriptor'{streamID    = SID,
4453%% 					streamParms = Parms}) ->
4454%%     is_StreamID(SID) andalso is_StreamParms(Parms);
4455%% is_StreamDescriptor(_) ->
4456%%     false.
4457
4458%% chk_StreamDescriptor(D, D) ->
4459%%     chk_type(fun is_StreamDescriptor/1, 'StreamDescriptor', D);
4460%% chk_StreamDescriptor(#'StreamDescriptor'{streamID    = SID1,
4461%% 					 streamParms = Parms1},
4462%% 		     #'StreamDescriptor'{streamID    = SID2,
4463%% 					 streamParms = Parms2}) ->
4464%%     validate(fun() -> chk_StreamID(SID1, SID2) end, 'StreamDescriptor'),
4465%%     validate(fun() -> chk_StreamParms(Parms1, Parms2) end, 'StreamDescriptor'),
4466%%     ok;
4467%% chk_StreamDescriptor(D1, D2) ->
4468%%     wrong_type('StreamDescriptor', D1, D2).
4469
4470
4471%% %% -- StreamParms --
4472
4473%% is_StreamParms(#'StreamParms'{localControlDescriptor = LCD,
4474%% 			      localDescriptor        = LD,
4475%% 			      remoteDescriptor       = RD}) ->
4476%%     is_opt_LocalControlDescriptor(LCD) andalso
4477%% 	is_opt_LocalRemoteDescriptor(LD) andalso
4478%% 	is_opt_LocalRemoteDescriptor(RD);
4479%% is_StreamParms(_) ->
4480%%     false.
4481
4482%% chk_StreamParms(SP, SP) ->
4483%%     chk_type(fun is_StreamParms/1, 'StreamParms', SP);
4484%% chk_StreamParms(#'StreamParms'{localControlDescriptor = LCD1,
4485%% 			       localDescriptor        = LD1,
4486%% 			       remoteDescriptor       = RD1},
4487%% 		#'StreamParms'{localControlDescriptor = LCD2,
4488%% 			       localDescriptor        = LD2,
4489%% 			       remoteDescriptor       = RD2}) ->
4490%%     chk_opt_LocalControlDescriptor(LCD1, LCD2),
4491%%     validate(fun() -> chk_opt_LocalRemoteDescriptor(LD1, LD2) end,
4492%% 	     localDescriptor),
4493%%     validate(fun() -> chk_opt_LocalRemoteDescriptor(RD1, RD2) end,
4494%% 	     remoteDescriptor),
4495%%     ok;
4496%% chk_StreamParms(P1, P2) ->
4497%%     wrong_type('StreamParms', P1, P2).
4498
4499
4500%% %% -- LocalControlDescriptor --
4501
4502%% is_opt_LocalControlDescriptor(asn1_NOVALUE) ->
4503%%     true;
4504%% is_opt_LocalControlDescriptor(D) ->
4505%%     is_LocalControlDescriptor(D).
4506
4507%% is_LocalControlDescriptor(#'LocalControlDescriptor'{streamMode    = SM,
4508%% 						    reserveValue  = RV,
4509%% 						    reserveGroup  = RG,
4510%% 						    propertyParms = PP}) ->
4511%%     is_opt_StreamMode(SM) andalso
4512%% 	is_opt_BOOLEAN(RV) andalso
4513%% 	is_opt_BOOLEAN(RG) andalso
4514%% 	is_LocalControlDescriptor_propertyParms(PP);
4515%% is_LocalControlDescriptor(_) ->
4516%%     false.
4517
4518%% is_LocalControlDescriptor_propertyParms([]) ->
4519%%     true;
4520%% is_LocalControlDescriptor_propertyParms([H|T]) ->
4521%%     is_PropertyParm(H) andalso is_LocalControlDescriptor_propertyParms(T);
4522%% is_LocalControlDescriptor_propertyParms(_) ->
4523%%     false.
4524
4525%% chk_opt_LocalControlDescriptor(asn1_NOVALUE, asn1_NOVALUE) ->
4526%%     ok;
4527%% chk_opt_LocalControlDescriptor(LCD1, LCD2) ->
4528%%     chk_LocalControlDescriptor(LCD1, LCD2).
4529
4530%% chk_LocalControlDescriptor(LCD, LCD) ->
4531%%     chk_type(fun is_LocalControlDescriptor/1, 'LocalControlDescriptor', LCD);
4532%% chk_LocalControlDescriptor(#'LocalControlDescriptor'{streamMode    = SM1,
4533%% 						     reserveValue  = RV1,
4534%% 						     reserveGroup  = RG1,
4535%% 						     propertyParms = PP1},
4536%% 			   #'LocalControlDescriptor'{streamMode    = SM2,
4537%% 						     reserveValue  = RV2,
4538%% 						     reserveGroup  = RG2,
4539%% 						     propertyParms = PP2}) ->
4540%%     validate(
4541%%       fun() -> chk_opt_StreamMode(SM1, SM2) end,
4542%%       'LocalControlDescriptor'),
4543%%     validate(
4544%%       fun() -> chk_opt_BOOLEAN(RV1, RV2) end,
4545%%       'LocalControlDescriptor_reserveValue'),
4546%%     validate(
4547%%       fun() -> chk_opt_BOOLEAN(RG1, RG2) end,
4548%%       'LocalControlDescriptor_reserveGroup'),
4549%%     chk_LocalControlDescriptor_propertyParms(PP1, PP2),
4550%%     ok;
4551%% chk_LocalControlDescriptor(LCD1, LCD2) ->
4552%%     wrong_type('LocalControlDescriptor', LCD1, LCD2).
4553
4554
4555%% chk_LocalControlDescriptor_propertyParms([], []) ->
4556%%     ok;
4557%% chk_LocalControlDescriptor_propertyParms([] = PP1, PP2) ->
4558%%     not_equal('LocalControlDescriptor_propertyParms', PP1, PP2);
4559%% chk_LocalControlDescriptor_propertyParms(PP1, [] = PP2) ->
4560%%     not_equal('LocalControlDescriptor_propertyParms', PP1, PP2);
4561%% chk_LocalControlDescriptor_propertyParms([H|T1], [H|T2]) ->
4562%%     case is_PropertyParm(H) of
4563%% 	true ->
4564%% 	    chk_LocalControlDescriptor_propertyParms(T1, T2);
4565%% 	false ->
4566%% 	    wrong_type('LocalControlDescriptor_propertyParms_val', H)
4567%%     end;
4568%% chk_LocalControlDescriptor_propertyParms([H1|T1], [H2|T2]) ->
4569%%     validate(fun() -> chk_PropertyParm(H1, H2) end,
4570%% 	     'LocalControlDescriptor_propertyParms_val'),
4571%%     chk_LocalControlDescriptor_propertyParms(T1, T2);
4572%% chk_LocalControlDescriptor_propertyParms(PP1, PP2) ->
4573%%     wrong_type('LocalControlDescriptor_propertyParms', PP1, PP2).
4574
4575
4576%% %% -- StreamMode --
4577
4578%% is_opt_StreamMode(asn1_NOVALUE) ->
4579%%     true;
4580%% is_opt_StreamMode(SM) ->
4581%%     is_StreamMode(SM).
4582
4583%% is_StreamMode(SM) ->
4584%%     lists:member(SM, [sendOnly, recvOnly, sendRecv, inactive, loopBack]).
4585
4586%% chk_opt_StreamMode(asn1_NOVALUE, asn1_NOVALUE) ->
4587%%     ok;
4588%% chk_opt_StreamMode(SM1, SM2) ->
4589%%     chk_StreamMode(SM1, SM2).
4590
4591%% chk_StreamMode(SM, SM) ->
4592%%     chk_type(fun is_StreamMode/1, 'StreamMode', SM);
4593%% chk_StreamMode(SM1, SM2) ->
4594%%     case (is_StreamMode(SM1) andalso is_StreamMode(SM2)) of
4595%% 	true ->
4596%% 	    not_equal('StreamMode', SM1, SM2);
4597%% 	false ->
4598%% 	    wrong_type('StreamMode', SM1, SM2)
4599%%     end.
4600
4601
4602%% %% -- PropertyParm --
4603
4604%% is_PropertyParm(#'PropertyParm'{name      = N,
4605%% 				value     = V,
4606%% 				extraInfo = I}) ->
4607%%     is_PkgdName(N) andalso
4608%% 	is_PropertyParm_value(V) andalso
4609%% 	is_PropertyParm_extraInfo(I);
4610%% is_PropertyParm(_) ->
4611%%     false.
4612
4613%% is_PropertyParm_value([]) ->
4614%%     true;
4615%% is_PropertyParm_value([H|T]) ->
4616%%     is_OCTET_STRING(H) andalso is_PropertyParm_value(T);
4617%% is_PropertyParm_value(_) ->
4618%%     false.
4619
4620%% is_PropertyParm_extraInfo(asn1_NOVALUE) ->
4621%%     true;
4622%% is_PropertyParm_extraInfo({Tag, Val}) ->
4623%%     is_PropertyParm_extraInfo_tag(Tag) andalso
4624%% 	is_PropertyParm_extraInfo_val(Tag, Val);
4625%% is_PropertyParm_extraInfo(_) ->
4626%%     false.
4627
4628%% is_PropertyParm_extraInfo_tag(Tag) ->
4629%%     Tags = [relation, range, sublist],
4630%%     lists:member(Tag, Tags).
4631
4632%% is_PropertyParm_extraInfo_val(relation, Val) ->
4633%%     is_Relation(Val);
4634%% is_PropertyParm_extraInfo_val(range, Val) ->
4635%%     is_BOOLEAN(Val);
4636%% is_PropertyParm_extraInfo_val(sublist, Val) ->
4637%%     is_BOOLEAN(Val).
4638
4639%% chk_PropertyParm(P, P) ->
4640%%     chk_type(fun is_PropertyParm/1, 'PropertyParm', P);
4641%% chk_PropertyParm(#'PropertyParm'{name      = N1,
4642%% 				 value     = V1,
4643%% 				 extraInfo = I1},
4644%% 		 #'PropertyParm'{name      = N2,
4645%% 				 value     = V2,
4646%% 				 extraInfo = I2}) ->
4647%%     validate(fun() -> chk_PkgdName(N1, N2) end, 'PropertyParm'),
4648%%     chk_PropertyParm_value(V1, V2),
4649%%     chk_PropertyParm_extraInfo(I1, I2),
4650%%     ok;
4651%% chk_PropertyParm(P1, P2) ->
4652%%     wrong_type('PropertyParm', P1, P2).
4653
4654%% chk_PropertyParm_value([], []) ->
4655%%     ok;
4656%% chk_PropertyParm_value([] = V1, V2) ->
4657%%     not_equal('PropertyParm_value', V1, V2);
4658%% chk_PropertyParm_value(V1, [] = V2) ->
4659%%     not_equal('PropertyParm_value', V1, V2);
4660%% chk_PropertyParm_value([H|T1], [H|T2]) ->
4661%%     case is_OCTET_STRING(H) of
4662%% 	true ->
4663%% 	    chk_PropertyParm_value(T1, T2);
4664%% 	false ->
4665%% 	    wrong_type('PropertyParm_value_val', H)
4666%%     end;
4667%% chk_PropertyParm_value([H1|_], [H2|_]) ->
4668%%     case (is_OCTET_STRING(H1) andalso is_OCTET_STRING(H2)) of
4669%% 	true ->
4670%% 	    not_equal('PropertyParm_value_val', H1, H2);
4671%% 	false ->
4672%% 	    wrong_type('PropertyParm_value_val', H1, H2)
4673%%     end;
4674%% chk_PropertyParm_value(V1, V2) ->
4675%%     wrong_type('PropertyParm_value', V1, V2).
4676
4677%% chk_PropertyParm_extraInfo(EI, EI) ->
4678%%     chk_type(fun is_PropertyParm_extraInfo/1, 'PropertyParm_extraInfo', EI);
4679%% chk_PropertyParm_extraInfo({Tag, Val1} = EI1, {Tag, Val2} = EI2) ->
4680%%     case (is_PropertyParm_extraInfo_tag(Tag) and
4681%% 	  is_PropertyParm_extraInfo_val(Tag, Val1) and
4682%% 	  is_PropertyParm_extraInfo_val(Tag, Val2)) of
4683%% 	true ->
4684%% 	    chk_PropertyParm_extraInfo_val(Tag, Val1, Val2);
4685%% 	false ->
4686%% 	    wrong_type('PropertyParm_extraInfo', EI1, EI2)
4687%%     end;
4688%% chk_PropertyParm_extraInfo({Tag1, Val1} = EI1, {Tag2, Val2} = EI2) ->
4689%%     case ((is_PropertyParm_extraInfo_tag(Tag1) and
4690%% 	   is_PropertyParm_extraInfo_val(Tag1, Val1)) and
4691%% 	  (is_PropertyParm_extraInfo_tag(Tag2) and
4692%% 	   is_PropertyParm_extraInfo_val(Tag2, Val2))) of
4693%% 	true ->
4694%% 	    not_equal('PropertyParm_extraInfo', EI1, EI2);
4695%% 	false ->
4696%% 	    wrong_type('PropertyParm_extraInfo', EI1, EI2)
4697%%     end;
4698%% chk_PropertyParm_extraInfo(EI1, EI2) ->
4699%%     wrong_type('PropertyParm_extraInfo', EI1, EI2).
4700
4701%% chk_PropertyParm_extraInfo_val(relation, Val1, Val2) ->
4702%%     validate(fun() -> chk_Relation(Val1, Val2) end, 'PropertyParm_extraInfo');
4703%% chk_PropertyParm_extraInfo_val(range, Val1, Val2) ->
4704%%     validate(fun() -> chk_BOOLEAN(Val1, Val2) end, 'PropertyParm_extraInfo');
4705%% chk_PropertyParm_extraInfo_val(sublist, Val1, Val2) ->
4706%%     validate(fun() -> chk_BOOLEAN(Val1, Val2) end, 'PropertyParm_extraInfo').
4707
4708
4709%% %% -- Name --
4710
4711is_Name(N) ->
4712    %% Binary: is_OCTET_STRING(N, {exact, 2}).
4713    case is_OCTET_STRING(N, {range, 1, 64}) of
4714	true ->
4715	    is_NAME(N);
4716	false ->
4717	    false
4718    end.
4719
4720is_NAME([H|T]) when H =< $z, $a =< H ->
4721    is_NAME2(T);
4722is_NAME([H|T]) when H =< $Z, $A =< H ->
4723    is_NAME2(T);
4724is_NAME(_) ->
4725    false.
4726
4727is_NAME2([]) ->
4728    true;
4729is_NAME2([$_|T]) ->
4730    is_NAME2(T);
4731is_NAME2([H|T]) when H =< $z, $a =< H ->
4732    is_NAME2(T);
4733is_NAME2([H|T]) when H =< $Z, $A =< H ->
4734    is_NAME2(T);
4735is_NAME2([H|T]) when H =< $9, $0 =< H ->
4736    is_NAME2(T);
4737is_NAME2(_) ->
4738    false.
4739
4740
4741
4742%% chk_Name(N, N) ->
4743%%     chk_type(fun is_Name/1, 'Name', N);
4744%% chk_Name(N1, N2) ->
4745%%     case (is_Name(N1) andalso is_Name(N2)) of
4746%% 	true ->
4747%% 	    not_equal('Name', N1, N2);
4748%% 	false ->
4749%% 	    wrong_type('Name', N1, N2)
4750%%     end.
4751
4752
4753%% %% -- PkgdName --
4754
4755%% PkgdName is either "AB/CD" or just plain "ABCD"
4756%% Note that in ASN.1 the parts is exactly 2 char
4757%% each, unless you don't use the native config
4758%% option. In text and in binary without the native
4759%% option, it is 63 + 1 chars for each.
4760is_PkgdName(N) ->
4761    d("is_PkgdName -> entry with"
4762      "~n   N: ~p", [N]),
4763    case string:tokens(N, "/") of
4764	["*" = PackageName, "*" = ItemID] ->
4765	    d("is_PkgdName -> tokenized (0): "
4766	      "~n   PackageName: ~p"
4767	      "~n   ItemID:      ~p", [PackageName, ItemID]),
4768	    true;
4769	[PackageName, "*" = ItemID] ->
4770	    d("is_PkgdName -> tokenized (1): "
4771	      "~n   PackageName: ~p"
4772	      "~n   ItemID:      ~p", [PackageName, ItemID]),
4773	    is_Name(PackageName);
4774	[PackageName, ItemID] ->
4775	    d("is_PkgdName -> tokenized (2): "
4776	      "~n   PackageName: ~p"
4777	      "~n   ItemID:      ~p", [PackageName, ItemID]),
4778	    is_Name(PackageName) andalso is_Name(ItemID);
4779	_ ->
4780	    is_Name(N)
4781    end.
4782
4783%% chk_PkgdName(N, N) ->
4784%%     case is_PkgdName(N) of
4785%% 	true ->
4786%% 	    ok;
4787%% 	false ->
4788%% 	    wrong_type('PkgdName', N, N)
4789%%     end;
4790%% chk_PkgdName(N1, N2) ->
4791%%     case (is_PkgdName(N1) andalso is_PkgdName(N2)) of
4792%% 	true ->
4793%% 	    not_equal('PkgdName', N1, N2);
4794%% 	false ->
4795%% 	    wrong_type('PkgdName', N1, N2)
4796%%     end.
4797
4798
4799%% %% -- Relation --
4800
4801is_Relation(R) ->
4802    lists:member(R, [greaterThan, smallerThan, unequalTo]).
4803
4804%% chk_Relation(R, R) ->
4805%%     chk_type(fun is_Relation/1, 'Relation', R);
4806%% chk_Relation(R1, R2) ->
4807%%     case (is_Relation(R1) andalso is_Relation(R2)) of
4808%% 	true ->
4809%% 	    not_equal('Relation', R1, R2);
4810%% 	false ->
4811%% 	    wrong_type('Relation', R1, R2)
4812%%     end.
4813
4814
4815%% %% -- LocalRemoteDescriptor --
4816
4817%% is_opt_LocalRemoteDescriptor(D) ->
4818%%     is_OPTIONAL(fun is_LocalRemoteDescriptor/1, D).
4819
4820%% is_LocalRemoteDescriptor(#'LocalRemoteDescriptor'{propGrps = PGs}) ->
4821%%     is_LocalRemoteDescriptor_propGrps(PGs);
4822%% is_LocalRemoteDescriptor(_) ->
4823%%     false.
4824
4825%% is_LocalRemoteDescriptor_propGrps([]) ->
4826%%     true;
4827%% is_LocalRemoteDescriptor_propGrps([H|T]) ->
4828%%     is_PropertyGroup(H) andalso is_LocalRemoteDescriptor_propGrps(T);
4829%% is_LocalRemoteDescriptor_propGrps(_) ->
4830%%     false.
4831
4832%% chk_opt_LocalRemoteDescriptor(D1, D2) ->
4833%%     chk_OPTIONAL('LocalRemoteDescriptor', D1, D2,
4834%% 		 fun is_LocalRemoteDescriptor/1,
4835%% 		 fun chk_LocalRemoteDescriptor/2).
4836
4837%% chk_LocalRemoteDescriptor(LRD, LRD) ->
4838%%     chk_type(fun is_LocalRemoteDescriptor/1, 'LocalRemoteDescriptor', LRD);
4839%% chk_LocalRemoteDescriptor(#'LocalRemoteDescriptor'{propGrps = PG1},
4840%% 			  #'LocalRemoteDescriptor'{propGrps = PG2}) ->
4841%%     chk_LocalRemoteDescriptor_propGrps(PG1, PG2),
4842%%     ok;
4843%% chk_LocalRemoteDescriptor(LRD1, LRD2) ->
4844%%     wrong_type('LocalRemoteDescriptor', LRD1, LRD2).
4845
4846%% chk_LocalRemoteDescriptor_propGrps([], []) ->
4847%%     ok;
4848%% chk_LocalRemoteDescriptor_propGrps([] = PG1, PG2) ->
4849%%     not_equal('LocalRemoteDescriptor_propGrps', PG1, PG2);
4850%% chk_LocalRemoteDescriptor_propGrps(PG1, [] = PG2) ->
4851%%     not_equal('LocalRemoteDescriptor_propGrps', PG1, PG2);
4852%% chk_LocalRemoteDescriptor_propGrps([H|T1], [H|T2]) ->
4853%%     case is_PropertyGroup(H) of
4854%% 	true ->
4855%% 	    chk_LocalRemoteDescriptor_propGrps(T1, T2);
4856%% 	false ->
4857%% 	    wrong_type('LocalRemoteDescriptor_propGrps_val', H)
4858%%     end;
4859%% chk_LocalRemoteDescriptor_propGrps([H1|T1], [H2|T2]) ->
4860%%     validate(fun() -> chk_PropertyGroup(H1, H2) end,
4861%% 	     'LocalRemoteDescriptor_propGrps_val'),
4862%%     chk_LocalRemoteDescriptor_propGrps(T1, T2);
4863%% chk_LocalRemoteDescriptor_propGrps(PG1, PG2) ->
4864%%     wrong_type('LocalRemoteDescriptor_propGrps', PG1, PG2).
4865
4866
4867%% %% -- PropertyGroup --
4868
4869%% is_PropertyGroup([]) ->
4870%%     true;
4871%% is_PropertyGroup([H|T]) ->
4872%%     is_PropertyParm(H) andalso is_PropertyGroup(T);
4873%% is_PropertyGroup(_) ->
4874%%     false.
4875
4876%% chk_PropertyGroup([], []) ->
4877%%     ok;
4878%% chk_PropertyGroup([] = PG1, PG2) ->
4879%%     not_equal('PropertyGroup', PG1, PG2);
4880%% chk_PropertyGroup(PG1, [] = PG2) ->
4881%%     not_equal('PropertyGroup', PG1, PG2);
4882%% chk_PropertyGroup([H|T1], [H|T2]) ->
4883%%     case is_PropertyParm(H) of
4884%% 	true ->
4885%% 	    chk_PropertyGroup(T1, T2);
4886%% 	false ->
4887%% 	    wrong_type('PropertyGroup_val', H)
4888%%     end;
4889%% chk_PropertyGroup([H1|T1], [H2|T2]) ->
4890%%     validate(fun() -> chk_PropertyParm(H1, H2) end, 'PropertyGroup_val'),
4891%%     chk_PropertyGroup(T1, T2);
4892%% chk_PropertyGroup(PG1, PG2) ->
4893%%     wrong_type('PropertyGroup', PG1, PG2).
4894
4895
4896%% %% -- TerminationStateDescriptor --
4897
4898%% is_opt_TerminationStateDescriptor(D) ->
4899%%     is_OPTIONAL(fun is_TerminationStateDescriptor/1, D).
4900
4901%% is_TerminationStateDescriptor(
4902%%   #'TerminationStateDescriptor'{propertyParms      = PP,
4903%% 				eventBufferControl = EBC,
4904%% 				serviceState       = SS}) ->
4905%%     is_TerminationStateDescriptor_propertyParms(PP) andalso
4906%% 	is_opt_EventBufferControl(EBC) andalso
4907%% 	is_opt_ServiceState(SS);
4908%% is_TerminationStateDescriptor(_) ->
4909%%     false.
4910
4911%% is_TerminationStateDescriptor_propertyParms([]) ->
4912%%     true;
4913%% is_TerminationStateDescriptor_propertyParms([H|T]) ->
4914%%     is_PropertyParm(H) andalso is_TerminationStateDescriptor_propertyParms(T);
4915%% is_TerminationStateDescriptor_propertyParms(_) ->
4916%%     false.
4917
4918%% chk_opt_TerminationStateDescriptor(D1, D2) ->
4919%%     chk_OPTIONAL('TerminationStateDescriptor', D1, D2,
4920%% 		 fun is_TerminationStateDescriptor/1,
4921%% 		 fun chk_TerminationStateDescriptor/2).
4922
4923%% chk_TerminationStateDescriptor(D, D) ->
4924%%     chk_type(fun is_TerminationStateDescriptor/1,
4925%% 	     'TerminationStateDescriptor', D);
4926%% chk_TerminationStateDescriptor(
4927%%   #'TerminationStateDescriptor'{propertyParms      = PP1,
4928%% 				eventBufferControl = EBC1,
4929%% 				serviceState       = SS1},
4930%%   #'TerminationStateDescriptor'{propertyParms      = PP2,
4931%% 				eventBufferControl = EBC2,
4932%% 				serviceState       = SS2}) ->
4933%%     chk_TerminationStateDescriptor_propertyParms(PP1, PP2),
4934%%     validate(
4935%%       fun() ->
4936%% 	      chk_opt_EventBufferControl(EBC1, EBC2)
4937%%       end,
4938%%       'TerminationStateDescriptor'),
4939%%     validate(
4940%%       fun() ->
4941%% 	      chk_opt_ServiceState(SS1, SS2)
4942%%       end,
4943%%       'TerminationStateDescriptor'),
4944%%     ok;
4945%% chk_TerminationStateDescriptor(D1, D2) ->
4946%%     wrong_type('TerminationStateDescriptor', D1, D2).
4947
4948
4949%% chk_TerminationStateDescriptor_propertyParms([], []) ->
4950%%     ok;
4951%% chk_TerminationStateDescriptor_propertyParms([] = P1, P2) ->
4952%%     not_equal('TerminationStateDescriptor_propertyParms', P1, P2);
4953%% chk_TerminationStateDescriptor_propertyParms(P1, [] = P2) ->
4954%%     not_equal('TerminationStateDescriptor_propertyParms', P1, P2);
4955%% chk_TerminationStateDescriptor_propertyParms([H|T1], [H|T2]) ->
4956%%     case is_PropertyParm(H) of
4957%% 	true ->
4958%% 	    chk_TerminationStateDescriptor_propertyParms(T1, T2);
4959%% 	false ->
4960%% 	    wrong_type('TerminationStateDescriptor_propertyParms_val', H)
4961%%     end;
4962%% chk_TerminationStateDescriptor_propertyParms([H1|_], [H2|_]) ->
4963%%     case (is_PropertyParm(H1) andalso is_PropertyParm(H2)) of
4964%% 	true ->
4965%% 	    not_equal('TerminationStateDescriptor_propertyParms_val', H1, H2);
4966%% 	false ->
4967%% 	    wrong_type('TerminationStateDescriptor_propertyParms_val', H1, H2)
4968%%     end;
4969%% chk_TerminationStateDescriptor_propertyParms(P1, P2) ->
4970%%     wrong_type('TerminationStateDescriptor_propertyParms', P1, P2).
4971
4972
4973%% %% -- EventBufferControl --
4974
4975%% is_opt_EventBufferControl(asn1_NOVALUE) ->
4976%%     true;
4977%% is_opt_EventBufferControl(EBC) ->
4978%%     is_EventBufferControl(EBC).
4979
4980%% is_EventBufferControl(EBC) ->
4981%%     lists:member(EBC, [off, lockStep]).
4982
4983%% chk_opt_EventBufferControl(asn1_NOVALUE, asn1_NOVALUE) ->
4984%%     ok;
4985%% chk_opt_EventBufferControl(EBC1, EBC2) ->
4986%%     chk_EventBufferControl(EBC1, EBC2).
4987
4988%% chk_EventBufferControl(EBC, EBC) ->
4989%%     chk_type(fun is_EventBufferControl/1, 'EventBufferControl', EBC);
4990%% chk_EventBufferControl(EBC1, EBC2) ->
4991%%     case (is_EventBufferControl(EBC1) andalso is_EventBufferControl(EBC2)) of
4992%% 	true ->
4993%% 	    not_equal('EventBufferControl', EBC1, EBC2);
4994%% 	false ->
4995%% 	    wrong_type('EventBufferControl', EBC1, EBC2)
4996%%     end.
4997
4998
4999%% %% -- ServiceState --
5000
5001%% is_opt_ServiceState(asn1_NOVALUE) ->
5002%%     true;
5003%% is_opt_ServiceState(SS) ->
5004%%     is_ServiceState(SS).
5005
5006%% is_ServiceState(SS) ->
5007%%     lists:member(SS, [test, outOfSvc, inSvc]).
5008
5009%% chk_opt_ServiceState(asn1_NOVALUE, asn1_NOVALUE) ->
5010%%     ok;
5011%% chk_opt_ServiceState(SS1, SS2) ->
5012%%     chk_ServiceState(SS1, SS2).
5013
5014%% chk_ServiceState(SS, SS) ->
5015%%     chk_type(fun is_ServiceState/1, 'ServiceState', SS);
5016%% chk_ServiceState(SS1, SS2) ->
5017%%     case (is_ServiceState(SS1) andalso is_ServiceState(SS2)) of
5018%% 	true ->
5019%% 	    not_equal('ServiceState', SS1, SS2);
5020%% 	false ->
5021%% 	    wrong_type('ServiceState', SS1, SS2)
5022%%     end.
5023
5024
5025%% %% -- MuxDescriptor --
5026
5027%% is_MuxDescriptor(#'MuxDescriptor'{muxType         = MT,
5028%% 				  termList        = TL,
5029%% 				  nonStandardData = NSD}) ->
5030%%     is_MuxType(MT) andalso
5031%% 	is_MuxDescriptor_termList(TL) andalso
5032%% 	is_NonStandardData(NSD);
5033%% is_MuxDescriptor(_) ->
5034%%     false.
5035
5036%% is_MuxDescriptor_termList([]) ->
5037%%     true;
5038%% is_MuxDescriptor_termList([H|T]) ->
5039%%     is_TerminationID(H) andalso is_MuxDescriptor_termList(T);
5040%% is_MuxDescriptor_termList(_) ->
5041%%     false.
5042
5043%% chk_MuxDescriptor(D, D) ->
5044%%     chk_type(fun is_MuxDescriptor/1, 'MuxDescriptor', D);
5045%% chk_MuxDescriptor(#'MuxDescriptor'{muxType         = MT1,
5046%% 				   termList        = TL1,
5047%% 				   nonStandardData = NSD1},
5048%% 		  #'MuxDescriptor'{muxType         = MT2,
5049%% 				   termList        = TL2,
5050%% 				   nonStandardData = NSD2}) ->
5051%%     validate(fun() -> chk_MuxType(MT1, MT2) end, 'MuxDescriptor'),
5052%%     chk_MuxDescriptor_termList(TL1, TL2),
5053%%     validate(fun() -> chk_NonStandardData(NSD1, NSD2) end, 'MuxDescriptor'),
5054%%     ok;
5055%% chk_MuxDescriptor(D1, D2) ->
5056%%     wrong_type('MuxDescriptor', D1, D2).
5057
5058%% chk_MuxDescriptor_termList([], []) ->
5059%%     ok;
5060%% chk_MuxDescriptor_termList([] = TL1, TL2) ->
5061%%     not_equal('MuxDescriptor_termList', TL1, TL2);
5062%% chk_MuxDescriptor_termList(TL1, [] = TL2) ->
5063%%     not_equal('MuxDescriptor_termList', TL1, TL2);
5064%% chk_MuxDescriptor_termList([H|T1], [H|T2]) ->
5065%%     case is_TerminationID(H) of
5066%% 	true ->
5067%% 	    chk_MuxDescriptor_termList(T1, T2);
5068%% 	false ->
5069%% 	    wrong_type('MuxDescriptor_termList_val', H)
5070%%     end;
5071%% chk_MuxDescriptor_termList([H1|T1], [H2|T2]) ->
5072%%     validate(fun() -> chk_TerminationID(H1, H2) end,
5073%% 	     'MuxDescriptor_termList_val'),
5074%%     chk_MuxDescriptor_termList(T1, T2);
5075%% chk_MuxDescriptor_termList(TL1, TL2) ->
5076%%     wrong_type('MuxDescriptor_termList', TL1, TL2).
5077
5078
5079%% %% -- MuxType --
5080
5081%% is_MuxType(MT) ->
5082%%     lists:member(MT, [h221, h223, h226, v76, nx64k]).
5083
5084%% chk_MuxType(MT, MT) ->
5085%%     chk_type(fun is_MuxType/1, 'MuxType', MT);
5086%% chk_MuxType(MT1, MT2) ->
5087%%     case (is_MuxType(MT1) andalso is_MuxType(MT2)) of
5088%% 	true ->
5089%% 	    not_equal('MuxType', MT1, MT2);
5090%% 	false ->
5091%% 	    wrong_type('MuxType', MT1, MT2)
5092%%     end.
5093
5094
5095%% %% -- StreamID --
5096
5097is_opt_StreamID(asn1_NOVALUE) ->
5098    true;
5099is_opt_StreamID(V) ->
5100    is_StreamID(V).
5101
5102is_StreamID(V) -> is_INTEGER(V, {range, 0, 65535}).
5103
5104%% chk_opt_StreamID(asn1_NOVALUE, asn1_NOVALUE) ->
5105%%     ok;
5106%% chk_opt_StreamID(V1, V2) ->
5107%%     chk_StreamID(V1, V2).
5108
5109%% chk_StreamID(ID, ID) ->
5110%%     chk_type(fun is_StreamID/1, 'StreamID', ID);
5111%% chk_StreamID(ID1, ID2) ->
5112%%     case (is_StreamID(ID1) andalso is_StreamID(ID2)) of
5113%% 	true ->
5114%% 	    not_equal('StreamID', ID1, ID2);
5115%% 	false ->
5116%% 	    wrong_type('StreamID', ID1, ID2)
5117%%     end.
5118
5119
5120%% %% -- EventsDescriptor --
5121
5122%% is_EventsDescriptor(#'EventsDescriptor'{requestID = RID,
5123%% 					eventList = EVL}) ->
5124%%     d("is_EventsDescriptor -> entry with"
5125%%       "~n   RID: ~p"
5126%%       "~n   EVL: ~p", [RID, EVL]),
5127%%     is_opt_RequestID(RID) andalso is_EventsDescriptor_eventList(EVL);
5128%% is_EventsDescriptor(_) ->
5129%%     false.
5130
5131%% is_EventsDescriptor_eventList([]) ->
5132%%     true;
5133%% is_EventsDescriptor_eventList([H|T]) ->
5134%%     is_RequestedEvent(H) andalso is_EventsDescriptor_eventList(T);
5135%% is_EventsDescriptor_eventList(_) ->
5136%%     false.
5137
5138%% chk_EventsDescriptor(D, D) ->
5139%%     chk_type(fun is_EventsDescriptor/1, 'EventsDescriptor', D);
5140%% chk_EventsDescriptor(#'EventsDescriptor'{requestID = RID1,
5141%% 					 eventList = EVL1},
5142%% 		     #'EventsDescriptor'{requestID = RID2,
5143%% 					 eventList = EVL2}) ->
5144%%     validate(fun() -> chk_opt_RequestID(RID1, RID2) end, 'EventsDescriptor'),
5145%%     chk_EventsDescriptor_eventList(EVL1, EVL2),
5146%%     ok;
5147%% chk_EventsDescriptor(D1, D2) ->
5148%%     wrong_type('EventsDescriptor', D1, D2).
5149
5150%% chk_EventsDescriptor_eventList([], []) ->
5151%%     ok;
5152%% chk_EventsDescriptor_eventList([] = EVL1, EVL2) ->
5153%%     not_equal('EventsDescriptor_eventList', EVL1, EVL2);
5154%% chk_EventsDescriptor_eventList(EVL1, [] = EVL2) ->
5155%%     not_equal('EventsDescriptor_eventList', EVL1, EVL2);
5156%% chk_EventsDescriptor_eventList([H|T1], [H|T2]) ->
5157%%     case is_RequestedEvent(H) of
5158%% 	true ->
5159%% 	    chk_EventsDescriptor_eventList(T1, T2);
5160%% 	false ->
5161%% 	    wrong_type('EventsDescriptor_eventList_val', H)
5162%%     end;
5163%% chk_EventsDescriptor_eventList([H1|T1], [H2|T2]) ->
5164%%     validate(fun() -> chk_RequestedEvent(H1, H2) end,
5165%% 	     'EventsDescriptor_eventList_val'),
5166%%     chk_EventsDescriptor_eventList(T1, T2);
5167%% chk_EventsDescriptor_eventList(EVL1, EVL2) ->
5168%%     wrong_type('EventsDescriptor_eventList', EVL1, EVL2).
5169
5170
5171%% %% -- RequestedEvent --
5172
5173%% is_RequestedEvent(#'RequestedEvent'{pkgdName    = N,
5174%% 				    streamID    = SID,
5175%% 				    eventAction = EA,
5176%% 				    evParList   = EPL}) ->
5177%%     d("is_RequestedEvent -> entry with"
5178%%       "~n   N:   ~p"
5179%%       "~n   SID: ~p"
5180%%       "~n   EA:  ~p"
5181%%       "~n   EPL: ~p", [N, SID, EA, EPL]),
5182%%     is_PkgdName(N) andalso
5183%% 	is_opt_StreamID(SID) andalso
5184%% 	is_opt_RequestedActions(EA) andalso
5185%% 	is_RequestedEvent_evParList(EPL);
5186%% is_RequestedEvent(_) ->
5187%%     false.
5188
5189%% is_RequestedEvent_evParList([]) ->
5190%%     true;
5191%% is_RequestedEvent_evParList([H|T]) ->
5192%%     is_EventParameter(H) andalso is_RequestedEvent_evParList(T);
5193%% is_RequestedEvent_evParList(_) ->
5194%%     false.
5195
5196%% chk_RequestedEvent(RE, RE) ->
5197%%     chk_type(fun is_RequestedEvent/1, 'RequestedEvent', RE);
5198%% chk_RequestedEvent(#'RequestedEvent'{pkgdName    = N1,
5199%% 				     streamID    = SID1,
5200%% 				     eventAction = EA1,
5201%% 				     evParList   = EPL1},
5202%% 		   #'RequestedEvent'{pkgdName    = N2,
5203%% 				     streamID    = SID2,
5204%% 				     eventAction = EA2,
5205%% 				     evParList   = EPL2}) ->
5206%%     validate(fun() -> chk_PkgdName(N1, N2) end, 'RequestedEvent'),
5207%%     validate(fun() -> chk_opt_StreamID(SID1, SID2) end, 'RequestedEvent'),
5208%%     validate(fun() -> chk_opt_RequestedActions(EA1, EA2) end,
5209%% 	     'RequestedEvent'),
5210%%     chk_RequestedEvent_evParList(EPL1, EPL2),
5211%%     ok;
5212%% chk_RequestedEvent(RE1, RE2) ->
5213%%     wrong_type('RequestedEvent', RE1, RE2).
5214
5215%% chk_RequestedEvent_evParList([], []) ->
5216%%     ok;
5217%% chk_RequestedEvent_evParList([] = EPL1, EPL2) ->
5218%%     not_equal('RequestedEvent_evParList', EPL1, EPL2);
5219%% chk_RequestedEvent_evParList(EPL1, [] = EPL2) ->
5220%%     not_equal('RequestedEvent_evParList', EPL1, EPL2);
5221%% chk_RequestedEvent_evParList([H|T1], [H|T2]) ->
5222%%     case is_EventParameter(H) of
5223%% 	true ->
5224%% 	    chk_RequestedEvent_evParList(T1, T2);
5225%% 	false ->
5226%% 	    wrong_type('RequestedEvent_evParList_val', H)
5227%%     end;
5228%% chk_RequestedEvent_evParList([H1|T1], [H2|T2]) ->
5229%%     validate(fun() -> chk_EventParameter(H1, H2) end,
5230%% 	     'RequestedEvent_evParList_val'),
5231%%     chk_RequestedEvent_evParList(T1, T2);
5232%% chk_RequestedEvent_evParList(EPL1, EPL2) ->
5233%%     wrong_type('RequestedEvent_evParList', EPL1, EPL2).
5234
5235
5236%% %% -- RequestedActions --
5237
5238%% is_opt_RequestedActions(asn1_NOVALUE) ->
5239%%     true;
5240%% is_opt_RequestedActions(RA) ->
5241%%     is_RequestedActions(RA).
5242
5243%% is_RequestedActions(#'RequestedActions'{keepActive        = KA,
5244%% 					eventDM           = EDM,
5245%% 					secondEvent       = SE,
5246%% 					signalsDescriptor = SD}) ->
5247%%     d("is_RequestedActions -> entry with"
5248%%       "~n   KA:  ~p"
5249%%       "~n   EDM: ~p"
5250%%       "~n   SE:  ~p"
5251%%       "~n   SD:  ~p", [KA, EDM, SE, SD]),
5252%%     is_opt_BOOLEAN(KA) andalso
5253%% 	is_opt_EventDM(EDM) andalso
5254%% 	is_opt_SecondEventsDescriptor(SE) andalso
5255%% 	is_opt_SignalsDescriptor(SD);
5256%% is_RequestedActions(_) ->
5257%%     false.
5258
5259%% chk_opt_RequestedActions(asn1_NOVALUE, asn1_NOVALUE) ->
5260%%     ok;
5261%% chk_opt_RequestedActions(RA1, RA2) ->
5262%%     chk_RequestedActions(RA1, RA2).
5263
5264%% chk_RequestedActions(RA, RA) ->
5265%%     chk_type(fun is_RequestedActions/1, 'RequestedActions', RA);
5266%% chk_RequestedActions(#'RequestedActions'{keepActive        = KA1,
5267%% 					 eventDM           = EDM1,
5268%% 					 secondEvent       = SA1,
5269%% 					 signalsDescriptor = SD1},
5270%% 		     #'RequestedActions'{keepActive        = KA2,
5271%% 					 eventDM           = EDM2,
5272%% 					 secondEvent       = SA2,
5273%% 					 signalsDescriptor = SD2}) ->
5274%%     validate(fun() -> chk_opt_BOOLEAN(KA1, KA2) end, 'RequestedActions'),
5275%%     validate(fun() -> chk_opt_EventDM(EDM1, EDM2) end, 'RequestedActions'),
5276%%     validate(fun() -> chk_opt_SecondEventsDescriptor(SA1, SA2) end,
5277%% 	     'RequestedActions'),
5278%%     validate(fun() -> chk_opt_SignalsDescriptor(SD1, SD2) end,
5279%% 	     'RequestedActions'),
5280%%     ok;
5281%% chk_RequestedActions(RA1, RA2) ->
5282%%     wrong_type('RequestedActions', RA1, RA2).
5283
5284
5285%% %% -- EventDM --
5286
5287%% is_opt_EventDM(EDM) ->
5288%%     is_OPTIONAL(fun is_EventDM/1, EDM).
5289
5290%% is_EventDM({Tag, Val}) ->
5291%%     is_EventDM_tag(Tag) andalso is_EventDM_val(Tag, Val);
5292%% is_EventDM(_) ->
5293%%     false.
5294
5295%% is_EventDM_tag(Tag) ->
5296%%     Tags = [digitMapName, digitMapValue],
5297%%     lists:member(Tag, Tags).
5298
5299%% is_EventDM_val(digitMapName, Val) ->
5300%%     is_DigitMapName(Val);
5301%% is_EventDM_val(digitMapValue, Val) ->
5302%%     is_DigitMapValue(Val).
5303
5304%% chk_opt_EventDM(EDM1, EDM2) ->
5305%%     chk_OPTIONAL('EventDM', EDM1, EDM2, fun is_EventDM/1, fun chk_EventDM/2).
5306
5307%% chk_EventDM(EDM, EDM) ->
5308%%     chk_type(fun is_EventDM/1, 'EventDM', EDM);
5309%% chk_EventDM({Tag, Val1} = EDM1, {Tag, Val2} = EDM2) ->
5310%%     case (is_EventDM_tag(Tag) andalso
5311%% 	  is_EventDM_val(Tag, Val1) andalso
5312%% 	  is_EventDM_val(Tag, Val2)) of
5313%% 	true ->
5314%% 	    chk_EventDM_val(Tag, Val1, Val2);
5315%% 	false ->
5316%% 	    wrong_type('EventDM', EDM1, EDM2)
5317%%     end;
5318%% chk_EventDM({Tag1, Val1} = EDM1, {Tag2, Val2} = EDM2) ->
5319%%     case ((is_EventDM_tag(Tag1) andalso
5320%% 	   is_EventDM_val(Tag1, Val1)) andalso
5321%% 	  (is_EventDM_tag(Tag2) andalso
5322%% 	   is_EventDM_val(Tag2, Val2))) of
5323%% 	true ->
5324%% 	    not_equal('EventDM', EDM1, EDM2);
5325%% 	false ->
5326%% 	    wrong_type('EventDM', EDM1, EDM2)
5327%%     end;
5328%% chk_EventDM(EDM1, EDM2) ->
5329%%     wrong_type('EventDM', EDM1, EDM2).
5330
5331%% chk_EventDM_val(digitMapName, Val1, Val2) ->
5332%%     validate(fun() -> chk_DigitMapName(Val1, Val2) end, 'EventDM');
5333%% chk_EventDM_val(digitMapValue, Val1, Val2) ->
5334%%     validate(fun() -> chk_DigitMapValue(Val1, Val2) end, 'EventDM').
5335
5336
5337%% %% -- SecondEventsDescriptor --
5338
5339%% is_opt_SecondEventsDescriptor(asn1_NOVALUE) ->
5340%%     true;
5341%% is_opt_SecondEventsDescriptor(D) ->
5342%%     is_SecondEventsDescriptor(D).
5343
5344%% is_SecondEventsDescriptor(#'SecondEventsDescriptor'{requestID = RID,
5345%% 						    eventList = EL}) ->
5346%%     is_opt_RequestID(RID) andalso is_SecondEventsDescriptor_eventList(EL);
5347%% is_SecondEventsDescriptor(_) ->
5348%%     false.
5349
5350%% is_SecondEventsDescriptor_eventList([]) ->
5351%%     true;
5352%% is_SecondEventsDescriptor_eventList([H|T]) ->
5353%%     is_SecondRequestedEvent(H) andalso is_SecondEventsDescriptor_eventList(T);
5354%% is_SecondEventsDescriptor_eventList(_) ->
5355%%     false.
5356
5357%% chk_opt_SecondEventsDescriptor(asn1_NOVALUE, asn1_NOVALUE) ->
5358%%     ok;
5359%% chk_opt_SecondEventsDescriptor(D1, D2) ->
5360%%     chk_SecondEventsDescriptor(D1, D2).
5361
5362%% chk_SecondEventsDescriptor(D, D) ->
5363%%     chk_type(fun is_SecondEventsDescriptor/1, 'SecondEventsDescriptor', D);
5364%% chk_SecondEventsDescriptor(#'SecondEventsDescriptor'{requestID = RID1,
5365%% 						     eventList = EL1},
5366%% 			   #'SecondEventsDescriptor'{requestID = RID2,
5367%% 						     eventList = EL2}) ->
5368%%     validate(fun() -> chk_opt_RequestID(RID1, RID2) end,
5369%% 	     'SecondEventsDescriptor'),
5370%%     chk_SecondEventsDescriptor_eventList(EL1, EL2),
5371%%     ok;
5372%% chk_SecondEventsDescriptor(D1, D2) ->
5373%%     wrong_type('SecondEventsDescriptor', D1, D2).
5374
5375%% chk_SecondEventsDescriptor_eventList([], []) ->
5376%%     ok;
5377%% chk_SecondEventsDescriptor_eventList([] = EL1, EL2) ->
5378%%     not_equal('SecondEventsDescriptor_eventList', EL1, EL2);
5379%% chk_SecondEventsDescriptor_eventList(EL1, [] = EL2) ->
5380%%     not_equal('SecondEventsDescriptor_eventList', EL1, EL2);
5381%% chk_SecondEventsDescriptor_eventList([H|T1], [H|T2]) ->
5382%%     case is_SecondRequestedEvent(H) of
5383%% 	true ->
5384%% 	    chk_SecondEventsDescriptor_eventList(T1, T2);
5385%% 	false ->
5386%% 	    wrong_type('SecondEventsDescriptor_eventList_val', H)
5387%%     end;
5388%% chk_SecondEventsDescriptor_eventList([H1|T1], [H2|T2]) ->
5389%%     validate(fun() -> chk_SecondRequestedEvent(H1, H2) end,
5390%% 	     'SecondEventsDescriptor_eventList_val'),
5391%%     chk_SecondEventsDescriptor_eventList(T1, T2);
5392%% chk_SecondEventsDescriptor_eventList(L1, L2) ->
5393%%     wrong_type('SecondEventsDescriptor_eventList_val', L1, L2).
5394
5395
5396%% %% -- SecondRequestedEvent --
5397
5398%% is_SecondRequestedEvent(#'SecondRequestedEvent'{pkgdName    = N,
5399%% 						streamID    = SID,
5400%% 						eventAction = EA,
5401%% 						evParList   = EPL}) ->
5402%%     is_PkgdName(N) andalso
5403%% 	is_opt_StreamID(SID) andalso
5404%% 	is_opt_SecondRequestedActions(EA) andalso
5405%% 	is_SecondRequestedEvent_evParList(EPL);
5406%% is_SecondRequestedEvent(_) ->
5407%%     false.
5408
5409%% is_SecondRequestedEvent_evParList([]) ->
5410%%     true;
5411%% is_SecondRequestedEvent_evParList([H|T]) ->
5412%%     is_EventParameter(H) andalso is_SecondRequestedEvent_evParList(T);
5413%% is_SecondRequestedEvent_evParList(_) ->
5414%%     false.
5415
5416%% chk_SecondRequestedEvent(RE, RE) ->
5417%%     chk_type(fun is_SecondRequestedEvent/1, 'SecondRequestedEvent', RE);
5418%% chk_SecondRequestedEvent(#'SecondRequestedEvent'{pkgdName    = N1,
5419%% 						 streamID    = SID1,
5420%% 						 eventAction = EA1,
5421%% 						 evParList   = EPL1},
5422%% 			 #'SecondRequestedEvent'{pkgdName    = N2,
5423%% 						 streamID    = SID2,
5424%% 						 eventAction = EA2,
5425%% 						 evParList   = EPL2}) ->
5426%%     validate(fun() -> chk_PkgdName(N1, N2) end, 'SecondRequestedEvent'),
5427%%     validate(fun() -> chk_opt_StreamID(SID1, SID2) end,
5428%% 	     'SecondRequestedEvent'),
5429%%     validate(fun() -> chk_opt_SecondRequestedActions(EA1, EA2) end,
5430%% 	     'SecondRequestedEvent'),
5431%%     chk_SecondRequestedEvent_evParList(EPL1, EPL2),
5432%%     ok;
5433%% chk_SecondRequestedEvent(RE1, RE2) ->
5434%%     wrong_type('SecondRequestedEvent', RE1, RE2).
5435
5436%% chk_SecondRequestedEvent_evParList([], []) ->
5437%%     ok;
5438%% chk_SecondRequestedEvent_evParList([] = EPL1, EPL2) ->
5439%%     not_equal('SecondRequestedEvent_evParList', EPL1, EPL2);
5440%% chk_SecondRequestedEvent_evParList(EPL1, [] = EPL2) ->
5441%%     not_equal('SecondRequestedEvent_evParList', EPL1, EPL2);
5442%% chk_SecondRequestedEvent_evParList([H|T1], [H|T2]) ->
5443%%     case is_EventParameter(H) of
5444%% 	true ->
5445%% 	    chk_SecondRequestedEvent_evParList(T1, T2);
5446%% 	false ->
5447%% 	    wrong_type('SecondRequestedEvent_evParList_val', H)
5448%%     end;
5449%% chk_SecondRequestedEvent_evParList([H1|T1], [H2|T2]) ->
5450%%     validate(fun() -> chk_EventParameter(H1, H2) end,
5451%% 	     'SecondRequestedEvent_evParList_val'),
5452%%     chk_SecondRequestedEvent_evParList(T1, T2);
5453%% chk_SecondRequestedEvent_evParList(EPL1, EPL2) ->
5454%%     wrong_type('SecondRequestedEvent_evParList', EPL1, EPL2).
5455
5456
5457%% %% -- SecondRequestedActions --
5458
5459%% is_opt_SecondRequestedActions(asn1_NOVALUE) ->
5460%%     true;
5461%% is_opt_SecondRequestedActions(SRA) ->
5462%%     is_SecondRequestedActions(SRA).
5463
5464%% is_SecondRequestedActions(#'SecondRequestedActions'{keepActive        = KA,
5465%% 						    eventDM           = EDM,
5466%% 						    signalsDescriptor = SD}) ->
5467%%     is_opt_BOOLEAN(KA) andalso
5468%% 	is_opt_EventDM(EDM) andalso
5469%% 	is_opt_SignalsDescriptor(SD);
5470%% is_SecondRequestedActions(_) ->
5471%%     false.
5472
5473%% chk_opt_SecondRequestedActions(asn1_NOVALUE, asn1_NOVALUE) ->
5474%%     ok;
5475%% chk_opt_SecondRequestedActions(SRA1, SRA2) ->
5476%%     chk_SecondRequestedActions(SRA1, SRA2).
5477
5478%% chk_SecondRequestedActions(SRA, SRA) ->
5479%%     chk_type(fun is_SecondRequestedActions/1, 'SecondRequestedActions', SRA);
5480%% chk_SecondRequestedActions(
5481%%   #'SecondRequestedActions'{keepActive        = KA1,
5482%% 			    eventDM           = EDM1,
5483%% 			    signalsDescriptor = SD1},
5484%%   #'SecondRequestedActions'{keepActive        = KA2,
5485%% 			    eventDM           = EDM2,
5486%% 			    signalsDescriptor = SD2}) ->
5487%%     validate(fun() -> chk_opt_BOOLEAN(KA1, KA2) end,
5488%% 	     'SecondRequestedActions'),
5489%%     validate(fun() -> chk_opt_EventDM(EDM1, EDM2) end,
5490%% 	     'SecondRequestedActions'),
5491%%     validate(fun() -> chk_opt_SignalsDescriptor(SD1, SD2) end,
5492%% 	     'SecondRequestedActions'),
5493%%     ok;
5494%% chk_SecondRequestedActions(SRA1, SRA2) ->
5495%%     wrong_type('SecondRequestedActions', SRA1, SRA2).
5496
5497
5498%% %% -- EventBufferDescriptor --
5499
5500is_EventBufferDescriptor([]) ->
5501    true;
5502is_EventBufferDescriptor([H|T]) ->
5503    is_EventSpec(H) andalso is_EventBufferDescriptor(T);
5504is_EventBufferDescriptor(_) ->
5505    false.
5506
5507%% chk_EventBufferDescriptor([], []) ->
5508%%     ok;
5509%% chk_EventBufferDescriptor([] = D1, D2) ->
5510%%     not_equal('EventBufferDescriptor', D1, D2);
5511%% chk_EventBufferDescriptor(D1, [] = D2) ->
5512%%     not_equal('EventBufferDescriptor', D1, D2);
5513%% chk_EventBufferDescriptor([H|T1], [H|T2]) ->
5514%%     case is_EventSpec(H) of
5515%% 	true ->
5516%% 	    chk_EventBufferDescriptor(T1, T2);
5517%% 	false ->
5518%% 	    wrong_type('EventBufferDescriptor_val', H)
5519%%     end;
5520%% chk_EventBufferDescriptor([H1|T1], [H2|T2]) ->
5521%%     validate(fun() -> chk_EventSpec(H1, H2) end,
5522%% 	     'EventBufferDescriptor_val'),
5523%%     chk_EventBufferDescriptor(T1, T2);
5524%% chk_EventBufferDescriptor(D1, D2) ->
5525%%     wrong_type('EventBufferDescriptor_val', D1, D2).
5526
5527
5528%% %% -- EventSpec --
5529
5530is_EventSpec(#'EventSpec'{eventName    = N,
5531			  streamID     = SID,
5532			  eventParList = EPL}) ->
5533    is_EventName(N) andalso
5534	is_opt_StreamID(SID) andalso
5535	is_EventSpec_eventParList(EPL);
5536is_EventSpec(_) ->
5537    false.
5538
5539is_EventSpec_eventParList([]) ->
5540    true;
5541is_EventSpec_eventParList([H|T]) ->
5542    is_EventParameter(H) andalso is_EventSpec_eventParList(T);
5543is_EventSpec_eventParList(_) ->
5544    false.
5545
5546%% chk_EventSpec(ES, ES) ->
5547%%     chk_type(fun is_EventSpec/1, 'EventSpec', ES);
5548%% chk_EventSpec(#'EventSpec'{eventName    = N1,
5549%% 			   streamID     = SID1,
5550%% 			   eventParList = EPL1},
5551%% 	      #'EventSpec'{eventName    = N2,
5552%% 			   streamID     = SID2,
5553%% 			   eventParList = EPL2}) ->
5554%%     validate(fun() -> chk_EventName(N1, N2) end, 'EventSpec'),
5555%%     validate(fun() -> chk_opt_StreamID(SID1, SID2) end, 'EventSpec'),
5556%%     chk_EventSpec_eventParList(EPL1, EPL2),
5557%%     ok;
5558%% chk_EventSpec(ES1, ES2) ->
5559%%     wrong_type('EventSpec', ES1, ES2).
5560
5561%% chk_EventSpec_eventParList([], []) ->
5562%%     ok;
5563%% chk_EventSpec_eventParList([] = EPL1, EPL2) ->
5564%%     not_equal('EventSpec_eventParList', EPL1, EPL2);
5565%% chk_EventSpec_eventParList(EPL1, [] = EPL2) ->
5566%%     not_equal('EventSpec_eventParList', EPL1, EPL2);
5567%% chk_EventSpec_eventParList([H|T1], [H|T2]) ->
5568%%     case is_EventParameter(H) of
5569%% 	true ->
5570%% 	    chk_EventSpec_eventParList(T1, T2);
5571%% 	false ->
5572%% 	    wrong_type('EventSpec_eventParList_val', H)
5573%%     end;
5574%% chk_EventSpec_eventParList([H1|T1], [H2|T2]) ->
5575%%     validate(fun() -> chk_EventParameter(H1, H2) end,
5576%% 	     'EventSpec_eventParList_val'),
5577%%     chk_EventSpec_eventParList(T1, T2);
5578%% chk_EventSpec_eventParList(EPL1, EPL2) ->
5579%%     wrong_type('EventSpec_eventParList', EPL1, EPL2).
5580
5581
5582%% %% -- SignalsDescriptor --
5583
5584%% is_opt_SignalsDescriptor(asn1_NOVALUE) ->
5585%%     true;
5586%% is_opt_SignalsDescriptor(D) ->
5587%%     is_SignalsDescriptor(D).
5588
5589is_SignalsDescriptor([]) ->
5590    true;
5591is_SignalsDescriptor([H|T]) ->
5592    is_SignalRequest(H) andalso is_SignalsDescriptor(T);
5593is_SignalsDescriptor(_) ->
5594    false.
5595
5596%% chk_opt_SignalsDescriptor(asn1_NOVALUE, asn1_NOVALUE) ->
5597%%     ok;
5598%% chk_opt_SignalsDescriptor(D1, D2) ->
5599%%     chk_SignalsDescriptor(D1, D2).
5600
5601%% chk_SignalsDescriptor([], []) ->
5602%%     ok;
5603%% chk_SignalsDescriptor([] = D1, D2) ->
5604%%     not_equal('SignalsDescriptor', D1, D2);
5605%% chk_SignalsDescriptor(D1, [] = D2) ->
5606%%     not_equal('SignalsDescriptor', D1, D2);
5607%% chk_SignalsDescriptor([H|T1], [H|T2]) ->
5608%%     case is_SignalRequest(H) of
5609%% 	true ->
5610%% 	    chk_SignalsDescriptor(T1, T2);
5611%% 	false ->
5612%% 	    wrong_type('SignalsDescriptor_val', H)
5613%%     end;
5614%% chk_SignalsDescriptor([H1|T1], [H2|T2]) ->
5615%%     validate(fun() -> chk_SignalRequest(H1, H2) end, 'SignalsDescriptor_val'),
5616%%     chk_SignalsDescriptor(T1, T2);
5617%% chk_SignalsDescriptor(D1, D2) ->
5618%%     wrong_type('SignalsDescriptor', D1, D2).
5619
5620
5621%% %% -- SignalRequest --
5622
5623is_SignalRequest({Tag, Val}) ->
5624    is_SignalRequest_tag(Tag) andalso is_SignalRequest_val(Tag, Val);
5625is_SignalRequest(_) ->
5626    false.
5627
5628is_SignalRequest_tag(Tag) ->
5629    Tags = [signal, seqSigList],
5630    lists:member(Tag, Tags).
5631
5632is_SignalRequest_val(signal, Val) ->
5633    is_Signal(Val);
5634is_SignalRequest_val(seqSigList, Val) ->
5635    is_SeqSigList(Val).
5636
5637%% chk_SignalRequest(R, R) ->
5638%%     chk_type(fun is_SignalRequest/1, 'SignalRequest', R);
5639%% chk_SignalRequest({Tag, Val1} = R1, {Tag, Val2} = R2) ->
5640%%     case (is_SignalRequest_tag(Tag) andalso
5641%% 	  is_SignalRequest_val(Tag, Val1) andalso
5642%% 	  is_SignalRequest_val(Tag, Val2)) of
5643%% 	true ->
5644%% 	    chk_SignalRequest_val(Tag, Val1, Val2);
5645%% 	false ->
5646%% 	    wrong_type('SignalRequest', R1, R2)
5647%%     end;
5648%% chk_SignalRequest({Tag1, Val1} = R1, {Tag2, Val2} = R2) ->
5649%%     case ((is_SignalRequest_tag(Tag1) andalso
5650%% 	   is_SignalRequest_val(Tag1, Val1)) andalso
5651%% 	  (is_SignalRequest_tag(Tag2) andalso
5652%% 	   is_SignalRequest_val(Tag2, Val2))) of
5653%% 	true ->
5654%% 	    not_equal('SignalRequest', R1, R2);
5655%% 	false ->
5656%% 	    wrong_type('SignalRequest', R1, R2)
5657%%     end;
5658%% chk_SignalRequest(R1, R2) ->
5659%%     wrong_type('SignalRequest', R1, R2).
5660
5661%% chk_SignalRequest_val(signal, Val1, Val2) ->
5662%%     validate(fun() -> chk_Signal(Val1, Val2) end, 'SignalRequest');
5663%% chk_SignalRequest_val(seqSigList, Val1, Val2) ->
5664%%     validate(fun() -> chk_SeqSigList(Val1, Val2) end, 'SignalRequest').
5665
5666
5667%% %% -- SeqSigList --
5668
5669is_SeqSigList(#'SeqSigList'{id         = ID,
5670			    signalList = SL}) ->
5671    is_INTEGER(ID, {range, 0, 65535}) andalso
5672	is_SeqSigList_signalList(SL);
5673is_SeqSigList(_) ->
5674    false.
5675
5676is_SeqSigList_signalList([]) ->
5677    true;
5678is_SeqSigList_signalList([H|T]) ->
5679    is_Signal(H) andalso is_SeqSigList_signalList(T);
5680is_SeqSigList_signalList(_) ->
5681    false.
5682
5683%% chk_SeqSigList(L, L) ->
5684%%     chk_type(fun is_SeqSigList/1, 'SeqSigList', L);
5685%% chk_SeqSigList(#'SeqSigList'{id         = ID1,
5686%% 			     signalList = SL1},
5687%% 	       #'SeqSigList'{id         = ID2,
5688%% 			     signalList = SL2}) ->
5689%%     validate(fun() -> chk_INTEGER(ID1, ID2, {range, 0, 65535}) end,
5690%% 	     'SeqSigList'),
5691%%     chk_SeqSigList_signalList(SL1, SL2),
5692%%     ok;
5693%% chk_SeqSigList(L1, L2) ->
5694%%     wrong_type('SeqSigList', L1, L2).
5695
5696%% chk_SeqSigList_signalList([], []) ->
5697%%     ok;
5698%% chk_SeqSigList_signalList([] = L1, L2) ->
5699%%     not_equal('SeqSigList_signalList', L1, L2);
5700%% chk_SeqSigList_signalList(L1, [] = L2) ->
5701%%     not_equal('SeqSigList_signalList', L1, L2);
5702%% chk_SeqSigList_signalList([H|T1], [H|T2]) ->
5703%%     case is_Signal(H) of
5704%% 	true ->
5705%% 	    chk_SeqSigList_signalList(T1, T2);
5706%% 	false ->
5707%% 	    wrong_type('SeqSigList_signalList_val', H)
5708%%     end;
5709%% chk_SeqSigList_signalList([H1|T1], [H2|T2]) ->
5710%%     validate(fun() -> chk_Signal(H1, H2) end,
5711%% 	     'SeqSigList_signalList_val'),
5712%%     chk_SeqSigList_signalList(T1, T2);
5713%% chk_SeqSigList_signalList(L1, L2) ->
5714%%     wrong_type('SeqSigList_signalList', L1, L2).
5715
5716
5717%% %% -- Signal --
5718
5719is_Signal(#'Signal'{signalName       = N,
5720		    streamID         = SID,
5721		    sigType          = ST,
5722		    duration         = Dur,
5723		    notifyCompletion = NC,
5724		    keepActive       = KA,
5725		    sigParList       = SPL}) ->
5726    is_SignalName(N) andalso
5727	is_opt_StreamID(SID) andalso
5728	is_opt_SignalType(ST) andalso
5729	is_opt_INTEGER(Dur, {range, 0, 65535}) andalso
5730	is_opt_NotifyCompletion(NC) andalso
5731	is_opt_BOOLEAN(KA) andalso
5732	is_Signal_sigParList(SPL).
5733
5734is_Signal_sigParList([]) ->
5735    true;
5736is_Signal_sigParList([H|T]) ->
5737    is_SigParameter(H) andalso is_Signal_sigParList(T);
5738is_Signal_sigParList(_) ->
5739    false.
5740
5741%% chk_Signal(S, S) ->
5742%%     chk_type(fun is_Signal/1, 'Signal', S);
5743%% chk_Signal(#'Signal'{signalName       = N1,
5744%% 		     streamID         = SID1,
5745%% 		     sigType          = ST1,
5746%% 		     duration         = Dur1,
5747%% 		     notifyCompletion = NC1,
5748%% 		     keepActive       = KA1,
5749%% 		     sigParList       = SPL1},
5750%% 	   #'Signal'{signalName       = N2,
5751%% 		     streamID         = SID2,
5752%% 		     sigType          = ST2,
5753%% 		     duration         = Dur2,
5754%% 		     notifyCompletion = NC2,
5755%% 		     keepActive       = KA2,
5756%% 		     sigParList       = SPL2}) ->
5757%%     validate(fun() -> chk_SignalName(N1, N2) end, 'Signal'),
5758%%     validate(fun() -> chk_opt_StreamID(SID1, SID2) end, 'Signal'),
5759%%     validate(fun() -> chk_opt_SignalType(ST1, ST2) end, 'Signal'),
5760%%     validate(fun() -> chk_opt_INTEGER(Dur1, Dur2, {range, 0, 65535}) end,
5761%% 	     'Signal'),
5762%%     validate(fun() -> chk_opt_NotifyCompletion(NC1, NC2) end, 'Signal'),
5763%%     validate(fun() -> chk_opt_BOOLEAN(KA1, KA2) end, 'Signal'),
5764%%     chk_Signal_sigParList(SPL1, SPL2),
5765%%     ok;
5766%% chk_Signal(S1, S2) ->
5767%%     wrong_type('Signal', S1, S2).
5768
5769%% chk_Signal_sigParList([], []) ->
5770%%     ok;
5771%% chk_Signal_sigParList([] = L1, L2) ->
5772%%     not_equal('Signal_sigParList', L1, L2);
5773%% chk_Signal_sigParList(L1, [] = L2) ->
5774%%     not_equal('Signal_sigParList', L1, L2);
5775%% chk_Signal_sigParList([H|T1], [H|T2]) ->
5776%%     case is_SigParameter(H) of
5777%% 	true ->
5778%% 	    chk_Signal_sigParList(T1, T2);
5779%% 	false ->
5780%% 	    wrong_type('Signal_sigParList_val', H)
5781%%     end;
5782%% chk_Signal_sigParList([H1|T1], [H2|T2]) ->
5783%%     validate(fun() -> chk_SigParameter(H1, H2) end,
5784%% 	     'Signal_sigParList_val'),
5785%%     chk_Signal_sigParList(T1, T2);
5786%% chk_Signal_sigParList(L1, L2) ->
5787%%     wrong_type('Signal_sigParList', L1, L2).
5788
5789
5790%% %% -- SignalType --
5791
5792is_opt_SignalType(asn1_NOVALUE) ->
5793    true;
5794is_opt_SignalType(T) ->
5795    is_SignalType(T).
5796
5797is_SignalType(T) ->
5798    Types = [brief, onOff, timeOut],
5799    lists:member(T, Types).
5800
5801%% chk_opt_SignalType(asn1_NOVALUE, asn1_NOVALUE) ->
5802%%     ok;
5803%% chk_opt_SignalType(T1, T2) ->
5804%%     chk_SignalType(T1, T2).
5805
5806%% chk_SignalType(T, T) ->
5807%%     chk_type(fun is_SignalType/1, 'SignalType', T);
5808%% chk_SignalType(T1, T2) ->
5809%%     case (is_SignalType(T1) andalso is_SignalType(T2)) of
5810%% 	true ->
5811%% 	    not_equal('SignalType', T1, T2);
5812%% 	false ->
5813%% 	    wrong_type('SignalType', T1, T2)
5814%%     end.
5815
5816
5817%% %% -- SignalName --
5818
5819is_SignalName(N) -> is_PkgdName(N).
5820
5821%% chk_SignalName(N1, N2) ->
5822%%     validate(fun() -> chk_PkgdName(N1, N2) end, 'SignalName').
5823
5824
5825%% %% -- NotifyCompletion --
5826
5827is_opt_NotifyCompletion(NC) ->
5828    is_OPTIONAL(fun is_NotifyCompletion/1, NC).
5829
5830is_NotifyCompletion(NC) ->
5831    Valids = [onTimeOut,
5832	      onInterruptByEvent,
5833	      onInterruptByNewSignalDescr,
5834	      otherReason],
5835    lists:member(NC, Valids).
5836
5837%% chk_opt_NotifyCompletion(NC1, NC2) ->
5838%%     chk_OPTIONAL('NotifyCompletion', NC1, NC2,
5839%% 		 fun is_NotifyCompletion/1,
5840%% 		 fun chk_NotifyCompletion/2).
5841
5842%% chk_NotifyCompletion(NC, NC) ->
5843%%     chk_type(fun is_NotifyCompletion/1, 'NotifyCompletion', NC);
5844%% chk_NotifyCompletion(NC1, NC2) ->
5845%%     case (is_NotifyCompletion(NC1) andalso is_NotifyCompletion(NC2)) of
5846%% 	true ->
5847%% 	    not_equal('NotifyCompletion', NC1, NC2);
5848%% 	false ->
5849%% 	    wrong_type('NotifyCompletion', NC1, NC2)
5850%%     end.
5851
5852
5853%% %% -- SigParameter --
5854
5855is_SigParameter(#'SigParameter'{sigParameterName = N,
5856				value            = V,
5857				extraInfo        = I}) ->
5858    is_Name(N) andalso
5859	is_Value(V) andalso
5860	is_SigParameter_extraInfo(I);
5861is_SigParameter(_) ->
5862    false.
5863
5864is_SigParameter_extraInfo({Tag, Val}) ->
5865    is_SigParameter_extraInfo_tag(Tag) andalso
5866	is_SigParameter_extraInfo_val(Tag, Val);
5867is_SigParameter_extraInfo(_) ->
5868    false.
5869
5870is_SigParameter_extraInfo_tag(Tag) ->
5871    Tags = [relation, range, sublist],
5872    lists:member(Tag, Tags).
5873
5874is_SigParameter_extraInfo_val(relation, Val) ->
5875    is_Relation(Val);
5876is_SigParameter_extraInfo_val(range, Val) ->
5877    is_BOOLEAN(Val);
5878is_SigParameter_extraInfo_val(sublist, Val) ->
5879    is_BOOLEAN(Val).
5880
5881%% chk_SigParameter(P, P) ->
5882%%     chk_type(fun is_SigParameter/1, 'SigParameter', P);
5883%% chk_SigParameter(#'SigParameter'{sigParameterName = N1,
5884%% 				 value            = V1,
5885%% 				 extraInfo        = I1},
5886%% 		 #'SigParameter'{sigParameterName = N2,
5887%% 				 value            = V2,
5888%% 				 extraInfo        = I2}) ->
5889%%     validate(fun() -> chk_Name(N1, N2) end, 'SigParameter'),
5890%%     validate(fun() -> chk_Value(V1, V2) end, 'SigParameter'),
5891%%     chk_SigParameter_extraInfo(I1, I2),
5892%%     ok;
5893%% chk_SigParameter(P1, P2) ->
5894%%     wrong_type('SigParameter', P1, P2).
5895
5896%% chk_SigParameter_extraInfo(EI, EI) ->
5897%%     chk_type(fun is_SigParameter_extraInfo/1, 'SigParameter_extraInfo', EI);
5898%% chk_SigParameter_extraInfo({Tag, Val1} = EI1, {Tag, Val2} = EI2) ->
5899%%     case (is_SigParameter_extraInfo_tag(Tag) and
5900%% 	  is_SigParameter_extraInfo_val(Tag, Val1) and
5901%% 	  is_SigParameter_extraInfo_val(Tag, Val2)) of
5902%% 	true ->
5903%% 	    chk_SigParameter_extraInfo_val(Tag, Val1, Val2);
5904%% 	false ->
5905%% 	    wrong_type('SigParameter_extraInfo', EI1, EI2)
5906%%     end;
5907%% chk_SigParameter_extraInfo({Tag1, Val1} = EI1, {Tag2, Val2} = EI2) ->
5908%%     case ((is_SigParameter_extraInfo_tag(Tag1) and
5909%% 	   is_SigParameter_extraInfo_val(Tag1, Val1)) and
5910%% 	  (is_SigParameter_extraInfo_tag(Tag2) and
5911%% 	   is_SigParameter_extraInfo_val(Tag2, Val2))) of
5912%% 	true ->
5913%% 	    not_equal('SigParameter_extraInfo', EI1, EI2);
5914%% 	false ->
5915%% 	    wrong_type('SigParameter_extraInfo', EI1, EI2)
5916%%     end;
5917%% chk_SigParameter_extraInfo(EI1, EI2) ->
5918%%     wrong_type('SigParameter_extraInfo', EI1, EI2).
5919
5920%% chk_SigParameter_extraInfo_val(relation, Val1, Val2) ->
5921%%     validate(fun() -> chk_Relation(Val1, Val2) end, 'SigParameter_extraInfo');
5922%% chk_SigParameter_extraInfo_val(range, Val1, Val2) ->
5923%%     validate(fun() -> chk_BOOLEAN(Val1, Val2) end, 'SigParameter_extraInfo');
5924%% chk_SigParameter_extraInfo_val(sublist, Val1, Val2) ->
5925%%     validate(fun() -> chk_BOOLEAN(Val1, Val2) end, 'SigParameter_extraInfo').
5926
5927
5928%% %% -- RequestID --
5929
5930%% is_opt_RequestID(asn1_NOVALUE) ->
5931%%     true;
5932%% is_opt_RequestID(V) ->
5933%%     is_RequestID(V).
5934
5935%% is_RequestID(V) -> is_INTEGER(V, {range, 0, 4294967295}).
5936
5937%% chk_opt_RequestID(asn1_NOVALUE, asn1_NOVALUE) ->
5938%%     ok;
5939%% chk_opt_RequestID(V1, V2) ->
5940%%     chk_RequestID(V1, V2).
5941
5942%% chk_RequestID(ID, ID) ->
5943%%     chk_type(fun is_RequestID/1, 'RequestID', ID);
5944%% chk_RequestID(ID1, ID2) ->
5945%%     case (is_RequestID(ID1) andalso is_RequestID(ID2)) of
5946%% 	true ->
5947%% 	    not_equal('RequestID', ID1, ID2);
5948%% 	false ->
5949%% 	    wrong_type('RequestID', ID1, ID2)
5950%%     end.
5951
5952
5953%% %% -- ModemDescriptor --
5954
5955%% is_ModemDescriptor(D) when record(D, 'ModemDescriptor') ->
5956%%     true;
5957%% is_ModemDescriptor(_) ->
5958%%     false.
5959
5960%% chk_ModemDescriptor(D, D) when record(D, 'ModemDescriptor') ->
5961%%     ok;
5962%% chk_ModemDescriptor(#'ModemDescriptor'{mtl             = MTL1,
5963%% 				       mpl             = MPL1,
5964%% 				       nonStandardData = NSD1},
5965%% 		    #'ModemDescriptor'{mtl             = MTL2,
5966%% 				       mpl             = MPL2,
5967%% 				       nonStandardData = NSD2}) ->
5968%%     chk_ModemDescriptor_mtl(MTL1, MTL2),
5969%%     chk_ModemDescriptor_mpl(MPL1, MPL2),
5970%%     chk_opt_NonStandardData(NSD1, NSD2),
5971%%     ok;
5972%% chk_ModemDescriptor(D1, D2) ->
5973%%     wrong_type('ModemDescriptor', D1, D2).
5974
5975%% chk_ModemDescriptor_mtl([], []) ->
5976%%     ok;
5977%% chk_ModemDescriptor_mtl([] = MTL1, MTL2) ->
5978%%     not_equal('ModemDescriptor_mtl', MTL1, MTL2);
5979%% chk_ModemDescriptor_mtl(MTL1, [] = MTL2) ->
5980%%     not_equal('ModemDescriptor_mtl', MTL1, MTL2);
5981%% chk_ModemDescriptor_mtl([H|T1], [H|T2]) ->
5982%%     case is_ModemType(H) of
5983%% 	true ->
5984%% 	    chk_ModemDescriptor_mtl(T1, T2);
5985%% 	false ->
5986%% 	    wrong_type('ModemDescriptor_mtl_val', H)
5987%%     end;
5988%% chk_ModemDescriptor_mtl([H1|T1], [H2|T2]) ->
5989%%     validate(fun() -> chk_ModemType(H1, H2) end, 'ModemDescriptor_mtl_val'),
5990%%     chk_ModemDescriptor_mtl(T1, T2);
5991%% chk_ModemDescriptor_mtl(MTL1, MTL2) ->
5992%%     wrong_type('ModemDescriptor_mtl', MTL1, MTL2).
5993
5994
5995%% chk_ModemDescriptor_mpl([], []) ->
5996%%     ok;
5997%% chk_ModemDescriptor_mpl([] = MPL1, MPL2) ->
5998%%     not_equal('ModemDescriptor_mpl', MPL1, MPL2);
5999%% chk_ModemDescriptor_mpl(MPL1, [] = MPL2) ->
6000%%     not_equal('ModemDescriptor_mpl', MPL1, MPL2);
6001%% chk_ModemDescriptor_mpl([H|T1], [H|T2]) ->
6002%%     case is_PropertyParm(H) of
6003%% 	true ->
6004%% 	    chk_ModemDescriptor_mpl(T1, T2);
6005%% 	false ->
6006%% 	    wrong_type('ModemDescriptor_mpl_val', H)
6007%%     end;
6008%% chk_ModemDescriptor_mpl([H1|T1], [H2|T2]) ->
6009%%     validate(fun() -> chk_PropertyParm(H1, H2) end, 'ModemDescriptor_mpl_val'),
6010%%     chk_ModemDescriptor_mpl(T1, T2);
6011%% chk_ModemDescriptor_mpl(MPL1, MPL2) ->
6012%%     wrong_type('ModemDescriptor_mpl', MPL1, MPL2).
6013
6014
6015%% %% -- ModemType --
6016
6017%% chk_ModemType(MT, MT) ->
6018%%     case is_ModemType(MT) of
6019%% 	true ->
6020%% 	    ok;
6021%% 	false ->
6022%% 	    wrong_type('ModemType', MT, MT)
6023%%     end;
6024%% chk_ModemType(MT1, MT2) ->
6025%%     case (is_ModemType(MT1) andalso is_ModemType(MT2)) of
6026%% 	true ->
6027%% 	    not_equal('ModemType', MT1, MT2);
6028%% 	false ->
6029%% 	    wrong_type('ModemType', MT1, MT2)
6030%%     end.
6031
6032%% is_ModemType(MT) ->
6033%%     lists:member(MT,
6034%% 		 [v18, v22, v22bis, v32, v32bis, v34, v90, v91, synchISDN]).
6035
6036
6037%% %% -- DigitMapDescriptor --
6038
6039%% is_DigitMapDescriptor(#'DigitMapDescriptor'{digitMapName  = Name,
6040%% 					    digitMapValue = Val}) ->
6041%%     is_opt_DigitMapName(Name) andalso is_opt_DigitMapValue(Val);
6042%% is_DigitMapDescriptor(_) ->
6043%%     false.
6044
6045%% chk_DigitMapDescriptor(D, D) ->
6046%%     chk_type(fun is_DigitMapDescriptor/1, 'DigitMapDescriptor', D);
6047%% chk_DigitMapDescriptor(#'DigitMapDescriptor'{digitMapName  = Name1,
6048%% 					     digitMapValue = Val1},
6049%% 		       #'DigitMapDescriptor'{digitMapName  = Name2,
6050%% 					     digitMapValue = Val2}) ->
6051%%     d("chk_DigitMapDescriptor -> entry with"
6052%%       "~n   Name1: ~p"
6053%%       "~n   Name2: ~p"
6054%%       "~n   Val1:  ~p"
6055%%       "~n   Val2:  ~p", [Name1, Name2, Val1, Val2]),
6056%%     validate(fun() -> chk_opt_DigitMapName(Name1, Name2) end,
6057%% 		      'DigitMapDescriptor'),
6058%%     validate(fun() -> chk_opt_DigitMapValue(Val1, Val2) end,
6059%% 		      'DigitMapDescriptor'),
6060%%     ok;
6061%% chk_DigitMapDescriptor(D1, D2) ->
6062%%     wrong_type('DigitMapDescriptor', D1, D2).
6063
6064
6065%% %% -- DigitMapName --
6066
6067%% is_opt_DigitMapName(asn1_NOVALUE) ->
6068%%     true;
6069%% is_opt_DigitMapName(N) ->
6070%%     is_DigitMapName(N).
6071
6072%% is_DigitMapName(N) -> is_Name(N).
6073
6074%% chk_opt_DigitMapName(asn1_NOVALUE, asn1_NOVALUE) ->
6075%%     ok;
6076%% chk_opt_DigitMapName(N1, N2) ->
6077%%     chk_DigitMapName(N1, N2).
6078
6079%% chk_DigitMapName(N, N) ->
6080%%     chk_type(fun is_DigitMapName/1, 'DigitMapName', N);
6081%% chk_DigitMapName(N1, N2) ->
6082%%     case (is_DigitMapName(N1) andalso is_DigitMapName(N2)) of
6083%% 	true ->
6084%% 	    not_equal('DigitMapName', N1, N2);
6085%% 	false ->
6086%% 	    wrong_type('DigitMapName', N1, N2)
6087%%     end.
6088
6089
6090%% %% -- DigitMapValue --
6091
6092%% is_opt_DigitMapValue(V) ->
6093%%     is_OPTIONAL(fun is_DigitMapValue/1, V).
6094
6095%% is_DigitMapValue(#'DigitMapValue'{startTimer    = Start,
6096%% 				  shortTimer    = Short,
6097%% 				  longTimer     = Long,
6098%% 				  digitMapBody  = Body,
6099%% 				  durationTimer = Dur}) ->
6100%%     is_DigitMapValue_startTimer(Start) andalso
6101%% 	is_DigitMapValue_shortTimer(Short) andalso
6102%% 	is_DigitMapValue_longTimer(Long) andalso
6103%% 	is_IA5String(Body) andalso
6104%% 	is_DigitMapValue_durationTimer(Dur);
6105%% is_DigitMapValue(_) ->
6106%%     false.
6107
6108%% is_DigitMapValue_startTimer(asn1_NOVALUE)    -> true;
6109%% is_DigitMapValue_startTimer(T)               -> is_INTEGER(T, {range, 0, 99}).
6110
6111%% is_DigitMapValue_shortTimer(asn1_NOVALUE)    -> true;
6112%% is_DigitMapValue_shortTimer(T)               -> is_INTEGER(T, {range, 0, 99}).
6113
6114%% is_DigitMapValue_longTimer(asn1_NOVALUE)     -> true;
6115%% is_DigitMapValue_longTimer(T)                -> is_INTEGER(T, {range, 0, 99}).
6116
6117%% is_DigitMapValue_durationTimer(asn1_NOVALUE) -> true;
6118%% is_DigitMapValue_durationTimer(T)            -> is_INTEGER(T, {range, 0, 99}).
6119
6120%% chk_opt_DigitMapValue(V1, V2) ->
6121%%     chk_OPTIONAL('DigitMapValue', V1, V2,
6122%% 		 fun is_DigitMapValue/1, fun chk_DigitMapValue/2).
6123
6124%% chk_DigitMapValue(#'DigitMapValue'{startTimer    = Start1,
6125%% 				   shortTimer    = Short1,
6126%% 				   longTimer     = Long1,
6127%% 				   digitMapBody  = Body1,
6128%% 				   durationTimer = Dur1},
6129%% 		  #'DigitMapValue'{startTimer    = Start2,
6130%% 				   shortTimer    = Short2,
6131%% 				   longTimer     = Long2,
6132%% 				   digitMapBody  = Body2,
6133%% 				   durationTimer = Dur2}) ->
6134%%     d("chk_DigitMapValue -> entry with"
6135%%       "~n   Start1: ~p"
6136%%       "~n   Start2: ~p"
6137%%       "~n   Short1: ~p"
6138%%       "~n   Short2: ~p"
6139%%       "~n   Long1:  ~p"
6140%%       "~n   Long2:  ~p"
6141%%       "~n   Body1:  ~p"
6142%%       "~n   Body2:  ~p"
6143%%       "~n   Dur1:   ~p"
6144%%       "~n   Dur2:   ~p", [Start1, Start2,
6145%% 			  Short1, Short2,
6146%% 			  Long1, Long2,
6147%% 			  Body1, Body2,
6148%% 			  Dur1, Dur2]),
6149%%     chk_DigitMapValue_startTimer(Start1, Start2),
6150%%     chk_DigitMapValue_shortTimer(Short1, Short2),
6151%%     chk_DigitMapValue_longTimer(Long1, Long2),
6152%%     chk_DigitMapValue_digitMapBody(Body1, Body2),
6153%%     chk_DigitMapValue_durationTimer(Dur1, Dur2),
6154%%     ok;
6155%% chk_DigitMapValue(V1, V2) ->
6156%%     wrong_type('DigitMapValue', V1, V2).
6157
6158%% chk_DigitMapValue_startTimer(T, T) ->
6159%%     chk_type(fun is_DigitMapValue_startTimer/1, 'DigitMapValue_startTimer', T);
6160%% chk_DigitMapValue_startTimer(T1, T2) ->
6161%%     case (is_DigitMapValue_startTimer(T1) andalso
6162%% 	  is_DigitMapValue_startTimer(T2)) of
6163%% 	true ->
6164%% 	    not_equal('DigitMapValue_startTimer', T1, T2);
6165%% 	false ->
6166%% 	    wrong_type('DigitMapValue_startTimer', T1, T2)
6167%%     end.
6168
6169%% chk_DigitMapValue_shortTimer(T, T) ->
6170%%     chk_type(fun is_DigitMapValue_shortTimer/1, 'DigitMapValue_shortTimer', T);
6171%% chk_DigitMapValue_shortTimer(T1, T2) ->
6172%%     case (is_DigitMapValue_shortTimer(T1) andalso
6173%% 	  is_DigitMapValue_shortTimer(T2)) of
6174%% 	true ->
6175%% 	    not_equal('DigitMapValue_shortTimer', T1, T2);
6176%% 	false ->
6177%% 	    wrong_type('DigitMapValue_shortTimer', T1, T2)
6178%%     end.
6179
6180%% chk_DigitMapValue_longTimer(T, T) ->
6181%%     chk_type(fun is_DigitMapValue_longTimer/1, 'DigitMapValue_longTimer', T);
6182%% chk_DigitMapValue_longTimer(T1, T2) ->
6183%%     case (is_DigitMapValue_longTimer(T1) andalso
6184%% 	  is_DigitMapValue_longTimer(T2)) of
6185%% 	true ->
6186%% 	    not_equal('DigitMapValue_longTimer', T1, T2);
6187%% 	false ->
6188%% 	    wrong_type('DigitMapValue_longTimer', T1, T2)
6189%%     end.
6190
6191%% chk_DigitMapValue_durationTimer(T, T) ->
6192%%     chk_type(fun is_DigitMapValue_durationTimer/1,
6193%% 	     'DigitMapValue_durationTimer', T);
6194%% chk_DigitMapValue_durationTimer(T1, T2) ->
6195%%     case (is_DigitMapValue_durationTimer(T1) andalso
6196%% 	  is_DigitMapValue_durationTimer(T2)) of
6197%% 	true ->
6198%% 	    not_equal('DigitMapValue_durationTimer', T1, T2);
6199%% 	false ->
6200%% 	    wrong_type('DigitMapValue_durationTimer', T1, T2)
6201%%     end.
6202
6203%% chk_DigitMapValue_digitMapBody(B, B) ->
6204%%     d("chk_DigitMapValue_digitMapBody -> entry with"
6205%%       "~n   B: ~p", [B]),
6206%%     chk_type(fun is_IA5String/1, 'DigitMapValue_digitMapBody', B);
6207%% chk_DigitMapValue_digitMapBody(B1, B2) ->
6208%%     d("chk_DigitMapValue_digitMapBody -> entry with"
6209%%       "~n   B1: ~p"
6210%%       "~n   B2: ~p", [B1, B2]),
6211%%     case (is_IA5String(B1) andalso is_IA5String(B2)) of
6212%% 	true ->
6213%% 	    %% If they are different it could be because
6214%% 	    %% of trailing tab's and newline's.
6215%% 	    case compare_strings(B1, B2) of
6216%% 		{[], []} ->
6217%% 		    ok;
6218%% 		{Str1, []} ->
6219%% 		    case strip_tab_and_newline(Str1) of
6220%% 			[] ->
6221%% 			    ok;
6222%% 			_ ->
6223%% 			    not_equal('DigitMapValue_digitMapBody', B1, B2)
6224%% 		    end;
6225%% 		{[], Str2} ->
6226%% 		    case strip_tab_and_newline(Str2) of
6227%% 			[] ->
6228%% 			    ok;
6229%% 			_ ->
6230%% 			    not_equal('DigitMapValue_digitMapBody', B1, B2)
6231%% 		    end;
6232%% 		_ ->
6233%% 		    not_equal('DigitMapValue_digitMapBody', B1, B2)
6234%% 	    end;
6235%% 	false ->
6236%% 	    wrong_type('DigitMapValue_digitMapBody', B1, B2)
6237%%     end.
6238
6239%% %% -- ServiceChangeParm --
6240
6241%% is_ServiceChangeParm(#'ServiceChangeParm'{serviceChangeMethod  = M,
6242%% 					  serviceChangeAddress = A,
6243%% 					  serviceChangeVersion = V,
6244%% 					  serviceChangeProfile = P,
6245%% 					  serviceChangeReason  = R,
6246%% 					  serviceChangeDelay   = D,
6247%% 					  serviceChangeMgcId   = Id,
6248%% 					  timeStamp            = TS,
6249%% 					  nonStandardData      = NSD,
6250%% 					  serviceChangeInfo    = I}) ->
6251%%     is_ServiceChangeMethod(M) andalso
6252%% 	is_opt_ServiceChangeAddress(A) andalso
6253%% 	is_opt_INTEGER(V, {range, 0, 99}) andalso
6254%% 	is_opt_ServiceChangeProfile(P) andalso
6255%% 	is_Value(R) andalso
6256%% 	is_opt_INTEGER(D, {range, 0, 4294967295}) andalso
6257%% 	is_opt_MId(Id) andalso
6258%% 	is_opt_TimeNotation(TS) andalso
6259%% 	is_opt_NonStandardData(NSD) andalso
6260%% 	is_opt_AuditDescriptor(I);
6261%% is_ServiceChangeParm(_) ->
6262%%     false.
6263
6264%% chk_ServiceChangeParm(P, P) ->
6265%%     chk_type(fun is_ServiceChangeParm/1, 'ServiceChangeParm', P);
6266%% chk_ServiceChangeParm(#'ServiceChangeParm'{serviceChangeMethod  = M1,
6267%% 					   serviceChangeAddress = A1,
6268%% 					   serviceChangeVersion = V1,
6269%% 					   serviceChangeProfile = P1,
6270%% 					   serviceChangeReason  = R1,
6271%% 					   serviceChangeDelay   = D1,
6272%% 					   serviceChangeMgcId   = Id1,
6273%% 					   timeStamp            = TS1,
6274%% 					   nonStandardData      = NSD1,
6275%% 					   serviceChangeInfo    = I1},
6276%% 		      #'ServiceChangeParm'{serviceChangeMethod  = M2,
6277%% 					   serviceChangeAddress = A2,
6278%% 					   serviceChangeVersion = V2,
6279%% 					   serviceChangeProfile = P2,
6280%% 					   serviceChangeReason  = R2,
6281%% 					   serviceChangeDelay   = D2,
6282%% 					   serviceChangeMgcId   = Id2,
6283%% 					   timeStamp            = TS2,
6284%% 					   nonStandardData      = NSD2,
6285%% 					   serviceChangeInfo    = I2}) ->
6286%%     validate(fun() -> chk_ServiceChangeMethod(M1, M2) end,
6287%% 	     'ServiceChangeParm'),
6288%%     validate(fun() -> chk_opt_ServiceChangeAddress(A1, A2) end,
6289%% 	     'ServiceChangeParm'),
6290%%     validate(fun() -> chk_opt_INTEGER(V1, V2, {range, 0, 99}) end,
6291%% 	     'ServiceChangeParm'),
6292%%     validate(fun() -> chk_opt_ServiceChangeProfile(P1, P2) end,
6293%% 	     'ServiceChangeParm'),
6294%%     validate(fun() -> chk_Value(R1, R2) end,
6295%% 	     'ServiceChangeParm'),
6296%%     validate(fun() -> chk_opt_INTEGER(D1, D2, {range, 0, 4294967295}) end,
6297%% 	     'ServiceChangeParm'),
6298%%     validate(fun() -> chk_opt_MId(Id1, Id2) end,
6299%% 	     'ServiceChangeParm'),
6300%%     validate(fun() -> chk_opt_TimeNotation(TS1, TS2) end,
6301%% 	     'ServiceChangeParm'),
6302%%     validate(fun() -> chk_opt_NonStandardData(NSD1, NSD2) end,
6303%% 	     'ServiceChangeParm'),
6304%%     validate(fun() -> chk_opt_AuditDescriptor(I1, I2) end,
6305%% 	     'ServiceChangeParm'),
6306%%     ok;
6307%% chk_ServiceChangeParm(P1, P2) ->
6308%%     wrong_type('ServiceChangeParm', P1, P2).
6309
6310
6311%% %% -- ServiceChangeAddress --
6312
6313%% is_opt_ServiceChangeAddress(A) ->
6314%%     is_OPTIONAL(fun is_ServiceChangeAddress/1, A).
6315
6316%% is_ServiceChangeAddress({Tag, Val}) ->
6317%%     is_ServiceChangeAddress_tag(Tag) andalso
6318%% 	is_ServiceChangeAddress_val(Tag, Val);
6319%% is_ServiceChangeAddress(_) ->
6320%%     false.
6321
6322%% is_ServiceChangeAddress_tag(Tag) ->
6323%%     Tags = [portNumber, ip4Address, ip6Address, domainName, deviceName,
6324%% 	    mtpAddress],
6325%%     lists:member(Tag, Tags).
6326
6327%% is_ServiceChangeAddress_val(portNumber, Val) ->
6328%%     is_INTEGER(Val, {range, 0, 65535});
6329%% is_ServiceChangeAddress_val(ip4Address, Val) ->
6330%%     is_IP4Address(Val);
6331%% is_ServiceChangeAddress_val(ip6Address, Val) ->
6332%%     is_IP6Address(Val);
6333%% is_ServiceChangeAddress_val(domainName, Val) ->
6334%%     is_DomainName(Val);
6335%% is_ServiceChangeAddress_val(deviceName, Val) ->
6336%%     is_PathName(Val);
6337%% is_ServiceChangeAddress_val(mtpAddress, Val) ->
6338%%     is_OCTET_STRING(Val, {range, 2, 4}).
6339
6340
6341%% chk_opt_ServiceChangeAddress(A1, A2) ->
6342%%     chk_OPTIONAL('ServiceChangeAddress', A1, A2,
6343%% 		 fun is_ServiceChangeAddress/1,
6344%% 		 fun chk_ServiceChangeAddress/2).
6345
6346%% chk_ServiceChangeAddress(A, A) ->
6347%%     chk_type(fun is_ServiceChangeAddress/1, 'ServiceChangeAddress', A);
6348%% chk_ServiceChangeAddress({Tag, Val1} = A1, {Tag, Val2} = A2) ->
6349%%     case (is_ServiceChangeAddress_tag(Tag) andalso
6350%% 	  is_ServiceChangeAddress_val(Tag, Val1) andalso
6351%% 	  is_ServiceChangeAddress_val(Tag, Val2)) of
6352%% 	true ->
6353%% 	    chk_ServiceChangeAddress_val(Tag, Val1, Val2);
6354%% 	false ->
6355%% 	    wrong_type('ServiceChangeAddress', A1, A2)
6356%%     end;
6357%% chk_ServiceChangeAddress({Tag1, Val1} = A1, {Tag2, Val2} = A2) ->
6358%%     case ((is_ServiceChangeAddress_tag(Tag1) andalso
6359%% 	   is_ServiceChangeAddress_val(Tag1, Val1)) andalso
6360%% 	  (is_ServiceChangeAddress_tag(Tag2) andalso
6361%% 	   is_ServiceChangeAddress_val(Tag2, Val2))) of
6362%% 	true ->
6363%% 	    not_equal('ServiceChangeAddress', A1, A2);
6364%% 	false ->
6365%% 	    wrong_type('ServiceChangeAddress', A1, A2)
6366%%     end;
6367%% chk_ServiceChangeAddress(A1, A2) ->
6368%%     wrong_type('ServiceChangeAddress', A1, A2).
6369
6370%% chk_ServiceChangeAddress_val(portNumber, Val1, Val2) ->
6371%%     validate(fun() -> chk_INTEGER(Val1, Val2, {range, 0, 99}) end,
6372%% 	     'ServiceChangeAddress');
6373%% chk_ServiceChangeAddress_val(ip4Address, Val1, Val2) ->
6374%%     validate(fun() -> chk_IP4Address(Val1, Val2) end,
6375%% 	     'ServiceChangeAddress');
6376%% chk_ServiceChangeAddress_val(ip6Address, Val1, Val2) ->
6377%%     validate(fun() -> chk_IP6Address(Val1, Val2) end,
6378%% 	     'ServiceChangeAddress');
6379%% chk_ServiceChangeAddress_val(domainName, Val1, Val2) ->
6380%%     validate(fun() -> chk_DomainName(Val1, Val2) end,
6381%% 	     'ServiceChangeAddress');
6382%% chk_ServiceChangeAddress_val(deviceName, Val1, Val2) ->
6383%%     validate(fun() -> chk_PathName(Val1, Val2) end,
6384%% 	     'ServiceChangeAddress');
6385%% chk_ServiceChangeAddress_val(mtpAddress, Val1, Val2) ->
6386%%     validate(fun() -> chk_OCTET_STRING(Val1, Val2, {range, 2, 4}) end,
6387%% 	     'ServiceChangeAddress').
6388
6389
6390%% %% -- ServiceChangeResParm --
6391
6392%% is_ServiceChangeResParm(#'ServiceChangeResParm'{serviceChangeMgcId   = Id,
6393%% 						serviceChangeAddress = A,
6394%% 						serviceChangeVersion = V,
6395%% 						serviceChangeProfile = P,
6396%% 						timeStamp            = TS}) ->
6397%%     is_opt_MId(Id) andalso
6398%% 	is_opt_ServiceChangeAddress(A) andalso
6399%% 	is_opt_INTEGER(V, {range, 0, 99}) andalso
6400%% 	is_opt_ServiceChangeProfile(P) andalso
6401%% 	is_opt_TimeNotation(TS);
6402%% is_ServiceChangeResParm(_) ->
6403%%     false.
6404
6405%% chk_ServiceChangeResParm(P, P) ->
6406%%     chk_type(fun is_ServiceChangeResParm/1, 'ServiceChangeResParm', P);
6407%% chk_ServiceChangeResParm(
6408%%   #'ServiceChangeResParm'{serviceChangeMgcId   = Id1,
6409%% 			  serviceChangeAddress = A1,
6410%% 			  serviceChangeVersion = V1,
6411%% 			  serviceChangeProfile = P1,
6412%% 			  timeStamp            = TS1},
6413%%   #'ServiceChangeResParm'{serviceChangeMgcId   = Id2,
6414%% 			  serviceChangeAddress = A2,
6415%% 			  serviceChangeVersion = V2,
6416%% 			  serviceChangeProfile = P2,
6417%% 			  timeStamp            = TS2}) ->
6418%%     validate(fun() -> chk_opt_MId(Id1, Id2) end, 'ServiceChangeResParm'),
6419%%     validate(fun() -> chk_opt_ServiceChangeAddress(A1, A2) end,
6420%% 	     'ServiceChangeResParm'),
6421%%     validate(fun() -> chk_opt_INTEGER(V1, V2, {range, 0, 99}) end,
6422%% 	     'ServiceChangeResParm'),
6423%%     validate(fun() -> chk_opt_ServiceChangeProfile(P1, P2) end,
6424%% 	     'ServiceChangeResParm'),
6425%%     validate(fun() -> chk_opt_TimeNotation(TS1, TS2) end,
6426%% 	     'ServiceChangeResParm'),
6427%%     ok;
6428%% chk_ServiceChangeResParm(P1, P2) ->
6429%%     wrong_type('ServiceChangeResParm', P1, P2).
6430
6431
6432%% %% -- ServiceChangeMethod --
6433
6434%% is_ServiceChangeMethod(M) ->
6435%%     Methods = [failover, forced, graceful, restart, disconnected, handOff],
6436%%     lists:member(M, Methods).
6437
6438%% chk_ServiceChangeMethod(M, M) ->
6439%%     chk_type(fun is_ServiceChangeMethod/1, 'ServiceChangeMethod', M);
6440%% chk_ServiceChangeMethod(M1, M2) ->
6441%%     case (is_ServiceChangeMethod(M1) andalso is_ServiceChangeMethod(M2)) of
6442%% 	true ->
6443%% 	    not_equal('ServiceChangeMethod', M1, M2);
6444%% 	false ->
6445%% 	    wrong_type('ServiceChangeMethod', M1, M2)
6446%%     end.
6447
6448
6449%% %% -- ServiceChangeProfile --
6450
6451%% is_opt_ServiceChangeProfile(P) ->
6452%%     is_OPTIONAL(fun is_ServiceChangeProfile/1, P).
6453
6454%% is_ServiceChangeProfile(#'ServiceChangeProfile'{profileName = N}) ->
6455%%     is_IA5String(N, {range, 1, 67});
6456%% is_ServiceChangeProfile(_) ->
6457%%     false.
6458
6459%% chk_opt_ServiceChangeProfile(P1, P2) ->
6460%%     chk_OPTIONAL('ServiceChangeProfile', P1, P2,
6461%% 		 fun is_ServiceChangeProfile/1,
6462%% 		 fun chk_ServiceChangeProfile/2).
6463
6464%% chk_ServiceChangeProfile(P, P) ->
6465%%     chk_type(fun is_ServiceChangeProfile/1, 'ServiceChangeProfile', P);
6466%% chk_ServiceChangeProfile(#'ServiceChangeProfile'{profileName = N1},
6467%% 			 #'ServiceChangeProfile'{profileName = N2}) ->
6468%%     validate(fun() -> chk_IA5String(N1, N2, {range, 1, 67}) end,
6469%% 	     'ServiceChangeProfile'),
6470%%     ok;
6471%% chk_ServiceChangeProfile(P1, P2) ->
6472%%     wrong_type('ServiceChangeProfile', P1, P2).
6473
6474
6475%% %% -- PackagesDescriptor --
6476
6477%% is_PackagesDescriptor([]) ->
6478%%     true;
6479%% is_PackagesDescriptor([H|T]) ->
6480%%     is_PackagesItem(H) andalso is_PackagesDescriptor(T);
6481%% is_PackagesDescriptor(_) ->
6482%%     false.
6483
6484%% chk_PackagesDescriptor([], []) ->
6485%%     ok;
6486%% chk_PackagesDescriptor([] = D1, D2) ->
6487%%     not_equal('PackagesDescriptor', D1, D2);
6488%% chk_PackagesDescriptor(D1, [] = D2) ->
6489%%     not_equal('PackagesDescriptor', D1, D2);
6490%% chk_PackagesDescriptor([H|T1], [H|T2]) ->
6491%%     case is_PackagesItem(H) of
6492%% 	true ->
6493%% 	    chk_PackagesDescriptor(T1, T2);
6494%% 	false ->
6495%% 	    wrong_type('PackagesDescriptor_val', H)
6496%%     end;
6497%% chk_PackagesDescriptor([H1|T1], [H2|T2]) ->
6498%%     validate(fun() -> chk_PackagesItem(H1, H2) end,
6499%% 	     'PackagesDescriptor_val'),
6500%%     chk_PackagesDescriptor(T1, T2);
6501%% chk_PackagesDescriptor(D1, D2) ->
6502%%     wrong_type('PackagesDescriptor_val', D1, D2).
6503
6504
6505%% %% -- PackagesItem --
6506
6507%% is_PackagesItem(#'PackagesItem'{packageName    = N,
6508%% 				packageVersion = V}) ->
6509%%     is_Name(N) andalso is_INTEGER(V, {range, 0, 99});
6510%% is_PackagesItem(_) ->
6511%%     false.
6512
6513%% chk_PackagesItem(I, I) ->
6514%%     chk_type(fun is_PackagesItem/1, 'PackagesItem', I);
6515%% chk_PackagesItem(#'PackagesItem'{packageName    = N1,
6516%% 				 packageVersion = V1},
6517%% 		 #'PackagesItem'{packageName    = N2,
6518%% 				 packageVersion = V2}) ->
6519%%     validate(fun() -> chk_Name(N1, N2) end, 'PackagesItem'),
6520%%     validate(fun() -> chk_INTEGER(V1, V2, {range, 0, 99}) end, 'PackagesItem'),
6521%%     ok;
6522%% chk_PackagesItem(I1, I2) ->
6523%%     wrong_type('PackagesItem', I1, I2).
6524
6525
6526%% %% -- StatisticsDescriptor --
6527
6528%% is_StatisticsDescriptor([]) ->
6529%%     true;
6530%% is_StatisticsDescriptor([H|T]) ->
6531%%     is_StatisticsParameter(H) andalso is_StatisticsDescriptor(T);
6532%% is_StatisticsDescriptor(_) ->
6533%%     false.
6534
6535%% chk_StatisticsDescriptor([], []) ->
6536%%     ok;
6537%% chk_StatisticsDescriptor([] = D1, D2) ->
6538%%     not_equal('StatisticsDescriptor', D1, D2);
6539%% chk_StatisticsDescriptor(D1, [] = D2) ->
6540%%     not_equal('StatisticsDescriptor', D1, D2);
6541%% chk_StatisticsDescriptor([H|T1], [H|T2]) ->
6542%%     case is_StatisticsParameter(H) of
6543%% 	true ->
6544%% 	    chk_StatisticsDescriptor(T1, T2);
6545%% 	false ->
6546%% 	    wrong_type('StatisticsDescriptor_val', H)
6547%%     end;
6548%% chk_StatisticsDescriptor([H1|T1], [H2|T2]) ->
6549%%     validate(fun() -> chk_StatisticsParameter(H1, H2) end,
6550%% 	     'StatisticsDescriptor_val'),
6551%%     chk_StatisticsDescriptor(T1, T2);
6552%% chk_StatisticsDescriptor(D1, D2) ->
6553%%     wrong_type('StatisticsDescriptor_val', D1, D2).
6554
6555
6556%% %% -- StatisticsParameter --
6557
6558%% is_StatisticsParameter(#'StatisticsParameter'{statName  = N,
6559%% 					      statValue = V}) ->
6560%%     is_PkgdName(N) andalso is_opt_Value(V);
6561%% is_StatisticsParameter(_) ->
6562%%     false.
6563
6564%% chk_StatisticsParameter(P, P) ->
6565%%     chk_type(fun is_StatisticsParameter/1, 'StatisticsParameter', P);
6566%% chk_StatisticsParameter(#'StatisticsParameter'{statName  = N1,
6567%% 					       statValue = V1},
6568%% 			#'StatisticsParameter'{statName  = N2,
6569%% 					       statValue = V2}) ->
6570%%     validate(fun() -> chk_PkgdName(N1, N2) end, 'StatisticsParameter'),
6571%%     validate(fun() -> chk_opt_Value(V1, V2) end, 'StatisticsParameter'),
6572%%     ok;
6573%% chk_StatisticsParameter(P1, P2) ->
6574%%     wrong_type('StatisticsParameter', P1, P2).
6575
6576
6577%% %% -- NonStandardData --
6578
6579%% is_opt_NonStandardData(asn1_NOVALUE) ->
6580%%     true;
6581%% is_opt_NonStandardData(NSD) ->
6582%%     is_NonStandardData(NSD).
6583
6584%% %% is_NonStandardData(#'NonStandardData'{nonStandardIdentifier = Id,
6585%% %% 				      data                  = D}) ->
6586%% %%     is_NonStandardIdentifier(Id) andalso is_OCTET_STRING(D);
6587%% %% is_NonStandardData(_) ->
6588%% %%     false.
6589
6590%% is_NonStandardData(_) ->
6591%%     true.
6592
6593%% chk_opt_NonStandardData(asn1_NOVALUE, asn1_NOVALUE) ->
6594%%     true;
6595%% chk_opt_NonStandardData(NSD1, NSD2) ->
6596%%     chk_NonStandardData(NSD1, NSD2).
6597
6598%% chk_NonStandardData(NSD, NSD) ->
6599%%     chk_type(fun is_NonStandardData/1, 'NonStandardData', NSD);
6600%% %% chk_NonStandardData(#'NonStandardData'{nonStandardIdentifier = Id1,
6601%% %% 				       data                  = D1},
6602%% %% 		    #'NonStandardData'{nonStandardIdentifier = Id2,
6603%% %% 				       data                  = D2}) ->
6604%% %%     validate(fun() -> chk_NonStandardIdentifier(Id1, Id2) end,
6605%% %% 	     'NonStandardData'),
6606%% %%     validate(fun() -> chk_OCTET_STRING(D1, D2) end, 'NonStandardData'),
6607%% %%     ok;
6608%% %% chk_NonStandardData(NSD1, NSD2) ->
6609%% %%     wrong_type('NonStandardData', NSD1, NSD2).
6610%% chk_NonStandardData(NSD1, NSD2) ->
6611%%     not_equal('NonStandardData', NSD1, NSD2).
6612
6613
6614%% %% -- NonStandardIdentifier --
6615
6616%% %% is_NonStandardIdentifier({Tag, Val}) ->
6617%% %%     is_NonStandardIdentifier_tag(Tag) andalso
6618%% %% 	is_NonStandardIdentifier_val(Tag, Val);
6619%% %% is_NonStandardIdentifier(_) ->
6620%% %%     false.
6621
6622%% %% is_NonStandardIdentifier_tag(Tag) ->
6623%% %%     Tags = [object, h221NonStandard, experimental],
6624%% %%     lists:member(Tag, Tags).
6625
6626%% %% is_NonStandardIdentifier_val(object, Val) ->
6627%% %%     is_OBJECT_IDENTIFIER(Val);
6628%% %% is_NonStandardIdentifier_val(h221NonStandard, Val) ->
6629%% %%     is_H221NonStandard(Val);
6630%% %% is_NonStandardIdentifier_val(experimental, Val) ->
6631%% %%     is_IA5String(Val, {exact, 8}).
6632
6633%% %% chk_NonStandardIdentifier(Id, Id) ->
6634%% %%     chk_type(fun is_NonStandardIdentifier/1, 'NonStandardIdentifier', Id);
6635%% %% chk_NonStandardIdentifier({Tag, Val1} = Id1, {Tag, Val2} = Id2) ->
6636%% %%     case (is_NonStandardIdentifier_tag(Tag) andalso
6637%% %% 	  is_NonStandardIdentifier_val(Tag, Val1) andalso
6638%% %% 	  is_NonStandardIdentifier_val(Tag, Val1)) of
6639%% %% 	true ->
6640%% %% 	    chk_NonStandardIdentifier_val(Tag, Val1, Val2);
6641%% %% 	false ->
6642%% %% 	    wrong_type('NonStandardIdentifier', Id1, Id2)
6643%% %%     end;
6644%% %% chk_NonStandardIdentifier({Tag1, Val1} = Id1, {Tag2, Val2} = Id2) ->
6645%% %%     case ((is_NonStandardIdentifier_tag(Tag1) andalso
6646%% %% 	   is_NonStandardIdentifier_val(Tag1, Val1)) andalso
6647%% %% 	  (is_NonStandardIdentifier_tag(Tag2) andalso
6648%% %% 	   is_NonStandardIdentifier_val(Tag2, Val1))) of
6649%% %% 	true ->
6650%% %% 	    not_equal('NonStandardIdentifier', Id1, Id2);
6651%% %% 	false ->
6652%% %% 	    wrong_type('NonStandardIdentifier', Id1, Id2)
6653%% %%     end;
6654%% %% chk_NonStandardIdentifier(Id1, Id2) ->
6655%% %%     wrong_type('NonStandardIdentifier', Id1, Id2).
6656
6657%% %% chk_NonStandardIdentifier_val(object, Val1, Val2) ->
6658%% %%     chk_OBJECT_IDENTIFIER(Val1, Val2);
6659%% %% chk_NonStandardIdentifier_val(h221NonStandard, Val1, Val2) ->
6660%% %%     chk_H221NonStandard(Val1, Val2);
6661%% %% chk_NonStandardIdentifier_val(experimental, Val1, Val2) ->
6662%% %%     chk_IA5String(Val1, Val2, {exact, 8}).
6663
6664
6665%% %% -- H221NonStandard --
6666
6667%% %% is_H221NonStandard(#'H221NonStandard'{t35CountryCode1  = CC1,
6668%% %% 				      t35CountryCode2  = CC2,
6669%% %% 				      t35Extension     = Ext,
6670%% %% 				      manufacturerCode = MC}) ->
6671%% %%     is_INTEGER(CC1, {range, 0, 255}) andalso
6672%% %% 	is_INTEGER(CC2, {range, 0, 255}) andalso
6673%% %% 	is_INTEGER(Ext, {range, 0, 255}) andalso
6674%% %% 	is_INTEGER(Ext, {range, 0, 65535});
6675%% %% is_H221NonStandard(_) ->
6676%% %%     false.
6677
6678%% %% chk_H221NonStandard(NS, NS) ->
6679%% %%     chk_type(fun is_H221NonStandard/1, 'H221NonStandard', NS);
6680%% %% chk_H221NonStandard(#'H221NonStandard'{t35CountryCode1  = CC11,
6681%% %% 				       t35CountryCode2  = CC21,
6682%% %% 				       t35Extension     = Ext1,
6683%% %% 				       manufacturerCode = MC1},
6684%% %% 		    #'H221NonStandard'{t35CountryCode1  = CC12,
6685%% %% 				       t35CountryCode2  = CC22,
6686%% %% 				       t35Extension     = Ext2,
6687%% %% 				       manufacturerCode = MC2}) ->
6688%% %%     validate(fun() -> chk_INTEGER(CC11, CC12, {range, 0, 255}) end,
6689%% %% 	     'H221NonStandard'),
6690%% %%     validate(fun() -> chk_INTEGER(CC21, CC22, {range, 0, 255}) end,
6691%% %% 	     'H221NonStandard'),
6692%% %%     validate(fun() -> chk_INTEGER(Ext1, Ext2, {range, 0, 255}) end,
6693%% %% 	     'H221NonStandard'),
6694%% %%     validate(fun() -> chk_INTEGER(MC1, MC2, {range, 0, 65535}) end,
6695%% %% 	     'H221NonStandard'),
6696%% %%     ok;
6697%% %% chk_H221NonStandard(NS1, NS2) ->
6698%% %%     wrong_type('H221NonStandard', NS1, NS2).
6699
6700
6701%% %% -- TimeNotation --
6702
6703%% is_opt_TimeNotation(asn1_NOVALUE) ->
6704%%     true;
6705%% is_opt_TimeNotation(TN) ->
6706%%     is_TimeNotation(TN).
6707
6708%% is_TimeNotation(#'TimeNotation'{date = D, time = T}) ->
6709%%     is_IA5String(D, {exact, 8}) andalso is_IA5String(T, {exact, 8});
6710%% is_TimeNotation(_) ->
6711%%     false.
6712
6713%% chk_opt_TimeNotation(asn1_NOVALUE, asn1_NOVALUE) ->
6714%%     ok;
6715%% chk_opt_TimeNotation(TN1, TN2) ->
6716%%     chk_TimeNotation(TN1, TN2).
6717
6718%% chk_TimeNotation(TN, TN) ->
6719%%     chk_type(fun is_TimeNotation/1, 'TimeNotation', TN);
6720%% chk_TimeNotation(#'TimeNotation'{date = D1, time = T1},
6721%% 		 #'TimeNotation'{date = D2, time = T2}) ->
6722%%     validate(fun() -> chk_IA5String(D1, D2, {exact, 8}) end, 'TimeNotation'),
6723%%     validate(fun() -> chk_IA5String(T1, T2, {exact, 8}) end, 'TimeNotation'),
6724%%     ok;
6725%% chk_TimeNotation(TN1, TN2) ->
6726%%     wrong_type('TimeNotation', TN1, TN2).
6727
6728
6729%% %% -- Value --
6730
6731%% is_opt_Value(V) ->
6732%%     is_OPTIONAL(fun is_Value/1, V).
6733
6734is_Value([]) ->
6735    true;
6736is_Value([H|T]) ->
6737    is_OCTET_STRING(H) andalso is_Value(T);
6738is_Value(_) ->
6739    false.
6740
6741%% chk_opt_Value(V1, V2) ->
6742%%     chk_OPTIONAL('Value', V1, V2, fun is_Value/1, fun chk_Value/2).
6743
6744%% chk_Value(V, V) ->
6745%%     case is_Value(V) of
6746%% 	true ->
6747%% 	    ok;
6748%% 	false ->
6749%% 	    wrong_type('Value', V, V)
6750%%     end;
6751%% chk_Value(V1, V2) ->
6752%%     case (is_Value(V1) andalso is_Value(V2)) of
6753%% 	true ->
6754%% 	    not_equal('Value', V1, V2);
6755%% 	false ->
6756%% 	    wrong_type('Value', V1, V2)
6757%%     end.
6758
6759
6760%% %% ----------------------------------------------------------------------
6761%% %% Basic type check functions
6762%% %% ----------------------------------------------------------------------
6763
6764
6765is_opt_BOOLEAN(B) ->
6766    is_OPTIONAL(fun is_BOOLEAN/1, B).
6767
6768is_BOOLEAN(B) ->
6769    lists:member(B, [true, false]).
6770
6771%% chk_opt_BOOLEAN(B1, B2) ->
6772%%     chk_OPTIONAL('BOOLEAN', B1, B2, fun is_BOOLEAN/1, fun chk_BOOLEAN/2).
6773
6774%% chk_BOOLEAN(B, B) ->
6775%%     chk_type(fun is_BOOLEAN/1, 'BOOLEAN', B);
6776%% chk_BOOLEAN(B1, B2) ->
6777%%     case (is_BOOLEAN(B1) andalso is_BOOLEAN(B2)) of
6778%% 	true ->
6779%% 	    not_equal('BOOLEAN', B1, B2);
6780%% 	false ->
6781%% 	    wrong_type('BOOLEAN', B1, B2)
6782%%     end.
6783
6784
6785%% is_IA5String(S) when list(S) ->
6786%%     true;
6787%% is_IA5String(_) ->
6788%%     false.
6789
6790%% is_IA5String(S, _) when list(S) ->
6791%%     true;
6792%% is_IA5String(_, _) ->
6793%%     false.
6794
6795%% %% chk_IA5String(S, S) ->
6796%% %%     chk_type(fun is_IA5String/1, 'IA5String', S);
6797%% %% chk_IA5String(S1, S2) ->
6798%% %%     case (is_IA5String(S1) andalso is_IA5String(S2)) of
6799%% %% 	true ->
6800%% %% 	    not_equal('IA5String', S1, S2);
6801%% %% 	false ->
6802%% %% 	    wrong_type('IA5String', S1, S2)
6803%% %%     end.
6804
6805%% chk_IA5String(S, S, R) ->
6806%%     chk_type(fun is_IA5String/2, 'IA5String', S, R);
6807%% chk_IA5String(S1, S2, R) ->
6808%%     case (is_IA5String(S1, R) andalso is_IA5String(S2, R)) of
6809%% 	true ->
6810%% 	    not_equal('IA5String', S1, S2);
6811%% 	false ->
6812%% 	    wrong_type('IA5String', S1, S2)
6813%%     end.
6814
6815
6816is_OCTET_STRING(L) -> is_OCTET_STRING(L, any).
6817
6818is_OCTET_STRING(L, any) when is_list(L) ->
6819    true;
6820is_OCTET_STRING(L, {exact, Len}) when is_list(L) andalso (length(L) =:= Len) ->
6821    true;
6822is_OCTET_STRING(L, {atleast, Len}) when is_list(L) andalso (Len =< length(L)) ->
6823    true;
6824is_OCTET_STRING(L, {atmost, Len}) when is_list(L) andalso (length(L) =< Len) ->
6825    true;
6826is_OCTET_STRING(L, {range, Min, Max})
6827  when is_list(L) andalso (Min =< length(L)) andalso (length(L) =< Max) ->
6828    true;
6829is_OCTET_STRING(_, _) ->
6830    false.
6831
6832%% %% chk_OCTET_STRING(L1, L2) ->
6833%% %%     chk_OCTET_STRING(L1, L2, any).
6834
6835%% chk_OCTET_STRING(L, L, R) ->
6836%%     chk_type(fun is_OCTET_STRING/2, 'OCTET STRING', L, R);
6837%% chk_OCTET_STRING(L1, L2, R) ->
6838%%     case (is_OCTET_STRING(L1, R) andalso is_OCTET_STRING(L2, R)) of
6839%% 	true ->
6840%% 	    not_equal('OCTET STRING', L1, L2);
6841%% 	false ->
6842%% 	    wrong_type('OCTET STRING', L1, L2)
6843%%     end.
6844
6845
6846%% %% is_OBJECT_IDENTIFIER(_) ->
6847%% %%     true.
6848
6849%% %% chk_OBJECT_IDENTIFIER(X, X) ->
6850%% %%     ok;
6851%% %% chk_OBJECT_IDENTIFIER(X1, X2) ->
6852%% %%     not_equal('OBJECT IDENTIFIER', X1, X2).
6853
6854
6855%% is_opt_NULL(N) ->
6856%%     is_OPTIONAL(fun is_NULL/1, N).
6857
6858%% is_NULL('NULL') ->
6859%%     true;
6860%% is_NULL(_) ->
6861%%     false.
6862
6863%% chk_opt_NULL(N1, N2) ->
6864%%     chk_OPTIONAL('NULL', N1, N2, fun is_NULL/1, fun chk_NULL/2).
6865
6866%% chk_NULL(N, N) ->
6867%%     chk_type(fun is_NULL/1, 'NULL', N);
6868%% chk_NULL(N1, N2) ->
6869%%     case (is_NULL(N1) andalso is_NULL(N2)) of
6870%% 	true ->
6871%% 	    not_equal('NULL', N1, N2);
6872%% 	false ->
6873%% 	    wrong_type('NULL', N1, N2)
6874%%     end.
6875
6876
6877is_opt_INTEGER(I, R) ->
6878    is_OPTIONAL(fun(X) -> is_INTEGER(X, R) end, I).
6879
6880is_INTEGER(I, any) when is_integer(I) ->
6881    true;
6882is_INTEGER(I, {exact, I}) when is_integer(I) ->
6883    true;
6884is_INTEGER(I, {atleast, Min}) when is_integer(I) andalso is_integer(Min) andalso (Min =< I) ->
6885    true;
6886is_INTEGER(I, {atmost, Max}) when is_integer(I) andalso is_integer(Max) andalso (I =< Max) ->
6887    true;
6888is_INTEGER(I, {range, Min, Max})
6889  when is_integer(I) andalso
6890       is_integer(Min) andalso
6891       is_integer(Max) andalso
6892       (Min =< I) andalso
6893       (I =< Max) ->
6894    true;
6895is_INTEGER(_, _) ->
6896    false.
6897
6898%% chk_opt_INTEGER(I1, I2, R) ->
6899%%     chk_OPTIONAL('INTEGER', I1, I2,
6900%% 		 fun(X) -> is_INTEGER(X, R) end,
6901%% 		 fun(Y1, Y2) -> chk_INTEGER(Y1, Y2, R) end).
6902
6903%% chk_INTEGER(I, I, R) ->
6904%%     chk_type(fun is_INTEGER/2, 'INTEGER', I, R);
6905%% chk_INTEGER(I1, I2, R) ->
6906%%     case (is_INTEGER(I1, R) andalso is_INTEGER(I2, R)) of
6907%% 	true ->
6908%% 	    not_equal('INTEGER', I1, I2);
6909%% 	false ->
6910%% 	    wrong_type('INTEGER', I1, I2)
6911%%     end.
6912
6913
6914%% %% ----------------------------------------------------------------------
6915%% %% Various utility functions
6916%% %% ----------------------------------------------------------------------
6917
6918
6919%% to_lower([C|Cs]) when C >= $A, C =< $Z ->
6920%%     [C+($a-$A)|to_lower(Cs)];
6921%% to_lower([C|Cs]) ->
6922%%     [C|to_lower(Cs)];
6923%% to_lower([]) ->
6924%%     [].
6925
6926
6927%% validate(F, Type) when function(F) ->
6928%%     case (catch F()) of
6929%% 	{error, Reason} ->
6930%% 	    error({Type, Reason});
6931%% 	ok ->
6932%% 	    ok
6933%%     end.
6934
6935
6936%% chk_type(F, T, V) when function(F), atom(T) ->
6937%%     case F(V) of
6938%% 	true ->
6939%% 	    ok;
6940%% 	false ->
6941%% 	    wrong_type(T, V)
6942%%     end.
6943
6944%% chk_type(F, T, V1, V2) when function(F), atom(T) ->
6945%%     case F(V1, V2) of
6946%% 	true ->
6947%% 	    ok;
6948%% 	false ->
6949%% 	    wrong_type(T, V1)
6950%%     end.
6951
6952
6953is_OPTIONAL(_, asn1_NOVALUE) ->
6954    true;
6955is_OPTIONAL(F, Val) when is_function(F) ->
6956    F(Val).
6957
6958%% chk_OPTIONAL(_, asn1_NOVALUE, asn1_NOVALUE, _, _) ->
6959%%     ok;
6960%% chk_OPTIONAL(Type, asn1_NOVALUE = V1, V2, IS, _CHK) when function(IS) ->
6961%%     case IS(V2) of
6962%% 	true ->
6963%% 	    not_equal(Type, V1, V2);
6964%% 	false ->
6965%% 	    wrong_type(Type, V1, V2)
6966%%     end;
6967%% chk_OPTIONAL(Type, V1, asn1_NOVALUE = V2, IS, _CHK) when function(IS) ->
6968%%     case IS(V1) of
6969%% 	true ->
6970%% 	    not_equal(Type, V1, V2);
6971%% 	false ->
6972%% 	    wrong_type(Type, V1, V2)
6973%%     end;
6974%% chk_OPTIONAL(_Type, V1, V2, _IS, CHK) when function(CHK) ->
6975%%     CHK(V1, V2).
6976
6977
6978%% %% ----------------------------------------------------------------------
6979
6980%% compare_strings([] = L1, L2) ->
6981%%     {L1, L2};
6982%% compare_strings(L1, [] = L2) ->
6983%%     {L1, L2};
6984%% compare_strings([H|T1], [H|T2]) ->
6985%%     compare_strings(T1, T2);
6986%% compare_strings(L1, L2) ->
6987%%     {L1, L2}.
6988
6989%% strip_tab_and_newline([]) ->
6990%%     [];
6991%% strip_tab_and_newline([$\n|T]) ->
6992%%     strip_tab_and_newline(T);
6993%% strip_tab_and_newline([$\t|T]) ->
6994%%     strip_tab_and_newline(T);
6995%% strip_tab_and_newline([H|T]) ->
6996%%     [H|strip_tab_and_newline(T)].
6997
6998
6999%% ----------------------------------------------------------------------
7000
7001%% atmost_once(Type, Val) ->
7002%%     error({atmost_once, {Type, Val}}).
7003
7004%% wrong_type(Type, Val) ->
7005%%     error({wrong_type, {Type, Val}}).
7006
7007%% wrong_type(Type, Val1, Val2) ->
7008%%     error({wrong_type, {Type, Val1, Val2}}).
7009
7010%% not_equal(What, Val1, Val2) ->
7011%%     error({not_equal, {What, Val1, Val2}}).
7012
7013error(Reason) ->
7014    throw({error, Reason}).
7015
7016
7017%% ----------------------------------------------------------------------
7018
7019%% d(F) ->
7020%%     d(F, []).
7021
7022d(F, A) ->
7023    d(get(dbg), F, A).
7024
7025d(true, F, A) ->
7026    io:format("DBG:" ++ F ++ "~n", A);
7027d(_, _, _) ->
7028    ok.
7029
7030