commsfwtools/preparedefaultcommsdatabase/src/CommsDatMapperAndValidatorUtils.h
changeset 0 dfb7c4ff071f
child 12 8b5d60ce1e94
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 2007-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 CommsDatMapperAndValidatorUtils.h
       
    18  *
       
    19  * Definitions for internal use within CommsDat component for the Mapper and
       
    20  * Validator objects
       
    21  *
       
    22  * @internalTechnology
       
    23  * @released
       
    24  *
       
    25  *
       
    26  */
       
    27 #ifndef COMMSDATMAPPERANDVALIDATORUTILS_H
       
    28 #define COMMSDATMAPPERANDVALIDATORUTILS_H
       
    29 
       
    30 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
       
    31 
       
    32 #include <cdbcols.h>
       
    33 #include <in_sock.h> //KAfInet
       
    34 //forward declarations
       
    35 namespace CommsDat
       
    36     {
       
    37     class CMDBSession;
       
    38     class CCDAPPrioritySelectionPolicyRecord;
       
    39     class CCDAccessPointRecord;
       
    40     
       
    41     template<class RECORD_TYPE>
       
    42     class CMDBRecordLink;
       
    43     
       
    44     
       
    45     //Possible operations which the validatior should handle
       
    46     typedef enum 
       
    47         {
       
    48         ELoad,
       
    49         ERefresh,
       
    50         EStore,
       
    51         EModify,    //ModifyL or StoreL method
       
    52         EDelete,    //DeleteL method
       
    53         EFind		//FindL method
       
    54         } TOperation;
       
    55     }
       
    56 
       
    57 namespace CommsDatInternal
       
    58 /*
       
    59 @internalTechnology
       
    60 */
       
    61 {
       
    62 _LIT(KNetworkAPTemplateRecName,"NetworkDefaultTemplate");
       
    63 _LIT(KIPProtoTemplateRecName,"IPProtoDefaultTemplate");
       
    64 _LIT(KIPProtoTag, "IPProto_generated_");
       
    65 _LIT(KDefaultIPProtoRecName, "IPProtoDefault");
       
    66 
       
    67 const TInt MAX_BUFFER_LEN_FOR_NAMING = 10;
       
    68 const TInt IPProtoBaseTagId = 10001;
       
    69 //the maximum number of IAP links from the ConnPref table (1/record)
       
    70 const TInt MaxNumberOfLinks = 2;
       
    71 //the maximum number of AP/IAP links in an APPrioritySelPol/IAPPrioritySelPol record
       
    72 const TInt MaxLinkCount = 15;
       
    73 
       
    74 NONSHARABLE_CLASS(CommsDatMapperAndValidator)
       
    75 /*
       
    76 Contains definitions for the Validator and Mapper objects. The functions 
       
    77 are not exported.
       
    78 
       
    79 @internalTechnology
       
    80 */
       
    81     {
       
    82     public:
       
    83     
       
    84     enum
       
    85         {
       
    86         ENetworkLevelTierId = KAfInet,  // Network Tier Id : KAfInet=0x0800 
       
    87         EIPProtoTierId = 271064560,
       
    88         ELinkTierId = 271064565
       
    89         };
       
    90         
       
    91     typedef enum
       
    92         {
       
    93         EUndefined,
       
    94         ENetworkLevel,
       
    95         EIPProtoLevel,
       
    96         ELinkLevel
       
    97         } TAPTypes;
       
    98     
       
    99     typedef enum
       
   100         {
       
   101         EConnPref,
       
   102         EIAPPriorSelPol
       
   103         } TSelPolModLogic;
       
   104     
       
   105     static TInt GenerateTagIdL(TInt aBaseTagId, CommsDat::CMDBSession& aSession);
       
   106     static CommsDat::CCDAPPrioritySelectionPolicyRecord* FindTheAPPrioritySelPolRecL(CommsDat::CMDBSession& aSession);
       
   107     static CommsDat::CCDAccessPointRecord* GenerateIPProtoAPL(TInt aTagGenerationBase, 
       
   108                                                               TInt aLinkLevelAPTagId,
       
   109                                                               CommsDat::CMDBSession& aSession);
       
   110     static void GenerateRecordName(TDes& aBuffer, TInt aUniqueNumber);
       
   111 
       
   112 
       
   113     static void ModifyAPPrioritySelPolRecL(CommsDat::CMDBRecordLink<CommsDat::CCDAccessPointRecord>*& aFieldInRecord,
       
   114                                           CommsDat::CCDAPPrioritySelectionPolicyRecord*& aAPSelPolRec,
       
   115                                           TInt aAPElementId);
       
   116 
       
   117     static void ModifyDefaultTierRecordL(TInt aAPElementId, 
       
   118                                          CommsDat::CMDBSession& aSession);
       
   119     
       
   120     static TInt GetDefAPPrioritySelPolLinkValueL(CommsDat::CMDBSession& aSession);
       
   121     
       
   122     static TInt GetNetworkTierRecordIdL(CommsDat::CMDBSession& aSession);
       
   123     
       
   124     static TInt GetIPProtoTierRecordIdL(CommsDat::CMDBSession& aSession);
       
   125 
       
   126     static TBool IsIPProtoAPAlreadyExistL(TInt aLinkLevelTagId, CommsDat::CMDBSession& aSession);
       
   127     
       
   128     static TBool IsIPProtoAPAlreadyExistL(TInt aLinkLevelTagId, TInt aConnPrefElementId, CommsDat::CMDBSession& aSession);
       
   129     
       
   130     static CommsDat::CCDAccessPointRecord* LoadTheAPL(TInt aLinkLevelTagId, CommsDat::CMDBSession& aSession);
       
   131     
       
   132     static TInt CountReferenceToThisIPProtoAPL(TUint aElementId, CommsDat::CMDBSession& aSession);
       
   133     
       
   134     static TInt CountReferenceToThisIPProtoAPL(TUint aElementId, 
       
   135     										   CommsDat::CCDAPPrioritySelectionPolicyRecord* aTheAlreadyDeletedRecord,
       
   136     										   CommsDat::CMDBSession& aSession);
       
   137     
       
   138     static TBool IsIAPRecInDB(CommsDat::CMDBSession& aSession);
       
   139     
       
   140     static TBool IsDefIPProtoAPInDB(CommsDat::CMDBSession& aSession);
       
   141     
       
   142     static CommsDat::CCDAccessPointRecord* GetTheDefIPProtoAP(CommsDat::CMDBSession& aSession);
       
   143     
       
   144     static TInt GetNumberOfThisIPProtoAPL(CommsDat::CCDAccessPointRecord* aAPRecToBeDeleted, CommsDat::CMDBSession& aSession);
       
   145     
       
   146     static void CorrectLinksL(TUint aElementIdToBeDeleted, CommsDat::CMDBSession& aSession);
       
   147     
       
   148     private:
       
   149     CommsDatMapperAndValidator();
       
   150     CommsDatMapperAndValidator(const CommsDatMapperAndValidator&);
       
   151     CommsDatMapperAndValidator& operator=(const CommsDatMapperAndValidator&);
       
   152     
       
   153     static void CheckTheAPPrioritySelPolFromConnPrefModL(CommsDat::CCDAPPrioritySelectionPolicyRecord*& aAPSelPolRec);
       
   154     
       
   155     }; //CommsDatMapperAndValidator
       
   156     
       
   157 } //end of namespace CommsDatInternal
       
   158 
       
   159 #endif //SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
       
   160 
       
   161 #endif //COMMSDATMAPPERANDVALIDATORUTILS_H