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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
24 #ifndef __PUSHMESSAGE_H__
25 #define __PUSHMESSAGE_H__
28 #include <thttpfields.h>
35 Encapsulates a WAP Push Message.
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.
41 The class also has a function to give Read-Only access to the body of the message.
46 class CPushMessage : public CBase
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);
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;
63 IMPORT_C TBool GetServerAddress(TPtrC8& aServerAddress) const;
64 IMPORT_C TBool GetPushId(TUint8& aPushID) const;
66 IMPORT_C void SetMessageAllowed(TBool aAllowed);
67 IMPORT_C TBool MessageAllowed() const;
70 CPushMessage(HBufC8* aHeader, TUint8 aPushID = 0);
71 void ConstructL(HBufC8* aHeader, HBufC8* aBody, HBufC8* aRemoteAddress);
74 CHTTPResponse* iHttpResponse;
77 // Buffer containing the a unicode version of the content-type from CHTTPResponse
78 mutable HBufC* iContentType;
82 // Passed in constructor. Takes ownership.
83 HBufC8* iServerAddress;