RASCSI/cpp/devices/host_services.h
Daniel Markstedt 52c2aa474f
Rebrand project to PiSCSI (#1016)
* 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>
2022-12-05 09:58:23 -08:00

56 lines
1.4 KiB
C++

//---------------------------------------------------------------------------
//
// SCSI Target Emulator PiSCSI
// for Raspberry Pi
//
// Copyright (C) 2022 Uwe Seimet
//
// Host Services with realtime clock and shutdown support
//
//---------------------------------------------------------------------------
#pragma once
#include "mode_page_device.h"
#include <vector>
#include <map>
class HostServices: public ModePageDevice
{
public:
explicit HostServices(int lun) : ModePageDevice(SCHS, lun) {}
~HostServices() override = default;
bool Init(const unordered_map<string, string>&) override;
vector<uint8_t> InquiryInternal() const override;
void TestUnitReady() override;
protected:
void SetUpModePages(map<int, vector<byte>>&, int, bool) const override;
private:
using mode_page_datetime = struct __attribute__((packed)) {
// Major and minor version of this data structure (e.g. 1.0)
uint8_t major_version;
uint8_t minor_version;
// Current date and time, with daylight savings time adjustment applied
uint8_t year; // year - 1900
uint8_t month; // 0-11
uint8_t day; // 1-31
uint8_t hour; // 0-23
uint8_t minute; // 0-59
uint8_t second; // 0-59
};
void StartStopUnit() const;
int ModeSense6(const vector<int>&, vector<uint8_t>&) const override;
int ModeSense10(const vector<int>&, vector<uint8_t>&) const override;
void AddRealtimeClockPage(map<int, vector<byte>>&, bool) const;
};