datacommsserver/esockserver/inc/ss_commsprov.h
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     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 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @publishedPartner
       
    19  @released
       
    20 */
       
    21 
       
    22 #ifndef SYMBIAN_SS_COMMSPROV_H
       
    23 #define SYMBIAN_SS_COMMSPROV_H
       
    24 
       
    25 #include <comms-infras/metadata.h>
       
    26 #include <comms-infras/ss_commsprov_internal.h>
       
    27 #include <comms-infras/ss_rmetaextensioncontainer.h>
       
    28 
       
    29 class CIpProtoProviderSelector;
       
    30 
       
    31 namespace Messages
       
    32 {
       
    33     class TSignatureBase;
       
    34 }
       
    35 
       
    36 //class CIpProtoProviderSelector;
       
    37 
       
    38 namespace ESock
       
    39 {
       
    40 
       
    41 /**
       
    42 Information used by provider factories to uniquely identify providers.
       
    43 */
       
    44 class TProviderInfo
       
    45     {
       
    46 public:
       
    47     inline TProviderInfo()
       
    48         : iAPId(0), iTierId(TUid::Uid(0)), iInstance(0)
       
    49         {
       
    50         }
       
    51     
       
    52     /**
       
    53     @param aTierId Tier on which the provider is created
       
    54     @param aAPId   Access point id of the provider
       
    55     @param aInstance  Unique information used to deferenciate providers with the same aAPId and aTierId (used for legacy selection)
       
    56     */
       
    57     inline TProviderInfo(TUid aTierId, TUint32 aAPId, TAny* aInstance = NULL)
       
    58         : iAPId(aAPId), iTierId(aTierId), iInstance(aInstance)
       
    59         {
       
    60         }
       
    61 
       
    62     /**
       
    63     Do a binary comparison of this against another instance of TProviderInfo
       
    64     @param aRHS The other TProviderInfo
       
    65     @return ETrue if the passed in TProviderInfo matches this.
       
    66     */
       
    67     inline TBool operator==(const TProviderInfo& aRHS) const
       
    68         {
       
    69         return Mem::Compare((const TUint8*)this,sizeof(*this),(const TUint8*)&aRHS,sizeof(*this))==0;
       
    70         }
       
    71 
       
    72     /**
       
    73     @return the tier id of the provider
       
    74     */
       
    75     inline TUid TierId() const {return iTierId;}
       
    76 
       
    77     /**
       
    78     @return the access point id of the provider
       
    79     */
       
    80     inline TUint APId() const {return iAPId;}
       
    81     inline TUid  APId(const TInt /*aDummy*/) const {return TUid::Uid(iAPId);}
       
    82 
       
    83     /**
       
    84     @return the instance information of the provider
       
    85     */
       
    86     inline TAny* Instance() const {return iInstance;}
       
    87 
       
    88     /**
       
    89     Set the instance information of the provider
       
    90     @param aInstance The information used to uniquely identify the instance.
       
    91     */
       
    92     inline void SetInstance(TAny* aInstance) {iInstance = aInstance;}
       
    93 
       
    94 private:
       
    95     TUint iAPId;    //it has to be first so that it maps to TCommDbConnPref in case of legacy attach
       
    96                     //see class TAttachPrefs
       
    97     TUid iTierId;
       
    98     TAny* iInstance;
       
    99 
       
   100 public:
       
   101     /**
       
   102     Pointer to the null provider info instance
       
   103     */
       
   104     static const TProviderInfo* const KNullProviderInfo;
       
   105 
       
   106     /**
       
   107     @return a pointer to the null provider info instance
       
   108     */
       
   109     IMPORT_C static const TProviderInfo& NullProviderInfo();
       
   110     };
       
   111 
       
   112 /**
       
   113 Information used by provider factories to uniquely identify providers.
       
   114 */
       
   115 class TProviderInfoExt : public Meta::SMetaData
       
   116     {
       
   117 public:
       
   118     enum { ETypeId = 0, EUid = 0x10286B59 };
       
   119     
       
   120     /**
       
   121     @param aProviderInfo TProviderInfo object to store in the extension
       
   122     */
       
   123     inline TProviderInfoExt(const TProviderInfo& aProviderInfo)
       
   124         : iProviderInfo(aProviderInfo)
       
   125         {
       
   126         }
       
   127 
       
   128 public:
       
   129     EXPORT_DATA_VTABLE_AND_FN
       
   130 
       
   131 public:
       
   132     const TProviderInfo& iProviderInfo;
       
   133     };
       
   134 
       
   135 class CMetaConnectionProviderBase;
       
   136 
       
   137 
       
   138 class TLayerConfig : public Meta::SMetaData
       
   139     {
       
   140 public:
       
   141     enum { ETypeId = 0, EUid = 0x10286B58 };
       
   142 
       
   143     TLayerConfig()
       
   144         : iMCprUid(TUid::Uid(0)), iCprUid(TUid::Uid(0)), iSCprUid(TUid::Uid(0)),
       
   145         iProtocolUid(TUid::Uid(0)), iTierId(TUid::Uid(0))   
       
   146         {
       
   147         }
       
   148     
       
   149     TLayerConfig(TUid aMCprUid, TUid aCprUid, TUid aSCprUid, TUid aProtocolUid, TUid aTierId)
       
   150         : iMCprUid(aMCprUid), iCprUid(aCprUid), iSCprUid(aSCprUid),
       
   151         iProtocolUid(aProtocolUid), iTierId(aTierId)   
       
   152         {
       
   153         }
       
   154 
       
   155     /**
       
   156     @return the uid of the mcpr for the layer
       
   157     */
       
   158     inline TUid MCprUid() const
       
   159         {
       
   160         return iMCprUid;
       
   161         }
       
   162     
       
   163     /**
       
   164     @return the uid of the cpr for the layer
       
   165     */
       
   166     inline TUid CprUid() const
       
   167         {
       
   168         return iCprUid;
       
   169         }
       
   170     
       
   171     /**
       
   172     @return the uid of the scpr for the layer
       
   173     */
       
   174     inline TUid SCprUid() const
       
   175         {
       
   176         return iSCprUid;
       
   177         }
       
   178     
       
   179     /**
       
   180     @return the uid of the flow for the layer
       
   181     */
       
   182     inline TUid ProtocolUid() const
       
   183         {
       
   184         return iProtocolUid;
       
   185         }
       
   186     
       
   187     /**
       
   188     @return the uid of the tier this layer is in
       
   189     */
       
   190     inline TUid TierId() const
       
   191         {
       
   192         return iTierId;
       
   193         }
       
   194 
       
   195 public:
       
   196     EXPORT_DATA_VTABLE_AND_FN
       
   197 
       
   198 private:
       
   199     TUid iMCprUid;
       
   200     TUid iCprUid;
       
   201     TUid iSCprUid;
       
   202     TUid iProtocolUid;
       
   203     TUid iTierId;
       
   204     };
       
   205 
       
   206 
       
   207 class TLayerSelectionInfo : public Meta::SMetaData
       
   208     {
       
   209     friend class ::CIpProtoProviderSelector;
       
   210 
       
   211 public:
       
   212     enum { ETypeId = 0, EUid = 0x10286B57 };
       
   213 
       
   214     TLayerSelectionInfo()
       
   215         : iSelectionPolicy(0), iCprConfig(0), iCustomSelectionPolicy(0)
       
   216         {
       
   217         }
       
   218     
       
   219     TLayerSelectionInfo(TUint aSelectionPolicy, TUint aCprConfig, TUint aCustomSelectionPolicy)
       
   220         : iSelectionPolicy(aSelectionPolicy), iCprConfig(aCprConfig), iCustomSelectionPolicy(aCustomSelectionPolicy)
       
   221         {
       
   222         }
       
   223     
       
   224     /**
       
   225     @return the selection policy for the layer. How this is used is up to the layer.
       
   226     */
       
   227     inline TUint SelectionPolicy() const
       
   228         {
       
   229         return iSelectionPolicy;
       
   230         }
       
   231     
       
   232     /**
       
   233     @return the cpr configuration for the layer. How this is used is up to the layer. For ipproto and link layer this is equivalent to the IAP.
       
   234     */
       
   235     inline TUint CprConfig() const
       
   236         {
       
   237         return iCprConfig;
       
   238         }
       
   239 
       
   240     /** 
       
   241     @return the custom seleciton policy for this layer
       
   242     */
       
   243     inline TUint CustomSelectionPolicy() const
       
   244         {
       
   245         return iCustomSelectionPolicy;
       
   246         }
       
   247 
       
   248 public:
       
   249     EXPORT_DATA_VTABLE_AND_FN
       
   250 
       
   251 private:
       
   252     TUint iSelectionPolicy;
       
   253     TUint iCprConfig;
       
   254     TUint iCustomSelectionPolicy;   
       
   255     };
       
   256 
       
   257 
       
   258 class TAccessPointPriority : public Meta::SMetaData
       
   259     {
       
   260     public:
       
   261         enum { ETypeId = 0, EUid = 0x10286B56 };
       
   262 
       
   263     TAccessPointPriority()
       
   264         {
       
   265         iPriority = KMaxTUint;
       
   266         }
       
   267         
       
   268     inline TUint Priority() const
       
   269         {
       
   270         return iPriority;
       
   271         }
       
   272     
       
   273     inline void SetPriority(TUint aPriority)
       
   274         {
       
   275         iPriority = aPriority;
       
   276         }
       
   277     
       
   278 public:
       
   279     EXPORT_DATA_VTABLE_AND_FN
       
   280 
       
   281 private:
       
   282     TUint iPriority;
       
   283     };
       
   284 
       
   285 
       
   286 class TAppSidConfig : public Meta::SMetaData
       
   287     {
       
   288 public:
       
   289     enum { ETypeId = 0, EUid = 0x10286B55 };
       
   290 
       
   291     explicit TAppSidConfig(TUint aAppSid)
       
   292         : iAppSid(aAppSid)
       
   293         {
       
   294         }
       
   295     
       
   296     /**
       
   297     @return the Application secure ID for this layer
       
   298     */
       
   299     inline TUint AppSid() const
       
   300         {
       
   301         return iAppSid;
       
   302         }
       
   303 
       
   304 public:
       
   305     EXPORT_DATA_VTABLE_AND_FN
       
   306 
       
   307 private:
       
   308     TUint iAppSid;
       
   309     };
       
   310 
       
   311 } //namespace ESock
       
   312 
       
   313 #endif
       
   314 //SYMBIAN_SS_COMMSPROV_H
       
   315