|
1 /* |
|
2 * Copyright (c) 2009 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: |
|
15 * |
|
16 */ |
|
17 #include "sipprofile.h" |
|
18 //#include "teststubs.h" |
|
19 #include <sipprofileregistrybase.h> |
|
20 #include <sipprofileregistry.h> |
|
21 #include <sipmanagedprofile.h> |
|
22 #include <sipstrings.h> |
|
23 |
|
24 // ----------------------------------------------------------------------------- |
|
25 // CSIPProfile |
|
26 // ----------------------------------------------------------------------------- |
|
27 // |
|
28 CSIPProfile* CSIPProfile::NewL(CSIPProfileRegistry* aSIPRegistry) |
|
29 { |
|
30 CSIPProfile* self = CSIPProfile::NewLC (aSIPRegistry); |
|
31 CleanupStack::Pop(self); |
|
32 return self; |
|
33 } |
|
34 |
|
35 CSIPProfile* CSIPProfile::NewLC(CSIPProfileRegistry* aSIPRegistry) |
|
36 { |
|
37 CSIPProfile* self = new(ELeave)CSIPProfile(aSIPRegistry); |
|
38 CleanupStack::PushL (self); |
|
39 self->ConstructL (); |
|
40 return self; |
|
41 } |
|
42 |
|
43 CSIPProfile::CSIPProfile(CSIPProfileRegistryBase* /*aRegistry*/) |
|
44 : iEnabled(EFalse), |
|
45 iProviderNameValue(KProviderNameValue), |
|
46 iUserAorValue(KUserAorValue), |
|
47 iAccessPointIdValue(KAccessPointIdValue), |
|
48 iSnapIdValue(KSnapIdValue), |
|
49 iSigCompValue(KSigCompValue), |
|
50 iAutoRegistrationValue(KAutoRegistrationValue), |
|
51 iSecurityNegotiationValue(KSecurityNegotiationValue), |
|
52 iAllowAutoRegistrationOnlyOnHomeNetworkValue |
|
53 (KAllowAutoRegistrationOnlyOnHomeNetworkValue) |
|
54 |
|
55 { |
|
56 } |
|
57 |
|
58 void CSIPProfile::ConstructL() |
|
59 { |
|
60 TSIPProfileTypeInfo* typeInfo = new (ELeave)TSIPProfileTypeInfo; |
|
61 typeInfo->iSIPProfileName = KProviderNameValue; |
|
62 typeInfo->iSIPProfileClass = TSIPProfileTypeInfo::EInternet; |
|
63 |
|
64 iSIPProfile = reinterpret_cast<CSIPConcreteProfile*>(typeInfo); |
|
65 } |
|
66 |
|
67 |
|
68 CSIPProfile::~CSIPProfile() |
|
69 { |
|
70 TSIPProfileTypeInfo* typeInfo = |
|
71 reinterpret_cast<TSIPProfileTypeInfo*>(iSIPProfile); |
|
72 delete typeInfo; |
|
73 } |
|
74 |
|
75 const TSIPProfileTypeInfo& CSIPProfile::Type() const |
|
76 { |
|
77 return *reinterpret_cast<TSIPProfileTypeInfo*>(iSIPProfile); |
|
78 } |
|
79 |
|
80 TInt CSIPProfile::GetParameter(TUint32 aParam, TDesC8 const *& aVal) const |
|
81 { |
|
82 switch (aParam) |
|
83 { |
|
84 case KSIPProviderName: |
|
85 { |
|
86 aVal = &iProviderNameValue; |
|
87 break; |
|
88 } |
|
89 case KSIPUserAor: |
|
90 { |
|
91 aVal = &iUserAorValue; |
|
92 break; |
|
93 } |
|
94 default: |
|
95 { |
|
96 break; |
|
97 } |
|
98 } |
|
99 return KErrNone; |
|
100 } |
|
101 |
|
102 TInt CSIPProfile::GetParameter(TUint32 aParam, TUint32& aVal) const |
|
103 { |
|
104 switch (aParam) |
|
105 { |
|
106 case KSIPProfileId: |
|
107 aVal = iAccessPointIdValue; |
|
108 break; |
|
109 case KSIPSnapId: |
|
110 if ( !iEnabled ) // If SNAP is disabled, return Not Found |
|
111 { |
|
112 return KErrNotFound; |
|
113 } |
|
114 aVal = iSnapIdValue; |
|
115 break; |
|
116 case KSIPAccessPointId: |
|
117 aVal = iAccessPointIdValue; |
|
118 break; |
|
119 default: |
|
120 break; |
|
121 } |
|
122 return KErrNone; |
|
123 } |
|
124 |
|
125 TInt CSIPProfile::GetParameter(TUint32 aParam, TBool& aVal) const |
|
126 { |
|
127 switch (aParam) |
|
128 { |
|
129 case KSIPSigComp: |
|
130 aVal = iSigCompValue; |
|
131 break; |
|
132 case KSIPAutoRegistration: |
|
133 aVal = iAutoRegistrationValue; |
|
134 break; |
|
135 case KSIPSecurityNegotiation: |
|
136 aVal = iSecurityNegotiationValue; |
|
137 break; |
|
138 case KSIPProfileRegistered: |
|
139 aVal = iAutoRegistrationValue; |
|
140 break; |
|
141 case KSIPAllowAutoRegistrationOnlyOnHomeNetwork: |
|
142 aVal = iAllowAutoRegistrationOnlyOnHomeNetworkValue; |
|
143 break; |
|
144 default: |
|
145 break; |
|
146 } |
|
147 return KErrNone; |
|
148 |
|
149 } |
|
150 |
|
151 TInt CSIPProfile::GetParameter(TUint32 aServerType, TUint32 aParam, TDesC8 const *& aVal ) const |
|
152 { |
|
153 switch ( aParam ) |
|
154 { |
|
155 case KSIPDigestPassword: |
|
156 if (aServerType == KSIPOutboundProxy) |
|
157 { |
|
158 aVal = &iProxyPassword; |
|
159 } |
|
160 else // KSIPRegistrar |
|
161 { |
|
162 aVal = &iRegistrarPassword; |
|
163 } |
|
164 break; |
|
165 } |
|
166 return KErrNone; |
|
167 } |
|
168 |
|
169 TUint32 CSIPProfile::ContextId() const |
|
170 { |
|
171 return 32; |
|
172 } |
|
173 |
|
174 TBool CSIPProfile::IsContextActive() const |
|
175 { |
|
176 return EFalse; |
|
177 } |
|
178 |
|
179 void CSIPProfile::SetEnabled(TBool aEnabled) |
|
180 { |
|
181 iEnabled = aEnabled; |
|
182 } |
|
183 |
|
184 |
|
185 // ----------------------------------------------------------------------------- |
|
186 // CSIPStrings |
|
187 // ----------------------------------------------------------------------------- |
|
188 // |
|
189 |
|
190 void SIPStrings::OpenL() |
|
191 { |
|
192 |
|
193 } |
|
194 |
|
195 void SIPStrings::Close() |
|
196 { |
|
197 |
|
198 } |