|
1 /* |
|
2 * Copyright (c) 2007-2007 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 |
|
18 |
|
19 #include <e32debug.h> |
|
20 #include <centralrepository.h> |
|
21 #include <unsafprotocolsinternalcrkeys.h> |
|
22 |
|
23 #include "cscsvcpluginlogger.h" |
|
24 #include "cscsvcplugincenrephandler.h" |
|
25 |
|
26 |
|
27 // ======== MEMBER FUNCTIONS ======== |
|
28 |
|
29 |
|
30 // --------------------------------------------------------------------------- |
|
31 // --------------------------------------------------------------------------- |
|
32 // |
|
33 CCSCSvcPluginCenrepHandler::CCSCSvcPluginCenrepHandler() |
|
34 { |
|
35 } |
|
36 |
|
37 |
|
38 // --------------------------------------------------------------------------- |
|
39 // --------------------------------------------------------------------------- |
|
40 // |
|
41 void CCSCSvcPluginCenrepHandler::ConstructL() |
|
42 { |
|
43 CSCSVCPLUGINDEBUG("CCSCSvcPluginCenrepHandler::ConstructL - begin"); |
|
44 |
|
45 iNatfwRepository = CRepository::NewL( KCRUidUNSAFProtocols ); |
|
46 |
|
47 CSCSVCPLUGINDEBUG("CCSCSvcPluginCenrepHandler::ConstructL - end"); |
|
48 } |
|
49 |
|
50 |
|
51 // --------------------------------------------------------------------------- |
|
52 // --------------------------------------------------------------------------- |
|
53 // |
|
54 CCSCSvcPluginCenrepHandler* CCSCSvcPluginCenrepHandler::NewL() |
|
55 { |
|
56 CCSCSvcPluginCenrepHandler* self = |
|
57 new ( ELeave ) CCSCSvcPluginCenrepHandler(); |
|
58 CleanupStack::PushL( self ); |
|
59 self->ConstructL(); |
|
60 CleanupStack::Pop( self ); |
|
61 return self; |
|
62 } |
|
63 |
|
64 |
|
65 // --------------------------------------------------------------------------- |
|
66 // --------------------------------------------------------------------------- |
|
67 // |
|
68 CCSCSvcPluginCenrepHandler::~CCSCSvcPluginCenrepHandler() |
|
69 { |
|
70 CSCSVCPLUGINDEBUG( |
|
71 "CCSCSvcPluginCenrepHandler::~CCSCSvcPluginCenrepHandler - begin"); |
|
72 |
|
73 delete iNatfwRepository; |
|
74 |
|
75 CSCSVCPLUGINDEBUG( |
|
76 "CCSCSvcPluginCenrepHandler::~CCSCSvcPluginCenrepHandler - end"); |
|
77 } |
|
78 |
|
79 |
|
80 // --------------------------------------------------------------------------- |
|
81 // Destroys IAP spesific NAT/FW settings based on IAP id. |
|
82 // --------------------------------------------------------------------------- |
|
83 // |
|
84 void CCSCSvcPluginCenrepHandler::RemoveIapSpecificNatfwSettingsL( |
|
85 TInt aIapId ) |
|
86 { |
|
87 CSCSVCPLUGINDEBUG( |
|
88 "CCSCSvcPluginCenrepHandler::RemoveIapSpecificNatfwSettingsL - begin"); |
|
89 |
|
90 // Get IAP specific keys from Central Repository. |
|
91 RArray<TUint32> keys; |
|
92 CleanupClosePushL( keys ); |
|
93 User::LeaveIfError( |
|
94 iNatfwRepository->FindEqL( |
|
95 KUNSAFProtocolsIAPIdMask, |
|
96 KUNSAFProtocolsFieldTypeMask, |
|
97 aIapId, |
|
98 keys ) ); |
|
99 |
|
100 for ( TInt i( 0 ) ; i < keys.Count() ; i++ ) |
|
101 { |
|
102 TUint32 errorKey( 0 ); |
|
103 iNatfwRepository->Delete( keys[ i ], KUNSAFProtocolsIAPIdMask, errorKey ); |
|
104 } |
|
105 |
|
106 CleanupStack::PopAndDestroy( &keys ); |
|
107 |
|
108 CSCSVCPLUGINDEBUG( |
|
109 "CCSCSvcPluginCenrepHandler::RemoveIapSpecificNatfwSettingsL - end"); |
|
110 } |
|
111 |
|
112 |
|
113 // --------------------------------------------------------------------------- |
|
114 // Destroys Domain spesific NAT/FW settings based on domain name. |
|
115 // --------------------------------------------------------------------------- |
|
116 // |
|
117 void CCSCSvcPluginCenrepHandler::RemoveDomainSpecificNatfwSettingsL( |
|
118 const TDesC8& aDomainName ) |
|
119 { |
|
120 CSCSVCPLUGINDEBUG( |
|
121 "CCSCSvcPluginCenrepHandler::RemoveDomainSpecificNatfwSettingsL - begin"); |
|
122 |
|
123 // Get domain specific keys from Central Repository. |
|
124 RArray<TUint32> keys; |
|
125 CleanupClosePushL( keys ); |
|
126 User::LeaveIfError( |
|
127 iNatfwRepository->FindEqL( |
|
128 KUNSAFProtocolsDomainMask, |
|
129 KUNSAFProtocolsFieldTypeMask, |
|
130 aDomainName, |
|
131 keys ) ); |
|
132 |
|
133 for ( TInt i( 0 ) ; i < keys.Count() ; i++ ) |
|
134 { |
|
135 TUint32 errorKey( 0 ); |
|
136 iNatfwRepository->Delete( keys[ i ], KUNSAFProtocolsTableMask, errorKey ); |
|
137 } |
|
138 |
|
139 CleanupStack::PopAndDestroy( &keys ); |
|
140 |
|
141 CSCSVCPLUGINDEBUG( |
|
142 "CCSCSvcPluginCenrepHandler::RemoveDomainSpecificNatfwSettingsL - end"); |
|
143 } |
|
144 |