|
1 /* |
|
2 * Copyright (c) 2003 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: The class for using SIP profiles |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CSIPPROFILEREGISTRY_H |
|
20 #define CSIPPROFILEREGISTRY_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <e32std.h> |
|
25 #include <badesca.h> |
|
26 #include <sipprofileregistryobserver.h> |
|
27 #include "sipprofileregistrybase.h" |
|
28 |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 class CSIP; |
|
32 class CSIPConnection; |
|
33 class CSIPProfile; |
|
34 class MSIPProfileRegistryObserver; |
|
35 class MSIPConnectionObserver; |
|
36 |
|
37 // STUB stuff |
|
38 |
|
39 typedef TInt TSIPProfileBehavior; |
|
40 const TSIPProfileBehavior KRegistryLeaveAtConstruct = 1; |
|
41 const TSIPProfileBehavior KSIPProfileIdFetchFails = 2; |
|
42 const TSIPProfileBehavior KSIPIapIdFetchFails = 3; |
|
43 const TSIPProfileBehavior KSIPConnectionLeaveAtConstruct = 4; |
|
44 |
|
45 class CSIPProfileBehaviorTls : public CBase |
|
46 { |
|
47 public: |
|
48 static void OpenL(); |
|
49 static void Close(); |
|
50 |
|
51 static CSIPProfileBehaviorTls* Storage(); |
|
52 |
|
53 void Reset(); |
|
54 |
|
55 private: |
|
56 |
|
57 CSIPProfileBehaviorTls(); |
|
58 ~CSIPProfileBehaviorTls(); |
|
59 |
|
60 public: |
|
61 |
|
62 TSIPProfileBehavior iRegistryBehavior; |
|
63 TSIPProfileBehavior iProfileBehavior; |
|
64 TSIPProfileBehavior iConnectionBehavior; |
|
65 }; |
|
66 |
|
67 |
|
68 |
|
69 // CLASS DECLARATION |
|
70 /** |
|
71 * @publishedAll |
|
72 * @released |
|
73 * |
|
74 * The class for retrieving SIP profiles from permanent storage. |
|
75 * This class provides services for retreiving SIP profiles |
|
76 * and enabling/disabling them for the usage. |
|
77 * |
|
78 * The user can create only one instance of this class (a singleton class). |
|
79 * |
|
80 * @lib sipprofilecli.lib |
|
81 */ |
|
82 class CSIPProfileRegistry: public CSIPProfileRegistryBase |
|
83 { |
|
84 public: // Constructors and destructor |
|
85 /** |
|
86 * Two-phased constructor. |
|
87 * This constructor should be used if the client intends |
|
88 * to use SIP services with profiles. |
|
89 * @param aSip a SIP client providing connection to SIP stack. |
|
90 * @param aObserver a observer for SIP profile change events. |
|
91 */ |
|
92 IMPORT_C static CSIPProfileRegistry* NewL( |
|
93 CSIP& aSip, |
|
94 MSIPProfileRegistryObserver& aObserver); |
|
95 |
|
96 /** |
|
97 * Two-phased constructor. |
|
98 * This constructor should be used if the client intends |
|
99 * to use SIP services with profiles. |
|
100 * Constructs an object and adds the pointer to the cleanup stack; |
|
101 * @param aSip a SIP client providing connection to SIP stack. |
|
102 * @param aObserver a observer for SIP profile change events. |
|
103 */ |
|
104 IMPORT_C static CSIPProfileRegistry* NewLC( |
|
105 CSIP& aSip, |
|
106 MSIPProfileRegistryObserver& aObserver); |
|
107 |
|
108 /** |
|
109 * Destructor |
|
110 */ |
|
111 IMPORT_C ~CSIPProfileRegistry(); |
|
112 |
|
113 public: // New functions |
|
114 /** |
|
115 * Gets handle to the SIP server |
|
116 * @return handle to the SIP server |
|
117 */ |
|
118 IMPORT_C CSIP& SIP() const; |
|
119 |
|
120 /** |
|
121 * Gets the SIP connection to be used with this SIP profile. |
|
122 * @pre IsEnabled() == ETrue |
|
123 * @param aProfile a sip profile |
|
124 * @return a SIP connection to be used; the owneship is transfered |
|
125 * @leave KErrNoMemory if out of memory |
|
126 * @capability NetworkServices |
|
127 */ |
|
128 IMPORT_C CSIPConnection* ConnectionL( |
|
129 CSIPProfile& aProfile); |
|
130 |
|
131 /** |
|
132 * Enables the SIP profile for use. |
|
133 * Enabling the SIP profile will cause the SIP profile to |
|
134 * be registered if its status was unregistered. |
|
135 * The user must check the profile status after calling this |
|
136 * function. In case the profile is not registered the user must |
|
137 * wait until the it is notified about profile registration |
|
138 * on MSIPProfileRegistryObserver-callback interface. |
|
139 * @param aProfile a sip profile to enable |
|
140 * @param aObserver a observer for SIP connection events |
|
141 * @leave KErrNotFound if non-existing profile is provided |
|
142 * @capability NetworkServices |
|
143 */ |
|
144 IMPORT_C void EnableL( |
|
145 CSIPProfile& aProfile, |
|
146 MSIPConnectionObserver &aObserver); |
|
147 |
|
148 /** |
|
149 * Disables the usage of SIP profile |
|
150 * @param aProfile a sip profile to disable |
|
151 * @return KErrNone if SIP profile was successfully disabled; |
|
152 * system wide error otherwise |
|
153 * @capability NetworkServices |
|
154 */ |
|
155 IMPORT_C TInt Disable(CSIPProfile& aProfile); |
|
156 |
|
157 /** |
|
158 * Tests is the SIP profile enabled for the use |
|
159 * @param aProfile a SIP profile to be checked |
|
160 * @return ETrue if SIP profile is enabled; EFalse otherwise |
|
161 */ |
|
162 IMPORT_C TBool IsEnabled(const CSIPProfile& aProfile) const; |
|
163 |
|
164 public: |
|
165 |
|
166 CSIPProfile* NewInstanceL(); |
|
167 |
|
168 private: |
|
169 |
|
170 CSIPProfileRegistry(); |
|
171 CSIPProfileRegistry(CSIP& aSip, MSIPProfileRegistryObserver& aObserver); |
|
172 |
|
173 void ConstructL(); |
|
174 |
|
175 public: |
|
176 |
|
177 TBool iProfileDisabled; |
|
178 mutable TBool iProfileEnabled; |
|
179 |
|
180 private: |
|
181 |
|
182 CSIP& iSip; |
|
183 MSIPConnectionObserver* iConnectionObserver; |
|
184 |
|
185 }; |
|
186 |
|
187 |
|
188 |
|
189 // Constants |
|
190 _LIT8 ( KProviderNameValue, "MyProvider"); |
|
191 _LIT8 ( KUserAorValue, "i@127.0.0.1" ); |
|
192 const TUint KSnapIdValue (10); |
|
193 const TUint KAccessPointIdValue (2); |
|
194 const TBool KSigCompValue (EFalse); |
|
195 const TBool KAutoRegistrationValue (ETrue); |
|
196 const TBool KAllowAutoRegistrationOnlyOnHomeNetworkValue (ETrue); |
|
197 const TBool KSecurityNegotiationValue (EFalse); |
|
198 |
|
199 |
|
200 class CSIPProfileRegistryObserver : public CBase, public MSIPProfileRegistryObserver |
|
201 { |
|
202 public: |
|
203 |
|
204 static CSIPProfileRegistryObserver* NewLC(); |
|
205 static CSIPProfileRegistryObserver* NewL(); |
|
206 virtual ~CSIPProfileRegistryObserver(); |
|
207 |
|
208 void ProfileRegistryEventOccurred (TUint32 aProfileId, TEvent aEvent); |
|
209 void ProfileRegistryErrorOccurred (TUint32 aProfileId, TInt aError); |
|
210 |
|
211 private: |
|
212 CSIPProfileRegistryObserver(); |
|
213 void ConstructL(); |
|
214 }; |
|
215 |
|
216 #endif // CSIPPROFILEREGISTRY_H |