//--------------------------------------------------------------------------- // // SCSI Target Emulator PiSCSI // for Raspberry Pi // // Copyright (C) 2021-2022 Uwe Seimet // // The DeviceFactory creates devices based on their type and the image file extension // //--------------------------------------------------------------------------- #pragma once #include #include #include #include #include "generated/piscsi_interface.pb.h" using namespace std; using namespace piscsi_interface; class PrimaryDevice; class DeviceFactory { const inline static string DEFAULT_IP = "10.10.20.1/24"; //NOSONAR This hardcoded IP address is safe public: DeviceFactory(); ~DeviceFactory() = default; shared_ptr CreateDevice(PbDeviceType, int, const string&) const; PbDeviceType GetTypeForFile(const string&) const; const unordered_set& GetSectorSizes(PbDeviceType type) const; const unordered_map& GetDefaultParams(PbDeviceType type) const; vector GetNetworkInterfaces() const; const unordered_map& GetExtensionMapping() const { return extension_mapping; } private: unordered_map> sector_sizes; unordered_map> default_params; unordered_map extension_mapping; unordered_map device_mapping; unordered_set empty_set; unordered_map empty_map; };