diff -r 9f5ae1728557 -r db3f5fa34ec7 messagingfw/biomsgfw/BioWatchers/Inc/WapSocketWatcher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingfw/biomsgfw/BioWatchers/Inc/WapSocketWatcher.h Wed Nov 03 22:41:46 2010 +0530 @@ -0,0 +1,141 @@ +// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// BIO-message Socket Port Watcher +// +// + +#ifndef WAPSOCKETWATCHER_H__ +#define WAPSOCKETWATCHER_H__ + +#include +#include +#include +#include +#include + + +#include +#include "SmsSocketWatcher.h" +#include + +#include + +const TInt KReceiveBufferSize = 256; +const TInt KWspReceiveHeaderSize = 64; + + +//********************************** +// CWapPortWatcher +//********************************** +// +// +// +class CWapPortWatcher : public CBaseSmsActiveSocketWatcher + { + public: + static CWapPortWatcher* NewL(TMsvId aBioServiceId, + TMsvId aSmsServiceId, + CBIODatabase& aBioDb, + CWatcherLog& aWatcherLog, + TInt aPriority, + TUid aBioID, + RFs& aFs, + const TBioMsgId& aBioMsg); + ~CWapPortWatcher(); + + protected: + CWapPortWatcher(CWatcherLog& aWatcherLog, TInt aPriority, TUid aBioID, RFs& aFs, Wap::TPort aWapPort); + void DoReceiveL(const TDesC8& aRecvFrom); + + void DoComplete(TInt&); + virtual void CloseConn(); + void AppendToHBufC8L(HBufC8*& aBuf, const TDesC8& aAppend); + + void DoRunL(); + void CompleteSelf(); + protected: + //The entire received message + HBufC8* iRecvBuf; + Wap::TPort iWapPort; + }; + + + +// +// CWdpPortWatcher +// + +class CWdpPortWatcher : public CWapPortWatcher + { + public: + CWdpPortWatcher(CWatcherLog& aWatcherLog, TInt aPriority, TUid aBioID, RFs& aFs, TUint16 aWapPort); + ~CWdpPortWatcher(); + void DoCancel(); + void DoSetupL(); + + private: + void CloseConn(); + void WaitForMessageL(); + void ReceiveL(); + + private: + //Members required for receiving + TBuf8 iRemoteAddress; + Wap::TPort iRemotePort; + CWapBoundDatagramService* iWdpConn; + TBool iTruncated; + + TPtr8 iRecvPtr; + TUint16 iDataSize; + TPckg iDataSizePckg; + + enum TWdpRecvState + { + ERecvSize, + ERecv + } iRecvNext; + }; + + + +// +// CWspPortWatcher +// + +class CWspPortWatcher : public CWapPortWatcher + { + public: + CWspPortWatcher(CWatcherLog& aWatcherLog, TInt aPriority, TUid aBioID, RFs& aFs, TUint16 aWapPort); + ~CWspPortWatcher(); + + void DoCancel(); + void DoSetupL(); + + private: + void CloseConn(); + void WaitForMessageL(); + void ReceiveL(); + + private: + //Members required for receiving + HBufC8* iRecvHeader; + TPckgBuf iPushPckgId; + CWapBoundCLPushService* iWspConn; + + //Used to receive parts of each message. + TBuf8 iTempRecvBuf; + TBuf8 iTempRecvHeader; + }; + +#endif //WAPSOCKETWATCHER_H__