libdebugger: Add initial version of network interface.
NetworkTargetHostInterface{Info}:
- Barebones classes for implementing a target host interface over TCP.
This commit is contained in:
@@ -59,6 +59,7 @@ SEARCH_SOURCE += [ FDirName $(SUBDIR) source_language c_family ] ;
|
||||
SEARCH_SOURCE += [ FDirName $(SUBDIR) source_language x86 ] ;
|
||||
SEARCH_SOURCE += [ FDirName $(SUBDIR) target_host_interface ] ;
|
||||
SEARCH_SOURCE += [ FDirName $(SUBDIR) target_host_interface local ] ;
|
||||
SEARCH_SOURCE += [ FDirName $(SUBDIR) target_host_interface network ] ;
|
||||
SEARCH_SOURCE += [ FDirName $(SUBDIR) types ] ;
|
||||
SEARCH_SOURCE += [ FDirName $(SUBDIR) user_interface ] ;
|
||||
SEARCH_SOURCE += [ FDirName $(SUBDIR) user_interface util ] ;
|
||||
@@ -266,6 +267,10 @@ local sources =
|
||||
LocalTargetHostInterface.cpp
|
||||
LocalTargetHostInterfaceInfo.cpp
|
||||
|
||||
# target_host_interface/network
|
||||
NetworkTargetHostInterface.cpp
|
||||
NetworkTargetHostInterfaceInfo.cpp
|
||||
|
||||
# types
|
||||
ArrayIndexPath.cpp
|
||||
TargetAddressRangeList.cpp
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <AutoLocker.h>
|
||||
|
||||
#include "LocalTargetHostInterfaceInfo.h"
|
||||
#include "NetworkTargetHostInterfaceInfo.h"
|
||||
#include "TargetHostInterfaceInfo.h"
|
||||
|
||||
|
||||
@@ -100,6 +101,7 @@ TargetHostInterfaceRoster::RegisterInterfaceInfos()
|
||||
interfaceReference.Detach();
|
||||
|
||||
REGISTER_INTERFACE_INFO(Local)
|
||||
REGISTER_INTERFACE_INFO(Network)
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* Copyright 2016, Rene Gollent, [email protected].
|
||||
* Copyright 2016, Ingo Weinhold, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
#include "NetworkTargetHostInterface.h"
|
||||
|
||||
#include <AutoDeleter.h>
|
||||
#include <AutoLocker.h>
|
||||
#include <system_info.h>
|
||||
#include <util/KMessage.h>
|
||||
|
||||
#include "debug_utils.h"
|
||||
|
||||
#include "TargetHost.h"
|
||||
|
||||
|
||||
NetworkTargetHostInterface::NetworkTargetHostInterface()
|
||||
:
|
||||
TargetHostInterface()
|
||||
{
|
||||
SetName("Network");
|
||||
}
|
||||
|
||||
|
||||
NetworkTargetHostInterface::~NetworkTargetHostInterface()
|
||||
{
|
||||
Close();
|
||||
|
||||
if (fTargetHost != NULL)
|
||||
fTargetHost->ReleaseReference();
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
NetworkTargetHostInterface::Init(Settings* settings)
|
||||
{
|
||||
return B_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
NetworkTargetHostInterface::Close()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
NetworkTargetHostInterface::IsLocal() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
NetworkTargetHostInterface::Connected() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
TargetHost*
|
||||
NetworkTargetHostInterface::GetTargetHost()
|
||||
{
|
||||
return fTargetHost;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
NetworkTargetHostInterface::Attach(team_id teamID, thread_id threadID,
|
||||
DebuggerInterface*& _interface) const
|
||||
{
|
||||
return B_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
NetworkTargetHostInterface::CreateTeam(int commandLineArgc,
|
||||
const char* const* arguments, team_id& _teamID) const
|
||||
{
|
||||
return B_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
NetworkTargetHostInterface::LoadCore(const char* coreFilePath,
|
||||
DebuggerInterface*& _interface, thread_id& _thread) const
|
||||
{
|
||||
return B_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
NetworkTargetHostInterface::FindTeamByThread(thread_id thread,
|
||||
team_id& _teamID) const
|
||||
{
|
||||
return B_NOT_SUPPORTED;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright 2016, Rene Gollent, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef NETWORK_TARGET_HOST_INTERFACE_H
|
||||
#define NETWORK_TARGET_HOST_INTERFACE_H
|
||||
|
||||
#include "TargetHostInterface.h"
|
||||
|
||||
|
||||
class NetworkTargetHostInterface : public TargetHostInterface {
|
||||
public:
|
||||
NetworkTargetHostInterface();
|
||||
virtual ~NetworkTargetHostInterface();
|
||||
|
||||
virtual status_t Init(Settings* settings);
|
||||
virtual void Close();
|
||||
|
||||
virtual bool IsLocal() const;
|
||||
virtual bool Connected() const;
|
||||
|
||||
virtual TargetHost* GetTargetHost();
|
||||
|
||||
virtual status_t Attach(team_id id, thread_id threadID,
|
||||
DebuggerInterface*& _interface) const;
|
||||
virtual status_t CreateTeam(int commandLineArgc,
|
||||
const char* const* arguments,
|
||||
team_id& _teamID) const;
|
||||
virtual status_t LoadCore(const char* coreFilePath,
|
||||
DebuggerInterface*& _interface,
|
||||
thread_id& _thread) const;
|
||||
|
||||
virtual status_t FindTeamByThread(thread_id thread,
|
||||
team_id& _teamID) const;
|
||||
|
||||
private:
|
||||
TargetHost* fTargetHost;
|
||||
};
|
||||
|
||||
#endif // NETWORK_TARGET_HOST_INTERFACE_H
|
||||
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Copyright 2016, Rene Gollent, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#include "NetworkTargetHostInterfaceInfo.h"
|
||||
|
||||
#include <AutoDeleter.h>
|
||||
|
||||
#include "NetworkTargetHostInterface.h"
|
||||
#include "SettingsDescription.h"
|
||||
#include "Setting.h"
|
||||
|
||||
|
||||
static const char* kHostnameSetting = "hostname";
|
||||
static const char* kPortSetting = "port";
|
||||
|
||||
|
||||
NetworkTargetHostInterfaceInfo::NetworkTargetHostInterfaceInfo()
|
||||
:
|
||||
TargetHostInterfaceInfo("Network"),
|
||||
fDescription(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
NetworkTargetHostInterfaceInfo::~NetworkTargetHostInterfaceInfo()
|
||||
{
|
||||
delete fDescription;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
NetworkTargetHostInterfaceInfo::Init()
|
||||
{
|
||||
fDescription = new(std::nothrow) SettingsDescription;
|
||||
if (fDescription == NULL)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
Setting* setting = new(std::nothrow) StringSettingImpl(kHostnameSetting,
|
||||
"Hostname", "");
|
||||
if (setting == NULL)
|
||||
return B_NO_MEMORY;
|
||||
ObjectDeleter<Setting> settingDeleter(setting);
|
||||
if (!fDescription->AddSetting(setting))
|
||||
return B_NO_MEMORY;
|
||||
|
||||
settingDeleter.Detach();
|
||||
setting = new(std::nothrow) BoundedSettingImpl(kPortSetting, "Port",
|
||||
(uint16)0, (uint16)65535, (uint16)8305);
|
||||
if (setting == NULL)
|
||||
return B_NO_MEMORY;
|
||||
if (!fDescription->AddSetting(setting)) {
|
||||
delete setting;
|
||||
return B_NO_MEMORY;
|
||||
}
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
NetworkTargetHostInterfaceInfo::IsLocal() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
NetworkTargetHostInterfaceInfo::IsConfigured(Settings* settings) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
SettingsDescription*
|
||||
NetworkTargetHostInterfaceInfo::GetSettingsDescription() const
|
||||
{
|
||||
return fDescription;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
NetworkTargetHostInterfaceInfo::CreateInterface(Settings* settings,
|
||||
TargetHostInterface*& _interface) const
|
||||
{
|
||||
NetworkTargetHostInterface* interface
|
||||
= new(std::nothrow) NetworkTargetHostInterface;
|
||||
if (interface == NULL)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
status_t error = interface->Init(settings);
|
||||
if (error != B_OK) {
|
||||
delete interface;
|
||||
return error;
|
||||
}
|
||||
|
||||
_interface = interface;
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright 2016, Rene Gollent, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef NETWORK_TARGET_HOST_INTERFACE_INFO_H
|
||||
#define NETWORK_TARGET_HOST_INTERFACE_INFO_H
|
||||
|
||||
#include "TargetHostInterfaceInfo.h"
|
||||
|
||||
|
||||
class NetworkTargetHostInterfaceInfo : public TargetHostInterfaceInfo {
|
||||
public:
|
||||
NetworkTargetHostInterfaceInfo();
|
||||
virtual ~NetworkTargetHostInterfaceInfo();
|
||||
|
||||
virtual status_t Init();
|
||||
|
||||
virtual bool IsLocal() const;
|
||||
virtual bool IsConfigured(Settings* settings) const;
|
||||
virtual SettingsDescription* GetSettingsDescription() const;
|
||||
|
||||
virtual status_t CreateInterface(Settings* settings,
|
||||
TargetHostInterface*& _interface) const;
|
||||
|
||||
private:
|
||||
BString fName;
|
||||
SettingsDescription* fDescription;
|
||||
};
|
||||
|
||||
#endif // NETWORK_TARGET_HOST_INTERFACE_INFO_H
|
||||
Reference in New Issue
Block a user