Home | History | Annotate | Download | only in src
      1 /* ------------------------------------------------------------------
      2  * Copyright (C) 1998-2009 PacketVideo
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
     13  * express or implied.
     14  * See the License for the specific language governing permissions
     15  * and limitations under the License.
     16  * -------------------------------------------------------------------
     17  */
     18 // ============================================================(Auto)=
     19 // FILE: h245_encoder.c
     20 //
     21 // DESC: PER Encode routines for H.245
     22 // -------------------------------------------------------------------
     23 //  Copyright (c) 1998- 2000, PacketVideo Corporation.
     24 //                   All Rights Reserved.
     25 // ===================================================================
     26 
     27 #include "per_headers.h"
     28 #include "h245def.h"
     29 #include "h245_encoder.h"
     30 
     31 /* <=======================================================> */
     32 /*  PER-Encoder for MultimediaSystemControlMessage (CHOICE)  */
     33 /* <=======================================================> */
     34 void Encode_MultimediaSystemControlMessage(PS_MultimediaSystemControlMessage x, PS_OutStream stream)
     35 {
     36     PutChoiceIndex(4, 1, x->index, stream);
     37     switch (x->index)
     38     {
     39         case 0:
     40             Encode_RequestMessage(x->request, stream);
     41             break;
     42         case 1:
     43             Encode_ResponseMessage(x->response, stream);
     44             break;
     45         case 2:
     46             Encode_CommandMessage(x->command, stream);
     47             break;
     48         case 3:
     49             Encode_IndicationMessage(x->indication, stream);
     50             break;
     51             /* ------------------------------- */
     52             /* ---- Extension Begins Here ---- */
     53             /* ------------------------------- */
     54         default:
     55             ErrorMessageAndLeave("Encode_MultimediaSystemControlMessage: Illegal CHOICE index");
     56     }
     57 }
     58 
     59 /* <=======================================> */
     60 /*  PER-Encoder for RequestMessage (CHOICE)  */
     61 /* <=======================================> */
     62 void Encode_RequestMessage(PS_RequestMessage x, PS_OutStream stream)
     63 {
     64     PutChoiceIndex(11, 1, x->index, stream);
     65     switch (x->index)
     66     {
     67         case 0:
     68             Encode_NonStandardMessage(x->nonStandard, stream);
     69             break;
     70         case 1:
     71             Encode_MasterSlaveDetermination(x->masterSlaveDetermination, stream);
     72             break;
     73         case 2:
     74             Encode_TerminalCapabilitySet(x->terminalCapabilitySet, stream);
     75             break;
     76         case 3:
     77             Encode_OpenLogicalChannel(x->openLogicalChannel, stream);
     78             break;
     79         case 4:
     80             Encode_CloseLogicalChannel(x->closeLogicalChannel, stream);
     81             break;
     82         case 5:
     83             Encode_RequestChannelClose(x->requestChannelClose, stream);
     84             break;
     85         case 6:
     86             Encode_MultiplexEntrySend(x->multiplexEntrySend, stream);
     87             break;
     88         case 7:
     89             Encode_RequestMultiplexEntry(x->requestMultiplexEntry, stream);
     90             break;
     91         case 8:
     92             Encode_RequestMode(x->requestMode, stream);
     93             break;
     94         case 9:
     95             Encode_RoundTripDelayRequest(x->roundTripDelayRequest, stream);
     96             break;
     97         case 10:
     98             Encode_MaintenanceLoopRequest(x->maintenanceLoopRequest, stream);
     99             break;
    100             /* ------------------------------- */
    101             /* ---- Extension Begins Here ---- */
    102             /* ------------------------------- */
    103         case 11:
    104             PutExtensionItem(EPASS Encode_CommunicationModeRequest, (uint8*)x->communicationModeRequest, stream);
    105             break;
    106         case 12:
    107             PutExtensionItem(EPASS Encode_ConferenceRequest, (uint8*)x->conferenceRequest, stream);
    108             break;
    109         case 13:
    110             PutExtensionItem(EPASS Encode_MultilinkRequest, (uint8*)x->multilinkRequest, stream);
    111             break;
    112         case 14:
    113             PutExtensionItem(EPASS Encode_LogicalChannelRateRequest, (uint8*)x->logicalChannelRateRequest, stream);
    114             break;
    115         default:
    116             ErrorMessageAndLeave("Encode_RequestMessage: Illegal CHOICE index");
    117     }
    118 }
    119 
    120 /* <========================================> */
    121 /*  PER-Encoder for ResponseMessage (CHOICE)  */
    122 /* <========================================> */
    123 void Encode_ResponseMessage(PS_ResponseMessage x, PS_OutStream stream)
    124 {
    125     PutChoiceIndex(19, 1, x->index, stream);
    126     switch (x->index)
    127     {
    128         case 0:
    129             Encode_NonStandardMessage(x->nonStandard, stream);
    130             break;
    131         case 1:
    132             Encode_MasterSlaveDeterminationAck(x->masterSlaveDeterminationAck, stream);
    133             break;
    134         case 2:
    135             Encode_MasterSlaveDeterminationReject(x->masterSlaveDeterminationReject, stream);
    136             break;
    137         case 3:
    138             Encode_TerminalCapabilitySetAck(x->terminalCapabilitySetAck, stream);
    139             break;
    140         case 4:
    141             Encode_TerminalCapabilitySetReject(x->terminalCapabilitySetReject, stream);
    142             break;
    143         case 5:
    144             Encode_OpenLogicalChannelAck(x->openLogicalChannelAck, stream);
    145             break;
    146         case 6:
    147             Encode_OpenLogicalChannelReject(x->openLogicalChannelReject, stream);
    148             break;
    149         case 7:
    150             Encode_CloseLogicalChannelAck(x->closeLogicalChannelAck, stream);
    151             break;
    152         case 8:
    153             Encode_RequestChannelCloseAck(x->requestChannelCloseAck, stream);
    154             break;
    155         case 9:
    156             Encode_RequestChannelCloseReject(x->requestChannelCloseReject, stream);
    157             break;
    158         case 10:
    159             Encode_MultiplexEntrySendAck(x->multiplexEntrySendAck, stream);
    160             break;
    161         case 11:
    162             Encode_MultiplexEntrySendReject(x->multiplexEntrySendReject, stream);
    163             break;
    164         case 12:
    165             Encode_RequestMultiplexEntryAck(x->requestMultiplexEntryAck, stream);
    166             break;
    167         case 13:
    168             Encode_RequestMultiplexEntryReject(x->requestMultiplexEntryReject, stream);
    169             break;
    170         case 14:
    171             Encode_RequestModeAck(x->requestModeAck, stream);
    172             break;
    173         case 15:
    174             Encode_RequestModeReject(x->requestModeReject, stream);
    175             break;
    176         case 16:
    177             Encode_RoundTripDelayResponse(x->roundTripDelayResponse, stream);
    178             break;
    179         case 17:
    180             Encode_MaintenanceLoopAck(x->maintenanceLoopAck, stream);
    181             break;
    182         case 18:
    183             Encode_MaintenanceLoopReject(x->maintenanceLoopReject, stream);
    184             break;
    185             /* ------------------------------- */
    186             /* ---- Extension Begins Here ---- */
    187             /* ------------------------------- */
    188         case 19:
    189             PutExtensionItem(EPASS Encode_CommunicationModeResponse, (uint8*)x->communicationModeResponse, stream);
    190             break;
    191         case 20:
    192             PutExtensionItem(EPASS Encode_ConferenceResponse, (uint8*)x->conferenceResponse, stream);
    193             break;
    194         case 21:
    195             PutExtensionItem(EPASS Encode_MultilinkResponse, (uint8*)x->multilinkResponse, stream);
    196             break;
    197         case 22:
    198             PutExtensionItem(EPASS Encode_LogicalChannelRateAcknowledge, (uint8*)x->logicalChannelRateAcknowledge, stream);
    199             break;
    200         case 23:
    201             PutExtensionItem(EPASS Encode_LogicalChannelRateReject, (uint8*)x->logicalChannelRateReject, stream);
    202             break;
    203         default:
    204             ErrorMessageAndLeave("Encode_ResponseMessage: Illegal CHOICE index");
    205     }
    206 }
    207 
    208 /* <=======================================> */
    209 /*  PER-Encoder for CommandMessage (CHOICE)  */
    210 /* <=======================================> */
    211 void Encode_CommandMessage(PS_CommandMessage x, PS_OutStream stream)
    212 {
    213     PutChoiceIndex(7, 1, x->index, stream);
    214     switch (x->index)
    215     {
    216         case 0:
    217             Encode_NonStandardMessage(x->nonStandard, stream);
    218             break;
    219         case 1:
    220             Encode_MaintenanceLoopOffCommand(x->maintenanceLoopOffCommand, stream);
    221             break;
    222         case 2:
    223             Encode_SendTerminalCapabilitySet(x->sendTerminalCapabilitySet, stream);
    224             break;
    225         case 3:
    226             Encode_EncryptionCommand(x->encryptionCommand, stream);
    227             break;
    228         case 4:
    229             Encode_FlowControlCommand(x->flowControlCommand, stream);
    230             break;
    231         case 5:
    232             Encode_EndSessionCommand(x->endSessionCommand, stream);
    233             break;
    234         case 6:
    235             Encode_MiscellaneousCommand(x->miscellaneousCommand, stream);
    236             break;
    237             /* ------------------------------- */
    238             /* ---- Extension Begins Here ---- */
    239             /* ------------------------------- */
    240         case 7:
    241             PutExtensionItem(EPASS Encode_CommunicationModeCommand, (uint8*)x->communicationModeCommand, stream);
    242             break;
    243         case 8:
    244             PutExtensionItem(EPASS Encode_ConferenceCommand, (uint8*)x->conferenceCommand, stream);
    245             break;
    246         case 9:
    247             PutExtensionItem(EPASS Encode_H223MultiplexReconfiguration, (uint8*)x->h223MultiplexReconfiguration, stream);
    248             break;
    249         case 10:
    250             PutExtensionItem(EPASS Encode_NewATMVCCommand, (uint8*)x->newATMVCCommand, stream);
    251             break;
    252         default:
    253             ErrorMessageAndLeave("Encode_CommandMessage: Illegal CHOICE index");
    254     }
    255 }
    256 
    257 /* <==========================================> */
    258 /*  PER-Encoder for IndicationMessage (CHOICE)  */
    259 /* <==========================================> */
    260 void Encode_IndicationMessage(PS_IndicationMessage x, PS_OutStream stream)
    261 {
    262     PutChoiceIndex(14, 1, x->index, stream);
    263     switch (x->index)
    264     {
    265         case 0:
    266             Encode_NonStandardMessage(x->nonStandard, stream);
    267             break;
    268         case 1:
    269             Encode_FunctionNotUnderstood(x->functionNotUnderstood, stream);
    270             break;
    271         case 2:
    272             Encode_MasterSlaveDeterminationRelease(x->masterSlaveDeterminationRelease, stream);
    273             break;
    274         case 3:
    275             Encode_TerminalCapabilitySetRelease(x->terminalCapabilitySetRelease, stream);
    276             break;
    277         case 4:
    278             Encode_OpenLogicalChannelConfirm(x->openLogicalChannelConfirm, stream);
    279             break;
    280         case 5:
    281             Encode_RequestChannelCloseRelease(x->requestChannelCloseRelease, stream);
    282             break;
    283         case 6:
    284             Encode_MultiplexEntrySendRelease(x->multiplexEntrySendRelease, stream);
    285             break;
    286         case 7:
    287             Encode_RequestMultiplexEntryRelease(x->requestMultiplexEntryRelease, stream);
    288             break;
    289         case 8:
    290             Encode_RequestModeRelease(x->requestModeRelease, stream);
    291             break;
    292         case 9:
    293             Encode_MiscellaneousIndication(x->miscellaneousIndication, stream);
    294             break;
    295         case 10:
    296             Encode_JitterIndication(x->jitterIndication, stream);
    297             break;
    298         case 11:
    299             Encode_H223SkewIndication(x->h223SkewIndication, stream);
    300             break;
    301         case 12:
    302             Encode_NewATMVCIndication(x->newATMVCIndication, stream);
    303             break;
    304         case 13:
    305             Encode_UserInputIndication(x->userInput, stream);
    306             break;
    307             /* ------------------------------- */
    308             /* ---- Extension Begins Here ---- */
    309             /* ------------------------------- */
    310         case 14:
    311             PutExtensionItem(EPASS Encode_H2250MaximumSkewIndication, (uint8*)x->h2250MaximumSkewIndication, stream);
    312             break;
    313         case 15:
    314             PutExtensionItem(EPASS Encode_MCLocationIndication, (uint8*)x->mcLocationIndication, stream);
    315             break;
    316         case 16:
    317             PutExtensionItem(EPASS Encode_ConferenceIndication, (uint8*)x->conferenceIndication, stream);
    318             break;
    319         case 17:
    320             PutExtensionItem(EPASS Encode_VendorIdentification, (uint8*)x->vendorIdentification, stream);
    321             break;
    322         case 18:
    323             PutExtensionItem(EPASS Encode_FunctionNotSupported, (uint8*)x->functionNotSupported, stream);
    324             break;
    325         case 19:
    326             PutExtensionItem(EPASS Encode_MultilinkIndication, (uint8*)x->multilinkIndication, stream);
    327             break;
    328         case 20:
    329             PutExtensionItem(EPASS Encode_LogicalChannelRateRelease, (uint8*)x->logicalChannelRateRelease, stream);
    330             break;
    331         case 21:
    332             PutExtensionItem(EPASS Encode_FlowControlIndication, (uint8*)x->flowControlIndication, stream);
    333             break;
    334         default:
    335             ErrorMessageAndLeave("Encode_IndicationMessage: Illegal CHOICE index");
    336     }
    337 }
    338 
    339 /* <=============================================> */
    340 /*  PER-Encoder for GenericInformation (SEQUENCE)  */
    341 /* <=============================================> */
    342 void Encode_GenericInformation(PS_GenericInformation x, PS_OutStream stream)
    343 {
    344     uint16 i;
    345     PutBoolean(0, stream); /* Extension Bit OFF */
    346     PutBoolean(x->option_of_subMessageIdentifier, stream);
    347     PutBoolean(x->option_of_messageContent, stream);
    348     Encode_CapabilityIdentifier(&x->messageIdentifier, stream);
    349     if (x->option_of_subMessageIdentifier)
    350     {
    351         PutInteger(0, 127, (uint32)x->subMessageIdentifier, stream);
    352     }
    353     if (x->option_of_messageContent)
    354     {
    355         PutLengthDet(x->size_of_messageContent, stream);
    356         for (i = 0; i < x->size_of_messageContent; ++i)
    357         {
    358             Encode_GenericParameter(x->messageContent + i, stream);
    359         }
    360     }
    361     /* ------------------------------- */
    362     /* ---- Extension Begins Here ---- */
    363     /* ------------------------------- */
    364 }
    365 
    366 /* <=============================================> */
    367 /*  PER-Encoder for NonStandardMessage (SEQUENCE)  */
    368 /* <=============================================> */
    369 void Encode_NonStandardMessage(PS_NonStandardMessage x, PS_OutStream stream)
    370 {
    371     PutBoolean(0, stream); /* Extension Bit OFF */
    372     Encode_NonStandardParameter(&x->nonStandardData, stream);
    373     /* ------------------------------- */
    374     /* ---- Extension Begins Here ---- */
    375     /* ------------------------------- */
    376 }
    377 
    378 /* <===============================================> */
    379 /*  PER-Encoder for NonStandardParameter (SEQUENCE)  */
    380 /* <===============================================> */
    381 void Encode_NonStandardParameter(PS_NonStandardParameter x, PS_OutStream stream)
    382 {
    383     Encode_NonStandardIdentifier(&x->nonStandardIdentifier, stream);
    384     PutOctetString(1, 0, 0, &x->data, stream);
    385 }
    386 
    387 /* <==============================================> */
    388 /*  PER-Encoder for NonStandardIdentifier (CHOICE)  */
    389 /* <==============================================> */
    390 void Encode_NonStandardIdentifier(PS_NonStandardIdentifier x, PS_OutStream stream)
    391 {
    392     PutChoiceIndex(2, 0, x->index, stream);
    393     switch (x->index)
    394     {
    395         case 0:
    396             PutObjectID(x->object, stream);
    397             break;
    398         case 1:
    399             Encode_H221NonStandard(x->h221NonStandard, stream);
    400             break;
    401         default:
    402             ErrorMessageAndLeave("Encode_NonStandardIdentifier: Illegal CHOICE index");
    403     }
    404 }
    405 
    406 /* <==========================================> */
    407 /*  PER-Encoder for H221NonStandard (SEQUENCE)  */
    408 /* <==========================================> */
    409 void Encode_H221NonStandard(PS_H221NonStandard x, PS_OutStream stream)
    410 {
    411     PutInteger(0, 255, (uint32)x->t35CountryCode, stream);
    412     PutInteger(0, 255, (uint32)x->t35Extension, stream);
    413     PutInteger(0, 65535, (uint32)x->manufacturerCode, stream);
    414 }
    415 
    416 /* <===================================================> */
    417 /*  PER-Encoder for MasterSlaveDetermination (SEQUENCE)  */
    418 /* <===================================================> */
    419 void Encode_MasterSlaveDetermination(PS_MasterSlaveDetermination x, PS_OutStream stream)
    420 {
    421     PutBoolean(0, stream); /* Extension Bit OFF */
    422     PutInteger(0, 255, (uint32)x->terminalType, stream);
    423     PutInteger(0, 16777215, (uint32)x->statusDeterminationNumber, stream);
    424     /* ------------------------------- */
    425     /* ---- Extension Begins Here ---- */
    426     /* ------------------------------- */
    427 }
    428 
    429 /* <======================================================> */
    430 /*  PER-Encoder for MasterSlaveDeterminationAck (SEQUENCE)  */
    431 /* <======================================================> */
    432 void Encode_MasterSlaveDeterminationAck(PS_MasterSlaveDeterminationAck x, PS_OutStream stream)
    433 {
    434     PutBoolean(0, stream); /* Extension Bit OFF */
    435     Encode_Decision(&x->decision, stream);
    436     /* ------------------------------- */
    437     /* ---- Extension Begins Here ---- */
    438     /* ------------------------------- */
    439 }
    440 
    441 /* <=================================> */
    442 /*  PER-Encoder for Decision (CHOICE)  */
    443 /* <=================================> */
    444 void Encode_Decision(PS_Decision x, PS_OutStream stream)
    445 {
    446     PutChoiceIndex(2, 0, x->index, stream);
    447     switch (x->index)
    448     {
    449         case 0:
    450             /* (master is NULL) */
    451             break;
    452         case 1:
    453             /* (slave is NULL) */
    454             break;
    455         default:
    456             ErrorMessageAndLeave("Encode_Decision: Illegal CHOICE index");
    457     }
    458 }
    459 
    460 /* <=========================================================> */
    461 /*  PER-Encoder for MasterSlaveDeterminationReject (SEQUENCE)  */
    462 /* <=========================================================> */
    463 void Encode_MasterSlaveDeterminationReject(PS_MasterSlaveDeterminationReject x, PS_OutStream stream)
    464 {
    465     PutBoolean(0, stream); /* Extension Bit OFF */
    466     Encode_MsdRejectCause(&x->msdRejectCause, stream);
    467     /* ------------------------------- */
    468     /* ---- Extension Begins Here ---- */
    469     /* ------------------------------- */
    470 }
    471 
    472 /* <=======================================> */
    473 /*  PER-Encoder for MsdRejectCause (CHOICE)  */
    474 /* <=======================================> */
    475 void Encode_MsdRejectCause(PS_MsdRejectCause x, PS_OutStream stream)
    476 {
    477     PutChoiceIndex(1, 1, x->index, stream);
    478     switch (x->index)
    479     {
    480         case 0:
    481             /* (identicalNumbers is NULL) */
    482             break;
    483             /* ------------------------------- */
    484             /* ---- Extension Begins Here ---- */
    485             /* ------------------------------- */
    486         default:
    487             ErrorMessageAndLeave("Encode_MsdRejectCause: Illegal CHOICE index");
    488     }
    489 }
    490 
    491 /* <==========================================================> */
    492 /*  PER-Encoder for MasterSlaveDeterminationRelease (SEQUENCE)  */
    493 /* <==========================================================> */
    494 void Encode_MasterSlaveDeterminationRelease(PS_MasterSlaveDeterminationRelease x, PS_OutStream stream)
    495 {
    496     OSCL_UNUSED_ARG(x);
    497     PutBoolean(0, stream); /* Extension Bit OFF */
    498     /* ------------------------------- */
    499     /* ---- Extension Begins Here ---- */
    500     /* ------------------------------- */
    501 }
    502 
    503 /* <================================================> */
    504 /*  PER-Encoder for TerminalCapabilitySet (SEQUENCE)  */
    505 /* <================================================> */
    506 void Encode_TerminalCapabilitySet(PS_TerminalCapabilitySet x, PS_OutStream stream)
    507 {
    508     uint16 i;
    509     PS_OutStream tempStream;
    510     uint32 extension;
    511 
    512     extension = x->option_of_genericInformation;
    513     PutBoolean(extension, stream);
    514 
    515     PutBoolean(x->option_of_multiplexCapability, stream);
    516     PutBoolean(x->option_of_capabilityTable, stream);
    517     PutBoolean(x->option_of_capabilityDescriptors, stream);
    518     PutInteger(0, 255, (uint32)x->sequenceNumber, stream);
    519     PutObjectID(&x->protocolIdentifier, stream);
    520     if (x->option_of_multiplexCapability)
    521     {
    522         Encode_MultiplexCapability(&x->multiplexCapability, stream);
    523     }
    524     if (x->option_of_capabilityTable)
    525     {
    526         PutInteger(1, 256, (uint32)x->size_of_capabilityTable, stream);
    527         for (i = 0; i < x->size_of_capabilityTable; ++i)
    528         {
    529             Encode_CapabilityTableEntry(x->capabilityTable + i, stream);
    530         }
    531     }
    532     if (x->option_of_capabilityDescriptors)
    533     {
    534         PutInteger(1, 256, (uint32)x->size_of_capabilityDescriptors, stream);
    535         for (i = 0; i < x->size_of_capabilityDescriptors; ++i)
    536         {
    537             Encode_CapabilityDescriptor(x->capabilityDescriptors + i, stream);
    538         }
    539     }
    540     /* ------------------------------- */
    541     /* ---- Extension Begins Here ---- */
    542     /* ------------------------------- */
    543     if (!extension) return; /* (No items present?) */
    544     PutNormSmallLength(1, stream); /* Begin Options Map */
    545     PutBoolean(x->option_of_genericInformation, stream);
    546     if (x->option_of_genericInformation)
    547     {
    548         tempStream = NewOutStream();  /* Write to temp stream */
    549         PutLengthDet(x->size_of_genericInformation, tempStream);
    550         for (i = 0; i < x->size_of_genericInformation; ++i)
    551         {
    552             Encode_GenericInformation(x->genericInformation + i, tempStream);
    553         }
    554         PutTempStream(tempStream, stream); /* Copy to real stream */
    555     }
    556 }
    557 
    558 /* <===============================================> */
    559 /*  PER-Encoder for CapabilityTableEntry (SEQUENCE)  */
    560 /* <===============================================> */
    561 void Encode_CapabilityTableEntry(PS_CapabilityTableEntry x, PS_OutStream stream)
    562 {
    563     PutBoolean(x->option_of_capability, stream);
    564     PutInteger(1, 65535, (uint32)x->capabilityTableEntryNumber, stream);
    565     if (x->option_of_capability)
    566     {
    567         Encode_Capability(&x->capability, stream);
    568     }
    569 }
    570 
    571 /* <===============================================> */
    572 /*  PER-Encoder for CapabilityDescriptor (SEQUENCE)  */
    573 /* <===============================================> */
    574 void Encode_CapabilityDescriptor(PS_CapabilityDescriptor x, PS_OutStream stream)
    575 {
    576     uint16 i;
    577     PutBoolean(x->option_of_simultaneousCapabilities, stream);
    578     PutInteger(0, 255, (uint32)x->capabilityDescriptorNumber, stream);
    579     if (x->option_of_simultaneousCapabilities)
    580     {
    581         PutInteger(1, 256, (uint32)x->size_of_simultaneousCapabilities, stream);
    582         for (i = 0; i < x->size_of_simultaneousCapabilities; ++i)
    583         {
    584             Encode_AlternativeCapabilitySet(x->simultaneousCapabilities + i, stream);
    585         }
    586     }
    587 }
    588 
    589 /* <======================================================> */
    590 /*  PER-Encoder for AlternativeCapabilitySet (SEQUENCE-OF)  */
    591 /* <======================================================> */
    592 void Encode_AlternativeCapabilitySet(PS_AlternativeCapabilitySet x, PS_OutStream stream)
    593 {
    594     uint16 i;
    595     PutInteger(1, 256, (uint32)x->size, stream);
    596     for (i = 0; i < x->size; ++i)
    597     {
    598         PutInteger(1, 65535, (uint32)x->item[i], stream);
    599     }
    600 }
    601 
    602 /* <===================================================> */
    603 /*  PER-Encoder for TerminalCapabilitySetAck (SEQUENCE)  */
    604 /* <===================================================> */
    605 void Encode_TerminalCapabilitySetAck(PS_TerminalCapabilitySetAck x, PS_OutStream stream)
    606 {
    607     PutBoolean(0, stream); /* Extension Bit OFF */
    608     PutInteger(0, 255, (uint32)x->sequenceNumber, stream);
    609     /* ------------------------------- */
    610     /* ---- Extension Begins Here ---- */
    611     /* ------------------------------- */
    612 }
    613 
    614 /* <======================================================> */
    615 /*  PER-Encoder for TerminalCapabilitySetReject (SEQUENCE)  */
    616 /* <======================================================> */
    617 void Encode_TerminalCapabilitySetReject(PS_TerminalCapabilitySetReject x, PS_OutStream stream)
    618 {
    619     PutBoolean(0, stream); /* Extension Bit OFF */
    620     PutInteger(0, 255, (uint32)x->sequenceNumber, stream);
    621     Encode_TcsRejectCause(&x->tcsRejectCause, stream);
    622     /* ------------------------------- */
    623     /* ---- Extension Begins Here ---- */
    624     /* ------------------------------- */
    625 }
    626 
    627 /* <=======================================> */
    628 /*  PER-Encoder for TcsRejectCause (CHOICE)  */
    629 /* <=======================================> */
    630 void Encode_TcsRejectCause(PS_TcsRejectCause x, PS_OutStream stream)
    631 {
    632     PutChoiceIndex(4, 1, x->index, stream);
    633     switch (x->index)
    634     {
    635         case 0:
    636             /* (unspecified is NULL) */
    637             break;
    638         case 1:
    639             /* (undefinedTableEntryUsed is NULL) */
    640             break;
    641         case 2:
    642             /* (descriptorCapacityExceeded is NULL) */
    643             break;
    644         case 3:
    645             Encode_TableEntryCapacityExceeded(x->tableEntryCapacityExceeded, stream);
    646             break;
    647             /* ------------------------------- */
    648             /* ---- Extension Begins Here ---- */
    649             /* ------------------------------- */
    650         default:
    651             ErrorMessageAndLeave("Encode_TcsRejectCause: Illegal CHOICE index");
    652     }
    653 }
    654 
    655 /* <===================================================> */
    656 /*  PER-Encoder for TableEntryCapacityExceeded (CHOICE)  */
    657 /* <===================================================> */
    658 void Encode_TableEntryCapacityExceeded(PS_TableEntryCapacityExceeded x, PS_OutStream stream)
    659 {
    660     PutChoiceIndex(2, 0, x->index, stream);
    661     switch (x->index)
    662     {
    663         case 0:
    664             PutInteger(1, 65535, (uint32)x->highestEntryNumberProcessed, stream);
    665             break;
    666         case 1:
    667             /* (noneProcessed is NULL) */
    668             break;
    669         default:
    670             ErrorMessageAndLeave("Encode_TableEntryCapacityExceeded: Illegal CHOICE index");
    671     }
    672 }
    673 
    674 /* <=======================================================> */
    675 /*  PER-Encoder for TerminalCapabilitySetRelease (SEQUENCE)  */
    676 /* <=======================================================> */
    677 void Encode_TerminalCapabilitySetRelease(PS_TerminalCapabilitySetRelease x, PS_OutStream stream)
    678 {
    679     OSCL_UNUSED_ARG(x);
    680     PutBoolean(0, stream); /* Extension Bit OFF */
    681     /* ------------------------------- */
    682     /* ---- Extension Begins Here ---- */
    683     /* ------------------------------- */
    684 }
    685 
    686 /* <===================================> */
    687 /*  PER-Encoder for Capability (CHOICE)  */
    688 /* <===================================> */
    689 void Encode_Capability(PS_Capability x, PS_OutStream stream)
    690 {
    691     PutChoiceIndex(12, 1, x->index, stream);
    692     switch (x->index)
    693     {
    694         case 0:
    695             Encode_NonStandardParameter(x->nonStandard, stream);
    696             break;
    697         case 1:
    698             Encode_VideoCapability(x->receiveVideoCapability, stream);
    699             break;
    700         case 2:
    701             Encode_VideoCapability(x->transmitVideoCapability, stream);
    702             break;
    703         case 3:
    704             Encode_VideoCapability(x->receiveAndTransmitVideoCapability, stream);
    705             break;
    706         case 4:
    707             Encode_AudioCapability(x->receiveAudioCapability, stream);
    708             break;
    709         case 5:
    710             Encode_AudioCapability(x->transmitAudioCapability, stream);
    711             break;
    712         case 6:
    713             Encode_AudioCapability(x->receiveAndTransmitAudioCapability, stream);
    714             break;
    715         case 7:
    716             Encode_DataApplicationCapability(x->receiveDataApplicationCapability, stream);
    717             break;
    718         case 8:
    719             Encode_DataApplicationCapability(x->transmitDataApplicationCapability, stream);
    720             break;
    721         case 9:
    722             Encode_DataApplicationCapability(x->receiveAndTransmitDataApplicationCapability, stream);
    723             break;
    724         case 10:
    725             PutBoolean(x->h233EncryptionTransmitCapability, stream);
    726             break;
    727         case 11:
    728             Encode_H233EncryptionReceiveCapability(x->h233EncryptionReceiveCapability, stream);
    729             break;
    730             /* ------------------------------- */
    731             /* ---- Extension Begins Here ---- */
    732             /* ------------------------------- */
    733         case 12:
    734             PutExtensionItem(EPASS Encode_ConferenceCapability, (uint8*)x->conferenceCapability, stream);
    735             break;
    736         case 13:
    737             PutExtensionItem(EPASS Encode_H235SecurityCapability, (uint8*)x->h235SecurityCapability, stream);
    738             break;
    739         case 14:
    740             PutExtensionInteger(0, 255, (uint32)x->maxPendingReplacementFor, stream);
    741             break;
    742         case 15:
    743             PutExtensionItem(EPASS Encode_UserInputCapability, (uint8*)x->receiveUserInputCapability, stream);
    744             break;
    745         case 16:
    746             PutExtensionItem(EPASS Encode_UserInputCapability, (uint8*)x->transmitUserInputCapability, stream);
    747             break;
    748         case 17:
    749             PutExtensionItem(EPASS Encode_UserInputCapability, (uint8*)x->receiveAndTransmitUserInputCapability, stream);
    750             break;
    751         case 18:
    752             PutExtensionItem(EPASS Encode_GenericCapability, (uint8*)x->genericControlCapability, stream);
    753             break;
    754         default:
    755             ErrorMessageAndLeave("Encode_Capability: Illegal CHOICE index");
    756     }
    757 }
    758 
    759 /* <==========================================================> */
    760 /*  PER-Encoder for H233EncryptionReceiveCapability (SEQUENCE)  */
    761 /* <==========================================================> */
    762 void Encode_H233EncryptionReceiveCapability(PS_H233EncryptionReceiveCapability x, PS_OutStream stream)
    763 {
    764     PutBoolean(0, stream); /* Extension Bit OFF */
    765     PutInteger(0, 255, (uint32)x->h233IVResponseTime, stream);
    766     /* ------------------------------- */
    767     /* ---- Extension Begins Here ---- */
    768     /* ------------------------------- */
    769 }
    770 
    771 /* <=================================================> */
    772 /*  PER-Encoder for H235SecurityCapability (SEQUENCE)  */
    773 /* <=================================================> */
    774 void Encode_H235SecurityCapability(PS_H235SecurityCapability x, PS_OutStream stream)
    775 {
    776     PutBoolean(0, stream); /* Extension Bit OFF */
    777     Encode_EncryptionAuthenticationAndIntegrity(&x->encryptionAuthenticationAndIntegrity, stream);
    778     PutInteger(1, 65535, (uint32)x->mediaCapability, stream);
    779     /* ------------------------------- */
    780     /* ---- Extension Begins Here ---- */
    781     /* ------------------------------- */
    782 }
    783 
    784 /* <============================================> */
    785 /*  PER-Encoder for MultiplexCapability (CHOICE)  */
    786 /* <============================================> */
    787 void Encode_MultiplexCapability(PS_MultiplexCapability x, PS_OutStream stream)
    788 {
    789     PutChoiceIndex(4, 1, x->index, stream);
    790     switch (x->index)
    791     {
    792         case 0:
    793             Encode_NonStandardParameter(x->nonStandard, stream);
    794             break;
    795         case 1:
    796             Encode_H222Capability(x->h222Capability, stream);
    797             break;
    798         case 2:
    799             Encode_H223Capability(x->h223Capability, stream);
    800             break;
    801         case 3:
    802             Encode_V76Capability(x->v76Capability, stream);
    803             break;
    804             /* ------------------------------- */
    805             /* ---- Extension Begins Here ---- */
    806             /* ------------------------------- */
    807         case 4:
    808             PutExtensionItem(EPASS Encode_H2250Capability, (uint8*)x->h2250Capability, stream);
    809             break;
    810         case 5:
    811             PutExtensionItem(EPASS Encode_GenericCapability, (uint8*)x->genericMultiplexCapability, stream);
    812             break;
    813         default:
    814             ErrorMessageAndLeave("Encode_MultiplexCapability: Illegal CHOICE index");
    815     }
    816 }
    817 
    818 /* <=========================================> */
    819 /*  PER-Encoder for H222Capability (SEQUENCE)  */
    820 /* <=========================================> */
    821 void Encode_H222Capability(PS_H222Capability x, PS_OutStream stream)
    822 {
    823     uint16 i;
    824     PutBoolean(0, stream); /* Extension Bit OFF */
    825     PutInteger(1, 256, (uint32)x->numberOfVCs, stream);
    826     PutLengthDet(x->size_of_vcCapability, stream);
    827     for (i = 0; i < x->size_of_vcCapability; ++i)
    828     {
    829         Encode_VCCapability(x->vcCapability + i, stream);
    830     }
    831     /* ------------------------------- */
    832     /* ---- Extension Begins Here ---- */
    833     /* ------------------------------- */
    834 }
    835 
    836 /* <=======================================> */
    837 /*  PER-Encoder for VCCapability (SEQUENCE)  */
    838 /* <=======================================> */
    839 void Encode_VCCapability(PS_VCCapability x, PS_OutStream stream)
    840 {
    841     uint32 extension;
    842 
    843     extension = x->option_of_aal1ViaGateway;
    844     PutBoolean(extension, stream);
    845 
    846     PutBoolean(x->option_of_vccAal1, stream);
    847     PutBoolean(x->option_of_vccAal5, stream);
    848     if (x->option_of_vccAal1)
    849     {
    850         Encode_VccAal1(&x->vccAal1, stream);
    851     }
    852     if (x->option_of_vccAal5)
    853     {
    854         Encode_VccAal5(&x->vccAal5, stream);
    855     }
    856     PutBoolean(x->transportStream, stream);
    857     PutBoolean(x->programStream, stream);
    858     Encode_AvailableBitRates(&x->availableBitRates, stream);
    859     /* ------------------------------- */
    860     /* ---- Extension Begins Here ---- */
    861     /* ------------------------------- */
    862     if (!extension) return; /* (No items present?) */
    863     PutNormSmallLength(1, stream); /* Begin Options Map */
    864     PutBoolean(x->option_of_aal1ViaGateway, stream);
    865     if (x->option_of_aal1ViaGateway)
    866     {
    867         PutExtensionItem(EPASS Encode_Aal1ViaGateway, (uint8*)&x->aal1ViaGateway, stream);
    868     }
    869 }
    870 
    871 /* <=========================================> */
    872 /*  PER-Encoder for Aal1ViaGateway (SEQUENCE)  */
    873 /* <=========================================> */
    874 void Encode_Aal1ViaGateway(PS_Aal1ViaGateway x, PS_OutStream stream)
    875 {
    876     uint16 i;
    877     PutBoolean(0, stream); /* Extension Bit OFF */
    878     PutInteger(1, 256, (uint32)x->size_of_gatewayAddress, stream);
    879     for (i = 0; i < x->size_of_gatewayAddress; ++i)
    880     {
    881         Encode_Q2931Address(x->gatewayAddress + i, stream);
    882     }
    883     PutBoolean(x->nullClockRecovery, stream);
    884     PutBoolean(x->srtsClockRecovery, stream);
    885     PutBoolean(x->adaptiveClockRecovery, stream);
    886     PutBoolean(x->nullErrorCorrection, stream);
    887     PutBoolean(x->longInterleaver, stream);
    888     PutBoolean(x->shortInterleaver, stream);
    889     PutBoolean(x->errorCorrectionOnly, stream);
    890     PutBoolean(x->structuredDataTransfer, stream);
    891     PutBoolean(x->partiallyFilledCells, stream);
    892     /* ------------------------------- */
    893     /* ---- Extension Begins Here ---- */
    894     /* ------------------------------- */
    895 }
    896 
    897 /* <============================================> */
    898 /*  PER-Encoder for AvailableBitRates (SEQUENCE)  */
    899 /* <============================================> */
    900 void Encode_AvailableBitRates(PS_AvailableBitRates x, PS_OutStream stream)
    901 {
    902     PutBoolean(0, stream); /* Extension Bit OFF */
    903     Encode_VccAal5Type(&x->vccAal5Type, stream);
    904     /* ------------------------------- */
    905     /* ---- Extension Begins Here ---- */
    906     /* ------------------------------- */
    907 }
    908 
    909 /* <====================================> */
    910 /*  PER-Encoder for VccAal5Type (CHOICE)  */
    911 /* <====================================> */
    912 void Encode_VccAal5Type(PS_VccAal5Type x, PS_OutStream stream)
    913 {
    914     PutChoiceIndex(2, 0, x->index, stream);
    915     switch (x->index)
    916     {
    917         case 0:
    918             PutInteger(1, 65535, (uint32)x->singleBitRate, stream);
    919             break;
    920         case 1:
    921             Encode_RangeOfBitRates(x->rangeOfBitRates, stream);
    922             break;
    923         default:
    924             ErrorMessageAndLeave("Encode_VccAal5Type: Illegal CHOICE index");
    925     }
    926 }
    927 
    928 /* <==========================================> */
    929 /*  PER-Encoder for RangeOfBitRates (SEQUENCE)  */
    930 /* <==========================================> */
    931 void Encode_RangeOfBitRates(PS_RangeOfBitRates x, PS_OutStream stream)
    932 {
    933     PutInteger(1, 65535, (uint32)x->lowerBitRate, stream);
    934     PutInteger(1, 65535, (uint32)x->higherBitRate, stream);
    935 }
    936 
    937 /* <==================================> */
    938 /*  PER-Encoder for VccAal5 (SEQUENCE)  */
    939 /* <==================================> */
    940 void Encode_VccAal5(PS_VccAal5 x, PS_OutStream stream)
    941 {
    942     PutBoolean(0, stream); /* Extension Bit OFF */
    943     PutInteger(0, 65535, (uint32)x->forwardMaximumSDUSize, stream);
    944     PutInteger(0, 65535, (uint32)x->backwardMaximumSDUSize, stream);
    945     /* ------------------------------- */
    946     /* ---- Extension Begins Here ---- */
    947     /* ------------------------------- */
    948 }
    949 
    950 /* <==================================> */
    951 /*  PER-Encoder for VccAal1 (SEQUENCE)  */
    952 /* <==================================> */
    953 void Encode_VccAal1(PS_VccAal1 x, PS_OutStream stream)
    954 {
    955     PutBoolean(0, stream); /* Extension Bit OFF */
    956     PutBoolean(x->nullClockRecovery, stream);
    957     PutBoolean(x->srtsClockRecovery, stream);
    958     PutBoolean(x->adaptiveClockRecovery, stream);
    959     PutBoolean(x->nullErrorCorrection, stream);
    960     PutBoolean(x->longInterleaver, stream);
    961     PutBoolean(x->shortInterleaver, stream);
    962     PutBoolean(x->errorCorrectionOnly, stream);
    963     PutBoolean(x->structuredDataTransfer, stream);
    964     PutBoolean(x->partiallyFilledCells, stream);
    965     /* ------------------------------- */
    966     /* ---- Extension Begins Here ---- */
    967     /* ------------------------------- */
    968 }
    969 
    970 /* <=========================================> */
    971 /*  PER-Encoder for H223Capability (SEQUENCE)  */
    972 /* <=========================================> */
    973 void Encode_H223Capability(PS_H223Capability x, PS_OutStream stream)
    974 {
    975     uint32 extension;
    976 
    977     extension = x->option_of_maxMUXPDUSizeCapability |
    978                 x->option_of_nsrpSupport |
    979                 x->option_of_mobileOperationTransmitCapability |
    980                 x->option_of_h223AnnexCCapability;
    981     PutBoolean(extension, stream);
    982 
    983     PutBoolean(x->transportWithI_frames, stream);
    984     PutBoolean(x->videoWithAL1, stream);
    985     PutBoolean(x->videoWithAL2, stream);
    986     PutBoolean(x->videoWithAL3, stream);
    987     PutBoolean(x->audioWithAL1, stream);
    988     PutBoolean(x->audioWithAL2, stream);
    989     PutBoolean(x->audioWithAL3, stream);
    990     PutBoolean(x->dataWithAL1, stream);
    991     PutBoolean(x->dataWithAL2, stream);
    992     PutBoolean(x->dataWithAL3, stream);
    993     PutInteger(0, 65535, (uint32)x->maximumAl2SDUSize, stream);
    994     PutInteger(0, 65535, (uint32)x->maximumAl3SDUSize, stream);
    995     PutInteger(0, 1023, (uint32)x->maximumDelayJitter, stream);
    996     Encode_H223MultiplexTableCapability(&x->h223MultiplexTableCapability, stream);
    997     /* ------------------------------- */
    998     /* ---- Extension Begins Here ---- */
    999     /* ------------------------------- */
   1000     if (!extension) return; /* (No items present?) */
   1001     PutNormSmallLength(4, stream); /* Begin Options Map */
   1002     PutBoolean(x->option_of_maxMUXPDUSizeCapability, stream);
   1003     PutBoolean(x->option_of_nsrpSupport, stream);
   1004     PutBoolean(x->option_of_mobileOperationTransmitCapability, stream);
   1005     PutBoolean(x->option_of_h223AnnexCCapability, stream);
   1006     if (x->option_of_maxMUXPDUSizeCapability)
   1007     {
   1008         PutExtensionBoolean(x->maxMUXPDUSizeCapability, stream);
   1009     }
   1010     if (x->option_of_nsrpSupport)
   1011     {
   1012         PutExtensionBoolean(x->nsrpSupport, stream);
   1013     }
   1014     if (x->option_of_mobileOperationTransmitCapability)
   1015     {
   1016         PutExtensionItem(EPASS Encode_MobileOperationTransmitCapability, (uint8*)&x->mobileOperationTransmitCapability, stream);
   1017     }
   1018     if (x->option_of_h223AnnexCCapability)
   1019     {
   1020         PutExtensionItem(EPASS Encode_H223AnnexCCapability, (uint8*)&x->h223AnnexCCapability, stream);
   1021     }
   1022 }
   1023 
   1024 /* <============================================================> */
   1025 /*  PER-Encoder for MobileOperationTransmitCapability (SEQUENCE)  */
   1026 /* <============================================================> */
   1027 void Encode_MobileOperationTransmitCapability(PS_MobileOperationTransmitCapability x, PS_OutStream stream)
   1028 {
   1029     PutBoolean(0, stream); /* Extension Bit OFF */
   1030     PutBoolean(x->modeChangeCapability, stream);
   1031     PutBoolean(x->h223AnnexA, stream);
   1032     PutBoolean(x->h223AnnexADoubleFlag, stream);
   1033     PutBoolean(x->h223AnnexB, stream);
   1034     PutBoolean(x->h223AnnexBwithHeader, stream);
   1035     /* ------------------------------- */
   1036     /* ---- Extension Begins Here ---- */
   1037     /* ------------------------------- */
   1038 }
   1039 
   1040 /* <=====================================================> */
   1041 /*  PER-Encoder for H223MultiplexTableCapability (CHOICE)  */
   1042 /* <=====================================================> */
   1043 void Encode_H223MultiplexTableCapability(PS_H223MultiplexTableCapability x, PS_OutStream stream)
   1044 {
   1045     PutChoiceIndex(2, 0, x->index, stream);
   1046     switch (x->index)
   1047     {
   1048         case 0:
   1049             /* (basic is NULL) */
   1050             break;
   1051         case 1:
   1052             Encode_Enhanced(x->enhanced, stream);
   1053             break;
   1054         default:
   1055             ErrorMessageAndLeave("Encode_H223MultiplexTableCapability: Illegal CHOICE index");
   1056     }
   1057 }
   1058 
   1059 /* <===================================> */
   1060 /*  PER-Encoder for Enhanced (SEQUENCE)  */
   1061 /* <===================================> */
   1062 void Encode_Enhanced(PS_Enhanced x, PS_OutStream stream)
   1063 {
   1064     PutBoolean(0, stream); /* Extension Bit OFF */
   1065     PutInteger(1, 15, (uint32)x->maximumNestingDepth, stream);
   1066     PutInteger(2, 255, (uint32)x->maximumElementListSize, stream);
   1067     PutInteger(2, 255, (uint32)x->maximumSubElementListSize, stream);
   1068     /* ------------------------------- */
   1069     /* ---- Extension Begins Here ---- */
   1070     /* ------------------------------- */
   1071 }
   1072 
   1073 /* <===============================================> */
   1074 /*  PER-Encoder for H223AnnexCCapability (SEQUENCE)  */
   1075 /* <===============================================> */
   1076 void Encode_H223AnnexCCapability(PS_H223AnnexCCapability x, PS_OutStream stream)
   1077 {
   1078     uint32 extension;
   1079 
   1080     extension = x->option_of_rsCodeCapability;
   1081     PutBoolean(extension, stream);
   1082 
   1083     PutBoolean(x->videoWithAL1M, stream);
   1084     PutBoolean(x->videoWithAL2M, stream);
   1085     PutBoolean(x->videoWithAL3M, stream);
   1086     PutBoolean(x->audioWithAL1M, stream);
   1087     PutBoolean(x->audioWithAL2M, stream);
   1088     PutBoolean(x->audioWithAL3M, stream);
   1089     PutBoolean(x->dataWithAL1M, stream);
   1090     PutBoolean(x->dataWithAL2M, stream);
   1091     PutBoolean(x->dataWithAL3M, stream);
   1092     PutBoolean(x->alpduInterleaving, stream);
   1093     PutInteger(0, 65535, (uint32)x->maximumAL1MPDUSize, stream);
   1094     PutInteger(0, 65535, (uint32)x->maximumAL2MSDUSize, stream);
   1095     PutInteger(0, 65535, (uint32)x->maximumAL3MSDUSize, stream);
   1096     /* ------------------------------- */
   1097     /* ---- Extension Begins Here ---- */
   1098     /* ------------------------------- */
   1099     if (!extension) return; /* (No items present?) */
   1100     PutNormSmallLength(1, stream); /* Begin Options Map */
   1101     PutBoolean(x->option_of_rsCodeCapability, stream);
   1102     if (x->option_of_rsCodeCapability)
   1103     {
   1104         PutExtensionBoolean(x->rsCodeCapability, stream);
   1105     }
   1106 }
   1107 
   1108 /* <========================================> */
   1109 /*  PER-Encoder for V76Capability (SEQUENCE)  */
   1110 /* <========================================> */
   1111 void Encode_V76Capability(PS_V76Capability x, PS_OutStream stream)
   1112 {
   1113     PutBoolean(0, stream); /* Extension Bit OFF */
   1114     PutBoolean(x->suspendResumeCapabilitywAddress, stream);
   1115     PutBoolean(x->suspendResumeCapabilitywoAddress, stream);
   1116     PutBoolean(x->rejCapability, stream);
   1117     PutBoolean(x->sREJCapability, stream);
   1118     PutBoolean(x->mREJCapability, stream);
   1119     PutBoolean(x->crc8bitCapability, stream);
   1120     PutBoolean(x->crc16bitCapability, stream);
   1121     PutBoolean(x->crc32bitCapability, stream);
   1122     PutBoolean(x->uihCapability, stream);
   1123     PutInteger(2, 8191, (uint32)x->numOfDLCS, stream);
   1124     PutBoolean(x->twoOctetAddressFieldCapability, stream);
   1125     PutBoolean(x->loopBackTestCapability, stream);
   1126     PutInteger(1, 4095, (uint32)x->n401Capability, stream);
   1127     PutInteger(1, 127, (uint32)x->maxWindowSizeCapability, stream);
   1128     Encode_V75Capability(&x->v75Capability, stream);
   1129     /* ------------------------------- */
   1130     /* ---- Extension Begins Here ---- */
   1131     /* ------------------------------- */
   1132 }
   1133 
   1134 /* <========================================> */
   1135 /*  PER-Encoder for V75Capability (SEQUENCE)  */
   1136 /* <========================================> */
   1137 void Encode_V75Capability(PS_V75Capability x, PS_OutStream stream)
   1138 {
   1139     PutBoolean(0, stream); /* Extension Bit OFF */
   1140     PutBoolean(x->audioHeader, stream);
   1141     /* ------------------------------- */
   1142     /* ---- Extension Begins Here ---- */
   1143     /* ------------------------------- */
   1144 }
   1145 
   1146 /* <==========================================> */
   1147 /*  PER-Encoder for H2250Capability (SEQUENCE)  */
   1148 /* <==========================================> */
   1149 void Encode_H2250Capability(PS_H2250Capability x, PS_OutStream stream)
   1150 {
   1151     uint16 i;
   1152     PS_OutStream tempStream;
   1153     uint32 extension;
   1154 
   1155     extension = x->option_of_transportCapability |
   1156                 x->option_of_redundancyEncodingCapability |
   1157                 x->option_of_logicalChannelSwitchingCapability |
   1158                 x->option_of_t120DynamicPortCapability;
   1159     PutBoolean(extension, stream);
   1160 
   1161     PutInteger(0, 1023, (uint32)x->maximumAudioDelayJitter, stream);
   1162     Encode_MultipointCapability(&x->receiveMultipointCapability, stream);
   1163     Encode_MultipointCapability(&x->transmitMultipointCapability, stream);
   1164     Encode_MultipointCapability(&x->receiveAndTransmitMultipointCapability, stream);
   1165     Encode_McCapability(&x->mcCapability, stream);
   1166     PutBoolean(x->rtcpVideoControlCapability, stream);
   1167     Encode_MediaPacketizationCapability(&x->mediaPacketizationCapability, stream);
   1168     /* ------------------------------- */
   1169     /* ---- Extension Begins Here ---- */
   1170     /* ------------------------------- */
   1171     if (!extension) return; /* (No items present?) */
   1172     PutNormSmallLength(4, stream); /* Begin Options Map */
   1173     PutBoolean(x->option_of_transportCapability, stream);
   1174     PutBoolean(x->option_of_redundancyEncodingCapability, stream);
   1175     PutBoolean(x->option_of_logicalChannelSwitchingCapability, stream);
   1176     PutBoolean(x->option_of_t120DynamicPortCapability, stream);
   1177     if (x->option_of_transportCapability)
   1178     {
   1179         PutExtensionItem(EPASS Encode_TransportCapability, (uint8*)&x->transportCapability, stream);
   1180     }
   1181     if (x->option_of_redundancyEncodingCapability)
   1182     {
   1183         tempStream = NewOutStream();  /* Write to temp stream */
   1184         PutInteger(1, 256, (uint32)x->size_of_redundancyEncodingCapability, tempStream);
   1185         for (i = 0; i < x->size_of_redundancyEncodingCapability; ++i)
   1186         {
   1187             Encode_RedundancyEncodingCapability(x->redundancyEncodingCapability + i, tempStream);
   1188         }
   1189         PutTempStream(tempStream, stream); /* Copy to real stream */
   1190     }
   1191     if (x->option_of_logicalChannelSwitchingCapability)
   1192     {
   1193         PutExtensionBoolean(x->logicalChannelSwitchingCapability, stream);
   1194     }
   1195     if (x->option_of_t120DynamicPortCapability)
   1196     {
   1197         PutExtensionBoolean(x->t120DynamicPortCapability, stream);
   1198     }
   1199 }
   1200 
   1201 /* <=======================================> */
   1202 /*  PER-Encoder for McCapability (SEQUENCE)  */
   1203 /* <=======================================> */
   1204 void Encode_McCapability(PS_McCapability x, PS_OutStream stream)
   1205 {
   1206     PutBoolean(0, stream); /* Extension Bit OFF */
   1207     PutBoolean(x->centralizedConferenceMC, stream);
   1208     PutBoolean(x->decentralizedConferenceMC, stream);
   1209     /* ------------------------------- */
   1210     /* ---- Extension Begins Here ---- */
   1211     /* ------------------------------- */
   1212 }
   1213 
   1214 /* <=======================================================> */
   1215 /*  PER-Encoder for MediaPacketizationCapability (SEQUENCE)  */
   1216 /* <=======================================================> */
   1217 void Encode_MediaPacketizationCapability(PS_MediaPacketizationCapability x, PS_OutStream stream)
   1218 {
   1219     uint16 i;
   1220     PS_OutStream tempStream;
   1221     uint32 extension;
   1222 
   1223     extension = x->option_of_rtpPayloadType;
   1224     PutBoolean(extension, stream);
   1225 
   1226     PutBoolean(x->h261aVideoPacketization, stream);
   1227     /* ------------------------------- */
   1228     /* ---- Extension Begins Here ---- */
   1229     /* ------------------------------- */
   1230     if (!extension) return; /* (No items present?) */
   1231     PutNormSmallLength(1, stream); /* Begin Options Map */
   1232     PutBoolean(x->option_of_rtpPayloadType, stream);
   1233     if (x->option_of_rtpPayloadType)
   1234     {
   1235         tempStream = NewOutStream();  /* Write to temp stream */
   1236         PutInteger(1, 256, (uint32)x->size_of_rtpPayloadType, tempStream);
   1237         for (i = 0; i < x->size_of_rtpPayloadType; ++i)
   1238         {
   1239             Encode_RTPPayloadType(x->rtpPayloadType + i, tempStream);
   1240         }
   1241         PutTempStream(tempStream, stream); /* Copy to real stream */
   1242     }
   1243 }
   1244 
   1245 /* <=========================================> */
   1246 /*  PER-Encoder for RSVPParameters (SEQUENCE)  */
   1247 /* <=========================================> */
   1248 void Encode_RSVPParameters(PS_RSVPParameters x, PS_OutStream stream)
   1249 {
   1250     PutBoolean(0, stream); /* Extension Bit OFF */
   1251     PutBoolean(x->option_of_qosMode, stream);
   1252     PutBoolean(x->option_of_tokenRate, stream);
   1253     PutBoolean(x->option_of_bucketSize, stream);
   1254     PutBoolean(x->option_of_peakRate, stream);
   1255     PutBoolean(x->option_of_minPoliced, stream);
   1256     PutBoolean(x->option_of_maxPktSize, stream);
   1257     if (x->option_of_qosMode)
   1258     {
   1259         Encode_QOSMode(&x->qosMode, stream);
   1260     }
   1261     if (x->option_of_tokenRate)
   1262     {
   1263         PutInteger(1, 0xffffffff, (uint32)x->tokenRate, stream);
   1264     }
   1265     if (x->option_of_bucketSize)
   1266     {
   1267         PutInteger(1, 0xffffffff, (uint32)x->bucketSize, stream);
   1268     }
   1269     if (x->option_of_peakRate)
   1270     {
   1271         PutInteger(1, 0xffffffff, (uint32)x->peakRate, stream);
   1272     }
   1273     if (x->option_of_minPoliced)
   1274     {
   1275         PutInteger(1, 0xffffffff, (uint32)x->minPoliced, stream);
   1276     }
   1277     if (x->option_of_maxPktSize)
   1278     {
   1279         PutInteger(1, 0xffffffff, (uint32)x->maxPktSize, stream);
   1280     }
   1281     /* ------------------------------- */
   1282     /* ---- Extension Begins Here ---- */
   1283     /* ------------------------------- */
   1284 }
   1285 
   1286 /* <================================> */
   1287 /*  PER-Encoder for QOSMode (CHOICE)  */
   1288 /* <================================> */
   1289 void Encode_QOSMode(PS_QOSMode x, PS_OutStream stream)
   1290 {
   1291     PutChoiceIndex(2, 1, x->index, stream);
   1292     switch (x->index)
   1293     {
   1294         case 0:
   1295             /* (guaranteedQOS is NULL) */
   1296             break;
   1297         case 1:
   1298             /* (controlledLoad is NULL) */
   1299             break;
   1300             /* ------------------------------- */
   1301             /* ---- Extension Begins Here ---- */
   1302             /* ------------------------------- */
   1303         default:
   1304             ErrorMessageAndLeave("Encode_QOSMode: Illegal CHOICE index");
   1305     }
   1306 }
   1307 
   1308 /* <========================================> */
   1309 /*  PER-Encoder for ATMParameters (SEQUENCE)  */
   1310 /* <========================================> */
   1311 void Encode_ATMParameters(PS_ATMParameters x, PS_OutStream stream)
   1312 {
   1313     PutBoolean(0, stream); /* Extension Bit OFF */
   1314     PutInteger(0, 65535, (uint32)x->maxNTUSize, stream);
   1315     PutBoolean(x->atmUBR, stream);
   1316     PutBoolean(x->atmrtVBR, stream);
   1317     PutBoolean(x->atmnrtVBR, stream);
   1318     PutBoolean(x->atmABR, stream);
   1319     PutBoolean(x->atmCBR, stream);
   1320     /* ------------------------------- */
   1321     /* ---- Extension Begins Here ---- */
   1322     /* ------------------------------- */
   1323 }
   1324 
   1325 /* <========================================> */
   1326 /*  PER-Encoder for QOSCapability (SEQUENCE)  */
   1327 /* <========================================> */
   1328 void Encode_QOSCapability(PS_QOSCapability x, PS_OutStream stream)
   1329 {
   1330     PutBoolean(0, stream); /* Extension Bit OFF */
   1331     PutBoolean(x->option_of_nonStandardData, stream);
   1332     PutBoolean(x->option_of_rsvpParameters, stream);
   1333     PutBoolean(x->option_of_atmParameters, stream);
   1334     if (x->option_of_nonStandardData)
   1335     {
   1336         Encode_NonStandardParameter(&x->nonStandardData, stream);
   1337     }
   1338     if (x->option_of_rsvpParameters)
   1339     {
   1340         Encode_RSVPParameters(&x->rsvpParameters, stream);
   1341     }
   1342     if (x->option_of_atmParameters)
   1343     {
   1344         Encode_ATMParameters(&x->atmParameters, stream);
   1345     }
   1346     /* ------------------------------- */
   1347     /* ---- Extension Begins Here ---- */
   1348     /* ------------------------------- */
   1349 }
   1350 
   1351 /* <===========================================> */
   1352 /*  PER-Encoder for MediaTransportType (CHOICE)  */
   1353 /* <===========================================> */
   1354 void Encode_MediaTransportType(PS_MediaTransportType x, PS_OutStream stream)
   1355 {
   1356     PutChoiceIndex(4, 1, x->index, stream);
   1357     switch (x->index)
   1358     {
   1359         case 0:
   1360             /* (ip_UDP is NULL) */
   1361             break;
   1362         case 1:
   1363             /* (ip_TCP is NULL) */
   1364             break;
   1365         case 2:
   1366             /* (atm_AAL5_UNIDIR is NULL) */
   1367             break;
   1368         case 3:
   1369             /* (atm_AAL5_BIDIR is NULL) */
   1370             break;
   1371             /* ------------------------------- */
   1372             /* ---- Extension Begins Here ---- */
   1373             /* ------------------------------- */
   1374         case 4:
   1375             PutExtensionItem(EPASS Encode_Atm_AAL5_compressed, (uint8*)x->atm_AAL5_compressed, stream);
   1376             break;
   1377         default:
   1378             ErrorMessageAndLeave("Encode_MediaTransportType: Illegal CHOICE index");
   1379     }
   1380 }
   1381 
   1382 /* <==============================================> */
   1383 /*  PER-Encoder for Atm_AAL5_compressed (SEQUENCE)  */
   1384 /* <==============================================> */
   1385 void Encode_Atm_AAL5_compressed(PS_Atm_AAL5_compressed x, PS_OutStream stream)
   1386 {
   1387     PutBoolean(0, stream); /* Extension Bit OFF */
   1388     PutBoolean(x->variable_delta, stream);
   1389     /* ------------------------------- */
   1390     /* ---- Extension Begins Here ---- */
   1391     /* ------------------------------- */
   1392 }
   1393 
   1394 /* <=================================================> */
   1395 /*  PER-Encoder for MediaChannelCapability (SEQUENCE)  */
   1396 /* <=================================================> */
   1397 void Encode_MediaChannelCapability(PS_MediaChannelCapability x, PS_OutStream stream)
   1398 {
   1399     PutBoolean(0, stream); /* Extension Bit OFF */
   1400     PutBoolean(x->option_of_mediaTransport, stream);
   1401     if (x->option_of_mediaTransport)
   1402     {
   1403         Encode_MediaTransportType(&x->mediaTransport, stream);
   1404     }
   1405     /* ------------------------------- */
   1406     /* ---- Extension Begins Here ---- */
   1407     /* ------------------------------- */
   1408 }
   1409 
   1410 /* <==============================================> */
   1411 /*  PER-Encoder for TransportCapability (SEQUENCE)  */
   1412 /* <==============================================> */
   1413 void Encode_TransportCapability(PS_TransportCapability x, PS_OutStream stream)
   1414 {
   1415     uint16 i;
   1416     PutBoolean(0, stream); /* Extension Bit OFF */
   1417     PutBoolean(x->option_of_nonStandard, stream);
   1418     PutBoolean(x->option_of_qOSCapabilities, stream);
   1419     PutBoolean(x->option_of_mediaChannelCapabilities, stream);
   1420     if (x->option_of_nonStandard)
   1421     {
   1422         Encode_NonStandardParameter(&x->nonStandard, stream);
   1423     }
   1424     if (x->option_of_qOSCapabilities)
   1425     {
   1426         PutInteger(1, 256, (uint32)x->size_of_qOSCapabilities, stream);
   1427         for (i = 0; i < x->size_of_qOSCapabilities; ++i)
   1428         {
   1429             Encode_QOSCapability(x->qOSCapabilities + i, stream);
   1430         }
   1431     }
   1432     if (x->option_of_mediaChannelCapabilities)
   1433     {
   1434         PutInteger(1, 256, (uint32)x->size_of_mediaChannelCapabilities, stream);
   1435         for (i = 0; i < x->size_of_mediaChannelCapabilities; ++i)
   1436         {
   1437             Encode_MediaChannelCapability(x->mediaChannelCapabilities + i, stream);
   1438         }
   1439     }
   1440     /* ------------------------------- */
   1441     /* ---- Extension Begins Here ---- */
   1442     /* ------------------------------- */
   1443 }
   1444 
   1445 /* <=======================================================> */
   1446 /*  PER-Encoder for RedundancyEncodingCapability (SEQUENCE)  */
   1447 /* <=======================================================> */
   1448 void Encode_RedundancyEncodingCapability(PS_RedundancyEncodingCapability x, PS_OutStream stream)
   1449 {
   1450     uint16 i;
   1451     PutBoolean(0, stream); /* Extension Bit OFF */
   1452     PutBoolean(x->option_of_secondaryEncoding, stream);
   1453     Encode_RedundancyEncodingMethod(&x->redundancyEncodingMethod, stream);
   1454     PutInteger(1, 65535, (uint32)x->primaryEncoding, stream);
   1455     if (x->option_of_secondaryEncoding)
   1456     {
   1457         PutInteger(1, 256, (uint32)x->size_of_secondaryEncoding, stream);
   1458         for (i = 0; i < x->size_of_secondaryEncoding; ++i)
   1459         {
   1460             PutInteger(1, 65535, (uint32)x->secondaryEncoding[i], stream);
   1461         }
   1462     }
   1463     /* ------------------------------- */
   1464     /* ---- Extension Begins Here ---- */
   1465     /* ------------------------------- */
   1466 }
   1467 
   1468 /* <=================================================> */
   1469 /*  PER-Encoder for RedundancyEncodingMethod (CHOICE)  */
   1470 /* <=================================================> */
   1471 void Encode_RedundancyEncodingMethod(PS_RedundancyEncodingMethod x, PS_OutStream stream)
   1472 {
   1473     PutChoiceIndex(2, 1, x->index, stream);
   1474     switch (x->index)
   1475     {
   1476         case 0:
   1477             Encode_NonStandardParameter(x->nonStandard, stream);
   1478             break;
   1479         case 1:
   1480             /* (rtpAudioRedundancyEncoding is NULL) */
   1481             break;
   1482             /* ------------------------------- */
   1483             /* ---- Extension Begins Here ---- */
   1484             /* ------------------------------- */
   1485         case 2:
   1486             PutExtensionItem(EPASS Encode_RTPH263VideoRedundancyEncoding, (uint8*)x->rtpH263VideoRedundancyEncoding, stream);
   1487             break;
   1488         default:
   1489             ErrorMessageAndLeave("Encode_RedundancyEncodingMethod: Illegal CHOICE index");
   1490     }
   1491 }
   1492 
   1493 /* <=========================================================> */
   1494 /*  PER-Encoder for RTPH263VideoRedundancyEncoding (SEQUENCE)  */
   1495 /* <=========================================================> */
   1496 void Encode_RTPH263VideoRedundancyEncoding(PS_RTPH263VideoRedundancyEncoding x, PS_OutStream stream)
   1497 {
   1498     uint16 i;
   1499     PutBoolean(0, stream); /* Extension Bit OFF */
   1500     PutBoolean(x->option_of_containedThreads, stream);
   1501     PutInteger(1, 16, (uint32)x->numberOfThreads, stream);
   1502     PutInteger(1, 256, (uint32)x->framesBetweenSyncPoints, stream);
   1503     Encode_FrameToThreadMapping(&x->frameToThreadMapping, stream);
   1504     if (x->option_of_containedThreads)
   1505     {
   1506         PutInteger(1, 256, (uint32)x->size_of_containedThreads, stream);
   1507         for (i = 0; i < x->size_of_containedThreads; ++i)
   1508         {
   1509             PutInteger(0, 15, (uint32)x->containedThreads[i], stream);
   1510         }
   1511     }
   1512     /* ------------------------------- */
   1513     /* ---- Extension Begins Here ---- */
   1514     /* ------------------------------- */
   1515 }
   1516 
   1517 /* <=============================================> */
   1518 /*  PER-Encoder for FrameToThreadMapping (CHOICE)  */
   1519 /* <=============================================> */
   1520 void Encode_FrameToThreadMapping(PS_FrameToThreadMapping x, PS_OutStream stream)
   1521 {
   1522     uint16 i;
   1523     PutChoiceIndex(2, 1, x->index, stream);
   1524     switch (x->index)
   1525     {
   1526         case 0:
   1527             /* (roundrobin is NULL) */
   1528             break;
   1529         case 1:
   1530             PutInteger(1, 256, (uint32)x->size, stream);
   1531             for (i = 0; i < x->size; ++i)
   1532             {
   1533                 Encode_RTPH263VideoRedundancyFrameMapping(x->custom + i, stream);
   1534             }
   1535             break;
   1536             /* ------------------------------- */
   1537             /* ---- Extension Begins Here ---- */
   1538             /* ------------------------------- */
   1539         default:
   1540             ErrorMessageAndLeave("Encode_FrameToThreadMapping: Illegal CHOICE index");
   1541     }
   1542 }
   1543 
   1544 /* <=============================================================> */
   1545 /*  PER-Encoder for RTPH263VideoRedundancyFrameMapping (SEQUENCE)  */
   1546 /* <=============================================================> */
   1547 void Encode_RTPH263VideoRedundancyFrameMapping(PS_RTPH263VideoRedundancyFrameMapping x, PS_OutStream stream)
   1548 {
   1549     uint16 i;
   1550     PutBoolean(0, stream); /* Extension Bit OFF */
   1551     PutInteger(0, 15, (uint32)x->threadNumber, stream);
   1552     PutInteger(1, 256, (uint32)x->size_of_frameSequence, stream);
   1553     for (i = 0; i < x->size_of_frameSequence; ++i)
   1554     {
   1555         PutInteger(0, 255, (uint32)x->frameSequence[i], stream);
   1556     }
   1557     /* ------------------------------- */
   1558     /* ---- Extension Begins Here ---- */
   1559     /* ------------------------------- */
   1560 }
   1561 
   1562 /* <===============================================> */
   1563 /*  PER-Encoder for MultipointCapability (SEQUENCE)  */
   1564 /* <===============================================> */
   1565 void Encode_MultipointCapability(PS_MultipointCapability x, PS_OutStream stream)
   1566 {
   1567     uint16 i;
   1568     PutBoolean(0, stream); /* Extension Bit OFF */
   1569     PutBoolean(x->multicastCapability, stream);
   1570     PutBoolean(x->multiUniCastConference, stream);
   1571     PutLengthDet(x->size_of_mediaDistributionCapability, stream);
   1572     for (i = 0; i < x->size_of_mediaDistributionCapability; ++i)
   1573     {
   1574         Encode_MediaDistributionCapability(x->mediaDistributionCapability + i, stream);
   1575     }
   1576     /* ------------------------------- */
   1577     /* ---- Extension Begins Here ---- */
   1578     /* ------------------------------- */
   1579 }
   1580 
   1581 /* <======================================================> */
   1582 /*  PER-Encoder for MediaDistributionCapability (SEQUENCE)  */
   1583 /* <======================================================> */
   1584 void Encode_MediaDistributionCapability(PS_MediaDistributionCapability x, PS_OutStream stream)
   1585 {
   1586     uint16 i;
   1587     PutBoolean(0, stream); /* Extension Bit OFF */
   1588     PutBoolean(x->option_of_centralizedData, stream);
   1589     PutBoolean(x->option_of_distributedData, stream);
   1590     PutBoolean(x->centralizedControl, stream);
   1591     PutBoolean(x->distributedControl, stream);
   1592     PutBoolean(x->centralizedAudio, stream);
   1593     PutBoolean(x->distributedAudio, stream);
   1594     PutBoolean(x->centralizedVideo, stream);
   1595     PutBoolean(x->distributedVideo, stream);
   1596     if (x->option_of_centralizedData)
   1597     {
   1598         PutLengthDet(x->size_of_centralizedData, stream);
   1599         for (i = 0; i < x->size_of_centralizedData; ++i)
   1600         {
   1601             Encode_DataApplicationCapability(x->centralizedData + i, stream);
   1602         }
   1603     }
   1604     if (x->option_of_distributedData)
   1605     {
   1606         PutLengthDet(x->size_of_distributedData, stream);
   1607         for (i = 0; i < x->size_of_distributedData; ++i)
   1608         {
   1609             Encode_DataApplicationCapability(x->distributedData + i, stream);
   1610         }
   1611     }
   1612     /* ------------------------------- */
   1613     /* ---- Extension Begins Here ---- */
   1614     /* ------------------------------- */
   1615 }
   1616 
   1617 /* <========================================> */
   1618 /*  PER-Encoder for VideoCapability (CHOICE)  */
   1619 /* <========================================> */
   1620 void Encode_VideoCapability(PS_VideoCapability x, PS_OutStream stream)
   1621 {
   1622     PutChoiceIndex(5, 1, x->index, stream);
   1623     switch (x->index)
   1624     {
   1625         case 0:
   1626             Encode_NonStandardParameter(x->nonStandard, stream);
   1627             break;
   1628         case 1:
   1629             Encode_H261VideoCapability(x->h261VideoCapability, stream);
   1630             break;
   1631         case 2:
   1632             Encode_H262VideoCapability(x->h262VideoCapability, stream);
   1633             break;
   1634         case 3:
   1635             Encode_H263VideoCapability(x->h263VideoCapability, stream);
   1636             break;
   1637         case 4:
   1638             Encode_IS11172VideoCapability(x->is11172VideoCapability, stream);
   1639             break;
   1640             /* ------------------------------- */
   1641             /* ---- Extension Begins Here ---- */
   1642             /* ------------------------------- */
   1643         case 5:
   1644             PutExtensionItem(EPASS Encode_GenericCapability, (uint8*)x->genericVideoCapability, stream);
   1645             break;
   1646         default:
   1647             ErrorMessageAndLeave("Encode_VideoCapability: Illegal CHOICE index");
   1648     }
   1649 }
   1650 
   1651 /* <==============================================> */
   1652 /*  PER-Encoder for H261VideoCapability (SEQUENCE)  */
   1653 /* <==============================================> */
   1654 void Encode_H261VideoCapability(PS_H261VideoCapability x, PS_OutStream stream)
   1655 {
   1656     PutBoolean(0, stream); /* Extension Bit OFF */
   1657     PutBoolean(x->option_of_qcifMPI, stream);
   1658     PutBoolean(x->option_of_cifMPI, stream);
   1659     if (x->option_of_qcifMPI)
   1660     {
   1661         PutInteger(1, 4, (uint32)x->qcifMPI, stream);
   1662     }
   1663     if (x->option_of_cifMPI)
   1664     {
   1665         PutInteger(1, 4, (uint32)x->cifMPI, stream);
   1666     }
   1667     PutBoolean(x->temporalSpatialTradeOffCapability, stream);
   1668     PutInteger(1, 19200, (uint32)x->maxBitRate, stream);
   1669     PutBoolean(x->stillImageTransmission, stream);
   1670     /* ------------------------------- */
   1671     /* ---- Extension Begins Here ---- */
   1672     /* ------------------------------- */
   1673 }
   1674 
   1675 /* <==============================================> */
   1676 /*  PER-Encoder for H262VideoCapability (SEQUENCE)  */
   1677 /* <==============================================> */
   1678 void Encode_H262VideoCapability(PS_H262VideoCapability x, PS_OutStream stream)
   1679 {
   1680     PutBoolean(0, stream); /* Extension Bit OFF */
   1681     PutBoolean(x->option_of_videoBitRate, stream);
   1682     PutBoolean(x->option_of_vbvBufferSize, stream);
   1683     PutBoolean(x->option_of_samplesPerLine, stream);
   1684     PutBoolean(x->option_of_linesPerFrame, stream);
   1685     PutBoolean(x->option_of_framesPerSecond, stream);
   1686     PutBoolean(x->option_of_luminanceSampleRate, stream);
   1687     PutBoolean(x->profileAndLevel_SPatML, stream);
   1688     PutBoolean(x->profileAndLevel_MPatLL, stream);
   1689     PutBoolean(x->profileAndLevel_MPatML, stream);
   1690     PutBoolean(x->profileAndLevel_MPatH_14, stream);
   1691     PutBoolean(x->profileAndLevel_MPatHL, stream);
   1692     PutBoolean(x->profileAndLevel_SNRatLL, stream);
   1693     PutBoolean(x->profileAndLevel_SNRatML, stream);
   1694     PutBoolean(x->profileAndLevel_SpatialatH_14, stream);
   1695     PutBoolean(x->profileAndLevel_HPatML, stream);
   1696     PutBoolean(x->profileAndLevel_HPatH_14, stream);
   1697     PutBoolean(x->profileAndLevel_HPatHL, stream);
   1698     if (x->option_of_videoBitRate)
   1699     {
   1700         PutInteger(0, 1073741823, (uint32)x->videoBitRate, stream);
   1701     }
   1702     if (x->option_of_vbvBufferSize)
   1703     {
   1704         PutInteger(0, 262143, (uint32)x->vbvBufferSize, stream);
   1705     }
   1706     if (x->option_of_samplesPerLine)
   1707     {
   1708         PutInteger(0, 16383, (uint32)x->samplesPerLine, stream);
   1709     }
   1710     if (x->option_of_linesPerFrame)
   1711     {
   1712         PutInteger(0, 16383, (uint32)x->linesPerFrame, stream);
   1713     }
   1714     if (x->option_of_framesPerSecond)
   1715     {
   1716         PutInteger(0, 15, (uint32)x->framesPerSecond, stream);
   1717     }
   1718     if (x->option_of_luminanceSampleRate)
   1719     {
   1720         PutInteger(0, 0xffffffff, (uint32)x->luminanceSampleRate, stream);
   1721     }
   1722     /* ------------------------------- */
   1723     /* ---- Extension Begins Here ---- */
   1724     /* ------------------------------- */
   1725 }
   1726 
   1727 /* <==============================================> */
   1728 /*  PER-Encoder for H263VideoCapability (SEQUENCE)  */
   1729 /* <==============================================> */
   1730 void Encode_H263VideoCapability(PS_H263VideoCapability x, PS_OutStream stream)
   1731 {
   1732     uint32 extension;
   1733 
   1734     extension = x->option_of_slowSqcifMPI |
   1735                 x->option_of_slowQcifMPI |
   1736                 x->option_of_slowCifMPI |
   1737                 x->option_of_slowCif4MPI |
   1738                 x->option_of_slowCif16MPI |
   1739                 x->option_of_errorCompensation |
   1740                 x->option_of_enhancementLayerInfo |
   1741                 x->option_of_h263Options;
   1742     PutBoolean(extension, stream);
   1743 
   1744     PutBoolean(x->option_of_sqcifMPI, stream);
   1745     PutBoolean(x->option_of_qcifMPI, stream);
   1746     PutBoolean(x->option_of_cifMPI, stream);
   1747     PutBoolean(x->option_of_cif4MPI, stream);
   1748     PutBoolean(x->option_of_cif16MPI, stream);
   1749     PutBoolean(x->option_of_hrd_B, stream);
   1750     PutBoolean(x->option_of_bppMaxKb, stream);
   1751     if (x->option_of_sqcifMPI)
   1752     {
   1753         PutInteger(1, 32, (uint32)x->sqcifMPI, stream);
   1754     }
   1755     if (x->option_of_qcifMPI)
   1756     {
   1757         PutInteger(1, 32, (uint32)x->qcifMPI, stream);
   1758     }
   1759     if (x->option_of_cifMPI)
   1760     {
   1761         PutInteger(1, 32, (uint32)x->cifMPI, stream);
   1762     }
   1763     if (x->option_of_cif4MPI)
   1764     {
   1765         PutInteger(1, 32, (uint32)x->cif4MPI, stream);
   1766     }
   1767     if (x->option_of_cif16MPI)
   1768     {
   1769         PutInteger(1, 32, (uint32)x->cif16MPI, stream);
   1770     }
   1771     PutInteger(1, 192400, (uint32)x->maxBitRate, stream);
   1772     PutBoolean(x->unrestrictedVector, stream);
   1773     PutBoolean(x->arithmeticCoding, stream);
   1774     PutBoolean(x->advancedPrediction, stream);
   1775     PutBoolean(x->pbFrames, stream);
   1776     PutBoolean(x->temporalSpatialTradeOffCapability, stream);
   1777     if (x->option_of_hrd_B)
   1778     {
   1779         PutInteger(0, 524287, (uint32)x->hrd_B, stream);
   1780     }
   1781     if (x->option_of_bppMaxKb)
   1782     {
   1783         PutInteger(0, 65535, (uint32)x->bppMaxKb, stream);
   1784     }
   1785     /* ------------------------------- */
   1786     /* ---- Extension Begins Here ---- */
   1787     /* ------------------------------- */
   1788     if (!extension) return; /* (No items present?) */
   1789     PutNormSmallLength(8, stream); /* Begin Options Map */
   1790     PutBoolean(x->option_of_slowSqcifMPI, stream);
   1791     PutBoolean(x->option_of_slowQcifMPI, stream);
   1792     PutBoolean(x->option_of_slowCifMPI, stream);
   1793     PutBoolean(x->option_of_slowCif4MPI, stream);
   1794     PutBoolean(x->option_of_slowCif16MPI, stream);
   1795     PutBoolean(x->option_of_errorCompensation, stream);
   1796     PutBoolean(x->option_of_enhancementLayerInfo, stream);
   1797     PutBoolean(x->option_of_h263Options, stream);
   1798     if (x->option_of_slowSqcifMPI)
   1799     {
   1800         PutExtensionInteger(1, 3600, (uint32)x->slowSqcifMPI, stream);
   1801     }
   1802     if (x->option_of_slowQcifMPI)
   1803     {
   1804         PutExtensionInteger(1, 3600, (uint32)x->slowQcifMPI, stream);
   1805     }
   1806     if (x->option_of_slowCifMPI)
   1807     {
   1808         PutExtensionInteger(1, 3600, (uint32)x->slowCifMPI, stream);
   1809     }
   1810     if (x->option_of_slowCif4MPI)
   1811     {
   1812         PutExtensionInteger(1, 3600, (uint32)x->slowCif4MPI, stream);
   1813     }
   1814     if (x->option_of_slowCif16MPI)
   1815     {
   1816         PutExtensionInteger(1, 3600, (uint32)x->slowCif16MPI, stream);
   1817     }
   1818     if (x->option_of_errorCompensation)
   1819     {
   1820         PutExtensionBoolean(x->errorCompensation, stream);
   1821     }
   1822     if (x->option_of_enhancementLayerInfo)
   1823     {
   1824         PutExtensionItem(EPASS Encode_EnhancementLayerInfo, (uint8*)&x->enhancementLayerInfo, stream);
   1825     }
   1826     if (x->option_of_h263Options)
   1827     {
   1828         PutExtensionItem(EPASS Encode_H263Options, (uint8*)&x->h263Options, stream);
   1829     }
   1830 }
   1831 
   1832 /* <===============================================> */
   1833 /*  PER-Encoder for EnhancementLayerInfo (SEQUENCE)  */
   1834 /* <===============================================> */
   1835 void Encode_EnhancementLayerInfo(PS_EnhancementLayerInfo x, PS_OutStream stream)
   1836 {
   1837     uint16 i;
   1838     PutBoolean(0, stream); /* Extension Bit OFF */
   1839     PutBoolean(x->option_of_snrEnhancement, stream);
   1840     PutBoolean(x->option_of_spatialEnhancement, stream);
   1841     PutBoolean(x->option_of_bPictureEnhancement, stream);
   1842     PutBoolean(x->baseBitRateConstrained, stream);
   1843     if (x->option_of_snrEnhancement)
   1844     {
   1845         PutInteger(1, 14, (uint32)x->size_of_snrEnhancement, stream);
   1846         for (i = 0; i < x->size_of_snrEnhancement; ++i)
   1847         {
   1848             Encode_EnhancementOptions(x->snrEnhancement + i, stream);
   1849         }
   1850     }
   1851     if (x->option_of_spatialEnhancement)
   1852     {
   1853         PutInteger(1, 14, (uint32)x->size_of_spatialEnhancement, stream);
   1854         for (i = 0; i < x->size_of_spatialEnhancement; ++i)
   1855         {
   1856             Encode_EnhancementOptions(x->spatialEnhancement + i, stream);
   1857         }
   1858     }
   1859     if (x->option_of_bPictureEnhancement)
   1860     {
   1861         PutInteger(1, 14, (uint32)x->size_of_bPictureEnhancement, stream);
   1862         for (i = 0; i < x->size_of_bPictureEnhancement; ++i)
   1863         {
   1864             Encode_BEnhancementParameters(x->bPictureEnhancement + i, stream);
   1865         }
   1866     }
   1867     /* ------------------------------- */
   1868     /* ---- Extension Begins Here ---- */
   1869     /* ------------------------------- */
   1870 }
   1871 
   1872 /* <=================================================> */
   1873 /*  PER-Encoder for BEnhancementParameters (SEQUENCE)  */
   1874 /* <=================================================> */
   1875 void Encode_BEnhancementParameters(PS_BEnhancementParameters x, PS_OutStream stream)
   1876 {
   1877     PutBoolean(0, stream); /* Extension Bit OFF */
   1878     Encode_EnhancementOptions(&x->enhancementOptions, stream);
   1879     PutInteger(1, 64, (uint32)x->numberOfBPictures, stream);
   1880     /* ------------------------------- */
   1881     /* ---- Extension Begins Here ---- */
   1882     /* ------------------------------- */
   1883 }
   1884 
   1885 /* <=============================================> */
   1886 /*  PER-Encoder for EnhancementOptions (SEQUENCE)  */
   1887 /* <=============================================> */
   1888 void Encode_EnhancementOptions(PS_EnhancementOptions x, PS_OutStream stream)
   1889 {
   1890     PutBoolean(0, stream); /* Extension Bit OFF */
   1891     PutBoolean(x->option_of_sqcifMPI, stream);
   1892     PutBoolean(x->option_of_qcifMPI, stream);
   1893     PutBoolean(x->option_of_cifMPI, stream);
   1894     PutBoolean(x->option_of_cif4MPI, stream);
   1895     PutBoolean(x->option_of_cif16MPI, stream);
   1896     PutBoolean(x->option_of_slowSqcifMPI, stream);
   1897     PutBoolean(x->option_of_slowQcifMPI, stream);
   1898     PutBoolean(x->option_of_slowCifMPI, stream);
   1899     PutBoolean(x->option_of_slowCif4MPI, stream);
   1900     PutBoolean(x->option_of_slowCif16MPI, stream);
   1901     PutBoolean(x->option_of_h263Options, stream);
   1902     if (x->option_of_sqcifMPI)
   1903     {
   1904         PutInteger(1, 32, (uint32)x->sqcifMPI, stream);
   1905     }
   1906     if (x->option_of_qcifMPI)
   1907     {
   1908         PutInteger(1, 32, (uint32)x->qcifMPI, stream);
   1909     }
   1910     if (x->option_of_cifMPI)
   1911     {
   1912         PutInteger(1, 32, (uint32)x->cifMPI, stream);
   1913     }
   1914     if (x->option_of_cif4MPI)
   1915     {
   1916         PutInteger(1, 32, (uint32)x->cif4MPI, stream);
   1917     }
   1918     if (x->option_of_cif16MPI)
   1919     {
   1920         PutInteger(1, 32, (uint32)x->cif16MPI, stream);
   1921     }
   1922     PutInteger(1, 192400, (uint32)x->maxBitRate, stream);
   1923     PutBoolean(x->unrestrictedVector, stream);
   1924     PutBoolean(x->arithmeticCoding, stream);
   1925     PutBoolean(x->temporalSpatialTradeOffCapability, stream);
   1926     if (x->option_of_slowSqcifMPI)
   1927     {
   1928         PutInteger(1, 3600, (uint32)x->slowSqcifMPI, stream);
   1929     }
   1930     if (x->option_of_slowQcifMPI)
   1931     {
   1932         PutInteger(1, 3600, (uint32)x->slowQcifMPI, stream);
   1933     }
   1934     if (x->option_of_slowCifMPI)
   1935     {
   1936         PutInteger(1, 3600, (uint32)x->slowCifMPI, stream);
   1937     }
   1938     if (x->option_of_slowCif4MPI)
   1939     {
   1940         PutInteger(1, 3600, (uint32)x->slowCif4MPI, stream);
   1941     }
   1942     if (x->option_of_slowCif16MPI)
   1943     {
   1944         PutInteger(1, 3600, (uint32)x->slowCif16MPI, stream);
   1945     }
   1946     PutBoolean(x->errorCompensation, stream);
   1947     if (x->option_of_h263Options)
   1948     {
   1949         Encode_H263Options(&x->h263Options, stream);
   1950     }
   1951     /* ------------------------------- */
   1952     /* ---- Extension Begins Here ---- */
   1953     /* ------------------------------- */
   1954 }
   1955 
   1956 /* <======================================> */
   1957 /*  PER-Encoder for H263Options (SEQUENCE)  */
   1958 /* <======================================> */
   1959 void Encode_H263Options(PS_H263Options x, PS_OutStream stream)
   1960 {
   1961     uint16 i;
   1962     PutBoolean(0, stream); /* Extension Bit OFF */
   1963     PutBoolean(x->option_of_transparencyParameters, stream);
   1964     PutBoolean(x->option_of_refPictureSelection, stream);
   1965     PutBoolean(x->option_of_customPictureClockFrequency, stream);
   1966     PutBoolean(x->option_of_customPictureFormat, stream);
   1967     PutBoolean(x->option_of_modeCombos, stream);
   1968     PutBoolean(x->advancedIntraCodingMode, stream);
   1969     PutBoolean(x->deblockingFilterMode, stream);
   1970     PutBoolean(x->improvedPBFramesMode, stream);
   1971     PutBoolean(x->unlimitedMotionVectors, stream);
   1972     PutBoolean(x->fullPictureFreeze, stream);
   1973     PutBoolean(x->partialPictureFreezeAndRelease, stream);
   1974     PutBoolean(x->resizingPartPicFreezeAndRelease, stream);
   1975     PutBoolean(x->fullPictureSnapshot, stream);
   1976     PutBoolean(x->partialPictureSnapshot, stream);
   1977     PutBoolean(x->videoSegmentTagging, stream);
   1978     PutBoolean(x->progressiveRefinement, stream);
   1979     PutBoolean(x->dynamicPictureResizingByFour, stream);
   1980     PutBoolean(x->dynamicPictureResizingSixteenthPel, stream);
   1981     PutBoolean(x->dynamicWarpingHalfPel, stream);
   1982     PutBoolean(x->dynamicWarpingSixteenthPel, stream);
   1983     PutBoolean(x->independentSegmentDecoding, stream);
   1984     PutBoolean(x->slicesInOrder_NonRect, stream);
   1985     PutBoolean(x->slicesInOrder_Rect, stream);
   1986     PutBoolean(x->slicesNoOrder_NonRect, stream);
   1987     PutBoolean(x->slicesNoOrder_Rect, stream);
   1988     PutBoolean(x->alternateInterVLCMode, stream);
   1989     PutBoolean(x->modifiedQuantizationMode, stream);
   1990     PutBoolean(x->reducedResolutionUpdate, stream);
   1991     if (x->option_of_transparencyParameters)
   1992     {
   1993         Encode_TransparencyParameters(&x->transparencyParameters, stream);
   1994     }
   1995     PutBoolean(x->separateVideoBackChannel, stream);
   1996     if (x->option_of_refPictureSelection)
   1997     {
   1998         Encode_RefPictureSelection(&x->refPictureSelection, stream);
   1999     }
   2000     if (x->option_of_customPictureClockFrequency)
   2001     {
   2002         PutInteger(1, 16, (uint32)x->size_of_customPictureClockFrequency, stream);
   2003         for (i = 0; i < x->size_of_customPictureClockFrequency; ++i)
   2004         {
   2005             Encode_CustomPictureClockFrequency(x->customPictureClockFrequency + i, stream);
   2006         }
   2007     }
   2008     if (x->option_of_customPictureFormat)
   2009     {
   2010         PutInteger(1, 16, (uint32)x->size_of_customPictureFormat, stream);
   2011         for (i = 0; i < x->size_of_customPictureFormat; ++i)
   2012         {
   2013             Encode_CustomPictureFormat(x->customPictureFormat + i, stream);
   2014         }
   2015     }
   2016     if (x->option_of_modeCombos)
   2017     {
   2018         PutInteger(1, 16, (uint32)x->size_of_modeCombos, stream);
   2019         for (i = 0; i < x->size_of_modeCombos; ++i)
   2020         {
   2021             Encode_H263VideoModeCombos(x->modeCombos + i, stream);
   2022         }
   2023     }
   2024     /* ------------------------------- */
   2025     /* ---- Extension Begins Here ---- */
   2026     /* ------------------------------- */
   2027 }
   2028 
   2029 /* <=================================================> */
   2030 /*  PER-Encoder for TransparencyParameters (SEQUENCE)  */
   2031 /* <=================================================> */
   2032 void Encode_TransparencyParameters(PS_TransparencyParameters x, PS_OutStream stream)
   2033 {
   2034     PutBoolean(0, stream); /* Extension Bit OFF */
   2035     PutInteger(1, 256, (uint32)x->presentationOrder, stream);
   2036     PutSignedInteger(-262144, 262143, (int32)x->offset_x, stream);
   2037     PutSignedInteger(-262144, 262143, (int32)x->offset_y, stream);
   2038     PutInteger(1, 255, (uint32)x->scale_x, stream);
   2039     PutInteger(1, 255, (uint32)x->scale_y, stream);
   2040     /* ------------------------------- */
   2041     /* ---- Extension Begins Here ---- */
   2042     /* ------------------------------- */
   2043 }
   2044 
   2045 /* <==============================================> */
   2046 /*  PER-Encoder for RefPictureSelection (SEQUENCE)  */
   2047 /* <==============================================> */
   2048 void Encode_RefPictureSelection(PS_RefPictureSelection x, PS_OutStream stream)
   2049 {
   2050     PutBoolean(0, stream); /* Extension Bit OFF */
   2051     PutBoolean(x->option_of_additionalPictureMemory, stream);
   2052     if (x->option_of_additionalPictureMemory)
   2053     {
   2054         Encode_AdditionalPictureMemory(&x->additionalPictureMemory, stream);
   2055     }
   2056     PutBoolean(x->videoMux, stream);
   2057     Encode_VideoBackChannelSend(&x->videoBackChannelSend, stream);
   2058     /* ------------------------------- */
   2059     /* ---- Extension Begins Here ---- */
   2060     /* ------------------------------- */
   2061 }
   2062 
   2063 /* <=============================================> */
   2064 /*  PER-Encoder for VideoBackChannelSend (CHOICE)  */
   2065 /* <=============================================> */
   2066 void Encode_VideoBackChannelSend(PS_VideoBackChannelSend x, PS_OutStream stream)
   2067 {
   2068     PutChoiceIndex(5, 1, x->index, stream);
   2069     switch (x->index)
   2070     {
   2071         case 0:
   2072             /* (none is NULL) */
   2073             break;
   2074         case 1:
   2075             /* (ackMessageOnly is NULL) */
   2076             break;
   2077         case 2:
   2078             /* (nackMessageOnly is NULL) */
   2079             break;
   2080         case 3:
   2081             /* (ackOrNackMessageOnly is NULL) */
   2082             break;
   2083         case 4:
   2084             /* (ackAndNackMessage is NULL) */
   2085             break;
   2086             /* ------------------------------- */
   2087             /* ---- Extension Begins Here ---- */
   2088             /* ------------------------------- */
   2089         default:
   2090             ErrorMessageAndLeave("Encode_VideoBackChannelSend: Illegal CHOICE index");
   2091     }
   2092 }
   2093 
   2094 /* <==================================================> */
   2095 /*  PER-Encoder for AdditionalPictureMemory (SEQUENCE)  */
   2096 /* <==================================================> */
   2097 void Encode_AdditionalPictureMemory(PS_AdditionalPictureMemory x, PS_OutStream stream)
   2098 {
   2099     PutBoolean(0, stream); /* Extension Bit OFF */
   2100     PutBoolean(x->option_of_sqcifAdditionalPictureMemory, stream);
   2101     PutBoolean(x->option_of_qcifAdditionalPictureMemory, stream);
   2102     PutBoolean(x->option_of_cifAdditionalPictureMemory, stream);
   2103     PutBoolean(x->option_of_cif4AdditionalPictureMemory, stream);
   2104     PutBoolean(x->option_of_cif16AdditionalPictureMemory, stream);
   2105     PutBoolean(x->option_of_bigCpfAdditionalPictureMemory, stream);
   2106     if (x->option_of_sqcifAdditionalPictureMemory)
   2107     {
   2108         PutInteger(1, 256, (uint32)x->sqcifAdditionalPictureMemory, stream);
   2109     }
   2110     if (x->option_of_qcifAdditionalPictureMemory)
   2111     {
   2112         PutInteger(1, 256, (uint32)x->qcifAdditionalPictureMemory, stream);
   2113     }
   2114     if (x->option_of_cifAdditionalPictureMemory)
   2115     {
   2116         PutInteger(1, 256, (uint32)x->cifAdditionalPictureMemory, stream);
   2117     }
   2118     if (x->option_of_cif4AdditionalPictureMemory)
   2119     {
   2120         PutInteger(1, 256, (uint32)x->cif4AdditionalPictureMemory, stream);
   2121     }
   2122     if (x->option_of_cif16AdditionalPictureMemory)
   2123     {
   2124         PutInteger(1, 256, (uint32)x->cif16AdditionalPictureMemory, stream);
   2125     }
   2126     if (x->option_of_bigCpfAdditionalPictureMemory)
   2127     {
   2128         PutInteger(1, 256, (uint32)x->bigCpfAdditionalPictureMemory, stream);
   2129     }
   2130     /* ------------------------------- */
   2131     /* ---- Extension Begins Here ---- */
   2132     /* ------------------------------- */
   2133 }
   2134 
   2135 /* <======================================================> */
   2136 /*  PER-Encoder for CustomPictureClockFrequency (SEQUENCE)  */
   2137 /* <======================================================> */
   2138 void Encode_CustomPictureClockFrequency(PS_CustomPictureClockFrequency x, PS_OutStream stream)
   2139 {
   2140     PutBoolean(0, stream); /* Extension Bit OFF */
   2141     PutBoolean(x->option_of_sqcifMPI, stream);
   2142     PutBoolean(x->option_of_qcifMPI, stream);
   2143     PutBoolean(x->option_of_cifMPI, stream);
   2144     PutBoolean(x->option_of_cif4MPI, stream);
   2145     PutBoolean(x->option_of_cif16MPI, stream);
   2146     PutInteger(1000, 1001, (uint32)x->clockConversionCode, stream);
   2147     PutInteger(1, 127, (uint32)x->clockDivisor, stream);
   2148     if (x->option_of_sqcifMPI)
   2149     {
   2150         PutInteger(1, 2048, (uint32)x->sqcifMPI, stream);
   2151     }
   2152     if (x->option_of_qcifMPI)
   2153     {
   2154         PutInteger(1, 2048, (uint32)x->qcifMPI, stream);
   2155     }
   2156     if (x->option_of_cifMPI)
   2157     {
   2158         PutInteger(1, 2048, (uint32)x->cifMPI, stream);
   2159     }
   2160     if (x->option_of_cif4MPI)
   2161     {
   2162         PutInteger(1, 2048, (uint32)x->cif4MPI, stream);
   2163     }
   2164     if (x->option_of_cif16MPI)
   2165     {
   2166         PutInteger(1, 2048, (uint32)x->cif16MPI, stream);
   2167     }
   2168     /* ------------------------------- */
   2169     /* ---- Extension Begins Here ---- */
   2170     /* ------------------------------- */
   2171 }
   2172 
   2173 /* <==============================================> */
   2174 /*  PER-Encoder for CustomPictureFormat (SEQUENCE)  */
   2175 /* <==============================================> */
   2176 void Encode_CustomPictureFormat(PS_CustomPictureFormat x, PS_OutStream stream)
   2177 {
   2178     PutBoolean(0, stream); /* Extension Bit OFF */
   2179     PutInteger(1, 2048, (uint32)x->maxCustomPictureWidth, stream);
   2180     PutInteger(1, 2048, (uint32)x->maxCustomPictureHeight, stream);
   2181     PutInteger(1, 2048, (uint32)x->minCustomPictureWidth, stream);
   2182     PutInteger(1, 2048, (uint32)x->minCustomPictureHeight, stream);
   2183     Encode_MPI(&x->mPI, stream);
   2184     Encode_PixelAspectInformation(&x->pixelAspectInformation, stream);
   2185     /* ------------------------------- */
   2186     /* ---- Extension Begins Here ---- */
   2187     /* ------------------------------- */
   2188 }
   2189 
   2190 /* <===============================================> */
   2191 /*  PER-Encoder for PixelAspectInformation (CHOICE)  */
   2192 /* <===============================================> */
   2193 void Encode_PixelAspectInformation(PS_PixelAspectInformation x, PS_OutStream stream)
   2194 {
   2195     uint16 i;
   2196     PutChoiceIndex(3, 1, x->index, stream);
   2197     switch (x->index)
   2198     {
   2199         case 0:
   2200             PutBoolean(x->anyPixelAspectRatio, stream);
   2201             break;
   2202         case 1:
   2203             PutInteger(1, 14, (uint32)x->size, stream);
   2204             for (i = 0; i < x->size; ++i)
   2205             {
   2206                 PutInteger(1, 14, (uint32)x->pixelAspectCode[i], stream);
   2207             }
   2208             break;
   2209         case 2:
   2210             PutInteger(1, 256, (uint32)x->size, stream);
   2211             for (i = 0; i < x->size; ++i)
   2212             {
   2213                 Encode_ExtendedPARItem(x->extendedPAR + i, stream);
   2214             }
   2215             break;
   2216             /* ------------------------------- */
   2217             /* ---- Extension Begins Here ---- */
   2218             /* ------------------------------- */
   2219         default:
   2220             ErrorMessageAndLeave("Encode_PixelAspectInformation: Illegal CHOICE index");
   2221     }
   2222 }
   2223 
   2224 /* <==========================================> */
   2225 /*  PER-Encoder for ExtendedPARItem (SEQUENCE)  */
   2226 /* <==========================================> */
   2227 void Encode_ExtendedPARItem(PS_ExtendedPARItem x, PS_OutStream stream)
   2228 {
   2229     PutBoolean(0, stream); /* Extension Bit OFF */
   2230     PutInteger(1, 255, (uint32)x->width, stream);
   2231     PutInteger(1, 255, (uint32)x->height, stream);
   2232     /* ------------------------------- */
   2233     /* ---- Extension Begins Here ---- */
   2234     /* ------------------------------- */
   2235 }
   2236 
   2237 /* <==============================> */
   2238 /*  PER-Encoder for MPI (SEQUENCE)  */
   2239 /* <==============================> */
   2240 void Encode_MPI(PS_MPI x, PS_OutStream stream)
   2241 {
   2242     uint16 i;
   2243     PutBoolean(0, stream); /* Extension Bit OFF */
   2244     PutBoolean(x->option_of_standardMPI, stream);
   2245     PutBoolean(x->option_of_customPCF, stream);
   2246     if (x->option_of_standardMPI)
   2247     {
   2248         PutInteger(1, 31, (uint32)x->standardMPI, stream);
   2249     }
   2250     if (x->option_of_customPCF)
   2251     {
   2252         PutInteger(1, 16, (uint32)x->size_of_customPCF, stream);
   2253         for (i = 0; i < x->size_of_customPCF; ++i)
   2254         {
   2255             Encode_CustomPCFItem(x->customPCF + i, stream);
   2256         }
   2257     }
   2258     /* ------------------------------- */
   2259     /* ---- Extension Begins Here ---- */
   2260     /* ------------------------------- */
   2261 }
   2262 
   2263 /* <========================================> */
   2264 /*  PER-Encoder for CustomPCFItem (SEQUENCE)  */
   2265 /* <========================================> */
   2266 void Encode_CustomPCFItem(PS_CustomPCFItem x, PS_OutStream stream)
   2267 {
   2268     PutBoolean(0, stream); /* Extension Bit OFF */
   2269     PutInteger(1000, 1001, (uint32)x->clockConversionCode, stream);
   2270     PutInteger(1, 127, (uint32)x->clockDivisor, stream);
   2271     PutInteger(1, 2048, (uint32)x->customMPI, stream);
   2272     /* ------------------------------- */
   2273     /* ---- Extension Begins Here ---- */
   2274     /* ------------------------------- */
   2275 }
   2276 
   2277 /* <==============================================> */
   2278 /*  PER-Encoder for H263VideoModeCombos (SEQUENCE)  */
   2279 /* <==============================================> */
   2280 void Encode_H263VideoModeCombos(PS_H263VideoModeCombos x, PS_OutStream stream)
   2281 {
   2282     uint16 i;
   2283     PutBoolean(0, stream); /* Extension Bit OFF */
   2284     Encode_H263ModeComboFlags(&x->h263VideoUncoupledModes, stream);
   2285     PutInteger(1, 16, (uint32)x->size_of_h263VideoCoupledModes, stream);
   2286     for (i = 0; i < x->size_of_h263VideoCoupledModes; ++i)
   2287     {
   2288         Encode_H263ModeComboFlags(x->h263VideoCoupledModes + i, stream);
   2289     }
   2290     /* ------------------------------- */
   2291     /* ---- Extension Begins Here ---- */
   2292     /* ------------------------------- */
   2293 }
   2294 
   2295 /* <=============================================> */
   2296 /*  PER-Encoder for H263ModeComboFlags (SEQUENCE)  */
   2297 /* <=============================================> */
   2298 void Encode_H263ModeComboFlags(PS_H263ModeComboFlags x, PS_OutStream stream)
   2299 {
   2300     PutBoolean(0, stream); /* Extension Bit OFF */
   2301     PutBoolean(x->unrestrictedVector, stream);
   2302     PutBoolean(x->arithmeticCoding, stream);
   2303     PutBoolean(x->advancedPrediction, stream);
   2304     PutBoolean(x->pbFrames, stream);
   2305     PutBoolean(x->advancedIntraCodingMode, stream);
   2306     PutBoolean(x->deblockingFilterMode, stream);
   2307     PutBoolean(x->unlimitedMotionVectors, stream);
   2308     PutBoolean(x->slicesInOrder_NonRect, stream);
   2309     PutBoolean(x->slicesInOrder_Rect, stream);
   2310     PutBoolean(x->slicesNoOrder_NonRect, stream);
   2311     PutBoolean(x->slicesNoOrder_Rect, stream);
   2312     PutBoolean(x->improvedPBFramesMode, stream);
   2313     PutBoolean(x->referencePicSelect, stream);
   2314     PutBoolean(x->dynamicPictureResizingByFour, stream);
   2315     PutBoolean(x->dynamicPictureResizingSixteenthPel, stream);
   2316     PutBoolean(x->dynamicWarpingHalfPel, stream);
   2317     PutBoolean(x->dynamicWarpingSixteenthPel, stream);
   2318     PutBoolean(x->reducedResolutionUpdate, stream);
   2319     PutBoolean(x->independentSegmentDecoding, stream);
   2320     PutBoolean(x->alternateInterVLCMode, stream);
   2321     PutBoolean(x->modifiedQuantizationMode, stream);
   2322     /* ------------------------------- */
   2323     /* ---- Extension Begins Here ---- */
   2324     /* ------------------------------- */
   2325 }
   2326 
   2327 /* <=================================================> */
   2328 /*  PER-Encoder for IS11172VideoCapability (SEQUENCE)  */
   2329 /* <=================================================> */
   2330 void Encode_IS11172VideoCapability(PS_IS11172VideoCapability x, PS_OutStream stream)
   2331 {
   2332     PutBoolean(0, stream); /* Extension Bit OFF */
   2333     PutBoolean(x->option_of_videoBitRate, stream);
   2334     PutBoolean(x->option_of_vbvBufferSize, stream);
   2335     PutBoolean(x->option_of_samplesPerLine, stream);
   2336     PutBoolean(x->option_of_linesPerFrame, stream);
   2337     PutBoolean(x->option_of_pictureRate, stream);
   2338     PutBoolean(x->option_of_luminanceSampleRate, stream);
   2339     PutBoolean(x->constrainedBitstream, stream);
   2340     if (x->option_of_videoBitRate)
   2341     {
   2342         PutInteger(0, 1073741823, (uint32)x->videoBitRate, stream);
   2343     }
   2344     if (x->option_of_vbvBufferSize)
   2345     {
   2346         PutInteger(0, 262143, (uint32)x->vbvBufferSize, stream);
   2347     }
   2348     if (x->option_of_samplesPerLine)
   2349     {
   2350         PutInteger(0, 16383, (uint32)x->samplesPerLine, stream);
   2351     }
   2352     if (x->option_of_linesPerFrame)
   2353     {
   2354         PutInteger(0, 16383, (uint32)x->linesPerFrame, stream);
   2355     }
   2356     if (x->option_of_pictureRate)
   2357     {
   2358         PutInteger(0, 15, (uint32)x->pictureRate, stream);
   2359     }
   2360     if (x->option_of_luminanceSampleRate)
   2361     {
   2362         PutInteger(0, 0xffffffff, (uint32)x->luminanceSampleRate, stream);
   2363     }
   2364     /* ------------------------------- */
   2365     /* ---- Extension Begins Here ---- */
   2366     /* ------------------------------- */
   2367 }
   2368 
   2369 /* <========================================> */
   2370 /*  PER-Encoder for AudioCapability (CHOICE)  */
   2371 /* <========================================> */
   2372 void Encode_AudioCapability(PS_AudioCapability x, PS_OutStream stream)
   2373 {
   2374     PutChoiceIndex(14, 1, x->index, stream);
   2375     switch (x->index)
   2376     {
   2377         case 0:
   2378             Encode_NonStandardParameter(x->nonStandard, stream);
   2379             break;
   2380         case 1:
   2381             PutInteger(1, 256, (uint32)x->g711Alaw64k, stream);
   2382             break;
   2383         case 2:
   2384             PutInteger(1, 256, (uint32)x->g711Alaw56k, stream);
   2385             break;
   2386         case 3:
   2387             PutInteger(1, 256, (uint32)x->g711Ulaw64k, stream);
   2388             break;
   2389         case 4:
   2390             PutInteger(1, 256, (uint32)x->g711Ulaw56k, stream);
   2391             break;
   2392         case 5:
   2393             PutInteger(1, 256, (uint32)x->g722_64k, stream);
   2394             break;
   2395         case 6:
   2396             PutInteger(1, 256, (uint32)x->g722_56k, stream);
   2397             break;
   2398         case 7:
   2399             PutInteger(1, 256, (uint32)x->g722_48k, stream);
   2400             break;
   2401         case 8:
   2402             Encode_G7231(x->g7231, stream);
   2403             break;
   2404         case 9:
   2405             PutInteger(1, 256, (uint32)x->g728, stream);
   2406             break;
   2407         case 10:
   2408             PutInteger(1, 256, (uint32)x->g729, stream);
   2409             break;
   2410         case 11:
   2411             PutInteger(1, 256, (uint32)x->g729AnnexA, stream);
   2412             break;
   2413         case 12:
   2414             Encode_IS11172AudioCapability(x->is11172AudioCapability, stream);
   2415             break;
   2416         case 13:
   2417             Encode_IS13818AudioCapability(x->is13818AudioCapability, stream);
   2418             break;
   2419             /* ------------------------------- */
   2420             /* ---- Extension Begins Here ---- */
   2421             /* ------------------------------- */
   2422         case 14:
   2423             PutExtensionInteger(1, 256, (uint32)x->g729wAnnexB, stream);
   2424             break;
   2425         case 15:
   2426             PutExtensionInteger(1, 256, (uint32)x->g729AnnexAwAnnexB, stream);
   2427             break;
   2428         case 16:
   2429             PutExtensionItem(EPASS Encode_G7231AnnexCCapability, (uint8*)x->g7231AnnexCCapability, stream);
   2430             break;
   2431         case 17:
   2432             PutExtensionItem(EPASS Encode_GSMAudioCapability, (uint8*)x->gsmFullRate, stream);
   2433             break;
   2434         case 18:
   2435             PutExtensionItem(EPASS Encode_GSMAudioCapability, (uint8*)x->gsmHalfRate, stream);
   2436             break;
   2437         case 19:
   2438             PutExtensionItem(EPASS Encode_GSMAudioCapability, (uint8*)x->gsmEnhancedFullRate, stream);
   2439             break;
   2440         case 20:
   2441             PutExtensionItem(EPASS Encode_GenericCapability, (uint8*)x->genericAudioCapability, stream);
   2442             break;
   2443         case 21:
   2444             PutExtensionItem(EPASS Encode_G729Extensions, (uint8*)x->g729Extensions, stream);
   2445             break;
   2446         default:
   2447             ErrorMessageAndLeave("Encode_AudioCapability: Illegal CHOICE index");
   2448     }
   2449 }
   2450 
   2451 /* <================================> */
   2452 /*  PER-Encoder for G7231 (SEQUENCE)  */
   2453 /* <================================> */
   2454 void Encode_G7231(PS_G7231 x, PS_OutStream stream)
   2455 {
   2456     PutInteger(1, 256, (uint32)x->maxAl_sduAudioFrames, stream);
   2457     PutBoolean(x->silenceSuppression, stream);
   2458 }
   2459 
   2460 /* <=========================================> */
   2461 /*  PER-Encoder for G729Extensions (SEQUENCE)  */
   2462 /* <=========================================> */
   2463 void Encode_G729Extensions(PS_G729Extensions x, PS_OutStream stream)
   2464 {
   2465     PutBoolean(0, stream); /* Extension Bit OFF */
   2466     PutBoolean(x->option_of_audioUnit, stream);
   2467     if (x->option_of_audioUnit)
   2468     {
   2469         PutInteger(1, 256, (uint32)x->audioUnit, stream);
   2470     }
   2471     PutBoolean(x->annexA, stream);
   2472     PutBoolean(x->annexB, stream);
   2473     PutBoolean(x->annexD, stream);
   2474     PutBoolean(x->annexE, stream);
   2475     PutBoolean(x->annexF, stream);
   2476     PutBoolean(x->annexG, stream);
   2477     PutBoolean(x->annexH, stream);
   2478     /* ------------------------------- */
   2479     /* ---- Extension Begins Here ---- */
   2480     /* ------------------------------- */
   2481 }
   2482 
   2483 /* <================================================> */
   2484 /*  PER-Encoder for G7231AnnexCCapability (SEQUENCE)  */
   2485 /* <================================================> */
   2486 void Encode_G7231AnnexCCapability(PS_G7231AnnexCCapability x, PS_OutStream stream)
   2487 {
   2488     PutBoolean(0, stream); /* Extension Bit OFF */
   2489     PutBoolean(x->option_of_g723AnnexCAudioMode, stream);
   2490     PutInteger(1, 256, (uint32)x->maxAl_sduAudioFrames, stream);
   2491     PutBoolean(x->silenceSuppression, stream);
   2492     if (x->option_of_g723AnnexCAudioMode)
   2493     {
   2494         Encode_G723AnnexCAudioMode(&x->g723AnnexCAudioMode, stream);
   2495     }
   2496     /* ------------------------------- */
   2497     /* ---- Extension Begins Here ---- */
   2498     /* ------------------------------- */
   2499 }
   2500 
   2501 /* <==============================================> */
   2502 /*  PER-Encoder for G723AnnexCAudioMode (SEQUENCE)  */
   2503 /* <==============================================> */
   2504 void Encode_G723AnnexCAudioMode(PS_G723AnnexCAudioMode x, PS_OutStream stream)
   2505 {
   2506     PutBoolean(0, stream); /* Extension Bit OFF */
   2507     PutInteger(27, 78, (uint32)x->highRateMode0, stream);
   2508     PutInteger(27, 78, (uint32)x->highRateMode1, stream);
   2509     PutInteger(23, 66, (uint32)x->lowRateMode0, stream);
   2510     PutInteger(23, 66, (uint32)x->lowRateMode1, stream);
   2511     PutInteger(6, 17, (uint32)x->sidMode0, stream);
   2512     PutInteger(6, 17, (uint32)x->sidMode1, stream);
   2513     /* ------------------------------- */
   2514     /* ---- Extension Begins Here ---- */
   2515     /* ------------------------------- */
   2516 }
   2517 
   2518 /* <=================================================> */
   2519 /*  PER-Encoder for IS11172AudioCapability (SEQUENCE)  */
   2520 /* <=================================================> */
   2521 void Encode_IS11172AudioCapability(PS_IS11172AudioCapability x, PS_OutStream stream)
   2522 {
   2523     PutBoolean(0, stream); /* Extension Bit OFF */
   2524     PutBoolean(x->audioLayer1, stream);
   2525     PutBoolean(x->audioLayer2, stream);
   2526     PutBoolean(x->audioLayer3, stream);
   2527     PutBoolean(x->audioSampling32k, stream);
   2528     PutBoolean(x->audioSampling44k1, stream);
   2529     PutBoolean(x->audioSampling48k, stream);
   2530     PutBoolean(x->singleChannel, stream);
   2531     PutBoolean(x->twoChannels, stream);
   2532     PutInteger(1, 448, (uint32)x->bitRate, stream);
   2533     /* ------------------------------- */
   2534     /* ---- Extension Begins Here ---- */
   2535     /* ------------------------------- */
   2536 }
   2537 
   2538 /* <=================================================> */
   2539 /*  PER-Encoder for IS13818AudioCapability (SEQUENCE)  */
   2540 /* <=================================================> */
   2541 void Encode_IS13818AudioCapability(PS_IS13818AudioCapability x, PS_OutStream stream)
   2542 {
   2543     PutBoolean(0, stream); /* Extension Bit OFF */
   2544     PutBoolean(x->audioLayer1, stream);
   2545     PutBoolean(x->audioLayer2, stream);
   2546     PutBoolean(x->audioLayer3, stream);
   2547     PutBoolean(x->audioSampling16k, stream);
   2548     PutBoolean(x->audioSampling22k05, stream);
   2549     PutBoolean(x->audioSampling24k, stream);
   2550     PutBoolean(x->audioSampling32k, stream);
   2551     PutBoolean(x->audioSampling44k1, stream);
   2552     PutBoolean(x->audioSampling48k, stream);
   2553     PutBoolean(x->singleChannel, stream);
   2554     PutBoolean(x->twoChannels, stream);
   2555     PutBoolean(x->threeChannels2_1, stream);
   2556     PutBoolean(x->threeChannels3_0, stream);
   2557     PutBoolean(x->fourChannels2_0_2_0, stream);
   2558     PutBoolean(x->fourChannels2_2, stream);
   2559     PutBoolean(x->fourChannels3_1, stream);
   2560     PutBoolean(x->fiveChannels3_0_2_0, stream);
   2561     PutBoolean(x->fiveChannels3_2, stream);
   2562     PutBoolean(x->lowFrequencyEnhancement, stream);
   2563     PutBoolean(x->multilingual, stream);
   2564     PutInteger(1, 1130, (uint32)x->bitRate, stream);
   2565     /* ------------------------------- */
   2566     /* ---- Extension Begins Here ---- */
   2567     /* ------------------------------- */
   2568 }
   2569 
   2570 /* <=============================================> */
   2571 /*  PER-Encoder for GSMAudioCapability (SEQUENCE)  */
   2572 /* <=============================================> */
   2573 void Encode_GSMAudioCapability(PS_GSMAudioCapability x, PS_OutStream stream)
   2574 {
   2575     PutBoolean(0, stream); /* Extension Bit OFF */
   2576     PutInteger(1, 256, (uint32)x->audioUnitSize, stream);
   2577     PutBoolean(x->comfortNoise, stream);
   2578     PutBoolean(x->scrambled, stream);
   2579     /* ------------------------------- */
   2580     /* ---- Extension Begins Here ---- */
   2581     /* ------------------------------- */
   2582 }
   2583 
   2584 /* <====================================================> */
   2585 /*  PER-Encoder for DataApplicationCapability (SEQUENCE)  */
   2586 /* <====================================================> */
   2587 void Encode_DataApplicationCapability(PS_DataApplicationCapability x, PS_OutStream stream)
   2588 {
   2589     PutBoolean(0, stream); /* Extension Bit OFF */
   2590     Encode_Application(&x->application, stream);
   2591     PutInteger(0, 0xffffffff, (uint32)x->maxBitRate, stream);
   2592     /* ------------------------------- */
   2593     /* ---- Extension Begins Here ---- */
   2594     /* ------------------------------- */
   2595 }
   2596 
   2597 /* <====================================> */
   2598 /*  PER-Encoder for Application (CHOICE)  */
   2599 /* <====================================> */
   2600 void Encode_Application(PS_Application x, PS_OutStream stream)
   2601 {
   2602     PutChoiceIndex(10, 1, x->index, stream);
   2603     switch (x->index)
   2604     {
   2605         case 0:
   2606             Encode_NonStandardParameter(x->nonStandard, stream);
   2607             break;
   2608         case 1:
   2609             Encode_DataProtocolCapability(x->t120, stream);
   2610             break;
   2611         case 2:
   2612             Encode_DataProtocolCapability(x->dsm_cc, stream);
   2613             break;
   2614         case 3:
   2615             Encode_DataProtocolCapability(x->userData, stream);
   2616             break;
   2617         case 4:
   2618             Encode_T84(x->t84, stream);
   2619             break;
   2620         case 5:
   2621             Encode_DataProtocolCapability(x->t434, stream);
   2622             break;
   2623         case 6:
   2624             Encode_DataProtocolCapability(x->h224, stream);
   2625             break;
   2626         case 7:
   2627             Encode_Nlpid(x->nlpid, stream);
   2628             break;
   2629         case 8:
   2630             /* (dsvdControl is NULL) */
   2631             break;
   2632         case 9:
   2633             Encode_DataProtocolCapability(x->h222DataPartitioning, stream);
   2634             break;
   2635             /* ------------------------------- */
   2636             /* ---- Extension Begins Here ---- */
   2637             /* ------------------------------- */
   2638         case 10:
   2639             PutExtensionItem(EPASS Encode_DataProtocolCapability, (uint8*)x->t30fax, stream);
   2640             break;
   2641         case 11:
   2642             PutExtensionItem(EPASS Encode_DataProtocolCapability, (uint8*)x->t140, stream);
   2643             break;
   2644         case 12:
   2645             PutExtensionItem(EPASS Encode_T38fax, (uint8*)x->t38fax, stream);
   2646             break;
   2647         case 13:
   2648             PutExtensionItem(EPASS Encode_GenericCapability, (uint8*)x->genericDataCapability, stream);
   2649             break;
   2650         default:
   2651             ErrorMessageAndLeave("Encode_Application: Illegal CHOICE index");
   2652     }
   2653 }
   2654 
   2655 /* <=================================> */
   2656 /*  PER-Encoder for T38fax (SEQUENCE)  */
   2657 /* <=================================> */
   2658 void Encode_T38fax(PS_T38fax x, PS_OutStream stream)
   2659 {
   2660     Encode_DataProtocolCapability(&x->t38FaxProtocol, stream);
   2661     Encode_T38FaxProfile(&x->t38FaxProfile, stream);
   2662 }
   2663 
   2664 /* <================================> */
   2665 /*  PER-Encoder for Nlpid (SEQUENCE)  */
   2666 /* <================================> */
   2667 void Encode_Nlpid(PS_Nlpid x, PS_OutStream stream)
   2668 {
   2669     Encode_DataProtocolCapability(&x->nlpidProtocol, stream);
   2670     PutOctetString(1, 0, 0, &x->nlpidData, stream);
   2671 }
   2672 
   2673 /* <==============================> */
   2674 /*  PER-Encoder for T84 (SEQUENCE)  */
   2675 /* <==============================> */
   2676 void Encode_T84(PS_T84 x, PS_OutStream stream)
   2677 {
   2678     Encode_DataProtocolCapability(&x->t84Protocol, stream);
   2679     Encode_T84Profile(&x->t84Profile, stream);
   2680 }
   2681 
   2682 /* <===============================================> */
   2683 /*  PER-Encoder for DataProtocolCapability (CHOICE)  */
   2684 /* <===============================================> */
   2685 void Encode_DataProtocolCapability(PS_DataProtocolCapability x, PS_OutStream stream)
   2686 {
   2687     PutChoiceIndex(7, 1, x->index, stream);
   2688     switch (x->index)
   2689     {
   2690         case 0:
   2691             Encode_NonStandardParameter(x->nonStandard, stream);
   2692             break;
   2693         case 1:
   2694             /* (v14buffered is NULL) */
   2695             break;
   2696         case 2:
   2697             /* (v42lapm is NULL) */
   2698             break;
   2699         case 3:
   2700             /* (hdlcFrameTunnelling is NULL) */
   2701             break;
   2702         case 4:
   2703             /* (h310SeparateVCStack is NULL) */
   2704             break;
   2705         case 5:
   2706             /* (h310SingleVCStack is NULL) */
   2707             break;
   2708         case 6:
   2709             /* (transparent is NULL) */
   2710             break;
   2711             /* ------------------------------- */
   2712             /* ---- Extension Begins Here ---- */
   2713             /* ------------------------------- */
   2714         case 7:
   2715             PutExtensionNull(stream);
   2716             break;
   2717         case 8:
   2718             PutExtensionNull(stream);
   2719             break;
   2720         case 9:
   2721             PutExtensionNull(stream);
   2722             break;
   2723         case 10:
   2724             PutExtensionNull(stream);
   2725             break;
   2726         case 11:
   2727             PutExtensionItem(EPASS Encode_V76wCompression, (uint8*)x->v76wCompression, stream);
   2728             break;
   2729         case 12:
   2730             PutExtensionNull(stream);
   2731             break;
   2732         case 13:
   2733             PutExtensionNull(stream);
   2734             break;
   2735         default:
   2736             ErrorMessageAndLeave("Encode_DataProtocolCapability: Illegal CHOICE index");
   2737     }
   2738 }
   2739 
   2740 /* <========================================> */
   2741 /*  PER-Encoder for V76wCompression (CHOICE)  */
   2742 /* <========================================> */
   2743 void Encode_V76wCompression(PS_V76wCompression x, PS_OutStream stream)
   2744 {
   2745     PutChoiceIndex(3, 1, x->index, stream);
   2746     switch (x->index)
   2747     {
   2748         case 0:
   2749             Encode_CompressionType(x->transmitCompression, stream);
   2750             break;
   2751         case 1:
   2752             Encode_CompressionType(x->receiveCompression, stream);
   2753             break;
   2754         case 2:
   2755             Encode_CompressionType(x->transmitAndReceiveCompression, stream);
   2756             break;
   2757             /* ------------------------------- */
   2758             /* ---- Extension Begins Here ---- */
   2759             /* ------------------------------- */
   2760         default:
   2761             ErrorMessageAndLeave("Encode_V76wCompression: Illegal CHOICE index");
   2762     }
   2763 }
   2764 
   2765 /* <========================================> */
   2766 /*  PER-Encoder for CompressionType (CHOICE)  */
   2767 /* <========================================> */
   2768 void Encode_CompressionType(PS_CompressionType x, PS_OutStream stream)
   2769 {
   2770     PutChoiceIndex(1, 1, x->index, stream);
   2771     switch (x->index)
   2772     {
   2773         case 0:
   2774             Encode_V42bis(x->v42bis, stream);
   2775             break;
   2776             /* ------------------------------- */
   2777             /* ---- Extension Begins Here ---- */
   2778             /* ------------------------------- */
   2779         default:
   2780             ErrorMessageAndLeave("Encode_CompressionType: Illegal CHOICE index");
   2781     }
   2782 }
   2783 
   2784 /* <=================================> */
   2785 /*  PER-Encoder for V42bis (SEQUENCE)  */
   2786 /* <=================================> */
   2787 void Encode_V42bis(PS_V42bis x, PS_OutStream stream)
   2788 {
   2789     PutBoolean(0, stream); /* Extension Bit OFF */
   2790     PutInteger(1, 65536, (uint32)x->numberOfCodewords, stream);
   2791     PutInteger(1, 256, (uint32)x->maximumStringLength, stream);
   2792     /* ------------------------------- */
   2793     /* ---- Extension Begins Here ---- */
   2794     /* ------------------------------- */
   2795 }
   2796 
   2797 /* <===================================> */
   2798 /*  PER-Encoder for T84Profile (CHOICE)  */
   2799 /* <===================================> */
   2800 void Encode_T84Profile(PS_T84Profile x, PS_OutStream stream)
   2801 {
   2802     PutChoiceIndex(2, 0, x->index, stream);
   2803     switch (x->index)
   2804     {
   2805         case 0:
   2806             /* (t84Unrestricted is NULL) */
   2807             break;
   2808         case 1:
   2809             Encode_T84Restricted(x->t84Restricted, stream);
   2810             break;
   2811         default:
   2812             ErrorMessageAndLeave("Encode_T84Profile: Illegal CHOICE index");
   2813     }
   2814 }
   2815 
   2816 /* <========================================> */
   2817 /*  PER-Encoder for T84Restricted (SEQUENCE)  */
   2818 /* <========================================> */
   2819 void Encode_T84Restricted(PS_T84Restricted x, PS_OutStream stream)
   2820 {
   2821     PutBoolean(0, stream); /* Extension Bit OFF */
   2822     PutBoolean(x->qcif, stream);
   2823     PutBoolean(x->cif, stream);
   2824     PutBoolean(x->ccir601Seq, stream);
   2825     PutBoolean(x->ccir601Prog, stream);
   2826     PutBoolean(x->hdtvSeq, stream);
   2827     PutBoolean(x->hdtvProg, stream);
   2828     PutBoolean(x->g3FacsMH200x100, stream);
   2829     PutBoolean(x->g3FacsMH200x200, stream);
   2830     PutBoolean(x->g4FacsMMR200x100, stream);
   2831     PutBoolean(x->g4FacsMMR200x200, stream);
   2832     PutBoolean(x->jbig200x200Seq, stream);
   2833     PutBoolean(x->jbig200x200Prog, stream);
   2834     PutBoolean(x->jbig300x300Seq, stream);
   2835     PutBoolean(x->jbig300x300Prog, stream);
   2836     PutBoolean(x->digPhotoLow, stream);
   2837     PutBoolean(x->digPhotoMedSeq, stream);
   2838     PutBoolean(x->digPhotoMedProg, stream);
   2839     PutBoolean(x->digPhotoHighSeq, stream);
   2840     PutBoolean(x->digPhotoHighProg, stream);
   2841     /* ------------------------------- */
   2842     /* ---- Extension Begins Here ---- */
   2843     /* ------------------------------- */
   2844 }
   2845 
   2846 /* <========================================> */
   2847 /*  PER-Encoder for T38FaxProfile (SEQUENCE)  */
   2848 /* <========================================> */
   2849 void Encode_T38FaxProfile(PS_T38FaxProfile x, PS_OutStream stream)
   2850 {
   2851     uint32 extension;
   2852 
   2853     extension = x->option_of_version |
   2854                 x->option_of_t38FaxRateManagement |
   2855                 x->option_of_t38FaxUdpOptions;
   2856     PutBoolean(extension, stream);
   2857 
   2858     PutBoolean(x->fillBitRemoval, stream);
   2859     PutBoolean(x->transcodingJBIG, stream);
   2860     PutBoolean(x->transcodingMMR, stream);
   2861     /* ------------------------------- */
   2862     /* ---- Extension Begins Here ---- */
   2863     /* ------------------------------- */
   2864     if (!extension) return; /* (No items present?) */
   2865     PutNormSmallLength(3, stream); /* Begin Options Map */
   2866     PutBoolean(x->option_of_version, stream);
   2867     PutBoolean(x->option_of_t38FaxRateManagement, stream);
   2868     PutBoolean(x->option_of_t38FaxUdpOptions, stream);
   2869     if (x->option_of_version)
   2870     {
   2871         PutExtensionInteger(0, 255, (uint32)x->version, stream);
   2872     }
   2873     if (x->option_of_t38FaxRateManagement)
   2874     {
   2875         PutExtensionItem(EPASS Encode_T38FaxRateManagement, (uint8*)&x->t38FaxRateManagement, stream);
   2876     }
   2877     if (x->option_of_t38FaxUdpOptions)
   2878     {
   2879         PutExtensionItem(EPASS Encode_T38FaxUdpOptions, (uint8*)&x->t38FaxUdpOptions, stream);
   2880     }
   2881 }
   2882 
   2883 /* <=============================================> */
   2884 /*  PER-Encoder for T38FaxRateManagement (CHOICE)  */
   2885 /* <=============================================> */
   2886 void Encode_T38FaxRateManagement(PS_T38FaxRateManagement x, PS_OutStream stream)
   2887 {
   2888     PutChoiceIndex(2, 1, x->index, stream);
   2889     switch (x->index)
   2890     {
   2891         case 0:
   2892             /* (localTCF is NULL) */
   2893             break;
   2894         case 1:
   2895             /* (transferredTCF is NULL) */
   2896             break;
   2897             /* ------------------------------- */
   2898             /* ---- Extension Begins Here ---- */
   2899             /* ------------------------------- */
   2900         default:
   2901             ErrorMessageAndLeave("Encode_T38FaxRateManagement: Illegal CHOICE index");
   2902     }
   2903 }
   2904 
   2905 /* <===========================================> */
   2906 /*  PER-Encoder for T38FaxUdpOptions (SEQUENCE)  */
   2907 /* <===========================================> */
   2908 void Encode_T38FaxUdpOptions(PS_T38FaxUdpOptions x, PS_OutStream stream)
   2909 {
   2910     PutBoolean(x->option_of_t38FaxMaxBuffer, stream);
   2911     PutBoolean(x->option_of_t38FaxMaxDatagram, stream);
   2912     if (x->option_of_t38FaxMaxBuffer)
   2913     {
   2914         PutUnboundedInteger((uint32)x->t38FaxMaxBuffer, stream);
   2915     }
   2916     if (x->option_of_t38FaxMaxDatagram)
   2917     {
   2918         PutUnboundedInteger((uint32)x->t38FaxMaxDatagram, stream);
   2919     }
   2920     Encode_T38FaxUdpEC(&x->t38FaxUdpEC, stream);
   2921 }
   2922 
   2923 /* <====================================> */
   2924 /*  PER-Encoder for T38FaxUdpEC (CHOICE)  */
   2925 /* <====================================> */
   2926 void Encode_T38FaxUdpEC(PS_T38FaxUdpEC x, PS_OutStream stream)
   2927 {
   2928     PutChoiceIndex(2, 1, x->index, stream);
   2929     switch (x->index)
   2930     {
   2931         case 0:
   2932             /* (t38UDPFEC is NULL) */
   2933             break;
   2934         case 1:
   2935             /* (t38UDPRedundancy is NULL) */
   2936             break;
   2937             /* ------------------------------- */
   2938             /* ---- Extension Begins Here ---- */
   2939             /* ------------------------------- */
   2940         default:
   2941             ErrorMessageAndLeave("Encode_T38FaxUdpEC: Illegal CHOICE index");
   2942     }
   2943 }
   2944 
   2945 /* <===============================================================> */
   2946 /*  PER-Encoder for EncryptionAuthenticationAndIntegrity (SEQUENCE)  */
   2947 /* <===============================================================> */
   2948 void Encode_EncryptionAuthenticationAndIntegrity(PS_EncryptionAuthenticationAndIntegrity x, PS_OutStream stream)
   2949 {
   2950     PutBoolean(0, stream); /* Extension Bit OFF */
   2951     PutBoolean(x->option_of_encryptionCapability, stream);
   2952     PutBoolean(x->option_of_authenticationCapability, stream);
   2953     PutBoolean(x->option_of_integrityCapability, stream);
   2954     if (x->option_of_encryptionCapability)
   2955     {
   2956         Encode_EncryptionCapability(&x->encryptionCapability, stream);
   2957     }
   2958     if (x->option_of_authenticationCapability)
   2959     {
   2960         Encode_AuthenticationCapability(&x->authenticationCapability, stream);
   2961     }
   2962     if (x->option_of_integrityCapability)
   2963     {
   2964         Encode_IntegrityCapability(&x->integrityCapability, stream);
   2965     }
   2966     /* ------------------------------- */
   2967     /* ---- Extension Begins Here ---- */
   2968     /* ------------------------------- */
   2969 }
   2970 
   2971 /* <==================================================> */
   2972 /*  PER-Encoder for EncryptionCapability (SEQUENCE-OF)  */
   2973 /* <==================================================> */
   2974 void Encode_EncryptionCapability(PS_EncryptionCapability x, PS_OutStream stream)
   2975 {
   2976     uint16 i;
   2977     PutInteger(1, 256, (uint32)x->size, stream);
   2978     for (i = 0; i < x->size; ++i)
   2979     {
   2980         Encode_MediaEncryptionAlgorithm(x->item + i, stream);
   2981     }
   2982 }
   2983 
   2984 /* <=================================================> */
   2985 /*  PER-Encoder for MediaEncryptionAlgorithm (CHOICE)  */
   2986 /* <=================================================> */
   2987 void Encode_MediaEncryptionAlgorithm(PS_MediaEncryptionAlgorithm x, PS_OutStream stream)
   2988 {
   2989     PutChoiceIndex(2, 1, x->index, stream);
   2990     switch (x->index)
   2991     {
   2992         case 0:
   2993             Encode_NonStandardParameter(x->nonStandard, stream);
   2994             break;
   2995         case 1:
   2996             PutObjectID(x->algorithm, stream);
   2997             break;
   2998             /* ------------------------------- */
   2999             /* ---- Extension Begins Here ---- */
   3000             /* ------------------------------- */
   3001         default:
   3002             ErrorMessageAndLeave("Encode_MediaEncryptionAlgorithm: Illegal CHOICE index");
   3003     }
   3004 }
   3005 
   3006 /* <===================================================> */
   3007 /*  PER-Encoder for AuthenticationCapability (SEQUENCE)  */
   3008 /* <===================================================> */
   3009 void Encode_AuthenticationCapability(PS_AuthenticationCapability x, PS_OutStream stream)
   3010 {
   3011     PutBoolean(0, stream); /* Extension Bit OFF */
   3012     PutBoolean(x->option_of_nonStandard, stream);
   3013     if (x->option_of_nonStandard)
   3014     {
   3015         Encode_NonStandardParameter(&x->nonStandard, stream);
   3016     }
   3017     /* ------------------------------- */
   3018     /* ---- Extension Begins Here ---- */
   3019     /* ------------------------------- */
   3020 }
   3021 
   3022 /* <==============================================> */
   3023 /*  PER-Encoder for IntegrityCapability (SEQUENCE)  */
   3024 /* <==============================================> */
   3025 void Encode_IntegrityCapability(PS_IntegrityCapability x, PS_OutStream stream)
   3026 {
   3027     PutBoolean(0, stream); /* Extension Bit OFF */
   3028     PutBoolean(x->option_of_nonStandard, stream);
   3029     if (x->option_of_nonStandard)
   3030     {
   3031         Encode_NonStandardParameter(&x->nonStandard, stream);
   3032     }
   3033     /* ------------------------------- */
   3034     /* ---- Extension Begins Here ---- */
   3035     /* ------------------------------- */
   3036 }
   3037 
   3038 /* <============================================> */
   3039 /*  PER-Encoder for UserInputCapability (CHOICE)  */
   3040 /* <============================================> */
   3041 void Encode_UserInputCapability(PS_UserInputCapability x, PS_OutStream stream)
   3042 {
   3043     uint16 i;
   3044     PutChoiceIndex(6, 1, x->index, stream);
   3045     switch (x->index)
   3046     {
   3047         case 0:
   3048             PutInteger(1, 16, (uint32)x->size, stream);
   3049             for (i = 0; i < x->size; ++i)
   3050             {
   3051                 Encode_NonStandardParameter(x->nonStandard + i, stream);
   3052             }
   3053             break;
   3054         case 1:
   3055             /* (basicString is NULL) */
   3056             break;
   3057         case 2:
   3058             /* (iA5String is NULL) */
   3059             break;
   3060         case 3:
   3061             /* (generalString is NULL) */
   3062             break;
   3063         case 4:
   3064             /* (dtmf is NULL) */
   3065             break;
   3066         case 5:
   3067             /* (hookflash is NULL) */
   3068             break;
   3069             /* ------------------------------- */
   3070             /* ---- Extension Begins Here ---- */
   3071             /* ------------------------------- */
   3072         default:
   3073             ErrorMessageAndLeave("Encode_UserInputCapability: Illegal CHOICE index");
   3074     }
   3075 }
   3076 
   3077 /* <===============================================> */
   3078 /*  PER-Encoder for ConferenceCapability (SEQUENCE)  */
   3079 /* <===============================================> */
   3080 void Encode_ConferenceCapability(PS_ConferenceCapability x, PS_OutStream stream)
   3081 {
   3082     uint16 i;
   3083     uint32 extension;
   3084 
   3085     extension = x->option_of_VideoIndicateMixingCapability |
   3086                 x->option_of_multipointVisualizationCapability;
   3087     PutBoolean(extension, stream);
   3088 
   3089     PutBoolean(x->option_of_nonStandardData, stream);
   3090     if (x->option_of_nonStandardData)
   3091     {
   3092         PutLengthDet(x->size_of_nonStandardData, stream);
   3093         for (i = 0; i < x->size_of_nonStandardData; ++i)
   3094         {
   3095             Encode_NonStandardParameter(x->nonStandardData + i, stream);
   3096         }
   3097     }
   3098     PutBoolean(x->chairControlCapability, stream);
   3099     /* ------------------------------- */
   3100     /* ---- Extension Begins Here ---- */
   3101     /* ------------------------------- */
   3102     if (!extension) return; /* (No items present?) */
   3103     PutNormSmallLength(2, stream); /* Begin Options Map */
   3104     PutBoolean(x->option_of_VideoIndicateMixingCapability, stream);
   3105     PutBoolean(x->option_of_multipointVisualizationCapability, stream);
   3106     if (x->option_of_VideoIndicateMixingCapability)
   3107     {
   3108         PutExtensionBoolean(x->VideoIndicateMixingCapability, stream);
   3109     }
   3110     if (x->option_of_multipointVisualizationCapability)
   3111     {
   3112         PutExtensionBoolean(x->multipointVisualizationCapability, stream);
   3113     }
   3114 }
   3115 
   3116 /* <============================================> */
   3117 /*  PER-Encoder for GenericCapability (SEQUENCE)  */
   3118 /* <============================================> */
   3119 void Encode_GenericCapability(PS_GenericCapability x, PS_OutStream stream)
   3120 {
   3121     uint16 i;
   3122     PutBoolean(0, stream); /* Extension Bit OFF */
   3123     PutBoolean(x->option_of_maxBitRate, stream);
   3124     PutBoolean(x->option_of_collapsing, stream);
   3125     PutBoolean(x->option_of_nonCollapsing, stream);
   3126     PutBoolean(x->option_of_nonCollapsingRaw, stream);
   3127     PutBoolean(x->option_of_transport, stream);
   3128     Encode_CapabilityIdentifier(&x->capabilityIdentifier, stream);
   3129     if (x->option_of_maxBitRate)
   3130     {
   3131         PutInteger(0, 0xffffffff, (uint32)x->maxBitRate, stream);
   3132     }
   3133     if (x->option_of_collapsing)
   3134     {
   3135         PutLengthDet(x->size_of_collapsing, stream);
   3136         for (i = 0; i < x->size_of_collapsing; ++i)
   3137         {
   3138             Encode_GenericParameter(x->collapsing + i, stream);
   3139         }
   3140     }
   3141     if (x->option_of_nonCollapsing)
   3142     {
   3143         PutLengthDet(x->size_of_nonCollapsing, stream);
   3144         for (i = 0; i < x->size_of_nonCollapsing; ++i)
   3145         {
   3146             Encode_GenericParameter(x->nonCollapsing + i, stream);
   3147         }
   3148     }
   3149     if (x->option_of_nonCollapsingRaw)
   3150     {
   3151         PutOctetString(1, 0, 0, &x->nonCollapsingRaw, stream);
   3152     }
   3153     if (x->option_of_transport)
   3154     {
   3155         Encode_DataProtocolCapability(&x->transport, stream);
   3156     }
   3157     /* ------------------------------- */
   3158     /* ---- Extension Begins Here ---- */
   3159     /* ------------------------------- */
   3160 }
   3161 
   3162 /* <=============================================> */
   3163 /*  PER-Encoder for CapabilityIdentifier (CHOICE)  */
   3164 /* <=============================================> */
   3165 void Encode_CapabilityIdentifier(PS_CapabilityIdentifier x, PS_OutStream stream)
   3166 {
   3167     PutChoiceIndex(4, 1, x->index, stream);
   3168     switch (x->index)
   3169     {
   3170         case 0:
   3171             PutObjectID(x->standard, stream);
   3172             break;
   3173         case 1:
   3174             Encode_NonStandardParameter(x->h221NonStandard, stream);
   3175             break;
   3176         case 2:
   3177             PutOctetString(0, 16, 16, x->uuid, stream);
   3178             break;
   3179         case 3:
   3180             PutCharString("IA5String", 0, 1, 64, NULL, x->domainBased, stream);
   3181             break;
   3182             /* ------------------------------- */
   3183             /* ---- Extension Begins Here ---- */
   3184             /* ------------------------------- */
   3185         default:
   3186             ErrorMessageAndLeave("Encode_CapabilityIdentifier: Illegal CHOICE index");
   3187     }
   3188 }
   3189 
   3190 /* <===========================================> */
   3191 /*  PER-Encoder for GenericParameter (SEQUENCE)  */
   3192 /* <===========================================> */
   3193 void Encode_GenericParameter(PS_GenericParameter x, PS_OutStream stream)
   3194 {
   3195     uint16 i;
   3196     PutBoolean(0, stream); /* Extension Bit OFF */
   3197     PutBoolean(x->option_of_supersedes, stream);
   3198     Encode_ParameterIdentifier(&x->parameterIdentifier, stream);
   3199     Encode_ParameterValue(&x->parameterValue, stream);
   3200     if (x->option_of_supersedes)
   3201     {
   3202         PutLengthDet(x->size_of_supersedes, stream);
   3203         for (i = 0; i < x->size_of_supersedes; ++i)
   3204         {
   3205             Encode_ParameterIdentifier(x->supersedes + i, stream);
   3206         }
   3207     }
   3208     /* ------------------------------- */
   3209     /* ---- Extension Begins Here ---- */
   3210     /* ------------------------------- */
   3211 }
   3212 
   3213 /* <============================================> */
   3214 /*  PER-Encoder for ParameterIdentifier (CHOICE)  */
   3215 /* <============================================> */
   3216 void Encode_ParameterIdentifier(PS_ParameterIdentifier x, PS_OutStream stream)
   3217 {
   3218     PutChoiceIndex(4, 1, x->index, stream);
   3219     switch (x->index)
   3220     {
   3221         case 0:
   3222             PutInteger(0, 127, (uint32)x->standard, stream);
   3223             break;
   3224         case 1:
   3225             Encode_NonStandardParameter(x->h221NonStandard, stream);
   3226             break;
   3227         case 2:
   3228             PutOctetString(0, 16, 16, x->uuid, stream);
   3229             break;
   3230         case 3:
   3231             PutCharString("IA5String", 0, 1, 64, NULL, x->domainBased, stream);
   3232             break;
   3233             /* ------------------------------- */
   3234             /* ---- Extension Begins Here ---- */
   3235             /* ------------------------------- */
   3236         default:
   3237             ErrorMessageAndLeave("Encode_ParameterIdentifier: Illegal CHOICE index");
   3238     }
   3239 }
   3240 
   3241 /* <=======================================> */
   3242 /*  PER-Encoder for ParameterValue (CHOICE)  */
   3243 /* <=======================================> */
   3244 void Encode_ParameterValue(PS_ParameterValue x, PS_OutStream stream)
   3245 {
   3246     uint16 i;
   3247     PutChoiceIndex(8, 1, x->index, stream);
   3248     switch (x->index)
   3249     {
   3250         case 0:
   3251             /* (logical is NULL) */
   3252             break;
   3253         case 1:
   3254             PutInteger(0, 255, (uint32)x->booleanArray, stream);
   3255             break;
   3256         case 2:
   3257             PutInteger(0, 65535, (uint32)x->unsignedMin, stream);
   3258             break;
   3259         case 3:
   3260             PutInteger(0, 65535, (uint32)x->unsignedMax, stream);
   3261             break;
   3262         case 4:
   3263             PutInteger(0, 0xffffffff, (uint32)x->unsigned32Min, stream);
   3264             break;
   3265         case 5:
   3266             PutInteger(0, 0xffffffff, (uint32)x->unsigned32Max, stream);
   3267             break;
   3268         case 6:
   3269             PutOctetString(1, 0, 0, x->octetString, stream);
   3270             break;
   3271         case 7:
   3272             PutLengthDet(x->size, stream);
   3273             for (i = 0; i < x->size; ++i)
   3274             {
   3275                 Encode_GenericParameter(x->genericParameter + i, stream);
   3276             }
   3277             break;
   3278             /* ------------------------------- */
   3279             /* ---- Extension Begins Here ---- */
   3280             /* ------------------------------- */
   3281         default:
   3282             ErrorMessageAndLeave("Encode_ParameterValue: Illegal CHOICE index");
   3283     }
   3284 }
   3285 
   3286 /* <=============================================> */
   3287 /*  PER-Encoder for OpenLogicalChannel (SEQUENCE)  */
   3288 /* <=============================================> */
   3289 void Encode_OpenLogicalChannel(PS_OpenLogicalChannel x, PS_OutStream stream)
   3290 {
   3291     uint32 extension;
   3292 
   3293     extension = x->option_of_separateStack |
   3294                 x->option_of_encryptionSync;
   3295     PutBoolean(extension, stream);
   3296 
   3297     PutBoolean(x->option_of_reverseLogicalChannelParameters, stream);
   3298     PutInteger(1, 65535, (uint32)x->forwardLogicalChannelNumber, stream);
   3299     Encode_ForwardLogicalChannelParameters(&x->forwardLogicalChannelParameters, stream);
   3300     if (x->option_of_reverseLogicalChannelParameters)
   3301     {
   3302         Encode_ReverseLogicalChannelParameters(&x->reverseLogicalChannelParameters, stream);
   3303     }
   3304     /* ------------------------------- */
   3305     /* ---- Extension Begins Here ---- */
   3306     /* ------------------------------- */
   3307     if (!extension) return; /* (No items present?) */
   3308     PutNormSmallLength(2, stream); /* Begin Options Map */
   3309     PutBoolean(x->option_of_separateStack, stream);
   3310     PutBoolean(x->option_of_encryptionSync, stream);
   3311     if (x->option_of_separateStack)
   3312     {
   3313         PutExtensionItem(EPASS Encode_NetworkAccessParameters, (uint8*)&x->separateStack, stream);
   3314     }
   3315     if (x->option_of_encryptionSync)
   3316     {
   3317         PutExtensionItem(EPASS Encode_EncryptionSync, (uint8*)&x->encryptionSync, stream);
   3318     }
   3319 }
   3320 
   3321 /* <==========================================================> */
   3322 /*  PER-Encoder for ReverseLogicalChannelParameters (SEQUENCE)  */
   3323 /* <==========================================================> */
   3324 void Encode_ReverseLogicalChannelParameters(PS_ReverseLogicalChannelParameters x, PS_OutStream stream)
   3325 {
   3326     uint32 extension;
   3327 
   3328     extension = x->option_of_reverseLogicalChannelDependency |
   3329                 x->option_of_replacementFor;
   3330     PutBoolean(extension, stream);
   3331 
   3332     PutBoolean(x->option_of_rlcMultiplexParameters, stream);
   3333     Encode_DataType(&x->dataType, stream);
   3334     if (x->option_of_rlcMultiplexParameters)
   3335     {
   3336         Encode_RlcMultiplexParameters(&x->rlcMultiplexParameters, stream);
   3337     }
   3338     /* ------------------------------- */
   3339     /* ---- Extension Begins Here ---- */
   3340     /* ------------------------------- */
   3341     if (!extension) return; /* (No items present?) */
   3342     PutNormSmallLength(2, stream); /* Begin Options Map */
   3343     PutBoolean(x->option_of_reverseLogicalChannelDependency, stream);
   3344     PutBoolean(x->option_of_replacementFor, stream);
   3345     if (x->option_of_reverseLogicalChannelDependency)
   3346     {
   3347         PutExtensionInteger(1, 65535, (uint32)x->reverseLogicalChannelDependency, stream);
   3348     }
   3349     if (x->option_of_replacementFor)
   3350     {
   3351         PutExtensionInteger(1, 65535, (uint32)x->replacementFor, stream);
   3352     }
   3353 }
   3354 
   3355 /* <===============================================> */
   3356 /*  PER-Encoder for RlcMultiplexParameters (CHOICE)  */
   3357 /* <===============================================> */
   3358 void Encode_RlcMultiplexParameters(PS_RlcMultiplexParameters x, PS_OutStream stream)
   3359 {
   3360     PutChoiceIndex(2, 1, x->index, stream);
   3361     switch (x->index)
   3362     {
   3363         case 0:
   3364             Encode_H223LogicalChannelParameters(x->h223LogicalChannelParameters, stream);
   3365             break;
   3366         case 1:
   3367             Encode_V76LogicalChannelParameters(x->v76LogicalChannelParameters, stream);
   3368             break;
   3369             /* ------------------------------- */
   3370             /* ---- Extension Begins Here ---- */
   3371             /* ------------------------------- */
   3372         case 2:
   3373             PutExtensionItem(EPASS Encode_H2250LogicalChannelParameters, (uint8*)x->h2250LogicalChannelParameters, stream);
   3374             break;
   3375         default:
   3376             ErrorMessageAndLeave("Encode_RlcMultiplexParameters: Illegal CHOICE index");
   3377     }
   3378 }
   3379 
   3380 /* <==========================================================> */
   3381 /*  PER-Encoder for ForwardLogicalChannelParameters (SEQUENCE)  */
   3382 /* <==========================================================> */
   3383 void Encode_ForwardLogicalChannelParameters(PS_ForwardLogicalChannelParameters x, PS_OutStream stream)
   3384 {
   3385     uint32 extension;
   3386 
   3387     extension = x->option_of_forwardLogicalChannelDependency |
   3388                 x->option_of_replacementFor;
   3389     PutBoolean(extension, stream);
   3390 
   3391     PutBoolean(x->option_of_portNumber, stream);
   3392     if (x->option_of_portNumber)
   3393     {
   3394         PutInteger(0, 65535, (uint32)x->portNumber, stream);
   3395     }
   3396     Encode_DataType(&x->dataType, stream);
   3397     Encode_MultiplexParameters(&x->multiplexParameters, stream);
   3398     /* ------------------------------- */
   3399     /* ---- Extension Begins Here ---- */
   3400     /* ------------------------------- */
   3401     if (!extension) return; /* (No items present?) */
   3402     PutNormSmallLength(2, stream); /* Begin Options Map */
   3403     PutBoolean(x->option_of_forwardLogicalChannelDependency, stream);
   3404     PutBoolean(x->option_of_replacementFor, stream);
   3405     if (x->option_of_forwardLogicalChannelDependency)
   3406     {
   3407         PutExtensionInteger(1, 65535, (uint32)x->forwardLogicalChannelDependency, stream);
   3408     }
   3409     if (x->option_of_replacementFor)
   3410     {
   3411         PutExtensionInteger(1, 65535, (uint32)x->replacementFor, stream);
   3412     }
   3413 }
   3414 
   3415 /* <============================================> */
   3416 /*  PER-Encoder for MultiplexParameters (CHOICE)  */
   3417 /* <============================================> */
   3418 void Encode_MultiplexParameters(PS_MultiplexParameters x, PS_OutStream stream)
   3419 {
   3420     PutChoiceIndex(3, 1, x->index, stream);
   3421     switch (x->index)
   3422     {
   3423         case 0:
   3424             Encode_H222LogicalChannelParameters(x->h222LogicalChannelParameters, stream);
   3425             break;
   3426         case 1:
   3427             Encode_H223LogicalChannelParameters(x->h223LogicalChannelParameters, stream);
   3428             break;
   3429         case 2:
   3430             Encode_V76LogicalChannelParameters(x->v76LogicalChannelParameters, stream);
   3431             break;
   3432             /* ------------------------------- */
   3433             /* ---- Extension Begins Here ---- */
   3434             /* ------------------------------- */
   3435         case 3:
   3436             PutExtensionItem(EPASS Encode_H2250LogicalChannelParameters, (uint8*)x->h2250LogicalChannelParameters, stream);
   3437             break;
   3438         case 4:
   3439             PutExtensionNull(stream);
   3440             break;
   3441         default:
   3442             ErrorMessageAndLeave("Encode_MultiplexParameters: Illegal CHOICE index");
   3443     }
   3444 }
   3445 
   3446 /* <==================================================> */
   3447 /*  PER-Encoder for NetworkAccessParameters (SEQUENCE)  */
   3448 /* <==================================================> */
   3449 void Encode_NetworkAccessParameters(PS_NetworkAccessParameters x, PS_OutStream stream)
   3450 {
   3451     uint32 extension;
   3452 
   3453     extension = x->option_of_t120SetupProcedure;
   3454     PutBoolean(extension, stream);
   3455 
   3456     PutBoolean(x->option_of_distribution, stream);
   3457     PutBoolean(x->option_of_externalReference, stream);
   3458     if (x->option_of_distribution)
   3459     {
   3460         Encode_Distribution(&x->distribution, stream);
   3461     }
   3462     Encode_NetworkAddress(&x->networkAddress, stream);
   3463     PutBoolean(x->associateConference, stream);
   3464     if (x->option_of_externalReference)
   3465     {
   3466         PutOctetString(0, 1, 255, &x->externalReference, stream);
   3467     }
   3468     /* ------------------------------- */
   3469     /* ---- Extension Begins Here ---- */
   3470     /* ------------------------------- */
   3471     if (!extension) return; /* (No items present?) */
   3472     PutNormSmallLength(1, stream); /* Begin Options Map */
   3473     PutBoolean(x->option_of_t120SetupProcedure, stream);
   3474     if (x->option_of_t120SetupProcedure)
   3475     {
   3476         PutExtensionItem(EPASS Encode_T120SetupProcedure, (uint8*)&x->t120SetupProcedure, stream);
   3477     }
   3478 }
   3479 
   3480 /* <===========================================> */
   3481 /*  PER-Encoder for T120SetupProcedure (CHOICE)  */
   3482 /* <===========================================> */
   3483 void Encode_T120SetupProcedure(PS_T120SetupProcedure x, PS_OutStream stream)
   3484 {
   3485     PutChoiceIndex(3, 1, x->index, stream);
   3486     switch (x->index)
   3487     {
   3488         case 0:
   3489             /* (originateCall is NULL) */
   3490             break;
   3491         case 1:
   3492             /* (waitForCall is NULL) */
   3493             break;
   3494         case 2:
   3495             /* (issueQuery is NULL) */
   3496             break;
   3497             /* ------------------------------- */
   3498             /* ---- Extension Begins Here ---- */
   3499             /* ------------------------------- */
   3500         default:
   3501             ErrorMessageAndLeave("Encode_T120SetupProcedure: Illegal CHOICE index");
   3502     }
   3503 }
   3504 
   3505 /* <=======================================> */
   3506 /*  PER-Encoder for NetworkAddress (CHOICE)  */
   3507 /* <=======================================> */
   3508 void Encode_NetworkAddress(PS_NetworkAddress x, PS_OutStream stream)
   3509 {
   3510     PutChoiceIndex(3, 1, x->index, stream);
   3511     switch (x->index)
   3512     {
   3513         case 0:
   3514             Encode_Q2931Address(x->q2931Address, stream);
   3515             break;
   3516         case 1:
   3517             PutCharString("IA5String(SIZE(1..128))", 0, 1, 128, "0123456789#*,", x->e164Address, stream);
   3518             break;
   3519         case 2:
   3520             Encode_TransportAddress(x->localAreaAddress, stream);
   3521             break;
   3522             /* ------------------------------- */
   3523             /* ---- Extension Begins Here ---- */
   3524             /* ------------------------------- */
   3525         default:
   3526             ErrorMessageAndLeave("Encode_NetworkAddress: Illegal CHOICE index");
   3527     }
   3528 }
   3529 
   3530 /* <=====================================> */
   3531 /*  PER-Encoder for Distribution (CHOICE)  */
   3532 /* <=====================================> */
   3533 void Encode_Distribution(PS_Distribution x, PS_OutStream stream)
   3534 {
   3535     PutChoiceIndex(2, 1, x->index, stream);
   3536     switch (x->index)
   3537     {
   3538         case 0:
   3539             /* (unicast is NULL) */
   3540             break;
   3541         case 1:
   3542             /* (multicast is NULL) */
   3543             break;
   3544             /* ------------------------------- */
   3545             /* ---- Extension Begins Here ---- */
   3546             /* ------------------------------- */
   3547         default:
   3548             ErrorMessageAndLeave("Encode_Distribution: Illegal CHOICE index");
   3549     }
   3550 }
   3551 
   3552 /* <=======================================> */
   3553 /*  PER-Encoder for Q2931Address (SEQUENCE)  */
   3554 /* <=======================================> */
   3555 void Encode_Q2931Address(PS_Q2931Address x, PS_OutStream stream)
   3556 {
   3557     PutBoolean(0, stream); /* Extension Bit OFF */
   3558     PutBoolean(x->option_of_subaddress, stream);
   3559     Encode_Address(&x->address, stream);
   3560     if (x->option_of_subaddress)
   3561     {
   3562         PutOctetString(0, 1, 20, &x->subaddress, stream);
   3563     }
   3564     /* ------------------------------- */
   3565     /* ---- Extension Begins Here ---- */
   3566     /* ------------------------------- */
   3567 }
   3568 
   3569 /* <================================> */
   3570 /*  PER-Encoder for Address (CHOICE)  */
   3571 /* <================================> */
   3572 void Encode_Address(PS_Address x, PS_OutStream stream)
   3573 {
   3574     PutChoiceIndex(2, 1, x->index, stream);
   3575     switch (x->index)
   3576     {
   3577         case 0:
   3578             PutCharString("NumericString(SIZE(1..16))", 0, 1, 16, NULL, x->internationalNumber, stream);
   3579             break;
   3580         case 1:
   3581             PutOctetString(0, 1, 20, x->nsapAddress, stream);
   3582             break;
   3583             /* ------------------------------- */
   3584             /* ---- Extension Begins Here ---- */
   3585             /* ------------------------------- */
   3586         default:
   3587             ErrorMessageAndLeave("Encode_Address: Illegal CHOICE index");
   3588     }
   3589 }
   3590 
   3591 /* <========================================> */
   3592 /*  PER-Encoder for V75Parameters (SEQUENCE)  */
   3593 /* <========================================> */
   3594 void Encode_V75Parameters(PS_V75Parameters x, PS_OutStream stream)
   3595 {
   3596     PutBoolean(0, stream); /* Extension Bit OFF */
   3597     PutBoolean(x->audioHeaderPresent, stream);
   3598     /* ------------------------------- */
   3599     /* ---- Extension Begins Here ---- */
   3600     /* ------------------------------- */
   3601 }
   3602 
   3603 /* <=================================> */
   3604 /*  PER-Encoder for DataType (CHOICE)  */
   3605 /* <=================================> */
   3606 void Encode_DataType(PS_DataType x, PS_OutStream stream)
   3607 {
   3608     PutChoiceIndex(6, 1, x->index, stream);
   3609     switch (x->index)
   3610     {
   3611         case 0:
   3612             Encode_NonStandardParameter(x->nonStandard, stream);
   3613             break;
   3614         case 1:
   3615             /* (nullData is NULL) */
   3616             break;
   3617         case 2:
   3618             Encode_VideoCapability(x->videoData, stream);
   3619             break;
   3620         case 3:
   3621             Encode_AudioCapability(x->audioData, stream);
   3622             break;
   3623         case 4:
   3624             Encode_DataApplicationCapability(x->data, stream);
   3625             break;
   3626         case 5:
   3627             Encode_EncryptionMode(x->encryptionData, stream);
   3628             break;
   3629             /* ------------------------------- */
   3630             /* ---- Extension Begins Here ---- */
   3631             /* ------------------------------- */
   3632         case 6:
   3633             PutExtensionItem(EPASS Encode_NonStandardParameter, (uint8*)x->h235Control, stream);
   3634             break;
   3635         case 7:
   3636             PutExtensionItem(EPASS Encode_H235Media, (uint8*)x->h235Media, stream);
   3637             break;
   3638         default:
   3639             ErrorMessageAndLeave("Encode_DataType: Illegal CHOICE index");
   3640     }
   3641 }
   3642 
   3643 /* <====================================> */
   3644 /*  PER-Encoder for H235Media (SEQUENCE)  */
   3645 /* <====================================> */
   3646 void Encode_H235Media(PS_H235Media x, PS_OutStream stream)
   3647 {
   3648     PutBoolean(0, stream); /* Extension Bit OFF */
   3649     Encode_EncryptionAuthenticationAndIntegrity(&x->encryptionAuthenticationAndIntegrity, stream);
   3650     Encode_MediaType(&x->mediaType, stream);
   3651     /* ------------------------------- */
   3652     /* ---- Extension Begins Here ---- */
   3653     /* ------------------------------- */
   3654 }
   3655 
   3656 /* <==================================> */
   3657 /*  PER-Encoder for MediaType (CHOICE)  */
   3658 /* <==================================> */
   3659 void Encode_MediaType(PS_MediaType x, PS_OutStream stream)
   3660 {
   3661     PutChoiceIndex(4, 1, x->index, stream);
   3662     switch (x->index)
   3663     {
   3664         case 0:
   3665             Encode_NonStandardParameter(x->nonStandard, stream);
   3666             break;
   3667         case 1:
   3668             Encode_VideoCapability(x->videoData, stream);
   3669             break;
   3670         case 2:
   3671             Encode_AudioCapability(x->audioData, stream);
   3672             break;
   3673         case 3:
   3674             Encode_DataApplicationCapability(x->data, stream);
   3675             break;
   3676             /* ------------------------------- */
   3677             /* ---- Extension Begins Here ---- */
   3678             /* ------------------------------- */
   3679         default:
   3680             ErrorMessageAndLeave("Encode_MediaType: Illegal CHOICE index");
   3681     }
   3682 }
   3683 
   3684 /* <=======================================================> */
   3685 /*  PER-Encoder for H222LogicalChannelParameters (SEQUENCE)  */
   3686 /* <=======================================================> */
   3687 void Encode_H222LogicalChannelParameters(PS_H222LogicalChannelParameters x, PS_OutStream stream)
   3688 {
   3689     PutBoolean(0, stream); /* Extension Bit OFF */
   3690     PutBoolean(x->option_of_pcr_pid, stream);
   3691     PutBoolean(x->option_of_programDescriptors, stream);
   3692     PutBoolean(x->option_of_streamDescriptors, stream);
   3693     PutInteger(0, 65535, (uint32)x->resourceID, stream);
   3694     PutInteger(0, 8191, (uint32)x->subChannelID, stream);
   3695     if (x->option_of_pcr_pid)
   3696     {
   3697         PutInteger(0, 8191, (uint32)x->pcr_pid, stream);
   3698     }
   3699     if (x->option_of_programDescriptors)
   3700     {
   3701         PutOctetString(1, 0, 0, &x->programDescriptors, stream);
   3702     }
   3703     if (x->option_of_streamDescriptors)
   3704     {
   3705         PutOctetString(1, 0, 0, &x->streamDescriptors, stream);
   3706     }
   3707     /* ------------------------------- */
   3708     /* ---- Extension Begins Here ---- */
   3709     /* ------------------------------- */
   3710 }
   3711 
   3712 /* <=======================================================> */
   3713 /*  PER-Encoder for H223LogicalChannelParameters (SEQUENCE)  */
   3714 /* <=======================================================> */
   3715 void Encode_H223LogicalChannelParameters(PS_H223LogicalChannelParameters x, PS_OutStream stream)
   3716 {
   3717     PutBoolean(0, stream); /* Extension Bit OFF */
   3718     Encode_AdaptationLayerType(&x->adaptationLayerType, stream);
   3719     PutBoolean(x->segmentableFlag, stream);
   3720     /* ------------------------------- */
   3721     /* ---- Extension Begins Here ---- */
   3722     /* ------------------------------- */
   3723 }
   3724 
   3725 /* <============================================> */
   3726 /*  PER-Encoder for AdaptationLayerType (CHOICE)  */
   3727 /* <============================================> */
   3728 void Encode_AdaptationLayerType(PS_AdaptationLayerType x, PS_OutStream stream)
   3729 {
   3730     PutChoiceIndex(6, 1, x->index, stream);
   3731     switch (x->index)
   3732     {
   3733         case 0:
   3734             Encode_NonStandardParameter(x->nonStandard, stream);
   3735             break;
   3736         case 1:
   3737             /* (al1Framed is NULL) */
   3738             break;
   3739         case 2:
   3740             /* (al1NotFramed is NULL) */
   3741             break;
   3742         case 3:
   3743             /* (al2WithoutSequenceNumbers is NULL) */
   3744             break;
   3745         case 4:
   3746             /* (al2WithSequenceNumbers is NULL) */
   3747             break;
   3748         case 5:
   3749             Encode_Al3(x->al3, stream);
   3750             break;
   3751             /* ------------------------------- */
   3752             /* ---- Extension Begins Here ---- */
   3753             /* ------------------------------- */
   3754         case 6:
   3755             PutExtensionItem(EPASS Encode_H223AL1MParameters, (uint8*)x->al1M, stream);
   3756             break;
   3757         case 7:
   3758             PutExtensionItem(EPASS Encode_H223AL2MParameters, (uint8*)x->al2M, stream);
   3759             break;
   3760         case 8:
   3761             PutExtensionItem(EPASS Encode_H223AL3MParameters, (uint8*)x->al3M, stream);
   3762             break;
   3763         default:
   3764             ErrorMessageAndLeave("Encode_AdaptationLayerType: Illegal CHOICE index");
   3765     }
   3766 }
   3767 
   3768 /* <==============================> */
   3769 /*  PER-Encoder for Al3 (SEQUENCE)  */
   3770 /* <==============================> */
   3771 void Encode_Al3(PS_Al3 x, PS_OutStream stream)
   3772 {
   3773     PutInteger(0, 2, (uint32)x->controlFieldOctets, stream);
   3774     PutInteger(0, 16777215, (uint32)x->sendBufferSize, stream);
   3775 }
   3776 
   3777 /* <=============================================> */
   3778 /*  PER-Encoder for H223AL1MParameters (SEQUENCE)  */
   3779 /* <=============================================> */
   3780 void Encode_H223AL1MParameters(PS_H223AL1MParameters x, PS_OutStream stream)
   3781 {
   3782     uint32 extension;
   3783 
   3784     extension = x->option_of_rsCodeCorrection;
   3785     PutBoolean(extension, stream);
   3786 
   3787     Encode_TransferMode(&x->transferMode, stream);
   3788     Encode_HeaderFEC(&x->headerFEC, stream);
   3789     Encode_CrcLength(&x->crcLength, stream);
   3790     PutInteger(8, 32, (uint32)x->rcpcCodeRate, stream);
   3791     Encode_ArqType(&x->arqType, stream);
   3792     PutBoolean(x->alpduInterleaving, stream);
   3793     PutBoolean(x->alsduSplitting, stream);
   3794     /* ------------------------------- */
   3795     /* ---- Extension Begins Here ---- */
   3796     /* ------------------------------- */
   3797     if (!extension) return; /* (No items present?) */
   3798     PutNormSmallLength(1, stream); /* Begin Options Map */
   3799     PutBoolean(x->option_of_rsCodeCorrection, stream);
   3800     if (x->option_of_rsCodeCorrection)
   3801     {
   3802         PutExtensionInteger(0, 127, (uint32)x->rsCodeCorrection, stream);
   3803     }
   3804 }
   3805 
   3806 /* <================================> */
   3807 /*  PER-Encoder for ArqType (CHOICE)  */
   3808 /* <================================> */
   3809 void Encode_ArqType(PS_ArqType x, PS_OutStream stream)
   3810 {
   3811     PutChoiceIndex(3, 1, x->index, stream);
   3812     switch (x->index)
   3813     {
   3814         case 0:
   3815             /* (noArq is NULL) */
   3816             break;
   3817         case 1:
   3818             Encode_H223AnnexCArqParameters(x->typeIArq, stream);
   3819             break;
   3820         case 2:
   3821             Encode_H223AnnexCArqParameters(x->typeIIArq, stream);
   3822             break;
   3823             /* ------------------------------- */
   3824             /* ---- Extension Begins Here ---- */
   3825             /* ------------------------------- */
   3826         default:
   3827             ErrorMessageAndLeave("Encode_ArqType: Illegal CHOICE index");
   3828     }
   3829 }
   3830 
   3831 /* <==================================> */
   3832 /*  PER-Encoder for CrcLength (CHOICE)  */
   3833 /* <==================================> */
   3834 void Encode_CrcLength(PS_CrcLength x, PS_OutStream stream)
   3835 {
   3836     PutChoiceIndex(4, 1, x->index, stream);
   3837     switch (x->index)
   3838     {
   3839         case 0:
   3840             /* (crc4bit is NULL) */
   3841             break;
   3842         case 1:
   3843             /* (crc12bit is NULL) */
   3844             break;
   3845         case 2:
   3846             /* (crc20bit is NULL) */
   3847             break;
   3848         case 3:
   3849             /* (crc28bit is NULL) */
   3850             break;
   3851             /* ------------------------------- */
   3852             /* ---- Extension Begins Here ---- */
   3853             /* ------------------------------- */
   3854         case 4:
   3855             PutExtensionNull(stream);
   3856             break;
   3857         case 5:
   3858             PutExtensionNull(stream);
   3859             break;
   3860         case 6:
   3861             PutExtensionNull(stream);
   3862             break;
   3863         case 7:
   3864             PutExtensionNull(stream);
   3865             break;
   3866         default:
   3867             ErrorMessageAndLeave("Encode_CrcLength: Illegal CHOICE index");
   3868     }
   3869 }
   3870 
   3871 /* <==================================> */
   3872 /*  PER-Encoder for HeaderFEC (CHOICE)  */
   3873 /* <==================================> */
   3874 void Encode_HeaderFEC(PS_HeaderFEC x, PS_OutStream stream)
   3875 {
   3876     PutChoiceIndex(2, 1, x->index, stream);
   3877     switch (x->index)
   3878     {
   3879         case 0:
   3880             /* (sebch16_7 is NULL) */
   3881             break;
   3882         case 1:
   3883             /* (golay24_12 is NULL) */
   3884             break;
   3885             /* ------------------------------- */
   3886             /* ---- Extension Begins Here ---- */
   3887             /* ------------------------------- */
   3888         default:
   3889             ErrorMessageAndLeave("Encode_HeaderFEC: Illegal CHOICE index");
   3890     }
   3891 }
   3892 
   3893 /* <=====================================> */
   3894 /*  PER-Encoder for TransferMode (CHOICE)  */
   3895 /* <=====================================> */
   3896 void Encode_TransferMode(PS_TransferMode x, PS_OutStream stream)
   3897 {
   3898     PutChoiceIndex(2, 1, x->index, stream);
   3899     switch (x->index)
   3900     {
   3901         case 0:
   3902             /* (framed is NULL) */
   3903             break;
   3904         case 1:
   3905             /* (unframed is NULL) */
   3906             break;
   3907             /* ------------------------------- */
   3908             /* ---- Extension Begins Here ---- */
   3909             /* ------------------------------- */
   3910         default:
   3911             ErrorMessageAndLeave("Encode_TransferMode: Illegal CHOICE index");
   3912     }
   3913 }
   3914 
   3915 /* <=============================================> */
   3916 /*  PER-Encoder for H223AL2MParameters (SEQUENCE)  */
   3917 /* <=============================================> */
   3918 void Encode_H223AL2MParameters(PS_H223AL2MParameters x, PS_OutStream stream)
   3919 {
   3920     PutBoolean(0, stream); /* Extension Bit OFF */
   3921     Encode_Al2HeaderFEC(&x->al2HeaderFEC, stream);
   3922     PutBoolean(x->alpduInterleaving, stream);
   3923     /* ------------------------------- */
   3924     /* ---- Extension Begins Here ---- */
   3925     /* ------------------------------- */
   3926 }
   3927 
   3928 /* <=====================================> */
   3929 /*  PER-Encoder for Al2HeaderFEC (CHOICE)  */
   3930 /* <=====================================> */
   3931 void Encode_Al2HeaderFEC(PS_Al2HeaderFEC x, PS_OutStream stream)
   3932 {
   3933     PutChoiceIndex(2, 1, x->index, stream);
   3934     switch (x->index)
   3935     {
   3936         case 0:
   3937             /* (sebch16_5 is NULL) */
   3938             break;
   3939         case 1:
   3940             /* (golay24_12 is NULL) */
   3941             break;
   3942             /* ------------------------------- */
   3943             /* ---- Extension Begins Here ---- */
   3944             /* ------------------------------- */
   3945         default:
   3946             ErrorMessageAndLeave("Encode_Al2HeaderFEC: Illegal CHOICE index");
   3947     }
   3948 }
   3949 
   3950 /* <=============================================> */
   3951 /*  PER-Encoder for H223AL3MParameters (SEQUENCE)  */
   3952 /* <=============================================> */
   3953 void Encode_H223AL3MParameters(PS_H223AL3MParameters x, PS_OutStream stream)
   3954 {
   3955     uint32 extension;
   3956 
   3957     extension = x->option_of_rsCodeCorrection;
   3958     PutBoolean(extension, stream);
   3959 
   3960     Encode_HeaderFormat(&x->headerFormat, stream);
   3961     Encode_Al3CrcLength(&x->al3CrcLength, stream);
   3962     PutInteger(8, 32, (uint32)x->rcpcCodeRate, stream);
   3963     Encode_Al3ArqType(&x->al3ArqType, stream);
   3964     PutBoolean(x->alpduInterleaving, stream);
   3965     /* ------------------------------- */
   3966     /* ---- Extension Begins Here ---- */
   3967     /* ------------------------------- */
   3968     if (!extension) return; /* (No items present?) */
   3969     PutNormSmallLength(1, stream); /* Begin Options Map */
   3970     PutBoolean(x->option_of_rsCodeCorrection, stream);
   3971     if (x->option_of_rsCodeCorrection)
   3972     {
   3973         PutExtensionInteger(0, 127, (uint32)x->rsCodeCorrection, stream);
   3974     }
   3975 }
   3976 
   3977 /* <===================================> */
   3978 /*  PER-Encoder for Al3ArqType (CHOICE)  */
   3979 /* <===================================> */
   3980 void Encode_Al3ArqType(PS_Al3ArqType x, PS_OutStream stream)
   3981 {
   3982     PutChoiceIndex(3, 1, x->index, stream);
   3983     switch (x->index)
   3984     {
   3985         case 0:
   3986             /* (noArq is NULL) */
   3987             break;
   3988         case 1:
   3989             Encode_H223AnnexCArqParameters(x->typeIArq, stream);
   3990             break;
   3991         case 2:
   3992             Encode_H223AnnexCArqParameters(x->typeIIArq, stream);
   3993             break;
   3994             /* ------------------------------- */
   3995             /* ---- Extension Begins Here ---- */
   3996             /* ------------------------------- */
   3997         default:
   3998             ErrorMessageAndLeave("Encode_Al3ArqType: Illegal CHOICE index");
   3999     }
   4000 }
   4001 
   4002 /* <=====================================> */
   4003 /*  PER-Encoder for Al3CrcLength (CHOICE)  */
   4004 /* <=====================================> */
   4005 void Encode_Al3CrcLength(PS_Al3CrcLength x, PS_OutStream stream)
   4006 {
   4007     PutChoiceIndex(4, 1, x->index, stream);
   4008     switch (x->index)
   4009     {
   4010         case 0:
   4011             /* (crc4bit is NULL) */
   4012             break;
   4013         case 1:
   4014             /* (crc12bit is NULL) */
   4015             break;
   4016         case 2:
   4017             /* (crc20bit is NULL) */
   4018             break;
   4019         case 3:
   4020             /* (crc28bit is NULL) */
   4021             break;
   4022             /* ------------------------------- */
   4023             /* ---- Extension Begins Here ---- */
   4024             /* ------------------------------- */
   4025         case 4:
   4026             PutExtensionNull(stream);
   4027             break;
   4028         case 5:
   4029             PutExtensionNull(stream);
   4030             break;
   4031         case 6:
   4032             PutExtensionNull(stream);
   4033             break;
   4034         case 7:
   4035             PutExtensionNull(stream);
   4036             break;
   4037         default:
   4038             ErrorMessageAndLeave("Encode_Al3CrcLength: Illegal CHOICE index");
   4039     }
   4040 }
   4041 
   4042 /* <=====================================> */
   4043 /*  PER-Encoder for HeaderFormat (CHOICE)  */
   4044 /* <=====================================> */
   4045 void Encode_HeaderFormat(PS_HeaderFormat x, PS_OutStream stream)
   4046 {
   4047     PutChoiceIndex(2, 1, x->index, stream);
   4048     switch (x->index)
   4049     {
   4050         case 0:
   4051             /* (sebch16_7 is NULL) */
   4052             break;
   4053         case 1:
   4054             /* (golay24_12 is NULL) */
   4055             break;
   4056             /* ------------------------------- */
   4057             /* ---- Extension Begins Here ---- */
   4058             /* ------------------------------- */
   4059         default:
   4060             ErrorMessageAndLeave("Encode_HeaderFormat: Illegal CHOICE index");
   4061     }
   4062 }
   4063 
   4064 /* <==================================================> */
   4065 /*  PER-Encoder for H223AnnexCArqParameters (SEQUENCE)  */
   4066 /* <==================================================> */
   4067 void Encode_H223AnnexCArqParameters(PS_H223AnnexCArqParameters x, PS_OutStream stream)
   4068 {
   4069     PutBoolean(0, stream); /* Extension Bit OFF */
   4070     Encode_NumberOfRetransmissions(&x->numberOfRetransmissions, stream);
   4071     PutInteger(0, 16777215, (uint32)x->sendBufferSize, stream);
   4072     /* ------------------------------- */
   4073     /* ---- Extension Begins Here ---- */
   4074     /* ------------------------------- */
   4075 }
   4076 
   4077 /* <================================================> */
   4078 /*  PER-Encoder for NumberOfRetransmissions (CHOICE)  */
   4079 /* <================================================> */
   4080 void Encode_NumberOfRetransmissions(PS_NumberOfRetransmissions x, PS_OutStream stream)
   4081 {
   4082     PutChoiceIndex(2, 1, x->index, stream);
   4083     switch (x->index)
   4084     {
   4085         case 0:
   4086             PutInteger(0, 16, (uint32)x->finite, stream);
   4087             break;
   4088         case 1:
   4089             /* (infinite is NULL) */
   4090             break;
   4091             /* ------------------------------- */
   4092             /* ---- Extension Begins Here ---- */
   4093             /* ------------------------------- */
   4094         default:
   4095             ErrorMessageAndLeave("Encode_NumberOfRetransmissions: Illegal CHOICE index");
   4096     }
   4097 }
   4098 
   4099 /* <======================================================> */
   4100 /*  PER-Encoder for V76LogicalChannelParameters (SEQUENCE)  */
   4101 /* <======================================================> */
   4102 void Encode_V76LogicalChannelParameters(PS_V76LogicalChannelParameters x, PS_OutStream stream)
   4103 {
   4104     PutBoolean(0, stream); /* Extension Bit OFF */
   4105     Encode_V76HDLCParameters(&x->hdlcParameters, stream);
   4106     Encode_SuspendResume(&x->suspendResume, stream);
   4107     PutBoolean(x->uIH, stream);
   4108     Encode_Mode(&x->mode, stream);
   4109     Encode_V75Parameters(&x->v75Parameters, stream);
   4110     /* ------------------------------- */
   4111     /* ---- Extension Begins Here ---- */
   4112     /* ------------------------------- */
   4113 }
   4114 
   4115 /* <=============================> */
   4116 /*  PER-Encoder for Mode (CHOICE)  */
   4117 /* <=============================> */
   4118 void Encode_Mode(PS_Mode x, PS_OutStream stream)
   4119 {
   4120     PutChoiceIndex(2, 1, x->index, stream);
   4121     switch (x->index)
   4122     {
   4123         case 0:
   4124             Encode_ERM(x->eRM, stream);
   4125             break;
   4126         case 1:
   4127             /* (uNERM is NULL) */
   4128             break;
   4129             /* ------------------------------- */
   4130             /* ---- Extension Begins Here ---- */
   4131             /* ------------------------------- */
   4132         default:
   4133             ErrorMessageAndLeave("Encode_Mode: Illegal CHOICE index");
   4134     }
   4135 }
   4136 
   4137 /* <==============================> */
   4138 /*  PER-Encoder for ERM (SEQUENCE)  */
   4139 /* <==============================> */
   4140 void Encode_ERM(PS_ERM x, PS_OutStream stream)
   4141 {
   4142     PutBoolean(0, stream); /* Extension Bit OFF */
   4143     PutInteger(1, 127, (uint32)x->windowSize, stream);
   4144     Encode_Recovery(&x->recovery, stream);
   4145     /* ------------------------------- */
   4146     /* ---- Extension Begins Here ---- */
   4147     /* ------------------------------- */
   4148 }
   4149 
   4150 /* <=================================> */
   4151 /*  PER-Encoder for Recovery (CHOICE)  */
   4152 /* <=================================> */
   4153 void Encode_Recovery(PS_Recovery x, PS_OutStream stream)
   4154 {
   4155     PutChoiceIndex(3, 1, x->index, stream);
   4156     switch (x->index)
   4157     {
   4158         case 0:
   4159             /* (rej is NULL) */
   4160             break;
   4161         case 1:
   4162             /* (sREJ is NULL) */
   4163             break;
   4164         case 2:
   4165             /* (mSREJ is NULL) */
   4166             break;
   4167             /* ------------------------------- */
   4168             /* ---- Extension Begins Here ---- */
   4169             /* ------------------------------- */
   4170         default:
   4171             ErrorMessageAndLeave("Encode_Recovery: Illegal CHOICE index");
   4172     }
   4173 }
   4174 
   4175 /* <======================================> */
   4176 /*  PER-Encoder for SuspendResume (CHOICE)  */
   4177 /* <======================================> */
   4178 void Encode_SuspendResume(PS_SuspendResume x, PS_OutStream stream)
   4179 {
   4180     PutChoiceIndex(3, 1, x->index, stream);
   4181     switch (x->index)
   4182     {
   4183         case 0:
   4184             /* (noSuspendResume is NULL) */
   4185             break;
   4186         case 1:
   4187             /* (suspendResumewAddress is NULL) */
   4188             break;
   4189         case 2:
   4190             /* (suspendResumewoAddress is NULL) */
   4191             break;
   4192             /* ------------------------------- */
   4193             /* ---- Extension Begins Here ---- */
   4194             /* ------------------------------- */
   4195         default:
   4196             ErrorMessageAndLeave("Encode_SuspendResume: Illegal CHOICE index");
   4197     }
   4198 }
   4199 
   4200 /* <============================================> */
   4201 /*  PER-Encoder for V76HDLCParameters (SEQUENCE)  */
   4202 /* <============================================> */
   4203 void Encode_V76HDLCParameters(PS_V76HDLCParameters x, PS_OutStream stream)
   4204 {
   4205     PutBoolean(0, stream); /* Extension Bit OFF */
   4206     Encode_CRCLength(&x->crcLength, stream);
   4207     PutInteger(1, 4095, (uint32)x->n401, stream);
   4208     PutBoolean(x->loopbackTestProcedure, stream);
   4209     /* ------------------------------- */
   4210     /* ---- Extension Begins Here ---- */
   4211     /* ------------------------------- */
   4212 }
   4213 
   4214 /* <==================================> */
   4215 /*  PER-Encoder for CRCLength (CHOICE)  */
   4216 /* <==================================> */
   4217 void Encode_CRCLength(PS_CRCLength x, PS_OutStream stream)
   4218 {
   4219     PutChoiceIndex(3, 1, x->index, stream);
   4220     switch (x->index)
   4221     {
   4222         case 0:
   4223             /* (crc8bit is NULL) */
   4224             break;
   4225         case 1:
   4226             /* (crc16bit is NULL) */
   4227             break;
   4228         case 2:
   4229             /* (crc32bit is NULL) */
   4230             break;
   4231             /* ------------------------------- */
   4232             /* ---- Extension Begins Here ---- */
   4233             /* ------------------------------- */
   4234         default:
   4235             ErrorMessageAndLeave("Encode_CRCLength: Illegal CHOICE index");
   4236     }
   4237 }
   4238 
   4239 /* <========================================================> */
   4240 /*  PER-Encoder for H2250LogicalChannelParameters (SEQUENCE)  */
   4241 /* <========================================================> */
   4242 void Encode_H2250LogicalChannelParameters(PS_H2250LogicalChannelParameters x, PS_OutStream stream)
   4243 {
   4244     uint16 i;
   4245     uint32 extension;
   4246 
   4247     extension = x->option_of_transportCapability |
   4248                 x->option_of_redundancyEncoding |
   4249                 x->option_of_source |
   4250                 x->option_of_symmetricMediaAddress;
   4251     PutBoolean(extension, stream);
   4252 
   4253     PutBoolean(x->option_of_nonStandard, stream);
   4254     PutBoolean(x->option_of_associatedSessionID, stream);
   4255     PutBoolean(x->option_of_mediaChannel, stream);
   4256     PutBoolean(x->option_of_mediaGuaranteedDelivery, stream);
   4257     PutBoolean(x->option_of_mediaControlChannel, stream);
   4258     PutBoolean(x->option_of_mediaControlGuaranteedDelivery, stream);
   4259     PutBoolean(x->option_of_silenceSuppression, stream);
   4260     PutBoolean(x->option_of_destination, stream);
   4261     PutBoolean(x->option_of_dynamicRTPPayloadType, stream);
   4262     PutBoolean(x->option_of_mediaPacketization, stream);
   4263     if (x->option_of_nonStandard)
   4264     {
   4265         PutLengthDet(x->size_of_nonStandard, stream);
   4266         for (i = 0; i < x->size_of_nonStandard; ++i)
   4267         {
   4268             Encode_NonStandardParameter(x->nonStandard + i, stream);
   4269         }
   4270     }
   4271     PutInteger(0, 255, (uint32)x->sessionID, stream);
   4272     if (x->option_of_associatedSessionID)
   4273     {
   4274         PutInteger(1, 255, (uint32)x->associatedSessionID, stream);
   4275     }
   4276     if (x->option_of_mediaChannel)
   4277     {
   4278         Encode_TransportAddress(&x->mediaChannel, stream);
   4279     }
   4280     if (x->option_of_mediaGuaranteedDelivery)
   4281     {
   4282         PutBoolean(x->mediaGuaranteedDelivery, stream);
   4283     }
   4284     if (x->option_of_mediaControlChannel)
   4285     {
   4286         Encode_TransportAddress(&x->mediaControlChannel, stream);
   4287     }
   4288     if (x->option_of_mediaControlGuaranteedDelivery)
   4289     {
   4290         PutBoolean(x->mediaControlGuaranteedDelivery, stream);
   4291     }
   4292     if (x->option_of_silenceSuppression)
   4293     {
   4294         PutBoolean(x->silenceSuppression, stream);
   4295     }
   4296     if (x->option_of_destination)
   4297     {
   4298         Encode_TerminalLabel(&x->destination, stream);
   4299     }
   4300     if (x->option_of_dynamicRTPPayloadType)
   4301     {
   4302         PutInteger(96, 127, (uint32)x->dynamicRTPPayloadType, stream);
   4303     }
   4304     if (x->option_of_mediaPacketization)
   4305     {
   4306         Encode_MediaPacketization(&x->mediaPacketization, stream);
   4307     }
   4308     /* ------------------------------- */
   4309     /* ---- Extension Begins Here ---- */
   4310     /* ------------------------------- */
   4311     if (!extension) return; /* (No items present?) */
   4312     PutNormSmallLength(4, stream); /* Begin Options Map */
   4313     PutBoolean(x->option_of_transportCapability, stream);
   4314     PutBoolean(x->option_of_redundancyEncoding, stream);
   4315     PutBoolean(x->option_of_source, stream);
   4316     PutBoolean(x->option_of_symmetricMediaAddress, stream);
   4317     if (x->option_of_transportCapability)
   4318     {
   4319         PutExtensionItem(EPASS Encode_TransportCapability, (uint8*)&x->transportCapability, stream);
   4320     }
   4321     if (x->option_of_redundancyEncoding)
   4322     {
   4323         PutExtensionItem(EPASS Encode_RedundancyEncoding, (uint8*)&x->redundancyEncoding, stream);
   4324     }
   4325     if (x->option_of_source)
   4326     {
   4327         PutExtensionItem(EPASS Encode_TerminalLabel, (uint8*)&x->source, stream);
   4328     }
   4329     if (x->option_of_symmetricMediaAddress)
   4330     {
   4331         PutExtensionBoolean(x->symmetricMediaAddress, stream);
   4332     }
   4333 }
   4334 
   4335 /* <===========================================> */
   4336 /*  PER-Encoder for MediaPacketization (CHOICE)  */
   4337 /* <===========================================> */
   4338 void Encode_MediaPacketization(PS_MediaPacketization x, PS_OutStream stream)
   4339 {
   4340     PutChoiceIndex(1, 1, x->index, stream);
   4341     switch (x->index)
   4342     {
   4343         case 0:
   4344             /* (h261aVideoPacketization is NULL) */
   4345             break;
   4346             /* ------------------------------- */
   4347             /* ---- Extension Begins Here ---- */
   4348             /* ------------------------------- */
   4349         case 1:
   4350             PutExtensionItem(EPASS Encode_RTPPayloadType, (uint8*)x->rtpPayloadType, stream);
   4351             break;
   4352         default:
   4353             ErrorMessageAndLeave("Encode_MediaPacketization: Illegal CHOICE index");
   4354     }
   4355 }
   4356 
   4357 /* <=========================================> */
   4358 /*  PER-Encoder for RTPPayloadType (SEQUENCE)  */
   4359 /* <=========================================> */
   4360 void Encode_RTPPayloadType(PS_RTPPayloadType x, PS_OutStream stream)
   4361 {
   4362     PutBoolean(0, stream); /* Extension Bit OFF */
   4363     PutBoolean(x->option_of_payloadType, stream);
   4364     Encode_PayloadDescriptor(&x->payloadDescriptor, stream);
   4365     if (x->option_of_payloadType)
   4366     {
   4367         PutInteger(0, 127, (uint32)x->payloadType, stream);
   4368     }
   4369     /* ------------------------------- */
   4370     /* ---- Extension Begins Here ---- */
   4371     /* ------------------------------- */
   4372 }
   4373 
   4374 /* <==========================================> */
   4375 /*  PER-Encoder for PayloadDescriptor (CHOICE)  */
   4376 /* <==========================================> */
   4377 void Encode_PayloadDescriptor(PS_PayloadDescriptor x, PS_OutStream stream)
   4378 {
   4379     PutChoiceIndex(3, 1, x->index, stream);
   4380     switch (x->index)
   4381     {
   4382         case 0:
   4383             Encode_NonStandardParameter(x->nonStandardIdentifier, stream);
   4384             break;
   4385         case 1:
   4386             PutExtendedInteger(1, 32768, (int32)x->rfc_number, stream);
   4387             break;
   4388         case 2:
   4389             PutObjectID(x->oid, stream);
   4390             break;
   4391             /* ------------------------------- */
   4392             /* ---- Extension Begins Here ---- */
   4393             /* ------------------------------- */
   4394         default:
   4395             ErrorMessageAndLeave("Encode_PayloadDescriptor: Illegal CHOICE index");
   4396     }
   4397 }
   4398 
   4399 /* <=============================================> */
   4400 /*  PER-Encoder for RedundancyEncoding (SEQUENCE)  */
   4401 /* <=============================================> */
   4402 void Encode_RedundancyEncoding(PS_RedundancyEncoding x, PS_OutStream stream)
   4403 {
   4404     PutBoolean(0, stream); /* Extension Bit OFF */
   4405     PutBoolean(x->option_of_secondaryEncoding, stream);
   4406     Encode_RedundancyEncodingMethod(&x->redundancyEncodingMethod, stream);
   4407     if (x->option_of_secondaryEncoding)
   4408     {
   4409         Encode_DataType(&x->secondaryEncoding, stream);
   4410     }
   4411     /* ------------------------------- */
   4412     /* ---- Extension Begins Here ---- */
   4413     /* ------------------------------- */
   4414 }
   4415 
   4416 /* <=========================================> */
   4417 /*  PER-Encoder for TransportAddress (CHOICE)  */
   4418 /* <=========================================> */
   4419 void Encode_TransportAddress(PS_TransportAddress x, PS_OutStream stream)
   4420 {
   4421     PutChoiceIndex(2, 1, x->index, stream);
   4422     switch (x->index)
   4423     {
   4424         case 0:
   4425             Encode_UnicastAddress(x->unicastAddress, stream);
   4426             break;
   4427         case 1:
   4428             Encode_MulticastAddress(x->multicastAddress, stream);
   4429             break;
   4430             /* ------------------------------- */
   4431             /* ---- Extension Begins Here ---- */
   4432             /* ------------------------------- */
   4433         default:
   4434             ErrorMessageAndLeave("Encode_TransportAddress: Illegal CHOICE index");
   4435     }
   4436 }
   4437 
   4438 /* <=======================================> */
   4439 /*  PER-Encoder for UnicastAddress (CHOICE)  */
   4440 /* <=======================================> */
   4441 void Encode_UnicastAddress(PS_UnicastAddress x, PS_OutStream stream)
   4442 {
   4443     PutChoiceIndex(5, 1, x->index, stream);
   4444     switch (x->index)
   4445     {
   4446         case 0:
   4447             Encode_IPAddress(x->iPAddress, stream);
   4448             break;
   4449         case 1:
   4450             Encode_IPXAddress(x->iPXAddress, stream);
   4451             break;
   4452         case 2:
   4453             Encode_IP6Address(x->iP6Address, stream);
   4454             break;
   4455         case 3:
   4456             PutOctetString(0, 16, 16, x->netBios, stream);
   4457             break;
   4458         case 4:
   4459             Encode_IPSourceRouteAddress(x->iPSourceRouteAddress, stream);
   4460             break;
   4461             /* ------------------------------- */
   4462             /* ---- Extension Begins Here ---- */
   4463             /* ------------------------------- */
   4464         case 5:
   4465             PutExtensionOctetString(0, 1, 20, x->nsap, stream);
   4466             break;
   4467         case 6:
   4468             PutExtensionItem(EPASS Encode_NonStandardParameter, (uint8*)x->nonStandardAddress, stream);
   4469             break;
   4470         default:
   4471             ErrorMessageAndLeave("Encode_UnicastAddress: Illegal CHOICE index");
   4472     }
   4473 }
   4474 
   4475 /* <===============================================> */
   4476 /*  PER-Encoder for IPSourceRouteAddress (SEQUENCE)  */
   4477 /* <===============================================> */
   4478 void Encode_IPSourceRouteAddress(PS_IPSourceRouteAddress x, PS_OutStream stream)
   4479 {
   4480     uint16 i;
   4481     PutBoolean(0, stream); /* Extension Bit OFF */
   4482     Encode_Routing(&x->routing, stream);
   4483     PutOctetString(0, 4, 4, &x->network, stream);
   4484     PutInteger(0, 65535, (uint32)x->tsapIdentifier, stream);
   4485     PutLengthDet(x->size_of_route, stream);
   4486     for (i = 0; i < x->size_of_route; ++i)
   4487     {
   4488         PutOctetString(0, 4, 4, x->route + i, stream);
   4489     }
   4490     /* ------------------------------- */
   4491     /* ---- Extension Begins Here ---- */
   4492     /* ------------------------------- */
   4493 }
   4494 
   4495 /* <================================> */
   4496 /*  PER-Encoder for Routing (CHOICE)  */
   4497 /* <================================> */
   4498 void Encode_Routing(PS_Routing x, PS_OutStream stream)
   4499 {
   4500     PutChoiceIndex(2, 0, x->index, stream);
   4501     switch (x->index)
   4502     {
   4503         case 0:
   4504             /* (strict is NULL) */
   4505             break;
   4506         case 1:
   4507             /* (loose is NULL) */
   4508             break;
   4509         default:
   4510             ErrorMessageAndLeave("Encode_Routing: Illegal CHOICE index");
   4511     }
   4512 }
   4513 
   4514 /* <=====================================> */
   4515 /*  PER-Encoder for IP6Address (SEQUENCE)  */
   4516 /* <=====================================> */
   4517 void Encode_IP6Address(PS_IP6Address x, PS_OutStream stream)
   4518 {
   4519     PutBoolean(0, stream); /* Extension Bit OFF */
   4520     PutOctetString(0, 16, 16, &x->network, stream);
   4521     PutInteger(0, 65535, (uint32)x->tsapIdentifier, stream);
   4522     /* ------------------------------- */
   4523     /* ---- Extension Begins Here ---- */
   4524     /* ------------------------------- */
   4525 }
   4526 
   4527 /* <=====================================> */
   4528 /*  PER-Encoder for IPXAddress (SEQUENCE)  */
   4529 /* <=====================================> */
   4530 void Encode_IPXAddress(PS_IPXAddress x, PS_OutStream stream)
   4531 {
   4532     PutBoolean(0, stream); /* Extension Bit OFF */
   4533     PutOctetString(0, 6, 6, &x->node, stream);
   4534     PutOctetString(0, 4, 4, &x->netnum, stream);
   4535     PutOctetString(0, 2, 2, &x->tsapIdentifier, stream);
   4536     /* ------------------------------- */
   4537     /* ---- Extension Begins Here ---- */
   4538     /* ------------------------------- */
   4539 }
   4540 
   4541 /* <====================================> */
   4542 /*  PER-Encoder for IPAddress (SEQUENCE)  */
   4543 /* <====================================> */
   4544 void Encode_IPAddress(PS_IPAddress x, PS_OutStream stream)
   4545 {
   4546     PutBoolean(0, stream); /* Extension Bit OFF */
   4547     PutOctetString(0, 4, 4, &x->network, stream);
   4548     PutInteger(0, 65535, (uint32)x->tsapIdentifier, stream);
   4549     /* ------------------------------- */
   4550     /* ---- Extension Begins Here ---- */
   4551     /* ------------------------------- */
   4552 }
   4553 
   4554 /* <=========================================> */
   4555 /*  PER-Encoder for MulticastAddress (CHOICE)  */
   4556 /* <=========================================> */
   4557 void Encode_MulticastAddress(PS_MulticastAddress x, PS_OutStream stream)
   4558 {
   4559     PutChoiceIndex(2, 1, x->index, stream);
   4560     switch (x->index)
   4561     {
   4562         case 0:
   4563             Encode_MaIpAddress(x->maIpAddress, stream);
   4564             break;
   4565         case 1:
   4566             Encode_MaIp6Address(x->maIp6Address, stream);
   4567             break;
   4568             /* ------------------------------- */
   4569             /* ---- Extension Begins Here ---- */
   4570             /* ------------------------------- */
   4571         case 2:
   4572             PutExtensionOctetString(0, 1, 20, x->nsap, stream);
   4573             break;
   4574         case 3:
   4575             PutExtensionItem(EPASS Encode_NonStandardParameter, (uint8*)x->nonStandardAddress, stream);
   4576             break;
   4577         default:
   4578             ErrorMessageAndLeave("Encode_MulticastAddress: Illegal CHOICE index");
   4579     }
   4580 }
   4581 
   4582 /* <=======================================> */
   4583 /*  PER-Encoder for MaIp6Address (SEQUENCE)  */
   4584 /* <=======================================> */
   4585 void Encode_MaIp6Address(PS_MaIp6Address x, PS_OutStream stream)
   4586 {
   4587     PutBoolean(0, stream); /* Extension Bit OFF */
   4588     PutOctetString(0, 16, 16, &x->network, stream);
   4589     PutInteger(0, 65535, (uint32)x->tsapIdentifier, stream);
   4590     /* ------------------------------- */
   4591     /* ---- Extension Begins Here ---- */
   4592     /* ------------------------------- */
   4593 }
   4594 
   4595 /* <======================================> */
   4596 /*  PER-Encoder for MaIpAddress (SEQUENCE)  */
   4597 /* <======================================> */
   4598 void Encode_MaIpAddress(PS_MaIpAddress x, PS_OutStream stream)
   4599 {
   4600     PutBoolean(0, stream); /* Extension Bit OFF */
   4601     PutOctetString(0, 4, 4, &x->network, stream);
   4602     PutInteger(0, 65535, (uint32)x->tsapIdentifier, stream);
   4603     /* ------------------------------- */
   4604     /* ---- Extension Begins Here ---- */
   4605     /* ------------------------------- */
   4606 }
   4607 
   4608 /* <=========================================> */
   4609 /*  PER-Encoder for EncryptionSync (SEQUENCE)  */
   4610 /* <=========================================> */
   4611 void Encode_EncryptionSync(PS_EncryptionSync x, PS_OutStream stream)
   4612 {
   4613     uint16 i;
   4614     PutBoolean(0, stream); /* Extension Bit OFF */
   4615     PutBoolean(x->option_of_nonStandard, stream);
   4616     PutBoolean(x->option_of_escrowentry, stream);
   4617     if (x->option_of_nonStandard)
   4618     {
   4619         Encode_NonStandardParameter(&x->nonStandard, stream);
   4620     }
   4621     PutInteger(0, 255, (uint32)x->synchFlag, stream);
   4622     PutOctetString(0, 1, 65535, &x->h235Key, stream);
   4623     if (x->option_of_escrowentry)
   4624     {
   4625         PutInteger(1, 256, (uint32)x->size_of_escrowentry, stream);
   4626         for (i = 0; i < x->size_of_escrowentry; ++i)
   4627         {
   4628             Encode_EscrowData(x->escrowentry + i, stream);
   4629         }
   4630     }
   4631     /* ------------------------------- */
   4632     /* ---- Extension Begins Here ---- */
   4633     /* ------------------------------- */
   4634 }
   4635 
   4636 /* <=====================================> */
   4637 /*  PER-Encoder for EscrowData (SEQUENCE)  */
   4638 /* <=====================================> */
   4639 void Encode_EscrowData(PS_EscrowData x, PS_OutStream stream)
   4640 {
   4641     PutBoolean(0, stream); /* Extension Bit OFF */
   4642     PutObjectID(&x->escrowID, stream);
   4643     PutBitString(0, 1, 65535, &x->escrowValue, stream);
   4644     /* ------------------------------- */
   4645     /* ---- Extension Begins Here ---- */
   4646     /* ------------------------------- */
   4647 }
   4648 
   4649 /* <================================================> */
   4650 /*  PER-Encoder for OpenLogicalChannelAck (SEQUENCE)  */
   4651 /* <================================================> */
   4652 void Encode_OpenLogicalChannelAck(PS_OpenLogicalChannelAck x, PS_OutStream stream)
   4653 {
   4654     uint32 extension;
   4655 
   4656     extension = x->option_of_separateStack |
   4657                 x->option_of_forwardMultiplexAckParameters |
   4658                 x->option_of_encryptionSync;
   4659     PutBoolean(extension, stream);
   4660 
   4661     PutBoolean(x->option_of_ackReverseLogicalChannelParameters, stream);
   4662     PutInteger(1, 65535, (uint32)x->forwardLogicalChannelNumber, stream);
   4663     if (x->option_of_ackReverseLogicalChannelParameters)
   4664     {
   4665         Encode_AckReverseLogicalChannelParameters(&x->ackReverseLogicalChannelParameters, stream);
   4666     }
   4667     /* ------------------------------- */
   4668     /* ---- Extension Begins Here ---- */
   4669     /* ------------------------------- */
   4670     if (!extension) return; /* (No items present?) */
   4671     PutNormSmallLength(3, stream); /* Begin Options Map */
   4672     PutBoolean(x->option_of_separateStack, stream);
   4673     PutBoolean(x->option_of_forwardMultiplexAckParameters, stream);
   4674     PutBoolean(x->option_of_encryptionSync, stream);
   4675     if (x->option_of_separateStack)
   4676     {
   4677         PutExtensionItem(EPASS Encode_NetworkAccessParameters, (uint8*)&x->separateStack, stream);
   4678     }
   4679     if (x->option_of_forwardMultiplexAckParameters)
   4680     {
   4681         PutExtensionItem(EPASS Encode_ForwardMultiplexAckParameters, (uint8*)&x->forwardMultiplexAckParameters, stream);
   4682     }
   4683     if (x->option_of_encryptionSync)
   4684     {
   4685         PutExtensionItem(EPASS Encode_EncryptionSync, (uint8*)&x->encryptionSync, stream);
   4686     }
   4687 }
   4688 
   4689 /* <======================================================> */
   4690 /*  PER-Encoder for ForwardMultiplexAckParameters (CHOICE)  */
   4691 /* <======================================================> */
   4692 void Encode_ForwardMultiplexAckParameters(PS_ForwardMultiplexAckParameters x, PS_OutStream stream)
   4693 {
   4694     PutChoiceIndex(1, 1, x->index, stream);
   4695     switch (x->index)
   4696     {
   4697         case 0:
   4698             Encode_H2250LogicalChannelAckParameters(x->h2250LogicalChannelAckParameters, stream);
   4699             break;
   4700             /* ------------------------------- */
   4701             /* ---- Extension Begins Here ---- */
   4702             /* ------------------------------- */
   4703         default:
   4704             ErrorMessageAndLeave("Encode_ForwardMultiplexAckParameters: Illegal CHOICE index");
   4705     }
   4706 }
   4707 
   4708 /* <=============================================================> */
   4709 /*  PER-Encoder for AckReverseLogicalChannelParameters (SEQUENCE)  */
   4710 /* <=============================================================> */
   4711 void Encode_AckReverseLogicalChannelParameters(PS_AckReverseLogicalChannelParameters x, PS_OutStream stream)
   4712 {
   4713     uint32 extension;
   4714 
   4715     extension = x->option_of_replacementFor;
   4716     PutBoolean(extension, stream);
   4717 
   4718     PutBoolean(x->option_of_portNumber, stream);
   4719     PutBoolean(x->option_of_ackMultiplexParameters, stream);
   4720     PutInteger(1, 65535, (uint32)x->reverseLogicalChannelNumber, stream);
   4721     if (x->option_of_portNumber)
   4722     {
   4723         PutInteger(0, 65535, (uint32)x->portNumber, stream);
   4724     }
   4725     if (x->option_of_ackMultiplexParameters)
   4726     {
   4727         Encode_AckMultiplexParameters(&x->ackMultiplexParameters, stream);
   4728     }
   4729     /* ------------------------------- */
   4730     /* ---- Extension Begins Here ---- */
   4731     /* ------------------------------- */
   4732     if (!extension) return; /* (No items present?) */
   4733     PutNormSmallLength(1, stream); /* Begin Options Map */
   4734     PutBoolean(x->option_of_replacementFor, stream);
   4735     if (x->option_of_replacementFor)
   4736     {
   4737         PutExtensionInteger(1, 65535, (uint32)x->replacementFor, stream);
   4738     }
   4739 }
   4740 
   4741 /* <===============================================> */
   4742 /*  PER-Encoder for AckMultiplexParameters (CHOICE)  */
   4743 /* <===============================================> */
   4744 void Encode_AckMultiplexParameters(PS_AckMultiplexParameters x, PS_OutStream stream)
   4745 {
   4746     PutChoiceIndex(1, 1, x->index, stream);
   4747     switch (x->index)
   4748     {
   4749         case 0:
   4750             Encode_H222LogicalChannelParameters(x->h222LogicalChannelParameters, stream);
   4751             break;
   4752             /* ------------------------------- */
   4753             /* ---- Extension Begins Here ---- */
   4754             /* ------------------------------- */
   4755         case 1:
   4756             PutExtensionItem(EPASS Encode_H2250LogicalChannelParameters, (uint8*)x->h2250LogicalChannelParameters, stream);
   4757             break;
   4758         default:
   4759             ErrorMessageAndLeave("Encode_AckMultiplexParameters: Illegal CHOICE index");
   4760     }
   4761 }
   4762 
   4763 /* <===================================================> */
   4764 /*  PER-Encoder for OpenLogicalChannelReject (SEQUENCE)  */
   4765 /* <===================================================> */
   4766 void Encode_OpenLogicalChannelReject(PS_OpenLogicalChannelReject x, PS_OutStream stream)
   4767 {
   4768     PutBoolean(0, stream); /* Extension Bit OFF */
   4769     PutInteger(1, 65535, (uint32)x->forwardLogicalChannelNumber, stream);
   4770     Encode_OlcRejectCause(&x->olcRejectCause, stream);
   4771     /* ------------------------------- */
   4772     /* ---- Extension Begins Here ---- */
   4773     /* ------------------------------- */
   4774 }
   4775 
   4776 /* <=======================================> */
   4777 /*  PER-Encoder for OlcRejectCause (CHOICE)  */
   4778 /* <=======================================> */
   4779 void Encode_OlcRejectCause(PS_OlcRejectCause x, PS_OutStream stream)
   4780 {
   4781     PutChoiceIndex(6, 1, x->index, stream);
   4782     switch (x->index)
   4783     {
   4784         case 0:
   4785             /* (unspecified is NULL) */
   4786             break;
   4787         case 1:
   4788             /* (unsuitableReverseParameters is NULL) */
   4789             break;
   4790         case 2:
   4791             /* (dataTypeNotSupported is NULL) */
   4792             break;
   4793         case 3:
   4794             /* (dataTypeNotAvailable is NULL) */
   4795             break;
   4796         case 4:
   4797             /* (unknownDataType is NULL) */
   4798             break;
   4799         case 5:
   4800             /* (dataTypeALCombinationNotSupported is NULL) */
   4801             break;
   4802             /* ------------------------------- */
   4803             /* ---- Extension Begins Here ---- */
   4804             /* ------------------------------- */
   4805         case 6:
   4806             PutExtensionNull(stream);
   4807             break;
   4808         case 7:
   4809             PutExtensionNull(stream);
   4810             break;
   4811         case 8:
   4812             PutExtensionNull(stream);
   4813             break;
   4814         case 9:
   4815             PutExtensionNull(stream);
   4816             break;
   4817         case 10:
   4818             PutExtensionNull(stream);
   4819             break;
   4820         case 11:
   4821             PutExtensionNull(stream);
   4822             break;
   4823         case 12:
   4824             PutExtensionNull(stream);
   4825             break;
   4826         case 13:
   4827             PutExtensionNull(stream);
   4828             break;
   4829         default:
   4830             ErrorMessageAndLeave("Encode_OlcRejectCause: Illegal CHOICE index");
   4831     }
   4832 }
   4833 
   4834 /* <====================================================> */
   4835 /*  PER-Encoder for OpenLogicalChannelConfirm (SEQUENCE)  */
   4836 /* <====================================================> */
   4837 void Encode_OpenLogicalChannelConfirm(PS_OpenLogicalChannelConfirm x, PS_OutStream stream)
   4838 {
   4839     PutBoolean(0, stream); /* Extension Bit OFF */
   4840     PutInteger(1, 65535, (uint32)x->forwardLogicalChannelNumber, stream);
   4841     /* ------------------------------- */
   4842     /* ---- Extension Begins Here ---- */
   4843     /* ------------------------------- */
   4844 }
   4845 
   4846 /* <===========================================================> */
   4847 /*  PER-Encoder for H2250LogicalChannelAckParameters (SEQUENCE)  */
   4848 /* <===========================================================> */
   4849 void Encode_H2250LogicalChannelAckParameters(PS_H2250LogicalChannelAckParameters x, PS_OutStream stream)
   4850 {
   4851     uint16 i;
   4852     uint32 extension;
   4853 
   4854     extension = x->option_of_flowControlToZero |
   4855                 x->option_of_portNumber;
   4856     PutBoolean(extension, stream);
   4857 
   4858     PutBoolean(x->option_of_nonStandard, stream);
   4859     PutBoolean(x->option_of_sessionID, stream);
   4860     PutBoolean(x->option_of_mediaChannel, stream);
   4861     PutBoolean(x->option_of_mediaControlChannel, stream);
   4862     PutBoolean(x->option_of_dynamicRTPPayloadType, stream);
   4863     if (x->option_of_nonStandard)
   4864     {
   4865         PutLengthDet(x->size_of_nonStandard, stream);
   4866         for (i = 0; i < x->size_of_nonStandard; ++i)
   4867         {
   4868             Encode_NonStandardParameter(x->nonStandard + i, stream);
   4869         }
   4870     }
   4871     if (x->option_of_sessionID)
   4872     {
   4873         PutInteger(1, 255, (uint32)x->sessionID, stream);
   4874     }
   4875     if (x->option_of_mediaChannel)
   4876     {
   4877         Encode_TransportAddress(&x->mediaChannel, stream);
   4878     }
   4879     if (x->option_of_mediaControlChannel)
   4880     {
   4881         Encode_TransportAddress(&x->mediaControlChannel, stream);
   4882     }
   4883     if (x->option_of_dynamicRTPPayloadType)
   4884     {
   4885         PutInteger(96, 127, (uint32)x->dynamicRTPPayloadType, stream);
   4886     }
   4887     /* ------------------------------- */
   4888     /* ---- Extension Begins Here ---- */
   4889     /* ------------------------------- */
   4890     if (!extension) return; /* (No items present?) */
   4891     PutNormSmallLength(2, stream); /* Begin Options Map */
   4892     PutBoolean(x->option_of_flowControlToZero, stream);
   4893     PutBoolean(x->option_of_portNumber, stream);
   4894     if (x->option_of_flowControlToZero)
   4895     {
   4896         PutExtensionBoolean(x->flowControlToZero, stream);
   4897     }
   4898     if (x->option_of_portNumber)
   4899     {
   4900         PutExtensionInteger(0, 65535, (uint32)x->portNumber, stream);
   4901     }
   4902 }
   4903 
   4904 /* <==============================================> */
   4905 /*  PER-Encoder for CloseLogicalChannel (SEQUENCE)  */
   4906 /* <==============================================> */
   4907 void Encode_CloseLogicalChannel(PS_CloseLogicalChannel x, PS_OutStream stream)
   4908 {
   4909     uint32 extension;
   4910 
   4911     extension = x->option_of_reason;
   4912     PutBoolean(extension, stream);
   4913 
   4914     PutInteger(1, 65535, (uint32)x->forwardLogicalChannelNumber, stream);
   4915     Encode_Source(&x->source, stream);
   4916     /* ------------------------------- */
   4917     /* ---- Extension Begins Here ---- */
   4918     /* ------------------------------- */
   4919     if (!extension) return; /* (No items present?) */
   4920     PutNormSmallLength(1, stream); /* Begin Options Map */
   4921     PutBoolean(x->option_of_reason, stream);
   4922     if (x->option_of_reason)
   4923     {
   4924         PutExtensionItem(EPASS Encode_Reason, (uint8*)&x->reason, stream);
   4925     }
   4926 }
   4927 
   4928 /* <===============================> */
   4929 /*  PER-Encoder for Reason (CHOICE)  */
   4930 /* <===============================> */
   4931 void Encode_Reason(PS_Reason x, PS_OutStream stream)
   4932 {
   4933     PutChoiceIndex(3, 1, x->index, stream);
   4934     switch (x->index)
   4935     {
   4936         case 0:
   4937             /* (unknown is NULL) */
   4938             break;
   4939         case 1:
   4940             /* (reopen is NULL) */
   4941             break;
   4942         case 2:
   4943             /* (reservationFailure is NULL) */
   4944             break;
   4945             /* ------------------------------- */
   4946             /* ---- Extension Begins Here ---- */
   4947             /* ------------------------------- */
   4948         default:
   4949             ErrorMessageAndLeave("Encode_Reason: Illegal CHOICE index");
   4950     }
   4951 }
   4952 
   4953 /* <===============================> */
   4954 /*  PER-Encoder for Source (CHOICE)  */
   4955 /* <===============================> */
   4956 void Encode_Source(PS_Source x, PS_OutStream stream)
   4957 {
   4958     PutChoiceIndex(2, 0, x->index, stream);
   4959     switch (x->index)
   4960     {
   4961         case 0:
   4962             /* (user is NULL) */
   4963             break;
   4964         case 1:
   4965             /* (lcse is NULL) */
   4966             break;
   4967         default:
   4968             ErrorMessageAndLeave("Encode_Source: Illegal CHOICE index");
   4969     }
   4970 }
   4971 
   4972 /* <=================================================> */
   4973 /*  PER-Encoder for CloseLogicalChannelAck (SEQUENCE)  */
   4974 /* <=================================================> */
   4975 void Encode_CloseLogicalChannelAck(PS_CloseLogicalChannelAck x, PS_OutStream stream)
   4976 {
   4977     PutBoolean(0, stream); /* Extension Bit OFF */
   4978     PutInteger(1, 65535, (uint32)x->forwardLogicalChannelNumber, stream);
   4979     /* ------------------------------- */
   4980     /* ---- Extension Begins Here ---- */
   4981     /* ------------------------------- */
   4982 }
   4983 
   4984 /* <==============================================> */
   4985 /*  PER-Encoder for RequestChannelClose (SEQUENCE)  */
   4986 /* <==============================================> */
   4987 void Encode_RequestChannelClose(PS_RequestChannelClose x, PS_OutStream stream)
   4988 {
   4989     uint32 extension;
   4990 
   4991     extension = x->option_of_qosCapability |
   4992                 x->option_of_rccReason;
   4993     PutBoolean(extension, stream);
   4994 
   4995     PutInteger(1, 65535, (uint32)x->forwardLogicalChannelNumber, stream);
   4996     /* ------------------------------- */
   4997     /* ---- Extension Begins Here ---- */
   4998     /* ------------------------------- */
   4999     if (!extension) return; /* (No items present?) */
   5000     PutNormSmallLength(2, stream); /* Begin Options Map */
   5001     PutBoolean(x->option_of_qosCapability, stream);
   5002     PutBoolean(x->option_of_rccReason, stream);
   5003     if (x->option_of_qosCapability)
   5004     {
   5005         PutExtensionItem(EPASS Encode_QOSCapability, (uint8*)&x->qosCapability, stream);
   5006     }
   5007     if (x->option_of_rccReason)
   5008     {
   5009         PutExtensionItem(EPASS Encode_RccReason, (uint8*)&x->rccReason, stream);
   5010     }
   5011 }
   5012 
   5013 /* <==================================> */
   5014 /*  PER-Encoder for RccReason (CHOICE)  */
   5015 /* <==================================> */
   5016 void Encode_RccReason(PS_RccReason x, PS_OutStream stream)
   5017 {
   5018     PutChoiceIndex(4, 1, x->index, stream);
   5019     switch (x->index)
   5020     {
   5021         case 0:
   5022             /* (unknown is NULL) */
   5023             break;
   5024         case 1:
   5025             /* (normal is NULL) */
   5026             break;
   5027         case 2:
   5028             /* (reopen is NULL) */
   5029             break;
   5030         case 3:
   5031             /* (reservationFailure is NULL) */
   5032             break;
   5033             /* ------------------------------- */
   5034             /* ---- Extension Begins Here ---- */
   5035             /* ------------------------------- */
   5036         default:
   5037             ErrorMessageAndLeave("Encode_RccReason: Illegal CHOICE index");
   5038     }
   5039 }
   5040 
   5041 /* <=================================================> */
   5042 /*  PER-Encoder for RequestChannelCloseAck (SEQUENCE)  */
   5043 /* <=================================================> */
   5044 void Encode_RequestChannelCloseAck(PS_RequestChannelCloseAck x, PS_OutStream stream)
   5045 {
   5046     PutBoolean(0, stream); /* Extension Bit OFF */
   5047     PutInteger(1, 65535, (uint32)x->forwardLogicalChannelNumber, stream);
   5048     /* ------------------------------- */
   5049     /* ---- Extension Begins Here ---- */
   5050     /* ------------------------------- */
   5051 }
   5052 
   5053 /* <====================================================> */
   5054 /*  PER-Encoder for RequestChannelCloseReject (SEQUENCE)  */
   5055 /* <====================================================> */
   5056 void Encode_RequestChannelCloseReject(PS_RequestChannelCloseReject x, PS_OutStream stream)
   5057 {
   5058     PutBoolean(0, stream); /* Extension Bit OFF */
   5059     PutInteger(1, 65535, (uint32)x->forwardLogicalChannelNumber, stream);
   5060     Encode_RccRejectCause(&x->rccRejectCause, stream);
   5061     /* ------------------------------- */
   5062     /* ---- Extension Begins Here ---- */
   5063     /* ------------------------------- */
   5064 }
   5065 
   5066 /* <=======================================> */
   5067 /*  PER-Encoder for RccRejectCause (CHOICE)  */
   5068 /* <=======================================> */
   5069 void Encode_RccRejectCause(PS_RccRejectCause x, PS_OutStream stream)
   5070 {
   5071     PutChoiceIndex(1, 1, x->index, stream);
   5072     switch (x->index)
   5073     {
   5074         case 0:
   5075             /* (unspecified is NULL) */
   5076             break;
   5077             /* ------------------------------- */
   5078             /* ---- Extension Begins Here ---- */
   5079             /* ------------------------------- */
   5080         default:
   5081             ErrorMessageAndLeave("Encode_RccRejectCause: Illegal CHOICE index");
   5082     }
   5083 }
   5084 
   5085 /* <=====================================================> */
   5086 /*  PER-Encoder for RequestChannelCloseRelease (SEQUENCE)  */
   5087 /* <=====================================================> */
   5088 void Encode_RequestChannelCloseRelease(PS_RequestChannelCloseRelease x, PS_OutStream stream)
   5089 {
   5090     PutBoolean(0, stream); /* Extension Bit OFF */
   5091     PutInteger(1, 65535, (uint32)x->forwardLogicalChannelNumber, stream);
   5092     /* ------------------------------- */
   5093     /* ---- Extension Begins Here ---- */
   5094     /* ------------------------------- */
   5095 }
   5096 
   5097 /* <=============================================> */
   5098 /*  PER-Encoder for MultiplexEntrySend (SEQUENCE)  */
   5099 /* <=============================================> */
   5100 void Encode_MultiplexEntrySend(PS_MultiplexEntrySend x, PS_OutStream stream)
   5101 {
   5102     uint16 i;
   5103     PutBoolean(0, stream); /* Extension Bit OFF */
   5104     PutInteger(0, 255, (uint32)x->sequenceNumber, stream);
   5105     PutInteger(1, 15, (uint32)x->size_of_multiplexEntryDescriptors, stream);
   5106     for (i = 0; i < x->size_of_multiplexEntryDescriptors; ++i)
   5107     {
   5108         Encode_MultiplexEntryDescriptor(x->multiplexEntryDescriptors + i, stream);
   5109     }
   5110     /* ------------------------------- */
   5111     /* ---- Extension Begins Here ---- */
   5112     /* ------------------------------- */
   5113 }
   5114 
   5115 /* <===================================================> */
   5116 /*  PER-Encoder for MultiplexEntryDescriptor (SEQUENCE)  */
   5117 /* <===================================================> */
   5118 void Encode_MultiplexEntryDescriptor(PS_MultiplexEntryDescriptor x, PS_OutStream stream)
   5119 {
   5120     uint16 i;
   5121     PutBoolean(x->option_of_elementList, stream);
   5122     PutInteger(1, 15, (uint32)x->multiplexTableEntryNumber, stream);
   5123     if (x->option_of_elementList)
   5124     {
   5125         PutInteger(1, 256, (uint32)x->size_of_elementList, stream);
   5126         for (i = 0; i < x->size_of_elementList; ++i)
   5127         {
   5128             Encode_MultiplexElement(x->elementList + i, stream);
   5129         }
   5130     }
   5131 }
   5132 
   5133 /* <===========================================> */
   5134 /*  PER-Encoder for MultiplexElement (SEQUENCE)  */
   5135 /* <===========================================> */
   5136 void Encode_MultiplexElement(PS_MultiplexElement x, PS_OutStream stream)
   5137 {
   5138     Encode_MuxType(&x->muxType, stream);
   5139     Encode_RepeatCount(&x->repeatCount, stream);
   5140 }
   5141 
   5142 /* <====================================> */
   5143 /*  PER-Encoder for RepeatCount (CHOICE)  */
   5144 /* <====================================> */
   5145 void Encode_RepeatCount(PS_RepeatCount x, PS_OutStream stream)
   5146 {
   5147     PutChoiceIndex(2, 0, x->index, stream);
   5148     switch (x->index)
   5149     {
   5150         case 0:
   5151             PutInteger(1, 65535, (uint32)x->finite, stream);
   5152             break;
   5153         case 1:
   5154             /* (untilClosingFlag is NULL) */
   5155             break;
   5156         default:
   5157             ErrorMessageAndLeave("Encode_RepeatCount: Illegal CHOICE index");
   5158     }
   5159 }
   5160 
   5161 /* <================================> */
   5162 /*  PER-Encoder for MuxType (CHOICE)  */
   5163 /* <================================> */
   5164 void Encode_MuxType(PS_MuxType x, PS_OutStream stream)
   5165 {
   5166     uint16 i;
   5167     PutChoiceIndex(2, 0, x->index, stream);
   5168     switch (x->index)
   5169     {
   5170         case 0:
   5171             PutInteger(0, 65535, (uint32)x->logicalChannelNumber, stream);
   5172             break;
   5173         case 1:
   5174             PutInteger(2, 255, (uint32)x->size, stream);
   5175             for (i = 0; i < x->size; ++i)
   5176             {
   5177                 Encode_MultiplexElement(x->subElementList + i, stream);
   5178             }
   5179             break;
   5180         default:
   5181             ErrorMessageAndLeave("Encode_MuxType: Illegal CHOICE index");
   5182     }
   5183 }
   5184 
   5185 /* <================================================> */
   5186 /*  PER-Encoder for MultiplexEntrySendAck (SEQUENCE)  */
   5187 /* <================================================> */
   5188 void Encode_MultiplexEntrySendAck(PS_MultiplexEntrySendAck x, PS_OutStream stream)
   5189 {
   5190     uint16 i;
   5191     PutBoolean(0, stream); /* Extension Bit OFF */
   5192     PutInteger(0, 255, (uint32)x->sequenceNumber, stream);
   5193     PutInteger(1, 15, (uint32)x->size_of_multiplexTableEntryNumber, stream);
   5194     for (i = 0; i < x->size_of_multiplexTableEntryNumber; ++i)
   5195     {
   5196         PutInteger(1, 15, (uint32)x->multiplexTableEntryNumber[i], stream);
   5197     }
   5198     /* ------------------------------- */
   5199     /* ---- Extension Begins Here ---- */
   5200     /* ------------------------------- */
   5201 }
   5202 
   5203 /* <===================================================> */
   5204 /*  PER-Encoder for MultiplexEntrySendReject (SEQUENCE)  */
   5205 /* <===================================================> */
   5206 void Encode_MultiplexEntrySendReject(PS_MultiplexEntrySendReject x, PS_OutStream stream)
   5207 {
   5208     uint16 i;
   5209     PutBoolean(0, stream); /* Extension Bit OFF */
   5210     PutInteger(0, 255, (uint32)x->sequenceNumber, stream);
   5211     PutInteger(1, 15, (uint32)x->size_of_rejectionDescriptions, stream);
   5212     for (i = 0; i < x->size_of_rejectionDescriptions; ++i)
   5213     {
   5214         Encode_MultiplexEntryRejectionDescriptions(x->rejectionDescriptions + i, stream);
   5215     }
   5216     /* ------------------------------- */
   5217     /* ---- Extension Begins Here ---- */
   5218     /* ------------------------------- */
   5219 }
   5220 
   5221 /* <==============================================================> */
   5222 /*  PER-Encoder for MultiplexEntryRejectionDescriptions (SEQUENCE)  */
   5223 /* <==============================================================> */
   5224 void Encode_MultiplexEntryRejectionDescriptions(PS_MultiplexEntryRejectionDescriptions x, PS_OutStream stream)
   5225 {
   5226     PutBoolean(0, stream); /* Extension Bit OFF */
   5227     PutInteger(1, 15, (uint32)x->multiplexTableEntryNumber, stream);
   5228     Encode_MeRejectCause(&x->meRejectCause, stream);
   5229     /* ------------------------------- */
   5230     /* ---- Extension Begins Here ---- */
   5231     /* ------------------------------- */
   5232 }
   5233 
   5234 /* <======================================> */
   5235 /*  PER-Encoder for MeRejectCause (CHOICE)  */
   5236 /* <======================================> */
   5237 void Encode_MeRejectCause(PS_MeRejectCause x, PS_OutStream stream)
   5238 {
   5239     PutChoiceIndex(2, 1, x->index, stream);
   5240     switch (x->index)
   5241     {
   5242         case 0:
   5243             /* (unspecifiedCause is NULL) */
   5244             break;
   5245         case 1:
   5246             /* (descriptorTooComplex is NULL) */
   5247             break;
   5248             /* ------------------------------- */
   5249             /* ---- Extension Begins Here ---- */
   5250             /* ------------------------------- */
   5251         default:
   5252             ErrorMessageAndLeave("Encode_MeRejectCause: Illegal CHOICE index");
   5253     }
   5254 }
   5255 
   5256 /* <====================================================> */
   5257 /*  PER-Encoder for MultiplexEntrySendRelease (SEQUENCE)  */
   5258 /* <====================================================> */
   5259 void Encode_MultiplexEntrySendRelease(PS_MultiplexEntrySendRelease x, PS_OutStream stream)
   5260 {
   5261     uint16 i;
   5262     PutBoolean(0, stream); /* Extension Bit OFF */
   5263     PutInteger(1, 15, (uint32)x->size_of_multiplexTableEntryNumber, stream);
   5264     for (i = 0; i < x->size_of_multiplexTableEntryNumber; ++i)
   5265     {
   5266         PutInteger(1, 15, (uint32)x->multiplexTableEntryNumber[i], stream);
   5267     }
   5268     /* ------------------------------- */
   5269     /* ---- Extension Begins Here ---- */
   5270     /* ------------------------------- */
   5271 }
   5272 
   5273 /* <================================================> */
   5274 /*  PER-Encoder for RequestMultiplexEntry (SEQUENCE)  */
   5275 /* <================================================> */
   5276 void Encode_RequestMultiplexEntry(PS_RequestMultiplexEntry x, PS_OutStream stream)
   5277 {
   5278     uint16 i;
   5279     PutBoolean(0, stream); /* Extension Bit OFF */
   5280     PutInteger(1, 15, (uint32)x->size_of_entryNumbers, stream);
   5281     for (i = 0; i < x->size_of_entryNumbers; ++i)
   5282     {
   5283         PutInteger(1, 15, (uint32)x->entryNumbers[i], stream);
   5284     }
   5285     /* ------------------------------- */
   5286     /* ---- Extension Begins Here ---- */
   5287     /* ------------------------------- */
   5288 }
   5289 
   5290 /* <===================================================> */
   5291 /*  PER-Encoder for RequestMultiplexEntryAck (SEQUENCE)  */
   5292 /* <===================================================> */
   5293 void Encode_RequestMultiplexEntryAck(PS_RequestMultiplexEntryAck x, PS_OutStream stream)
   5294 {
   5295     uint16 i;
   5296     PutBoolean(0, stream); /* Extension Bit OFF */
   5297     PutInteger(1, 15, (uint32)x->size_of_entryNumbers, stream);
   5298     for (i = 0; i < x->size_of_entryNumbers; ++i)
   5299     {
   5300         PutInteger(1, 15, (uint32)x->entryNumbers[i], stream);
   5301     }
   5302     /* ------------------------------- */
   5303     /* ---- Extension Begins Here ---- */
   5304     /* ------------------------------- */
   5305 }
   5306 
   5307 /* <======================================================> */
   5308 /*  PER-Encoder for RequestMultiplexEntryReject (SEQUENCE)  */
   5309 /* <======================================================> */
   5310 void Encode_RequestMultiplexEntryReject(PS_RequestMultiplexEntryReject x, PS_OutStream stream)
   5311 {
   5312     uint16 i;
   5313     PutBoolean(0, stream); /* Extension Bit OFF */
   5314     PutInteger(1, 15, (uint32)x->size_of_entryNumbers, stream);
   5315     for (i = 0; i < x->size_of_entryNumbers; ++i)
   5316     {
   5317         PutInteger(1, 15, (uint32)x->entryNumbers[i], stream);
   5318     }
   5319     PutInteger(1, 15, (uint32)x->size_of_rejectionDescriptions, stream);
   5320     for (i = 0; i < x->size_of_rejectionDescriptions; ++i)
   5321     {
   5322         Encode_RequestMultiplexEntryRejectionDescriptions(x->rejectionDescriptions + i, stream);
   5323     }
   5324     /* ------------------------------- */
   5325     /* ---- Extension Begins Here ---- */
   5326     /* ------------------------------- */
   5327 }
   5328 
   5329 /* <=====================================================================> */
   5330 /*  PER-Encoder for RequestMultiplexEntryRejectionDescriptions (SEQUENCE)  */
   5331 /* <=====================================================================> */
   5332 void Encode_RequestMultiplexEntryRejectionDescriptions(PS_RequestMultiplexEntryRejectionDescriptions x, PS_OutStream stream)
   5333 {
   5334     PutBoolean(0, stream); /* Extension Bit OFF */
   5335     PutInteger(1, 15, (uint32)x->multiplexTableEntryNumber, stream);
   5336     Encode_RmeRejectCause(&x->rmeRejectCause, stream);
   5337     /* ------------------------------- */
   5338     /* ---- Extension Begins Here ---- */
   5339     /* ------------------------------- */
   5340 }
   5341 
   5342 /* <=======================================> */
   5343 /*  PER-Encoder for RmeRejectCause (CHOICE)  */
   5344 /* <=======================================> */
   5345 void Encode_RmeRejectCause(PS_RmeRejectCause x, PS_OutStream stream)
   5346 {
   5347     PutChoiceIndex(1, 1, x->index, stream);
   5348     switch (x->index)
   5349     {
   5350         case 0:
   5351             /* (unspecifiedCause is NULL) */
   5352             break;
   5353             /* ------------------------------- */
   5354             /* ---- Extension Begins Here ---- */
   5355             /* ------------------------------- */
   5356         default:
   5357             ErrorMessageAndLeave("Encode_RmeRejectCause: Illegal CHOICE index");
   5358     }
   5359 }
   5360 
   5361 /* <=======================================================> */
   5362 /*  PER-Encoder for RequestMultiplexEntryRelease (SEQUENCE)  */
   5363 /* <=======================================================> */
   5364 void Encode_RequestMultiplexEntryRelease(PS_RequestMultiplexEntryRelease x, PS_OutStream stream)
   5365 {
   5366     uint16 i;
   5367     PutBoolean(0, stream); /* Extension Bit OFF */
   5368     PutInteger(1, 15, (uint32)x->size_of_entryNumbers, stream);
   5369     for (i = 0; i < x->size_of_entryNumbers; ++i)
   5370     {
   5371         PutInteger(1, 15, (uint32)x->entryNumbers[i], stream);
   5372     }
   5373     /* ------------------------------- */
   5374     /* ---- Extension Begins Here ---- */
   5375     /* ------------------------------- */
   5376 }
   5377 
   5378 /* <======================================> */
   5379 /*  PER-Encoder for RequestMode (SEQUENCE)  */
   5380 /* <======================================> */
   5381 void Encode_RequestMode(PS_RequestMode x, PS_OutStream stream)
   5382 {
   5383     uint16 i;
   5384     PutBoolean(0, stream); /* Extension Bit OFF */
   5385     PutInteger(0, 255, (uint32)x->sequenceNumber, stream);
   5386     PutInteger(1, 256, (uint32)x->size_of_requestedModes, stream);
   5387     for (i = 0; i < x->size_of_requestedModes; ++i)
   5388     {
   5389         Encode_ModeDescription(x->requestedModes + i, stream);
   5390     }
   5391     /* ------------------------------- */
   5392     /* ---- Extension Begins Here ---- */
   5393     /* ------------------------------- */
   5394 }
   5395 
   5396 /* <=========================================> */
   5397 /*  PER-Encoder for RequestModeAck (SEQUENCE)  */
   5398 /* <=========================================> */
   5399 void Encode_RequestModeAck(PS_RequestModeAck x, PS_OutStream stream)
   5400 {
   5401     PutBoolean(0, stream); /* Extension Bit OFF */
   5402     PutInteger(0, 255, (uint32)x->sequenceNumber, stream);
   5403     Encode_Response(&x->response, stream);
   5404     /* ------------------------------- */
   5405     /* ---- Extension Begins Here ---- */
   5406     /* ------------------------------- */
   5407 }
   5408 
   5409 /* <=================================> */
   5410 /*  PER-Encoder for Response (CHOICE)  */
   5411 /* <=================================> */
   5412 void Encode_Response(PS_Response x, PS_OutStream stream)
   5413 {
   5414     PutChoiceIndex(2, 1, x->index, stream);
   5415     switch (x->index)
   5416     {
   5417         case 0:
   5418             /* (willTransmitMostPreferredMode is NULL) */
   5419             break;
   5420         case 1:
   5421             /* (willTransmitLessPreferredMode is NULL) */
   5422             break;
   5423             /* ------------------------------- */
   5424             /* ---- Extension Begins Here ---- */
   5425             /* ------------------------------- */
   5426         default:
   5427             ErrorMessageAndLeave("Encode_Response: Illegal CHOICE index");
   5428     }
   5429 }
   5430 
   5431 /* <============================================> */
   5432 /*  PER-Encoder for RequestModeReject (SEQUENCE)  */
   5433 /* <============================================> */
   5434 void Encode_RequestModeReject(PS_RequestModeReject x, PS_OutStream stream)
   5435 {
   5436     PutBoolean(0, stream); /* Extension Bit OFF */
   5437     PutInteger(0, 255, (uint32)x->sequenceNumber, stream);
   5438     Encode_RmRejectCause(&x->rmRejectCause, stream);
   5439     /* ------------------------------- */
   5440     /* ---- Extension Begins Here ---- */
   5441     /* ------------------------------- */
   5442 }
   5443 
   5444 /* <======================================> */
   5445 /*  PER-Encoder for RmRejectCause (CHOICE)  */
   5446 /* <======================================> */
   5447 void Encode_RmRejectCause(PS_RmRejectCause x, PS_OutStream stream)
   5448 {
   5449     PutChoiceIndex(3, 1, x->index, stream);
   5450     switch (x->index)
   5451     {
   5452         case 0:
   5453             /* (modeUnavailable is NULL) */
   5454             break;
   5455         case 1:
   5456             /* (multipointConstraint is NULL) */
   5457             break;
   5458         case 2:
   5459             /* (requestDenied is NULL) */
   5460             break;
   5461             /* ------------------------------- */
   5462             /* ---- Extension Begins Here ---- */
   5463             /* ------------------------------- */
   5464         default:
   5465             ErrorMessageAndLeave("Encode_RmRejectCause: Illegal CHOICE index");
   5466     }
   5467 }
   5468 
   5469 /* <=============================================> */
   5470 /*  PER-Encoder for RequestModeRelease (SEQUENCE)  */
   5471 /* <=============================================> */
   5472 void Encode_RequestModeRelease(PS_RequestModeRelease x, PS_OutStream stream)
   5473 {
   5474     OSCL_UNUSED_ARG(x);
   5475     PutBoolean(0, stream); /* Extension Bit OFF */
   5476     /* ------------------------------- */
   5477     /* ---- Extension Begins Here ---- */
   5478     /* ------------------------------- */
   5479 }
   5480 
   5481 /* <========================================> */
   5482 /*  PER-Encoder for ModeDescription (SET-OF)  */
   5483 /* <========================================> */
   5484 void Encode_ModeDescription(PS_ModeDescription x, PS_OutStream stream)
   5485 {
   5486     uint16 i;
   5487     PutInteger(1, 256, (uint32)x->size, stream);
   5488     for (i = 0; i < x->size; ++i)
   5489     {
   5490         Encode_ModeElement(x->item + i, stream);
   5491     }
   5492 }
   5493 
   5494 /* <======================================> */
   5495 /*  PER-Encoder for ModeElement (SEQUENCE)  */
   5496 /* <======================================> */
   5497 void Encode_ModeElement(PS_ModeElement x, PS_OutStream stream)
   5498 {
   5499     uint32 extension;
   5500 
   5501     extension = x->option_of_v76ModeParameters |
   5502                 x->option_of_h2250ModeParameters |
   5503                 x->option_of_genericModeParameters;
   5504     PutBoolean(extension, stream);
   5505 
   5506     PutBoolean(x->option_of_h223ModeParameters, stream);
   5507     Encode_ModeType(&x->modeType, stream);
   5508     if (x->option_of_h223ModeParameters)
   5509     {
   5510         Encode_H223ModeParameters(&x->h223ModeParameters, stream);
   5511     }
   5512     /* ------------------------------- */
   5513     /* ---- Extension Begins Here ---- */
   5514     /* ------------------------------- */
   5515     if (!extension) return; /* (No items present?) */
   5516     PutNormSmallLength(3, stream); /* Begin Options Map */
   5517     PutBoolean(x->option_of_v76ModeParameters, stream);
   5518     PutBoolean(x->option_of_h2250ModeParameters, stream);
   5519     PutBoolean(x->option_of_genericModeParameters, stream);
   5520     if (x->option_of_v76ModeParameters)
   5521     {
   5522         PutExtensionItem(EPASS Encode_V76ModeParameters, (uint8*)&x->v76ModeParameters, stream);
   5523     }
   5524     if (x->option_of_h2250ModeParameters)
   5525     {
   5526         PutExtensionItem(EPASS Encode_H2250ModeParameters, (uint8*)&x->h2250ModeParameters, stream);
   5527     }
   5528     if (x->option_of_genericModeParameters)
   5529     {
   5530         PutExtensionItem(EPASS Encode_GenericCapability, (uint8*)&x->genericModeParameters, stream);
   5531     }
   5532 }
   5533 
   5534 /* <=================================> */
   5535 /*  PER-Encoder for ModeType (CHOICE)  */
   5536 /* <=================================> */
   5537 void Encode_ModeType(PS_ModeType x, PS_OutStream stream)
   5538 {
   5539     PutChoiceIndex(5, 1, x->index, stream);
   5540     switch (x->index)
   5541     {
   5542         case 0:
   5543             Encode_NonStandardParameter(x->nonStandard, stream);
   5544             break;
   5545         case 1:
   5546             Encode_VideoMode(x->videoMode, stream);
   5547             break;
   5548         case 2:
   5549             Encode_AudioMode(x->audioMode, stream);
   5550             break;
   5551         case 3:
   5552             Encode_DataMode(x->dataMode, stream);
   5553             break;
   5554         case 4:
   5555             Encode_EncryptionMode(x->encryptionMode, stream);
   5556             break;
   5557             /* ------------------------------- */
   5558             /* ---- Extension Begins Here ---- */
   5559             /* ------------------------------- */
   5560         case 5:
   5561             PutExtensionItem(EPASS Encode_H235Mode, (uint8*)x->h235Mode, stream);
   5562             break;
   5563         default:
   5564             ErrorMessageAndLeave("Encode_ModeType: Illegal CHOICE index");
   5565     }
   5566 }
   5567 
   5568 /* <===================================> */
   5569 /*  PER-Encoder for H235Mode (SEQUENCE)  */
   5570 /* <===================================> */
   5571 void Encode_H235Mode(PS_H235Mode x, PS_OutStream stream)
   5572 {
   5573     PutBoolean(0, stream); /* Extension Bit OFF */
   5574     Encode_EncryptionAuthenticationAndIntegrity(&x->encryptionAuthenticationAndIntegrity, stream);
   5575     Encode_MediaMode(&x->mediaMode, stream);
   5576     /* ------------------------------- */
   5577     /* ---- Extension Begins Here ---- */
   5578     /* ------------------------------- */
   5579 }
   5580 
   5581 /* <==================================> */
   5582 /*  PER-Encoder for MediaMode (CHOICE)  */
   5583 /* <==================================> */
   5584 void Encode_MediaMode(PS_MediaMode x, PS_OutStream stream)
   5585 {
   5586     PutChoiceIndex(4, 1, x->index, stream);
   5587     switch (x->index)
   5588     {
   5589         case 0:
   5590             Encode_NonStandardParameter(x->nonStandard, stream);
   5591             break;
   5592         case 1:
   5593             Encode_VideoMode(x->videoMode, stream);
   5594             break;
   5595         case 2:
   5596             Encode_AudioMode(x->audioMode, stream);
   5597             break;
   5598         case 3:
   5599             Encode_DataMode(x->dataMode, stream);
   5600             break;
   5601             /* ------------------------------- */
   5602             /* ---- Extension Begins Here ---- */
   5603             /* ------------------------------- */
   5604         default:
   5605             ErrorMessageAndLeave("Encode_MediaMode: Illegal CHOICE index");
   5606     }
   5607 }
   5608 
   5609 /* <=============================================> */
   5610 /*  PER-Encoder for H223ModeParameters (SEQUENCE)  */
   5611 /* <=============================================> */
   5612 void Encode_H223ModeParameters(PS_H223ModeParameters x, PS_OutStream stream)
   5613 {
   5614     PutBoolean(0, stream); /* Extension Bit OFF */
   5615     Encode_ModeAdaptationLayerType(&x->modeAdaptationLayerType, stream);
   5616     PutBoolean(x->segmentableFlag, stream);
   5617     /* ------------------------------- */
   5618     /* ---- Extension Begins Here ---- */
   5619     /* ------------------------------- */
   5620 }
   5621 
   5622 /* <================================================> */
   5623 /*  PER-Encoder for ModeAdaptationLayerType (CHOICE)  */
   5624 /* <================================================> */
   5625 void Encode_ModeAdaptationLayerType(PS_ModeAdaptationLayerType x, PS_OutStream stream)
   5626 {
   5627     PutChoiceIndex(6, 1, x->index, stream);
   5628     switch (x->index)
   5629     {
   5630         case 0:
   5631             Encode_NonStandardParameter(x->nonStandard, stream);
   5632             break;
   5633         case 1:
   5634             /* (al1Framed is NULL) */
   5635             break;
   5636         case 2:
   5637             /* (al1NotFramed is NULL) */
   5638             break;
   5639         case 3:
   5640             /* (al2WithoutSequenceNumbers is NULL) */
   5641             break;
   5642         case 4:
   5643             /* (al2WithSequenceNumbers is NULL) */
   5644             break;
   5645         case 5:
   5646             Encode_ModeAl3(x->modeAl3, stream);
   5647             break;
   5648             /* ------------------------------- */
   5649             /* ---- Extension Begins Here ---- */
   5650             /* ------------------------------- */
   5651         case 6:
   5652             PutExtensionItem(EPASS Encode_H223AL1MParameters, (uint8*)x->al1M, stream);
   5653             break;
   5654         case 7:
   5655             PutExtensionItem(EPASS Encode_H223AL2MParameters, (uint8*)x->al2M, stream);
   5656             break;
   5657         case 8:
   5658             PutExtensionItem(EPASS Encode_H223AL3MParameters, (uint8*)x->al3M, stream);
   5659             break;
   5660         default:
   5661             ErrorMessageAndLeave("Encode_ModeAdaptationLayerType: Illegal CHOICE index");
   5662     }
   5663 }
   5664 
   5665 /* <==================================> */
   5666 /*  PER-Encoder for ModeAl3 (SEQUENCE)  */
   5667 /* <==================================> */
   5668 void Encode_ModeAl3(PS_ModeAl3 x, PS_OutStream stream)
   5669 {
   5670     PutInteger(0, 2, (uint32)x->controlFieldOctets, stream);
   5671     PutInteger(0, 16777215, (uint32)x->sendBufferSize, stream);
   5672 }
   5673 
   5674 /* <==========================================> */
   5675 /*  PER-Encoder for V76ModeParameters (CHOICE)  */
   5676 /* <==========================================> */
   5677 void Encode_V76ModeParameters(PS_V76ModeParameters x, PS_OutStream stream)
   5678 {
   5679     PutChoiceIndex(2, 1, x->index, stream);
   5680     switch (x->index)
   5681     {
   5682         case 0:
   5683             /* (suspendResumewAddress is NULL) */
   5684             break;
   5685         case 1:
   5686             /* (suspendResumewoAddress is NULL) */
   5687             break;
   5688             /* ------------------------------- */
   5689             /* ---- Extension Begins Here ---- */
   5690             /* ------------------------------- */
   5691         default:
   5692             ErrorMessageAndLeave("Encode_V76ModeParameters: Illegal CHOICE index");
   5693     }
   5694 }
   5695 
   5696 /* <==============================================> */
   5697 /*  PER-Encoder for H2250ModeParameters (SEQUENCE)  */
   5698 /* <==============================================> */
   5699 void Encode_H2250ModeParameters(PS_H2250ModeParameters x, PS_OutStream stream)
   5700 {
   5701     PutBoolean(0, stream); /* Extension Bit OFF */
   5702     PutBoolean(x->option_of_redundancyEncodingMode, stream);
   5703     if (x->option_of_redundancyEncodingMode)
   5704     {
   5705         Encode_RedundancyEncodingMode(&x->redundancyEncodingMode, stream);
   5706     }
   5707     /* ------------------------------- */
   5708     /* ---- Extension Begins Here ---- */
   5709     /* ------------------------------- */
   5710 }
   5711 
   5712 /* <=================================================> */
   5713 /*  PER-Encoder for RedundancyEncodingMode (SEQUENCE)  */
   5714 /* <=================================================> */
   5715 void Encode_RedundancyEncodingMode(PS_RedundancyEncodingMode x, PS_OutStream stream)
   5716 {
   5717     PutBoolean(0, stream); /* Extension Bit OFF */
   5718     PutBoolean(x->option_of_secondaryEncoding, stream);
   5719     Encode_RedundancyEncodingMethod(&x->redundancyEncodingMethod, stream);
   5720     if (x->option_of_secondaryEncoding)
   5721     {
   5722         Encode_SecondaryEncoding(&x->secondaryEncoding, stream);
   5723     }
   5724     /* ------------------------------- */
   5725     /* ---- Extension Begins Here ---- */
   5726     /* ------------------------------- */
   5727 }
   5728 
   5729 /* <==========================================> */
   5730 /*  PER-Encoder for SecondaryEncoding (CHOICE)  */
   5731 /* <==========================================> */
   5732 void Encode_SecondaryEncoding(PS_SecondaryEncoding x, PS_OutStream stream)
   5733 {
   5734     PutChoiceIndex(2, 1, x->index, stream);
   5735     switch (x->index)
   5736     {
   5737         case 0:
   5738             Encode_NonStandardParameter(x->nonStandard, stream);
   5739             break;
   5740         case 1:
   5741             Encode_AudioMode(x->audioData, stream);
   5742             break;
   5743             /* ------------------------------- */
   5744             /* ---- Extension Begins Here ---- */
   5745             /* ------------------------------- */
   5746         default:
   5747             ErrorMessageAndLeave("Encode_SecondaryEncoding: Illegal CHOICE index");
   5748     }
   5749 }
   5750 
   5751 /* <==================================> */
   5752 /*  PER-Encoder for VideoMode (CHOICE)  */
   5753 /* <==================================> */
   5754 void Encode_VideoMode(PS_VideoMode x, PS_OutStream stream)
   5755 {
   5756     PutChoiceIndex(5, 1, x->index, stream);
   5757     switch (x->index)
   5758     {
   5759         case 0:
   5760             Encode_NonStandardParameter(x->nonStandard, stream);
   5761             break;
   5762         case 1:
   5763             Encode_H261VideoMode(x->h261VideoMode, stream);
   5764             break;
   5765         case 2:
   5766             Encode_H262VideoMode(x->h262VideoMode, stream);
   5767             break;
   5768         case 3:
   5769             Encode_H263VideoMode(x->h263VideoMode, stream);
   5770             break;
   5771         case 4:
   5772             Encode_IS11172VideoMode(x->is11172VideoMode, stream);
   5773             break;
   5774             /* ------------------------------- */
   5775             /* ---- Extension Begins Here ---- */
   5776             /* ------------------------------- */
   5777         case 5:
   5778             PutExtensionItem(EPASS Encode_GenericCapability, (uint8*)x->genericVideoMode, stream);
   5779             break;
   5780         default:
   5781             ErrorMessageAndLeave("Encode_VideoMode: Illegal CHOICE index");
   5782     }
   5783 }
   5784 
   5785 /* <========================================> */
   5786 /*  PER-Encoder for H261VideoMode (SEQUENCE)  */
   5787 /* <========================================> */
   5788 void Encode_H261VideoMode(PS_H261VideoMode x, PS_OutStream stream)
   5789 {
   5790     PutBoolean(0, stream); /* Extension Bit OFF */
   5791     Encode_Resolution(&x->resolution, stream);
   5792     PutInteger(1, 19200, (uint32)x->bitRate, stream);
   5793     PutBoolean(x->stillImageTransmission, stream);
   5794     /* ------------------------------- */
   5795     /* ---- Extension Begins Here ---- */
   5796     /* ------------------------------- */
   5797 }
   5798 
   5799 /* <===================================> */
   5800 /*  PER-Encoder for Resolution (CHOICE)  */
   5801 /* <===================================> */
   5802 void Encode_Resolution(PS_Resolution x, PS_OutStream stream)
   5803 {
   5804     PutChoiceIndex(2, 0, x->index, stream);
   5805     switch (x->index)
   5806     {
   5807         case 0:
   5808             /* (qcif is NULL) */
   5809             break;
   5810         case 1:
   5811             /* (cif is NULL) */
   5812             break;
   5813         default:
   5814             ErrorMessageAndLeave("Encode_Resolution: Illegal CHOICE index");
   5815     }
   5816 }
   5817 
   5818 /* <========================================> */
   5819 /*  PER-Encoder for H262VideoMode (SEQUENCE)  */
   5820 /* <========================================> */
   5821 void Encode_H262VideoMode(PS_H262VideoMode x, PS_OutStream stream)
   5822 {
   5823     PutBoolean(0, stream); /* Extension Bit OFF */
   5824     PutBoolean(x->option_of_videoBitRate, stream);
   5825     PutBoolean(x->option_of_vbvBufferSize, stream);
   5826     PutBoolean(x->option_of_samplesPerLine, stream);
   5827     PutBoolean(x->option_of_linesPerFrame, stream);
   5828     PutBoolean(x->option_of_framesPerSecond, stream);
   5829     PutBoolean(x->option_of_luminanceSampleRate, stream);
   5830     Encode_ProfileAndLevel(&x->profileAndLevel, stream);
   5831     if (x->option_of_videoBitRate)
   5832     {
   5833         PutInteger(0, 1073741823, (uint32)x->videoBitRate, stream);
   5834     }
   5835     if (x->option_of_vbvBufferSize)
   5836     {
   5837         PutInteger(0, 262143, (uint32)x->vbvBufferSize, stream);
   5838     }
   5839     if (x->option_of_samplesPerLine)
   5840     {
   5841         PutInteger(0, 16383, (uint32)x->samplesPerLine, stream);
   5842     }
   5843     if (x->option_of_linesPerFrame)
   5844     {
   5845         PutInteger(0, 16383, (uint32)x->linesPerFrame, stream);
   5846     }
   5847     if (x->option_of_framesPerSecond)
   5848     {
   5849         PutInteger(0, 15, (uint32)x->framesPerSecond, stream);
   5850     }
   5851     if (x->option_of_luminanceSampleRate)
   5852     {
   5853         PutInteger(0, 0xffffffff, (uint32)x->luminanceSampleRate, stream);
   5854     }
   5855     /* ------------------------------- */
   5856     /* ---- Extension Begins Here ---- */
   5857     /* ------------------------------- */
   5858 }
   5859 
   5860 /* <========================================> */
   5861 /*  PER-Encoder for ProfileAndLevel (CHOICE)  */
   5862 /* <========================================> */
   5863 void Encode_ProfileAndLevel(PS_ProfileAndLevel x, PS_OutStream stream)
   5864 {
   5865     PutChoiceIndex(11, 1, x->index, stream);
   5866     switch (x->index)
   5867     {
   5868         case 0:
   5869             /* (profileAndLevel_SPatML is NULL) */
   5870             break;
   5871         case 1:
   5872             /* (profileAndLevel_MPatLL is NULL) */
   5873             break;
   5874         case 2:
   5875             /* (profileAndLevel_MPatML is NULL) */
   5876             break;
   5877         case 3:
   5878             /* (profileAndLevel_MPatH_14 is NULL) */
   5879             break;
   5880         case 4:
   5881             /* (profileAndLevel_MPatHL is NULL) */
   5882             break;
   5883         case 5:
   5884             /* (profileAndLevel_SNRatLL is NULL) */
   5885             break;
   5886         case 6:
   5887             /* (profileAndLevel_SNRatML is NULL) */
   5888             break;
   5889         case 7:
   5890             /* (profileAndLevel_SpatialatH_14 is NULL) */
   5891             break;
   5892         case 8:
   5893             /* (profileAndLevel_HPatML is NULL) */
   5894             break;
   5895         case 9:
   5896             /* (profileAndLevel_HPatH_14 is NULL) */
   5897             break;
   5898         case 10:
   5899             /* (profileAndLevel_HPatHL is NULL) */
   5900             break;
   5901             /* ------------------------------- */
   5902             /* ---- Extension Begins Here ---- */
   5903             /* ------------------------------- */
   5904         default:
   5905             ErrorMessageAndLeave("Encode_ProfileAndLevel: Illegal CHOICE index");
   5906     }
   5907 }
   5908 
   5909 /* <========================================> */
   5910 /*  PER-Encoder for H263VideoMode (SEQUENCE)  */
   5911 /* <========================================> */
   5912 void Encode_H263VideoMode(PS_H263VideoMode x, PS_OutStream stream)
   5913 {
   5914     uint32 extension;
   5915 
   5916     extension = x->option_of_errorCompensation |
   5917                 x->option_of_enhancementLayerInfo |
   5918                 x->option_of_h263Options;
   5919     PutBoolean(extension, stream);
   5920 
   5921     Encode_H263Resolution(&x->h263Resolution, stream);
   5922     PutInteger(1, 19200, (uint32)x->bitRate, stream);
   5923     PutBoolean(x->unrestrictedVector, stream);
   5924     PutBoolean(x->arithmeticCoding, stream);
   5925     PutBoolean(x->advancedPrediction, stream);
   5926     PutBoolean(x->pbFrames, stream);
   5927     /* ------------------------------- */
   5928     /* ---- Extension Begins Here ---- */
   5929     /* ------------------------------- */
   5930     if (!extension) return; /* (No items present?) */
   5931     PutNormSmallLength(3, stream); /* Begin Options Map */
   5932     PutBoolean(x->option_of_errorCompensation, stream);
   5933     PutBoolean(x->option_of_enhancementLayerInfo, stream);
   5934     PutBoolean(x->option_of_h263Options, stream);
   5935     if (x->option_of_errorCompensation)
   5936     {
   5937         PutExtensionBoolean(x->errorCompensation, stream);
   5938     }
   5939     if (x->option_of_enhancementLayerInfo)
   5940     {
   5941         PutExtensionItem(EPASS Encode_EnhancementLayerInfo, (uint8*)&x->enhancementLayerInfo, stream);
   5942     }
   5943     if (x->option_of_h263Options)
   5944     {
   5945         PutExtensionItem(EPASS Encode_H263Options, (uint8*)&x->h263Options, stream);
   5946     }
   5947 }
   5948 
   5949 /* <=======================================> */
   5950 /*  PER-Encoder for H263Resolution (CHOICE)  */
   5951 /* <=======================================> */
   5952 void Encode_H263Resolution(PS_H263Resolution x, PS_OutStream stream)
   5953 {
   5954     PutChoiceIndex(5, 1, x->index, stream);
   5955     switch (x->index)
   5956     {
   5957         case 0:
   5958             /* (sqcif is NULL) */
   5959             break;
   5960         case 1:
   5961             /* (qcif is NULL) */
   5962             break;
   5963         case 2:
   5964             /* (cif is NULL) */
   5965             break;
   5966         case 3:
   5967             /* (cif4 is NULL) */
   5968             break;
   5969         case 4:
   5970             /* (cif16 is NULL) */
   5971             break;
   5972             /* ------------------------------- */
   5973             /* ---- Extension Begins Here ---- */
   5974             /* ------------------------------- */
   5975         default:
   5976             ErrorMessageAndLeave("Encode_H263Resolution: Illegal CHOICE index");
   5977     }
   5978 }
   5979 
   5980 /* <===========================================> */
   5981 /*  PER-Encoder for IS11172VideoMode (SEQUENCE)  */
   5982 /* <===========================================> */
   5983 void Encode_IS11172VideoMode(PS_IS11172VideoMode x, PS_OutStream stream)
   5984 {
   5985     PutBoolean(0, stream); /* Extension Bit OFF */
   5986     PutBoolean(x->option_of_videoBitRate, stream);
   5987     PutBoolean(x->option_of_vbvBufferSize, stream);
   5988     PutBoolean(x->option_of_samplesPerLine, stream);
   5989     PutBoolean(x->option_of_linesPerFrame, stream);
   5990     PutBoolean(x->option_of_pictureRate, stream);
   5991     PutBoolean(x->option_of_luminanceSampleRate, stream);
   5992     PutBoolean(x->constrainedBitstream, stream);
   5993     if (x->option_of_videoBitRate)
   5994     {
   5995         PutInteger(0, 1073741823, (uint32)x->videoBitRate, stream);
   5996     }
   5997     if (x->option_of_vbvBufferSize)
   5998     {
   5999         PutInteger(0, 262143, (uint32)x->vbvBufferSize, stream);
   6000     }
   6001     if (x->option_of_samplesPerLine)
   6002     {
   6003         PutInteger(0, 16383, (uint32)x->samplesPerLine, stream);
   6004     }
   6005     if (x->option_of_linesPerFrame)
   6006     {
   6007         PutInteger(0, 16383, (uint32)x->linesPerFrame, stream);
   6008     }
   6009     if (x->option_of_pictureRate)
   6010     {
   6011         PutInteger(0, 15, (uint32)x->pictureRate, stream);
   6012     }
   6013     if (x->option_of_luminanceSampleRate)
   6014     {
   6015         PutInteger(0, 0xffffffff, (uint32)x->luminanceSampleRate, stream);
   6016     }
   6017     /* ------------------------------- */
   6018     /* ---- Extension Begins Here ---- */
   6019     /* ------------------------------- */
   6020 }
   6021 
   6022 /* <==================================> */
   6023 /*  PER-Encoder for AudioMode (CHOICE)  */
   6024 /* <==================================> */
   6025 void Encode_AudioMode(PS_AudioMode x, PS_OutStream stream)
   6026 {
   6027     PutChoiceIndex(14, 1, x->index, stream);
   6028     switch (x->index)
   6029     {
   6030         case 0:
   6031             Encode_NonStandardParameter(x->nonStandard, stream);
   6032             break;
   6033         case 1:
   6034             /* (g711Alaw64k is NULL) */
   6035             break;
   6036         case 2:
   6037             /* (g711Alaw56k is NULL) */
   6038             break;
   6039         case 3:
   6040             /* (g711Ulaw64k is NULL) */
   6041             break;
   6042         case 4:
   6043             /* (g711Ulaw56k is NULL) */
   6044             break;
   6045         case 5:
   6046             /* (g722_64k is NULL) */
   6047             break;
   6048         case 6:
   6049             /* (g722_56k is NULL) */
   6050             break;
   6051         case 7:
   6052             /* (g722_48k is NULL) */
   6053             break;
   6054         case 8:
   6055             /* (g728 is NULL) */
   6056             break;
   6057         case 9:
   6058             /* (g729 is NULL) */
   6059             break;
   6060         case 10:
   6061             /* (g729AnnexA is NULL) */
   6062             break;
   6063         case 11:
   6064             Encode_ModeG7231(x->modeG7231, stream);
   6065             break;
   6066         case 12:
   6067             Encode_IS11172AudioMode(x->is11172AudioMode, stream);
   6068             break;
   6069         case 13:
   6070             Encode_IS13818AudioMode(x->is13818AudioMode, stream);
   6071             break;
   6072             /* ------------------------------- */
   6073             /* ---- Extension Begins Here ---- */
   6074             /* ------------------------------- */
   6075         case 14:
   6076             PutExtensionInteger(1, 256, (uint32)x->g729wAnnexB, stream);
   6077             break;
   6078         case 15:
   6079             PutExtensionInteger(1, 256, (uint32)x->g729AnnexAwAnnexB, stream);
   6080             break;
   6081         case 16:
   6082             PutExtensionItem(EPASS Encode_G7231AnnexCMode, (uint8*)x->g7231AnnexCMode, stream);
   6083             break;
   6084         case 17:
   6085             PutExtensionItem(EPASS Encode_GSMAudioCapability, (uint8*)x->gsmFullRate, stream);
   6086             break;
   6087         case 18:
   6088             PutExtensionItem(EPASS Encode_GSMAudioCapability, (uint8*)x->gsmHalfRate, stream);
   6089             break;
   6090         case 19:
   6091             PutExtensionItem(EPASS Encode_GSMAudioCapability, (uint8*)x->gsmEnhancedFullRate, stream);
   6092             break;
   6093         case 20:
   6094             PutExtensionItem(EPASS Encode_GenericCapability, (uint8*)x->genericAudioMode, stream);
   6095             break;
   6096         case 21:
   6097             PutExtensionItem(EPASS Encode_G729Extensions, (uint8*)x->g729Extensions, stream);
   6098             break;
   6099         default:
   6100             ErrorMessageAndLeave("Encode_AudioMode: Illegal CHOICE index");
   6101     }
   6102 }
   6103 
   6104 /* <==================================> */
   6105 /*  PER-Encoder for ModeG7231 (CHOICE)  */
   6106 /* <==================================> */
   6107 void Encode_ModeG7231(PS_ModeG7231 x, PS_OutStream stream)
   6108 {
   6109     PutChoiceIndex(4, 0, x->index, stream);
   6110     switch (x->index)
   6111     {
   6112         case 0:
   6113             /* (noSilenceSuppressionLowRate is NULL) */
   6114             break;
   6115         case 1:
   6116             /* (noSilenceSuppressionHighRate is NULL) */
   6117             break;
   6118         case 2:
   6119             /* (silenceSuppressionLowRate is NULL) */
   6120             break;
   6121         case 3:
   6122             /* (silenceSuppressionHighRate is NULL) */
   6123             break;
   6124         default:
   6125             ErrorMessageAndLeave("Encode_ModeG7231: Illegal CHOICE index");
   6126     }
   6127 }
   6128 
   6129 /* <===========================================> */
   6130 /*  PER-Encoder for IS11172AudioMode (SEQUENCE)  */
   6131 /* <===========================================> */
   6132 void Encode_IS11172AudioMode(PS_IS11172AudioMode x, PS_OutStream stream)
   6133 {
   6134     PutBoolean(0, stream); /* Extension Bit OFF */
   6135     Encode_AudioLayer(&x->audioLayer, stream);
   6136     Encode_AudioSampling(&x->audioSampling, stream);
   6137     Encode_MultichannelType(&x->multichannelType, stream);
   6138     PutInteger(1, 448, (uint32)x->bitRate, stream);
   6139     /* ------------------------------- */
   6140     /* ---- Extension Begins Here ---- */
   6141     /* ------------------------------- */
   6142 }
   6143 
   6144 /* <=========================================> */
   6145 /*  PER-Encoder for MultichannelType (CHOICE)  */
   6146 /* <=========================================> */
   6147 void Encode_MultichannelType(PS_MultichannelType x, PS_OutStream stream)
   6148 {
   6149     PutChoiceIndex(3, 0, x->index, stream);
   6150     switch (x->index)
   6151     {
   6152         case 0:
   6153             /* (singleChannel is NULL) */
   6154             break;
   6155         case 1:
   6156             /* (twoChannelStereo is NULL) */
   6157             break;
   6158         case 2:
   6159             /* (twoChannelDual is NULL) */
   6160             break;
   6161         default:
   6162             ErrorMessageAndLeave("Encode_MultichannelType: Illegal CHOICE index");
   6163     }
   6164 }
   6165 
   6166 /* <======================================> */
   6167 /*  PER-Encoder for AudioSampling (CHOICE)  */
   6168 /* <======================================> */
   6169 void Encode_AudioSampling(PS_AudioSampling x, PS_OutStream stream)
   6170 {
   6171     PutChoiceIndex(3, 0, x->index, stream);
   6172     switch (x->index)
   6173     {
   6174         case 0:
   6175             /* (audioSampling32k is NULL) */
   6176             break;
   6177         case 1:
   6178             /* (audioSampling44k1 is NULL) */
   6179             break;
   6180         case 2:
   6181             /* (audioSampling48k is NULL) */
   6182             break;
   6183         default:
   6184             ErrorMessageAndLeave("Encode_AudioSampling: Illegal CHOICE index");
   6185     }
   6186 }
   6187 
   6188 /* <===================================> */
   6189 /*  PER-Encoder for AudioLayer (CHOICE)  */
   6190 /* <===================================> */
   6191 void Encode_AudioLayer(PS_AudioLayer x, PS_OutStream stream)
   6192 {
   6193     PutChoiceIndex(3, 0, x->index, stream);
   6194     switch (x->index)
   6195     {
   6196         case 0:
   6197             /* (audioLayer1 is NULL) */
   6198             break;
   6199         case 1:
   6200             /* (audioLayer2 is NULL) */
   6201             break;
   6202         case 2:
   6203             /* (audioLayer3 is NULL) */
   6204             break;
   6205         default:
   6206             ErrorMessageAndLeave("Encode_AudioLayer: Illegal CHOICE index");
   6207     }
   6208 }
   6209 
   6210 /* <===========================================> */
   6211 /*  PER-Encoder for IS13818AudioMode (SEQUENCE)  */
   6212 /* <===========================================> */
   6213 void Encode_IS13818AudioMode(PS_IS13818AudioMode x, PS_OutStream stream)
   6214 {
   6215     PutBoolean(0, stream); /* Extension Bit OFF */
   6216     Encode_Is13818AudioLayer(&x->is13818AudioLayer, stream);
   6217     Encode_Is13818AudioSampling(&x->is13818AudioSampling, stream);
   6218     Encode_Is13818MultichannelType(&x->is13818MultichannelType, stream);
   6219     PutBoolean(x->lowFrequencyEnhancement, stream);
   6220     PutBoolean(x->multilingual, stream);
   6221     PutInteger(1, 1130, (uint32)x->bitRate, stream);
   6222     /* ------------------------------- */
   6223     /* ---- Extension Begins Here ---- */
   6224     /* ------------------------------- */
   6225 }
   6226 
   6227 /* <================================================> */
   6228 /*  PER-Encoder for Is13818MultichannelType (CHOICE)  */
   6229 /* <================================================> */
   6230 void Encode_Is13818MultichannelType(PS_Is13818MultichannelType x, PS_OutStream stream)
   6231 {
   6232     PutChoiceIndex(10, 0, x->index, stream);
   6233     switch (x->index)
   6234     {
   6235         case 0:
   6236             /* (singleChannel is NULL) */
   6237             break;
   6238         case 1:
   6239             /* (twoChannelStereo is NULL) */
   6240             break;
   6241         case 2:
   6242             /* (twoChannelDual is NULL) */
   6243             break;
   6244         case 3:
   6245             /* (threeChannels2_1 is NULL) */
   6246             break;
   6247         case 4:
   6248             /* (threeChannels3_0 is NULL) */
   6249             break;
   6250         case 5:
   6251             /* (fourChannels2_0_2_0 is NULL) */
   6252             break;
   6253         case 6:
   6254             /* (fourChannels2_2 is NULL) */
   6255             break;
   6256         case 7:
   6257             /* (fourChannels3_1 is NULL) */
   6258             break;
   6259         case 8:
   6260             /* (fiveChannels3_0_2_0 is NULL) */
   6261             break;
   6262         case 9:
   6263             /* (fiveChannels3_2 is NULL) */
   6264             break;
   6265         default:
   6266             ErrorMessageAndLeave("Encode_Is13818MultichannelType: Illegal CHOICE index");
   6267     }
   6268 }
   6269 
   6270 /* <=============================================> */
   6271 /*  PER-Encoder for Is13818AudioSampling (CHOICE)  */
   6272 /* <=============================================> */
   6273 void Encode_Is13818AudioSampling(PS_Is13818AudioSampling x, PS_OutStream stream)
   6274 {
   6275     PutChoiceIndex(6, 0, x->index, stream);
   6276     switch (x->index)
   6277     {
   6278         case 0:
   6279             /* (audioSampling16k is NULL) */
   6280             break;
   6281         case 1:
   6282             /* (audioSampling22k05 is NULL) */
   6283             break;
   6284         case 2:
   6285             /* (audioSampling24k is NULL) */
   6286             break;
   6287         case 3:
   6288             /* (audioSampling32k is NULL) */
   6289             break;
   6290         case 4:
   6291             /* (audioSampling44k1 is NULL) */
   6292             break;
   6293         case 5:
   6294             /* (audioSampling48k is NULL) */
   6295             break;
   6296         default:
   6297             ErrorMessageAndLeave("Encode_Is13818AudioSampling: Illegal CHOICE index");
   6298     }
   6299 }
   6300 
   6301 /* <==========================================> */
   6302 /*  PER-Encoder for Is13818AudioLayer (CHOICE)  */
   6303 /* <==========================================> */
   6304 void Encode_Is13818AudioLayer(PS_Is13818AudioLayer x, PS_OutStream stream)
   6305 {
   6306     PutChoiceIndex(3, 0, x->index, stream);
   6307     switch (x->index)
   6308     {
   6309         case 0:
   6310             /* (audioLayer1 is NULL) */
   6311             break;
   6312         case 1:
   6313             /* (audioLayer2 is NULL) */
   6314             break;
   6315         case 2:
   6316             /* (audioLayer3 is NULL) */
   6317             break;
   6318         default:
   6319             ErrorMessageAndLeave("Encode_Is13818AudioLayer: Illegal CHOICE index");
   6320     }
   6321 }
   6322 
   6323 /* <==========================================> */
   6324 /*  PER-Encoder for G7231AnnexCMode (SEQUENCE)  */
   6325 /* <==========================================> */
   6326 void Encode_G7231AnnexCMode(PS_G7231AnnexCMode x, PS_OutStream stream)
   6327 {
   6328     PutBoolean(0, stream); /* Extension Bit OFF */
   6329     PutInteger(1, 256, (uint32)x->maxAl_sduAudioFrames, stream);
   6330     PutBoolean(x->silenceSuppression, stream);
   6331     Encode_ModeG723AnnexCAudioMode(&x->modeG723AnnexCAudioMode, stream);
   6332     /* ------------------------------- */
   6333     /* ---- Extension Begins Here ---- */
   6334     /* ------------------------------- */
   6335 }
   6336 
   6337 /* <==================================================> */
   6338 /*  PER-Encoder for ModeG723AnnexCAudioMode (SEQUENCE)  */
   6339 /* <==================================================> */
   6340 void Encode_ModeG723AnnexCAudioMode(PS_ModeG723AnnexCAudioMode x, PS_OutStream stream)
   6341 {
   6342     PutBoolean(0, stream); /* Extension Bit OFF */
   6343     PutInteger(27, 78, (uint32)x->highRateMode0, stream);
   6344     PutInteger(27, 78, (uint32)x->highRateMode1, stream);
   6345     PutInteger(23, 66, (uint32)x->lowRateMode0, stream);
   6346     PutInteger(23, 66, (uint32)x->lowRateMode1, stream);
   6347     PutInteger(6, 17, (uint32)x->sidMode0, stream);
   6348     PutInteger(6, 17, (uint32)x->sidMode1, stream);
   6349     /* ------------------------------- */
   6350     /* ---- Extension Begins Here ---- */
   6351     /* ------------------------------- */
   6352 }
   6353 
   6354 /* <===================================> */
   6355 /*  PER-Encoder for DataMode (SEQUENCE)  */
   6356 /* <===================================> */
   6357 void Encode_DataMode(PS_DataMode x, PS_OutStream stream)
   6358 {
   6359     PutBoolean(0, stream); /* Extension Bit OFF */
   6360     Encode_DmApplication(&x->dmApplication, stream);
   6361     PutInteger(0, 0xffffffff, (uint32)x->bitRate, stream);
   6362     /* ------------------------------- */
   6363     /* ---- Extension Begins Here ---- */
   6364     /* ------------------------------- */
   6365 }
   6366 
   6367 /* <======================================> */
   6368 /*  PER-Encoder for DmApplication (CHOICE)  */
   6369 /* <======================================> */
   6370 void Encode_DmApplication(PS_DmApplication x, PS_OutStream stream)
   6371 {
   6372     PutChoiceIndex(10, 1, x->index, stream);
   6373     switch (x->index)
   6374     {
   6375         case 0:
   6376             Encode_NonStandardParameter(x->nonStandard, stream);
   6377             break;
   6378         case 1:
   6379             Encode_DataProtocolCapability(x->t120, stream);
   6380             break;
   6381         case 2:
   6382             Encode_DataProtocolCapability(x->dsm_cc, stream);
   6383             break;
   6384         case 3:
   6385             Encode_DataProtocolCapability(x->userData, stream);
   6386             break;
   6387         case 4:
   6388             Encode_DataProtocolCapability(x->t84, stream);
   6389             break;
   6390         case 5:
   6391             Encode_DataProtocolCapability(x->t434, stream);
   6392             break;
   6393         case 6:
   6394             Encode_DataProtocolCapability(x->h224, stream);
   6395             break;
   6396         case 7:
   6397             Encode_DmNlpid(x->dmNlpid, stream);
   6398             break;
   6399         case 8:
   6400             /* (dsvdControl is NULL) */
   6401             break;
   6402         case 9:
   6403             Encode_DataProtocolCapability(x->h222DataPartitioning, stream);
   6404             break;
   6405             /* ------------------------------- */
   6406             /* ---- Extension Begins Here ---- */
   6407             /* ------------------------------- */
   6408         case 10:
   6409             PutExtensionItem(EPASS Encode_DataProtocolCapability, (uint8*)x->t30fax, stream);
   6410             break;
   6411         case 11:
   6412             PutExtensionItem(EPASS Encode_DataProtocolCapability, (uint8*)x->t140, stream);
   6413             break;
   6414         case 12:
   6415             PutExtensionItem(EPASS Encode_DmT38fax, (uint8*)x->dmT38fax, stream);
   6416             break;
   6417         case 13:
   6418             PutExtensionItem(EPASS Encode_GenericCapability, (uint8*)x->genericDataMode, stream);
   6419             break;
   6420         default:
   6421             ErrorMessageAndLeave("Encode_DmApplication: Illegal CHOICE index");
   6422     }
   6423 }
   6424 
   6425 /* <===================================> */
   6426 /*  PER-Encoder for DmT38fax (SEQUENCE)  */
   6427 /* <===================================> */
   6428 void Encode_DmT38fax(PS_DmT38fax x, PS_OutStream stream)
   6429 {
   6430     Encode_DataProtocolCapability(&x->t38FaxProtocol, stream);
   6431     Encode_T38FaxProfile(&x->t38FaxProfile, stream);
   6432 }
   6433 
   6434 /* <==================================> */
   6435 /*  PER-Encoder for DmNlpid (SEQUENCE)  */
   6436 /* <==================================> */
   6437 void Encode_DmNlpid(PS_DmNlpid x, PS_OutStream stream)
   6438 {
   6439     Encode_DataProtocolCapability(&x->nlpidProtocol, stream);
   6440     PutOctetString(1, 0, 0, &x->nlpidData, stream);
   6441 }
   6442 
   6443 /* <=======================================> */
   6444 /*  PER-Encoder for EncryptionMode (CHOICE)  */
   6445 /* <=======================================> */
   6446 void Encode_EncryptionMode(PS_EncryptionMode x, PS_OutStream stream)
   6447 {
   6448     PutChoiceIndex(2, 1, x->index, stream);
   6449     switch (x->index)
   6450     {
   6451         case 0:
   6452             Encode_NonStandardParameter(x->nonStandard, stream);
   6453             break;
   6454         case 1:
   6455             /* (h233Encryption is NULL) */
   6456             break;
   6457             /* ------------------------------- */
   6458             /* ---- Extension Begins Here ---- */
   6459             /* ------------------------------- */
   6460         default:
   6461             ErrorMessageAndLeave("Encode_EncryptionMode: Illegal CHOICE index");
   6462     }
   6463 }
   6464 
   6465 /* <================================================> */
   6466 /*  PER-Encoder for RoundTripDelayRequest (SEQUENCE)  */
   6467 /* <================================================> */
   6468 void Encode_RoundTripDelayRequest(PS_RoundTripDelayRequest x, PS_OutStream stream)
   6469 {
   6470     PutBoolean(0, stream); /* Extension Bit OFF */
   6471     PutInteger(0, 255, (uint32)x->sequenceNumber, stream);
   6472     /* ------------------------------- */
   6473     /* ---- Extension Begins Here ---- */
   6474     /* ------------------------------- */
   6475 }
   6476 
   6477 /* <=================================================> */
   6478 /*  PER-Encoder for RoundTripDelayResponse (SEQUENCE)  */
   6479 /* <=================================================> */
   6480 void Encode_RoundTripDelayResponse(PS_RoundTripDelayResponse x, PS_OutStream stream)
   6481 {
   6482     PutBoolean(0, stream); /* Extension Bit OFF */
   6483     PutInteger(0, 255, (uint32)x->sequenceNumber, stream);
   6484     /* ------------------------------- */
   6485     /* ---- Extension Begins Here ---- */
   6486     /* ------------------------------- */
   6487 }
   6488 
   6489 /* <=================================================> */
   6490 /*  PER-Encoder for MaintenanceLoopRequest (SEQUENCE)  */
   6491 /* <=================================================> */
   6492 void Encode_MaintenanceLoopRequest(PS_MaintenanceLoopRequest x, PS_OutStream stream)
   6493 {
   6494     PutBoolean(0, stream); /* Extension Bit OFF */
   6495     Encode_MlRequestType(&x->mlRequestType, stream);
   6496     /* ------------------------------- */
   6497     /* ---- Extension Begins Here ---- */
   6498     /* ------------------------------- */
   6499 }
   6500 
   6501 /* <======================================> */
   6502 /*  PER-Encoder for MlRequestType (CHOICE)  */
   6503 /* <======================================> */
   6504 void Encode_MlRequestType(PS_MlRequestType x, PS_OutStream stream)
   6505 {
   6506     PutChoiceIndex(3, 1, x->index, stream);
   6507     switch (x->index)
   6508     {
   6509         case 0:
   6510             /* (systemLoop is NULL) */
   6511             break;
   6512         case 1:
   6513             PutInteger(1, 65535, (uint32)x->mediaLoop, stream);
   6514             break;
   6515         case 2:
   6516             PutInteger(1, 65535, (uint32)x->logicalChannelLoop, stream);
   6517             break;
   6518             /* ------------------------------- */
   6519             /* ---- Extension Begins Here ---- */
   6520             /* ------------------------------- */
   6521         default:
   6522             ErrorMessageAndLeave("Encode_MlRequestType: Illegal CHOICE index");
   6523     }
   6524 }
   6525 
   6526 /* <=============================================> */
   6527 /*  PER-Encoder for MaintenanceLoopAck (SEQUENCE)  */
   6528 /* <=============================================> */
   6529 void Encode_MaintenanceLoopAck(PS_MaintenanceLoopAck x, PS_OutStream stream)
   6530 {
   6531     PutBoolean(0, stream); /* Extension Bit OFF */
   6532     Encode_MlAckType(&x->mlAckType, stream);
   6533     /* ------------------------------- */
   6534     /* ---- Extension Begins Here ---- */
   6535     /* ------------------------------- */
   6536 }
   6537 
   6538 /* <==================================> */
   6539 /*  PER-Encoder for MlAckType (CHOICE)  */
   6540 /* <==================================> */
   6541 void Encode_MlAckType(PS_MlAckType x, PS_OutStream stream)
   6542 {
   6543     PutChoiceIndex(3, 1, x->index, stream);
   6544     switch (x->index)
   6545     {
   6546         case 0:
   6547             /* (systemLoop is NULL) */
   6548             break;
   6549         case 1:
   6550             PutInteger(1, 65535, (uint32)x->mediaLoop, stream);
   6551             break;
   6552         case 2:
   6553             PutInteger(1, 65535, (uint32)x->logicalChannelLoop, stream);
   6554             break;
   6555             /* ------------------------------- */
   6556             /* ---- Extension Begins Here ---- */
   6557             /* ------------------------------- */
   6558         default:
   6559             ErrorMessageAndLeave("Encode_MlAckType: Illegal CHOICE index");
   6560     }
   6561 }
   6562 
   6563 /* <================================================> */
   6564 /*  PER-Encoder for MaintenanceLoopReject (SEQUENCE)  */
   6565 /* <================================================> */
   6566 void Encode_MaintenanceLoopReject(PS_MaintenanceLoopReject x, PS_OutStream stream)
   6567 {
   6568     PutBoolean(0, stream); /* Extension Bit OFF */
   6569     Encode_MlRejectType(&x->mlRejectType, stream);
   6570     Encode_MlRejectCause(&x->mlRejectCause, stream);
   6571     /* ------------------------------- */
   6572     /* ---- Extension Begins Here ---- */
   6573     /* ------------------------------- */
   6574 }
   6575 
   6576 /* <======================================> */
   6577 /*  PER-Encoder for MlRejectCause (CHOICE)  */
   6578 /* <======================================> */
   6579 void Encode_MlRejectCause(PS_MlRejectCause x, PS_OutStream stream)
   6580 {
   6581     PutChoiceIndex(1, 1, x->index, stream);
   6582     switch (x->index)
   6583     {
   6584         case 0:
   6585             /* (canNotPerformLoop is NULL) */
   6586             break;
   6587             /* ------------------------------- */
   6588             /* ---- Extension Begins Here ---- */
   6589             /* ------------------------------- */
   6590         default:
   6591             ErrorMessageAndLeave("Encode_MlRejectCause: Illegal CHOICE index");
   6592     }
   6593 }
   6594 
   6595 /* <=====================================> */
   6596 /*  PER-Encoder for MlRejectType (CHOICE)  */
   6597 /* <=====================================> */
   6598 void Encode_MlRejectType(PS_MlRejectType x, PS_OutStream stream)
   6599 {
   6600     PutChoiceIndex(3, 1, x->index, stream);
   6601     switch (x->index)
   6602     {
   6603         case 0:
   6604             /* (systemLoop is NULL) */
   6605             break;
   6606         case 1:
   6607             PutInteger(1, 65535, (uint32)x->mediaLoop, stream);
   6608             break;
   6609         case 2:
   6610             PutInteger(1, 65535, (uint32)x->logicalChannelLoop, stream);
   6611             break;
   6612             /* ------------------------------- */
   6613             /* ---- Extension Begins Here ---- */
   6614             /* ------------------------------- */
   6615         default:
   6616             ErrorMessageAndLeave("Encode_MlRejectType: Illegal CHOICE index");
   6617     }
   6618 }
   6619 
   6620 /* <====================================================> */
   6621 /*  PER-Encoder for MaintenanceLoopOffCommand (SEQUENCE)  */
   6622 /* <====================================================> */
   6623 void Encode_MaintenanceLoopOffCommand(PS_MaintenanceLoopOffCommand x, PS_OutStream stream)
   6624 {
   6625     OSCL_UNUSED_ARG(x);
   6626     PutBoolean(0, stream); /* Extension Bit OFF */
   6627     /* ------------------------------- */
   6628     /* ---- Extension Begins Here ---- */
   6629     /* ------------------------------- */
   6630 }
   6631 
   6632 /* <===================================================> */
   6633 /*  PER-Encoder for CommunicationModeCommand (SEQUENCE)  */
   6634 /* <===================================================> */
   6635 void Encode_CommunicationModeCommand(PS_CommunicationModeCommand x, PS_OutStream stream)
   6636 {
   6637     uint16 i;
   6638     PutBoolean(0, stream); /* Extension Bit OFF */
   6639     PutInteger(1, 256, (uint32)x->size_of_communicationModeTable, stream);
   6640     for (i = 0; i < x->size_of_communicationModeTable; ++i)
   6641     {
   6642         Encode_CommunicationModeTableEntry(x->communicationModeTable + i, stream);
   6643     }
   6644     /* ------------------------------- */
   6645     /* ---- Extension Begins Here ---- */
   6646     /* ------------------------------- */
   6647 }
   6648 
   6649 /* <===================================================> */
   6650 /*  PER-Encoder for CommunicationModeRequest (SEQUENCE)  */
   6651 /* <===================================================> */
   6652 void Encode_CommunicationModeRequest(PS_CommunicationModeRequest x, PS_OutStream stream)
   6653 {
   6654     OSCL_UNUSED_ARG(x);
   6655     PutBoolean(0, stream); /* Extension Bit OFF */
   6656     /* ------------------------------- */
   6657     /* ---- Extension Begins Here ---- */
   6658     /* ------------------------------- */
   6659 }
   6660 
   6661 /* <==================================================> */
   6662 /*  PER-Encoder for CommunicationModeResponse (CHOICE)  */
   6663 /* <==================================================> */
   6664 void Encode_CommunicationModeResponse(PS_CommunicationModeResponse x, PS_OutStream stream)
   6665 {
   6666     uint16 i;
   6667     PutChoiceIndex(1, 1, x->index, stream);
   6668     switch (x->index)
   6669     {
   6670         case 0:
   6671             PutInteger(1, 256, (uint32)x->size, stream);
   6672             for (i = 0; i < x->size; ++i)
   6673             {
   6674                 Encode_CommunicationModeTableEntry(x->communicationModeTable + i, stream);
   6675             }
   6676             break;
   6677             /* ------------------------------- */
   6678             /* ---- Extension Begins Here ---- */
   6679             /* ------------------------------- */
   6680         default:
   6681             ErrorMessageAndLeave("Encode_CommunicationModeResponse: Illegal CHOICE index");
   6682     }
   6683 }
   6684 
   6685 /* <======================================================> */
   6686 /*  PER-Encoder for CommunicationModeTableEntry (SEQUENCE)  */
   6687 /* <======================================================> */
   6688 void Encode_CommunicationModeTableEntry(PS_CommunicationModeTableEntry x, PS_OutStream stream)
   6689 {
   6690     uint16 i;
   6691     uint32 extension;
   6692 
   6693     extension = x->option_of_redundancyEncoding |
   6694                 x->option_of_sessionDependency |
   6695                 x->option_of_destination;
   6696     PutBoolean(extension, stream);
   6697 
   6698     PutBoolean(x->option_of_nonStandard, stream);
   6699     PutBoolean(x->option_of_associatedSessionID, stream);
   6700     PutBoolean(x->option_of_terminalLabel, stream);
   6701     PutBoolean(x->option_of_mediaChannel, stream);
   6702     PutBoolean(x->option_of_mediaGuaranteedDelivery, stream);
   6703     PutBoolean(x->option_of_mediaControlChannel, stream);
   6704     PutBoolean(x->option_of_mediaControlGuaranteedDelivery, stream);
   6705     if (x->option_of_nonStandard)
   6706     {
   6707         PutLengthDet(x->size_of_nonStandard, stream);
   6708         for (i = 0; i < x->size_of_nonStandard; ++i)
   6709         {
   6710             Encode_NonStandardParameter(x->nonStandard + i, stream);
   6711         }
   6712     }
   6713     PutInteger(1, 255, (uint32)x->sessionID, stream);
   6714     if (x->option_of_associatedSessionID)
   6715     {
   6716         PutInteger(1, 255, (uint32)x->associatedSessionID, stream);
   6717     }
   6718     if (x->option_of_terminalLabel)
   6719     {
   6720         Encode_TerminalLabel(&x->terminalLabel, stream);
   6721     }
   6722     PutCharString("BMPString", 0, 1, 128, NULL, &x->sessionDescription, stream);
   6723     Encode_CmtDataType(&x->cmtDataType, stream);
   6724     if (x->option_of_mediaChannel)
   6725     {
   6726         Encode_TransportAddress(&x->mediaChannel, stream);
   6727     }
   6728     if (x->option_of_mediaGuaranteedDelivery)
   6729     {
   6730         PutBoolean(x->mediaGuaranteedDelivery, stream);
   6731     }
   6732     if (x->option_of_mediaControlChannel)
   6733     {
   6734         Encode_TransportAddress(&x->mediaControlChannel, stream);
   6735     }
   6736     if (x->option_of_mediaControlGuaranteedDelivery)
   6737     {
   6738         PutBoolean(x->mediaControlGuaranteedDelivery, stream);
   6739     }
   6740     /* ------------------------------- */
   6741     /* ---- Extension Begins Here ---- */
   6742     /* ------------------------------- */
   6743     if (!extension) return; /* (No items present?) */
   6744     PutNormSmallLength(3, stream); /* Begin Options Map */
   6745     PutBoolean(x->option_of_redundancyEncoding, stream);
   6746     PutBoolean(x->option_of_sessionDependency, stream);
   6747     PutBoolean(x->option_of_destination, stream);
   6748     if (x->option_of_redundancyEncoding)
   6749     {
   6750         PutExtensionItem(EPASS Encode_RedundancyEncoding, (uint8*)&x->redundancyEncoding, stream);
   6751     }
   6752     if (x->option_of_sessionDependency)
   6753     {
   6754         PutExtensionInteger(1, 255, (uint32)x->sessionDependency, stream);
   6755     }
   6756     if (x->option_of_destination)
   6757     {
   6758         PutExtensionItem(EPASS Encode_TerminalLabel, (uint8*)&x->destination, stream);
   6759     }
   6760 }
   6761 
   6762 /* <====================================> */
   6763 /*  PER-Encoder for CmtDataType (CHOICE)  */
   6764 /* <====================================> */
   6765 void Encode_CmtDataType(PS_CmtDataType x, PS_OutStream stream)
   6766 {
   6767     PutChoiceIndex(3, 1, x->index, stream);
   6768     switch (x->index)
   6769     {
   6770         case 0:
   6771             Encode_VideoCapability(x->videoData, stream);
   6772             break;
   6773         case 1:
   6774             Encode_AudioCapability(x->audioData, stream);
   6775             break;
   6776         case 2:
   6777             Encode_DataApplicationCapability(x->data, stream);
   6778             break;
   6779             /* ------------------------------- */
   6780             /* ---- Extension Begins Here ---- */
   6781             /* ------------------------------- */
   6782         default:
   6783             ErrorMessageAndLeave("Encode_CmtDataType: Illegal CHOICE index");
   6784     }
   6785 }
   6786 
   6787 /* <==========================================> */
   6788 /*  PER-Encoder for ConferenceRequest (CHOICE)  */
   6789 /* <==========================================> */
   6790 void Encode_ConferenceRequest(PS_ConferenceRequest x, PS_OutStream stream)
   6791 {
   6792     PutChoiceIndex(8, 1, x->index, stream);
   6793     switch (x->index)
   6794     {
   6795         case 0:
   6796             /* (terminalListRequest is NULL) */
   6797             break;
   6798         case 1:
   6799             /* (makeMeChair is NULL) */
   6800             break;
   6801         case 2:
   6802             /* (cancelMakeMeChair is NULL) */
   6803             break;
   6804         case 3:
   6805             Encode_TerminalLabel(x->dropTerminal, stream);
   6806             break;
   6807         case 4:
   6808             Encode_TerminalLabel(x->requestTerminalID, stream);
   6809             break;
   6810         case 5:
   6811             /* (enterH243Password is NULL) */
   6812             break;
   6813         case 6:
   6814             /* (enterH243TerminalID is NULL) */
   6815             break;
   6816         case 7:
   6817             /* (enterH243ConferenceID is NULL) */
   6818             break;
   6819             /* ------------------------------- */
   6820             /* ---- Extension Begins Here ---- */
   6821             /* ------------------------------- */
   6822         case 8:
   6823             PutExtensionNull(stream);
   6824             break;
   6825         case 9:
   6826             PutExtensionNull(stream);
   6827             break;
   6828         case 10:
   6829             PutExtensionItem(EPASS Encode_RequestTerminalCertificate, (uint8*)x->requestTerminalCertificate, stream);
   6830             break;
   6831         case 11:
   6832             PutExtensionInteger(1, 65535, (uint32)x->broadcastMyLogicalChannel, stream);
   6833             break;
   6834         case 12:
   6835             PutExtensionItem(EPASS Encode_TerminalLabel, (uint8*)x->makeTerminalBroadcaster, stream);
   6836             break;
   6837         case 13:
   6838             PutExtensionItem(EPASS Encode_TerminalLabel, (uint8*)x->sendThisSource, stream);
   6839             break;
   6840         case 14:
   6841             PutExtensionNull(stream);
   6842             break;
   6843         case 15:
   6844             PutExtensionItem(EPASS Encode_RemoteMCRequest, (uint8*)x->remoteMCRequest, stream);
   6845             break;
   6846         default:
   6847             ErrorMessageAndLeave("Encode_ConferenceRequest: Illegal CHOICE index");
   6848     }
   6849 }
   6850 
   6851 /* <=====================================================> */
   6852 /*  PER-Encoder for RequestTerminalCertificate (SEQUENCE)  */
   6853 /* <=====================================================> */
   6854 void Encode_RequestTerminalCertificate(PS_RequestTerminalCertificate x, PS_OutStream stream)
   6855 {
   6856     PutBoolean(0, stream); /* Extension Bit OFF */
   6857     PutBoolean(x->option_of_terminalLabel, stream);
   6858     PutBoolean(x->option_of_certSelectionCriteria, stream);
   6859     PutBoolean(x->option_of_sRandom, stream);
   6860     if (x->option_of_terminalLabel)
   6861     {
   6862         Encode_TerminalLabel(&x->terminalLabel, stream);
   6863     }
   6864     if (x->option_of_certSelectionCriteria)
   6865     {
   6866         Encode_CertSelectionCriteria(&x->certSelectionCriteria, stream);
   6867     }
   6868     if (x->option_of_sRandom)
   6869     {
   6870         PutInteger(1, 0xffffffff, (uint32)x->sRandom, stream);
   6871     }
   6872     /* ------------------------------- */
   6873     /* ---- Extension Begins Here ---- */
   6874     /* ------------------------------- */
   6875 }
   6876 
   6877 /* <===================================================> */
   6878 /*  PER-Encoder for CertSelectionCriteria (SEQUENCE-OF)  */
   6879 /* <===================================================> */
   6880 void Encode_CertSelectionCriteria(PS_CertSelectionCriteria x, PS_OutStream stream)
   6881 {
   6882     uint16 i;
   6883     PutInteger(1, 16, (uint32)x->size, stream);
   6884     for (i = 0; i < x->size; ++i)
   6885     {
   6886         Encode_Criteria(x->item + i, stream);
   6887     }
   6888 }
   6889 
   6890 /* <===================================> */
   6891 /*  PER-Encoder for Criteria (SEQUENCE)  */
   6892 /* <===================================> */
   6893 void Encode_Criteria(PS_Criteria x, PS_OutStream stream)
   6894 {
   6895     PutBoolean(0, stream); /* Extension Bit OFF */
   6896     PutObjectID(&x->field, stream);
   6897     PutOctetString(0, 1, 65535, &x->value, stream);
   6898     /* ------------------------------- */
   6899     /* ---- Extension Begins Here ---- */
   6900     /* ------------------------------- */
   6901 }
   6902 
   6903 /* <========================================> */
   6904 /*  PER-Encoder for TerminalLabel (SEQUENCE)  */
   6905 /* <========================================> */
   6906 void Encode_TerminalLabel(PS_TerminalLabel x, PS_OutStream stream)
   6907 {
   6908     PutBoolean(0, stream); /* Extension Bit OFF */
   6909     PutInteger(0, 192, (uint32)x->mcuNumber, stream);
   6910     PutInteger(0, 192, (uint32)x->terminalNumber, stream);
   6911     /* ------------------------------- */
   6912     /* ---- Extension Begins Here ---- */
   6913     /* ------------------------------- */
   6914 }
   6915 
   6916 /* <===========================================> */
   6917 /*  PER-Encoder for ConferenceResponse (CHOICE)  */
   6918 /* <===========================================> */
   6919 void Encode_ConferenceResponse(PS_ConferenceResponse x, PS_OutStream stream)
   6920 {
   6921     uint16 i;
   6922     PutChoiceIndex(8, 1, x->index, stream);
   6923     switch (x->index)
   6924     {
   6925         case 0:
   6926             Encode_MCTerminalIDResponse(x->mCTerminalIDResponse, stream);
   6927             break;
   6928         case 1:
   6929             Encode_TerminalIDResponse(x->terminalIDResponse, stream);
   6930             break;
   6931         case 2:
   6932             Encode_ConferenceIDResponse(x->conferenceIDResponse, stream);
   6933             break;
   6934         case 3:
   6935             Encode_PasswordResponse(x->passwordResponse, stream);
   6936             break;
   6937         case 4:
   6938             PutInteger(1, 256, (uint32)x->size, stream);
   6939             for (i = 0; i < x->size; ++i)
   6940             {
   6941                 Encode_TerminalLabel(x->terminalListResponse + i, stream);
   6942             }
   6943             break;
   6944         case 5:
   6945             /* (videoCommandReject is NULL) */
   6946             break;
   6947         case 6:
   6948             /* (terminalDropReject is NULL) */
   6949             break;
   6950         case 7:
   6951             Encode_MakeMeChairResponse(x->makeMeChairResponse, stream);
   6952             break;
   6953             /* ------------------------------- */
   6954             /* ---- Extension Begins Here ---- */
   6955             /* ------------------------------- */
   6956         case 8:
   6957             PutExtensionItem(EPASS Encode_ExtensionAddressResponse, (uint8*)x->extensionAddressResponse, stream);
   6958             break;
   6959         case 9:
   6960             PutExtensionItem(EPASS Encode_ChairTokenOwnerResponse, (uint8*)x->chairTokenOwnerResponse, stream);
   6961             break;
   6962         case 10:
   6963             PutExtensionItem(EPASS Encode_TerminalCertificateResponse, (uint8*)x->terminalCertificateResponse, stream);
   6964             break;
   6965         case 11:
   6966             PutExtensionItem(EPASS Encode_BroadcastMyLogicalChannelResponse, (uint8*)x->broadcastMyLogicalChannelResponse, stream);
   6967             break;
   6968         case 12:
   6969             PutExtensionItem(EPASS Encode_MakeTerminalBroadcasterResponse, (uint8*)x->makeTerminalBroadcasterResponse, stream);
   6970             break;
   6971         case 13:
   6972             PutExtensionItem(EPASS Encode_SendThisSourceResponse, (uint8*)x->sendThisSourceResponse, stream);
   6973             break;
   6974         case 14:
   6975             PutExtensionItem(EPASS Encode_RequestAllTerminalIDsResponse, (uint8*)x->requestAllTerminalIDsResponse, stream);
   6976             break;
   6977         case 15:
   6978             PutExtensionItem(EPASS Encode_RemoteMCResponse, (uint8*)x->remoteMCResponse, stream);
   6979             break;
   6980         default:
   6981             ErrorMessageAndLeave("Encode_ConferenceResponse: Illegal CHOICE index");
   6982     }
   6983 }
   6984 
   6985 /* <===============================================> */
   6986 /*  PER-Encoder for SendThisSourceResponse (CHOICE)  */
   6987 /* <===============================================> */
   6988 void Encode_SendThisSourceResponse(PS_SendThisSourceResponse x, PS_OutStream stream)
   6989 {
   6990     PutChoiceIndex(2, 1, x->index, stream);
   6991     switch (x->index)
   6992     {
   6993         case 0:
   6994             /* (grantedSendThisSource is NULL) */
   6995             break;
   6996         case 1:
   6997             /* (deniedSendThisSource is NULL) */
   6998             break;
   6999             /* ------------------------------- */
   7000             /* ---- Extension Begins Here ---- */
   7001             /* ------------------------------- */
   7002         default:
   7003             ErrorMessageAndLeave("Encode_SendThisSourceResponse: Illegal CHOICE index");
   7004     }
   7005 }
   7006 
   7007 /* <========================================================> */
   7008 /*  PER-Encoder for MakeTerminalBroadcasterResponse (CHOICE)  */
   7009 /* <========================================================> */
   7010 void Encode_MakeTerminalBroadcasterResponse(PS_MakeTerminalBroadcasterResponse x, PS_OutStream stream)
   7011 {
   7012     PutChoiceIndex(2, 1, x->index, stream);
   7013     switch (x->index)
   7014     {
   7015         case 0:
   7016             /* (grantedMakeTerminalBroadcaster is NULL) */
   7017             break;
   7018         case 1:
   7019             /* (deniedMakeTerminalBroadcaster is NULL) */
   7020             break;
   7021             /* ------------------------------- */
   7022             /* ---- Extension Begins Here ---- */
   7023             /* ------------------------------- */
   7024         default:
   7025             ErrorMessageAndLeave("Encode_MakeTerminalBroadcasterResponse: Illegal CHOICE index");
   7026     }
   7027 }
   7028 
   7029 /* <==========================================================> */
   7030 /*  PER-Encoder for BroadcastMyLogicalChannelResponse (CHOICE)  */
   7031 /* <==========================================================> */
   7032 void Encode_BroadcastMyLogicalChannelResponse(PS_BroadcastMyLogicalChannelResponse x, PS_OutStream stream)
   7033 {
   7034     PutChoiceIndex(2, 1, x->index, stream);
   7035     switch (x->index)
   7036     {
   7037         case 0:
   7038             /* (grantedBroadcastMyLogicalChannel is NULL) */
   7039             break;
   7040         case 1:
   7041             /* (deniedBroadcastMyLogicalChannel is NULL) */
   7042             break;
   7043             /* ------------------------------- */
   7044             /* ---- Extension Begins Here ---- */
   7045             /* ------------------------------- */
   7046         default:
   7047             ErrorMessageAndLeave("Encode_BroadcastMyLogicalChannelResponse: Illegal CHOICE index");
   7048     }
   7049 }
   7050 
   7051 /* <======================================================> */
   7052 /*  PER-Encoder for TerminalCertificateResponse (SEQUENCE)  */
   7053 /* <======================================================> */
   7054 void Encode_TerminalCertificateResponse(PS_TerminalCertificateResponse x, PS_OutStream stream)
   7055 {
   7056     PutBoolean(0, stream); /* Extension Bit OFF */
   7057     PutBoolean(x->option_of_terminalLabel, stream);
   7058     PutBoolean(x->option_of_certificateResponse, stream);
   7059     if (x->option_of_terminalLabel)
   7060     {
   7061         Encode_TerminalLabel(&x->terminalLabel, stream);
   7062     }
   7063     if (x->option_of_certificateResponse)
   7064     {
   7065         PutOctetString(0, 1, 65535, &x->certificateResponse, stream);
   7066     }
   7067     /* ------------------------------- */
   7068     /* ---- Extension Begins Here ---- */
   7069     /* ------------------------------- */
   7070 }
   7071 
   7072 /* <==================================================> */
   7073 /*  PER-Encoder for ChairTokenOwnerResponse (SEQUENCE)  */
   7074 /* <==================================================> */
   7075 void Encode_ChairTokenOwnerResponse(PS_ChairTokenOwnerResponse x, PS_OutStream stream)
   7076 {
   7077     PutBoolean(0, stream); /* Extension Bit OFF */
   7078     Encode_TerminalLabel(&x->terminalLabel, stream);
   7079     PutOctetString(0, 1, 128, &x->terminalID, stream);
   7080     /* ------------------------------- */
   7081     /* ---- Extension Begins Here ---- */
   7082     /* ------------------------------- */
   7083 }
   7084 
   7085 /* <===================================================> */
   7086 /*  PER-Encoder for ExtensionAddressResponse (SEQUENCE)  */
   7087 /* <===================================================> */
   7088 void Encode_ExtensionAddressResponse(PS_ExtensionAddressResponse x, PS_OutStream stream)
   7089 {
   7090     PutBoolean(0, stream); /* Extension Bit OFF */
   7091     PutOctetString(0, 1, 128, &x->extensionAddress, stream);
   7092     /* ------------------------------- */
   7093     /* ---- Extension Begins Here ---- */
   7094     /* ------------------------------- */
   7095 }
   7096 
   7097 /* <============================================> */
   7098 /*  PER-Encoder for MakeMeChairResponse (CHOICE)  */
   7099 /* <============================================> */
   7100 void Encode_MakeMeChairResponse(PS_MakeMeChairResponse x, PS_OutStream stream)
   7101 {
   7102     PutChoiceIndex(2, 1, x->index, stream);
   7103     switch (x->index)
   7104     {
   7105         case 0:
   7106             /* (grantedChairToken is NULL) */
   7107             break;
   7108         case 1:
   7109             /* (deniedChairToken is NULL) */
   7110             break;
   7111             /* ------------------------------- */
   7112             /* ---- Extension Begins Here ---- */
   7113             /* ------------------------------- */
   7114         default:
   7115             ErrorMessageAndLeave("Encode_MakeMeChairResponse: Illegal CHOICE index");
   7116     }
   7117 }
   7118 
   7119 /* <===========================================> */
   7120 /*  PER-Encoder for PasswordResponse (SEQUENCE)  */
   7121 /* <===========================================> */
   7122 void Encode_PasswordResponse(PS_PasswordResponse x, PS_OutStream stream)
   7123 {
   7124     PutBoolean(0, stream); /* Extension Bit OFF */
   7125     Encode_TerminalLabel(&x->terminalLabel, stream);
   7126     PutOctetString(0, 1, 32, &x->password, stream);
   7127     /* ------------------------------- */
   7128     /* ---- Extension Begins Here ---- */
   7129     /* ------------------------------- */
   7130 }
   7131 
   7132 /* <===============================================> */
   7133 /*  PER-Encoder for ConferenceIDResponse (SEQUENCE)  */
   7134 /* <===============================================> */
   7135 void Encode_ConferenceIDResponse(PS_ConferenceIDResponse x, PS_OutStream stream)
   7136 {
   7137     PutBoolean(0, stream); /* Extension Bit OFF */
   7138     Encode_TerminalLabel(&x->terminalLabel, stream);
   7139     PutOctetString(0, 1, 32, &x->conferenceID, stream);
   7140     /* ------------------------------- */
   7141     /* ---- Extension Begins Here ---- */
   7142     /* ------------------------------- */
   7143 }
   7144 
   7145 /* <=============================================> */
   7146 /*  PER-Encoder for TerminalIDResponse (SEQUENCE)  */
   7147 /* <=============================================> */
   7148 void Encode_TerminalIDResponse(PS_TerminalIDResponse x, PS_OutStream stream)
   7149 {
   7150     PutBoolean(0, stream); /* Extension Bit OFF */
   7151     Encode_TerminalLabel(&x->terminalLabel, stream);
   7152     PutOctetString(0, 1, 128, &x->terminalID, stream);
   7153     /* ------------------------------- */
   7154     /* ---- Extension Begins Here ---- */
   7155     /* ------------------------------- */
   7156 }
   7157 
   7158 /* <===============================================> */
   7159 /*  PER-Encoder for MCTerminalIDResponse (SEQUENCE)  */
   7160 /* <===============================================> */
   7161 void Encode_MCTerminalIDResponse(PS_MCTerminalIDResponse x, PS_OutStream stream)
   7162 {
   7163     PutBoolean(0, stream); /* Extension Bit OFF */
   7164     Encode_TerminalLabel(&x->terminalLabel, stream);
   7165     PutOctetString(0, 1, 128, &x->terminalID, stream);
   7166     /* ------------------------------- */
   7167     /* ---- Extension Begins Here ---- */
   7168     /* ------------------------------- */
   7169 }
   7170 
   7171 /* <========================================================> */
   7172 /*  PER-Encoder for RequestAllTerminalIDsResponse (SEQUENCE)  */
   7173 /* <========================================================> */
   7174 void Encode_RequestAllTerminalIDsResponse(PS_RequestAllTerminalIDsResponse x, PS_OutStream stream)
   7175 {
   7176     uint16 i;
   7177     PutBoolean(0, stream); /* Extension Bit OFF */
   7178     PutLengthDet(x->size_of_terminalInformation, stream);
   7179     for (i = 0; i < x->size_of_terminalInformation; ++i)
   7180     {
   7181         Encode_TerminalInformation(x->terminalInformation + i, stream);
   7182     }
   7183     /* ------------------------------- */
   7184     /* ---- Extension Begins Here ---- */
   7185     /* ------------------------------- */
   7186 }
   7187 
   7188 /* <==============================================> */
   7189 /*  PER-Encoder for TerminalInformation (SEQUENCE)  */
   7190 /* <==============================================> */
   7191 void Encode_TerminalInformation(PS_TerminalInformation x, PS_OutStream stream)
   7192 {
   7193     PutBoolean(0, stream); /* Extension Bit OFF */
   7194     Encode_TerminalLabel(&x->terminalLabel, stream);
   7195     PutOctetString(0, 1, 128, &x->terminalID, stream);
   7196     /* ------------------------------- */
   7197     /* ---- Extension Begins Here ---- */
   7198     /* ------------------------------- */
   7199 }
   7200 
   7201 /* <========================================> */
   7202 /*  PER-Encoder for RemoteMCRequest (CHOICE)  */
   7203 /* <========================================> */
   7204 void Encode_RemoteMCRequest(PS_RemoteMCRequest x, PS_OutStream stream)
   7205 {
   7206     PutChoiceIndex(3, 1, x->index, stream);
   7207     switch (x->index)
   7208     {
   7209         case 0:
   7210             /* (masterActivate is NULL) */
   7211             break;
   7212         case 1:
   7213             /* (slaveActivate is NULL) */
   7214             break;
   7215         case 2:
   7216             /* (deActivate is NULL) */
   7217             break;
   7218             /* ------------------------------- */
   7219             /* ---- Extension Begins Here ---- */
   7220             /* ------------------------------- */
   7221         default:
   7222             ErrorMessageAndLeave("Encode_RemoteMCRequest: Illegal CHOICE index");
   7223     }
   7224 }
   7225 
   7226 /* <=========================================> */
   7227 /*  PER-Encoder for RemoteMCResponse (CHOICE)  */
   7228 /* <=========================================> */
   7229 void Encode_RemoteMCResponse(PS_RemoteMCResponse x, PS_OutStream stream)
   7230 {
   7231     PutChoiceIndex(2, 1, x->index, stream);
   7232     switch (x->index)
   7233     {
   7234         case 0:
   7235             /* (accept is NULL) */
   7236             break;
   7237         case 1:
   7238             Encode_Reject(x->reject, stream);
   7239             break;
   7240             /* ------------------------------- */
   7241             /* ---- Extension Begins Here ---- */
   7242             /* ------------------------------- */
   7243         default:
   7244             ErrorMessageAndLeave("Encode_RemoteMCResponse: Illegal CHOICE index");
   7245     }
   7246 }
   7247 
   7248 /* <===============================> */
   7249 /*  PER-Encoder for Reject (CHOICE)  */
   7250 /* <===============================> */
   7251 void Encode_Reject(PS_Reject x, PS_OutStream stream)
   7252 {
   7253     PutChoiceIndex(2, 1, x->index, stream);
   7254     switch (x->index)
   7255     {
   7256         case 0:
   7257             /* (unspecified is NULL) */
   7258             break;
   7259         case 1:
   7260             /* (functionNotSupported is NULL) */
   7261             break;
   7262             /* ------------------------------- */
   7263             /* ---- Extension Begins Here ---- */
   7264             /* ------------------------------- */
   7265         default:
   7266             ErrorMessageAndLeave("Encode_Reject: Illegal CHOICE index");
   7267     }
   7268 }
   7269 
   7270 /* <=========================================> */
   7271 /*  PER-Encoder for MultilinkRequest (CHOICE)  */
   7272 /* <=========================================> */
   7273 void Encode_MultilinkRequest(PS_MultilinkRequest x, PS_OutStream stream)
   7274 {
   7275     PutChoiceIndex(5, 1, x->index, stream);
   7276     switch (x->index)
   7277     {
   7278         case 0:
   7279             Encode_NonStandardMessage(x->nonStandard, stream);
   7280             break;
   7281         case 1:
   7282             Encode_CallInformation(x->callInformation, stream);
   7283             break;
   7284         case 2:
   7285             Encode_AddConnection(x->addConnection, stream);
   7286             break;
   7287         case 3:
   7288             Encode_RemoveConnection(x->removeConnection, stream);
   7289             break;
   7290         case 4:
   7291             Encode_MaximumHeaderInterval(x->maximumHeaderInterval, stream);
   7292             break;
   7293             /* ------------------------------- */
   7294             /* ---- Extension Begins Here ---- */
   7295             /* ------------------------------- */
   7296         default:
   7297             ErrorMessageAndLeave("Encode_MultilinkRequest: Illegal CHOICE index");
   7298     }
   7299 }
   7300 
   7301 /* <================================================> */
   7302 /*  PER-Encoder for MaximumHeaderInterval (SEQUENCE)  */
   7303 /* <================================================> */
   7304 void Encode_MaximumHeaderInterval(PS_MaximumHeaderInterval x, PS_OutStream stream)
   7305 {
   7306     PutBoolean(0, stream); /* Extension Bit OFF */
   7307     Encode_RequestType(&x->requestType, stream);
   7308     /* ------------------------------- */
   7309     /* ---- Extension Begins Here ---- */
   7310     /* ------------------------------- */
   7311 }
   7312 
   7313 /* <====================================> */
   7314 /*  PER-Encoder for RequestType (CHOICE)  */
   7315 /* <====================================> */
   7316 void Encode_RequestType(PS_RequestType x, PS_OutStream stream)
   7317 {
   7318     PutChoiceIndex(2, 1, x->index, stream);
   7319     switch (x->index)
   7320     {
   7321         case 0:
   7322             /* (currentIntervalInformation is NULL) */
   7323             break;
   7324         case 1:
   7325             PutInteger(0, 65535, (uint32)x->requestedInterval, stream);
   7326             break;
   7327             /* ------------------------------- */
   7328             /* ---- Extension Begins Here ---- */
   7329             /* ------------------------------- */
   7330         default:
   7331             ErrorMessageAndLeave("Encode_RequestType: Illegal CHOICE index");
   7332     }
   7333 }
   7334 
   7335 /* <===========================================> */
   7336 /*  PER-Encoder for RemoveConnection (SEQUENCE)  */
   7337 /* <===========================================> */
   7338 void Encode_RemoveConnection(PS_RemoveConnection x, PS_OutStream stream)
   7339 {
   7340     PutBoolean(0, stream); /* Extension Bit OFF */
   7341     Encode_ConnectionIdentifier(&x->connectionIdentifier, stream);
   7342     /* ------------------------------- */
   7343     /* ---- Extension Begins Here ---- */
   7344     /* ------------------------------- */
   7345 }
   7346 
   7347 /* <========================================> */
   7348 /*  PER-Encoder for AddConnection (SEQUENCE)  */
   7349 /* <========================================> */
   7350 void Encode_AddConnection(PS_AddConnection x, PS_OutStream stream)
   7351 {
   7352     PutBoolean(0, stream); /* Extension Bit OFF */
   7353     PutInteger(0, 255, (uint32)x->sequenceNumber, stream);
   7354     Encode_DialingInformation(&x->dialingInformation, stream);
   7355     /* ------------------------------- */
   7356     /* ---- Extension Begins Here ---- */
   7357     /* ------------------------------- */
   7358 }
   7359 
   7360 /* <==========================================> */
   7361 /*  PER-Encoder for CallInformation (SEQUENCE)  */
   7362 /* <==========================================> */
   7363 void Encode_CallInformation(PS_CallInformation x, PS_OutStream stream)
   7364 {
   7365     PutBoolean(0, stream); /* Extension Bit OFF */
   7366     PutInteger(1, 65535, (uint32)x->maxNumberOfAdditionalConnections, stream);
   7367     /* ------------------------------- */
   7368     /* ---- Extension Begins Here ---- */
   7369     /* ------------------------------- */
   7370 }
   7371 
   7372 /* <==========================================> */
   7373 /*  PER-Encoder for MultilinkResponse (CHOICE)  */
   7374 /* <==========================================> */
   7375 void Encode_MultilinkResponse(PS_MultilinkResponse x, PS_OutStream stream)
   7376 {
   7377     PutChoiceIndex(5, 1, x->index, stream);
   7378     switch (x->index)
   7379     {
   7380         case 0:
   7381             Encode_NonStandardMessage(x->nonStandard, stream);
   7382             break;
   7383         case 1:
   7384             Encode_RespCallInformation(x->respCallInformation, stream);
   7385             break;
   7386         case 2:
   7387             Encode_RespAddConnection(x->respAddConnection, stream);
   7388             break;
   7389         case 3:
   7390             Encode_RespRemoveConnection(x->respRemoveConnection, stream);
   7391             break;
   7392         case 4:
   7393             Encode_RespMaximumHeaderInterval(x->respMaximumHeaderInterval, stream);
   7394             break;
   7395             /* ------------------------------- */
   7396             /* ---- Extension Begins Here ---- */
   7397             /* ------------------------------- */
   7398         default:
   7399             ErrorMessageAndLeave("Encode_MultilinkResponse: Illegal CHOICE index");
   7400     }
   7401 }
   7402 
   7403 /* <====================================================> */
   7404 /*  PER-Encoder for RespMaximumHeaderInterval (SEQUENCE)  */
   7405 /* <====================================================> */
   7406 void Encode_RespMaximumHeaderInterval(PS_RespMaximumHeaderInterval x, PS_OutStream stream)
   7407 {
   7408     PutBoolean(0, stream); /* Extension Bit OFF */
   7409     PutInteger(0, 65535, (uint32)x->currentInterval, stream);
   7410     /* ------------------------------- */
   7411     /* ---- Extension Begins Here ---- */
   7412     /* ------------------------------- */
   7413 }
   7414 
   7415 /* <===============================================> */
   7416 /*  PER-Encoder for RespRemoveConnection (SEQUENCE)  */
   7417 /* <===============================================> */
   7418 void Encode_RespRemoveConnection(PS_RespRemoveConnection x, PS_OutStream stream)
   7419 {
   7420     PutBoolean(0, stream); /* Extension Bit OFF */
   7421     Encode_ConnectionIdentifier(&x->connectionIdentifier, stream);
   7422     /* ------------------------------- */
   7423     /* ---- Extension Begins Here ---- */
   7424     /* ------------------------------- */
   7425 }
   7426 
   7427 /* <============================================> */
   7428 /*  PER-Encoder for RespAddConnection (SEQUENCE)  */
   7429 /* <============================================> */
   7430 void Encode_RespAddConnection(PS_RespAddConnection x, PS_OutStream stream)
   7431 {
   7432     PutBoolean(0, stream); /* Extension Bit OFF */
   7433     PutInteger(0, 255, (uint32)x->sequenceNumber, stream);
   7434     Encode_ResponseCode(&x->responseCode, stream);
   7435     /* ------------------------------- */
   7436     /* ---- Extension Begins Here ---- */
   7437     /* ------------------------------- */
   7438 }
   7439 
   7440 /* <=====================================> */
   7441 /*  PER-Encoder for ResponseCode (CHOICE)  */
   7442 /* <=====================================> */
   7443 void Encode_ResponseCode(PS_ResponseCode x, PS_OutStream stream)
   7444 {
   7445     PutChoiceIndex(2, 1, x->index, stream);
   7446     switch (x->index)
   7447     {
   7448         case 0:
   7449             /* (accepted is NULL) */
   7450             break;
   7451         case 1:
   7452             Encode_Rejected(x->rejected, stream);
   7453             break;
   7454             /* ------------------------------- */
   7455             /* ---- Extension Begins Here ---- */
   7456             /* ------------------------------- */
   7457         default:
   7458             ErrorMessageAndLeave("Encode_ResponseCode: Illegal CHOICE index");
   7459     }
   7460 }
   7461 
   7462 /* <=================================> */
   7463 /*  PER-Encoder for Rejected (CHOICE)  */
   7464 /* <=================================> */
   7465 void Encode_Rejected(PS_Rejected x, PS_OutStream stream)
   7466 {
   7467     PutChoiceIndex(2, 1, x->index, stream);
   7468     switch (x->index)
   7469     {
   7470         case 0:
   7471             /* (connectionsNotAvailable is NULL) */
   7472             break;
   7473         case 1:
   7474             /* (userRejected is NULL) */
   7475             break;
   7476             /* ------------------------------- */
   7477             /* ---- Extension Begins Here ---- */
   7478             /* ------------------------------- */
   7479         default:
   7480             ErrorMessageAndLeave("Encode_Rejected: Illegal CHOICE index");
   7481     }
   7482 }
   7483 
   7484 /* <==============================================> */
   7485 /*  PER-Encoder for RespCallInformation (SEQUENCE)  */
   7486 /* <==============================================> */
   7487 void Encode_RespCallInformation(PS_RespCallInformation x, PS_OutStream stream)
   7488 {
   7489     PutBoolean(0, stream); /* Extension Bit OFF */
   7490     Encode_DialingInformation(&x->dialingInformation, stream);
   7491     PutInteger(0, 0xffffffff, (uint32)x->callAssociationNumber, stream);
   7492     /* ------------------------------- */
   7493     /* ---- Extension Begins Here ---- */
   7494     /* ------------------------------- */
   7495 }
   7496 
   7497 /* <============================================> */
   7498 /*  PER-Encoder for MultilinkIndication (CHOICE)  */
   7499 /* <============================================> */
   7500 void Encode_MultilinkIndication(PS_MultilinkIndication x, PS_OutStream stream)
   7501 {
   7502     PutChoiceIndex(3, 1, x->index, stream);
   7503     switch (x->index)
   7504     {
   7505         case 0:
   7506             Encode_NonStandardMessage(x->nonStandard, stream);
   7507             break;
   7508         case 1:
   7509             Encode_CrcDesired(x->crcDesired, stream);
   7510             break;
   7511         case 2:
   7512             Encode_ExcessiveError(x->excessiveError, stream);
   7513             break;
   7514             /* ------------------------------- */
   7515             /* ---- Extension Begins Here ---- */
   7516             /* ------------------------------- */
   7517         default:
   7518             ErrorMessageAndLeave("Encode_MultilinkIndication: Illegal CHOICE index");
   7519     }
   7520 }
   7521 
   7522 /* <=========================================> */
   7523 /*  PER-Encoder for ExcessiveError (SEQUENCE)  */
   7524 /* <=========================================> */
   7525 void Encode_ExcessiveError(PS_ExcessiveError x, PS_OutStream stream)
   7526 {
   7527     PutBoolean(0, stream); /* Extension Bit OFF */
   7528     Encode_ConnectionIdentifier(&x->connectionIdentifier, stream);
   7529     /* ------------------------------- */
   7530     /* ---- Extension Begins Here ---- */
   7531     /* ------------------------------- */
   7532 }
   7533 
   7534 /* <=====================================> */
   7535 /*  PER-Encoder for CrcDesired (SEQUENCE)  */
   7536 /* <=====================================> */
   7537 void Encode_CrcDesired(PS_CrcDesired x, PS_OutStream stream)
   7538 {
   7539     OSCL_UNUSED_ARG(x);
   7540     PutBoolean(0, stream); /* Extension Bit OFF */
   7541     /* ------------------------------- */
   7542     /* ---- Extension Begins Here ---- */
   7543     /* ------------------------------- */
   7544 }
   7545 
   7546 /* <===========================================> */
   7547 /*  PER-Encoder for DialingInformation (CHOICE)  */
   7548 /* <===========================================> */
   7549 void Encode_DialingInformation(PS_DialingInformation x, PS_OutStream stream)
   7550 {
   7551     uint16 i;
   7552     PutChoiceIndex(3, 1, x->index, stream);
   7553     switch (x->index)
   7554     {
   7555         case 0:
   7556             Encode_NonStandardMessage(x->nonStandard, stream);
   7557             break;
   7558         case 1:
   7559             PutInteger(1, 65535, (uint32)x->size, stream);
   7560             for (i = 0; i < x->size; ++i)
   7561             {
   7562                 Encode_DialingInformationNumber(x->differential + i, stream);
   7563             }
   7564             break;
   7565         case 2:
   7566             PutInteger(1, 65535, (uint32)x->infoNotAvailable, stream);
   7567             break;
   7568             /* ------------------------------- */
   7569             /* ---- Extension Begins Here ---- */
   7570             /* ------------------------------- */
   7571         default:
   7572             ErrorMessageAndLeave("Encode_DialingInformation: Illegal CHOICE index");
   7573     }
   7574 }
   7575 
   7576 /* <===================================================> */
   7577 /*  PER-Encoder for DialingInformationNumber (SEQUENCE)  */
   7578 /* <===================================================> */
   7579 void Encode_DialingInformationNumber(PS_DialingInformationNumber x, PS_OutStream stream)
   7580 {
   7581     uint16 i;
   7582     PutBoolean(0, stream); /* Extension Bit OFF */
   7583     PutBoolean(x->option_of_subAddress, stream);
   7584     PutCharString("NumericString", 0, 0, 40, NULL, &x->networkAddress, stream);
   7585     if (x->option_of_subAddress)
   7586     {
   7587         PutCharString("IA5String", 0, 1, 40, NULL, &x->subAddress, stream);
   7588     }
   7589     PutInteger(1, 255, (uint32)x->size_of_networkType, stream);
   7590     for (i = 0; i < x->size_of_networkType; ++i)
   7591     {
   7592         Encode_DialingInformationNetworkType(x->networkType + i, stream);
   7593     }
   7594     /* ------------------------------- */
   7595     /* ---- Extension Begins Here ---- */
   7596     /* ------------------------------- */
   7597 }
   7598 
   7599 /* <======================================================> */
   7600 /*  PER-Encoder for DialingInformationNetworkType (CHOICE)  */
   7601 /* <======================================================> */
   7602 void Encode_DialingInformationNetworkType(PS_DialingInformationNetworkType x, PS_OutStream stream)
   7603 {
   7604     PutChoiceIndex(3, 1, x->index, stream);
   7605     switch (x->index)
   7606     {
   7607         case 0:
   7608             Encode_NonStandardMessage(x->nonStandard, stream);
   7609             break;
   7610         case 1:
   7611             /* (n_isdn is NULL) */
   7612             break;
   7613         case 2:
   7614             /* (gstn is NULL) */
   7615             break;
   7616             /* ------------------------------- */
   7617             /* ---- Extension Begins Here ---- */
   7618             /* ------------------------------- */
   7619         default:
   7620             ErrorMessageAndLeave("Encode_DialingInformationNetworkType: Illegal CHOICE index");
   7621     }
   7622 }
   7623 
   7624 /* <===============================================> */
   7625 /*  PER-Encoder for ConnectionIdentifier (SEQUENCE)  */
   7626 /* <===============================================> */
   7627 void Encode_ConnectionIdentifier(PS_ConnectionIdentifier x, PS_OutStream stream)
   7628 {
   7629     PutBoolean(0, stream); /* Extension Bit OFF */
   7630     PutInteger(0, 0xffffffff, (uint32)x->channelTag, stream);
   7631     PutInteger(0, 0xffffffff, (uint32)x->sequenceNumber, stream);
   7632     /* ------------------------------- */
   7633     /* ---- Extension Begins Here ---- */
   7634     /* ------------------------------- */
   7635 }
   7636 
   7637 /* <====================================================> */
   7638 /*  PER-Encoder for LogicalChannelRateRequest (SEQUENCE)  */
   7639 /* <====================================================> */
   7640 void Encode_LogicalChannelRateRequest(PS_LogicalChannelRateRequest x, PS_OutStream stream)
   7641 {
   7642     PutBoolean(0, stream); /* Extension Bit OFF */
   7643     PutInteger(0, 255, (uint32)x->sequenceNumber, stream);
   7644     PutInteger(1, 65535, (uint32)x->logicalChannelNumber, stream);
   7645     PutInteger(0, 0xffffffff, (uint32)x->maximumBitRate, stream);
   7646     /* ------------------------------- */
   7647     /* ---- Extension Begins Here ---- */
   7648     /* ------------------------------- */
   7649 }
   7650 
   7651 /* <========================================================> */
   7652 /*  PER-Encoder for LogicalChannelRateAcknowledge (SEQUENCE)  */
   7653 /* <========================================================> */
   7654 void Encode_LogicalChannelRateAcknowledge(PS_LogicalChannelRateAcknowledge x, PS_OutStream stream)
   7655 {
   7656     PutBoolean(0, stream); /* Extension Bit OFF */
   7657     PutInteger(0, 255, (uint32)x->sequenceNumber, stream);
   7658     PutInteger(1, 65535, (uint32)x->logicalChannelNumber, stream);
   7659     PutInteger(0, 0xffffffff, (uint32)x->maximumBitRate, stream);
   7660     /* ------------------------------- */
   7661     /* ---- Extension Begins Here ---- */
   7662     /* ------------------------------- */
   7663 }
   7664 
   7665 /* <===================================================> */
   7666 /*  PER-Encoder for LogicalChannelRateReject (SEQUENCE)  */
   7667 /* <===================================================> */
   7668 void Encode_LogicalChannelRateReject(PS_LogicalChannelRateReject x, PS_OutStream stream)
   7669 {
   7670     PutBoolean(0, stream); /* Extension Bit OFF */
   7671     PutBoolean(x->option_of_currentMaximumBitRate, stream);
   7672     PutInteger(0, 255, (uint32)x->sequenceNumber, stream);
   7673     PutInteger(1, 65535, (uint32)x->logicalChannelNumber, stream);
   7674     Encode_LogicalChannelRateRejectReason(&x->rejectReason, stream);
   7675     if (x->option_of_currentMaximumBitRate)
   7676     {
   7677         PutInteger(0, 0xffffffff, (uint32)x->currentMaximumBitRate, stream);
   7678     }
   7679     /* ------------------------------- */
   7680     /* ---- Extension Begins Here ---- */
   7681     /* ------------------------------- */
   7682 }
   7683 
   7684 /* <=======================================================> */
   7685 /*  PER-Encoder for LogicalChannelRateRejectReason (CHOICE)  */
   7686 /* <=======================================================> */
   7687 void Encode_LogicalChannelRateRejectReason(PS_LogicalChannelRateRejectReason x, PS_OutStream stream)
   7688 {
   7689     PutChoiceIndex(2, 1, x->index, stream);
   7690     switch (x->index)
   7691     {
   7692         case 0:
   7693             /* (undefinedReason is NULL) */
   7694             break;
   7695         case 1:
   7696             /* (insufficientResources is NULL) */
   7697             break;
   7698             /* ------------------------------- */
   7699             /* ---- Extension Begins Here ---- */
   7700             /* ------------------------------- */
   7701         default:
   7702             ErrorMessageAndLeave("Encode_LogicalChannelRateRejectReason: Illegal CHOICE index");
   7703     }
   7704 }
   7705 
   7706 /* <====================================================> */
   7707 /*  PER-Encoder for LogicalChannelRateRelease (SEQUENCE)  */
   7708 /* <====================================================> */
   7709 void Encode_LogicalChannelRateRelease(PS_LogicalChannelRateRelease x, PS_OutStream stream)
   7710 {
   7711     OSCL_UNUSED_ARG(x);
   7712     PutBoolean(0, stream); /* Extension Bit OFF */
   7713     /* ------------------------------- */
   7714     /* ---- Extension Begins Here ---- */
   7715     /* ------------------------------- */
   7716 }
   7717 
   7718 /* <==================================================> */
   7719 /*  PER-Encoder for SendTerminalCapabilitySet (CHOICE)  */
   7720 /* <==================================================> */
   7721 void Encode_SendTerminalCapabilitySet(PS_SendTerminalCapabilitySet x, PS_OutStream stream)
   7722 {
   7723     PutChoiceIndex(2, 1, x->index, stream);
   7724     switch (x->index)
   7725     {
   7726         case 0:
   7727             Encode_SpecificRequest(x->specificRequest, stream);
   7728             break;
   7729         case 1:
   7730             /* (genericRequest is NULL) */
   7731             break;
   7732             /* ------------------------------- */
   7733             /* ---- Extension Begins Here ---- */
   7734             /* ------------------------------- */
   7735         default:
   7736             ErrorMessageAndLeave("Encode_SendTerminalCapabilitySet: Illegal CHOICE index");
   7737     }
   7738 }
   7739 
   7740 /* <==========================================> */
   7741 /*  PER-Encoder for SpecificRequest (SEQUENCE)  */
   7742 /* <==========================================> */
   7743 void Encode_SpecificRequest(PS_SpecificRequest x, PS_OutStream stream)
   7744 {
   7745     uint16 i;
   7746     PutBoolean(0, stream); /* Extension Bit OFF */
   7747     PutBoolean(x->option_of_capabilityTableEntryNumbers, stream);
   7748     PutBoolean(x->option_of_capabilityDescriptorNumbers, stream);
   7749     PutBoolean(x->multiplexCapability, stream);
   7750     if (x->option_of_capabilityTableEntryNumbers)
   7751     {
   7752         PutInteger(1, 65535, (uint32)x->size_of_capabilityTableEntryNumbers, stream);
   7753         for (i = 0; i < x->size_of_capabilityTableEntryNumbers; ++i)
   7754         {
   7755             PutInteger(1, 65535, (uint32)x->capabilityTableEntryNumbers[i], stream);
   7756         }
   7757     }
   7758     if (x->option_of_capabilityDescriptorNumbers)
   7759     {
   7760         PutInteger(1, 256, (uint32)x->size_of_capabilityDescriptorNumbers, stream);
   7761         for (i = 0; i < x->size_of_capabilityDescriptorNumbers; ++i)
   7762         {
   7763             PutInteger(0, 255, (uint32)x->capabilityDescriptorNumbers[i], stream);
   7764         }
   7765     }
   7766     /* ------------------------------- */
   7767     /* ---- Extension Begins Here ---- */
   7768     /* ------------------------------- */
   7769 }
   7770 
   7771 /* <==========================================> */
   7772 /*  PER-Encoder for EncryptionCommand (CHOICE)  */
   7773 /* <==========================================> */
   7774 void Encode_EncryptionCommand(PS_EncryptionCommand x, PS_OutStream stream)
   7775 {
   7776     PutChoiceIndex(3, 1, x->index, stream);
   7777     switch (x->index)
   7778     {
   7779         case 0:
   7780             PutOctetString(1, 0, 0, x->encryptionSE, stream);
   7781             break;
   7782         case 1:
   7783             /* (encryptionIVRequest is NULL) */
   7784             break;
   7785         case 2:
   7786             Encode_EncryptionAlgorithmID(x->encryptionAlgorithmID, stream);
   7787             break;
   7788             /* ------------------------------- */
   7789             /* ---- Extension Begins Here ---- */
   7790             /* ------------------------------- */
   7791         default:
   7792             ErrorMessageAndLeave("Encode_EncryptionCommand: Illegal CHOICE index");
   7793     }
   7794 }
   7795 
   7796 /* <================================================> */
   7797 /*  PER-Encoder for EncryptionAlgorithmID (SEQUENCE)  */
   7798 /* <================================================> */
   7799 void Encode_EncryptionAlgorithmID(PS_EncryptionAlgorithmID x, PS_OutStream stream)
   7800 {
   7801     PutInteger(0, 255, (uint32)x->h233AlgorithmIdentifier, stream);
   7802     Encode_NonStandardParameter(&x->associatedAlgorithm, stream);
   7803 }
   7804 
   7805 /* <=============================================> */
   7806 /*  PER-Encoder for FlowControlCommand (SEQUENCE)  */
   7807 /* <=============================================> */
   7808 void Encode_FlowControlCommand(PS_FlowControlCommand x, PS_OutStream stream)
   7809 {
   7810     PutBoolean(0, stream); /* Extension Bit OFF */
   7811     Encode_FccScope(&x->fccScope, stream);
   7812     Encode_FccRestriction(&x->fccRestriction, stream);
   7813     /* ------------------------------- */
   7814     /* ---- Extension Begins Here ---- */
   7815     /* ------------------------------- */
   7816 }
   7817 
   7818 /* <=======================================> */
   7819 /*  PER-Encoder for FccRestriction (CHOICE)  */
   7820 /* <=======================================> */
   7821 void Encode_FccRestriction(PS_FccRestriction x, PS_OutStream stream)
   7822 {
   7823     PutChoiceIndex(2, 0, x->index, stream);
   7824     switch (x->index)
   7825     {
   7826         case 0:
   7827             PutInteger(0, 16777215, (uint32)x->maximumBitRate, stream);
   7828             break;
   7829         case 1:
   7830             /* (noRestriction is NULL) */
   7831             break;
   7832         default:
   7833             ErrorMessageAndLeave("Encode_FccRestriction: Illegal CHOICE index");
   7834     }
   7835 }
   7836 
   7837 /* <=================================> */
   7838 /*  PER-Encoder for FccScope (CHOICE)  */
   7839 /* <=================================> */
   7840 void Encode_FccScope(PS_FccScope x, PS_OutStream stream)
   7841 {
   7842     PutChoiceIndex(3, 0, x->index, stream);
   7843     switch (x->index)
   7844     {
   7845         case 0:
   7846             PutInteger(1, 65535, (uint32)x->logicalChannelNumber, stream);
   7847             break;
   7848         case 1:
   7849             PutInteger(0, 65535, (uint32)x->resourceID, stream);
   7850             break;
   7851         case 2:
   7852             /* (wholeMultiplex is NULL) */
   7853             break;
   7854         default:
   7855             ErrorMessageAndLeave("Encode_FccScope: Illegal CHOICE index");
   7856     }
   7857 }
   7858 
   7859 /* <==========================================> */
   7860 /*  PER-Encoder for EndSessionCommand (CHOICE)  */
   7861 /* <==========================================> */
   7862 void Encode_EndSessionCommand(PS_EndSessionCommand x, PS_OutStream stream)
   7863 {
   7864     PutChoiceIndex(3, 1, x->index, stream);
   7865     switch (x->index)
   7866     {
   7867         case 0:
   7868             Encode_NonStandardParameter(x->nonStandard, stream);
   7869             break;
   7870         case 1:
   7871             /* (disconnect is NULL) */
   7872             break;
   7873         case 2:
   7874             Encode_GstnOptions(x->gstnOptions, stream);
   7875             break;
   7876             /* ------------------------------- */
   7877             /* ---- Extension Begins Here ---- */
   7878             /* ------------------------------- */
   7879         case 3:
   7880             PutExtensionItem(EPASS Encode_IsdnOptions, (uint8*)x->isdnOptions, stream);
   7881             break;
   7882         default:
   7883             ErrorMessageAndLeave("Encode_EndSessionCommand: Illegal CHOICE index");
   7884     }
   7885 }
   7886 
   7887 /* <====================================> */
   7888 /*  PER-Encoder for IsdnOptions (CHOICE)  */
   7889 /* <====================================> */
   7890 void Encode_IsdnOptions(PS_IsdnOptions x, PS_OutStream stream)
   7891 {
   7892     PutChoiceIndex(3, 1, x->index, stream);
   7893     switch (x->index)
   7894     {
   7895         case 0:
   7896             /* (telephonyMode is NULL) */
   7897             break;
   7898         case 1:
   7899             /* (v140 is NULL) */
   7900             break;
   7901         case 2:
   7902             /* (terminalOnHold is NULL) */
   7903             break;
   7904             /* ------------------------------- */
   7905             /* ---- Extension Begins Here ---- */
   7906             /* ------------------------------- */
   7907         default:
   7908             ErrorMessageAndLeave("Encode_IsdnOptions: Illegal CHOICE index");
   7909     }
   7910 }
   7911 
   7912 /* <====================================> */
   7913 /*  PER-Encoder for GstnOptions (CHOICE)  */
   7914 /* <====================================> */
   7915 void Encode_GstnOptions(PS_GstnOptions x, PS_OutStream stream)
   7916 {
   7917     PutChoiceIndex(5, 1, x->index, stream);
   7918     switch (x->index)
   7919     {
   7920         case 0:
   7921             /* (telephonyMode is NULL) */
   7922             break;
   7923         case 1:
   7924             /* (v8bis is NULL) */
   7925             break;
   7926         case 2:
   7927             /* (v34DSVD is NULL) */
   7928             break;
   7929         case 3:
   7930             /* (v34DuplexFAX is NULL) */
   7931             break;
   7932         case 4:
   7933             /* (v34H324 is NULL) */
   7934             break;
   7935             /* ------------------------------- */
   7936             /* ---- Extension Begins Here ---- */
   7937             /* ------------------------------- */
   7938         default:
   7939             ErrorMessageAndLeave("Encode_GstnOptions: Illegal CHOICE index");
   7940     }
   7941 }
   7942 
   7943 /* <==========================================> */
   7944 /*  PER-Encoder for ConferenceCommand (CHOICE)  */
   7945 /* <==========================================> */
   7946 void Encode_ConferenceCommand(PS_ConferenceCommand x, PS_OutStream stream)
   7947 {
   7948     PutChoiceIndex(7, 1, x->index, stream);
   7949     switch (x->index)
   7950     {
   7951         case 0:
   7952             PutInteger(1, 65535, (uint32)x->broadcastMyLogicalChannel, stream);
   7953             break;
   7954         case 1:
   7955             PutInteger(1, 65535, (uint32)x->cancelBroadcastMyLogicalChannel, stream);
   7956             break;
   7957         case 2:
   7958             Encode_TerminalLabel(x->makeTerminalBroadcaster, stream);
   7959             break;
   7960         case 3:
   7961             /* (cancelMakeTerminalBroadcaster is NULL) */
   7962             break;
   7963         case 4:
   7964             Encode_TerminalLabel(x->sendThisSource, stream);
   7965             break;
   7966         case 5:
   7967             /* (cancelSendThisSource is NULL) */
   7968             break;
   7969         case 6:
   7970             /* (dropConference is NULL) */
   7971             break;
   7972             /* ------------------------------- */
   7973             /* ---- Extension Begins Here ---- */
   7974             /* ------------------------------- */
   7975         case 7:
   7976             PutExtensionItem(EPASS Encode_SubstituteConferenceIDCommand, (uint8*)x->substituteConferenceIDCommand, stream);
   7977             break;
   7978         default:
   7979             ErrorMessageAndLeave("Encode_ConferenceCommand: Illegal CHOICE index");
   7980     }
   7981 }
   7982 
   7983 /* <========================================================> */
   7984 /*  PER-Encoder for SubstituteConferenceIDCommand (SEQUENCE)  */
   7985 /* <========================================================> */
   7986 void Encode_SubstituteConferenceIDCommand(PS_SubstituteConferenceIDCommand x, PS_OutStream stream)
   7987 {
   7988     PutBoolean(0, stream); /* Extension Bit OFF */
   7989     PutOctetString(0, 16, 16, &x->conferenceIdentifier, stream);
   7990     /* ------------------------------- */
   7991     /* ---- Extension Begins Here ---- */
   7992     /* ------------------------------- */
   7993 }
   7994 
   7995 /* <===============================================> */
   7996 /*  PER-Encoder for MiscellaneousCommand (SEQUENCE)  */
   7997 /* <===============================================> */
   7998 void Encode_MiscellaneousCommand(PS_MiscellaneousCommand x, PS_OutStream stream)
   7999 {
   8000     PutBoolean(0, stream); /* Extension Bit OFF */
   8001     PutInteger(1, 65535, (uint32)x->logicalChannelNumber, stream);
   8002     Encode_McType(&x->mcType, stream);
   8003     /* ------------------------------- */
   8004     /* ---- Extension Begins Here ---- */
   8005     /* ------------------------------- */
   8006 }
   8007 
   8008 /* <===============================> */
   8009 /*  PER-Encoder for McType (CHOICE)  */
   8010 /* <===============================> */
   8011 void Encode_McType(PS_McType x, PS_OutStream stream)
   8012 {
   8013     PutChoiceIndex(10, 1, x->index, stream);
   8014     switch (x->index)
   8015     {
   8016         case 0:
   8017             /* (equaliseDelay is NULL) */
   8018             break;
   8019         case 1:
   8020             /* (zeroDelay is NULL) */
   8021             break;
   8022         case 2:
   8023             /* (multipointModeCommand is NULL) */
   8024             break;
   8025         case 3:
   8026             /* (cancelMultipointModeCommand is NULL) */
   8027             break;
   8028         case 4:
   8029             /* (videoFreezePicture is NULL) */
   8030             break;
   8031         case 5:
   8032             /* (videoFastUpdatePicture is NULL) */
   8033             break;
   8034         case 6:
   8035             Encode_VideoFastUpdateGOB(x->videoFastUpdateGOB, stream);
   8036             break;
   8037         case 7:
   8038             PutInteger(0, 31, (uint32)x->videoTemporalSpatialTradeOff, stream);
   8039             break;
   8040         case 8:
   8041             /* (videoSendSyncEveryGOB is NULL) */
   8042             break;
   8043         case 9:
   8044             /* (videoSendSyncEveryGOBCancel is NULL) */
   8045             break;
   8046             /* ------------------------------- */
   8047             /* ---- Extension Begins Here ---- */
   8048             /* ------------------------------- */
   8049         case 10:
   8050             PutExtensionItem(EPASS Encode_VideoFastUpdateMB, (uint8*)x->videoFastUpdateMB, stream);
   8051             break;
   8052         case 11:
   8053             PutExtensionInteger(1, 65535, (uint32)x->maxH223MUXPDUsize, stream);
   8054             break;
   8055         case 12:
   8056             PutExtensionItem(EPASS Encode_EncryptionSync, (uint8*)x->encryptionUpdate, stream);
   8057             break;
   8058         case 13:
   8059             PutExtensionItem(EPASS Encode_EncryptionUpdateRequest, (uint8*)x->encryptionUpdateRequest, stream);
   8060             break;
   8061         case 14:
   8062             PutExtensionNull(stream);
   8063             break;
   8064         case 15:
   8065             PutExtensionNull(stream);
   8066             break;
   8067         case 16:
   8068             PutExtensionItem(EPASS Encode_ProgressiveRefinementStart, (uint8*)x->progressiveRefinementStart, stream);
   8069             break;
   8070         case 17:
   8071             PutExtensionNull(stream);
   8072             break;
   8073         case 18:
   8074             PutExtensionNull(stream);
   8075             break;
   8076         default:
   8077             ErrorMessageAndLeave("Encode_McType: Illegal CHOICE index");
   8078     }
   8079 }
   8080 
   8081 /* <=====================================================> */
   8082 /*  PER-Encoder for ProgressiveRefinementStart (SEQUENCE)  */
   8083 /* <=====================================================> */
   8084 void Encode_ProgressiveRefinementStart(PS_ProgressiveRefinementStart x, PS_OutStream stream)
   8085 {
   8086     PutBoolean(0, stream); /* Extension Bit OFF */
   8087     Encode_PrsRepeatCount(&x->prsRepeatCount, stream);
   8088     /* ------------------------------- */
   8089     /* ---- Extension Begins Here ---- */
   8090     /* ------------------------------- */
   8091 }
   8092 
   8093 /* <=======================================> */
   8094 /*  PER-Encoder for PrsRepeatCount (CHOICE)  */
   8095 /* <=======================================> */
   8096 void Encode_PrsRepeatCount(PS_PrsRepeatCount x, PS_OutStream stream)
   8097 {
   8098     PutChoiceIndex(4, 1, x->index, stream);
   8099     switch (x->index)
   8100     {
   8101         case 0:
   8102             /* (doOneProgression is NULL) */
   8103             break;
   8104         case 1:
   8105             /* (doContinuousProgressions is NULL) */
   8106             break;
   8107         case 2:
   8108             /* (doOneIndependentProgression is NULL) */
   8109             break;
   8110         case 3:
   8111             /* (doContinuousIndependentProgressions is NULL) */
   8112             break;
   8113             /* ------------------------------- */
   8114             /* ---- Extension Begins Here ---- */
   8115             /* ------------------------------- */
   8116         default:
   8117             ErrorMessageAndLeave("Encode_PrsRepeatCount: Illegal CHOICE index");
   8118     }
   8119 }
   8120 
   8121 /* <============================================> */
   8122 /*  PER-Encoder for VideoFastUpdateMB (SEQUENCE)  */
   8123 /* <============================================> */
   8124 void Encode_VideoFastUpdateMB(PS_VideoFastUpdateMB x, PS_OutStream stream)
   8125 {
   8126     PutBoolean(0, stream); /* Extension Bit OFF */
   8127     PutBoolean(x->option_of_firstGOB, stream);
   8128     PutBoolean(x->option_of_firstMB, stream);
   8129     if (x->option_of_firstGOB)
   8130     {
   8131         PutInteger(0, 255, (uint32)x->firstGOB, stream);
   8132     }
   8133     if (x->option_of_firstMB)
   8134     {
   8135         PutInteger(1, 8192, (uint32)x->firstMB, stream);
   8136     }
   8137     PutInteger(1, 8192, (uint32)x->numberOfMBs, stream);
   8138     /* ------------------------------- */
   8139     /* ---- Extension Begins Here ---- */
   8140     /* ------------------------------- */
   8141 }
   8142 
   8143 /* <=============================================> */
   8144 /*  PER-Encoder for VideoFastUpdateGOB (SEQUENCE)  */
   8145 /* <=============================================> */
   8146 void Encode_VideoFastUpdateGOB(PS_VideoFastUpdateGOB x, PS_OutStream stream)
   8147 {
   8148     PutInteger(0, 17, (uint32)x->firstGOB, stream);
   8149     PutInteger(1, 18, (uint32)x->numberOfGOBs, stream);
   8150 }
   8151 
   8152 /* <==============================================> */
   8153 /*  PER-Encoder for KeyProtectionMethod (SEQUENCE)  */
   8154 /* <==============================================> */
   8155 void Encode_KeyProtectionMethod(PS_KeyProtectionMethod x, PS_OutStream stream)
   8156 {
   8157     PutBoolean(0, stream); /* Extension Bit OFF */
   8158     PutBoolean(x->secureChannel, stream);
   8159     PutBoolean(x->sharedSecret, stream);
   8160     PutBoolean(x->certProtectedKey, stream);
   8161     /* ------------------------------- */
   8162     /* ---- Extension Begins Here ---- */
   8163     /* ------------------------------- */
   8164 }
   8165 
   8166 /* <==================================================> */
   8167 /*  PER-Encoder for EncryptionUpdateRequest (SEQUENCE)  */
   8168 /* <==================================================> */
   8169 void Encode_EncryptionUpdateRequest(PS_EncryptionUpdateRequest x, PS_OutStream stream)
   8170 {
   8171     PutBoolean(0, stream); /* Extension Bit OFF */
   8172     PutBoolean(x->option_of_keyProtectionMethod, stream);
   8173     if (x->option_of_keyProtectionMethod)
   8174     {
   8175         Encode_KeyProtectionMethod(&x->keyProtectionMethod, stream);
   8176     }
   8177     /* ------------------------------- */
   8178     /* ---- Extension Begins Here ---- */
   8179     /* ------------------------------- */
   8180 }
   8181 
   8182 /* <=====================================================> */
   8183 /*  PER-Encoder for H223MultiplexReconfiguration (CHOICE)  */
   8184 /* <=====================================================> */
   8185 void Encode_H223MultiplexReconfiguration(PS_H223MultiplexReconfiguration x, PS_OutStream stream)
   8186 {
   8187     PutChoiceIndex(2, 1, x->index, stream);
   8188     switch (x->index)
   8189     {
   8190         case 0:
   8191             Encode_H223ModeChange(x->h223ModeChange, stream);
   8192             break;
   8193         case 1:
   8194             Encode_H223AnnexADoubleFlag(x->h223AnnexADoubleFlag, stream);
   8195             break;
   8196             /* ------------------------------- */
   8197             /* ---- Extension Begins Here ---- */
   8198             /* ------------------------------- */
   8199         default:
   8200             ErrorMessageAndLeave("Encode_H223MultiplexReconfiguration: Illegal CHOICE index");
   8201     }
   8202 }
   8203 
   8204 /* <=============================================> */
   8205 /*  PER-Encoder for H223AnnexADoubleFlag (CHOICE)  */
   8206 /* <=============================================> */
   8207 void Encode_H223AnnexADoubleFlag(PS_H223AnnexADoubleFlag x, PS_OutStream stream)
   8208 {
   8209     PutChoiceIndex(2, 1, x->index, stream);
   8210     switch (x->index)
   8211     {
   8212         case 0:
   8213             /* (start is NULL) */
   8214             break;
   8215         case 1:
   8216             /* (stop is NULL) */
   8217             break;
   8218             /* ------------------------------- */
   8219             /* ---- Extension Begins Here ---- */
   8220             /* ------------------------------- */
   8221         default:
   8222             ErrorMessageAndLeave("Encode_H223AnnexADoubleFlag: Illegal CHOICE index");
   8223     }
   8224 }
   8225 
   8226 /* <=======================================> */
   8227 /*  PER-Encoder for H223ModeChange (CHOICE)  */
   8228 /* <=======================================> */
   8229 void Encode_H223ModeChange(PS_H223ModeChange x, PS_OutStream stream)
   8230 {
   8231     PutChoiceIndex(4, 1, x->index, stream);
   8232     switch (x->index)
   8233     {
   8234         case 0:
   8235             /* (toLevel0 is NULL) */
   8236             break;
   8237         case 1:
   8238             /* (toLevel1 is NULL) */
   8239             break;
   8240         case 2:
   8241             /* (toLevel2 is NULL) */
   8242             break;
   8243         case 3:
   8244             /* (toLevel2withOptionalHeader is NULL) */
   8245             break;
   8246             /* ------------------------------- */
   8247             /* ---- Extension Begins Here ---- */
   8248             /* ------------------------------- */
   8249         default:
   8250             ErrorMessageAndLeave("Encode_H223ModeChange: Illegal CHOICE index");
   8251     }
   8252 }
   8253 
   8254 /* <==========================================> */
   8255 /*  PER-Encoder for NewATMVCCommand (SEQUENCE)  */
   8256 /* <==========================================> */
   8257 void Encode_NewATMVCCommand(PS_NewATMVCCommand x, PS_OutStream stream)
   8258 {
   8259     PutBoolean(0, stream); /* Extension Bit OFF */
   8260     PutInteger(0, 65535, (uint32)x->resourceID, stream);
   8261     PutInteger(1, 65535, (uint32)x->bitRate, stream);
   8262     PutBoolean(x->bitRateLockedToPCRClock, stream);
   8263     PutBoolean(x->bitRateLockedToNetworkClock, stream);
   8264     Encode_CmdAal(&x->cmdAal, stream);
   8265     Encode_CmdMultiplex(&x->cmdMultiplex, stream);
   8266     Encode_CmdReverseParameters(&x->cmdReverseParameters, stream);
   8267     /* ------------------------------- */
   8268     /* ---- Extension Begins Here ---- */
   8269     /* ------------------------------- */
   8270 }
   8271 
   8272 /* <===============================================> */
   8273 /*  PER-Encoder for CmdReverseParameters (SEQUENCE)  */
   8274 /* <===============================================> */
   8275 void Encode_CmdReverseParameters(PS_CmdReverseParameters x, PS_OutStream stream)
   8276 {
   8277     PutBoolean(0, stream); /* Extension Bit OFF */
   8278     PutInteger(1, 65535, (uint32)x->bitRate, stream);
   8279     PutBoolean(x->bitRateLockedToPCRClock, stream);
   8280     PutBoolean(x->bitRateLockedToNetworkClock, stream);
   8281     Encode_Multiplex(&x->multiplex, stream);
   8282     /* ------------------------------- */
   8283     /* ---- Extension Begins Here ---- */
   8284     /* ------------------------------- */
   8285 }
   8286 
   8287 /* <==================================> */
   8288 /*  PER-Encoder for Multiplex (CHOICE)  */
   8289 /* <==================================> */
   8290 void Encode_Multiplex(PS_Multiplex x, PS_OutStream stream)
   8291 {
   8292     PutChoiceIndex(3, 1, x->index, stream);
   8293     switch (x->index)
   8294     {
   8295         case 0:
   8296             /* (noMultiplex is NULL) */
   8297             break;
   8298         case 1:
   8299             /* (transportStream is NULL) */
   8300             break;
   8301         case 2:
   8302             /* (programStream is NULL) */
   8303             break;
   8304             /* ------------------------------- */
   8305             /* ---- Extension Begins Here ---- */
   8306             /* ------------------------------- */
   8307         default:
   8308             ErrorMessageAndLeave("Encode_Multiplex: Illegal CHOICE index");
   8309     }
   8310 }
   8311 
   8312 /* <=====================================> */
   8313 /*  PER-Encoder for CmdMultiplex (CHOICE)  */
   8314 /* <=====================================> */
   8315 void Encode_CmdMultiplex(PS_CmdMultiplex x, PS_OutStream stream)
   8316 {
   8317     PutChoiceIndex(3, 1, x->index, stream);
   8318     switch (x->index)
   8319     {
   8320         case 0:
   8321             /* (noMultiplex is NULL) */
   8322             break;
   8323         case 1:
   8324             /* (transportStream is NULL) */
   8325             break;
   8326         case 2:
   8327             /* (programStream is NULL) */
   8328             break;
   8329             /* ------------------------------- */
   8330             /* ---- Extension Begins Here ---- */
   8331             /* ------------------------------- */
   8332         default:
   8333             ErrorMessageAndLeave("Encode_CmdMultiplex: Illegal CHOICE index");
   8334     }
   8335 }
   8336 
   8337 /* <===============================> */
   8338 /*  PER-Encoder for CmdAal (CHOICE)  */
   8339 /* <===============================> */
   8340 void Encode_CmdAal(PS_CmdAal x, PS_OutStream stream)
   8341 {
   8342     PutChoiceIndex(2, 1, x->index, stream);
   8343     switch (x->index)
   8344     {
   8345         case 0:
   8346             Encode_CmdAal1(x->cmdAal1, stream);
   8347             break;
   8348         case 1:
   8349             Encode_CmdAal5(x->cmdAal5, stream);
   8350             break;
   8351             /* ------------------------------- */
   8352             /* ---- Extension Begins Here ---- */
   8353             /* ------------------------------- */
   8354         default:
   8355             ErrorMessageAndLeave("Encode_CmdAal: Illegal CHOICE index");
   8356     }
   8357 }
   8358 
   8359 /* <==================================> */
   8360 /*  PER-Encoder for CmdAal5 (SEQUENCE)  */
   8361 /* <==================================> */
   8362 void Encode_CmdAal5(PS_CmdAal5 x, PS_OutStream stream)
   8363 {
   8364     PutBoolean(0, stream); /* Extension Bit OFF */
   8365     PutInteger(0, 65535, (uint32)x->forwardMaximumSDUSize, stream);
   8366     PutInteger(0, 65535, (uint32)x->backwardMaximumSDUSize, stream);
   8367     /* ------------------------------- */
   8368     /* ---- Extension Begins Here ---- */
   8369     /* ------------------------------- */
   8370 }
   8371 
   8372 /* <==================================> */
   8373 /*  PER-Encoder for CmdAal1 (SEQUENCE)  */
   8374 /* <==================================> */
   8375 void Encode_CmdAal1(PS_CmdAal1 x, PS_OutStream stream)
   8376 {
   8377     PutBoolean(0, stream); /* Extension Bit OFF */
   8378     Encode_CmdClockRecovery(&x->cmdClockRecovery, stream);
   8379     Encode_CmdErrorCorrection(&x->cmdErrorCorrection, stream);
   8380     PutBoolean(x->structuredDataTransfer, stream);
   8381     PutBoolean(x->partiallyFilledCells, stream);
   8382     /* ------------------------------- */
   8383     /* ---- Extension Begins Here ---- */
   8384     /* ------------------------------- */
   8385 }
   8386 
   8387 /* <===========================================> */
   8388 /*  PER-Encoder for CmdErrorCorrection (CHOICE)  */
   8389 /* <===========================================> */
   8390 void Encode_CmdErrorCorrection(PS_CmdErrorCorrection x, PS_OutStream stream)
   8391 {
   8392     PutChoiceIndex(4, 1, x->index, stream);
   8393     switch (x->index)
   8394     {
   8395         case 0:
   8396             /* (nullErrorCorrection is NULL) */
   8397             break;
   8398         case 1:
   8399             /* (longInterleaver is NULL) */
   8400             break;
   8401         case 2:
   8402             /* (shortInterleaver is NULL) */
   8403             break;
   8404         case 3:
   8405             /* (errorCorrectionOnly is NULL) */
   8406             break;
   8407             /* ------------------------------- */
   8408             /* ---- Extension Begins Here ---- */
   8409             /* ------------------------------- */
   8410         default:
   8411             ErrorMessageAndLeave("Encode_CmdErrorCorrection: Illegal CHOICE index");
   8412     }
   8413 }
   8414 
   8415 /* <=========================================> */
   8416 /*  PER-Encoder for CmdClockRecovery (CHOICE)  */
   8417 /* <=========================================> */
   8418 void Encode_CmdClockRecovery(PS_CmdClockRecovery x, PS_OutStream stream)
   8419 {
   8420     PutChoiceIndex(3, 1, x->index, stream);
   8421     switch (x->index)
   8422     {
   8423         case 0:
   8424             /* (nullClockRecovery is NULL) */
   8425             break;
   8426         case 1:
   8427             /* (srtsClockRecovery is NULL) */
   8428             break;
   8429         case 2:
   8430             /* (adaptiveClockRecovery is NULL) */
   8431             break;
   8432             /* ------------------------------- */
   8433             /* ---- Extension Begins Here ---- */
   8434             /* ------------------------------- */
   8435         default:
   8436             ErrorMessageAndLeave("Encode_CmdClockRecovery: Illegal CHOICE index");
   8437     }
   8438 }
   8439 
   8440 /* <==============================================> */
   8441 /*  PER-Encoder for FunctionNotUnderstood (CHOICE)  */
   8442 /* <==============================================> */
   8443 void Encode_FunctionNotUnderstood(PS_FunctionNotUnderstood x, PS_OutStream stream)
   8444 {
   8445     PutChoiceIndex(3, 0, x->index, stream);
   8446     switch (x->index)
   8447     {
   8448         case 0:
   8449             Encode_RequestMessage(x->request, stream);
   8450             break;
   8451         case 1:
   8452             Encode_ResponseMessage(x->response, stream);
   8453             break;
   8454         case 2:
   8455             Encode_CommandMessage(x->command, stream);
   8456             break;
   8457         default:
   8458             ErrorMessageAndLeave("Encode_FunctionNotUnderstood: Illegal CHOICE index");
   8459     }
   8460 }
   8461 
   8462 /* <===============================================> */
   8463 /*  PER-Encoder for FunctionNotSupported (SEQUENCE)  */
   8464 /* <===============================================> */
   8465 void Encode_FunctionNotSupported(PS_FunctionNotSupported x, PS_OutStream stream)
   8466 {
   8467     PutBoolean(0, stream); /* Extension Bit OFF */
   8468     PutBoolean(x->option_of_returnedFunction, stream);
   8469     Encode_FnsCause(&x->fnsCause, stream);
   8470     if (x->option_of_returnedFunction)
   8471     {
   8472         PutOctetString(1, 0, 0, &x->returnedFunction, stream);
   8473     }
   8474     /* ------------------------------- */
   8475     /* ---- Extension Begins Here ---- */
   8476     /* ------------------------------- */
   8477 }
   8478 
   8479 /* <=================================> */
   8480 /*  PER-Encoder for FnsCause (CHOICE)  */
   8481 /* <=================================> */
   8482 void Encode_FnsCause(PS_FnsCause x, PS_OutStream stream)
   8483 {
   8484     PutChoiceIndex(3, 1, x->index, stream);
   8485     switch (x->index)
   8486     {
   8487         case 0:
   8488             /* (syntaxError is NULL) */
   8489             break;
   8490         case 1:
   8491             /* (semanticError is NULL) */
   8492             break;
   8493         case 2:
   8494             /* (unknownFunction is NULL) */
   8495             break;
   8496             /* ------------------------------- */
   8497             /* ---- Extension Begins Here ---- */
   8498             /* ------------------------------- */
   8499         default:
   8500             ErrorMessageAndLeave("Encode_FnsCause: Illegal CHOICE index");
   8501     }
   8502 }
   8503 
   8504 /* <=============================================> */
   8505 /*  PER-Encoder for ConferenceIndication (CHOICE)  */
   8506 /* <=============================================> */
   8507 void Encode_ConferenceIndication(PS_ConferenceIndication x, PS_OutStream stream)
   8508 {
   8509     PutChoiceIndex(10, 1, x->index, stream);
   8510     switch (x->index)
   8511     {
   8512         case 0:
   8513             PutInteger(0, 9, (uint32)x->sbeNumber, stream);
   8514             break;
   8515         case 1:
   8516             Encode_TerminalLabel(x->terminalNumberAssign, stream);
   8517             break;
   8518         case 2:
   8519             Encode_TerminalLabel(x->terminalJoinedConference, stream);
   8520             break;
   8521         case 3:
   8522             Encode_TerminalLabel(x->terminalLeftConference, stream);
   8523             break;
   8524         case 4:
   8525             /* (seenByAtLeastOneOther is NULL) */
   8526             break;
   8527         case 5:
   8528             /* (cancelSeenByAtLeastOneOther is NULL) */
   8529             break;
   8530         case 6:
   8531             /* (seenByAll is NULL) */
   8532             break;
   8533         case 7:
   8534             /* (cancelSeenByAll is NULL) */
   8535             break;
   8536         case 8:
   8537             Encode_TerminalLabel(x->terminalYouAreSeeing, stream);
   8538             break;
   8539         case 9:
   8540             /* (requestForFloor is NULL) */
   8541             break;
   8542             /* ------------------------------- */
   8543             /* ---- Extension Begins Here ---- */
   8544             /* ------------------------------- */
   8545         case 10:
   8546             PutExtensionNull(stream);
   8547             break;
   8548         case 11:
   8549             PutExtensionItem(EPASS Encode_TerminalLabel, (uint8*)x->floorRequested, stream);
   8550             break;
   8551         case 12:
   8552             PutExtensionItem(EPASS Encode_TerminalYouAreSeeingInSubPictureNumber, (uint8*)x->terminalYouAreSeeingInSubPictureNumber, stream);
   8553             break;
   8554         case 13:
   8555             PutExtensionItem(EPASS Encode_VideoIndicateCompose, (uint8*)x->videoIndicateCompose, stream);
   8556             break;
   8557         default:
   8558             ErrorMessageAndLeave("Encode_ConferenceIndication: Illegal CHOICE index");
   8559     }
   8560 }
   8561 
   8562 /* <=================================================================> */
   8563 /*  PER-Encoder for TerminalYouAreSeeingInSubPictureNumber (SEQUENCE)  */
   8564 /* <=================================================================> */
   8565 void Encode_TerminalYouAreSeeingInSubPictureNumber(PS_TerminalYouAreSeeingInSubPictureNumber x, PS_OutStream stream)
   8566 {
   8567     PutBoolean(0, stream); /* Extension Bit OFF */
   8568     PutInteger(0, 192, (uint32)x->terminalNumber, stream);
   8569     PutInteger(0, 255, (uint32)x->subPictureNumber, stream);
   8570     /* ------------------------------- */
   8571     /* ---- Extension Begins Here ---- */
   8572     /* ------------------------------- */
   8573 }
   8574 
   8575 /* <===============================================> */
   8576 /*  PER-Encoder for VideoIndicateCompose (SEQUENCE)  */
   8577 /* <===============================================> */
   8578 void Encode_VideoIndicateCompose(PS_VideoIndicateCompose x, PS_OutStream stream)
   8579 {
   8580     PutBoolean(0, stream); /* Extension Bit OFF */
   8581     PutInteger(0, 255, (uint32)x->compositionNumber, stream);
   8582     /* ------------------------------- */
   8583     /* ---- Extension Begins Here ---- */
   8584     /* ------------------------------- */
   8585 }
   8586 
   8587 /* <==================================================> */
   8588 /*  PER-Encoder for MiscellaneousIndication (SEQUENCE)  */
   8589 /* <==================================================> */
   8590 void Encode_MiscellaneousIndication(PS_MiscellaneousIndication x, PS_OutStream stream)
   8591 {
   8592     PutBoolean(0, stream); /* Extension Bit OFF */
   8593     PutInteger(1, 65535, (uint32)x->logicalChannelNumber, stream);
   8594     Encode_MiType(&x->miType, stream);
   8595     /* ------------------------------- */
   8596     /* ---- Extension Begins Here ---- */
   8597     /* ------------------------------- */
   8598 }
   8599 
   8600 /* <===============================> */
   8601 /*  PER-Encoder for MiType (CHOICE)  */
   8602 /* <===============================> */
   8603 void Encode_MiType(PS_MiType x, PS_OutStream stream)
   8604 {
   8605     PutChoiceIndex(10, 1, x->index, stream);
   8606     switch (x->index)
   8607     {
   8608         case 0:
   8609             /* (logicalChannelActive is NULL) */
   8610             break;
   8611         case 1:
   8612             /* (logicalChannelInactive is NULL) */
   8613             break;
   8614         case 2:
   8615             /* (multipointConference is NULL) */
   8616             break;
   8617         case 3:
   8618             /* (cancelMultipointConference is NULL) */
   8619             break;
   8620         case 4:
   8621             /* (multipointZeroComm is NULL) */
   8622             break;
   8623         case 5:
   8624             /* (cancelMultipointZeroComm is NULL) */
   8625             break;
   8626         case 6:
   8627             /* (multipointSecondaryStatus is NULL) */
   8628             break;
   8629         case 7:
   8630             /* (cancelMultipointSecondaryStatus is NULL) */
   8631             break;
   8632         case 8:
   8633             /* (videoIndicateReadyToActivate is NULL) */
   8634             break;
   8635         case 9:
   8636             PutInteger(0, 31, (uint32)x->videoTemporalSpatialTradeOff, stream);
   8637             break;
   8638             /* ------------------------------- */
   8639             /* ---- Extension Begins Here ---- */
   8640             /* ------------------------------- */
   8641         case 10:
   8642             PutExtensionItem(EPASS Encode_VideoNotDecodedMBs, (uint8*)x->videoNotDecodedMBs, stream);
   8643             break;
   8644         case 11:
   8645             PutExtensionItem(EPASS Encode_TransportCapability, (uint8*)x->transportCapability, stream);
   8646             break;
   8647         default:
   8648             ErrorMessageAndLeave("Encode_MiType: Illegal CHOICE index");
   8649     }
   8650 }
   8651 
   8652 /* <=============================================> */
   8653 /*  PER-Encoder for VideoNotDecodedMBs (SEQUENCE)  */
   8654 /* <=============================================> */
   8655 void Encode_VideoNotDecodedMBs(PS_VideoNotDecodedMBs x, PS_OutStream stream)
   8656 {
   8657     PutBoolean(0, stream); /* Extension Bit OFF */
   8658     PutInteger(1, 8192, (uint32)x->firstMB, stream);
   8659     PutInteger(1, 8192, (uint32)x->numberOfMBs, stream);
   8660     PutInteger(0, 255, (uint32)x->temporalReference, stream);
   8661     /* ------------------------------- */
   8662     /* ---- Extension Begins Here ---- */
   8663     /* ------------------------------- */
   8664 }
   8665 
   8666 /* <===========================================> */
   8667 /*  PER-Encoder for JitterIndication (SEQUENCE)  */
   8668 /* <===========================================> */
   8669 void Encode_JitterIndication(PS_JitterIndication x, PS_OutStream stream)
   8670 {
   8671     PutBoolean(0, stream); /* Extension Bit OFF */
   8672     PutBoolean(x->option_of_skippedFrameCount, stream);
   8673     PutBoolean(x->option_of_additionalDecoderBuffer, stream);
   8674     Encode_JiScope(&x->jiScope, stream);
   8675     PutInteger(0, 3, (uint32)x->estimatedReceivedJitterMantissa, stream);
   8676     PutInteger(0, 7, (uint32)x->estimatedReceivedJitterExponent, stream);
   8677     if (x->option_of_skippedFrameCount)
   8678     {
   8679         PutInteger(0, 15, (uint32)x->skippedFrameCount, stream);
   8680     }
   8681     if (x->option_of_additionalDecoderBuffer)
   8682     {
   8683         PutInteger(0, 262143, (uint32)x->additionalDecoderBuffer, stream);
   8684     }
   8685     /* ------------------------------- */
   8686     /* ---- Extension Begins Here ---- */
   8687     /* ------------------------------- */
   8688 }
   8689 
   8690 /* <================================> */
   8691 /*  PER-Encoder for JiScope (CHOICE)  */
   8692 /* <================================> */
   8693 void Encode_JiScope(PS_JiScope x, PS_OutStream stream)
   8694 {
   8695     PutChoiceIndex(3, 0, x->index, stream);
   8696     switch (x->index)
   8697     {
   8698         case 0:
   8699             PutInteger(1, 65535, (uint32)x->logicalChannelNumber, stream);
   8700             break;
   8701         case 1:
   8702             PutInteger(0, 65535, (uint32)x->resourceID, stream);
   8703             break;
   8704         case 2:
   8705             /* (wholeMultiplex is NULL) */
   8706             break;
   8707         default:
   8708             ErrorMessageAndLeave("Encode_JiScope: Illegal CHOICE index");
   8709     }
   8710 }
   8711 
   8712 /* <=============================================> */
   8713 /*  PER-Encoder for H223SkewIndication (SEQUENCE)  */
   8714 /* <=============================================> */
   8715 void Encode_H223SkewIndication(PS_H223SkewIndication x, PS_OutStream stream)
   8716 {
   8717     PutBoolean(0, stream); /* Extension Bit OFF */
   8718     PutInteger(1, 65535, (uint32)x->logicalChannelNumber1, stream);
   8719     PutInteger(1, 65535, (uint32)x->logicalChannelNumber2, stream);
   8720     PutInteger(0, 4095, (uint32)x->skew, stream);
   8721     /* ------------------------------- */
   8722     /* ---- Extension Begins Here ---- */
   8723     /* ------------------------------- */
   8724 }
   8725 
   8726 /* <=====================================================> */
   8727 /*  PER-Encoder for H2250MaximumSkewIndication (SEQUENCE)  */
   8728 /* <=====================================================> */
   8729 void Encode_H2250MaximumSkewIndication(PS_H2250MaximumSkewIndication x, PS_OutStream stream)
   8730 {
   8731     PutBoolean(0, stream); /* Extension Bit OFF */
   8732     PutInteger(1, 65535, (uint32)x->logicalChannelNumber1, stream);
   8733     PutInteger(1, 65535, (uint32)x->logicalChannelNumber2, stream);
   8734     PutInteger(0, 4095, (uint32)x->maximumSkew, stream);
   8735     /* ------------------------------- */
   8736     /* ---- Extension Begins Here ---- */
   8737     /* ------------------------------- */
   8738 }
   8739 
   8740 /* <===============================================> */
   8741 /*  PER-Encoder for MCLocationIndication (SEQUENCE)  */
   8742 /* <===============================================> */
   8743 void Encode_MCLocationIndication(PS_MCLocationIndication x, PS_OutStream stream)
   8744 {
   8745     PutBoolean(0, stream); /* Extension Bit OFF */
   8746     Encode_TransportAddress(&x->signalAddress, stream);
   8747     /* ------------------------------- */
   8748     /* ---- Extension Begins Here ---- */
   8749     /* ------------------------------- */
   8750 }
   8751 
   8752 /* <===============================================> */
   8753 /*  PER-Encoder for VendorIdentification (SEQUENCE)  */
   8754 /* <===============================================> */
   8755 void Encode_VendorIdentification(PS_VendorIdentification x, PS_OutStream stream)
   8756 {
   8757     PutBoolean(0, stream); /* Extension Bit OFF */
   8758     PutBoolean(x->option_of_productNumber, stream);
   8759     PutBoolean(x->option_of_versionNumber, stream);
   8760     Encode_NonStandardIdentifier(&x->vendor, stream);
   8761     if (x->option_of_productNumber)
   8762     {
   8763         PutOctetString(0, 1, 256, &x->productNumber, stream);
   8764     }
   8765     if (x->option_of_versionNumber)
   8766     {
   8767         PutOctetString(0, 1, 256, &x->versionNumber, stream);
   8768     }
   8769     /* ------------------------------- */
   8770     /* ---- Extension Begins Here ---- */
   8771     /* ------------------------------- */
   8772 }
   8773 
   8774 /* <=============================================> */
   8775 /*  PER-Encoder for NewATMVCIndication (SEQUENCE)  */
   8776 /* <=============================================> */
   8777 void Encode_NewATMVCIndication(PS_NewATMVCIndication x, PS_OutStream stream)
   8778 {
   8779     uint32 extension;
   8780 
   8781     extension = x->option_of_indReverseParameters;
   8782     PutBoolean(extension, stream);
   8783 
   8784     PutInteger(0, 65535, (uint32)x->resourceID, stream);
   8785     PutInteger(1, 65535, (uint32)x->bitRate, stream);
   8786     PutBoolean(x->bitRateLockedToPCRClock, stream);
   8787     PutBoolean(x->bitRateLockedToNetworkClock, stream);
   8788     Encode_IndAal(&x->indAal, stream);
   8789     Encode_IndMultiplex(&x->indMultiplex, stream);
   8790     /* ------------------------------- */
   8791     /* ---- Extension Begins Here ---- */
   8792     /* ------------------------------- */
   8793     if (!extension) return; /* (No items present?) */
   8794     PutNormSmallLength(1, stream); /* Begin Options Map */
   8795     PutBoolean(x->option_of_indReverseParameters, stream);
   8796     if (x->option_of_indReverseParameters)
   8797     {
   8798         PutExtensionItem(EPASS Encode_IndReverseParameters, (uint8*)&x->indReverseParameters, stream);
   8799     }
   8800 }
   8801 
   8802 /* <===============================================> */
   8803 /*  PER-Encoder for IndReverseParameters (SEQUENCE)  */
   8804 /* <===============================================> */
   8805 void Encode_IndReverseParameters(PS_IndReverseParameters x, PS_OutStream stream)
   8806 {
   8807     PutBoolean(0, stream); /* Extension Bit OFF */
   8808     PutInteger(1, 65535, (uint32)x->bitRate, stream);
   8809     PutBoolean(x->bitRateLockedToPCRClock, stream);
   8810     PutBoolean(x->bitRateLockedToNetworkClock, stream);
   8811     Encode_IrpMultiplex(&x->irpMultiplex, stream);
   8812     /* ------------------------------- */
   8813     /* ---- Extension Begins Here ---- */
   8814     /* ------------------------------- */
   8815 }
   8816 
   8817 /* <=====================================> */
   8818 /*  PER-Encoder for IrpMultiplex (CHOICE)  */
   8819 /* <=====================================> */
   8820 void Encode_IrpMultiplex(PS_IrpMultiplex x, PS_OutStream stream)
   8821 {
   8822     PutChoiceIndex(3, 1, x->index, stream);
   8823     switch (x->index)
   8824     {
   8825         case 0:
   8826             /* (noMultiplex is NULL) */
   8827             break;
   8828         case 1:
   8829             /* (transportStream is NULL) */
   8830             break;
   8831         case 2:
   8832             /* (programStream is NULL) */
   8833             break;
   8834             /* ------------------------------- */
   8835             /* ---- Extension Begins Here ---- */
   8836             /* ------------------------------- */
   8837         default:
   8838             ErrorMessageAndLeave("Encode_IrpMultiplex: Illegal CHOICE index");
   8839     }
   8840 }
   8841 
   8842 /* <=====================================> */
   8843 /*  PER-Encoder for IndMultiplex (CHOICE)  */
   8844 /* <=====================================> */
   8845 void Encode_IndMultiplex(PS_IndMultiplex x, PS_OutStream stream)
   8846 {
   8847     PutChoiceIndex(3, 1, x->index, stream);
   8848     switch (x->index)
   8849     {
   8850         case 0:
   8851             /* (noMultiplex is NULL) */
   8852             break;
   8853         case 1:
   8854             /* (transportStream is NULL) */
   8855             break;
   8856         case 2:
   8857             /* (programStream is NULL) */
   8858             break;
   8859             /* ------------------------------- */
   8860             /* ---- Extension Begins Here ---- */
   8861             /* ------------------------------- */
   8862         default:
   8863             ErrorMessageAndLeave("Encode_IndMultiplex: Illegal CHOICE index");
   8864     }
   8865 }
   8866 
   8867 /* <===============================> */
   8868 /*  PER-Encoder for IndAal (CHOICE)  */
   8869 /* <===============================> */
   8870 void Encode_IndAal(PS_IndAal x, PS_OutStream stream)
   8871 {
   8872     PutChoiceIndex(2, 1, x->index, stream);
   8873     switch (x->index)
   8874     {
   8875         case 0:
   8876             Encode_IndAal1(x->indAal1, stream);
   8877             break;
   8878         case 1:
   8879             Encode_IndAal5(x->indAal5, stream);
   8880             break;
   8881             /* ------------------------------- */
   8882             /* ---- Extension Begins Here ---- */
   8883             /* ------------------------------- */
   8884         default:
   8885             ErrorMessageAndLeave("Encode_IndAal: Illegal CHOICE index");
   8886     }
   8887 }
   8888 
   8889 /* <==================================> */
   8890 /*  PER-Encoder for IndAal5 (SEQUENCE)  */
   8891 /* <==================================> */
   8892 void Encode_IndAal5(PS_IndAal5 x, PS_OutStream stream)
   8893 {
   8894     PutBoolean(0, stream); /* Extension Bit OFF */
   8895     PutInteger(0, 65535, (uint32)x->forwardMaximumSDUSize, stream);
   8896     PutInteger(0, 65535, (uint32)x->backwardMaximumSDUSize, stream);
   8897     /* ------------------------------- */
   8898     /* ---- Extension Begins Here ---- */
   8899     /* ------------------------------- */
   8900 }
   8901 
   8902 /* <==================================> */
   8903 /*  PER-Encoder for IndAal1 (SEQUENCE)  */
   8904 /* <==================================> */
   8905 void Encode_IndAal1(PS_IndAal1 x, PS_OutStream stream)
   8906 {
   8907     PutBoolean(0, stream); /* Extension Bit OFF */
   8908     Encode_IndClockRecovery(&x->indClockRecovery, stream);
   8909     Encode_IndErrorCorrection(&x->indErrorCorrection, stream);
   8910     PutBoolean(x->structuredDataTransfer, stream);
   8911     PutBoolean(x->partiallyFilledCells, stream);
   8912     /* ------------------------------- */
   8913     /* ---- Extension Begins Here ---- */
   8914     /* ------------------------------- */
   8915 }
   8916 
   8917 /* <===========================================> */
   8918 /*  PER-Encoder for IndErrorCorrection (CHOICE)  */
   8919 /* <===========================================> */
   8920 void Encode_IndErrorCorrection(PS_IndErrorCorrection x, PS_OutStream stream)
   8921 {
   8922     PutChoiceIndex(4, 1, x->index, stream);
   8923     switch (x->index)
   8924     {
   8925         case 0:
   8926             /* (nullErrorCorrection is NULL) */
   8927             break;
   8928         case 1:
   8929             /* (longInterleaver is NULL) */
   8930             break;
   8931         case 2:
   8932             /* (shortInterleaver is NULL) */
   8933             break;
   8934         case 3:
   8935             /* (errorCorrectionOnly is NULL) */
   8936             break;
   8937             /* ------------------------------- */
   8938             /* ---- Extension Begins Here ---- */
   8939             /* ------------------------------- */
   8940         default:
   8941             ErrorMessageAndLeave("Encode_IndErrorCorrection: Illegal CHOICE index");
   8942     }
   8943 }
   8944 
   8945 /* <=========================================> */
   8946 /*  PER-Encoder for IndClockRecovery (CHOICE)  */
   8947 /* <=========================================> */
   8948 void Encode_IndClockRecovery(PS_IndClockRecovery x, PS_OutStream stream)
   8949 {
   8950     PutChoiceIndex(3, 1, x->index, stream);
   8951     switch (x->index)
   8952     {
   8953         case 0:
   8954             /* (nullClockRecovery is NULL) */
   8955             break;
   8956         case 1:
   8957             /* (srtsClockRecovery is NULL) */
   8958             break;
   8959         case 2:
   8960             /* (adaptiveClockRecovery is NULL) */
   8961             break;
   8962             /* ------------------------------- */
   8963             /* ---- Extension Begins Here ---- */
   8964             /* ------------------------------- */
   8965         default:
   8966             ErrorMessageAndLeave("Encode_IndClockRecovery: Illegal CHOICE index");
   8967     }
   8968 }
   8969 
   8970 /* <============================================> */
   8971 /*  PER-Encoder for UserInputIndication (CHOICE)  */
   8972 /* <============================================> */
   8973 void Encode_UserInputIndication(PS_UserInputIndication x, PS_OutStream stream)
   8974 {
   8975     PutChoiceIndex(2, 1, x->index, stream);
   8976     switch (x->index)
   8977     {
   8978         case 0:
   8979             Encode_NonStandardParameter(x->nonStandard, stream);
   8980             break;
   8981         case 1:
   8982             PutCharString("GeneralString", 1, 0, 0, NULL, x->alphanumeric, stream);
   8983             break;
   8984             /* ------------------------------- */
   8985             /* ---- Extension Begins Here ---- */
   8986             /* ------------------------------- */
   8987         case 2:
   8988             PutExtensionItem(EPASS Encode_UserInputSupportIndication, (uint8*)x->userInputSupportIndication, stream);
   8989             break;
   8990         case 3:
   8991             PutExtensionItem(EPASS Encode_Signal, (uint8*)x->signal, stream);
   8992             break;
   8993         case 4:
   8994             PutExtensionItem(EPASS Encode_SignalUpdate, (uint8*)x->signalUpdate, stream);
   8995             break;
   8996         default:
   8997             ErrorMessageAndLeave("Encode_UserInputIndication: Illegal CHOICE index");
   8998     }
   8999 }
   9000 
   9001 /* <=======================================> */
   9002 /*  PER-Encoder for SignalUpdate (SEQUENCE)  */
   9003 /* <=======================================> */
   9004 void Encode_SignalUpdate(PS_SignalUpdate x, PS_OutStream stream)
   9005 {
   9006     PutBoolean(0, stream); /* Extension Bit OFF */
   9007     PutBoolean(x->option_of_rtp, stream);
   9008     PutInteger(1, 65535, (uint32)x->duration, stream);
   9009     if (x->option_of_rtp)
   9010     {
   9011         Encode_Rtp(&x->rtp, stream);
   9012     }
   9013     /* ------------------------------- */
   9014     /* ---- Extension Begins Here ---- */
   9015     /* ------------------------------- */
   9016 }
   9017 
   9018 /* <==============================> */
   9019 /*  PER-Encoder for Rtp (SEQUENCE)  */
   9020 /* <==============================> */
   9021 void Encode_Rtp(PS_Rtp x, PS_OutStream stream)
   9022 {
   9023     PutBoolean(0, stream); /* Extension Bit OFF */
   9024     PutInteger(1, 65535, (uint32)x->logicalChannelNumber, stream);
   9025     /* ------------------------------- */
   9026     /* ---- Extension Begins Here ---- */
   9027     /* ------------------------------- */
   9028 }
   9029 
   9030 /* <=================================> */
   9031 /*  PER-Encoder for Signal (SEQUENCE)  */
   9032 /* <=================================> */
   9033 void Encode_Signal(PS_Signal x, PS_OutStream stream)
   9034 {
   9035     PutBoolean(0, stream); /* Extension Bit OFF */
   9036     PutBoolean(x->option_of_duration, stream);
   9037     PutBoolean(x->option_of_signalRtp, stream);
   9038     PutCharString("IA5String", 0, 1, 1, "0123456789#*ABCD!", &x->signalType, stream);
   9039     if (x->option_of_duration)
   9040     {
   9041         PutInteger(1, 65535, (uint32)x->duration, stream);
   9042     }
   9043     if (x->option_of_signalRtp)
   9044     {
   9045         Encode_SignalRtp(&x->signalRtp, stream);
   9046     }
   9047     /* ------------------------------- */
   9048     /* ---- Extension Begins Here ---- */
   9049     /* ------------------------------- */
   9050 }
   9051 
   9052 /* <====================================> */
   9053 /*  PER-Encoder for SignalRtp (SEQUENCE)  */
   9054 /* <====================================> */
   9055 void Encode_SignalRtp(PS_SignalRtp x, PS_OutStream stream)
   9056 {
   9057     PutBoolean(0, stream); /* Extension Bit OFF */
   9058     PutBoolean(x->option_of_timestamp, stream);
   9059     PutBoolean(x->option_of_expirationTime, stream);
   9060     if (x->option_of_timestamp)
   9061     {
   9062         PutInteger(0, 0xffffffff, (uint32)x->timestamp, stream);
   9063     }
   9064     if (x->option_of_expirationTime)
   9065     {
   9066         PutInteger(0, 0xffffffff, (uint32)x->expirationTime, stream);
   9067     }
   9068     PutInteger(1, 65535, (uint32)x->logicalChannelNumber, stream);
   9069     /* ------------------------------- */
   9070     /* ---- Extension Begins Here ---- */
   9071     /* ------------------------------- */
   9072 }
   9073 
   9074 /* <===================================================> */
   9075 /*  PER-Encoder for UserInputSupportIndication (CHOICE)  */
   9076 /* <===================================================> */
   9077 void Encode_UserInputSupportIndication(PS_UserInputSupportIndication x, PS_OutStream stream)
   9078 {
   9079     PutChoiceIndex(4, 1, x->index, stream);
   9080     switch (x->index)
   9081     {
   9082         case 0:
   9083             Encode_NonStandardParameter(x->nonStandard, stream);
   9084             break;
   9085         case 1:
   9086             /* (basicString is NULL) */
   9087             break;
   9088         case 2:
   9089             /* (iA5String is NULL) */
   9090             break;
   9091         case 3:
   9092             /* (generalString is NULL) */
   9093             break;
   9094             /* ------------------------------- */
   9095             /* ---- Extension Begins Here ---- */
   9096             /* ------------------------------- */
   9097         default:
   9098             ErrorMessageAndLeave("Encode_UserInputSupportIndication: Illegal CHOICE index");
   9099     }
   9100 }
   9101 
   9102 /* <================================================> */
   9103 /*  PER-Encoder for FlowControlIndication (SEQUENCE)  */
   9104 /* <================================================> */
   9105 void Encode_FlowControlIndication(PS_FlowControlIndication x, PS_OutStream stream)
   9106 {
   9107     PutBoolean(0, stream); /* Extension Bit OFF */
   9108     Encode_FciScope(&x->fciScope, stream);
   9109     Encode_FciRestriction(&x->fciRestriction, stream);
   9110     /* ------------------------------- */
   9111     /* ---- Extension Begins Here ---- */
   9112     /* ------------------------------- */
   9113 }
   9114 
   9115 /* <=======================================> */
   9116 /*  PER-Encoder for FciRestriction (CHOICE)  */
   9117 /* <=======================================> */
   9118 void Encode_FciRestriction(PS_FciRestriction x, PS_OutStream stream)
   9119 {
   9120     PutChoiceIndex(2, 0, x->index, stream);
   9121     switch (x->index)
   9122     {
   9123         case 0:
   9124             PutInteger(0, 16777215, (uint32)x->maximumBitRate, stream);
   9125             break;
   9126         case 1:
   9127             /* (noRestriction is NULL) */
   9128             break;
   9129         default:
   9130             ErrorMessageAndLeave("Encode_FciRestriction: Illegal CHOICE index");
   9131     }
   9132 }
   9133 
   9134 /* <=================================> */
   9135 /*  PER-Encoder for FciScope (CHOICE)  */
   9136 /* <=================================> */
   9137 void Encode_FciScope(PS_FciScope x, PS_OutStream stream)
   9138 {
   9139     PutChoiceIndex(3, 0, x->index, stream);
   9140     switch (x->index)
   9141     {
   9142         case 0:
   9143             PutInteger(1, 65535, (uint32)x->logicalChannelNumber, stream);
   9144             break;
   9145         case 1:
   9146             PutInteger(0, 65535, (uint32)x->resourceID, stream);
   9147             break;
   9148         case 2:
   9149             /* (wholeMultiplex is NULL) */
   9150             break;
   9151         default:
   9152             ErrorMessageAndLeave("Encode_FciScope: Illegal CHOICE index");
   9153     }
   9154 }
   9155 
   9156