|
1 /* |
|
2 * Copyright (c) 2007-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: Recognize vpn policy files |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <f32file.h> |
|
19 #include <ecom/implementationproxy.h> |
|
20 |
|
21 #include "vpnpolicyrecognizer.h" |
|
22 #include "vpnpolicyrecognizerconstants.h" |
|
23 |
|
24 |
|
25 const TImplementationProxy ImplementationTable[] = |
|
26 { |
|
27 IMPLEMENTATION_PROXY_ENTRY(KVpnPolicyRecognizerId, CVpnPolicyRecognizer::NewL) |
|
28 }; |
|
29 |
|
30 |
|
31 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) |
|
32 { |
|
33 aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); |
|
34 return ImplementationTable; |
|
35 } |
|
36 |
|
37 |
|
38 CVpnPolicyRecognizer* CVpnPolicyRecognizer::NewL() |
|
39 { |
|
40 CVpnPolicyRecognizer* self = new (ELeave) CVpnPolicyRecognizer; |
|
41 |
|
42 return self; |
|
43 } |
|
44 |
|
45 |
|
46 CVpnPolicyRecognizer::CVpnPolicyRecognizer() |
|
47 : CApaDataRecognizerType(KVpnPolicyRecognizerUid, EHigh) |
|
48 { |
|
49 iCountDataTypes = KSupporstedMimeTypeCount; |
|
50 } |
|
51 |
|
52 |
|
53 CVpnPolicyRecognizer::~CVpnPolicyRecognizer() |
|
54 { |
|
55 } |
|
56 |
|
57 |
|
58 TDataType CVpnPolicyRecognizer::SupportedDataTypeL(TInt aIndex) const |
|
59 { |
|
60 |
|
61 if (aIndex == 0) |
|
62 { |
|
63 return TDataType(KZippedPolicyFile); |
|
64 } |
|
65 else |
|
66 { |
|
67 return TDataType(KPolicyInfoFile); |
|
68 } |
|
69 } |
|
70 |
|
71 |
|
72 void CVpnPolicyRecognizer::DoRecognizeL(const TDesC &aName, const TDesC8& /*aBuffer*/) |
|
73 { |
|
74 |
|
75 iConfidence=ENotRecognized; |
|
76 |
|
77 if (aName.Length() >= KFileExtensionLength) |
|
78 { |
|
79 TPtrC extension(aName.Right(KFileExtensionLength)); |
|
80 |
|
81 if (extension.CompareF(KVpnZipPolicyFileExtension) == 0) |
|
82 { |
|
83 iConfidence=ECertain; |
|
84 iDataType=TDataType(KZippedPolicyFile); |
|
85 } |
|
86 else if (extension.CompareF(KVpnPinPolicyFileExtension) == 0) |
|
87 { |
|
88 iConfidence=ECertain; |
|
89 iDataType=TDataType(KPolicyInfoFile); |
|
90 } |
|
91 } |
|
92 } |