mirror of
https://github.com/akuker/RASCSI.git
synced 2026-10-25 12:02:59 +00:00
Restore the SCBR device as an X68000 Host Bridge, including the Human68k-compatible host file-system service and the bridge-specific SCSI message handlers. Back its Ethernet path with the TAP driver, derive a stable locally administered MAC address, preserve the driver minimum-frame/FCS expectations, and restrict received traffic to its own unicast frames and broadcasts. Match the RASCTL/RASETHER/RASDRV bridge protocol that originated in the parent RaSCSI project: dispatch its non-standard message format on READ(10)/WRITE(10) (0x28/0x2a), with type, function, phase, and a three-byte byte count carried in the CDB. Advertise the legacy control channel required by RASCTL, translate its list and device-management commands to PiSCSI operations, and defer stop or system-shutdown requests until after the response is sent, while gating this insecure interface behind a new '-c disabled|media|full' runtime option. Preserve the type-1 Ethernet exchange used by RASETHER and the type-2, phased filesystem exchange used by RASDRV. Register the device in the factory, protobuf API, controller transfer path, command-line tooling, device listings, and web UI. Share the explicit bridge and proxy-ARP topology workflow with DaynaPort so both adapters validate and use the same mode/interface pair. Add build support for iconv where needed, extend unit coverage for device creation, RAS* protocol handling, CLI parsing, web attachment, and topology selection, and update the man pages and network-profile documentation for Host Bridge operation and its networking limits.
60 lines
1.9 KiB
C++
60 lines
1.9 KiB
C++
//---------------------------------------------------------------------------
|
|
//
|
|
// SCSI Target Emulator PiSCSI
|
|
// for Raspberry Pi
|
|
//
|
|
// Copyright (C) 2022 Uwe Seimet
|
|
//
|
|
//---------------------------------------------------------------------------
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
#include "scsictl/scsictl_parser.h"
|
|
|
|
TEST(ScsictlParserTest, ParseOperation)
|
|
{
|
|
ScsictlParser parser;
|
|
|
|
EXPECT_EQ(ATTACH, parser.ParseOperation("A"));
|
|
EXPECT_EQ(ATTACH, parser.ParseOperation("a"));
|
|
EXPECT_EQ(DETACH, parser.ParseOperation("d"));
|
|
EXPECT_EQ(INSERT, parser.ParseOperation("i"));
|
|
EXPECT_EQ(EJECT, parser.ParseOperation("e"));
|
|
EXPECT_EQ(PROTECT, parser.ParseOperation("p"));
|
|
EXPECT_EQ(UNPROTECT, parser.ParseOperation("u"));
|
|
EXPECT_EQ(NO_OPERATION, parser.ParseOperation(""));
|
|
EXPECT_EQ(NO_OPERATION, parser.ParseOperation("xyz"));
|
|
}
|
|
|
|
TEST(ScsictlParserTest, ParseType)
|
|
{
|
|
ScsictlParser parser;
|
|
|
|
EXPECT_EQ(SCBR, parser.ParseType("SCBR"));
|
|
EXPECT_EQ(SCBR, parser.ParseType("scbr"));
|
|
EXPECT_EQ(SCCD, parser.ParseType("SCCD"));
|
|
EXPECT_EQ(SCCD, parser.ParseType("sccd"));
|
|
EXPECT_EQ(SCDP, parser.ParseType("scdp"));
|
|
EXPECT_EQ(SCHD, parser.ParseType("schd"));
|
|
EXPECT_EQ(SCHS, parser.ParseType("schs"));
|
|
EXPECT_EQ(SCLP, parser.ParseType("sclp"));
|
|
EXPECT_EQ(SCMO, parser.ParseType("scmo"));
|
|
EXPECT_EQ(SCRM, parser.ParseType("scrm"));
|
|
EXPECT_EQ(SCTP, parser.ParseType("sctp"));
|
|
|
|
EXPECT_EQ(SCBR, parser.ParseType("B"));
|
|
EXPECT_EQ(SCBR, parser.ParseType("b"));
|
|
EXPECT_EQ(SCCD, parser.ParseType("C"));
|
|
EXPECT_EQ(SCCD, parser.ParseType("c"));
|
|
EXPECT_EQ(SCDP, parser.ParseType("d"));
|
|
EXPECT_EQ(SCHD, parser.ParseType("h"));
|
|
EXPECT_EQ(SCHS, parser.ParseType("s"));
|
|
EXPECT_EQ(SCLP, parser.ParseType("p"));
|
|
EXPECT_EQ(SCMO, parser.ParseType("m"));
|
|
EXPECT_EQ(SCRM, parser.ParseType("r"));
|
|
EXPECT_EQ(SCTP, parser.ParseType("t"));
|
|
|
|
EXPECT_EQ(UNDEFINED, parser.ParseType(""));
|
|
EXPECT_EQ(UNDEFINED, parser.ParseType("xyz"));
|
|
}
|