|
1 /* |
|
2 * Copyright (c) 2002-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: Decoding of binary multimedia message |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CMMSDECODE_H |
|
21 #define CMMSDECODE_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <mentact.h> |
|
25 #include <cmsvattachment.h> |
|
26 |
|
27 #include "mmsservercommon.h" |
|
28 #include "mmscodecdatasink.h" |
|
29 |
|
30 // CONSTANTS |
|
31 // We cannot save unlimited number of attachments. |
|
32 // We use a "sanity" limit which is actually insanely high, but should be safe. |
|
33 const TInt KMmsMaxAttachments = 500; |
|
34 |
|
35 // FUNCTION PROTOTYPES |
|
36 |
|
37 // FORWARD DECLARATIONS |
|
38 class MMmsEntryWrapper; |
|
39 class RBufReadStream; |
|
40 class CMmsHeaders; |
|
41 class CMsvMimeHeaders; |
|
42 class CMmsSettings; |
|
43 |
|
44 // CLASS DECLARATION |
|
45 |
|
46 /** |
|
47 * Decoding of binary multimedia message. |
|
48 * |
|
49 * @lib mmscodec.lib |
|
50 * @since V2.1 |
|
51 */ |
|
52 class CMmsDecode :public CMsgActive, public MMmsCodecDataSink |
|
53 { |
|
54 |
|
55 public: |
|
56 |
|
57 /** Lookup for file extension */ |
|
58 typedef struct |
|
59 { |
|
60 const TText8* tag; |
|
61 const TText16* extension; |
|
62 }TMmsExtensionLookup; |
|
63 |
|
64 /** Lookup for extension header assigned values */ |
|
65 typedef struct MmsExtensionHeaderLookup |
|
66 { |
|
67 const TText8* extensionHeader; |
|
68 const TUint8* assignedValue; |
|
69 }TMmsExtensionHeaderLookup; |
|
70 |
|
71 /** |
|
72 * @param aFs file system handle. |
|
73 */ |
|
74 IMPORT_C static CMmsDecode* NewL( RFs& aFs ); |
|
75 |
|
76 virtual ~CMmsDecode(); |
|
77 |
|
78 public: |
|
79 |
|
80 /** |
|
81 * Start the state machine. |
|
82 * @param aEntryWrapper entry class for message access |
|
83 * @param aMmsHeadders reference to CMmsHeaders class. |
|
84 * @param aDecodeBuffer buffer holding the data to be decoded. |
|
85 * @param aStatus status of calling active object |
|
86 * @param aStartPosition the starting point in the buffer. |
|
87 * Default = 0, start from beginning. |
|
88 * @param aLength length of the data to be decoded. |
|
89 * Default = 0, decode whole buffer |
|
90 * If memory runs out before state machine is started, leaves with error code. |
|
91 */ |
|
92 IMPORT_C void StartL( |
|
93 MMmsEntryWrapper& aEntryWrapper, |
|
94 CMmsHeaders& aMmsHeaders, |
|
95 CBufFlat& aDecodeBuffer, |
|
96 TRequestStatus& aStatus, |
|
97 TInt aStartPosition = 0, |
|
98 TInt aLength = 0 ); |
|
99 |
|
100 /** |
|
101 * Synchronous decoding function. |
|
102 * To be used for messages that have only headers and no body. |
|
103 * For example MMS notifications and delivery reports. |
|
104 * @param aEntryWrapper entry class for message access |
|
105 * @param aMmsHeaders reference to CMmsHeaders class. |
|
106 * @param aDecodeBuffer buffer holding the data to be decoded. |
|
107 * @param aStartPosition the starting point in the buffer. |
|
108 * Default = 0, start from beginning. |
|
109 * @param aLength length of the data to be decoded. |
|
110 * Default = 0, decode whole buffer |
|
111 * @param aNumberofAttachments pointer to a variable that will contain |
|
112 * the number of attachments on return. |
|
113 * Default = 0, no attachment number requested |
|
114 * @param aDataStart pointer to a variable that will contain the |
|
115 * starting position of data in this MMS message. |
|
116 * Will point to start of first multipart entry or start of |
|
117 * monoblock data. If data type is WSP multipart, the assigned |
|
118 * number of the multipart has been stored in aMmsHeaders. |
|
119 * Default = 0, data part start not requested. |
|
120 * leaves with error code. |
|
121 */ |
|
122 IMPORT_C void DecodeHeadersL( |
|
123 MMmsEntryWrapper& aEntryWrapper, |
|
124 CMmsHeaders& aMmsHeaders, |
|
125 CBufFlat& aDecodeBuffer, |
|
126 TInt aStartPosition = 0, |
|
127 TInt aLength = 0, |
|
128 TInt* aNumberOfAttachments = 0, |
|
129 TInt* aDataStart = 0 ); |
|
130 |
|
131 /** |
|
132 * Decode attachments separately |
|
133 * @since 2.6 |
|
134 * @param aEntryWrapper entry class for message access |
|
135 * @param aMmsHeaders reference to CMmsHeaders class. |
|
136 * @param aDecodeBuffer buffer holding the data to be decoded. |
|
137 * @param aNumberOfAttachments number of attachments to be decoded. |
|
138 * @param aStartPosition start position of the data to be decoded. |
|
139 * On return this is updated to point to next data part. |
|
140 * If this was the last data part, aStartPosition will point |
|
141 * past the end of the buffer. |
|
142 * @param aStatus status of calling active object. |
|
143 * @param aDoNotUpdateParentEntry should the parent entry be updated with |
|
144 * attachment info. |
|
145 * The parent entry should be updated only when the last attachment |
|
146 * has been handled. |
|
147 * Default EFalse = update parent entry. |
|
148 * @param aLength length of the data to be decoded. |
|
149 * Default = 0, decode whole buffer. |
|
150 * If aNumberOfAttachments is the actual number of attachments, and |
|
151 * aDoNotUpdateParentEntry and aLength have their default values, the whole |
|
152 * attachment buffer is decoded and the result is the same as it were |
|
153 * if the headers and attachments had been decoded together. |
|
154 * If the attachments are handled one by one, aDoNotUpdateParentEntry should |
|
155 * be false only when the last attachment has been reached. |
|
156 */ |
|
157 IMPORT_C void DecodeAttachmentsL( |
|
158 MMmsEntryWrapper& aEntryWrapper, |
|
159 CMmsHeaders& aMmsHeaders, |
|
160 CBufFlat& aDecodeBuffer, |
|
161 TInt aNumberOfAttachments, |
|
162 TInt& aStartPosition, |
|
163 TRequestStatus& aStatus, |
|
164 TBool aDoNotUpdateParentEntry = EFalse, |
|
165 TInt aLength = 0 ); |
|
166 |
|
167 /** |
|
168 * Extract starting position and length of data content from WSP multipart |
|
169 * @since 2.6 |
|
170 * @param aDecodeBuffer buffer holding the data to be decoded. |
|
171 * @param aStartPosition start position of the data to be decoded. |
|
172 * On return this is updated to point to next data part. |
|
173 * If this was the last data part, aStartPosition will point |
|
174 * past the end of the buffer. |
|
175 * @param aStartOfData On return start of the actual data content in multipart entry |
|
176 * @param aLengthOfData On return the length of the data content. |
|
177 * @return Mime headers containing content type and content type parameters |
|
178 * of the data part. The structure will be valid only until next call to |
|
179 * some function of CMmsDecode. |
|
180 */ |
|
181 IMPORT_C CMsvMimeHeaders& ExtractNextDataPartL( |
|
182 CBufFlat& aDecodeBuffer, |
|
183 TInt& aStartPosition, |
|
184 TInt& aStartOfData, |
|
185 TInt& aLengthOfData); |
|
186 |
|
187 /* |
|
188 * Commit the store. |
|
189 * This function must be called to commit the store if attachments are decoded |
|
190 * and stored individually without allowing the parent entry to be updated |
|
191 * after last attachment. |
|
192 * This function can also be called to commit the store after each attachment. |
|
193 * This function does not delete the store. The store is deleted when headers |
|
194 * are reseted to start decoding a new entry. |
|
195 */ |
|
196 IMPORT_C void CommitStoreL(); |
|
197 |
|
198 |
|
199 /** |
|
200 * Initialize the decoder for work in chunked decoding mode. |
|
201 * |
|
202 * @since v3.1 |
|
203 * Only chunked decoding of headers or incoming messages is supported. |
|
204 * Chunked decoding of MMBox descriptions is not supported. |
|
205 * Needed variables are initialized. |
|
206 * Data will be provided later through the MmsCodecDataSink API |
|
207 * @param aEntryWrapper entry class for message access. |
|
208 * Must be initialized to point to created message entry to receive the data. |
|
209 * @param aMmsHeaders reference to CMmsHeaders class. |
|
210 * @param aDecodeBuffer buffer. Given only to ensure that the buffer is always defined. |
|
211 * During initialization buffer contains no data and it can be changed by NextDataPart |
|
212 * function. Normally the buffer given here is the same as given in NextDataPart, |
|
213 * only content will change. |
|
214 * |
|
215 */ |
|
216 IMPORT_C void InitializeChunkedMode( |
|
217 MMmsEntryWrapper& aEntryWrapper, |
|
218 CMmsHeaders& aMmsHeaders, |
|
219 CBufFlat& aDecodeBuffer |
|
220 ); |
|
221 |
|
222 // from base class MMmsCodecDataSink |
|
223 |
|
224 /** |
|
225 * From MMmsCodecDataSink. |
|
226 * Gives the next data part to be decoded. |
|
227 * Decoding is synchronous. When the code returns, data can be released. |
|
228 * |
|
229 * @since v3.1 |
|
230 * @param aBuffer flat buffer containing the data to be decoded. |
|
231 * @param aPosition start of data to be decoded. |
|
232 * Decoding will start from aPosition. |
|
233 * At return aPosition will point to the data that has not been |
|
234 * decoded yet (in case data ends with an incomplete header) or |
|
235 * past the end of data if everything has been decoded. |
|
236 * The caller can discard the beginning of data up to aPosition. |
|
237 * If there is data left in the buffer it must be shifted to the |
|
238 * beginning of buffer and new data appended to the end to allow |
|
239 * an incomplete header to be decoded at next round. |
|
240 * @param aLastChunk ETrue if the data chunk in the buffer is the last one. |
|
241 * @return error code, KErrNone if decoding succeeds |
|
242 * If returns some other error, transaction must be cancelled. |
|
243 */ |
|
244 TInt NextDataPart( |
|
245 CBufFlat& aBuffer, |
|
246 TInt& aPosition, |
|
247 TBool aLastDataChunk ); |
|
248 |
|
249 /** |
|
250 * From MMmsCodecDataSink. |
|
251 * Release data sink and free any resources |
|
252 * This funktion must be called after last data chunk has been processed. |
|
253 * This funktion must also be called if the process is terminated by an error. |
|
254 * |
|
255 * @since v3.1 |
|
256 */ |
|
257 void RelaseDataSink(); |
|
258 |
|
259 /** |
|
260 * Reset data sink. |
|
261 * Delete all attachments from current message. |
|
262 * Reset MMS headers |
|
263 * Start message decoding from the beginning |
|
264 * |
|
265 * This function must be called if transaction is interrupted and restarted |
|
266 * |
|
267 * @since v3.1 |
|
268 */ |
|
269 void ResetDataSink(); |
|
270 |
|
271 |
|
272 private: |
|
273 |
|
274 CMmsDecode(); |
|
275 |
|
276 /** |
|
277 * @param aFs file system handle. |
|
278 */ |
|
279 void ConstructL( RFs& aFs ); |
|
280 |
|
281 /** |
|
282 * Active object completion. |
|
283 */ |
|
284 void DoRunL(); |
|
285 |
|
286 /** |
|
287 * Cleanup |
|
288 * @param aStatus the completion code |
|
289 */ |
|
290 void DoComplete( TInt& aStatus ); |
|
291 |
|
292 /** |
|
293 * Select next state for state machine. |
|
294 */ |
|
295 void SelectNextState(); |
|
296 |
|
297 /** |
|
298 * Switch states. |
|
299 */ |
|
300 void ChangeStateL(); |
|
301 |
|
302 /** |
|
303 * Initialize members to allow several entry points. |
|
304 * We have at least one service that does not preceed |
|
305 * in stages, but completes in one shot. |
|
306 */ |
|
307 void Reset(); |
|
308 |
|
309 /** |
|
310 * Header decode stage for chunked decoding |
|
311 * @param aLastDataChunk is the data chunk the last one |
|
312 * @return |
|
313 * - ETrue if more data is needed to finish decoding the headers |
|
314 * - EFalse if no more data is needed |
|
315 */ |
|
316 TBool SinkHeaders( TBool aLastDataChunk ); |
|
317 |
|
318 /** |
|
319 * Attachment header decode stage for chunked decoding |
|
320 * @param aLastDataChunk is the data chunk the last one |
|
321 * @return |
|
322 * - ETrue if more data is needed to finish decoding the headers |
|
323 * - EFalse if no more data is needed |
|
324 */ |
|
325 TBool SinkAttachmentHeaders( TBool aLastDataChunk ); |
|
326 |
|
327 /** |
|
328 * Attachment data start stage for chunked decoding |
|
329 */ |
|
330 void SinkAttachmentDataStart(); |
|
331 |
|
332 /** |
|
333 * Attachment data stage for chunked decoding |
|
334 */ |
|
335 void SinkAttachmentData(); |
|
336 |
|
337 /** |
|
338 * Attachment data finished for chunked decoding |
|
339 * @param aLastDataChunk is the data chunk the last one |
|
340 */ |
|
341 void FinishSinkingAttachment( TBool aLastDataChunk ); |
|
342 |
|
343 /** |
|
344 * Last chunk postamble for chunked decoding |
|
345 */ |
|
346 void FinalizeSinkingLastChunk(); |
|
347 |
|
348 /** |
|
349 * Do headers |
|
350 */ |
|
351 void DecodeHeadersL(); |
|
352 |
|
353 /** |
|
354 * Save the MMS headers |
|
355 */ |
|
356 void SaveMMSHeadersL(); |
|
357 |
|
358 /** |
|
359 * Decode one header |
|
360 */ |
|
361 void DecodeOneHeaderL(); |
|
362 |
|
363 /** |
|
364 * Get one header. |
|
365 * iPosition is advanced to point to the start of value. <br> |
|
366 * (value coding depends on header.) <br> |
|
367 * If header name is unknown, pointer is advanced to point |
|
368 * beyond parameters. |
|
369 * MMS headers only, assigned numbers only |
|
370 * @return -1, if unknown header assignment |
|
371 */ |
|
372 TInt GetHeaderName(); |
|
373 |
|
374 /** |
|
375 * Skip an unknown header name. |
|
376 */ |
|
377 // no longer used |
|
378 /* |
|
379 void SkipTextString(); |
|
380 */ |
|
381 |
|
382 /** |
|
383 * Skip field value (needed for unknown fields). |
|
384 */ |
|
385 void SkipFieldValue(); |
|
386 |
|
387 /** |
|
388 * Skip parameter name (needed for unsupported parameters). |
|
389 */ |
|
390 void SkipParameterName(); |
|
391 |
|
392 /** |
|
393 * Get uintvar that tells how many bytes will follow. |
|
394 * @return decoded number according to WSP uintvar specs |
|
395 */ |
|
396 TUint32 GetUintvar(); |
|
397 |
|
398 /** |
|
399 * Decode From field. |
|
400 * Caller must delete returned TDes16* |
|
401 * @return descriptor holding the address in unicode |
|
402 * (type has been removed) |
|
403 * from is different from rest of addresses, as there |
|
404 * will be the "address present" token |
|
405 */ |
|
406 HBufC16* DecodeFromL(); |
|
407 |
|
408 /** |
|
409 * Decode address. |
|
410 * Caller must delete returned TDes16* |
|
411 * @return descriptor holding the address in unicode |
|
412 * (type has been removed) |
|
413 */ |
|
414 HBufC16* DecodeAddressL(); |
|
415 |
|
416 /** |
|
417 * Get simple text string. |
|
418 * ASCII into unicode. |
|
419 * @param aKeepQuote retain quote in the beginning of string. |
|
420 * Needed only when caled from GetEncodedTextStringL. |
|
421 * @return descriptor holding unicode version of ASCII string |
|
422 */ |
|
423 HBufC16* GetSimpleTextStringL( TBool aKeepQuote = EFalse ); |
|
424 |
|
425 /** |
|
426 * Get encoded text string. |
|
427 * Convert to unicode from character set specified. |
|
428 * @return descriptor holding unicode version of string |
|
429 */ |
|
430 HBufC16* GetEncodedTextStringL(); |
|
431 |
|
432 /** |
|
433 * Get a text string as bytes (no conversions). |
|
434 * Data is not copied! The result is valid only as long as the |
|
435 * source stays alive. The pointer will point to our |
|
436 * decoding buffer, so it is valid as long as we stay alive. |
|
437 * @return descriptor pointing to byte string |
|
438 */ |
|
439 TPtrC8 GetByteString(); |
|
440 |
|
441 /** |
|
442 * Get a text string as bytes (no conversions). |
|
443 * Data is not copied! The result is valid only as long as the |
|
444 * source stays alive. The pointer will point to our |
|
445 * decoding buffer, so it is valid as long as we stay alive. |
|
446 * Leading 0x7F is removed, but characters from 0x80 to 0x8f are valid |
|
447 * @return descriptor pointing to byte string |
|
448 */ |
|
449 TPtrC8 GetUtf8String(); |
|
450 |
|
451 /** |
|
452 * Get short integer or a long integer that is no longer than 32 bits. |
|
453 * @return 32 bit integer |
|
454 * If the length of the integer is more than 4 bytes, the field is skipped |
|
455 */ |
|
456 TUint32 GetLongOrShortInteger(); |
|
457 |
|
458 /** |
|
459 * Get an integer that may be up to 64 bits long (for example date). |
|
460 * @return 64 bit integer |
|
461 */ |
|
462 TInt64 GetVeryLongInteger(); |
|
463 |
|
464 /** |
|
465 * Get a well known header assignment, skip field value if unknown coding. |
|
466 * @return token value, 0 if unknown coding (text string etc.) |
|
467 */ |
|
468 TUint8 GetWellKnownFieldValueOrSkip(); |
|
469 |
|
470 /** |
|
471 * Get token and date or interval value for time fields that have alternate coding. |
|
472 * @param aTime reference to 64 bit integer that receives |
|
473 * the time. |
|
474 * @return absolute or reltive token, KMmsAbsoluteToken or |
|
475 * KMmsRelativeToken. Returns 0, if cannot interpret field. |
|
476 */ |
|
477 TUint8 GetRelativeOrAbsoluteTime( TInt64& aTime ); |
|
478 |
|
479 /** |
|
480 * Get field length and skip the bytes that indicate the length. |
|
481 * If field is one-byte token, it is skipped and 0 is returned. |
|
482 * If field is text string, the length of the string (including |
|
483 * terminating zero) is returned. |
|
484 * The field can be skipped by adding the indicated number of bytes to |
|
485 * current postition |
|
486 * @return the length of the value. 0 if not enough data |
|
487 */ |
|
488 TUint GetValueLength(); |
|
489 |
|
490 /** |
|
491 * Check if there is enough data in the buffer to decode a whole header |
|
492 * |
|
493 * @since v3.1 |
|
494 * iPosition is always restored to its original value. |
|
495 * |
|
496 * @return ETrue if a whole header and its value is in the buffer. |
|
497 * EFalse if not enough data and more should be obtained from the data source |
|
498 */ |
|
499 TBool CheckHeaderLength(); |
|
500 |
|
501 /** |
|
502 * Check if there is enough data in the buffer to decode a whole value |
|
503 * |
|
504 * @since v3.1 |
|
505 * |
|
506 * @param aCheckUintvarData ETrue if routine must check that enough data bytes |
|
507 * follow uintvar. |
|
508 * This is needed when uintvar specifies the length of a header |
|
509 * EFalse if only the integrity of the uintvar itself must be checked |
|
510 * @return ETrue if a whole value is in the buffer. |
|
511 * EFalse if not enough data and more should be obtained from the data source |
|
512 */ |
|
513 TBool CheckValueLength( TBool aCheckUintvarData ); |
|
514 |
|
515 /** |
|
516 * See if there are enough bytes in the buffer to define a legal uintvar |
|
517 * |
|
518 * @since v3.1 |
|
519 * |
|
520 * @return ETrue if a whole value is in the buffer. |
|
521 * EFalse if not enough data and more should be obtained from the data source |
|
522 * After check iPosition still points to the beginning of the Uintvar checked |
|
523 */ |
|
524 TBool CheckUintvarLength(); |
|
525 |
|
526 /** |
|
527 * Get attachment mime type. |
|
528 * @return pointer (with length) to the mime type string |
|
529 */ |
|
530 TPtrC8 GetContentTypeL(); |
|
531 |
|
532 /** |
|
533 * Get multipart content type. |
|
534 * Also gets parameters for the multipart type (start). |
|
535 * Root content type parameter is discarded (not used). |
|
536 * Start-info parameter is discarded (unless we know how to use it!). |
|
537 * @return assigned number for multipart content type, |
|
538 * 0 if not multipart (monoblock body) |
|
539 */ |
|
540 TUint8 GetMultipartContentTypeL(); |
|
541 |
|
542 /** |
|
543 * Get content type and content type parameters for one attachment |
|
544 */ |
|
545 void GetAttachmentContentTypeL(); |
|
546 |
|
547 /** |
|
548 * Decode one content header from multipart headers. |
|
549 */ |
|
550 void DecodeOneContentHeaderL(); |
|
551 |
|
552 /** |
|
553 * Get one content header. |
|
554 * iPosition is advanced to point to the start of value. |
|
555 * (value coding depends on header.) |
|
556 * @param atextHeader pointer set to header in text form |
|
557 * @return assigned number of header |
|
558 * -1, if unknown header assignment |
|
559 * 0x7f if textual header (to handle X-type headers) |
|
560 */ |
|
561 TInt GetContentHeaderName( TPtrC8& aTextHeader ); |
|
562 |
|
563 /** |
|
564 * Decode one attachment. |
|
565 */ |
|
566 void DecodeOneAttachmentL(); |
|
567 |
|
568 /** |
|
569 * Decode attachment headers |
|
570 */ |
|
571 void DecodeAttachmentHeadersL(); |
|
572 |
|
573 /** |
|
574 * Extract parameters that are separated by semicolons. |
|
575 * Extracted parameters are stored to MIME headers. |
|
576 * @param aBuffer content parameter string ( actual content type string removed already) |
|
577 * this should be of the form: |
|
578 * parameter1=value1;parameter2=value2;parameter3=value3 |
|
579 */ |
|
580 void ExtractContentTypeParametersL( const TPtrC8& aBuffer ); |
|
581 |
|
582 /** |
|
583 * Try to form filename from possibly MIME-encoded string |
|
584 * @param aSource suggestion for filename, may be MIME encoded |
|
585 * @param aDestination full path and filename, if aSource is valid name. |
|
586 * @param aPath path for the file. |
|
587 * @return ETrue if aSource forms a valid filename, EFalse if not. |
|
588 */ |
|
589 TBool MakeFilenameL( TPtrC8& aSource, TParse& aDestination, const TFileName& aPath ); |
|
590 |
|
591 /** |
|
592 * Cleanup (close streams etc.). |
|
593 */ |
|
594 void FinishL(); |
|
595 /** |
|
596 * check DRM contents. |
|
597 */ |
|
598 TBool CheckDRMContent(); |
|
599 /** |
|
600 * Dump binary data into file. |
|
601 */ |
|
602 void DumpL(); |
|
603 |
|
604 /** |
|
605 * Dump smil part into separate file if needed |
|
606 @param aDataLength length of smil part |
|
607 */ |
|
608 void DumpSmil(TInt aDataLength); |
|
609 |
|
610 /** |
|
611 * Log value yes/no |
|
612 * @param aTitle title text |
|
613 * @param aValue value that maps to KMmsYes or KMmsNo |
|
614 */ |
|
615 void LogYesNo( TRefByValue<const TDesC> aTitle, TInt aValue ); |
|
616 |
|
617 /** |
|
618 * Decode X-Mms-MM-Flags header and store value |
|
619 */ |
|
620 void GetKeywordL(); |
|
621 |
|
622 /** |
|
623 * Get active and complete own status with error code. |
|
624 * To be used when state machine loop must be terminated with error |
|
625 */ |
|
626 void CompleteSelf( TInt aError ); |
|
627 |
|
628 /** |
|
629 * Check if string contains only US-ASCII characters. |
|
630 * @param aString the string to be checked |
|
631 * @return ETrue = ASCII, EFalse = contains characters >= 0x80 |
|
632 */ |
|
633 TBool IsStringSafe( const TDesC8& aString ); |
|
634 |
|
635 /** |
|
636 * decode FROM header |
|
637 */ |
|
638 void DecodeFromHeaderL(); |
|
639 |
|
640 /** |
|
641 * decode TO header |
|
642 */ |
|
643 void DecodeToL(); |
|
644 |
|
645 /** |
|
646 * decode CC header |
|
647 */ |
|
648 void DecodeCcL(); |
|
649 |
|
650 /** |
|
651 * decode BCC header |
|
652 */ |
|
653 void DecodeBccL(); |
|
654 |
|
655 /** |
|
656 * decode content location header |
|
657 */ |
|
658 void DecodeContentLocationHeaderL(); |
|
659 |
|
660 /** |
|
661 * Decode message date header |
|
662 */ |
|
663 void DecodeDateHeaderL(); |
|
664 |
|
665 /** |
|
666 * Decode delivery report wanted header |
|
667 */ |
|
668 void DecodeDeliveryReportHeader(); |
|
669 |
|
670 /** |
|
671 * Decode message delivery time header |
|
672 */ |
|
673 void DecodeDeliveryTimeL(); |
|
674 |
|
675 /** |
|
676 * Decode message expiration header |
|
677 */ |
|
678 void DecodeExpiryL(); |
|
679 |
|
680 /** |
|
681 * Decode Message Class header |
|
682 */ |
|
683 void DecodeMessageClass(); |
|
684 |
|
685 /** |
|
686 * Decode message Id header |
|
687 */ |
|
688 void DecodeMessageIdL(); |
|
689 |
|
690 /** |
|
691 * Decode Message Type Header |
|
692 */ |
|
693 void DecodeMessageType(); |
|
694 |
|
695 /** |
|
696 * Decode MMS encapsulation version header |
|
697 */ |
|
698 void DecodeMmsVersion(); |
|
699 |
|
700 /** |
|
701 * Decode message size header |
|
702 */ |
|
703 void DecodeMessageSize(); |
|
704 |
|
705 /** |
|
706 * Decode priority header |
|
707 */ |
|
708 void DecodePriority(); |
|
709 |
|
710 /** |
|
711 * Decode Read Reply wanted header |
|
712 */ |
|
713 void DecodeReadReply(); |
|
714 |
|
715 /** |
|
716 * Decode delivery report sending allowed header |
|
717 */ |
|
718 void DecodeReportAllowed(); |
|
719 |
|
720 /** |
|
721 * decode response status or retrieve status header |
|
722 * @param aHeader tells if this is a response status or retrieve status |
|
723 */ |
|
724 void DecodeResponseStatusL( TInt aHeader ); |
|
725 |
|
726 /** |
|
727 * decode response text or retrieve text header |
|
728 */ |
|
729 void DecodeResponseTextL( TInt aHeader ); |
|
730 |
|
731 /** |
|
732 * Decode sender visibility header |
|
733 */ |
|
734 void DecodeSenderVisibility(); |
|
735 |
|
736 /** |
|
737 * decode message status header |
|
738 */ |
|
739 void DecodeStatus(); |
|
740 |
|
741 /** |
|
742 * decode subject header |
|
743 */ |
|
744 void DecodeSubjectL(); |
|
745 |
|
746 /** |
|
747 * decode Transaction ID |
|
748 */ |
|
749 void DecodeTidL(); |
|
750 |
|
751 /** |
|
752 * decode content type header |
|
753 */ |
|
754 void DecodeContentTypeL(); |
|
755 |
|
756 /** |
|
757 * Decode read status header |
|
758 */ |
|
759 void DecodeReadStatus(); |
|
760 |
|
761 /** |
|
762 * Decode Reply charging header |
|
763 */ |
|
764 void DecodeReplyCharging(); |
|
765 |
|
766 /** |
|
767 * Decode reply charging deadline header |
|
768 */ |
|
769 void DecodeReplyChargingDeadlineL(); |
|
770 |
|
771 /** |
|
772 * Decode Reply charging id header |
|
773 */ |
|
774 void DecodeReplyChargingIdL(); |
|
775 |
|
776 /** |
|
777 * Decode Reply charging size header |
|
778 */ |
|
779 void DecodeReplyChargingSize(); |
|
780 |
|
781 /** |
|
782 * Decode Previously-sent-by header |
|
783 */ |
|
784 void DecodePreviousSenderL(); |
|
785 |
|
786 /** |
|
787 * Decode Previously sent date header |
|
788 */ |
|
789 void DecodePreviouslySentDateL(); |
|
790 |
|
791 /** |
|
792 * Decode store-to-MMBox header |
|
793 */ |
|
794 void DecodeStoreHeaderL(); |
|
795 |
|
796 /** |
|
797 * Decode State in MMBox |
|
798 */ |
|
799 void DecodeMMBoxStateL(); |
|
800 |
|
801 /** |
|
802 * Decode MMBox Store status header |
|
803 */ |
|
804 void DecodeMMBoxStoreStatusL(); |
|
805 |
|
806 /** |
|
807 * Decode MMBox Store status text header |
|
808 */ |
|
809 void DecodeMMBoxStoreStatusTextL(); |
|
810 |
|
811 /** |
|
812 * Decode stored in MMBox header |
|
813 */ |
|
814 void DecodeStoredInMMBoxHeaderL(); |
|
815 |
|
816 /** |
|
817 * Decode attributes header in MMBox View |
|
818 */ |
|
819 void DecodeAttributesHeaderL(); |
|
820 |
|
821 /** |
|
822 * Decode Totals header in MMBox view |
|
823 */ |
|
824 void DecodeTotalsL(); |
|
825 |
|
826 /** |
|
827 * Decode totals header in MMBox view |
|
828 */ |
|
829 void DecodeMboxTotalsL(); |
|
830 |
|
831 /** |
|
832 * Decode MMBox View Quota header |
|
833 */ |
|
834 void DecodeQuotaHeaderL(); |
|
835 |
|
836 /** |
|
837 * Decode MMBox Quota header |
|
838 */ |
|
839 void DecodeMBoxQuotasL(); |
|
840 |
|
841 /** |
|
842 * Decode message count header in MMBox View |
|
843 */ |
|
844 void DecodeMessageCountL(); |
|
845 |
|
846 /** |
|
847 * Decode start header in MMBox View |
|
848 */ |
|
849 void DecodeStartInMMBoxViewL(); |
|
850 |
|
851 /** |
|
852 * Decode Distribution Indicator header |
|
853 */ |
|
854 void DecodeDistributionIndicator(); |
|
855 |
|
856 /** |
|
857 * Decode Element descriptor header |
|
858 */ |
|
859 void DecodeElementDescriptorL(); |
|
860 |
|
861 /** |
|
862 * Decode the limit header in MMBox view (max number of messages) |
|
863 */ |
|
864 void DecodeMessageLimitL(); |
|
865 |
|
866 /** |
|
867 * Decode the extended notification header |
|
868 */ |
|
869 void DecodeExtNotifTextL(); |
|
870 |
|
871 /** |
|
872 * Decode the extended notification end of string indicator |
|
873 */ |
|
874 void DecodeExtNotifEolL(); |
|
875 |
|
876 /** |
|
877 * Decode Content Class header |
|
878 */ |
|
879 void DecodeContentClass(); |
|
880 |
|
881 /** |
|
882 * Decode DRM Content header |
|
883 */ |
|
884 void DecodeDrmContentHeader(); |
|
885 |
|
886 /** |
|
887 * Decode Adaptation allowed header |
|
888 */ |
|
889 void DecodeAdaptationAllowed(); |
|
890 |
|
891 /** |
|
892 * Decode application id header |
|
893 */ |
|
894 void DecodeApplicationIdL(); |
|
895 |
|
896 /** |
|
897 * Decode reply to application id header |
|
898 */ |
|
899 void DecodeReplyApplicationIdL(); |
|
900 |
|
901 /** |
|
902 * Decode application info header |
|
903 */ |
|
904 void DecodeApplicationInfoL(); |
|
905 |
|
906 /** |
|
907 * Decode recommended retrieval mode |
|
908 */ |
|
909 void DecodeRecommendedRetrievalMode(); |
|
910 |
|
911 /** |
|
912 * Decode explanation for the recommended retrieval mode |
|
913 */ |
|
914 void DecodeRecommendedRetrievalModeTextL(); |
|
915 |
|
916 /** |
|
917 * Decode id of a message to be cancelled or replaced |
|
918 */ |
|
919 void DecodeCancelReplaceIdL( TInt aHeader ); |
|
920 |
|
921 /** |
|
922 * Decode status of cancel operation |
|
923 */ |
|
924 void DecodeCancelStatus(); |
|
925 |
|
926 #ifndef _NO_MMSS_LOGGING_ |
|
927 /** |
|
928 * log date |
|
929 * @param aDate date to be logged |
|
930 */ |
|
931 void LogDateL( const TInt64& aDate ); |
|
932 #endif |
|
933 |
|
934 private: // Data |
|
935 RFs iFs; // file system |
|
936 TInt iError; |
|
937 TInt iState; |
|
938 MMmsEntryWrapper* iEntryWrapper; |
|
939 CMmsHeaders* iMmsHeaders; |
|
940 CMsvMimeHeaders* iMimeHeaders; |
|
941 |
|
942 CBufFlat* iDecodeBuffer; |
|
943 TUint iPosition; // pointer to decode buffer |
|
944 TUint iLength; // total length of the message to be encoded |
|
945 TUint iDataStart; // starting point of multipart data |
|
946 TUint iNextStart; // starting point of next multipart |
|
947 TUint iNumberOfAttachments; |
|
948 TUint iTotalSize; |
|
949 // pointer to start of first text/plain part to be used to generate |
|
950 // a description in case actual subject is missing |
|
951 TUint iFakeSubject; |
|
952 TUint iTextPlainLength; // length of the data |
|
953 // IANA MIBEnum value of the first text/plain part |
|
954 TUint iCharacterSet; |
|
955 // Assigned number for multipart body type. |
|
956 // If not multipart, iMultipartType will be 0. |
|
957 TUint8 iMultipartType; |
|
958 TPtrC8 iRootContentId; |
|
959 HBufC8* iRootContentIdBuffer; |
|
960 TMsvAttachmentId iRootAttachmentId; |
|
961 TMsvAttachmentId iFirstAttachmentId; // if multipart/related, |
|
962 // and root not defined, first attachment is root |
|
963 // Counter to generate filenames atta1, atta2, etc. |
|
964 // Also keeps track of total number of attachments to support audio messaging |
|
965 TInt iAttaNumber; |
|
966 TInt iSmilCount; // counts the number of SMIL parts |
|
967 TInt iAudioCount; // counts the number of audio(amr) parts |
|
968 |
|
969 TInt32 iDRMFlags; |
|
970 |
|
971 // iLogAllDecoded is obsolete - everything is logged in debug version |
|
972 TBool iLogAllDecoded; |
|
973 TBool iDumpIncoming; |
|
974 |
|
975 TPtrC8 iMultipartRootType; // for logging only |
|
976 TParse iParse; // parse buffer stores current atta filename |
|
977 TBufC8<18> iTempBuffer; |
|
978 TInt iPlainTexts; // number of plain text attachments |
|
979 // if caller wants to know where position is, this pointer is non-zero |
|
980 TInt* iUpdatedPosition; |
|
981 TBool iDoNotUpdateParentEntry; |
|
982 CMsvStore* iStore; // store kept open to save several attachments |
|
983 |
|
984 TInt iDecodingStage; // stage for chunked encoding |
|
985 TInt iCurrentAttaLength; // data length for current attachment |
|
986 TInt iAttaDataWritten; // data that has already been written to atta file |
|
987 TInt iOldData; // the amount of data left undecoded |
|
988 TMsvAttachmentId iCurrentAttachment; |
|
989 TMsvAttachmentId iFirstTextPlain; |
|
990 TBool iUseForSubject; |
|
991 TBool iRemoveDrm; // remove DRM atta (not really an error) |
|
992 // Emergency brake to detect when last header has been decoded |
|
993 // Needed when receiving a message that has no attachments from a server |
|
994 // that always sends an empty last chunk |
|
995 TBool iLastHeader; |
|
996 |
|
997 |
|
998 #ifndef _NO_MMSS_LOGGING_ |
|
999 // iFilename is only needed when logging and dumping |
|
1000 TFileName iFileName ; // filename buffer as member to save stack space |
|
1001 #endif |
|
1002 |
|
1003 }; |
|
1004 |
|
1005 #endif // CMMSDECODE_H |
|
1006 |
|
1007 // End of File |