commsfwtools/preparedefaultcommsdatabase/inc/CommsDatSchema.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 CommsDatSchema.h
       
    18  *
       
    19  * Declaration of the comms data schema
       
    20  *
       
    21  * @internalComponent
       
    22  * @released
       
    23  *
       
    24  */
       
    25 
       
    26 #if (! defined COMMSDATSCHEMA_H)
       
    27 #define        COMMSDATSCHEMA_H
       
    28 
       
    29 #include <commsdattypeinfov1_1.h>
       
    30 #include <commsdattypeinfov1_1_internal.h>
       
    31 
       
    32 namespace CommsDat
       
    33 {
       
    34     // table lookup structure 
       
    35     typedef struct 
       
    36 	    {
       
    37 	    TMDBElementId				        iTableId;
       
    38 	    const TText* 						iTableName;
       
    39       	const CommsDat::SRecordTypeInfo*	iFields;
       
    40       } STableLookup;
       
    41 
       
    42 
       
    43 NONSHARABLE_CLASS(CommsDatSchemaV1_1)
       
    44 /*
       
    45 CommsDatSchemaV1_1 encapsulates
       
    46 
       
    47   Schema (Version 1.1) of tables in the Comms Database
       
    48 	Linking table id with table name and field info
       
    49 */
       
    50 	{
       
    51 
       
    52 	public :
       
    53 
       
    54         //
       
    55         // Field Linktypes
       
    56         //
       
    57         typedef enum
       
    58         {
       
    59 #ifdef SYMBIAN_COMMSDAT_USE_INT_RECORD_LINKS
       
    60 // Integer record links used up to OS 9.3
       
    61             /* links for particular record types (can be extended as necessary)*/
       
    62             ELinkIAPRecord          = EInt,
       
    63             ELinkAPRecord           = EInt,
       
    64             ELinkEAPSecRecord       = EInt,
       
    65             ELinkWAPAPRecord        = EInt,
       
    66             ELinkModemBearerRecord  = EInt,
       
    67             ELinkAgentLookupRecord  = EInt,
       
    68             ELinkNetworkRecord      = EInt,
       
    69             ELinkLocationRecord     = EInt,
       
    70             ELinkChargecardRecord   = EInt,
       
    71             ELinkUMTSR99QoSRecord   = EInt
       
    72 #else
       
    73             /* links for particular record types (can be extended as necessary)*/
       
    74             ELinkIAPRecord          = ELink | KCDTIdIAPRecord,
       
    75             ELinkAPRecord           = ELink | KCDTIdAccessPointRecord,
       
    76 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
       
    77             ELinkTierRecord         = ELink | KCDTIdTierRecord,
       
    78             ELinkMCprRecord         = ELink | KCDTIdMCprRecord,
       
    79             ELinkCprRecord          = ELink | KCDTIdCprRecord,            
       
    80             ELinkSCprRecord         = ELink | KCDTIdSCprRecord,            
       
    81             ELinkProtocolRecord     = ELink | KCDTIdProtocolRecord,
       
    82             ELinkCAPRecord          = ELink | KCDTIdConfigAccessPointRecord,
       
    83 #endif //SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
       
    84             ELinkEAPSecRecord       = ELink | KCDTIdEAPSecRecord,
       
    85             ELinkWAPAPRecord        = ELink | KCDTIdWAPAccessPointRecord,
       
    86             ELinkModemBearerRecord  = ELink | KCDTIdModemBearerRecord,
       
    87             ELinkAgentLookupRecord  = ELink | KCDTIdAgentLookupRecord,
       
    88             ELinkNetworkRecord      = ELink | KCDTIdNetworkRecord,
       
    89             ELinkLocationRecord     = ELink | KCDTIdLocationRecord,
       
    90             ELinkChargecardRecord   = ELink | KCDTIdChargecardRecord,
       
    91             ELinkUMTSR99QoSRecord   = ELink | KCDTIdUmtsR99QoSAndOnTableRecord
       
    92 #endif // SYMBIAN_COMMSDAT_USE_INT_RECORD_LINKS
       
    93         } TCDFieldLinkTypes;
       
    94 		/*
       
    95 		1/ Schema of tables in the database
       
    96 		*/
       
    97 
       
    98 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
       
    99 		static const SRecordTypeInfo iParamsRecordBaseInfo[];				// base class for all PARAMS tables
       
   100 #endif
       
   101 		static const SRecordTypeInfo iServiceRecordBaseInfo[];			// base class for all SERVICE tables
       
   102 		static const SRecordTypeInfo iBearerRecordBaseInfo[];				// base class for all BEARER tables
       
   103 		static const SRecordTypeInfo iConnectionPrefsRecordInfo[];		// Connection Preferences table - config for client preferences for connection behaviour
       
   104 		static const SRecordTypeInfo iGlobalSettingsRecordInfo[];			// Global settings - contains single record - config for global settings for comms behaviour
       
   105 		static const SRecordTypeInfo iNetworkRecordInfo[];				// Network table - config for service network information
       
   106 		static const SRecordTypeInfo iLocationRecordInfo[];				// Location table - config for host phone location
       
   107 		static const SRecordTypeInfo iIAPRecordInfo[];					// IAP table - config for a connection at the link layer, oonnects service, bearer, location and network information
       
   108 		static const SRecordTypeInfo iWAPAccessPointRecordInfo[];			// WAP access point table - config for WAP access point connection
       
   109 		static const SRecordTypeInfo iDialOutISPRecordInfo[];				// SERVICE: DialOut ISP table - config to allow dial-up connection with remote ISP
       
   110 		static const SRecordTypeInfo iDialInISPRecordInfo[];				// SERVICE: DialIn ISP table - config to allow dial-back from remote ISP (testing only)
       
   111 		static const SRecordTypeInfo iLANServiceRecordInfo[];				// SERVICE: LAN Service table - config for a LAN service
       
   112 		static const SRecordTypeInfo iWLANServiceExtRecordInfo[];			// SERVICE: WLAN Service table - config for a WLAN service
       
   113 		static const SRecordTypeInfo iVPNServiceRecordInfo[];				// SERVICE: VPN Service table - config for a VPN service
       
   114 		static const SRecordTypeInfo iUmtsR99QoSAndOnTableRecordInfo[];	// UMTSR99QoSAndOn Table - config for QoS parameters for default context
       
   115 		static const SRecordTypeInfo iWCDMAPacketServiceRecordInfo[];		// SERVICE:	WCDMA Packet service table - config for a WCDMA packet service (GPRS) connection
       
   116 		static const SRecordTypeInfo iDefaultWCDMARecordInfo[];			// Default WCDMA table - default settings for WCDMA service (only one record in this table)
       
   117 		static const SRecordTypeInfo iModemBearerRecordInfo[];				// BEARER: Modem Bearer table - settings for any modem bearer
       
   118 		static const SRecordTypeInfo iLANBearerRecordInfo[];				// BEARER: LAN bearer table - settings for any LAN bearer
       
   119 		static const SRecordTypeInfo iVirtualBearerRecordInfo[];			// BEARER: Virtual Bearer table - settings for any virtual bearer
       
   120 		static const SRecordTypeInfo iWAPSMSBearerRecordInfo[];			// WAP: WAP SMS Bearer table - settings for a WAP SMS bearer
       
   121 		static const SRecordTypeInfo iWAPIPBearerRecordInfo[];				// WAP: WAP IP Bearer table - settings for a WAP IP bearer
       
   122 		static const SRecordTypeInfo iChargecardRecordInfo[];				// Chargecard table - settings for chargecard payment
       
   123 		static const SRecordTypeInfo iProxiesRecordInfo[];					// Proxies table - settings for HTTP and other proxies
       
   124 		static const SRecordTypeInfo iSecureSocketRecordInfo[];			// @deprecated - Secure Socket table - settings for SSL/TLS
       
   125 		static const SRecordTypeInfo iAgentLookupRecordInfo[];				// @deprecated - settings for AgentLookupTable
       
   126 		static const SRecordTypeInfo iPANServiceExtRecordInfo[];			// PAN service extension table - extension table to use PAN via LAN service
       
   127 		static const SRecordTypeInfo iAccessPointRecordInfo[];				// Access Point table - definition of a single layer or access point within the comms stack
       
   128 		static const SRecordTypeInfo iIAPPrioritySelectionPolicyRecordInfo[];// IAP Priority Selection Policy table - indication of priority selection of next-level Access Point
       
   129 		static const SRecordTypeInfo iEAPSecRecordInfo[];					// EAP Sec table - settings for EAP authenticiation
       
   130 		static const SRecordTypeInfo iTunEAPRecordInfo[];					// Tun EAP table - settings for Tunnelled EAP authentication method
       
   131 		static const SRecordTypeInfo iEAPTLSRecordInfo[];					// EAP TLS table - settings for EAP TLS authentication method
       
   132 		static const SRecordTypeInfo iLEAPRecordInfo[];						// LEAP table - settings for LEAP authentication method
       
   133 		static const SRecordTypeInfo iEAPSIMRecordInfo[];					// EAP-SIM table - settings for EAP-SIM authentication method
       
   134 		static const SRecordTypeInfo iEAPAKARecordInfo[];					// EAP-AKA table - settings for EAP-AKA authentication method
       
   135 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
       
   136 		static const SRecordTypeInfo iAPPrioritySelectionPolicyRecordInfo[];// IAP Priority Selection Policy table - indication of priority selection of next-level Access Point
       
   137 		static const SRecordTypeInfo iTierRecordInfo[];
       
   138 	    static const SRecordTypeInfo iMCprRecordInfo[];
       
   139 	    static const SRecordTypeInfo iCprRecordInfo[];
       
   140 	    static const SRecordTypeInfo iSCprRecordInfo[];
       
   141 	    static const SRecordTypeInfo iProtocolRecordInfo[];
       
   142 	    static const SRecordTypeInfo iBearerTypeRecordInfo[];
       
   143 	    static const SRecordTypeInfo iConfigAccessPointRecordInfo[];
       
   144 
       
   145 	    static const SRecordTypeInfo iPolicySelectorRecordInfo[];
       
   146 	    static const SRecordTypeInfo iPolicySelector2ParamsRecordInfo[];
       
   147 
       
   148 		static const SRecordTypeInfo iGenericQosRecordInfo[];
       
   149 #endif // SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
       
   150 
       
   151 		static const SRecordTypeInfo iWifiScanEngineRecordInfo[];
       
   152 
       
   153 		static const STableLookup iTableLookup[];
       
   154 		
       
   155 		/*
       
   156 		Retrieve type info for a table given a table id
       
   157 		@internalComponent
       
   158 		*/
       
   159 		static const SRecordTypeInfo* GetRecordTypeInfo(TMDBElementId aId);
       
   160 
       
   161         /*
       
   162         Retrieve full type info for a field given a <table><column> id
       
   163         @internalcomponent
       
   164         */
       
   165 		IMPORT_C static TInt GetFieldTypeInfoL(TMDBElementId aId);
       
   166 		
       
   167 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
       
   168 		/* This function is to get full table info based on the table ID. The main
       
   169 		 * purpose to have this function is CEDDUMP. It has got a functionality,
       
   170 		 * which resolves the link values to Link.<Tablename>.<TagId> format. In order
       
   171 		 * to get the tableID we need this function.
       
   172 		 * It's marked as internal component, because CEDDUMP should use it only.
       
   173 		 * @internalcomponent
       
   174 		 */
       
   175 		IMPORT_C static const STableLookup* GetTableInfoL(TMDBElementId aId);
       
   176 #endif
       
   177 		/* Get back the table ID based on the table name */
       
   178         static TMDBElementId LookupTableId(TDesC& tableName);
       
   179         
       
   180         /*
       
   181         This function is used when some linked record is given as tagId. This can be done
       
   182         only with some tables and this function can tell whether the forced link resolving
       
   183         can be applied to the given table or not...
       
   184         @internalcomponent
       
   185         */
       
   186         static TBool IsEnabledForcedLinkedTypeResolving(TMDBElementId aId);
       
   187         
       
   188         /*
       
   189         If the forced link resolving is enabled this function resolves the linked record
       
   190         given as tagId and returns the linked type.
       
   191         @internalcomponent
       
   192         */
       
   193         static TMDBElementId ForcedFindLinkedIdL(TMDBElementId aTableId, TMDBElementId aLinkingFieldId);
       
   194 
       
   195 	private :
       
   196 
       
   197 		CommsDatSchemaV1_1(){} // at the moment, no need to instantiate this class - just used as namespace
       
   198 
       
   199 	};
       
   200 
       
   201 NONSHARABLE_CLASS(CommsDatSchema)
       
   202 /*
       
   203 CommsDatSchema encapsulates
       
   204 
       
   205   Type Validation Functions
       
   206 		Lookup for Table Type info by id
       
   207 		 to check container type matches data type
       
   208 */
       
   209 	{
       
   210 	public:
       
   211 
       
   212 		/*******************************************************
       
   213 		Functions to check the meaning of an elementId
       
   214 		*/
       
   215 		static TBool IsNode(TMDBElementId aElementId);
       
   216 
       
   217 		static TBool IsTable(TMDBElementId aElementId);
       
   218 
       
   219 		static TBool IsColumn(TMDBElementId aElementId);
       
   220 
       
   221 		static TBool IsRecord(TMDBElementId aElementId);
       
   222 
       
   223 		static TBool IsGenericRecord(TMDBElementId aElementId);
       
   224 
       
   225 		static TBool IsTemplate(TMDBElementId aElementId);
       
   226 
       
   227 		static TBool HasValidTableId(TMDBElementId aElementId);
       
   228 
       
   229 		static TBool HasValidColumnId(TMDBElementId aElementId);
       
   230 
       
   231 		static TBool HasValidRecordId(TMDBElementId aElementId);
       
   232 
       
   233 		static TBool IsNewRecordRequest(TMDBElementId aElementId);
       
   234 
       
   235 		static TBool IsNewColumnRequest(TMDBElementId aElementId);
       
   236 
       
   237 		static TBool IsNewTableRequest(TMDBElementId aElementId); // New Table Request is not currently supported
       
   238 
       
   239 		static TBool IsDeprecatedRecord(
       
   240 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
       
   241 		                                TMDBElementId aElementId
       
   242 #endif //SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
       
   243 		                               );
       
   244 		/*****************************************************************************************
       
   245 		* Functions to check validity of container being used to store or modify data
       
   246 		*/
       
   247 
       
   248 		/*
       
   249 		Validate the container type of aElement is appropriate to carry the data specified by its element id
       
   250 		*/
       
   251 		static void ValidateFieldTypeL(CMDBSession& aSession, CMDBElement& aElement);
       
   252 
       
   253         /*
       
   254         Get link information about legacy fields that link with base classes (NB new links should be used properly)
       
   255         */
       
   256 		static TMDBElementId GetLegacyLinkTableIdL(CMDBSession& aSession, TMDBElementId aLinkingFieldId, CMDBElement* aLinkingRecord);
       
   257 
       
   258         /*
       
   259         Fully qualify link fields to give table and record id
       
   260         */
       
   261         static TMDBElementId GetLinkIdL(CMDBSession& aSession, TMDBElementId aLinkingFieldId, TMDBElementId aLinkingFieldValue, TMDBElementId aLinkedTableId, CMDBElement* aLinkingRecord = NULL);
       
   262         
       
   263         /*
       
   264         Get the linked element ID from the database
       
   265         */
       
   266         static TMDBElementId IdTagResolverL(CMDBSession& aSession, TMDBElementId aLinkedTypeId, TMDBElementId aTargetValue);
       
   267         
       
   268         static TMDBElementId ConstructLinkFromLegacyValueL(CMDBSession& aSession, CMDBElement* aLegacyField, TInt aLegacyValue);
       
   269         
       
   270         /* This funciton here is for the case when somebody tries to read a
       
   271                   * legacy link field, which is now contains the fully resolved TMDBElementId
       
   272                   * of the linked record, to contain only the record id...
       
   273                   * 
       
   274                   * IMPORTANT: the function expects ONLY fields as parameter!!!!!!!!!
       
   275         */
       
   276         static void ChangeLegacyLinkFieldValues(CMDBElement*& aLegacyField);
       
   277         
       
   278         static TMDBElementId ForcedLegacyLinkFindL(CMDBSession& aSession, TMDBElementId aLinkingFieldId, TMDBElementId aLinkingFieldValue, CMDBElement* aElement);
       
   279         
       
   280 	private :
       
   281 		static TMDBElementId ForcedIAPFindL(CMDBSession& aSession, TMDBElementId aLinkingFieldId, TMDBElementId aLinkingFieldValue, CMDBElement* aElement);
       
   282 		static TMDBElementId ForcedProxiesFindL(CMDBSession& aSession, TMDBElementId aLinkingFieldId, TMDBElementId aLinkingFieldValue, CMDBElement* aElement);
       
   283 		static TMDBElementId ForcedLanServiceFindL(CMDBSession& aSession, TMDBElementId aLinkingFieldId, TMDBElementId aLinkingFieldValue, CMDBElement* aElement);
       
   284 		
       
   285 		CommsDatSchema(){} // at the moment, no need to instantiate this class - just used as namespace
       
   286 
       
   287 	}; //class CommsDatSchema
       
   288 
       
   289 
       
   290 }// end namespace CommsDat
       
   291 
       
   292 #endif // COMMSDATSCHEMA_H