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