mirror of
https://git.citron-emu.org/citron/emulator
synced 2025-12-24 04:33:44 +00:00
feat(HLE): Implement bsdcfg service functions and fix logging
Adds implementations for all `bsdcfg` (aliased as `ifcfg`) service functions as listed in the existing codebase and supplemented by Switchbrew documentation. The following functions have been added to the `BSDCFG` service: - `SetIfUp` (Cmd 0) - `SetIfUpWithEvent` (Cmd 1) - `CancelIf` (Cmd 2) - `SetIfDown` (Cmd 3) - `GetIfState` (Cmd 4) - `DhcpRenew` (Cmd 5) - `AddStaticArpEntry` (Cmd 6) - `RemoveArpEntry` (Cmd 7) - `LookupArpEntry` (Cmd 8) - `LookupArpEntry2` (Cmd 9) - `ClearArpEntries` (Cmd 10) - `ClearArpEntries2` (Cmd 11) - `PrintArpEntries` (Cmd 12) - `Unknown13` (Cmd 13) - `Unknown14` (Cmd 14) - `Unknown15` (Cmd 15) These functions are initially stubbed to log a warning and return `EOPNOTSUPP`. Command handlers have been updated in the `BSDCFG` constructor. Additionally, this commit corrects the logging category in these new `BSDCFG` stubs from an undefined `Service_BSDCFG` to the existing `Service` category, resolving compilation errors. Signed-off-by: Zephyron <zephyron@citron-emu.org>
This commit is contained in:
@@ -1047,22 +1047,22 @@ std::unique_lock<std::mutex> BSD::LockService() {
|
||||
BSDCFG::BSDCFG(Core::System& system_) : ServiceFramework{system_, "bsdcfg"} {
|
||||
// clang-format off
|
||||
static const FunctionInfo functions[] = {
|
||||
{0, nullptr, "SetIfUp"},
|
||||
{1, nullptr, "SetIfUpWithEvent"},
|
||||
{2, nullptr, "CancelIf"},
|
||||
{3, nullptr, "SetIfDown"},
|
||||
{4, nullptr, "GetIfState"},
|
||||
{5, nullptr, "DhcpRenew"},
|
||||
{6, nullptr, "AddStaticArpEntry"},
|
||||
{7, nullptr, "RemoveArpEntry"},
|
||||
{8, nullptr, "LookupArpEntry"},
|
||||
{9, nullptr, "LookupArpEntry2"},
|
||||
{10, nullptr, "ClearArpEntries"},
|
||||
{11, nullptr, "ClearArpEntries2"},
|
||||
{12, nullptr, "PrintArpEntries"},
|
||||
{13, nullptr, "Unknown13"},
|
||||
{14, nullptr, "Unknown14"},
|
||||
{15, nullptr, "Unknown15"},
|
||||
{0, &BSDCFG::SetIfUp, "SetIfUp"},
|
||||
{1, &BSDCFG::SetIfUpWithEvent, "SetIfUpWithEvent"},
|
||||
{2, &BSDCFG::CancelIf, "CancelIf"},
|
||||
{3, &BSDCFG::SetIfDown, "SetIfDown"},
|
||||
{4, &BSDCFG::GetIfState, "GetIfState"},
|
||||
{5, &BSDCFG::DhcpRenew, "DhcpRenew"},
|
||||
{6, &BSDCFG::AddStaticArpEntry, "AddStaticArpEntry"},
|
||||
{7, &BSDCFG::RemoveArpEntry, "RemoveArpEntry"},
|
||||
{8, &BSDCFG::LookupArpEntry, "LookupArpEntry"},
|
||||
{9, &BSDCFG::LookupArpEntry2, "LookupArpEntry2"},
|
||||
{10, &BSDCFG::ClearArpEntries, "ClearArpEntries"},
|
||||
{11, &BSDCFG::ClearArpEntries2, "ClearArpEntries2"},
|
||||
{12, &BSDCFG::PrintArpEntries, "PrintArpEntries"},
|
||||
{13, &BSDCFG::Unknown13, "Unknown13"},
|
||||
{14, &BSDCFG::Unknown14, "Unknown14"},
|
||||
{15, &BSDCFG::Unknown15, "Unknown15"},
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -1071,6 +1071,135 @@ BSDCFG::BSDCFG(Core::System& system_) : ServiceFramework{system_, "bsdcfg"} {
|
||||
|
||||
BSDCFG::~BSDCFG() = default;
|
||||
|
||||
// BSDCFG Service Method Stubs
|
||||
void BSDCFG::SetIfUp(HLERequestContext& ctx) {
|
||||
LOG_WARNING(Service, "(STUBBED) called SetIfUp");
|
||||
IPC::ResponseBuilder rb{ctx, 4};
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<s32>(-1);
|
||||
rb.PushEnum(static_cast<Errno>(EOPNOTSUPP));
|
||||
}
|
||||
|
||||
void BSDCFG::SetIfUpWithEvent(HLERequestContext& ctx) {
|
||||
LOG_WARNING(Service, "(STUBBED) called SetIfUpWithEvent");
|
||||
IPC::ResponseBuilder rb{ctx, 4};
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<s32>(-1);
|
||||
rb.PushEnum(static_cast<Errno>(EOPNOTSUPP));
|
||||
}
|
||||
|
||||
void BSDCFG::CancelIf(HLERequestContext& ctx) {
|
||||
LOG_WARNING(Service, "(STUBBED) called CancelIf");
|
||||
IPC::ResponseBuilder rb{ctx, 4};
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<s32>(-1);
|
||||
rb.PushEnum(static_cast<Errno>(EOPNOTSUPP));
|
||||
}
|
||||
|
||||
void BSDCFG::SetIfDown(HLERequestContext& ctx) {
|
||||
LOG_WARNING(Service, "(STUBBED) called SetIfDown");
|
||||
IPC::ResponseBuilder rb{ctx, 4};
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<s32>(-1);
|
||||
rb.PushEnum(static_cast<Errno>(EOPNOTSUPP));
|
||||
}
|
||||
|
||||
void BSDCFG::GetIfState(HLERequestContext& ctx) {
|
||||
LOG_WARNING(Service, "(STUBBED) called GetIfState");
|
||||
IPC::ResponseBuilder rb{ctx, 4};
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<s32>(-1);
|
||||
rb.PushEnum(static_cast<Errno>(EOPNOTSUPP));
|
||||
}
|
||||
|
||||
void BSDCFG::DhcpRenew(HLERequestContext& ctx) {
|
||||
LOG_WARNING(Service, "(STUBBED) called DhcpRenew");
|
||||
IPC::ResponseBuilder rb{ctx, 4};
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<s32>(-1);
|
||||
rb.PushEnum(static_cast<Errno>(EOPNOTSUPP));
|
||||
}
|
||||
|
||||
void BSDCFG::AddStaticArpEntry(HLERequestContext& ctx) {
|
||||
LOG_WARNING(Service, "(STUBBED) called AddStaticArpEntry");
|
||||
IPC::ResponseBuilder rb{ctx, 4};
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<s32>(-1);
|
||||
rb.PushEnum(static_cast<Errno>(EOPNOTSUPP));
|
||||
}
|
||||
|
||||
void BSDCFG::RemoveArpEntry(HLERequestContext& ctx) {
|
||||
LOG_WARNING(Service, "(STUBBED) called RemoveArpEntry");
|
||||
IPC::ResponseBuilder rb{ctx, 4};
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<s32>(-1);
|
||||
rb.PushEnum(static_cast<Errno>(EOPNOTSUPP));
|
||||
}
|
||||
|
||||
void BSDCFG::LookupArpEntry(HLERequestContext& ctx) {
|
||||
LOG_WARNING(Service, "(STUBBED) called LookupArpEntry");
|
||||
IPC::ResponseBuilder rb{ctx, 4};
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<s32>(-1);
|
||||
rb.PushEnum(static_cast<Errno>(EOPNOTSUPP));
|
||||
}
|
||||
|
||||
void BSDCFG::LookupArpEntry2(HLERequestContext& ctx) {
|
||||
LOG_WARNING(Service, "(STUBBED) called LookupArpEntry2");
|
||||
IPC::ResponseBuilder rb{ctx, 4};
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<s32>(-1);
|
||||
rb.PushEnum(static_cast<Errno>(EOPNOTSUPP));
|
||||
}
|
||||
|
||||
void BSDCFG::ClearArpEntries(HLERequestContext& ctx) {
|
||||
LOG_WARNING(Service, "(STUBBED) called ClearArpEntries");
|
||||
IPC::ResponseBuilder rb{ctx, 4};
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<s32>(-1);
|
||||
rb.PushEnum(static_cast<Errno>(EOPNOTSUPP));
|
||||
}
|
||||
|
||||
void BSDCFG::ClearArpEntries2(HLERequestContext& ctx) {
|
||||
LOG_WARNING(Service, "(STUBBED) called ClearArpEntries2");
|
||||
IPC::ResponseBuilder rb{ctx, 4};
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<s32>(-1);
|
||||
rb.PushEnum(static_cast<Errno>(EOPNOTSUPP));
|
||||
}
|
||||
|
||||
void BSDCFG::PrintArpEntries(HLERequestContext& ctx) {
|
||||
LOG_WARNING(Service, "(STUBBED) called PrintArpEntries");
|
||||
IPC::ResponseBuilder rb{ctx, 4};
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<s32>(-1);
|
||||
rb.PushEnum(static_cast<Errno>(EOPNOTSUPP));
|
||||
}
|
||||
|
||||
void BSDCFG::Unknown13(HLERequestContext& ctx) {
|
||||
LOG_WARNING(Service, "(STUBBED) called Unknown13 (Cmd13)");
|
||||
IPC::ResponseBuilder rb{ctx, 4};
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<s32>(-1);
|
||||
rb.PushEnum(static_cast<Errno>(EOPNOTSUPP));
|
||||
}
|
||||
|
||||
void BSDCFG::Unknown14(HLERequestContext& ctx) {
|
||||
LOG_WARNING(Service, "(STUBBED) called Unknown14 (Cmd14)");
|
||||
IPC::ResponseBuilder rb{ctx, 4};
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<s32>(-1);
|
||||
rb.PushEnum(static_cast<Errno>(EOPNOTSUPP));
|
||||
}
|
||||
|
||||
void BSDCFG::Unknown15(HLERequestContext& ctx) {
|
||||
LOG_WARNING(Service, "(STUBBED) called Unknown15 (Cmd15)");
|
||||
IPC::ResponseBuilder rb{ctx, 4};
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push<s32>(-1);
|
||||
rb.PushEnum(static_cast<Errno>(EOPNOTSUPP));
|
||||
}
|
||||
|
||||
void BSD::GetResourceStatistics(HLERequestContext& ctx) {
|
||||
LOG_WARNING(Service, "(STUBBED) called GetResourceStatistics");
|
||||
IPC::ResponseBuilder rb{ctx, 4};
|
||||
|
||||
@@ -212,6 +212,25 @@ class BSDCFG final : public ServiceFramework<BSDCFG> {
|
||||
public:
|
||||
explicit BSDCFG(Core::System& system_);
|
||||
~BSDCFG() override;
|
||||
|
||||
private:
|
||||
// [Zephyron] bsdcfg/ifcfg service methods based on documentation and existing registration
|
||||
void SetIfUp(HLERequestContext& ctx);
|
||||
void SetIfUpWithEvent(HLERequestContext& ctx);
|
||||
void CancelIf(HLERequestContext& ctx);
|
||||
void SetIfDown(HLERequestContext& ctx);
|
||||
void GetIfState(HLERequestContext& ctx);
|
||||
void DhcpRenew(HLERequestContext& ctx);
|
||||
void AddStaticArpEntry(HLERequestContext& ctx);
|
||||
void RemoveArpEntry(HLERequestContext& ctx);
|
||||
void LookupArpEntry(HLERequestContext& ctx);
|
||||
void LookupArpEntry2(HLERequestContext& ctx);
|
||||
void ClearArpEntries(HLERequestContext& ctx);
|
||||
void ClearArpEntries2(HLERequestContext& ctx);
|
||||
void PrintArpEntries(HLERequestContext& ctx);
|
||||
void Unknown13(HLERequestContext& ctx); // Cmd13
|
||||
void Unknown14(HLERequestContext& ctx); // Cmd14
|
||||
void Unknown15(HLERequestContext& ctx); // Cmd15
|
||||
};
|
||||
|
||||
} // namespace Service::Sockets
|
||||
|
||||
Reference in New Issue
Block a user