messagingfw/wappushfw/pushwatcher/inc/CLWatcher.h
changeset 0 8e480a14352b
equal deleted inserted replaced
-1:000000000000 0:8e480a14352b
       
     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 // WAP Push Message Header File - 
       
    15 // This file contains the classes for Concrete Secure/Unsecure CL Watcher and connectionless Watcher Base Class
       
    16 // 
       
    17 //
       
    18 
       
    19 /**
       
    20  @file CLWatcher.H
       
    21 */
       
    22 
       
    23 #ifndef __CLWATCHER_H__
       
    24 #define __CLWATCHER_H__
       
    25 
       
    26 // System Include
       
    27 #include <e32base.h>
       
    28 #include <push/pushlog.h>
       
    29 #include "cmanobserver.h"
       
    30 #include <push/murilistlookup.h>
       
    31 
       
    32 // User Include
       
    33 // User Include
       
    34 #include "errorcodes.h"
       
    35 // Forward Declares
       
    36 class CWapPushMessageFilter;
       
    37 class CWapBoundCLPushService;
       
    38 
       
    39 /**
       
    40  * KRecieveBufferSize
       
    41  *
       
    42  *	Pre-allocated buffer size for recieving a Push Message.  
       
    43  */
       
    44 const TInt KRecieveBufferSize=256;  
       
    45 
       
    46 
       
    47 /**
       
    48  * PushPorts
       
    49  */
       
    50 const Wap::TPort KPushPortUnsecure = 2948; 
       
    51 const Wap::TPort KPushPortSecure = 2949; 
       
    52 
       
    53 
       
    54 /**
       
    55  *		Connectionless Watcher Base Class
       
    56  *		Connects to the WapStack, waits for a Push Message, dispatches it, waits
       
    57  */
       
    58 //##ModelId=3B659EEA027E
       
    59 class CCLWatcherBase : public CActive
       
    60 /**
       
    61 @internalComponent
       
    62 @released
       
    63 */
       
    64 	{
       
    65 public:
       
    66 	//##ModelId=3B659EEB0009
       
    67 	virtual ~CCLWatcherBase();
       
    68 
       
    69 
       
    70 	enum TCLWatcherBasePanic 
       
    71 		{
       
    72 		ENoMessageExists,
       
    73 		EUnknownState
       
    74 		};
       
    75 
       
    76 protected:
       
    77 	//##ModelId=3B659EEA03CB
       
    78 	CCLWatcherBase(MWapPushLog& aLog, MConnManObserver& aManager); 
       
    79 	
       
    80 	//##ModelId=3B659EEA03CA
       
    81 	void ConstructL();
       
    82 
       
    83 	// Called by ConstructL()
       
    84 	// Override and use for initialization
       
    85 	//##ModelId=3B659EEA03C9
       
    86 	virtual void SetupCLWatcherL() = 0;
       
    87 
       
    88 	// CActive 
       
    89 	//##ModelId=3B659EEA03BF
       
    90 	void RunL();
       
    91 	//##ModelId=3B659EEA03AD
       
    92 	TInt RunError(TInt aError);
       
    93 	//##ModelId=3B659EEA03AC
       
    94 	void DoCancel();
       
    95 	
       
    96 	//##ModelId=3B659EEA03AB
       
    97 	void IdleComplete();
       
    98 
       
    99 	//##ModelId=3B659EEA0398
       
   100 	void Panic(TCLWatcherBasePanic aPanicCode);
       
   101 
       
   102 private:
       
   103 
       
   104 	//##ModelId=3B659EEA0397
       
   105 	void WaitForPushL();
       
   106 	//##ModelId=3B659EEA038F
       
   107 	void ReceivePushL();
       
   108 	//##ModelId=3B659EEA038E
       
   109 	void DispatchMessageL();
       
   110 	//##ModelId=3B659EEA038D
       
   111 	void FilterMessageL();
       
   112 
       
   113 protected:	
       
   114 
       
   115 	enum TCLWatcherState 
       
   116 		{ 
       
   117 		EWaiting, 
       
   118 		EReceiving,
       
   119 		EFiltering, 
       
   120 		EDispatching
       
   121 		} iState;
       
   122 	
       
   123 
       
   124 	//##ModelId=3B659EEA037B
       
   125 	MWapPushLog&				iLog;
       
   126 	//##ModelId=3B659EEA0365
       
   127 	MConnManObserver&			iManager;
       
   128 
       
   129 	//##ModelId=3B659EEA033F
       
   130 	CWapBoundCLPushService		*iWapCLServ;
       
   131 
       
   132 	//##ModelId=3B659EEA030D
       
   133 	TBuf8<KRecieveBufferSize>	iBodyBuf;
       
   134 	//##ModelId=3B659EEA02F9
       
   135 	TBuf8<KRecieveBufferSize>	iHeadersBuf;
       
   136 	//##ModelId=3B659EEA02D8
       
   137 	HBufC8*						iBody;
       
   138 	//##ModelId=3B659EEA02CE
       
   139 	HBufC8*						iHeaders;
       
   140 	//##ModelId=3B659EEA02BC
       
   141 	TPckgBuf<TUint8>			iPushID;
       
   142 	//##ModelId=3B659EEA02B2
       
   143 	TBool						iCachedFilter;
       
   144 	//##ModelId=3B659E71016E
       
   145 	CWapPushMessageFilter*		iPushMsgFilter;
       
   146 	//##ModelId=3B659E710164
       
   147 	TBool						iPassedFilter;
       
   148 
       
   149 	//##ModelId=3B659EEA0292
       
   150 	CPushMessage*				iCurrentMessage;
       
   151 
       
   152 	HBufC8* iServerAddress;
       
   153 	
       
   154 private: 
       
   155 	MUriListLookup* iUriListLookup;
       
   156 	};
       
   157 
       
   158 /**
       
   159  * Concrete Unsecure CL Watcher
       
   160  */
       
   161 //##ModelId=3B659EE401D5
       
   162 class CCLUnsecureWatcher : public CCLWatcherBase
       
   163 /**
       
   164 @internalComponent
       
   165 @released
       
   166 */
       
   167 	{
       
   168 public:
       
   169 	//##ModelId=3B659EE401EF
       
   170 	static CCLUnsecureWatcher* NewL(MWapPushLog& aLog, MConnManObserver& aManager);
       
   171 	//##ModelId=3B659EE401EE
       
   172 	~CCLUnsecureWatcher();
       
   173 
       
   174 protected:
       
   175 	//##ModelId=3B659EE401ED
       
   176 	virtual void SetupCLWatcherL();
       
   177 
       
   178 private:
       
   179 	//##ModelId=3B659EE401EA
       
   180 	CCLUnsecureWatcher(MWapPushLog& aLog,MConnManObserver& aManager) : CCLWatcherBase(aLog,aManager){};
       
   181 	};
       
   182 
       
   183 /**
       
   184  * Concrete Secure CL Watcher
       
   185  */
       
   186 //##ModelId=3B659EE00388
       
   187 class CCLSecureWatcher : public CCLWatcherBase
       
   188 /**
       
   189 @internalComponent
       
   190 @released
       
   191 */
       
   192 	{
       
   193 public:
       
   194 	//##ModelId=3B659EE003A1
       
   195 	static CCLSecureWatcher* NewL(MWapPushLog& aLog, MConnManObserver& aManager);
       
   196 	//##ModelId=3B659EE003A0
       
   197 	~CCLSecureWatcher();
       
   198 
       
   199 protected:
       
   200 	//##ModelId=3B659EE0039F
       
   201 	virtual void SetupCLWatcherL();
       
   202 
       
   203 private:
       
   204 	//##ModelId=3B659EE0039C
       
   205 	CCLSecureWatcher(MWapPushLog& aLog,MConnManObserver& aManager) : CCLWatcherBase(aLog,aManager){};
       
   206 	};
       
   207 
       
   208 
       
   209 #endif