datacommsserver/esockserver/inc/ss_tiermanagerutils.h
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 2006-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 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @internalTechnology
       
    19 */
       
    20 
       
    21 #ifndef SYMBIAN_SS_TIER_MANAGER_UTILS_H
       
    22 #define SYMBIAN_SS_TIER_MANAGER_UTILS_H
       
    23 
       
    24 #include <metadatabase.h>		// for TMDBElementId
       
    25 #include <cdbcols.h>		// for TCommDbConnectionDirection
       
    26 #include <es_sock.h>		// for TAccessPointInfo
       
    27 #include <e32cmn.h>		// for RArray
       
    28 
       
    29 class TConnIdList;
       
    30 class TIp6Addr;
       
    31 class TCommDbConnPref;
       
    32 class TConnectionPrefs;
       
    33 
       
    34 namespace CommsDat
       
    35 {
       
    36 	class CMDBSession;
       
    37 	class CCDTierRecord;
       
    38 	class CCDAccessPointRecord;
       
    39 	class CCDMCprRecord;
       
    40 	class CCDCprRecord;
       
    41 	class CCDSCprRecord;
       
    42 	class CCDProtocolRecord;
       
    43 	class CCDGlobalSettingsRecord;
       
    44 	class CCDConfigAccessPointRecord;
       
    45 	class CCDIAPRecord;
       
    46 	template<class TYPE> class CMDBRecordSet;
       
    47 	class CMDBElement;
       
    48 	template<class TYPE> class CMDBField;
       
    49 	class CCDAPPrioritySelectionPolicyRecord;
       
    50 }
       
    51 
       
    52 namespace ESock
       
    53 {
       
    54 
       
    55 //
       
    56 //CTierManagerUtils - for commsdat manipulation, etc so that can be used in several places
       
    57 class TProviderInfo;
       
    58 class SAccessPointConfig;
       
    59 class RTierThreadMap;
       
    60 class RConnPrefList;
       
    61 class TierManagerUtils
       
    62 /** Base class for selection resolver factories. Specifies the interface
       
    63     that selection resolver factories must implement.
       
    64 
       
    65 @internalTechnology
       
    66 */
       
    67 	{
       
    68 	friend class TCFImplicitFlowRequest;
       
    69 
       
    70 private:
       
    71 	//private, not exported, used with legacy implicit flows only
       
    72 	static TUid MapTierIdsForLegacyImplicitFlowsL(TUid aTierId, TUint aProtocol);
       
    73 	
       
    74 	static TInt ResolveDefAPtoTagL(TInt aElementId, CommsDat::CMDBSession& aDbs );
       
    75 	
       
    76 public:
       
    77 	IMPORT_C static TUid MapTierIdsL(TUid aTierId, TUint aProtocol);
       
    78 	IMPORT_C static CommsDat::CCDTierRecord* LoadTierRecordL(TUid aTierId, CommsDat::CMDBSession& aDbs);
       
    79 	
       
    80 	IMPORT_C static CommsDat::CCDTierRecord* LoadTierRecordL(CommsDat::TMDBElementId aTierId, CommsDat::CMDBSession& aDbs);
       
    81     IMPORT_C static CommsDat::CCDAPPrioritySelectionPolicyRecord* LoadAPPrioritySelRecordL(CommsDat::TMDBElementId aApSelId, CommsDat::CMDBSession& aDbs);
       
    82     IMPORT_C static CommsDat::CCDAccessPointRecord* LoadAccessPointRecordL(TUid aAccessPointId, CommsDat::CMDBSession& aDbs);
       
    83     
       
    84     
       
    85 	IMPORT_C static CommsDat::CCDAccessPointRecord* LoadAccessPointRecordL(TUint aAccessPointId, CommsDat::CMDBSession& aDbs);
       
    86 	IMPORT_C static CommsDat::CCDAccessPointRecord* LoadAccessPointRecordL(const TProviderInfo& aProviderInfo, CommsDat::CMDBSession& aDbs);
       
    87 	IMPORT_C static CommsDat::CMDBRecordSet<CommsDat::CCDAccessPointRecord>* LoadAccessPointRecordsL(TUid aTierId, CommsDat::CMDBSession& aDbs);
       
    88 	IMPORT_C static CommsDat::CMDBRecordSet<CommsDat::CCDAccessPointRecord>* LoadAccessPointRecordsL(TUid aTierId, const RArray<TAccessPointInfo>& aApIdsToMatch, CommsDat::CMDBSession& aDbs);
       
    89 
       
    90 	IMPORT_C static CommsDat::CCDMCprRecord* LoadMCprRecordL(TUint aMCprId, CommsDat::CMDBSession& aDbs);
       
    91 	IMPORT_C static CommsDat::CCDMCprRecord* LoadMCprRecordL(TUid aMCprFactoryUid, CommsDat::CMDBSession& aDbs);
       
    92 	IMPORT_C static CommsDat::CCDCprRecord* LoadCprRecordL(TUint aCprId, CommsDat::CMDBSession& aDbs);
       
    93 	IMPORT_C static CommsDat::CCDSCprRecord* LoadSCprRecordL(TUint aSCprId, CommsDat::CMDBSession& aDbs);
       
    94 	IMPORT_C static CommsDat::CCDProtocolRecord* LoadProtocolRecordL(TUint aProtocolId, CommsDat::CMDBSession& aDbs);
       
    95 	IMPORT_C static CommsDat::CCDGlobalSettingsRecord* LoadGlobalSettingsRecordL(CommsDat::CMDBSession& aDbs);
       
    96 	IMPORT_C static CommsDat::CCDIAPRecord* LoadIapRecordL(TUint aIapId, CommsDat::CMDBSession& aDbs);
       
    97 	IMPORT_C static CommsDat::CMDBRecordSet<CommsDat::CCDIAPRecord>* LoadIapRecordsL(CommsDat::CMDBSession& aDbs);
       
    98 
       
    99 	IMPORT_C static TUint ReadDefaultAccessPointL(TUid aTierId, CommsDat::CMDBSession& aDbs);
       
   100 	IMPORT_C static TUid ReadTierIdL(TUint aAccessPointId, CommsDat::CMDBSession& aDbs);
       
   101 	IMPORT_C static TUid ReadMCprUidL(TUint aAccessPointId, CommsDat::CMDBSession& aDbs);
       
   102 	
       
   103 	IMPORT_C static TUint ReadSelectionPolicyIdL(TUint aAccessPointId, CommsDat::CMDBSession& aDbs);
       
   104 	IMPORT_C static TUint ReadCustomSelectionPolicyIdL(TUint aAccessPointId, CommsDat::CMDBSession& aDbs);
       
   105 	IMPORT_C static TUint ReadCprConfigL(TUint aAccessPointId, CommsDat::CMDBSession& aDbs);
       
   106 	IMPORT_C static void MapRankingToPrefsL(TUint aRanking, TCommDbConnPref& aPrefs, CommsDat::CMDBSession& aDbs);
       
   107 	IMPORT_C static void ParseTLConfigAccessPointIdsL(RArray<TUint> &aIds, const TDesC& aIdList);
       
   108 	IMPORT_C static CommsDat::CCDConfigAccessPointRecord* LoadConfigAccessPointRecordL(TUint aId, CommsDat::CMDBSession& aDBs);
       
   109 	IMPORT_C static TUint GetConnectionAttemptsL(CommsDat::CMDBSession& aDbs);
       
   110 	IMPORT_C static void MapRankingAndDirectionToPrefsL(TUint aRanking, TCommDbConnectionDirection aDirection, TCommDbConnPref& aPrefs, CommsDat::CMDBSession& aDbs);
       
   111 
       
   112 	//This function reads the AP priority based selection policy table (CCDAPPrioritySelectionPolicyRecord)
       
   113 	//and fills the array provided using the specified selectionPolicy id (record id within the policy table).
       
   114 	IMPORT_C static void FillListL(TConnIdList& aList, TUint selectionPolicy, CommsDat::CMDBSession& aDbs);
       
   115 	IMPORT_C static void FillListL(RConnPrefList& aList, TUint selectionPolicy, CommsDat::CMDBSession& aDbs);
       
   116 
       
   117 	IMPORT_C static RTierThreadMap* BuildTierThreadMappingL(CommsDat::CMDBSession& aDbs);
       
   118 
       
   119 	IMPORT_C static TUid MapElementIdToTagId(TUint aElementId, CommsDat::CMDBSession& aDbs);
       
   120 	
       
   121 	IMPORT_C static void GetPrefsFromConnPrefRecL(TUint aConnPrefRecElemId, 
       
   122 												  CommsDat::CMDBSession& aDbs,
       
   123 												  TConnectionPrefs& aConnPrefs);
       
   124 	//This function is called from the Network level selector when a SNAP
       
   125 	//preference is received from the client.
       
   126 	IMPORT_C static TInt ConvertSNAPPrefToTagIdL(TUint aSNAPPref, CommsDat::CMDBSession& aDbs);
       
   127 	IMPORT_C static TUid MapTierIdtoTierImplIdL(TUid aTierUid, CommsDat::CMDBSession& aDbs );
       
   128 	};
       
   129 
       
   130 class CCommsDatIapView : public CBase
       
   131 /**
       
   132 Class used for reading CommsDat Service and Bearer tables according to a particular IAP view.
       
   133 
       
   134 @internalTechnology
       
   135 */
       
   136 	{
       
   137 public:
       
   138 	enum TFieldId
       
   139 		{
       
   140 		EIfNetworks = 1,
       
   141 		EConfigDaemonName,
       
   142 		EConfigDaemonManagerName
       
   143 		};
       
   144 
       
   145 	IMPORT_C static CCommsDatIapView* NewL(TUint aIapId);
       
   146 	IMPORT_C static CCommsDatIapView* NewLC(TUint aIapId);
       
   147 	IMPORT_C ~CCommsDatIapView();
       
   148 
       
   149 	IMPORT_C TUint IapId();
       
   150 	IMPORT_C CommsDat::TMDBElementId GetServiceTableType() const;
       
   151 	IMPORT_C CommsDat::TMDBElementId GetBearerTableType() const;
       
   152 
       
   153 	IMPORT_C void GetIntL(CommsDat::TMDBElementId aElementId, TUint32& aValue);
       
   154 	IMPORT_C void GetIntL(CommsDat::TMDBElementId aElementId, TInt& aValue);
       
   155 	IMPORT_C void GetBoolL(CommsDat::TMDBElementId aElementId, TBool& aValue);
       
   156 	IMPORT_C void GetTextL(CommsDat::TMDBElementId aElementId, HBufC8*& aValue);
       
   157 	IMPORT_C void GetTextL(CommsDat::TMDBElementId aElementId, HBufC16*& aValue);
       
   158 
       
   159 	IMPORT_C TInt GetInt(CommsDat::TMDBElementId aElementId, TUint32& aValue);
       
   160 	IMPORT_C TInt GetInt(CommsDat::TMDBElementId aElementId, TInt& aValue);
       
   161 	IMPORT_C TInt GetBool(CommsDat::TMDBElementId aElementId, TBool& aValue);
       
   162 	IMPORT_C TInt GetText(CommsDat::TMDBElementId aElementId, HBufC8*& aValue);
       
   163 	IMPORT_C TInt GetText(CommsDat::TMDBElementId aElementId, HBufC16*& aValue);
       
   164 
       
   165 	IMPORT_C void GetTableCommonTextFieldL(CCommsDatIapView::TFieldId aFieldId, HBufC*& aValue);
       
   166 
       
   167 	IMPORT_C void GetTimeoutValuesL(TUint32& aShortTimeout, TUint32& aMediumTimeout, TUint32& aLongTimeout);
       
   168 
       
   169 private:
       
   170 	void SetElementAndRecordIdL(CommsDat::CMDBElement* aElement, CommsDat::TMDBElementId aElementId);
       
   171     static TInt ConvertBearerTypeToTableId(const TDesC& aBearerType, CommsDat::TMDBElementId& aElementId);
       
   172     static TInt ConvertServiceTypeToTableId(const TDesC& aBearerType, CommsDat::TMDBElementId& aElementId);
       
   173     void GetIapRecordIntL(CommsDat::TMDBElementId aElementId, TUint32& aValue);
       
   174     void GetIapRecordIntL(CommsDat::TMDBElementId aElementId, TInt& aValue);
       
   175 	void GetIapRecordTextL(CommsDat::TMDBElementId aElementId, HBufC16*& aValue);
       
   176 	void IntFieldTypeCheckL(TInt aElementId);
       
   177 	void BoolFieldTypeCheckL(TInt aElementId);
       
   178 	void TextOrBinFieldTypeCheckL(TInt aElementId);
       
   179 	//void BinFieldTypeCheckL(TInt aElementId);
       
   180 private:
       
   181 	CommsDat::CMDBSession*          iDbs;
       
   182 	CommsDat::CCDIAPRecord*         iIapRec;
       
   183 	TInt                            iUmtsR99QoSAndOnRecId;
       
   184 
       
   185 	CommsDat::CMDBField<TBool>*     iBool;
       
   186 	CommsDat::CMDBField<TUint32>*   iUint;
       
   187 	CommsDat::CMDBField<TInt>*      iInt;
       
   188 	CommsDat::CMDBField<TDesC8>*    iText8;
       
   189 	CommsDat::CMDBField<TDesC16>*   iText16;
       
   190 	};
       
   191 
       
   192 } //namespace ESock
       
   193 
       
   194 
       
   195 #endif
       
   196 // SYMBIAN_SS_TIER_MANAGER_UTILS_H
       
   197 
       
   198