epoc32/include/push/pushmessage.h
branchSymbian2
changeset 2 2fe1408b6811
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/push/pushmessage.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,88 @@
     1.4 +// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// 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
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +
    1.20 +
    1.21 +/**
    1.22 + @file
    1.23 + @publishedPartner
    1.24 + @released
    1.25 +*/
    1.26 +
    1.27 +#ifndef __PUSHMESSAGE_H__
    1.28 +#define __PUSHMESSAGE_H__
    1.29 +
    1.30 +#include <e32base.h>
    1.31 +#include <thttpfields.h>
    1.32 +
    1.33 +class RWriteStream;
    1.34 +class CHTTPResponse;
    1.35 +
    1.36 +
    1.37 +/** 
    1.38 +Encapsulates a WAP Push Message.
    1.39 +
    1.40 +It provides functions to access the headers and body information. There are 
    1.41 +specific functions to find Application ID, and the Content Type headers as 
    1.42 +these fields are frequently required. 
    1.43 +
    1.44 +The class also has a function to give Read-Only access to the body of the message. 
    1.45 +
    1.46 +@publishedPartner
    1.47 +@released
    1.48 +*/
    1.49 +class CPushMessage : public CBase
    1.50 +	{
    1.51 +public:
    1.52 +	IMPORT_C static CPushMessage* NewL(HBufC8* aHeader, HBufC8* aBody);
    1.53 +	IMPORT_C static CPushMessage* NewL(HBufC8* aHeader, HBufC8* aBody, 
    1.54 +								TUint8 aPushID, HBufC8* aRemoteAddress);	
    1.55 +
    1.56 +	IMPORT_C virtual ~CPushMessage();  
    1.57 +	IMPORT_C TBool GetAppID(TPtrC8& aAppURI, TInt& aAppID, TBool& aIsAnInt);
    1.58 +	IMPORT_C TBool GetAppIdL(TPtrC8& aAppURI, TInt& aAppID, TBool& aIsInt);	
    1.59 +	IMPORT_C void  GetContentType(TPtrC& aContentType) const;
    1.60 +	IMPORT_C TBool GetHeaderField(THttpHeaderField aField, TPtrC8& aFieldValue) const;
    1.61 +	IMPORT_C TBool GetBinaryHeaderField(THttpHeaderField aField, TPtrC8& aFieldValue) const;
    1.62 +	IMPORT_C TBool GetHeaderField(THttpHeaderField aField, TTime& aTime) const;
    1.63 +	IMPORT_C TBool GetMessageBody(TPtrC8& aMessageBodyPtr) const;
    1.64 +	IMPORT_C TBool GetHeader(TPtrC8& aMessageHeaderPtr) const;
    1.65 +
    1.66 +	IMPORT_C TBool GetServerAddress(TPtrC8& aServerAddress) const;
    1.67 +	IMPORT_C TBool GetPushId(TUint8& aPushID) const;
    1.68 +	
    1.69 +	IMPORT_C void SetMessageAllowed(TBool aAllowed);
    1.70 +	IMPORT_C TBool MessageAllowed() const;
    1.71 +
    1.72 +private:
    1.73 +	CPushMessage(HBufC8* aHeader, TUint8 aPushID = 0);
    1.74 +	void ConstructL(HBufC8* aHeader, HBufC8* aBody, HBufC8* aRemoteAddress);
    1.75 +
    1.76 +private:
    1.77 +	CHTTPResponse* iHttpResponse;
    1.78 +	TPtrC8 iPushHeader;
    1.79 +	HBufC8* iPushBody;
    1.80 +	// Buffer containing the a unicode version of the content-type from CHTTPResponse
    1.81 +	mutable HBufC* iContentType;
    1.82 +
    1.83 +	TUint8 iPushID;
    1.84 +
    1.85 +	// Passed in constructor. Takes ownership.
    1.86 +	HBufC8* iServerAddress;
    1.87 +	
    1.88 +	TBool iAllowed;
    1.89 +	};
    1.90 +
    1.91 +#endif