|
1 /* |
|
2 * Copyright (c) 2003 - 2005 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: Utility class for manipulating profiles and their attributes |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef GS_SIP_PPROFILE_UTIL_H |
|
21 #define GS_SIP_PPROFILE_UTIL_H |
|
22 |
|
23 // INCLUDES |
|
24 |
|
25 #include <sipprofile.h> |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 |
|
29 class TSIPSettingsData; |
|
30 class TGSSIPServerData; |
|
31 class CSIPManagedProfile; |
|
32 class UT_GSSIPProfileUtil; |
|
33 |
|
34 // CLASS DECLARATION |
|
35 |
|
36 /** |
|
37 * GSSIPProfileUtil utility class |
|
38 * @since 3.0 |
|
39 * Utility class for manipulating profiles and their attributes. |
|
40 */ |
|
41 class GSSIPProfileUtil |
|
42 { |
|
43 public: // New functions |
|
44 |
|
45 /** |
|
46 * Copies profile parameters from temporary data structure |
|
47 * to profile |
|
48 * @param aProfile Profile where the attributes are copied to |
|
49 * @param aProfileData Temporary data structure |
|
50 */ |
|
51 static void CopyProfileAttributesL( |
|
52 CSIPManagedProfile* aProfile, |
|
53 const TSIPSettingsData& aProfileData ); |
|
54 |
|
55 /** |
|
56 * Copies proxy server parameters from temporary data structure |
|
57 * to profile |
|
58 * @param aProfile Profile where the attributes are copied to |
|
59 * @param aServer Proxy server/registrar server |
|
60 * @param aProfileData Temporary data structure |
|
61 */ |
|
62 static void CopyServerAttributesL( |
|
63 CSIPManagedProfile* aProfile, |
|
64 TUint32 aServer, |
|
65 const TGSSIPServerData& aProfileData ); |
|
66 |
|
67 /** |
|
68 * Copies profiles attributes to temporary data structure |
|
69 * @param aProfile Profile where the attributes are copied from |
|
70 * @param aProfileData Temporary data structure where attribs |
|
71 * are copied to |
|
72 */ |
|
73 static void CopyToTempStructL( |
|
74 CSIPManagedProfile* aProfile, |
|
75 TSIPSettingsData& aProfileData ); |
|
76 |
|
77 /** |
|
78 * Copies server attributes to temporary data structure |
|
79 * @param aProfile Profile where the attributes are copied from |
|
80 * @param aServer Proxy server/registrar server |
|
81 * @param aProfileData Temporary data structure where attribs |
|
82 * are copied to |
|
83 */ |
|
84 static void CopyServerSettingsToTempStructL( |
|
85 CSIPManagedProfile* aProfile, |
|
86 TUint32 aServer, |
|
87 TGSSIPServerData& aProfileData ); |
|
88 |
|
89 /** |
|
90 * Compares the temporary data structure with given profile |
|
91 * @param aProfile Profile |
|
92 * @param aProfileData Temporary data structure |
|
93 * @return ETrue if the profiles differ |
|
94 */ |
|
95 static TBool ProfileModificationsL( |
|
96 CSIPManagedProfile* aProfile, |
|
97 const TSIPSettingsData& aProfileData ); |
|
98 |
|
99 /** |
|
100 * Compares the temporary data structure with given profile |
|
101 * @param aProfile Profile |
|
102 * @param aServer Proxy server/registrar server |
|
103 * @param aData Temporary data structure |
|
104 * @return ETrue if the attributes differ |
|
105 */ |
|
106 static TBool ServerModificationsL( |
|
107 CSIPManagedProfile* aProfile, |
|
108 TUint32 aServer, |
|
109 const TGSSIPServerData& aData ); |
|
110 |
|
111 /** |
|
112 * Copies profile information from one profile to another |
|
113 * @param aOrigProfile Attributes from here |
|
114 * @param aCopiedProfile Attributes stored here |
|
115 */ |
|
116 static void CopyProfileL( |
|
117 CSIPManagedProfile* aOrigProfile, |
|
118 CSIPManagedProfile* aCopiedProfile ); |
|
119 |
|
120 /** |
|
121 * Copies and sets server URI from given parameters |
|
122 * Used by CopyServerAttributesL() |
|
123 */ |
|
124 static void CopyServerURIL( |
|
125 CSIPManagedProfile* aProfile, |
|
126 TUint32 aServer, |
|
127 const TGSSIPServerData& aProfileData ); |
|
128 |
|
129 /** |
|
130 * Parses uri path. |
|
131 * Used by CopyServerURIL() |
|
132 */ |
|
133 static void ParseUriPathL( |
|
134 CSIPManagedProfile* aProfile, |
|
135 TUint32 aServer, |
|
136 const TGSSIPServerData& aProfileData, |
|
137 HBufC8* aFinalPath ); |
|
138 |
|
139 /** |
|
140 * Checks if sip or sips scheme included. |
|
141 * @param aAddr address to be checked |
|
142 * @param aHostBrackets when ETrue, host brackets are checked |
|
143 */ |
|
144 static TBool SchemeIncluded( const TDesC8& aAddr, |
|
145 TBool aHostBrackets=EFalse ); |
|
146 |
|
147 /** |
|
148 * GSSIPProfileUtil::BracketsIncluded |
|
149 * Check if brackets included correctly in IPv6 reference. |
|
150 * @return ETrue if brackets included, |
|
151 * EFalse if brackets not included |
|
152 * -1 if brackets included incorrectly |
|
153 */ |
|
154 static TInt BracketsIncluded( TPtrC8 aHost ); |
|
155 |
|
156 /** |
|
157 * Adds brackets into IPv6 address, if needed |
|
158 * @param aHost address to be checked |
|
159 */ |
|
160 static void AddBrackets( TPtr8 aHost ); |
|
161 |
|
162 /** |
|
163 * Removes brackets from IPv6 address, if needed |
|
164 * @param aHost address to be checked |
|
165 */ |
|
166 static void RemoveBrackets( TPtr8 aHost ); |
|
167 |
|
168 /** |
|
169 * Check if reference is valid URI |
|
170 * @param aValue reference to a value checked if valid URI |
|
171 */ |
|
172 static TInt URIValid( const TDesC8& aValue ); |
|
173 |
|
174 /** |
|
175 * Replace %20 to ' ' |
|
176 * @param aValue reference to token |
|
177 */ |
|
178 static void ReplaceEscapedSpace( HBufC8* aValue ); |
|
179 private: |
|
180 |
|
181 /** |
|
182 * C++ default constructor. |
|
183 * This class can never be instantiated and thus |
|
184 * the constructor is declared as private. |
|
185 */ |
|
186 GSSIPProfileUtil(); |
|
187 |
|
188 /** |
|
189 * For testing purposes |
|
190 */ |
|
191 friend class UT_GSSIPProfileUtil; |
|
192 }; |
|
193 |
|
194 #endif // GS_SIP_PPROFILE_UTIL_H |
|
195 |
|
196 // End of File |