mirror of
https://github.com/akuker/RASCSI.git
synced 2024-12-01 13:51:43 +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>
46 lines
1.2 KiB
C++
46 lines
1.2 KiB
C++
//---------------------------------------------------------------------------
|
|
//
|
|
// SCSI Target Emulator PiSCSI
|
|
// for Raspberry Pi
|
|
//
|
|
// Copyright (C) 2021-2022 Uwe Seimet
|
|
//
|
|
//---------------------------------------------------------------------------
|
|
|
|
#pragma once
|
|
|
|
#include "generated/piscsi_interface.pb.h"
|
|
#include "localizer.h"
|
|
#include "shared/protobuf_serializer.h"
|
|
#include <string>
|
|
|
|
using namespace std;
|
|
using namespace piscsi_interface;
|
|
|
|
class CommandContext
|
|
{
|
|
const ProtobufSerializer serializer;
|
|
|
|
const Localizer localizer;
|
|
|
|
string locale;
|
|
|
|
int fd;
|
|
|
|
public:
|
|
|
|
CommandContext(const std::string& s = "", int f = -1) : locale(s), fd(f) {}
|
|
~CommandContext() = default;
|
|
|
|
void Cleanup();
|
|
|
|
const ProtobufSerializer& GetSerializer() const { return serializer; }
|
|
int GetFd() const { return fd; }
|
|
void SetFd(int f) { fd = f; }
|
|
bool IsValid() const { return fd != -1; }
|
|
|
|
bool ReturnLocalizedError(LocalizationKey, const string& = "", const string& = "", const string& = "") const;
|
|
bool ReturnLocalizedError(LocalizationKey, PbErrorCode, const string& = "", const string& = "", const string& = "") const;
|
|
bool ReturnStatus(bool = true, const string& = "", PbErrorCode = PbErrorCode::NO_ERROR_CODE, bool = true) const;
|
|
};
|