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