Home | History | Annotate | Download | only in include
      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 // ----------------------------------------------------------------------
     19 //
     20 // This Software is an original work of authorship of PacketVideo Corporation.
     21 // Portions of the Software were developed in collaboration with NTT  DoCoMo,
     22 // Inc. or were derived from the public domain or materials licensed from
     23 // third parties.  Title and ownership, including all intellectual property
     24 // rights in and to the Software shall remain with PacketVideo Corporation
     25 // and NTT DoCoMo, Inc.
     26 //
     27 // -----------------------------------------------------------------------
     28 /************************************************************************/
     29 /*  file name       : serme.h                                           */
     30 /*  file contents   : Request Multiplex Entry Signalling Entity         */
     31 /*                  :                                 Management Header */
     32 /*  draw            : '96.11.26                                         */
     33 /*----------------------------------------------------------------------*/
     34 /*  amendment       :                                                   */
     35 /*                          Copyright (C) 1996 NTT DoCoMo               */
     36 /************************************************************************/
     37 #ifndef _SERME_H_
     38 #define _SERME_H_
     39 
     40 
     41 /************************************************************************/
     42 /*  Headerfile Include                                                  */
     43 /************************************************************************/
     44 #include "h245pri.h"
     45 #include "sebase.h"
     46 #include "oscl_mem.h"
     47 
     48 /************************************************************************/
     49 /*  Definition                                                          */
     50 /************************************************************************/
     51 #define     RME_OUTGOING_IDLE           0X00    /* Outgoing Idle */
     52 #define     RME_OUTGOING_AWTING_RPS     0X10    /* Outgoing Awaiting Response */
     53 #define     RME_INCOMING_IDLE           0X01    /* Incoming Idle */
     54 #define     RME_INCOMING_AWTING_RPS     0X11    /* Incoming Awaiting Response */
     55 
     56 
     57 /************************************************************************/
     58 /*  Function Prototype Declare                                          */
     59 /************************************************************************/
     60 
     61 class RMEntries
     62 {
     63         enum { MAX_ENTRIES = 20 };
     64     public:
     65         RMEntries()
     66         {
     67             Clear();
     68         }
     69         ~RMEntries() {}
     70 
     71         int32 SizeRead()
     72         {
     73             return SizeEntries;
     74         }
     75         void EntriesCopy(uint32* pEntries)
     76         {
     77             oscl_memcpy((int8*)pEntries, (int8*)Entries, SizeEntries * sizeof(uint32)) ;
     78         }
     79 
     80         void Write(int sizeEntries, uint32* entries)
     81         {
     82             SizeEntries = sizeEntries;
     83             oscl_memcpy((int8*)Entries, entries, sizeEntries * sizeof(uint32));
     84         }
     85 
     86         void Clear()
     87         {
     88             SizeEntries = 0;
     89             oscl_memset(Entries, 0, sizeof(Entries[0]));
     90         }
     91 
     92         void Sequence()
     93         {
     94             SizeEntries = 15;
     95             for (int ii = 0; ii < SizeEntries; ii++)
     96             {
     97                 Entries[ii] = ii + 1;
     98             }
     99         }
    100 
    101     private:
    102         int32  SizeEntries;
    103         uint32 Entries[ MAX_ENTRIES ];
    104 };
    105 
    106 class RME : public SEBase
    107 {
    108     public:
    109         RME() : SEBase()
    110         {
    111             OutRMEntries.Sequence();
    112             InRMEntries.Clear();
    113             T107TimerStop() ;
    114             TmrSqcNumberClear() ;               /* H245_TWOWAY */
    115             StatusWrite(RME_INCOMING_IDLE) ;    /* Init incoming RMESE */
    116             StatusWrite(RME_OUTGOING_IDLE) ;    /* Init outgoing RMESE */
    117         }
    118         ~RME() {}
    119 
    120         void Reset()
    121         {
    122             OutRMEntries.Sequence();
    123             InRMEntries.Clear();
    124             T107TimerStop() ;
    125             TmrSqcNumberClear() ;
    126             StatusWrite(RME_INCOMING_IDLE) ;
    127             StatusWrite(RME_OUTGOING_IDLE) ;
    128         }
    129 
    130         void _0600_0000(void) ;
    131         void _0601_0001(PS_RequestMultiplexEntry) ;
    132         void _0601_0011(PS_RequestMultiplexEntry) ;
    133         void _0602_0011(void) ;
    134         void _0603_0011(PS_RmeRejectCause) ;
    135         void _0604_0010(PS_RequestMultiplexEntryAck) ;
    136         void _0605_0010(PS_RequestMultiplexEntryReject) ;
    137         void _0606_0010(int32) ;
    138         void _0607_0011(PS_RequestMultiplexEntryRelease) ;
    139 
    140     private:
    141         RME(const RME&);
    142 
    143         void MsgEntrySend(void) ;
    144         void MsgEntryAckSend(void) ;
    145         void MsgEntryRjtSend(PS_RmeRejectCause) ;
    146         void MsgEntryRlsSend(void) ;
    147         void PtvSendIndSend(void) ;
    148         void PtvRjtIdcSend(int32 , PS_RmeRejectCause) ;
    149         void PtvSendCfmSend(void) ;
    150     public:
    151         uint8 StatusRead(void)
    152         {
    153             return Status;
    154         }
    155         uint8 StatusRead2(void)
    156         {
    157             return Status2;
    158         }
    159     private:
    160         void StatusWrite(uint8 status)
    161         {
    162             if (status&0x01)                      /* Incoming */
    163             {
    164 #ifdef PVANALYZER
    165                 StatusShow(Status2, status);
    166 #endif
    167                 Status2 = status;
    168             }
    169             else                                   /* Outgoing */
    170             {
    171 #ifdef PVANALYZER
    172                 StatusShow(Status, status);
    173 #endif
    174                 Status = status;
    175             }
    176         }
    177 
    178 #ifdef PVANALYZER
    179         void StatusShow(uint8 oldStatus, uint8 newStatus);
    180         char* StateLabel(uint8 status);
    181 #endif
    182 
    183         void TmrSqcNumberClear(void)
    184         {
    185             TmrSqcNumber = 0;
    186         }
    187         int32 TmrSqcNumberRead(void)
    188         {
    189             return TmrSqcNumber;
    190         }
    191         void TmrSqcNumberInc(void)
    192         {
    193             TmrSqcNumber++;
    194         }
    195         void T107TimerStart(void);
    196         void T107TimerStop(void);
    197 
    198         RMEntries OutRMEntries;
    199         RMEntries InRMEntries;
    200         int32       TmrSqcNumber;
    201         uint8     Status;
    202         uint8     Status2;
    203 };
    204 
    205 #endif /* _SERME_ */
    206