telephonyprotocols/umtsgprsscpr/inc/UmtsGprs_subconnProv.h
changeset 69 b982c3e940f3
parent 59 ac20d6a0a19d
child 73 70d75957b98f
equal deleted inserted replaced
59:ac20d6a0a19d 69:b982c3e940f3
     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 // Umts/Gprs SubConnection Provider class definition.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalComponent
       
    21 */
       
    22 
       
    23 
       
    24 #ifndef UMTSGPRS_SUBCONNPROV_H
       
    25 #define UMTSGPRS_SUBCONNPROV_H
       
    26 
       
    27 
       
    28 #include <ss_subconnprov.h>
       
    29 #include <comms-infras/commsdebugutility.h>
       
    30 
       
    31 #include <cs_subconparams.h>
       
    32 #include <cs_subconevents.h>
       
    33 
       
    34 #include "PDPFSM.h"
       
    35 #include <networking/qos3gpp_subconparams.h>
       
    36 
       
    37 
       
    38 #ifdef __FLOG_ACTIVE
       
    39 // Logging tags
       
    40 _LIT8(KUmtsGprsLogTag1,"SubConn");
       
    41 _LIT8(KUmtsGprsLogTag2,"UmtsGprs");
       
    42 #endif
       
    43 
       
    44 class CPdpFsmRequestBase;
       
    45 
       
    46 void SubconEventCleanupFunction(TAny* aEvent);
       
    47 void SubconParamSetCleanupFunction(TAny* aEvent);
       
    48 
       
    49 
       
    50 /** The class represents an onwer/issuer of a CPdpFsmRequestBase
       
    51 
       
    52 @internalTechnology
       
    53 @released Since 9.3
       
    54 */
       
    55 class MPdpFsmRequestOwner
       
    56 {
       
    57     public:
       
    58 	/** Called by the owned CPdpFsmRequestBase to flag the completion of the
       
    59 	* request back to 'this'
       
    60 	*
       
    61 	  @param aResult - the request result indication.
       
    62 	  @param aParam  - the request completed (in case 'this' owns more requests).
       
    63 	*/
       
    64     virtual void Done( TInt aResult, CPdpFsmRequestBase& aThis ) = 0;
       
    65 };
       
    66 
       
    67 
       
    68 
       
    69 
       
    70 
       
    71 class CUmtsGprsSubConnProvd : public CSubConnectionProviderBase, public MConnectionDataClient, public MPdpFsmRequestOwner
       
    72 /** The class represents UMTS/GPRS-proprietary subconnection provider.
       
    73     It is designed to operate in the near proximity to Etel and
       
    74     convert downcalls to Etel's language. This class represents both 
       
    75     TSubConnTypes: { EAttachToDefault, ECreateNew }
       
    76 
       
    77 @internalTechnology
       
    78 @released Since 9.3
       
    79 */
       
    80 	{
       
    81 protected:
       
    82     enum TQosParameterRelease
       
    83         {
       
    84         KParameterRelInvalid = 0,
       
    85         KParameterRelGeneric = 1,
       
    86         KParameterRel4Rel99 = 4,
       
    87         KParameterRel5 = 5,
       
    88         };
       
    89 
       
    90 
       
    91 public:
       
    92 	//-=========================================================
       
    93 	// Custom methods
       
    94 	//-=========================================================	
       
    95 
       
    96 #ifdef SYMBIAN_NETWORKING_UMTSR5
       
    97 
       
    98 	/**
       
    99 	Scans given parameter bundle for supported parameter sets
       
   100 	The first one found gets converted to RPacketQoS::TQoSR5Requested. 
       
   101     The supported parameter sets are (in order of priority):
       
   102     1) KSubConQosR5ParamsType
       
   103     2) KSubConQosR99ParamsType
       
   104     3) Generic QoS 
       
   105 	
       
   106 	@param aIn CSubConParameterBundle to be converted.
       
   107 	@param aOut RPacketQoS::TQoSR5Requested to be populated from aIn
       
   108 	@exception KErrNotSupported - if CUmtsGprsSubConnProvd does not support conversion from what's
       
   109 	in the supplied parameter bundle.
       
   110 	*/
       
   111 	void MapQosParamBundleToEtelL(const CSubConParameterBundle& aIn,
       
   112 	    RPacketQoS::TQoSR5Requested* aOut);
       
   113 
       
   114 #else
       
   115 // !SYMBIAN_NETWORKING_UMTSR5
       
   116 	
       
   117 	/** Scans given parameter bundle for supported parameter sets
       
   118 	The first one found gets converted to RPacketQoS::TQoSR99_R4Requested. 
       
   119     The supported parameter sets are (in order of priority):
       
   120     1) KSubConQosR99ParamsType
       
   121     2) Generic QoS 
       
   122 	
       
   123 	@param aIn CSubConParameterBundle to be converted.
       
   124 	@param aOut RPacketQoS::TQoSR99_R4Requested to be populated from aIn
       
   125 	@exception KErrNotSupported - if CUmtsGprsSubConnProvd does not support conversion from what's
       
   126 	in the supplied parameter bundle.
       
   127 	*/
       
   128 	void MapQosParamBundleToEtelL(const CSubConParameterBundle& aIn,
       
   129 	    RPacketQoS::TQoSR99_R4Requested* aOut);
       
   130 
       
   131 #endif 
       
   132 // SYMBIAN_NETWORKING_UMTSR5 
       
   133 	
       
   134 	/**
       
   135    Maps QoS parameters received from the network via Etel into a CSubConGenEventParamsGranted class
       
   136    for client event notification.
       
   137 
       
   138    @param aNetworkQoS  - A pointer to an Etel TPacketDataConfigBase class containing the
       
   139    QoS to be mapped into the event.
       
   140    @param aGranted - A reference to the CSubConGenEventParamsGranted object that should receive the mapped
       
   141    QoS parameters.
       
   142 	*/
       
   143    void MapQosEtelToGrantedParamsL (TPacketDataConfigBase* aNetworkQoS,
       
   144       CSubConGenEventParamsGranted& aGranted);
       
   145    
       
   146    /** Returns the default CUmtsGprsSubConnProvd for 'this'
       
   147 	* IMPORTANT: This method is left pure virtual because its implementation, 
       
   148 	  although trivial, is not needed until CUmtsGprsSubConnProvd fully spports PDP 
       
   149 	  context management.
       
   150 	  
       
   151 	  @return the default CUmtsGprsSubConnProvd for 'this'
       
   152 	*/
       
   153 	virtual CUmtsGprsSubConnProvd& GetDefaultSubConnection() = 0;
       
   154 	
       
   155 	/** Called by SpudFsm to inform about events and responses regarding
       
   156 	* the PDP context 'this' represents. The event format complies to UmtsIf interface.
       
   157 	* CUmtsGprsSubConnProvd forwards the event to the active/pending request 
       
   158 	* (iCurrentPdpFsmReq) or ignores the event if no request exists.
       
   159 	*
       
   160 	  @param aEvent the event type
       
   161 	  @param aParam additional data
       
   162 	*/
       
   163     virtual TBool PdpFsmEvent(TContextId aContextId, TInt aEvent, TInt aParam);	
       
   164 	
       
   165 	/** Returns the PdpFsmInterface instance, which can be used to talk to SpudFsm
       
   166 	 * 
       
   167 	  @return the local instance (pertaining to this connection) of CPdpFsmInterface.
       
   168 	*/
       
   169 	virtual CPdpFsmInterface& GetPdpFsmInterface();
       
   170 	
       
   171 	
       
   172 	/** Returns context id of the PDP context 'this' represents.
       
   173 	 * 
       
   174 	  @return context id of the PDP context 'this' represents.
       
   175 	*/
       
   176 	TContextId GetContextId() const;
       
   177 	
       
   178 	/** Sends request to the control clients. This method is the overload of
       
   179 	 * the CSubConnectionProviderBase protected counterpart. It's to be used
       
   180 	 * by CPdpFsmRequestBase objects.
       
   181 	 * 
       
   182 	  @param aEvent - the notification to be sent. 
       
   183 	*/
       
   184     TInt NotifyClientEvent(const CSubConNotificationEvent& aEvent);	
       
   185 	
       
   186 
       
   187 	//-=========================================================
       
   188 	// MPdpFsmRequestOwner methods
       
   189 	//-=========================================================	
       
   190 	void Done(TInt aResult, CPdpFsmRequestBase& aThis);
       
   191     
       
   192 	//-=========================================================
       
   193 	// MConnectionDataClient methods
       
   194 	//-=========================================================	
       
   195 	virtual void Notify(TNotify aNotifyType,  CConnectionProviderBase* aConnProvider, TInt aError, const CConNotificationEvent* aConNotificationEvent);
       
   196   	virtual void AttachToNext(CSubConnectionProviderBase* aSubConnProvider);
       
   197 	virtual void ConnectionGoingDown(CConnectionProviderBase& aConnProvider);
       
   198 	virtual void ConnectionError(TInt aStage, TInt aError);
       
   199 
       
   200 	//-=========================================================
       
   201 	// CSubConnectionProviderBase methods
       
   202 	//-=========================================================
       
   203 	virtual void DoDataClientJoiningL(MSubConnectionDataClient& aDataClient);
       
   204 	virtual void DoDataClientLeaving(MSubConnectionDataClient& aDataClient);
       
   205 	virtual void DoControlClientJoiningL(MSubConnectionControlClient& aControlClient);
       
   206 	virtual void DoControlClientLeaving(MSubConnectionControlClient& aControlClient);
       
   207 	virtual void DoSourceAddressUpdate(MSubConnectionDataClient& aDataClient, const TSockAddr& aSource);
       
   208 	virtual void DoDestinationAddressUpdate(MSubConnectionDataClient& aDataClient, const TSockAddr& aDestination);
       
   209 	virtual void DoDataClientRouted(MSubConnectionDataClient& aDataClient, const TSockAddr& aSource, const TSockAddr& aDestination, const TDesC8& aConnectionInfo);
       
   210 	virtual void DoParametersAboutToBeSetL(CSubConParameterBundle& aParameterBundle);
       
   211 	virtual TInt DoControl(TUint aOptionLevel, TUint aOptionName, TDes8& aOption);
       
   212 	virtual CConnDataTransfer& DoDataTransferL();
       
   213 	virtual MConnectionDataClient* DoSelfConnectionDataClient();
       
   214    virtual void DoStartL();
       
   215 	virtual void DoStop();
       
   216 	virtual CSubConnectionProviderBase* DoNextLayer();
       
   217 
       
   218 protected:
       
   219 	
       
   220 	//-=========================================================
       
   221 	// Custom methods
       
   222 	//-=========================================================	
       
   223     CUmtsGprsSubConnProvd(CSubConnectionProviderFactoryBase& aFactory, 
       
   224         CConnectionProviderBase& aConnProvider);
       
   225 
       
   226     // Don't allow clients to invoke the destructor.
       
   227     // (Only the CCommsFactoryBase should do this)
       
   228     virtual ~CUmtsGprsSubConnProvd();
       
   229 
       
   230     static void MapQosR99ExtensionSetToEtel(const CSubConQosR99ParamSet& aInRequested,
       
   231         const CSubConQosR99ParamSet* aInAcceptable,
       
   232         RPacketQoS::TQoSR99_R4Requested* aOut);
       
   233 
       
   234     static void MapQosGenericSetToEtel(const CSubConQosGenericParamSet& aInRequested, 
       
   235         const CSubConQosGenericParamSet* aInAcceptable,
       
   236         RPacketQoS::TQoSR99_R4Requested* aOut);
       
   237                                
       
   238 
       
   239     static void MapQosEtelToGenericSetL (RPacketQoS::TQoSR99_R4Negotiated* aNetworkQoS,
       
   240         CSubConGenEventParamsGranted& aGranted);
       
   241 
       
   242     static void MapQosEtelToR99SetL (RPacketQoS::TQoSR99_R4Negotiated* aNetworkQoS,
       
   243         CSubConGenEventParamsGranted& aGranted);
       
   244 
       
   245 	void NotifySubConDownL(TInt aError);
       
   246     void NotifyParamsChangedL(TInt aError);
       
   247 
       
   248     inline void ResetQosRelease();
       
   249     inline TQosParameterRelease RequestedQosRelease();
       
   250 
       
   251 
       
   252 #ifdef SYMBIAN_NETWORKING_UMTSR5
       
   253     static void MapQosR5ExtensionSetToEtel(const CSubConQosR5ParamSet& aInRequested,
       
   254         const CSubConQosR5ParamSet* aInAcceptable,
       
   255         RPacketQoS::TQoSR5Requested* aOut);
       
   256 
       
   257     static void MapQosR99ExtensionSetToEtel(const CSubConQosR99ParamSet& aInRequested,
       
   258         const CSubConQosR99ParamSet* aInAcceptable, RPacketQoS::TQoSR5Requested* aOut);
       
   259 
       
   260     static void MapQosEtelToR5SetL (RPacketQoS::TQoSR5Negotiated* aNetworkQoS,
       
   261         CSubConGenEventParamsGranted& aGranted);
       
   262 #endif 
       
   263 // SYMBIAN_NETWORKING_UMTSR5 
       
   264 
       
   265 	/** 
       
   266 	Given a set of generic parameters, the method derives the R99 value for the traffic class.
       
   267 
       
   268 	@param aIn requested CSubConQosGenericParamSet to be converted
       
   269 	@return the value of RPacketQoS::TTrafficClass
       
   270 	*/	
       
   271 	static RPacketQoS::TTrafficClass DeriveTrafficClass(const CSubConQosGenericParamSet& aIn );
       
   272 	
       
   273 	/** 
       
   274 	Given a set of generic parameters, the method derives the R99 value for the traffic priority.
       
   275 
       
   276 	@param aIn requested CSubConQosGenericParamSet to be converted
       
   277 	@return the value of RPacketQoS::TTrafficHandlingPriority
       
   278 	*/		
       
   279 	static RPacketQoS::TTrafficHandlingPriority DeriveTrafficPriority(const CSubConQosGenericParamSet& aIn );
       
   280 	
       
   281 	/*
       
   282 	The PDP context id 'this' represents. This is semantically equal to the SpudFSM PDP
       
   283 	Context identification scheme.
       
   284 	*/
       
   285 	TContextId iContextId;
       
   286 
       
   287 	/*
       
   288 	Holds the current request towards PDPFSM
       
   289 	*/
       
   290 	CPdpFsmRequestBase* iCurrentPdpFsmReq;
       
   291 
       
   292 
       
   293 private:
       
   294 	TQosParameterRelease iParameterRelease;
       
   295 
       
   296 
       
   297 public:
       
   298 	__FLOG_DECLARATION_MEMBER;
       
   299 	};
       
   300 	
       
   301 	
       
   302 	
       
   303 	
       
   304 	
       
   305 /**
       
   306 The base class for a PDP Context control asynchronous requests. 
       
   307 
       
   308 @internalTechnology
       
   309 @released Since 9.3
       
   310 */
       
   311 class CPdpFsmRequestBase
       
   312 {
       
   313 public:
       
   314     
       
   315 	/** 
       
   316 	C'tor
       
   317 
       
   318 	@param aProvider - the sub connection provider 'this' is directly or indirectly owned by.
       
   319 	*                  Also represents a specific PDP context.
       
   320 	@param aOwner    - the immediate owner of 'this' (could be same as aProvider or could be
       
   321 	*                  request (when nested). 
       
   322 	*/		
       
   323     CPdpFsmRequestBase( CUmtsGprsSubConnProvd& aProvider, MPdpFsmRequestOwner& aOwner);
       
   324 
       
   325     virtual ~CPdpFsmRequestBase();
       
   326     
       
   327 	/** 
       
   328 	The method should issue the request
       
   329 
       
   330 	@return the immediate request result.
       
   331 	*/		
       
   332     virtual TInt Start() = 0;
       
   333     
       
   334     
       
   335 	/** 
       
   336 	The callback method called by the direct owner of 'this' to forward events/results
       
   337 	caused by issuing 'this'. 'This' can interpret the events and decide whether to
       
   338 	flag the completion back to its owner.
       
   339 
       
   340 	@param aContextId The context Id that the event occured on
       
   341 	@param aEvent The identifier of the event that occured
       
   342 	@param aParam Data relavent to the event. Usually a system-wide error code
       
   343 	@return ETrue if the event was of interested and handled, EFalse if wasn't
       
   344 	handled and should be passed on to SpudMan
       
   345 	*/	
       
   346 	virtual TBool PdpFsmEvent(TContextId aContextId, TInt aEvent, TInt aParam) = 0;
       
   347     
       
   348 protected:
       
   349     CUmtsGprsSubConnProvd& iProvider;
       
   350     MPdpFsmRequestOwner& iOwner;
       
   351     TContextId iContextId;
       
   352 
       
   353 public:
       
   354 	__FLOG_DECLARATION_MEMBER;
       
   355 };
       
   356 
       
   357 
       
   358 
       
   359 #include "UmtsGprs_subconnProv.inl"
       
   360 #endif
       
   361 // UMTSGPRS_SUBCONNPROV_H