|
1 /* |
|
2 * Copyright (c) 2004-2006 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: Implementation of PnPMS components |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef NHEADWRAPPER_PARSER_H |
|
20 #define NHEADWRAPPER_PARSER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include "HttpProvStates.h" |
|
25 |
|
26 class CHttpProvHeaders; |
|
27 class CHttpProvContentType; |
|
28 |
|
29 enum TProvisioningActivation |
|
30 { |
|
31 EProvisioningActivationUser = 0, |
|
32 EProvisioningActivationOn, |
|
33 EProvisioningActivationOff |
|
34 }; |
|
35 |
|
36 class CNHeadWrapperParser : public CBase |
|
37 { |
|
38 public: |
|
39 IMPORT_C ~CNHeadWrapperParser(); |
|
40 |
|
41 /*! |
|
42 Constructor |
|
43 Does not make an own copy of the data, so aWrapperData should remain |
|
44 in the scope during the lifetime of the CNHeadWrapperParser object. |
|
45 @param aWrapperData Pointer to a buffer containing HeadWrapper data. |
|
46 */ |
|
47 IMPORT_C static CNHeadWrapperParser* NewL( const TPtrC8& aWrapperData ); |
|
48 |
|
49 /*! |
|
50 Parses Oma Content provisioning data from wrapper |
|
51 */ |
|
52 IMPORT_C THttpProvStates::TProvisioningStatus Parse(); |
|
53 |
|
54 /*! |
|
55 @return headers |
|
56 Leaves with KErrNotFound if there was no headers in the HeadWrapper. |
|
57 */ |
|
58 IMPORT_C const TDesC8& GetHeadersL() const; |
|
59 |
|
60 /*! |
|
61 @return content type |
|
62 Leaves with KErrNotFound if there was no content type in the HeadWrapper. |
|
63 */ |
|
64 IMPORT_C const TDesC8& GetContentTypeL() const; |
|
65 |
|
66 /*! |
|
67 @return content data |
|
68 */ |
|
69 IMPORT_C const TDesC8& GetContentL() const; |
|
70 |
|
71 /*! |
|
72 @return report URL from the provisioned data |
|
73 */ |
|
74 IMPORT_C const TDesC8& GetReportUrlL() const; |
|
75 |
|
76 /*! |
|
77 @return |
|
78 ETrue if there was no "Provisioning Activation" header |
|
79 in the provisioned head wrapper or if the header was set to value "1" |
|
80 */ |
|
81 IMPORT_C TProvisioningActivation GetProvisioningActivation() const; |
|
82 |
|
83 /*! |
|
84 @return ETrue if there was "User Interaction" header in the |
|
85 provisioned head wrapper and it was set to value "1". EFalse |
|
86 otherwise. |
|
87 */ |
|
88 IMPORT_C TBool GetUserInteraction() const; |
|
89 |
|
90 private: |
|
91 CNHeadWrapperParser(); |
|
92 void ConstructL(const TPtrC8& aWrapperData); |
|
93 |
|
94 void DoParseL(); |
|
95 void CheckHeadWrapperL(); |
|
96 |
|
97 /* |
|
98 * Parses Uintvar from beginning of descriptor |
|
99 */ |
|
100 TInt ParseUintVar(const TDesC8& aVarDes, TUint32& aVar, TUint &aVarLength); |
|
101 TBool GetBoolParamValueL( const TDesC8& aParam ) const; |
|
102 |
|
103 private: |
|
104 |
|
105 // Wrapper data |
|
106 TPtrC8 iWrapperData; |
|
107 |
|
108 CHttpProvHeaders* iHttpProvHeaders; |
|
109 CHttpProvContentType* iHttpProvContentType; |
|
110 |
|
111 // headers |
|
112 TPtrC8 iHeaders; |
|
113 |
|
114 // Content type |
|
115 TPtrC8 iContentTypeField; |
|
116 |
|
117 // Content of wrapper |
|
118 TPtrC8 iContent; |
|
119 |
|
120 }; |
|
121 |
|
122 #endif // NHEADWRAPPER_PARSER_H |