//--------------------------------------------------------------------------- // // SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2022 Uwe Seimet // //--------------------------------------------------------------------------- #include "generated/piscsi_interface.pb.h" #include #include 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 operations = { { 'a', ATTACH }, { 'd', DETACH }, { 'e', EJECT }, { 'i', INSERT }, { 'p', PROTECT }, { 's', DEVICES_INFO }, { 'u', UNPROTECT } }; unordered_map device_types = { { 'b', SCBR }, { 'c', SCCD }, { 'd', SCDP }, { 'h', SCHD }, { 'l', SCLP }, { 'm', SCMO }, { 'r', SCRM }, { 's', SCHS } }; };