mirror of
https://github.com/akuker/RASCSI.git
synced 2024-12-21 23:29:39 +00:00
83d1595a35
* Moved rascsi/rasctl/scsimon/rasdump.cpp to classes (for better testability) * Moved bus.* to hal folder * Removed some global variables * Fixed code redundancies
58 lines
1.4 KiB
C++
58 lines
1.4 KiB
C++
//---------------------------------------------------------------------------
|
|
//
|
|
// SCSI Target Emulator RaSCSI Reloaded
|
|
// for Raspberry Pi
|
|
//
|
|
// Copyright (C) 2022 Uwe Seimet
|
|
//
|
|
//---------------------------------------------------------------------------
|
|
|
|
#pragma once
|
|
|
|
#include "rascsi/command_context.h"
|
|
#include "rascsi_interface.pb.h"
|
|
#include <deque>
|
|
#include <vector>
|
|
#include <string>
|
|
|
|
using namespace std;
|
|
|
|
class Rascsi
|
|
{
|
|
using optarg_value_type = pair<int, string>;
|
|
using optarg_queue_type = deque<optarg_value_type>;
|
|
|
|
static const int DEFAULT_PORT = 6868;
|
|
static const char COMPONENT_SEPARATOR = ':';
|
|
|
|
public:
|
|
|
|
Rascsi() = default;
|
|
~Rascsi() = default;
|
|
|
|
int run(const vector<char *>&) const;
|
|
|
|
private:
|
|
|
|
void Banner(const vector<char *>&) const;
|
|
bool InitBus() const;
|
|
void Reset() const;
|
|
bool ReadAccessToken(const char *) const;
|
|
void LogDevices(string_view) const;
|
|
bool ProcessId(const string&, int&, int&) const;
|
|
bool ParseArguments(const vector<char *>&, int&, optarg_queue_type&) const;
|
|
bool CreateInitialDevices(const optarg_queue_type&) const;
|
|
|
|
static bool ExecuteCommand(const CommandContext&, const PbCommand&);
|
|
|
|
// TODO Get rid of static fields
|
|
|
|
// Processing flag
|
|
static inline volatile bool active;
|
|
|
|
// Some versions of spdlog do not support get_log_level(), so we have to remember the level
|
|
static inline string current_log_level = "info";
|
|
|
|
static inline string access_token;
|
|
};
|