2021-10-06 23:25:43 +02:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
2022-08-25 18:01:39 -07:00
|
|
|
// SCSI Target Emulator RaSCSI Reloaded
|
2021-10-06 23:25:43 +02:00
|
|
|
// for Raspberry Pi
|
|
|
|
//
|
2022-10-08 19:26:04 +02:00
|
|
|
// Copyright (C) 2021-2022 Uwe Seimet
|
2021-10-06 23:25:43 +02:00
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2022-10-04 17:23:42 +02:00
|
|
|
#include "protobuf_serializer.h"
|
2021-10-06 23:25:43 +02:00
|
|
|
#include "rascsi_interface.pb.h"
|
|
|
|
#include "rasctl_display.h"
|
|
|
|
#include <string>
|
|
|
|
|
2022-10-04 17:23:42 +02:00
|
|
|
using namespace rascsi_interface;
|
2021-10-06 23:25:43 +02:00
|
|
|
|
2022-10-23 21:51:39 +02:00
|
|
|
struct sockaddr_in;
|
|
|
|
|
2021-10-06 23:25:43 +02:00
|
|
|
class RasctlCommands
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2022-10-23 21:51:39 +02:00
|
|
|
RasctlCommands(PbCommand& command, const string& hostname, int port)
|
|
|
|
: command(command), hostname(hostname), port(port) {}
|
2022-09-07 16:38:42 +02:00
|
|
|
~RasctlCommands() = default;
|
2021-10-06 23:25:43 +02:00
|
|
|
|
2022-10-23 21:51:39 +02:00
|
|
|
bool Execute(const string&, const string&, const string&, const string&, const string&);
|
2022-09-25 23:49:24 +02:00
|
|
|
|
2022-10-23 21:51:39 +02:00
|
|
|
bool CommandDevicesInfo();
|
2022-09-25 23:49:24 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2022-10-23 21:51:39 +02: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 23:25:43 +02:00
|
|
|
|
2022-10-08 19:26:04 +02:00
|
|
|
static bool ResolveHostName(const string&, sockaddr_in *);
|
|
|
|
|
2022-10-04 17:23:42 +02:00
|
|
|
ProtobufSerializer serializer;
|
2022-10-23 21:51:39 +02:00
|
|
|
PbCommand& command;
|
2021-10-06 23:25:43 +02:00
|
|
|
string hostname;
|
|
|
|
int port;
|
|
|
|
|
|
|
|
PbResult result;
|
|
|
|
|
|
|
|
RasctlDisplay rasctl_display;
|
|
|
|
};
|