servicediscoveryandcontrol/pnp/test/upnp/SocketHandler/inc/csockethandler.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 02 Feb 2010 01:12:20 +0200
changeset 0 f5a58ecadc66
permissions -rw-r--r--
Revision: 201003

// Copyright (c) 2008-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:
// @internalTechnology
// 
//

#ifndef __CSOCKETHANDLER_H__
#define __CSOCKETHANDLER_H__

#include <e32base.h>
#include <e32cmn.h>
#include <es_mbuf.h>
#include <es_sock.h>
#include <sockhandlerdefs.h>
#include <eintsock.h>

// Forward class references.
class MSocketHandlerObserver;

using namespace SockHandler;
/**
This is an active object which performs all the asynchronous operations of RInternalSocket. 
On completion of the operation CSocketHandler will notify its observer.

@internalComponent
*/
class CSocketHandler : public CActive
	{
	public:
		CSocketHandler ( RInternalSocket& aSocket, MSocketHandlerObserver& aObserver );
		CSocketHandler ( MSocketHandlerObserver& aObserver );
		~CSocketHandler ();
		
		void Activate ( const TSocketHandlerParams& aParams );
		TBool IsRunning ( TOperation aOperation );
		
	protected:	
		// CActive overloads
		void RunL ();
		void DoCancel ();
	
	private:
		void NotifyCompletion ();
		void CancelCurrent ();
		void CompleteSelf ( TInt aError );

	private:
		RInternalSocket				iSocket;
		MSocketHandlerObserver&		iObserver;	// Observer for socket operational success completion & error conditons
		TOperation					iOperation;
		
		RMBufChain					iBufChain;
		TSockAddr					iSockAddr;
		RInternalSocket				iAcceptingSocket;
		TSockXfrLength 				iLength;
	};

#endif // __CSOCKETHANDLER_H__