2021-10-06 21:25:43 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
2022-08-26 01:01:39 +00:00
|
|
|
// SCSI Target Emulator RaSCSI Reloaded
|
2021-10-06 21:25:43 +00:00
|
|
|
// for Raspberry Pi
|
|
|
|
//
|
2022-10-08 17:26:04 +00:00
|
|
|
// Copyright (C) 2021-2022 Uwe Seimet
|
2021-10-06 21:25:43 +00:00
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2022-11-10 06:44:06 +00:00
|
|
|
#include "shared/protobuf_serializer.h"
|
|
|
|
#include "generated/rascsi_interface.pb.h"
|
2021-10-06 21:25:43 +00:00
|
|
|
#include "rasctl_display.h"
|
|
|
|
#include <string>
|
|
|
|
|
2022-10-04 15:23:42 +00:00
|
|
|
using namespace rascsi_interface;
|
2021-10-06 21:25:43 +00:00
|
|
|
|
2022-10-23 19:51:39 +00:00
|
|
|
struct sockaddr_in;
|
|
|
|
|
2021-10-06 21:25:43 +00:00
|
|
|
class RasctlCommands
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2022-10-23 19:51:39 +00:00
|
|
|
RasctlCommands(PbCommand& command, const string& hostname, int port)
|
|
|
|
: command(command), hostname(hostname), port(port) {}
|
2022-09-07 14:38:42 +00:00
|
|
|
~RasctlCommands() = default;
|
2021-10-06 21:25:43 +00:00
|
|
|
|
2022-10-23 19:51:39 +00:00
|
|
|
bool Execute(const string&, const string&, const string&, const string&, const string&);
|
2022-09-25 21:49:24 +00:00
|
|
|
|
2022-10-23 19:51:39 +00:00
|
|
|
bool CommandDevicesInfo();
|
2022-09-25 21:49:24 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2022-10-23 19:51:39 +00:00
|
|
|
bool CommandLogLevel(const string&);
|
|
|
|
bool CommandReserveIds(const string&);
|
|
|
|
bool CommandCreateImage(const string&);
|
|
|
|
bool CommandDeleteImage(const string&);
|
|
|
|
bool CommandRenameImage(const string&);
|
|
|
|
bool CommandCopyImage(const string&);
|
|
|
|
bool CommandDefaultImageFolder(const string&);
|
|
|
|
bool CommandDeviceInfo();
|
|
|
|
bool CommandDeviceTypesInfo();
|
|
|
|
bool CommandVersionInfo();
|
|
|
|
bool CommandServerInfo();
|
|
|
|
bool CommandDefaultImageFilesInfo();
|
|
|
|
bool CommandImageFileInfo(const string&);
|
|
|
|
bool CommandNetworkInterfacesInfo();
|
|
|
|
bool CommandLogLevelInfo();
|
|
|
|
bool CommandReservedIdsInfo();
|
|
|
|
bool CommandMappingInfo();
|
|
|
|
bool CommandOperationInfo();
|
|
|
|
bool SendCommand();
|
2021-10-06 21:25:43 +00:00
|
|
|
|
2022-10-08 17:26:04 +00:00
|
|
|
static bool ResolveHostName(const string&, sockaddr_in *);
|
|
|
|
|
2022-10-04 15:23:42 +00:00
|
|
|
ProtobufSerializer serializer;
|
2022-10-23 19:51:39 +00:00
|
|
|
PbCommand& command;
|
2021-10-06 21:25:43 +00:00
|
|
|
string hostname;
|
|
|
|
int port;
|
|
|
|
|
|
|
|
PbResult result;
|
|
|
|
|
|
|
|
RasctlDisplay rasctl_display;
|
|
|
|
};
|