satengine/SatServer/Engine/inc/TSatQoSParser.h
changeset 0 ff3b6d0fd310
equal deleted inserted replaced
-1:000000000000 0:ff3b6d0fd310
       
     1 /*
       
     2 * Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Maps QoS classes to correxponding Hex values
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef TSATQOSPARSER_H
       
    20 #define TSATQOSPARSER_H
       
    21 
       
    22 #include <e32std.h>
       
    23 #include <etelsat.h>
       
    24 #include <etelqos.h>
       
    25 
       
    26 /**
       
    27  *  Parses QoS Classes coming from SIM in open channel to corresponding 
       
    28  *  values to use with RPacketQoS and vice versa.
       
    29  *
       
    30  *  Bearer params are in order:
       
    31  *   0 = Precedence class
       
    32  *   1 = Delay class
       
    33  *   2 = Reliability class
       
    34  *   3 = Peak throughput
       
    35  *   4 = Mean throughput
       
    36  *   (5 = protocol)
       
    37  *
       
    38  *
       
    39  *  @lib SatEngine.lib
       
    40  *  @since 3.0
       
    41  */
       
    42 class TSatQoSParser
       
    43     {
       
    44     
       
    45 public:
       
    46         
       
    47     /**  Enum for Maximum bit rate */
       
    48     enum TSatMaxBitRate
       
    49         {
       
    50         ESatMaxBitRateUnspecified = 0,
       
    51         ESatMaxBitRate1 = 8,
       
    52         ESatMaxBitRate2 = 16,
       
    53         ESatMaxBitRate3 = 32,
       
    54         ESatMaxBitRate4 = 64,
       
    55         ESatMaxBitRate5 = 128,
       
    56         ESatMaxBitRate6 = 256,
       
    57         ESatMaxBitRate7 = 512,
       
    58         ESatMaxBitRate8 = 1024,
       
    59         ESatMaxBitRate9 = 2048,
       
    60         };
       
    61         
       
    62     /**  Struct for converting QoS params */
       
    63     struct TQoSRel5
       
    64         {
       
    65         TInt iTrafficClass;             // Traffic Class
       
    66         TInt iTrafficHandlingPriority;  // Traffic handling priority
       
    67         TInt iSduErrorRatio;            // SDU error ratio            
       
    68         TInt iResidualBer;              // Residual bit error ratio
       
    69         TInt iDeliveryErroneousSdu;     // Delivery of Erroneous SDUs
       
    70         TInt iMaxBitRate;               // Maximum bitrate
       
    71         TInt iMaximumSDUSize;           // Maximum SDU size
       
    72         TInt iDeliveryOrder;            // Delivery Order
       
    73         };
       
    74 
       
    75 // New functions
       
    76         
       
    77     /**
       
    78      * Converts requested QoS classes to corresponding Hex values used
       
    79      * by ETel Packet when requesting QoS parameters
       
    80      * 
       
    81      * @param aParams Requested QoS classes coming from SIM
       
    82      * @param aResult Output QoS values in RPacketQoS::TQoSGPRSRequested
       
    83      */
       
    84     static void GetRequestedQoSValues(
       
    85         RSat::TBearerParams& aParams, 
       
    86         RPacketQoS::TQoSGPRSRequested& aResult);
       
    87         
       
    88     /**
       
    89      * Converts negotiated QoS values to corresponding QoS class values used
       
    90      * in OpenChannel terminal response.
       
    91      * 
       
    92      * @param aNegParams Negotiated QoS parameters
       
    93      * @param aResult Output QoS class values in RSat::TBearerParams
       
    94      */ 
       
    95     static void GetNegotiatedQoSValues( 
       
    96         const RPacketQoS::TQoSGPRSNegotiated& aNegParams, 
       
    97         RSat::TBearerParams& aResult );
       
    98         
       
    99     /**
       
   100      * Convert QoS parameters from Rel97/98 format to Rel5 format
       
   101      * 
       
   102      * @param aReqParams: Requested QoS parameters in Rel97/98 format
       
   103      * @return QoS paramters in Rel5 format
       
   104      */ 
       
   105     static TQoSRel5 ConvertQoS( 
       
   106         const RPacketQoS::TQoSGPRSRequested& aReqParams );
       
   107             
       
   108     /**
       
   109      * Convert QoS parameters from Rel5 format to Rel97/98 format
       
   110      * 
       
   111      * @param aNegQoSRel5: Negotiated QoS parameters in Rel5 format
       
   112      * @return Negotiated QoS paramters in Rel97/98 format
       
   113      */ 
       
   114     static RPacketQoS::TQoSGPRSNegotiated ConvertNegotiatedQoS( 
       
   115         const TQoSRel5& aNegQoSRel5 );
       
   116         
       
   117 private:
       
   118 
       
   119 // New functions
       
   120         
       
   121     /**
       
   122      * Checks is requested index bigger than maximum lenght to prevent 
       
   123      * array overflows
       
   124      *
       
   125      * @param aReqIndex Requested index
       
   126      * @param aMaxIndex Last index, Requested cannot be bigger than this
       
   127      * @param Retuns aReqIndex, if it's not bigger that aMaxIndex, else 0
       
   128      */ 
       
   129     static TInt CheckIndex( TInt aReqIndex, TInt aMaxIndex );
       
   130     };
       
   131 
       
   132 #endif      // TSATQOSPARSER_H
       
   133 
       
   134 // End of File