|
1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Internet Access Configuration Parser |
|
15 // |
|
16 // |
|
17 |
|
18 |
|
19 #ifndef __IACP_H__ |
|
20 #define __IACP_H__ |
|
21 |
|
22 #include <bsp.h> |
|
23 |
|
24 _LIT(KIACP, "IACP-DLL"); |
|
25 // Names for the different kinds of settings |
|
26 _LIT(KINTERNET, "Iname"); |
|
27 _LIT(KMAIL, "Mname"); |
|
28 _LIT(KHOTLIST, "Hname"); |
|
29 _LIT(KSCRIPT, "Pname"); |
|
30 _LIT(KSMS, "Sname"); |
|
31 _LIT(KTELNET, "Tname"); |
|
32 _LIT(KTERMINAL, "Rname"); |
|
33 _LIT(KFTP, "Fname"); |
|
34 _LIT(KTELEPHONE, "TBox"); // voice mailbox number |
|
35 _LIT(KGPRS, "Gname"); |
|
36 _LIT(KWWWHotlist, "Hname"); |
|
37 |
|
38 _LIT(KIacpIfName, "ppp"); |
|
39 _LIT(KIacpIfNetworks, "ip,ip6"); |
|
40 |
|
41 #define KBIO_MSG_ENTRY_PARSED 1 // Set entry .iMtmData3 to 1 to indicate that the entry has store i.e parsed,externalised |
|
42 #define KBIO_MSG_ENTRY_PROCESSED 2 // Set TMsvEntry iMtmData3 = 2 to indicate that a message has been processed |
|
43 |
|
44 //forward declarations |
|
45 class CBaseScriptParser2; |
|
46 class CRegisteredParserDll; |
|
47 class CMailParser; |
|
48 class CIspParser; |
|
49 class CScriptParser; |
|
50 class CSmsParser; |
|
51 class CGprsParser; |
|
52 class CTelVoiceMailboxParser; |
|
53 class CWWWHotlistParser; |
|
54 class CRichText; |
|
55 class CParsedFieldCollection; |
|
56 |
|
57 |
|
58 class CIacSettingsParser : public CBaseScriptParser2 |
|
59 /** |
|
60 @internalComponent |
|
61 @released |
|
62 */ |
|
63 { |
|
64 public: |
|
65 IMPORT_C static CIacSettingsParser* NewL(CRegisteredParserDll& aRegisteredParserDll, CMsvEntry& aEntry, RFs& aFs); |
|
66 ~CIacSettingsParser(); |
|
67 |
|
68 void ParseL(TRequestStatus& aStatus,const TDesC& aSms); |
|
69 void ProcessL(TRequestStatus& aStatus); |
|
70 //Utility functions |
|
71 CArrayPtrSeg<CParsedField>& ParsedFieldArray() const; |
|
72 void SetFieldValueL(const TDesC& aFieldName, const TDesC& aFieldValue); |
|
73 TBool GetMandatoryField(const TDesC& aFieldName) const; |
|
74 |
|
75 enum TSmsType |
|
76 { |
|
77 ESmsTypeUndefined, |
|
78 EBasicIAP, //Supported |
|
79 EBasicMail, //Supported |
|
80 EBasicMailIAP, // combined basic Email and Internet settings |
|
81 EExtendedIAP, //Supported |
|
82 EExtendedMail, |
|
83 EExtWWWHostListItem, // Supported |
|
84 EExtScriptSettings, //Supported |
|
85 EExtSmsSettings, //Supported |
|
86 EExtGprsSettings, //Supported |
|
87 EExtTelnetSettings, |
|
88 EExtTerminalSettings, |
|
89 EExtWWWSettings, |
|
90 EExtTTMLSettings, |
|
91 EExtFTPSettings, |
|
92 EExtInternetSettings, |
|
93 EExtTelephoneSettings, //Supported |
|
94 EExtWWWAutofetchSettings, |
|
95 EExtGprsIAP, // combined IAP and GPRS |
|
96 EExtGprsMail, // combined mail & GPRS |
|
97 EExtGprsIAPMail, // combined GPRS, IAP and mail |
|
98 ESmsMixedContent |
|
99 }; |
|
100 |
|
101 enum TParseSession |
|
102 { |
|
103 EParseSms=1, |
|
104 ECheckData, |
|
105 ESetParsersData, |
|
106 EProcessSms |
|
107 }; |
|
108 |
|
109 // flags indicating whether to attempt to create |
|
110 // a connection preference for GPRS or ISP settings |
|
111 enum TIacpConnectionPreferenceFlag |
|
112 { |
|
113 EIacpDoNotCreatePreference, |
|
114 EIacpAttempCreateAsFirstRank, |
|
115 EIacpAttempCreateAsSecondRank |
|
116 }; |
|
117 |
|
118 private: |
|
119 CIacSettingsParser(CRegisteredParserDll& aRegisteredParserDll, CMsvEntry& aEntry, RFs& aFs); |
|
120 void ConstructL(); |
|
121 void ChangeStateL(TParseSession aState); |
|
122 |
|
123 void ParseSmsL(); //Parsers sms data into an array of CParsedField |
|
124 void DoParseL(); |
|
125 void DoProcessL(); |
|
126 |
|
127 void GetPtrToScriptDataL(HBufC*& aPtrScriptData); |
|
128 TBool SetBioMsgTypeL(const TDesC& aLeftToken, TSmsType& aType); |
|
129 TBool IsSmsExtendedIAP(); |
|
130 TBool isMandatoryData(const TDesC& aFieldName); |
|
131 void CheckMandatoryDataL(); |
|
132 |
|
133 // set & store/restore data |
|
134 void SetDataL(); |
|
135 void SetParsersDataL(); |
|
136 void StoreParsedDataL(); |
|
137 void RestoreParsedDataL(); |
|
138 |
|
139 void SetDataFieldsL(CParsedField& aParsedField, const TDesC& aName, const TDesC& aValue, TBool aBool); |
|
140 TBool IsValidToken(const TDesC& aToken); |
|
141 |
|
142 void RequestComplete(TRequestStatus& aStatus,TInt aCompletion); |
|
143 |
|
144 void PopulateFieldCollectionsL(); |
|
145 TInt CompleteMessage(); |
|
146 |
|
147 //CActive |
|
148 void DoCancel(); |
|
149 void RunL(); |
|
150 TInt RunError(TInt aError); |
|
151 |
|
152 private: |
|
153 TBool iSmsParsed; |
|
154 TInt iState; |
|
155 TSmsType iSmsType; |
|
156 TSmsType iCurrentlyProcessing; |
|
157 |
|
158 HBufC* iSmsBuf; |
|
159 CMailParser* iMailParser; //Mail Parser i.e IMAP, POP3, SMTP |
|
160 CIspParser* iIspParser; //Internet Service Provided Parser i.e.Dial Out DB |
|
161 CScriptParser* iScriptParser; |
|
162 CSmsParser* iSmsParser; //SMS settings parser |
|
163 CTelVoiceMailboxParser* iTelVoiceMailboxParser; |
|
164 CGprsParser* iGprsParser; |
|
165 CWWWHotlistParser* iWWWHotlistParser; |
|
166 TRequestStatus* iReport; |
|
167 |
|
168 CArrayPtrSeg<CParsedFieldCollection>* iParsedFieldCollections; |
|
169 TInt iCurrentSettingsCtr; |
|
170 TIacpConnectionPreferenceFlag iConnectionPreference; |
|
171 |
|
172 TUint32 iDefaultIAP; |
|
173 TUint32 iDefaultMail; |
|
174 }; |
|
175 |
|
176 class CParsedFieldCollection : public CArrayPtrSeg<CParsedField> |
|
177 /** |
|
178 @internalComponent |
|
179 @released |
|
180 */ |
|
181 { |
|
182 public: |
|
183 CParsedFieldCollection(CIacSettingsParser::TSmsType aSmsType); |
|
184 CIacSettingsParser::TSmsType MessageType() { return iSmsType; }; |
|
185 |
|
186 TPtrC GetFieldValue(const TDesC& aFieldName) const; |
|
187 TInt GetFieldValueAndLength(const TDesC& aFieldName, TPtrC& aValue) const; |
|
188 |
|
189 void GetTBoolL(const TDesC& aDes, TBool& aBool) const; |
|
190 void GetTUint32NumL(const TDesC& aDes, TUint32& aTUint32Value) const; |
|
191 |
|
192 TBool FieldNameExists(const TDesC& aFieldName) const; |
|
193 |
|
194 // Used in runl to associate iap and mail settings |
|
195 |
|
196 public: |
|
197 TBool iCanCommit; |
|
198 private: |
|
199 CIacSettingsParser::TSmsType iSmsType; |
|
200 }; |
|
201 |
|
202 #endif |