williamr@2: // Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@2: // 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 williamr@2: // which accompanies this distribution, and is available williamr@2: // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @file williamr@2: @publishedPartner williamr@2: @released williamr@2: */ williamr@2: williamr@2: #ifndef __PUSHMESSAGE_H__ williamr@2: #define __PUSHMESSAGE_H__ williamr@2: williamr@2: #include williamr@2: #include williamr@2: williamr@2: class RWriteStream; williamr@2: class CHTTPResponse; williamr@2: williamr@2: williamr@2: /** williamr@2: Encapsulates a WAP Push Message. williamr@2: williamr@2: It provides functions to access the headers and body information. There are williamr@2: specific functions to find Application ID, and the Content Type headers as williamr@2: these fields are frequently required. williamr@2: williamr@2: The class also has a function to give Read-Only access to the body of the message. williamr@2: williamr@2: @publishedPartner williamr@2: @released williamr@2: */ williamr@2: class CPushMessage : public CBase williamr@2: { williamr@2: public: williamr@2: IMPORT_C static CPushMessage* NewL(HBufC8* aHeader, HBufC8* aBody); williamr@2: IMPORT_C static CPushMessage* NewL(HBufC8* aHeader, HBufC8* aBody, williamr@2: TUint8 aPushID, HBufC8* aRemoteAddress); williamr@2: williamr@2: IMPORT_C virtual ~CPushMessage(); williamr@2: IMPORT_C TBool GetAppID(TPtrC8& aAppURI, TInt& aAppID, TBool& aIsAnInt); williamr@2: IMPORT_C TBool GetAppIdL(TPtrC8& aAppURI, TInt& aAppID, TBool& aIsInt); williamr@2: IMPORT_C void GetContentType(TPtrC& aContentType) const; williamr@2: IMPORT_C TBool GetHeaderField(THttpHeaderField aField, TPtrC8& aFieldValue) const; williamr@2: IMPORT_C TBool GetBinaryHeaderField(THttpHeaderField aField, TPtrC8& aFieldValue) const; williamr@2: IMPORT_C TBool GetHeaderField(THttpHeaderField aField, TTime& aTime) const; williamr@2: IMPORT_C TBool GetMessageBody(TPtrC8& aMessageBodyPtr) const; williamr@2: IMPORT_C TBool GetHeader(TPtrC8& aMessageHeaderPtr) const; williamr@2: williamr@2: IMPORT_C TBool GetServerAddress(TPtrC8& aServerAddress) const; williamr@2: IMPORT_C TBool GetPushId(TUint8& aPushID) const; williamr@2: williamr@2: IMPORT_C void SetMessageAllowed(TBool aAllowed); williamr@2: IMPORT_C TBool MessageAllowed() const; williamr@2: williamr@2: private: williamr@2: CPushMessage(HBufC8* aHeader, TUint8 aPushID = 0); williamr@2: void ConstructL(HBufC8* aHeader, HBufC8* aBody, HBufC8* aRemoteAddress); williamr@2: williamr@2: private: williamr@2: CHTTPResponse* iHttpResponse; williamr@2: TPtrC8 iPushHeader; williamr@2: HBufC8* iPushBody; williamr@2: // Buffer containing the a unicode version of the content-type from CHTTPResponse williamr@2: mutable HBufC* iContentType; williamr@2: williamr@2: TUint8 iPushID; williamr@2: williamr@2: // Passed in constructor. Takes ownership. williamr@2: HBufC8* iServerAddress; williamr@2: williamr@2: TBool iAllowed; williamr@2: }; williamr@2: williamr@2: #endif