2021-10-06 23:25:43 +02:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
2022-12-05 09:58:23 -08:00
|
|
|
// SCSI Target Emulator PiSCSI
|
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-11-10 07:44:06 +01:00
|
|
|
#include "shared/protobuf_serializer.h"
|
2022-12-05 09:58:23 -08:00
|
|
|
#include "generated/piscsi_interface.pb.h"
|
|
|
|
#include "scsictl_display.h"
|
2021-10-06 23:25:43 +02:00
|
|
|
#include <string>
|
|
|
|
|
2022-12-05 09:58:23 -08:00
|
|
|
using namespace piscsi_interface;
|
2021-10-06 23:25:43 +02:00
|
|
|
|
2022-10-23 21:51:39 +02:00
|
|
|
struct sockaddr_in;
|
|
|
|
|
2022-12-05 09:58:23 -08:00
|
|
|
class ScsictlCommands
|
2021-10-06 23:25:43 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2022-12-05 09:58:23 -08:00
|
|
|
ScsictlCommands(PbCommand& command, const string& hostname, int port)
|
2022-10-23 21:51:39 +02:00
|
|
|
: command(command), hostname(hostname), port(port) {}
|
2022-12-05 09:58:23 -08:00
|
|
|
~ScsictlCommands() = 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;
|
|
|
|
|
2022-12-05 09:58:23 -08:00
|
|
|
ScsictlDisplay scsictl_display;
|
2021-10-06 23:25:43 +02:00
|
|
|
};
|