mirror of
https://github.com/akuker/RASCSI.git
synced 2024-11-29 16:49:55 +00:00
52c2aa474f
* Rebrand project to PiSCSI - rascsi ->piscsi - rasctl -> scsictl - rasdump -> scsidump - ras* -> piscsi* (rasutil -> piscsi_util, etc.) * Refined the formatting and wording of the app startup banner * Kept some references to rascsi and rasctl where backwards compatibility is concerned * Point to the new github repo URL Co-authored-by: nucleogenic <nr@nucleogenic.com> Co-authored-by: Uwe Seimet <Uwe.Seimet@seimet.de>
51 lines
992 B
C++
51 lines
992 B
C++
//---------------------------------------------------------------------------
|
|
//
|
|
// SCSI Target Emulator PiSCSI
|
|
// for Raspberry Pi
|
|
//
|
|
// Copyright (C) 2022 Uwe Seimet
|
|
//
|
|
//---------------------------------------------------------------------------
|
|
|
|
#include "generated/piscsi_interface.pb.h"
|
|
#include <string>
|
|
#include <unordered_map>
|
|
|
|
using namespace std;
|
|
using namespace piscsi_interface;
|
|
|
|
class ScsictlParser
|
|
{
|
|
|
|
public:
|
|
|
|
ScsictlParser() = default;
|
|
~ScsictlParser() = default;
|
|
|
|
PbOperation ParseOperation(const string&) const;
|
|
PbDeviceType ParseType(const string&) const;
|
|
|
|
private:
|
|
|
|
unordered_map<int, PbOperation> operations = {
|
|
{ 'a', ATTACH },
|
|
{ 'd', DETACH },
|
|
{ 'e', EJECT },
|
|
{ 'i', INSERT },
|
|
{ 'p', PROTECT },
|
|
{ 's', DEVICES_INFO },
|
|
{ 'u', UNPROTECT }
|
|
};
|
|
|
|
unordered_map<int, PbDeviceType> device_types = {
|
|
{ 'b', SCBR },
|
|
{ 'c', SCCD },
|
|
{ 'd', SCDP },
|
|
{ 'h', SCHD },
|
|
{ 'l', SCLP },
|
|
{ 'm', SCMO },
|
|
{ 'r', SCRM },
|
|
{ 's', SCHS }
|
|
};
|
|
};
|