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