RASCSI/cpp/scsictl/scsictl_commands.h
Uwe Seimet 41bdcd4aed
Issues 1179 and 1182 (#1232)
* Update logging

* Remove duplicate code

* Update unit tests

* Clean up includes

* Merge ProtobufSerializer into protobuf_util namespace

* Precompile regex

* Add const

* Add Split() convenience method, update log level/ID parsing

* Move log.h to legacy folder

* Elimininate gotos

* Fixes for gcc 13

* Update compiler flags

* Update default folder handling

* Use references instead of pointers

* Move code for better encapsulation

* Move code

* Remove unused method argument

* Move device logger

* Remove redundant to_string

* Rename for consistency

* Update handling of protobuf pointers

* Simplify protobuf usage

* Memory handling update

* Add hasher
2023-10-15 08:38:15 +02:00

63 lines
1.5 KiB
C++

//---------------------------------------------------------------------------
//
// SCSI Target Emulator PiSCSI
// for Raspberry Pi
//
// Copyright (C) 2021-2023 Uwe Seimet
//
//---------------------------------------------------------------------------
#pragma once
#include "generated/piscsi_interface.pb.h"
#include "scsictl_display.h"
#include <string>
using namespace piscsi_interface;
struct sockaddr_in;
class ScsictlCommands
{
public:
ScsictlCommands(PbCommand& command, const string& hostname, int port)
: command(command), hostname(hostname), port(port) {}
~ScsictlCommands() = default;
bool Execute(string_view, string_view, string_view, string_view, string_view);
bool CommandDevicesInfo();
private:
bool CommandLogLevel(string_view);
bool CommandReserveIds(string_view);
bool CommandCreateImage(string_view);
bool CommandDeleteImage(string_view);
bool CommandRenameImage(string_view);
bool CommandCopyImage(string_view);
bool CommandDefaultImageFolder(string_view);
bool CommandDeviceInfo();
bool CommandDeviceTypesInfo();
bool CommandVersionInfo();
bool CommandServerInfo();
bool CommandDefaultImageFilesInfo();
bool CommandImageFileInfo(string_view);
bool CommandNetworkInterfacesInfo();
bool CommandLogLevelInfo();
bool CommandReservedIdsInfo();
bool CommandMappingInfo();
bool CommandOperationInfo();
bool SendCommand();
bool EvaluateParams(string_view, const string&, const string&);
PbCommand& command;
string hostname;
int port;
PbResult result;
[[no_unique_address]] const ScsictlDisplay scsictl_display;
};