|
1 /* |
|
2 * Copyright (c) 2009-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: SIP handler for VoIP XML processor |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef VOIPXMLSIPHANDLER_H |
|
20 #define VOIPXMLSIPHANDLER_H |
|
21 |
|
22 #include <sipprofileregistryobserver.h> |
|
23 #include <sipprofiletypeinfo.h> |
|
24 |
|
25 class CSIPManagedProfile; |
|
26 class CSIPManagedProfileRegistry; |
|
27 class CSIPProfile; |
|
28 class TSIPProfileTypeInfo; |
|
29 |
|
30 /** |
|
31 * VoipXmlSipHandler |
|
32 * SIP handler class. |
|
33 * |
|
34 * @lib voipxmlprocessor.lib |
|
35 * @since S60 v5.0 |
|
36 */ |
|
37 class CVoipXmlSipHandler : public CBase, |
|
38 public MSIPProfileRegistryObserver |
|
39 { |
|
40 #ifdef _DEBUG |
|
41 friend class UT_CVoipXmlSipHandler; |
|
42 friend class UT_CVoipXmlParser; |
|
43 friend class UT_CVoipXmlParamHandler; |
|
44 #endif |
|
45 |
|
46 public: |
|
47 enum TTransportType |
|
48 { |
|
49 EAutomatic = 0, |
|
50 EUdp, |
|
51 ETcp, |
|
52 ETls |
|
53 }; |
|
54 public: |
|
55 |
|
56 static CVoipXmlSipHandler* NewL(); |
|
57 ~CVoipXmlSipHandler(); |
|
58 |
|
59 public: |
|
60 |
|
61 /** |
|
62 * Sets SIP setting. |
|
63 * |
|
64 * @since S60 v5.0 |
|
65 * @param aType Type of setting (SIP 'core', proxy or registrar) |
|
66 * @param aParam Parameter to be set. |
|
67 * @param aValue Value of the setting. |
|
68 */ |
|
69 void SetSetting( TInt aType, TInt aParam, const TDesC8& aValue ); |
|
70 |
|
71 /** |
|
72 * Stores settings to SIP managed profile registry. |
|
73 * |
|
74 * @since S60 v5.0 |
|
75 * @return KErrNone if successful, |
|
76 * KErrNotSupported if no settings to be stored, |
|
77 * KErrCompletion if settings could not be stored. |
|
78 */ |
|
79 TInt StoreSettings(); |
|
80 |
|
81 /** |
|
82 * Returns the profile ID. |
|
83 * |
|
84 * @since S60 v5.0 |
|
85 * @return SIP profile ID. |
|
86 */ |
|
87 TUint32 SettingsId(); |
|
88 |
|
89 /** |
|
90 * Gives linkage information. |
|
91 * |
|
92 * @since S60 v5.0 |
|
93 * @param aType Type of settings. |
|
94 * @param aSettingsId Settings ID. |
|
95 */ |
|
96 void LinkSettings( TInt aType, TUint32 aSettingsId ); |
|
97 |
|
98 /** |
|
99 * Finalizes settings, i.e. sets Destination ID to SIP profile. |
|
100 * |
|
101 * @since S60 v5.0 |
|
102 * @return KErrNone if successful, |
|
103 * KErrCompletion if settings could not be finalized. |
|
104 */ |
|
105 TInt FinalizeSettings(); |
|
106 |
|
107 protected: |
|
108 |
|
109 // from base class MSIPProfileRegistryObserver |
|
110 |
|
111 /** |
|
112 * From MSIPProfileRegistryObserver |
|
113 * SIP profile information event. |
|
114 * |
|
115 * @since S60 v5.0 |
|
116 * @param aSIPProfileId SIP profile ID. |
|
117 * @param aEvent Type of SIP event |
|
118 */ |
|
119 void ProfileRegistryEventOccurred( TUint32 /*aSIPProfileId*/, |
|
120 TEvent /*aEvent*/ ); |
|
121 |
|
122 /** |
|
123 * From MSIPProfileRegistryObserver |
|
124 * An asynchronous error has occurred related to SIP profile. |
|
125 * |
|
126 * @since S60 v5.0 |
|
127 * @param aSIPProfileId SIP profile ID. |
|
128 * @param aError Error code. |
|
129 */ |
|
130 void ProfileRegistryErrorOccurred( TUint32 /*aSIPProfileId*/, |
|
131 TInt /*aError*/ ); |
|
132 |
|
133 private: |
|
134 |
|
135 /** |
|
136 * Creates a provider name for SIP profile. aName is used |
|
137 * and replaced with a parenthised ordered number if the name is |
|
138 * already found in SIP stack. |
|
139 * |
|
140 * @since S60 v5.0 |
|
141 * @param aName Provider name to be set. |
|
142 */ |
|
143 void CreateProviderNameL( const TDesC8& aName ); |
|
144 |
|
145 /** |
|
146 * Handles public User ID modification if needed. |
|
147 * Possible modifications are escaping and adding sip: prefix. |
|
148 * |
|
149 * @since S60 v5.0 |
|
150 * @param aValue Value to be checked and modified if needed. |
|
151 */ |
|
152 void ModifyPuidL( TDes8& aValue ); |
|
153 |
|
154 /** |
|
155 * Validates transport type. |
|
156 * |
|
157 * @since S60 v5.0 |
|
158 * @param aValue Value to be validated. |
|
159 * @return Validated transport type. |
|
160 */ |
|
161 TTransportType ValidateTransport( const TDesC8& aValue ); |
|
162 |
|
163 private: |
|
164 |
|
165 CVoipXmlSipHandler(); |
|
166 void ConstructL(); |
|
167 |
|
168 private: |
|
169 |
|
170 /** |
|
171 * SIP profile object. |
|
172 * Own. |
|
173 */ |
|
174 CSIPManagedProfile* iProfile; |
|
175 |
|
176 /** |
|
177 * SIP managed profile registry object. |
|
178 * Own. |
|
179 */ |
|
180 CSIPManagedProfileRegistry* iRegistry; |
|
181 |
|
182 /** |
|
183 * Profile type. |
|
184 */ |
|
185 TSIPProfileTypeInfo iProfileType; |
|
186 |
|
187 /** |
|
188 * Proxy URI. |
|
189 * Own. |
|
190 */ |
|
191 HBufC8* iProxyUri; |
|
192 |
|
193 /** |
|
194 * Proxy transport type. |
|
195 */ |
|
196 TTransportType iProxyTransport; |
|
197 |
|
198 /** |
|
199 * Proxy port number. |
|
200 */ |
|
201 TInt iProxyPort; |
|
202 |
|
203 /** |
|
204 * Loose routing. |
|
205 */ |
|
206 TBool iLr; |
|
207 |
|
208 /** |
|
209 * Registrar URI. |
|
210 * Own. |
|
211 */ |
|
212 HBufC8* iRegistrarUri; |
|
213 |
|
214 /** |
|
215 * Registrar transport type. |
|
216 */ |
|
217 TTransportType iRegistrarTransport; |
|
218 |
|
219 /** |
|
220 * Registrar server port number. |
|
221 */ |
|
222 TInt iRegistrarPort; |
|
223 |
|
224 /** |
|
225 * Tells if any settings have been set to temporary profile. |
|
226 */ |
|
227 TBool iSettingsSet; |
|
228 |
|
229 /** |
|
230 * SIP profile ID. |
|
231 */ |
|
232 TUint32 iProfileId; |
|
233 }; |
|
234 |
|
235 #endif // VOIPXMLSIPHANDLER_H |
|
236 |
|
237 // End of file. |