commands/testexecute/ProxyServer.h
author Tom Sutcliffe <thomas.sutcliffe@accenture.com>
Sat, 31 Jul 2010 19:07:57 +0100
changeset 23 092bcc217d9d
parent 5 9c58252c6740
permissions -rw-r--r--
Tidied iocli exports, build macro tweaks. Removed 4 overloads of CCommandBase::RunCommand[L] that are no longer used at all, and changed one more to not be exported as it's only used internally to iocli.dll. fixed builds on platforms that don't support btrace or any form of tracing.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
     1
// ProxyServer.h
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
     2
// 
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
     3
// Copyright (c) 2010 Accenture. All rights reserved.
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
     4
// This component and the accompanying materials are made available
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
     5
// under the terms of the "Eclipse Public License v1.0"
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
     6
// which accompanies this distribution, and is available
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
     7
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
     8
// 
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
     9
// Initial Contributors:
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    10
// Accenture - Initial contribution
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    11
//
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    12
#ifndef PROXYSERVER_H
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    13
#define PROXYSERVER_H
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    14
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    15
#include <fshell/memoryaccess.h>
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    16
#include <e32base.h>
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    17
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    18
class CProxySession;
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    19
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    20
class MMessageHandler
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    21
	{
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    22
public:
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    23
	virtual TBool HandleMessageL(CProxySession* aSession, const RMessage2& aMessage)=0;
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    24
	};
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    25
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    26
NONSHARABLE_CLASS(CProxyServer) : public CServer2
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    27
	{
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    28
public:
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    29
	static CProxyServer* NewInSeparateThreadL(const TDesC& aServerToReplace, MMessageHandler* aHandler=NULL);
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    30
	void Destroy(); // This should be used instead of delete - the server object has to be destroyed from the thread in which it was started
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    31
	MMessageHandler* Handler() const;
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    32
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    33
protected:
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    34
	CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const;
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    35
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    36
private:
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    37
	~CProxyServer();
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    38
	CProxyServer(const TDesC& aServerToReplace, MMessageHandler* aHandler);
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    39
	void ConstructL();
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    40
	void ThreadConstructL();
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    41
	static TInt StartServerThreadFunction(TAny* aSelf);
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    42
	void ServerThreadRunL();
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    43
	static TInt Shutdown(TAny* aSelf);
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    44
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    45
private:
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    46
	RMemoryAccess iMemAccess;
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    47
	TBool iProxying;
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    48
	TName iServerName;
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    49
	TName iRealServerName;
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    50
	RThread iServerThread;
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    51
	MMessageHandler* iHandler;
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    52
	CAsyncCallBack* iShutdownCallback;
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    53
	};
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    54
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    55
class RUnderlyingSession : public RSessionBase
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    56
	{
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    57
public:
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    58
	friend class CProxySession;
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    59
	friend class CAsyncWaiter;
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    60
	};
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    61
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    62
NONSHARABLE_CLASS(CProxySession) : public CSession2
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    63
	{
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    64
public:
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    65
	void ConstructL(const TDesC& aServerName, const TVersion& aVersion);
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    66
	void ForwardUnhandledMessageL(const RMessage2& aMessage);
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    67
	void ForwardMessageArgsL(const RMessage2& aMessage, const TIpcArgs& aArgs);
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    68
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    69
protected:
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    70
	void ServiceL(const RMessage2 &aMessage);
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    71
	void Disconnect(const RMessage2 &aMessage);
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    72
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    73
private:
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    74
	CProxyServer& Server();
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    75
	const CProxyServer& Server() const;
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    76
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    77
private:
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    78
	RUnderlyingSession iSession;
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    79
	};
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    80
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    81
9c58252c6740 Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff changeset
    82
#endif