2021-09-24 08:48:48 +02:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// SCSI Target Emulator RaSCSI (*^..^*)
|
|
|
|
// for Raspberry Pi
|
|
|
|
//
|
|
|
|
// Copyright (C) 2021 Uwe Seimet
|
|
|
|
//
|
|
|
|
// A singleton that creates responses for protobuf interface requests
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "devices/device_factory.h"
|
|
|
|
#include "rascsi_interface.pb.h"
|
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
using namespace rascsi_interface;
|
|
|
|
|
|
|
|
class Device;
|
|
|
|
|
|
|
|
class ProtobufResponseHandler
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
ProtobufResponseHandler();
|
|
|
|
~ProtobufResponseHandler() {};
|
|
|
|
|
|
|
|
static ProtobufResponseHandler& instance();
|
|
|
|
|
2021-09-30 19:22:57 +02:00
|
|
|
bool GetImageFile(PbImageFile *, const string&, const string&);
|
2021-09-24 08:48:48 +02:00
|
|
|
PbImageFilesInfo *GetAvailableImages(PbResult&, const string&);
|
2021-10-06 23:25:43 +02:00
|
|
|
PbReservedIdsInfo *GetReservedIds(PbResult&, const set<int>&);
|
2021-09-24 08:48:48 +02:00
|
|
|
void GetDevices(PbServerInfo&, const vector<Device *>&, const string&);
|
|
|
|
void GetDevicesInfo(PbResult&, const PbCommand&, const vector<Device *>&, const string&, int);
|
|
|
|
PbDeviceTypesInfo *GetDeviceTypesInfo(PbResult&, const PbCommand&);
|
2021-10-06 23:25:43 +02:00
|
|
|
PbVersionInfo *GetVersionInfo(PbResult&);
|
2021-09-24 08:48:48 +02:00
|
|
|
PbServerInfo *GetServerInfo(PbResult&, const vector<Device *>&, const set<int>&, const string&, const string&);
|
|
|
|
PbNetworkInterfacesInfo *GetNetworkInterfacesInfo(PbResult&);
|
2021-09-28 01:39:50 +02:00
|
|
|
PbMappingInfo *GetMappingInfo(PbResult&);
|
2021-10-06 23:25:43 +02:00
|
|
|
PbLogLevelInfo *GetLogLevelInfo(PbResult&, const string&);
|
2021-09-24 08:48:48 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
DeviceFactory device_factory;
|
|
|
|
|
|
|
|
vector<string> log_levels;
|
|
|
|
|
|
|
|
PbDeviceProperties *GetDeviceProperties(const Device *);
|
|
|
|
void GetDevice(const Device *, PbDevice *, const string&);
|
|
|
|
void GetAllDeviceTypeProperties(PbDeviceTypesInfo&);
|
|
|
|
void GetDeviceTypeProperties(PbDeviceTypesInfo&, PbDeviceType);
|
|
|
|
void GetAvailableImages(PbResult& result, PbServerInfo&, const string&);
|
|
|
|
};
|