datacommsserver/esockserver/inc/ss_metaconnprov_internal.h
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 1997-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 // SS_METACONNPROV.H
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalAll
       
    21 */
       
    22 
       
    23 #ifndef SYMBIAN_SS_METACONNPROV_INTERNAL_H
       
    24 #define SYMBIAN_SS_METACONNPROV_INTERNAL_H
       
    25 
       
    26 #include <comms-infras/ss_fact_internal.h>
       
    27 #include <comms-infras/ss_metaconnprov.h>
       
    28 
       
    29 namespace ESock
       
    30 {
       
    31 
       
    32 class CMetaConnectionProviderBase;
       
    33 
       
    34 /**
       
    35    Configuration classes for Config Access points
       
    36 */
       
    37 class TConfigAccessPointLayer
       
    38 	{
       
    39     public:
       
    40 	inline TConfigAccessPointLayer() {};
       
    41 	inline TConfigAccessPointLayer(const TUint aId,
       
    42 								   const TUid aSCprUid,
       
    43 								   const TUid aProtocolUid,
       
    44 								   const TUint iLayerBelow=0,
       
    45 								   const TBool aTopLevel=EFalse);
       
    46 
       
    47 	inline TUint Id() const {return iId;}
       
    48 	inline TUid SCprUid() const {return iSCprUid;}
       
    49 	inline TUid ProtocolUid() const {return iProtocolUid;}
       
    50 	inline TUint LayerBelow() const {return iLayerBelow; }
       
    51 	inline TBool TopLevel() const {return iTopLevel;}
       
    52 
       
    53 	inline void SetId(const TUint aId) { iId = aId; }
       
    54 	inline void SetSCprUid(const TUid aUid) { iSCprUid = aUid; }
       
    55 	inline void SetProtocolUid(const TUid aUid) { iProtocolUid = aUid; }
       
    56 	inline void SetLayerBelow(const TUint aLayerBelow) { iLayerBelow = aLayerBelow; }
       
    57 	inline void SetTopLevel(const TBool aTopLevel) { iTopLevel = aTopLevel; }
       
    58 
       
    59     private:
       
    60 	TUint iId;
       
    61 	TUid iSCprUid;
       
    62 	TUid iProtocolUid;
       
    63 
       
    64 	TUint iLayerBelow;
       
    65 	TBool iTopLevel;
       
    66 	};
       
    67 
       
    68 TConfigAccessPointLayer::TConfigAccessPointLayer(const TUint aId, const TUid aSCprUid,
       
    69 												 const TUid aProtocolUid, const TUint aLayerBelow,
       
    70 												 const TBool aTopLevel)
       
    71 	{
       
    72 	SetId(aId);
       
    73 	SetSCprUid(aSCprUid);
       
    74 	SetProtocolUid(aProtocolUid);
       
    75 	SetLayerBelow(aLayerBelow);
       
    76 	SetTopLevel(aTopLevel);
       
    77 	}
       
    78 
       
    79 class CConfigAccessPointConfig : public CBase, public Meta::SMetaData
       
    80 	{
       
    81     public:
       
    82 	enum { ETypeId = 0, EUid = 0x102822FF };
       
    83 
       
    84 	IMPORT_C static CConfigAccessPointConfig* NewL();
       
    85 	IMPORT_C ~CConfigAccessPointConfig();
       
    86 
       
    87 	IMPORT_C void AppendLayerL(const TConfigAccessPointLayer& aLayer);
       
    88 	IMPORT_C TBool LayerExists(const TConfigAccessPointLayer& aLayer) const;
       
    89 	IMPORT_C void GetTopLayersL(const TUid aScprUid, RPointerArray<TConfigAccessPointLayer>& aTopLayers) const;
       
    90 	IMPORT_C const TConfigAccessPointLayer& GetLayerL(const TUint aId) const;
       
    91 	IMPORT_C TUint GetLayerCount() const;
       
    92 
       
    93 	IMPORT_C void AppendSCprL(const TUid& aUid);
       
    94 	IMPORT_C const RArray<TUid>& SCprs() const;
       
    95 
       
    96 	EXPORT_DATA_VTABLE
       
    97 
       
    98     private:
       
    99 	inline CConfigAccessPointConfig() {};
       
   100 
       
   101 	RArray<TUid> iSCprs;
       
   102 	RArray<TConfigAccessPointLayer> iLayers;
       
   103 	};
       
   104 
       
   105 //
       
   106 //Factories - container
       
   107 //
       
   108 //There are no exports by design. The container is not supposed to be accessed
       
   109 //synchronously via a function call (other than ReceivedL()).
       
   110 
       
   111 NONSHARABLE_CLASS(CMetaConnectionFactoryContainer) : public CCommsFactoryContainer
       
   112 /** Container for meta connection provider factories.
       
   113 */
       
   114 	{
       
   115 	friend class CMetaConnectionProviderFactoryBase;
       
   116 
       
   117 #ifdef __X86GCC__
       
   118 protected:
       
   119  	// gcc-mingw does not support declaring friends from different namespaces so we define proxy
       
   120  	// functions to do the cast.
       
   121     friend CMetaConnectionProviderBase* ESock::__x86gcc_meta_connection_provider_base_cast(Factories::AFactoryObject* aFactoryObject);
       
   122     friend const CMetaConnectionProviderBase* ESock::__x86gcc_meta_connection_provider_base_cast(const Factories::AFactoryObject* aFactoryObject);
       
   123 
       
   124     enum
       
   125         {
       
   126         EId = EMetaConnectionFactoryContainer
       
   127         };
       
   128 #elif defined(__GCCXML__)
       
   129 public:
       
   130     enum
       
   131         {
       
   132         EId = EMetaConnectionFactoryContainer
       
   133         };
       
   134 #else
       
   135 protected:
       
   136     friend CMetaConnectionProviderBase* Factories::factoryobject_cast<CMetaConnectionProviderBase>(Factories::AFactoryObject* aFactoryObject);
       
   137     friend const CMetaConnectionProviderBase* Factories::factoryobject_cast<const CMetaConnectionProviderBase>(const Factories::AFactoryObject* aFactoryObject);
       
   138 
       
   139     enum
       
   140         {
       
   141         EId = EMetaConnectionFactoryContainer
       
   142         };
       
   143 #endif
       
   144 
       
   145 public:
       
   146 	virtual ~CMetaConnectionFactoryContainer();
       
   147 
       
   148 public:
       
   149 	static CMetaConnectionFactoryContainer* NewL();
       
   150 
       
   151 public:
       
   152 	CMetaConnectionProviderFactoryBase* Factory(TInt aIndex) const;
       
   153 
       
   154 protected:
       
   155 	CMetaConnectionFactoryContainer();
       
   156 	virtual void ReceivedL(const Messages::TRuntimeCtxId& aSender, const Messages::TNodeId& aRecipient, Messages::TSignatureBase& aMessage);
       
   157 
       
   158 	};
       
   159 } // namespace Esock
       
   160 
       
   161 
       
   162 namespace Factories
       
   163 {
       
   164 
       
   165 #ifdef __X86GCC__
       
   166  	// gcc-mingw does not support declaring friends from different namespaces so we define proxy
       
   167  	// functions to do the cast.
       
   168 	template <>
       
   169 	inline ESock::CMetaConnectionProviderBase* factoryobject_cast(AFactoryObject* aFactoryObject)
       
   170 	    {
       
   171 	    return ESock::__x86gcc_meta_connection_provider_base_cast(aFactoryObject);
       
   172 	    };
       
   173 
       
   174 	template <>
       
   175 	inline const ESock::CMetaConnectionProviderBase* factoryobject_cast(const AFactoryObject* aFactoryObject)
       
   176 	    {
       
   177 	    return ESock::__x86gcc_meta_connection_provider_base_cast(aFactoryObject);
       
   178 	    }
       
   179 #else
       
   180 	// RVCT does not allow the specialisation of template functions in a different namespace from the original
       
   181 	// so we declare them in the Factories namespace.
       
   182 	template<>
       
   183 	inline ESock::CMetaConnectionProviderBase* factoryobject_cast<ESock::CMetaConnectionProviderBase>(Factories::AFactoryObject* aFactoryObject)
       
   184 	    {
       
   185 	    return ESock::CMetaConnectionFactoryContainer::EId == static_cast<ESock::CCommsFactoryContainer&>(aFactoryObject->Factory().ParentContainer()).iId?
       
   186 	    	static_cast<ESock::CMetaConnectionProviderBase*>(aFactoryObject) : NULL;
       
   187 	    }
       
   188 
       
   189 	template<>
       
   190 	inline const ESock::CMetaConnectionProviderBase* factoryobject_cast<const ESock::CMetaConnectionProviderBase>(const Factories::AFactoryObject* aFactoryObject)
       
   191 	    {
       
   192 	    return ESock::CMetaConnectionFactoryContainer::EId == static_cast<ESock::CCommsFactoryContainer&>(aFactoryObject->Factory().ParentContainer()).iId?
       
   193 	    	static_cast<const ESock::CMetaConnectionProviderBase*>(aFactoryObject) : NULL;
       
   194 	    }
       
   195 #endif
       
   196 
       
   197 } //namespace Factories
       
   198 
       
   199 #endif
       
   200 // SYMBIAN_SS_METACONNPROV_INTERNAL_H
       
   201