datacommsserver/esockserver/inc/ConnPref.h
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 2003-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  @publishedAll
       
    19  @released
       
    20 */
       
    21 
       
    22 #if !(defined __CONNPREF_H__)
       
    23 #define __CONNPREF_H__
       
    24 
       
    25 #define TCommSnapPref TConnSnapPref
       
    26 #include <e32std.h>
       
    27 #include <comms-infras/metadata.h>
       
    28 #include <comms-infras/metacontainer.h>
       
    29 
       
    30 using namespace Meta;
       
    31 
       
    32 /**
       
    33 @publishedAll
       
    34 @released since v7.0s
       
    35 */
       
    36 const TUint KMaxConnPrefSize = 0x40;
       
    37 
       
    38 /**
       
    39 @internalTechnology
       
    40 */
       
    41 struct SConnPref
       
    42 	{
       
    43 	TInt16 iExtensionId; //< Extension ID
       
    44 	TInt16 iSpare;
       
    45 	};
       
    46 
       
    47 class TConnPref : public TBuf8<KMaxConnPrefSize>
       
    48 /**
       
    49 Overrides the connection preferences.
       
    50 @publishedAll
       
    51 @released since v7.0s
       
    52 */
       
    53 	{
       
    54 public:
       
    55 	enum
       
    56 		{
       
    57 		EConnPrefUnknown = 0x00,     //< Unknown Connection preference
       
    58 		EConnPrefCommDb = 0x01,      //< CommDb Connection preference
       
    59 		EConnPrefCommDbMulti = 0x02, //< CommDbMulti Connection preferenc
       
    60 		EConnPrefSnap = 0x03,
       
    61 		EConnPrefIdList = 0x04,
       
    62 		EConnPrefSip = 0x05,         //< Sip Connection preference
       
    63 		EConnPrefProviderInfo = 0x06,
       
    64 		EConnPrefEComList = 0x07
       
    65 		};
       
    66 
       
    67 	IMPORT_C TConnPref();
       
    68 	IMPORT_C TConnPref(TInt aExtensionId);
       
    69 
       
    70 	IMPORT_C TInt ExtensionId() const;
       
    71 	IMPORT_C TInt GetUserLen();
       
    72 
       
    73 protected:
       
    74 	IMPORT_C void SetExtensionId(TInt aExtensionId);
       
    75 	IMPORT_C void SetUserLen(TInt aLen);
       
    76 	inline TUint8* UserPtr() const;
       
    77 
       
    78 private:
       
    79 	inline SConnPref* BasePtr() const;
       
    80 	};
       
    81 
       
    82 inline SConnPref* TConnPref::BasePtr() const
       
    83 	{
       
    84 	return (SConnPref*)iBuf;
       
    85 	}
       
    86 
       
    87 inline TUint8* TConnPref::UserPtr() const
       
    88 	{
       
    89 	return (TUint8*)(BasePtr()+1);
       
    90 	}
       
    91 
       
    92 class TConnSnapPref : public TConnPref
       
    93 /**
       
    94 An instance of the class is passed to RConnection::Start when user wants to start connection using
       
    95 a Service Network Access Point. A Service Network Access Point is an access point in the KAfInet
       
    96 tier.
       
    97 
       
    98 A list of available access points can be retrieved from CommsDat using CCDAccessPointRecord. It is
       
    99 recommended that users only attempt to start access points whose tier is KAfInet. Access points in
       
   100 the KAfInet can use multiple access points on lower tiers to access the internet.
       
   101 
       
   102 @code
       
   103 RConnection conn;
       
   104 User::LeaveIfError(conn.Open(sockSvr));
       
   105 CleanupClosePushL(conn);
       
   106 
       
   107 TCommSnapPref pref(52);
       
   108 
       
   109 TInt error = conn.Start(pref);
       
   110 @endcode
       
   111 
       
   112 @see CommsDat::CCDAccessPointRecord
       
   113 @see RConnection::Start
       
   114 @see TConnAPPref
       
   115 
       
   116 @publishedAll
       
   117 @released since v9.1
       
   118 */
       
   119 	{
       
   120 public:
       
   121 	IMPORT_C TConnSnapPref();
       
   122 	IMPORT_C TConnSnapPref(TUint32 aSnap);
       
   123 
       
   124 	IMPORT_C void SetSnap(TUint32 aSnap);
       
   125 	IMPORT_C TUint32 Snap() const;
       
   126 	};
       
   127 
       
   128 class TConnPrefList : public TConnPref
       
   129 /**
       
   130 This class is used to send a collection of connection preferences expressed
       
   131 as SMetaData objects between RConnection and Comms server which uses them to
       
   132 construct it stack.
       
   133 
       
   134 Each tier will look up the preferences it understands, act of them, consume them
       
   135 if applicable (see individual preferences) and pass the rest down to the next
       
   136 tier.
       
   137 
       
   138 @code
       
   139 RConnection conn;
       
   140 User::LeaveIfError(conn.Open(sockSvr));
       
   141 CleanupClosePushL(conn);
       
   142 
       
   143 TConnPrefList* prefs = TConnPrefList::NewL();
       
   144 CleanupStack::PushL(prefs);
       
   145 TConnAPPref* APPref = TConnAPPref::NewL(aPara->iAp);
       
   146 CleanupStack::PushL(APPref);
       
   147 prefs->AppendL(APPref);
       
   148 
       
   149 error = conn.Start(pref);
       
   150 @endcode
       
   151 
       
   152 @see TConnAPPref
       
   153 @see TConnAutoStartPref
       
   154 @see TConnSnapPref
       
   155 @see RConnection::Start
       
   156 
       
   157 @publishedAll
       
   158 @released
       
   159 */
       
   160 	{
       
   161 public:
       
   162 	IMPORT_C static TConnPrefList* NewL();
       
   163 	IMPORT_C static TConnPrefList* LoadL(TDesC8& aDes);
       
   164 
       
   165 	IMPORT_C TConnPrefList();
       
   166 	IMPORT_C ~TConnPrefList();
       
   167 
       
   168 	IMPORT_C TInt Length();
       
   169 	IMPORT_C TInt Load(TDesC8& aDes);
       
   170 	IMPORT_C TInt Store(TDes8& aDes);
       
   171 
       
   172 	IMPORT_C void AppendL(SMetaDataECom* aFamily);
       
   173 	IMPORT_C SMetaData* operator[](TInt aIndex);
       
   174 	IMPORT_C void Remove(TInt aIndex);
       
   175 
       
   176 	IMPORT_C TInt Count();
       
   177 
       
   178 private:
       
   179 	Meta::RMetaDataEComContainer iPrefs;
       
   180 	};
       
   181 
       
   182 #endif // __CONNPREF_H__
       
   183