telephonyprotocols/umtsgprsscpr/src/UmtsGprs_subconnProv.cpp
changeset 68 d0d9cc530d21
parent 62 8ef833fbf5aa
child 75 f45cd1ad4667
equal deleted inserted replaced
62:8ef833fbf5aa 68:d0d9cc530d21
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Implementation file for the Umts/Gprs SubConnection Provider
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalComponent
       
    21 */
       
    22 
       
    23 
       
    24 
       
    25 #include <cs_subconevents.h>
       
    26 #include "UmtsGprs_subconnProv.h"
       
    27 
       
    28 const TInt KQoSMappingBorderDelay = 250;
       
    29 
       
    30 #define IN_RANGE_INCLUSIVE(value, left, right) (value >= left && value <= right )
       
    31 #define MIN(left, right) (left < right ? left : right)
       
    32 
       
    33 //We need to use a cleanup item here becuase CSubConNotificationEvents are not CBase derived. This means that on cleanup, things are not cleaned up as expected
       
    34 //We therefore need a TCleanupItem to deal with it.
       
    35 void SubconEventCleanupFunction(TAny* aEvent)
       
    36 	{
       
    37 	CSubConNotificationEvent* ptr = static_cast<CSubConNotificationEvent*>(aEvent);
       
    38 	delete ptr;
       
    39 	}
       
    40 
       
    41 void SubconParamSetCleanupFunction(TAny* aEvent)
       
    42 	{
       
    43 	CSubConParameterSet* ptr = static_cast<CSubConParameterSet*>(aEvent);
       
    44 	delete ptr;
       
    45 	}
       
    46 	
       
    47 #ifdef SYMBIAN_NETWORKING_UMTSR5
       
    48 void CUmtsGprsSubConnProvd::MapQosParamBundleToEtelL(const CSubConParameterBundle& aIn, 
       
    49    RPacketQoS::TQoSR5Requested* aOut)
       
    50 
       
    51 #else
       
    52 // !SYMBIAN_NETWORKING_UMTSR5
       
    53 
       
    54 void CUmtsGprsSubConnProvd::MapQosParamBundleToEtelL(const CSubConParameterBundle& aIn, 
       
    55     RPacketQoS::TQoSR99_R4Requested* aOut)
       
    56 #endif
       
    57 // SYMBIAN_NETWORKING_UMTSR5
       
    58    {
       
    59 	ASSERT(aOut);
       
    60 
       
    61     //Note: There should probably be const and non-const versions of FindFamily. 
       
    62     //There is only non-const, hence casting below.
       
    63 	CSubConParameterFamily* family = const_cast<CSubConParameterBundle&>(aIn).FindFamily(KSubConQoSFamily);
       
    64 	if (!family)
       
    65         {
       
    66         User::Leave(KErrArgument);
       
    67         }
       
    68 
       
    69 
       
    70 #ifdef SYMBIAN_NETWORKING_UMTSR5
       
    71 	// check the UMTS R5 extension first
       
    72 	CSubConQosR5ParamSet* extRequestedR5 = NULL;
       
    73 	CSubConQosR5ParamSet* extAcceptableR5 = NULL;
       
    74 	
       
    75 	extRequestedR5 = static_cast<CSubConQosR5ParamSet*>(family->FindExtensionSet(
       
    76         STypeId::CreateSTypeId(KSubCon3GPPExtParamsFactoryUid,KSubConQosR5ParamsType), CSubConParameterFamily::ERequested));
       
    77 
       
    78 	extAcceptableR5 = static_cast<CSubConQosR5ParamSet*>(family->FindExtensionSet(
       
    79         STypeId::CreateSTypeId(KSubCon3GPPExtParamsFactoryUid,KSubConQosR5ParamsType), CSubConParameterFamily::EAcceptable));
       
    80 
       
    81 	if (extRequestedR5)
       
    82         {
       
    83         MapQosR5ExtensionSetToEtel (*extRequestedR5, extAcceptableR5, aOut);
       
    84         iParameterRelease = KParameterRel5;
       
    85         return;
       
    86         }
       
    87 #endif
       
    88 
       
    89 	// No R5 so check the UMTS R99/R4 extension next
       
    90 	CSubConQosR99ParamSet* extRequestedR99 = NULL;
       
    91 	CSubConQosR99ParamSet* extAcceptableR99 = NULL;
       
    92 	extRequestedR99 = static_cast<CSubConQosR99ParamSet*>(family->FindExtensionSet(
       
    93         STypeId::CreateSTypeId(KSubCon3GPPExtParamsFactoryUid,KSubConQosR99ParamsType), CSubConParameterFamily::ERequested));
       
    94 
       
    95 	extAcceptableR99 = static_cast<CSubConQosR99ParamSet*>(family->FindExtensionSet(
       
    96         STypeId::CreateSTypeId(KSubCon3GPPExtParamsFactoryUid,KSubConQosR99ParamsType), CSubConParameterFamily::EAcceptable));
       
    97 
       
    98 	if (extRequestedR99)
       
    99         {
       
   100         MapQosR99ExtensionSetToEtel (*extRequestedR99, extAcceptableR99, aOut);
       
   101         iParameterRelease = KParameterRel4Rel99;
       
   102         return;
       
   103         }
       
   104       
       
   105       
       
   106 	// Still nothing specific, try to use the generic params
       
   107 	CSubConQosGenericParamSet* genericRequested = 
       
   108         static_cast<CSubConQosGenericParamSet*>(family->GetGenericSet(CSubConParameterFamily::ERequested));
       
   109 	CSubConQosGenericParamSet* genericAcceptable = 
       
   110         static_cast<CSubConQosGenericParamSet*>(family->GetGenericSet(CSubConParameterFamily::EAcceptable));
       
   111 
       
   112     if (genericRequested)
       
   113         {
       
   114         MapQosGenericSetToEtel (*genericRequested, genericAcceptable, aOut);
       
   115         iParameterRelease = KParameterRelGeneric;
       
   116         return;
       
   117         }
       
   118     	
       
   119     // Nothing left that we support
       
   120     User::Leave(KErrNotSupported);
       
   121     }
       
   122 
       
   123     
       
   124 /** 
       
   125 Maps given requested and acceptable sets of R99/R4 parameters as defined CSubConQosR99ParamSet
       
   126 into the Etel format (RPacketQoS::TQoSR99_R4Requested).
       
   127 
       
   128 @param aInRequested requested CSubConQosR99ParamSet to be converted
       
   129 @param aInAcceptable optional acceptable CSubConQosR99ParamSet to be converted
       
   130 @param aOut RPacketQoS::TQoSR99_R4Requested derived class to be mapped into.
       
   131 */
       
   132 void CUmtsGprsSubConnProvd::MapQosR99ExtensionSetToEtel(const CSubConQosR99ParamSet& aInRequested,
       
   133    const CSubConQosR99ParamSet* aInAcceptable, RPacketQoS::TQoSR99_R4Requested* aOut)
       
   134    {
       
   135    ASSERT (aOut);
       
   136    
       
   137 	aOut->iReqTrafficClass =  aInRequested.GetTrafficClass();
       
   138 	aOut->iReqDeliveryOrderReqd = aInRequested.GetDeliveryOrder();
       
   139 	aOut->iReqDeliverErroneousSDU = aInRequested.GetErroneousSDUDelivery();
       
   140 	aOut->iReqBER = aInRequested.GetResidualBitErrorRatio();
       
   141 	aOut->iReqSDUErrorRatio = aInRequested.GetSDUErrorRatio();
       
   142 	aOut->iReqTrafficHandlingPriority = aInRequested.GetTrafficHandlingPriority();
       
   143 	aOut->iReqTransferDelay = aInRequested.GetTransferDelay();
       
   144 	aOut->iReqMaxSDUSize = aInRequested.GetMaxSduSize();
       
   145 	aOut->iReqMaxRate.iUplinkRate = aInRequested.GetMaxBitrateUplink();
       
   146 	aOut->iReqMaxRate.iDownlinkRate = aInRequested.GetMaxBitrateDownlink();
       
   147 	aOut->iReqGuaranteedRate.iUplinkRate = aInRequested.GetGuaBitrateUplink();
       
   148 	aOut->iReqGuaranteedRate.iDownlinkRate = aInRequested.GetGuaBitrateDownlink();
       
   149 	
       
   150 	if (!aInAcceptable)
       
   151 	   {
       
   152 	   // when aInAcceptable is ommitted the minimum is the requested
       
   153 	   aInAcceptable = &aInRequested;
       
   154 	   }
       
   155 	   
       
   156 	aOut->iMinTrafficClass = aInAcceptable->GetTrafficClass();
       
   157 	aOut->iMinDeliveryOrderReqd = aInAcceptable->GetDeliveryOrder();
       
   158 	aOut->iMinDeliverErroneousSDU = aInAcceptable->GetErroneousSDUDelivery();
       
   159 	aOut->iMaxBER = aInAcceptable->GetResidualBitErrorRatio();
       
   160 	aOut->iMaxSDUErrorRatio = aInAcceptable->GetSDUErrorRatio();
       
   161 	aOut->iMinTrafficHandlingPriority = aInAcceptable->GetTrafficHandlingPriority();
       
   162 	aOut->iMaxTransferDelay = aInAcceptable->GetTransferDelay();
       
   163 	aOut->iMinAcceptableMaxSDUSize = aInAcceptable->GetMaxSduSize();
       
   164 	aOut->iMinAcceptableMaxRate.iUplinkRate = aInAcceptable->GetMaxBitrateUplink();
       
   165 	aOut->iMinAcceptableMaxRate.iDownlinkRate = aInAcceptable->GetMaxBitrateDownlink();
       
   166 	aOut->iMinGuaranteedRate.iUplinkRate = aInAcceptable->GetGuaBitrateUplink();
       
   167 	aOut->iMinGuaranteedRate.iDownlinkRate = aInAcceptable->GetGuaBitrateDownlink();
       
   168    }
       
   169     
       
   170   
       
   171 #ifdef SYMBIAN_NETWORKING_UMTSR5
       
   172 /** 
       
   173 Maps given requested and acceptable sets of R5 parameters as defined CSubConQosR5ParamSet
       
   174 into the Etel format (RPacketQoS::TQoSR5Requested).
       
   175 
       
   176 
       
   177 @param aInRequested requested CSubConQosR5ParamSet to be converted
       
   178 @param aInAcceptable optional acceptable CSubConQosR5ParamSet to be converted
       
   179 @param aOut RPacketQoS::TQoSR5Requested derived class to be mapped into.
       
   180 */
       
   181 void CUmtsGprsSubConnProvd::MapQosR5ExtensionSetToEtel(const CSubConQosR5ParamSet& aInRequested,
       
   182     const CSubConQosR5ParamSet* aInAcceptable, RPacketQoS::TQoSR5Requested* aOut)
       
   183     {
       
   184     MapQosR99ExtensionSetToEtel(aInRequested,aInAcceptable,aOut);
       
   185     aOut->iSourceStatisticsDescriptor =  aInRequested.GetSourceStatisticsDescriptor();
       
   186     aOut->iSignallingIndication = aInRequested.GetSignallingIndicator();
       
   187     }
       
   188     
       
   189     
       
   190 void CUmtsGprsSubConnProvd::MapQosR99ExtensionSetToEtel(const CSubConQosR99ParamSet& aInRequested,
       
   191     const CSubConQosR99ParamSet* aInAcceptable, RPacketQoS::TQoSR5Requested* aOut)
       
   192     {
       
   193     MapQosR99ExtensionSetToEtel(aInRequested, aInAcceptable, static_cast<RPacketQoS::TQoSR99_R4Requested*>(aOut));
       
   194     aOut->iSourceStatisticsDescriptor =  RPacketQoS::ESourceStatisticsDescriptorUnknown;
       
   195     aOut->iSignallingIndication = EFalse;
       
   196     }
       
   197 
       
   198 #endif 
       
   199 // SYMBIAN_NETWORKING_UMTSR5   
       
   200     
       
   201 /** 
       
   202 Given a set of generic parameters, the method derives the R99 value for the traffic class.
       
   203 
       
   204 
       
   205 @param aIn requested CSubConQosGenericParamSet to be converted
       
   206 @return the value of RPacketQoS::TTrafficClass
       
   207 */	
       
   208 RPacketQoS::TTrafficClass CUmtsGprsSubConnProvd::DeriveTrafficClass(const CSubConQosGenericParamSet& aIn )
       
   209     {
       
   210     //-----------------------------------
       
   211     // Traffic class
       
   212     //-----------------------------------
       
   213     if (IN_RANGE_INCLUSIVE(aIn.GetUpLinkDelay(), 0, KQoSMappingBorderDelay-1) ||
       
   214         IN_RANGE_INCLUSIVE(aIn.GetDownLinkDelay(), 0, KQoSMappingBorderDelay-1) )
       
   215 	    {
       
   216 	    return RPacketQoS::ETrafficClassConversational;
       
   217 	    }
       
   218     else if (aIn.GetUpLinkDelay() >= KQoSMappingBorderDelay || 
       
   219     		 aIn.GetDownLinkDelay() >= KQoSMappingBorderDelay )
       
   220 	    {
       
   221 	    return RPacketQoS::ETrafficClassStreaming;	
       
   222 	    }  
       
   223     else if (IN_RANGE_INCLUSIVE(aIn.GetUpLinkPriority(), 1, 3) ||
       
   224     		 IN_RANGE_INCLUSIVE(aIn.GetDownLinkPriority(), 1, 3))
       
   225 	    {
       
   226 	    return RPacketQoS::ETrafficClassInteractive;	
       
   227 	    }
       
   228 
       
   229 	return RPacketQoS::ETrafficClassBackground;	
       
   230 	}
       
   231 	
       
   232 	
       
   233 /** 
       
   234 Given a set of generic parameters, the method derives the R99 value for the traffic priority.
       
   235 
       
   236 
       
   237 @param aIn requested CSubConQosGenericParamSet to be converted
       
   238 @return the value of RPacketQoS::TTrafficHandlingPriority
       
   239 */	
       
   240 RPacketQoS::TTrafficHandlingPriority CUmtsGprsSubConnProvd::DeriveTrafficPriority(const CSubConQosGenericParamSet& aIn )
       
   241     {    
       
   242     //
       
   243     // Traffic handling priority
       
   244     //
       
   245     if (aIn.GetUpLinkPriority() == 1 || aIn.GetDownLinkPriority() == 1)
       
   246 	    {
       
   247 	    return RPacketQoS::ETrafficPriority1;	
       
   248 	    }
       
   249     else if (aIn.GetUpLinkPriority() == 2 || aIn.GetDownLinkPriority() == 2)
       
   250 	    {
       
   251 	    return RPacketQoS::ETrafficPriority2;
       
   252 	    }
       
   253 
       
   254 	return RPacketQoS::ETrafficPriority3;
       
   255     }
       
   256 	    
       
   257     
       
   258 /** 
       
   259 Maps given requested and acceptable sets of generic QoS parameters as defined CSubConQosGenericParamSet
       
   260 into the Etel format (RPacketQoS::TQoSR99_R4Requested).
       
   261 
       
   262 
       
   263 @param aInRequested requested CSubConQosGenericParamSet to be converted
       
   264 @param aInAcceptable optional acceptable CSubConQosGenericParamSet to be converted
       
   265 @param aOut RPacketQoS::TQoSR99_R4Requested to be produced.
       
   266 */	
       
   267 void CUmtsGprsSubConnProvd::MapQosGenericSetToEtel(const CSubConQosGenericParamSet& aInRequested, 
       
   268    const CSubConQosGenericParamSet* aInAcceptable, RPacketQoS::TQoSR99_R4Requested* aOut)
       
   269 	{
       
   270 	ASSERT (aOut);
       
   271 	
       
   272 	aOut->iReqDeliveryOrderReqd = RPacketQoS::EDeliveryOrderNotRequired;
       
   273 	aOut->iReqDeliverErroneousSDU = RPacketQoS::EErroneousSDUDeliveryNotRequired;;
       
   274 	aOut->iReqBER = RPacketQoS::EBERUnspecified;
       
   275    aOut->iReqSDUErrorRatio = RPacketQoS::ESDUErrorRatioUnspecified;
       
   276 
       
   277 	aOut->iReqTrafficClass = DeriveTrafficClass(aInRequested);
       
   278 	aOut->iReqTrafficHandlingPriority = DeriveTrafficPriority(aInRequested);
       
   279 	aOut->iReqTransferDelay = MIN(aInRequested.GetUpLinkDelay(), aInRequested.GetDownLinkDelay());
       
   280 	aOut->iReqMaxSDUSize = aInRequested.GetUpLinkMaximumPacketSize();
       
   281 	aOut->iReqMaxRate.iUplinkRate = aInRequested.GetUplinkBandwidth();
       
   282 	aOut->iReqMaxRate.iDownlinkRate = aInRequested.GetDownlinkBandwidth();
       
   283 	aOut->iReqGuaranteedRate.iUplinkRate = aInRequested.GetUplinkBandwidth();
       
   284 	aOut->iReqGuaranteedRate.iDownlinkRate = aInRequested.GetDownlinkBandwidth();
       
   285 	
       
   286 	if (!aInAcceptable)
       
   287 	   {
       
   288 	   // when aInAcceptable is ommitted the minimum is the requested
       
   289 	   aInAcceptable = &aInRequested;
       
   290 	   }
       
   291 	
       
   292 	aOut->iMinDeliveryOrderReqd = RPacketQoS::EDeliveryOrderNotRequired;
       
   293 	aOut->iMinDeliverErroneousSDU = RPacketQoS::EErroneousSDUDeliveryNotRequired;
       
   294 	aOut->iMaxBER = RPacketQoS::EBERUnspecified;
       
   295 	aOut->iMaxSDUErrorRatio = RPacketQoS::ESDUErrorRatioUnspecified;
       
   296 
       
   297 	aOut->iMinTrafficClass = DeriveTrafficClass(*aInAcceptable);
       
   298 	aOut->iMinTrafficHandlingPriority = DeriveTrafficPriority(*aInAcceptable);
       
   299 	aOut->iMaxTransferDelay = MIN(aInAcceptable->GetUpLinkDelay(), aInAcceptable->GetDownLinkDelay());
       
   300 	aOut->iMinAcceptableMaxSDUSize = aInAcceptable->GetUpLinkMaximumPacketSize();
       
   301 	aOut->iMinAcceptableMaxRate.iUplinkRate = aInAcceptable->GetUplinkBandwidth();
       
   302 	aOut->iMinAcceptableMaxRate.iDownlinkRate = aInAcceptable->GetDownlinkBandwidth();
       
   303 	aOut->iMinGuaranteedRate.iUplinkRate = aInAcceptable->GetUplinkBandwidth();
       
   304 	aOut->iMinGuaranteedRate.iDownlinkRate = aInAcceptable->GetDownlinkBandwidth();
       
   305 	}
       
   306 
       
   307 
       
   308 
       
   309 /**
       
   310 Maps QoS parameters received from the network via Etel into a CSubConGenEventParamsGranted class
       
   311 so that it is usable by the RSubConnection API.
       
   312 
       
   313 @param aNetworkQoS  - A pointer to an Etel TPacketDataConfigBase class containing the
       
   314 QoS to be mapped into the QoS event.
       
   315 @param aGranted - A reference to the CSubConGenEventParamsGranted object that should receive the mapped
       
   316 QoS parameters.
       
   317 */
       
   318 void CUmtsGprsSubConnProvd::MapQosEtelToGrantedParamsL (TPacketDataConfigBase* aNetworkQoS,CSubConGenEventParamsGranted& aGranted)
       
   319     {
       
   320     ASSERT (aNetworkQoS);
       
   321     
       
   322     // Always set the generic set
       
   323     MapQosEtelToGenericSetL ((static_cast<RPacketQoS::TQoSR99_R4Negotiated*>(aNetworkQoS)), aGranted);
       
   324 
       
   325 
       
   326     
       
   327     switch (iParameterRelease)
       
   328         {
       
   329 #ifdef SYMBIAN_NETWORKING_UMTSR5
       
   330         case KParameterRel5:
       
   331             // Control client sent us an R5 qos request
       
   332             MapQosEtelToR5SetL ((static_cast<RPacketQoS::TQoSR5Negotiated*>(aNetworkQoS)), aGranted);
       
   333             break;
       
   334 #endif
       
   335 // SYMBIAN_NETWORKING_UMTSR5
       
   336             
       
   337         case KParameterRelInvalid:
       
   338 #ifdef SYMBIAN_NETWORKING_UMTSR5
       
   339             // This will be the case if the client hasn't actually requested a level of QoS yet
       
   340             // but the network has notified us of a QoS change. We don't know what the client might
       
   341             // support so return both sets (if the define is set, else just what the code supports)
       
   342             MapQosEtelToR5SetL ((static_cast<RPacketQoS::TQoSR5Negotiated*>(aNetworkQoS)), aGranted);
       
   343 #endif
       
   344             MapQosEtelToR99SetL ((static_cast<RPacketQoS::TQoSR99_R4Negotiated*>(aNetworkQoS)), aGranted);
       
   345             break;
       
   346             
       
   347         case KParameterRel4Rel99:
       
   348             // Control client sent us an R4/R99 qos request
       
   349             MapQosEtelToR99SetL ((static_cast<RPacketQoS::TQoSR99_R4Negotiated*>(aNetworkQoS)), aGranted);
       
   350             break;
       
   351         
       
   352         case KParameterRelGeneric:
       
   353             // Generic set always returned. Done above.
       
   354             break;
       
   355         }
       
   356     }
       
   357     
       
   358 
       
   359 /**
       
   360 Maps QoS parameters received from the network via Etel into a 3GPP Release R4/R99 set and
       
   361 sets it in the given event.
       
   362 
       
   363 @param aNetworkQoS  - A pointer to an Etel RPacketQoS::TQoSR99_R4Requested derived class containing
       
   364 the QoS to be mapped.
       
   365 @param aGranted - A reference to the CSubConGenEventParamsGranted object that should receive the
       
   366 extension QoS parameters.
       
   367 */
       
   368 void CUmtsGprsSubConnProvd::MapQosEtelToR99SetL (RPacketQoS::TQoSR99_R4Negotiated* aNetworkQoS,
       
   369    CSubConGenEventParamsGranted& aGranted)
       
   370    {
       
   371    ASSERT (aNetworkQoS);
       
   372    
       
   373    CSubConQosR99ParamSet* r99Extension = CSubConQosR99ParamSet::NewL ();
       
   374    CleanupStack::PushL(TCleanupItem(SubconParamSetCleanupFunction,r99Extension));
       
   375    r99Extension->SetTrafficClass(aNetworkQoS->iTrafficClass);
       
   376    r99Extension->SetDeliveryOrder(aNetworkQoS->iDeliveryOrderReqd);
       
   377    r99Extension->SetErroneousSDUDelivery(aNetworkQoS->iDeliverErroneousSDU);
       
   378    r99Extension->SetResidualBitErrorRatio(aNetworkQoS->iBER);
       
   379    r99Extension->SetSDUErrorRatio(aNetworkQoS->iSDUErrorRatio);
       
   380    r99Extension->SetTrafficHandlingPriority(aNetworkQoS->iTrafficHandlingPriority);
       
   381    r99Extension->SetTransferDelay(aNetworkQoS->iTransferDelay);
       
   382    r99Extension->SetMaxSduSize(aNetworkQoS->iMaxSDUSize);
       
   383    r99Extension->SetMaxBitrateUplink(aNetworkQoS->iMaxRate.iUplinkRate);
       
   384    r99Extension->SetMaxBitrateDownlink(aNetworkQoS->iMaxRate.iDownlinkRate);
       
   385    r99Extension->SetGuaBitrateUplink(aNetworkQoS->iGuaranteedRate.iUplinkRate);
       
   386    r99Extension->SetGuaBitrateDownlink(aNetworkQoS->iGuaranteedRate.iDownlinkRate);
       
   387    
       
   388    aGranted.AddExtensionSetL (r99Extension);
       
   389    CleanupStack::Pop(); //r99Extension
       
   390    }
       
   391 
       
   392 #ifdef SYMBIAN_NETWORKING_UMTSR5
       
   393 /**
       
   394 Maps QoS parameters received from the network via Etel into a 3GPP Release R5 set and
       
   395 sets it in the given event.
       
   396 
       
   397 @param aNetworkQoS  - A pointer to an Etel RPacketQoS::TQoSR5Requested derived class containing
       
   398 the QoS to be mapped.
       
   399 @param aGranted - A reference to the CSubConGenEventParamsGranted object that should receive the
       
   400 extension QoS parameters.
       
   401 */
       
   402 void CUmtsGprsSubConnProvd::MapQosEtelToR5SetL (RPacketQoS::TQoSR5Negotiated* aNetworkQoS,
       
   403    CSubConGenEventParamsGranted& aGranted)
       
   404    {
       
   405    ASSERT (aNetworkQoS);
       
   406    
       
   407    CSubConQosR5ParamSet* r5Extension = CSubConQosR5ParamSet::NewL ();
       
   408    CleanupStack::PushL(TCleanupItem(SubconParamSetCleanupFunction,r5Extension));
       
   409    r5Extension->SetTrafficClass(aNetworkQoS->iTrafficClass);
       
   410    r5Extension->SetDeliveryOrder(aNetworkQoS->iDeliveryOrderReqd);
       
   411    r5Extension->SetErroneousSDUDelivery(aNetworkQoS->iDeliverErroneousSDU);
       
   412    r5Extension->SetResidualBitErrorRatio(aNetworkQoS->iBER);
       
   413    r5Extension->SetSDUErrorRatio(aNetworkQoS->iSDUErrorRatio);
       
   414    r5Extension->SetTrafficHandlingPriority(aNetworkQoS->iTrafficHandlingPriority);
       
   415    r5Extension->SetTransferDelay(aNetworkQoS->iTransferDelay);
       
   416    r5Extension->SetMaxSduSize(aNetworkQoS->iMaxSDUSize);
       
   417    r5Extension->SetMaxBitrateUplink(aNetworkQoS->iMaxRate.iUplinkRate);
       
   418    r5Extension->SetMaxBitrateDownlink(aNetworkQoS->iMaxRate.iDownlinkRate);
       
   419    r5Extension->SetGuaBitrateUplink(aNetworkQoS->iGuaranteedRate.iUplinkRate);
       
   420    r5Extension->SetGuaBitrateDownlink(aNetworkQoS->iGuaranteedRate.iDownlinkRate);
       
   421 
       
   422    r5Extension->SetSourceStatisticsDescriptor(aNetworkQoS->iSourceStatisticsDescriptor);
       
   423    r5Extension->SetSignallingIndicator(aNetworkQoS->iSignallingIndication);		
       
   424    
       
   425    aGranted.AddExtensionSetL (r5Extension);
       
   426    CleanupStack::Pop(); //r5Extension
       
   427    }
       
   428 
       
   429     
       
   430 #endif 
       
   431 // SYMBIAN_NETWORKING_UMTSR5 
       
   432 
       
   433 
       
   434 /**
       
   435 Maps QoS parameters received from the network via Etel into a generic set and sets it in the given event.
       
   436 
       
   437 @param aNetworkQoS  - A pointer to an Etel RPacketQoS::TQoSR99_R4Requested derived class containing the QoS
       
   438 to be mapped.
       
   439 @param aFamily - A reference to the CSubConGenEventParamsGranted object that should receive the
       
   440 generic QoS parameters.
       
   441 */
       
   442 void CUmtsGprsSubConnProvd::MapQosEtelToGenericSetL (RPacketQoS::TQoSR99_R4Negotiated* aNetworkQoS,
       
   443    CSubConGenEventParamsGranted& aGranted)
       
   444    {
       
   445    ASSERT (aNetworkQoS);
       
   446    
       
   447    CSubConQosGenericParamSet* genericQoS = CSubConQosGenericParamSet::NewL ();
       
   448    
       
   449    genericQoS->SetDownlinkBandwidth (aNetworkQoS->iGuaranteedRate.iDownlinkRate);
       
   450    genericQoS->SetUplinkBandwidth (aNetworkQoS->iGuaranteedRate.iUplinkRate);
       
   451    genericQoS->SetDownLinkDelay (aNetworkQoS->iTransferDelay);
       
   452    genericQoS->SetUpLinkDelay (aNetworkQoS->iTransferDelay);
       
   453    genericQoS->SetDownLinkMaximumPacketSize (aNetworkQoS->iMaxSDUSize);
       
   454    genericQoS->SetUpLinkMaximumPacketSize (aNetworkQoS->iMaxSDUSize);
       
   455    
       
   456    switch (aNetworkQoS->iTrafficHandlingPriority) 
       
   457       {
       
   458          case RPacketQoS::ETrafficPriority1:
       
   459             genericQoS->SetDownLinkPriority (RPacketQoS::ETrafficPriority1);
       
   460             genericQoS->SetUpLinkPriority (RPacketQoS::ETrafficPriority1);
       
   461             break;
       
   462 
       
   463          case RPacketQoS::ETrafficPriority2:
       
   464             genericQoS->SetDownLinkPriority (RPacketQoS::ETrafficPriority2);
       
   465             genericQoS->SetUpLinkPriority (RPacketQoS::ETrafficPriority2);
       
   466             break;
       
   467 
       
   468          case RPacketQoS::ETrafficPriority3:
       
   469             genericQoS->SetDownLinkPriority (RPacketQoS::ETrafficPriority3);
       
   470             genericQoS->SetUpLinkPriority (RPacketQoS::ETrafficPriority3);
       
   471             break;
       
   472             
       
   473          default:
       
   474             genericQoS->SetDownLinkPriority (RPacketQoS::ETrafficPriorityUnspecified);
       
   475             genericQoS->SetUpLinkPriority (RPacketQoS::ETrafficPriorityUnspecified);
       
   476             break;
       
   477       }
       
   478       
       
   479    aGranted.SetGenericSet (genericQoS);
       
   480    }
       
   481    
       
   482 
       
   483    
       
   484 CPdpFsmInterface& CUmtsGprsSubConnProvd::GetPdpFsmInterface()
       
   485     {
       
   486     return GetDefaultSubConnection().GetPdpFsmInterface();
       
   487     }
       
   488 
       
   489 
       
   490 TBool CUmtsGprsSubConnProvd::PdpFsmEvent(TContextId aContextId, TInt aEvent, TInt aParam)
       
   491     {
       
   492     if (iCurrentPdpFsmReq)
       
   493         {
       
   494         TBool handled(EFalse);
       
   495         handled = iCurrentPdpFsmReq->PdpFsmEvent(aContextId, aEvent, aParam);
       
   496         return handled;
       
   497         }
       
   498 
       
   499 	// Any events that are not a result of a request that we've made must be forwarded to
       
   500 	// control clients.
       
   501 
       
   502 	switch(aEvent)
       
   503 		{
       
   504 		case KContextParametersChangeEvent:
       
   505 	    // For QoS Changed the event must be processed here, it doesn't occur as a response
       
   506     	// to something we've requested.
       
   507         __FLOG_2(_L("CUmtsGprsSubConnProvd [this=%08x]:\tPdpFsmEvent(): QoS Params Changed [aParam=%d]"), this, aParam);
       
   508         TRAP_IGNORE(NotifyParamsChangedL(aParam));
       
   509 		break;
       
   510 		
       
   511 		case KContextDeleteEvent:
       
   512 		// For network-initiate close of PDP context.
       
   513         __FLOG_2(_L("CUmtsGprsSubConnProvd [this=%08x]:\tPdpFsmEvent(): Context Delete Event [aParam=%d]"), this, aParam);
       
   514         TRAP_IGNORE(NotifySubConDownL(aParam));
       
   515 		break;
       
   516 		
       
   517 		case KContextBlockedEvent:		// A PDP context becomes blocked
       
   518 		case KContextUnblockedEvent:	// A PDP context becomes unblocked
       
   519 		case KNetworkStatusEvent:		// For different network indications	
       
   520 		case KContextQoSSetEvent:		// Response to KContextQoSSet
       
   521 		case KContextTFTModifiedEvent:	// Response to KContextTFTModify
       
   522 		case KPrimaryContextCreated:	// Primary context at startup created
       
   523 		case KSecondaryContextCreated:	// Secondary context created
       
   524 		case KContextModifyActiveEvent:	// Response to KModifyActive
       
   525 		case KGetNegQoSEvent:			// Response to KGetNegQoS. ** Used internally by NIF **
       
   526 		default:
       
   527 		// Do nothing.
       
   528 		break;
       
   529 		}
       
   530 
       
   531     // Although we have notified the change of qos to the client application we haven't handled this
       
   532     // event. We can get here because the network changed the QoS without a request from us, or
       
   533     // because a secondary context (actually owned by GuQoS) has been promoted to default. 
       
   534     return EFalse;
       
   535     }
       
   536     
       
   537 void CUmtsGprsSubConnProvd::NotifySubConDownL(TInt aError)
       
   538 	{
       
   539    	CSubConGenEventSubConDown* event = CSubConGenEventSubConDown::NewL();
       
   540 	CleanupStack::PushL(TCleanupItem(SubconEventCleanupFunction, event));
       
   541 	event->SetError(aError);
       
   542 	NotifyClientEvent(*event);
       
   543 	CleanupStack::PopAndDestroy (); //event
       
   544 	}
       
   545 
       
   546 
       
   547 void CUmtsGprsSubConnProvd::NotifyParamsChangedL(TInt aError)
       
   548     {
       
   549     CSubConGenEventParamsChanged* event = CSubConGenEventParamsChanged::NewL();
       
   550     CleanupStack::PushL(TCleanupItem(SubconEventCleanupFunction, event));
       
   551     event->SetFamily (KSubConQoSFamily);
       
   552     event->SetError (aError);
       
   553 
       
   554 #ifdef SYMBIAN_NETWORKING_UMTSR5  
       
   555 	RPacketQoS::TQoSR5Negotiated negotiatedQoS;
       
   556 #else
       
   557     RPacketQoS::TQoSR99_R4Negotiated negotiatedQoS;
       
   558 #endif 
       
   559 
       
   560     GetPdpFsmInterface().Get(GetContextId(), negotiatedQoS);
       
   561     MapQosEtelToGrantedParamsL(&negotiatedQoS, *event);
       
   562 	NotifyClientEvent (*event);
       
   563 	CleanupStack::PopAndDestroy (); //event
       
   564     }
       
   565 
       
   566     
       
   567 MConnectionDataClient* CUmtsGprsSubConnProvd::DoSelfConnectionDataClient()
       
   568     {
       
   569     return this;
       
   570     }    
       
   571 
       
   572 
       
   573 CPdpFsmRequestBase::CPdpFsmRequestBase(CUmtsGprsSubConnProvd& aProvider, MPdpFsmRequestOwner& aOwner)
       
   574    :iProvider(aProvider), iOwner(aOwner)
       
   575    {
       
   576    __FLOG_OPEN(KUmtsGprsLogTag1, KUmtsGprsLogTag2);     
       
   577    }
       
   578 
       
   579 
       
   580 CSubConnectionProviderBase* CUmtsGprsSubConnProvd::DoNextLayer()
       
   581     {
       
   582 	__FLOG_1(_L("CUmtsGprsSubConnProvd::DoNextLayer [this=%08x] - this is (by design) the last layer"), this);
       
   583 	return NULL;
       
   584     }
       
   585 
       
   586 
       
   587 //-=========================================================
       
   588 //
       
   589 // Ignored overrides.
       
   590 //
       
   591 //-=========================================================	
       
   592 
       
   593 
       
   594 
       
   595 /** Convert the given parameter budle to Etel language (r99) and if at the time possible, submit the request SPUDFSM.
       
   596 @param 
       
   597 */
       
   598 void CUmtsGprsSubConnProvd::DoParametersAboutToBeSetL(CSubConParameterBundle& /*aParameterBundle*/)
       
   599     {
       
   600 	__FLOG_1(_L("CUmtsGprsSubConnProvd::DoParametersAboutToBeSetL [this=%08x]"), this);
       
   601 
       
   602 	iParameterRelease = KParameterRelInvalid;
       
   603     //TODO: implement set qos on secondaries when UmtsGprsSCPR enables ECreateNew SubConnection Providers.
       
   604     }
       
   605 
       
   606 
       
   607 CConnDataTransfer& CUmtsGprsSubConnProvd::DoDataTransferL()
       
   608     {
       
   609     //TODO: implement when UmtsGprsSCPR enables ECreateNew SubConnection Providers.    
       
   610 	User::Leave(KErrNotSupported);
       
   611 	return iNextLayer->DataTransferL();    
       
   612     }
       
   613 
       
   614 
       
   615     
       
   616 /**
       
   617 From MConnectionDataClient
       
   618 */
       
   619 void CUmtsGprsSubConnProvd::Notify(TNotify /*aNotifyType*/, CConnectionProviderBase* /*aConnProvider*/, 
       
   620                                    TInt /*aError*/, const CConNotificationEvent* /*aConNotificationEvent*/)
       
   621     {   
       
   622     //TODO: implement when UmtsGprsSCPR enables ECreateNew SubConnection Providers.
       
   623     }
       
   624 
       
   625 /**
       
   626 From MConnectionDataClient
       
   627 */
       
   628 void CUmtsGprsSubConnProvd::AttachToNext(CSubConnectionProviderBase* /*aSubConnProvider*/)
       
   629     {
       
   630     //TODO: implement when UmtsGprsSCPR enables ECreateNew SubConnection Providers.
       
   631     }
       
   632     
       
   633 /**
       
   634 From MConnectionDataClient
       
   635 */
       
   636 void CUmtsGprsSubConnProvd::ConnectionGoingDown(CConnectionProviderBase& aConnProvider)
       
   637    {
       
   638    (void)aConnProvider;
       
   639 	__FLOG_2(_L("CUmtsGprsSubConnProvd [this=%08x]:\tConnectionGoingDown() [aConnProvider=%08x]"), this, &aConnProvider);
       
   640 	iConnectionProvider = NULL;
       
   641 	DeleteMeNow();
       
   642    }
       
   643 
       
   644 /**
       
   645 From MConnectionDataClient
       
   646 */
       
   647 void CUmtsGprsSubConnProvd::ConnectionError(TInt /*aStage*/, TInt /*aError*/)
       
   648     {   
       
   649     //TODO: implement when UmtsGprsSCPR enables ECreateNew SubConnection Providers.
       
   650     }
       
   651     
       
   652 /**
       
   653 Function called by Connection Provider when a socket is to be added to the QoS Flow ('this')
       
   654 
       
   655 @param aDataClient Data Client to add to the QoS Channel
       
   656 */
       
   657 void CUmtsGprsSubConnProvd::DoDataClientJoiningL(MSubConnectionDataClient& aDataClient)
       
   658     {
       
   659     (void)aDataClient;    
       
   660 	__FLOG_3(_L("CUmtsGprsSubConnProvd [this=%08x]:\tDoDataClientJoiningL() [iDataClients.Count=%d] [aDataClient=%08x]"), this, iDataClients.Count(), &aDataClient);
       
   661 	//We're not interested in knowing about MSubConnectionDataClient joining this sub-connection
       
   662     }
       
   663     
       
   664 /**
       
   665 Function called by Connection Provider when a socket is to be removed from the QoS Flow ('this')
       
   666 
       
   667 @param aDataClient Data Client to remove from this QoS Channel
       
   668 */
       
   669 void CUmtsGprsSubConnProvd::DoDataClientLeaving(MSubConnectionDataClient& aDataClient)
       
   670     {
       
   671     (void)aDataClient;
       
   672 	__FLOG_3(_L("CUmtsGprsSubConnProvd [this=%08x]:\tDoDataClientLeaving() [iDataClients.Count=%d] [aDataClient=%08x]"), this, iDataClients.Count(), &aDataClient);
       
   673 	 aDataClient.LeaveComplete (*this);
       
   674     }
       
   675     
       
   676 /**
       
   677 Function called by SubConnection Provider when a control client is to join to this the QoS Flow ('this')
       
   678 
       
   679 @param aControlClient Control Client to remove from this QoS Channel
       
   680 */
       
   681 void CUmtsGprsSubConnProvd::DoControlClientJoiningL(MSubConnectionControlClient& aControlClient)
       
   682     {
       
   683     (void)aControlClient;
       
   684 	__FLOG_3(_L("CUmtsGprsSubConnProvd [this=%08x]:\tDoControlClientJoiningL() [iControlClients.Count=%d] [aControlClient=%08x]"), this, iControlClients.Count(), &aControlClient);
       
   685 	//We're not interested in knowing about MSubConnectionControlClient joining this sub-connection
       
   686     }
       
   687     
       
   688 /**
       
   689 Function called by SubConnection Provider when a control client is to be removed from the QoS Flow ('this')
       
   690 
       
   691 @param aControlClient Control Client to remove from this QoS Channel
       
   692 */
       
   693 void CUmtsGprsSubConnProvd::DoControlClientLeaving(MSubConnectionControlClient& aControlClient)
       
   694     {
       
   695     (void)aControlClient;
       
   696 	__FLOG_3(_L("CUmtsGprsSubConnProvd [this=%08x]:\tDoControlClientLeaving() [iControlClients.Count=%d] [aControlClient=%08x]"), this, iControlClients.Count(), &aControlClient);
       
   697 	//We're not interested in knowing about MSubConnectionControlClient leaving this sub-connection
       
   698     }
       
   699 
       
   700 
       
   701 /** 
       
   702 @param 
       
   703 */
       
   704 void CUmtsGprsSubConnProvd::DoSourceAddressUpdate(MSubConnectionDataClient& /*aDataClient*/, const TSockAddr& /*aSource*/)
       
   705     {
       
   706     //TODO: implement when UmtsGprsSCPR enables ECreateNew SubConnection Providers.
       
   707     }
       
   708     
       
   709 /** 
       
   710 @param 
       
   711 */
       
   712 void CUmtsGprsSubConnProvd::DoDestinationAddressUpdate(MSubConnectionDataClient& /*aDataClient*/, const TSockAddr& /*aDestination*/)
       
   713     {
       
   714     //TODO: implement when UmtsGprsSCPR enables ECreateNew SubConnection Providers.
       
   715     }
       
   716     
       
   717 void CUmtsGprsSubConnProvd::DoDataClientRouted(MSubConnectionDataClient& /*aDataClient*/, const TSockAddr& /*aSource*/, const TSockAddr& /*aDestination*/, const TDesC8& /*aConnectionInfo*/)
       
   718 /** 
       
   719 
       
   720 @param 
       
   721 */
       
   722     {
       
   723     //TODO: implement when UmtsGprsSCPR enables ECreateNew SubConnection Providers.
       
   724     }
       
   725 
       
   726 TInt CUmtsGprsSubConnProvd::DoControl(TUint /*aOptionLevel*/, TUint /*aOptionName*/, TDes8& /*aOption*/)
       
   727 /** 
       
   728 
       
   729 @param 
       
   730 */
       
   731     {
       
   732 	__FLOG_1(_L("CUmtsGprsSubConnProvd::DoControl [this=%08x]"), this);
       
   733 	return KErrNotSupported;
       
   734     }
       
   735  
       
   736 void CUmtsGprsSubConnProvd::DoStartL()
       
   737 /** 
       
   738 
       
   739 @param 
       
   740 */
       
   741     {
       
   742     //TODO: implement when UmtsGprsSCPR enables ECreateNew SubConnection Providers.
       
   743     }
       
   744     
       
   745 void CUmtsGprsSubConnProvd::DoStop()
       
   746 /** 
       
   747 
       
   748 @param 
       
   749 */
       
   750     {
       
   751     //TODO: implement when UmtsGprsSCPR enables ECreateNew SubConnection Providers.
       
   752     }
       
   753 
       
   754 
       
   755 CUmtsGprsSubConnProvd::~CUmtsGprsSubConnProvd ()
       
   756    {
       
   757 	__FLOG_1(_L("~CUmtsGprsSubConnProvd [this=%08x]"), this);
       
   758 	if (iConnectionProvider)
       
   759 		{
       
   760 		iConnectionProvider->Leave(*this);
       
   761 		}   
       
   762     delete iCurrentPdpFsmReq;
       
   763     __FLOG_CLOSE;
       
   764    }