|
1 // Copyright (c) 2000-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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 |
|
17 |
|
18 /** |
|
19 @file |
|
20 @publishedPartner |
|
21 @released |
|
22 */ |
|
23 |
|
24 #ifndef __PUSHMESSAGE_H__ |
|
25 #define __PUSHMESSAGE_H__ |
|
26 |
|
27 #include <e32base.h> |
|
28 #include <thttpfields.h> |
|
29 |
|
30 class RWriteStream; |
|
31 class CHTTPResponse; |
|
32 |
|
33 |
|
34 /** |
|
35 Encapsulates a WAP Push Message. |
|
36 |
|
37 It provides functions to access the headers and body information. There are |
|
38 specific functions to find Application ID, and the Content Type headers as |
|
39 these fields are frequently required. |
|
40 |
|
41 The class also has a function to give Read-Only access to the body of the message. |
|
42 |
|
43 @publishedPartner |
|
44 @released |
|
45 */ |
|
46 class CPushMessage : public CBase |
|
47 { |
|
48 public: |
|
49 IMPORT_C static CPushMessage* NewL(HBufC8* aHeader, HBufC8* aBody); |
|
50 IMPORT_C static CPushMessage* NewL(HBufC8* aHeader, HBufC8* aBody, |
|
51 TUint8 aPushID, HBufC8* aRemoteAddress); |
|
52 |
|
53 IMPORT_C virtual ~CPushMessage(); |
|
54 IMPORT_C TBool GetAppID(TPtrC8& aAppURI, TInt& aAppID, TBool& aIsAnInt); |
|
55 IMPORT_C TBool GetAppIdL(TPtrC8& aAppURI, TInt& aAppID, TBool& aIsInt); |
|
56 IMPORT_C void GetContentType(TPtrC& aContentType) const; |
|
57 IMPORT_C TBool GetHeaderField(THttpHeaderField aField, TPtrC8& aFieldValue) const; |
|
58 IMPORT_C TBool GetBinaryHeaderField(THttpHeaderField aField, TPtrC8& aFieldValue) const; |
|
59 IMPORT_C TBool GetHeaderField(THttpHeaderField aField, TTime& aTime) const; |
|
60 IMPORT_C TBool GetMessageBody(TPtrC8& aMessageBodyPtr) const; |
|
61 IMPORT_C TBool GetHeader(TPtrC8& aMessageHeaderPtr) const; |
|
62 |
|
63 IMPORT_C TBool GetServerAddress(TPtrC8& aServerAddress) const; |
|
64 IMPORT_C TBool GetPushId(TUint8& aPushID) const; |
|
65 |
|
66 IMPORT_C void SetMessageAllowed(TBool aAllowed); |
|
67 IMPORT_C TBool MessageAllowed() const; |
|
68 |
|
69 private: |
|
70 CPushMessage(HBufC8* aHeader, TUint8 aPushID = 0); |
|
71 void ConstructL(HBufC8* aHeader, HBufC8* aBody, HBufC8* aRemoteAddress); |
|
72 |
|
73 private: |
|
74 CHTTPResponse* iHttpResponse; |
|
75 TPtrC8 iPushHeader; |
|
76 HBufC8* iPushBody; |
|
77 // Buffer containing the a unicode version of the content-type from CHTTPResponse |
|
78 mutable HBufC* iContentType; |
|
79 |
|
80 TUint8 iPushID; |
|
81 |
|
82 // Passed in constructor. Takes ownership. |
|
83 HBufC8* iServerAddress; |
|
84 |
|
85 TBool iAllowed; |
|
86 }; |
|
87 |
|
88 #endif |