1/*
2 * Copyright 2016, Rene Gollent, rene@gollent.com.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef LOCAL_TARGET_HOST_INTERFACE_H
6#define LOCAL_TARGET_HOST_INTERFACE_H
7
8#include "TargetHostInterface.h"
9
10
11class LocalTargetHostInterface : public TargetHostInterface {
12public:
13								LocalTargetHostInterface();
14	virtual						~LocalTargetHostInterface();
15
16	virtual	status_t			Init(Settings* settings);
17	virtual	void				Close();
18
19	virtual	bool				IsLocal() const;
20	virtual	bool				Connected() const;
21
22	virtual	TargetHost*			GetTargetHost();
23
24	virtual	status_t			Attach(team_id id, thread_id threadID,
25									DebuggerInterface*& _interface) const;
26	virtual	status_t			CreateTeam(int commandLineArgc,
27									const char* const* arguments,
28									team_id& _teamID) const;
29	virtual	status_t			LoadCore(const char* coreFilePath,
30									DebuggerInterface*& _interface,
31									thread_id& _thread) const;
32
33	virtual	status_t			FindTeamByThread(thread_id thread,
34									team_id& _teamID) const;
35
36
37private:
38	static	status_t			_PortLoop(void* arg);
39			status_t			_HandleTeamEvent(team_id team, int32 opcode,
40									bool& addToWaiters);
41
42private:
43			TargetHost*			fTargetHost;
44			port_id				fDataPort;
45			thread_id			fPortWorker;
46};
47
48#endif	// LOCAL_TARGET_HOST_INTERFACE_H
49