|
1 /* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: TUN Driver plugin IF implementation class. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef TUNDRIVER_PLUGIN_INCLUDED |
|
19 #define TUNDRIVER_PLUGIN_INCLUDED |
|
20 |
|
21 #include <cmplugintundriverdef.h> |
|
22 #include <cmpluginlanbase.h> |
|
23 |
|
24 class CCDVirtualIAPNextLayerRecord; |
|
25 |
|
26 /** |
|
27 * TUN Driver Plugin IF implementation class |
|
28 * This class will be instantiated when the connection is created using the PluginBearer Id KPluginTUNDriverBearerTypeUid |
|
29 * @since S^3 |
|
30 */ |
|
31 NONSHARABLE_CLASS(CCmPluginTUNDriver) : public CCmPluginLanBase |
|
32 { |
|
33 |
|
34 public: |
|
35 |
|
36 /** |
|
37 * This function is invoked by the cmmanager plugin framework to load TUNDriver plugin. |
|
38 * This plugin will be identified based on the plugin UID from cmpluginproxy.cpp |
|
39 * @param aInitParam Initialization parameters. |
|
40 * @return CCmPluginTUNDriver. |
|
41 */ |
|
42 static CCmPluginTUNDriver* NewL( TCmPluginInitParam* aInitParam ); |
|
43 |
|
44 /** |
|
45 * Destructor. |
|
46 */ |
|
47 virtual ~CCmPluginTUNDriver(); |
|
48 |
|
49 /** |
|
50 * This function is invoked by the cmmanager plugin framework while loading the plugin. |
|
51 * CreateInstance of the plugin will invoke each time plugin type needs to instantiated |
|
52 * @param aInitParam Initialization parameters. |
|
53 * @return CCmPluginBaseEng. |
|
54 */ |
|
55 virtual CCmPluginBaseEng* CreateInstanceL( TCmPluginInitParam& aInitParam ) const; |
|
56 |
|
57 /** |
|
58 * This is function is invoked by cmmanager framework. |
|
59 * Once the plugin type is identified, identifies the right ServiceRecord and loads. |
|
60 */ |
|
61 void LoadServiceSettingL(); |
|
62 |
|
63 public: |
|
64 |
|
65 /** |
|
66 * This is function is invoked by cmmanager framework. |
|
67 * Check here if every data of the connection method is valid |
|
68 * before records were saved to CommsDat. |
|
69 * Set incorrect attribute id in iInvalidAttribute and leave |
|
70 * with KErrArgument. |
|
71 */ |
|
72 void PrepareToUpdateRecordsL(); |
|
73 |
|
74 /** |
|
75 * This is function is invoked by cmmanager framework. If Settings are enabled. |
|
76 * Currently Settings for TUNDriver is not supported. |
|
77 * @return KErrNotSupported. |
|
78 */ |
|
79 virtual TInt RunSettingsL(); |
|
80 |
|
81 /** |
|
82 * This is function is invoked by cmmanager framework. |
|
83 * Once the plugin type is identified, type of bearer and other attributes types are obtained. |
|
84 * @param aAttribute Attribute type. |
|
85 * @return Integer attribute's value. |
|
86 */ |
|
87 virtual TUint32 GetIntAttributeL( const TUint32 aAttribute ) const; |
|
88 |
|
89 /** |
|
90 * This is function is invoked by cmmanager framework. |
|
91 * Once the plugin type is identified, finds wether the IAP selected belongs to TUNDriver. |
|
92 * @param aIapId IapId for the selected accesspoint |
|
93 * @return ETrue if IAP can be handled else EFalse. |
|
94 */ |
|
95 virtual TBool CanHandleIapIdL( TUint32 aIapId ) const; |
|
96 |
|
97 /** |
|
98 * This is function is invoked by cmmanager framework. |
|
99 * Once the plugin type is identified, finds wether the IAP selected belongs to TUNDriver. |
|
100 * This is identified if service type is LANService and Bearer is VirtualBearer and |
|
101 * IfName is TunDriverIf and agent is TunDriverAgent. |
|
102 * @param aIapRecord - iaprecord of type CCDIAPRecord from commsdatabase |
|
103 * @return ETrue if IAP can be handled else EFalse. |
|
104 */ |
|
105 virtual TBool CanHandleIapIdL( CommsDat::CCDIAPRecord* aIapRecord ) const; |
|
106 |
|
107 /** |
|
108 * This is function is invoked by cmmanager framework when needs to initialzed with UI. |
|
109 * This feature is currently not supported by the plugin. |
|
110 * @param aManuallyConfigure Manual configuration on or off. |
|
111 * @return KErrNotSupported |
|
112 */ |
|
113 TBool InitializeWithUiL( TBool aManuallyConfigure ); |
|
114 |
|
115 /** |
|
116 * This is function is invoked by plugin destructor. |
|
117 * If the function is not defined then compiler will throw error for TUNDriver plugin construction. |
|
118 */ |
|
119 virtual void AdditionalReset(); |
|
120 |
|
121 protected: |
|
122 |
|
123 /** |
|
124 * This is function is invoked by cmmanager framework. |
|
125 * @return aName is LanService name and aRecordId the service record Id. |
|
126 */ |
|
127 virtual void ServiceRecordIdLC( HBufC* &aServiceName, TUint32& aRecordId ); |
|
128 |
|
129 /** |
|
130 * This is function is invoked by cmmanager framework. |
|
131 * @param aBearerName Output parameter for bearer name. |
|
132 * @param aRecordId Output parameter for Bearer record Id. |
|
133 */ |
|
134 virtual void BearerRecordIdLC( HBufC* &aBearerName, TUint32& aRecordId ); |
|
135 |
|
136 /** |
|
137 * This is function is invoked by cmmanager framework. |
|
138 * Once the plugin type is identified, this invoked for the first time when plgun is loaded |
|
139 * while creating connection for TUNDriver plugin. |
|
140 */ |
|
141 virtual void CreateNewServiceRecordL(); |
|
142 |
|
143 private: |
|
144 |
|
145 /** |
|
146 * This is default constructor of the plugin. |
|
147 * @param aInitParam Initialization parameters. |
|
148 */ |
|
149 CCmPluginTUNDriver( TCmPluginInitParam* aInitParam ); |
|
150 |
|
151 /** |
|
152 * This is second phase constructor of the plugin. |
|
153 * Builds the commsdatabase with the Tables required for TUNDriver plugin. |
|
154 */ |
|
155 void ConstructL(); |
|
156 |
|
157 /** |
|
158 * This is function is invoked by cmmanager framework. |
|
159 * Returns the service record of the TUN driver plugin. |
|
160 * @return service record. |
|
161 */ |
|
162 CommsDat::CCDLANServiceRecord& ServiceRecord()const; |
|
163 }; |
|
164 |
|
165 #endif // TUNDRIVER_PLUGIN_INCLUDED |