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