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