Merge pull request #3871 from NarcolepticK/nwm-migrate-logging
service/nwm: Migrate logging macros
This commit is contained in:
commit
64adf94ef2
@ -238,7 +238,7 @@ static void HandleEAPoLPacket(const Network::WifiPacket& packet) {
|
||||
|
||||
if (GetEAPoLFrameType(packet.data) == EAPoLStartMagic) {
|
||||
if (connection_status.status != static_cast<u32>(NetworkStatus::ConnectedAsHost)) {
|
||||
LOG_DEBUG(Service_NWM, "Connection sequence aborted, because connection status is %u",
|
||||
NGLOG_DEBUG(Service_NWM, "Connection sequence aborted, because connection status is {}",
|
||||
connection_status.status);
|
||||
return;
|
||||
}
|
||||
@ -247,7 +247,7 @@ static void HandleEAPoLPacket(const Network::WifiPacket& packet) {
|
||||
|
||||
if (connection_status.max_nodes == connection_status.total_nodes) {
|
||||
// Reject connection attempt
|
||||
LOG_ERROR(Service_NWM, "Reached maximum nodes, but reject packet wasn't sent.");
|
||||
NGLOG_ERROR(Service_NWM, "Reached maximum nodes, but reject packet wasn't sent.");
|
||||
// TODO(B3N30): Figure out what packet is sent here
|
||||
return;
|
||||
}
|
||||
@ -425,7 +425,7 @@ void SendAssociationResponseFrame(const MacAddress& address) {
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(connection_status_mutex);
|
||||
if (connection_status.status != static_cast<u32>(NetworkStatus::ConnectedAsHost)) {
|
||||
LOG_ERROR(Service_NWM, "Connection sequence aborted, because connection status is %u",
|
||||
NGLOG_ERROR(Service_NWM, "Connection sequence aborted, because connection status is {}",
|
||||
connection_status.status);
|
||||
return;
|
||||
}
|
||||
@ -457,8 +457,8 @@ void HandleAuthenticationFrame(const Network::WifiPacket& packet) {
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(connection_status_mutex);
|
||||
if (connection_status.status != static_cast<u32>(NetworkStatus::ConnectedAsHost)) {
|
||||
LOG_ERROR(Service_NWM,
|
||||
"Connection sequence aborted, because connection status is %u",
|
||||
NGLOG_ERROR(Service_NWM,
|
||||
"Connection sequence aborted, because connection status is {}",
|
||||
connection_status.status);
|
||||
return;
|
||||
}
|
||||
@ -477,16 +477,16 @@ void HandleAuthenticationFrame(const Network::WifiPacket& packet) {
|
||||
|
||||
/// Handles the deauthentication frames sent from clients to hosts, when they leave a session
|
||||
void HandleDeauthenticationFrame(const Network::WifiPacket& packet) {
|
||||
LOG_DEBUG(Service_NWM, "called");
|
||||
NGLOG_DEBUG(Service_NWM, "called");
|
||||
std::unique_lock<std::recursive_mutex> hle_lock(HLE::g_hle_lock, std::defer_lock);
|
||||
std::unique_lock<std::mutex> lock(connection_status_mutex, std::defer_lock);
|
||||
std::lock(hle_lock, lock);
|
||||
if (connection_status.status != static_cast<u32>(NetworkStatus::ConnectedAsHost)) {
|
||||
LOG_ERROR(Service_NWM, "Got deauthentication frame but we are not the host");
|
||||
NGLOG_ERROR(Service_NWM, "Got deauthentication frame but we are not the host");
|
||||
return;
|
||||
}
|
||||
if (node_map.find(packet.transmitter_address) == node_map.end()) {
|
||||
LOG_ERROR(Service_NWM, "Got deauthentication frame from unknown node");
|
||||
NGLOG_ERROR(Service_NWM, "Got deauthentication frame from unknown node");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -555,7 +555,7 @@ void NWM_UDS::Shutdown(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
LOG_DEBUG(Service_NWM, "called");
|
||||
NGLOG_DEBUG(Service_NWM, "called");
|
||||
}
|
||||
|
||||
void NWM_UDS::RecvBeaconBroadcastData(Kernel::HLERequestContext& ctx) {
|
||||
@ -617,9 +617,9 @@ void NWM_UDS::RecvBeaconBroadcastData(Kernel::HLERequestContext& ctx) {
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.PushMappedBuffer(out_buffer);
|
||||
|
||||
LOG_DEBUG(Service_NWM,
|
||||
"called out_buffer_size=0x%08X, wlan_comm_id=0x%08X, id=0x%08X,"
|
||||
"unk1=0x%08X, unk2=0x%08X, offset=%zu",
|
||||
NGLOG_DEBUG(Service_NWM,
|
||||
"called out_buffer_size=0x{:08X}, wlan_comm_id=0x{:08X}, id=0x{:08X},"
|
||||
"unk1=0x{:08X}, unk2=0x{:08X}, offset={}",
|
||||
out_buffer_size, wlan_comm_id, id, unk1, unk2, cur_buffer_size);
|
||||
}
|
||||
|
||||
@ -642,7 +642,7 @@ void NWM_UDS::InitializeWithVersion(Kernel::HLERequestContext& ctx) {
|
||||
if (auto room_member = Network::GetRoomMember().lock()) {
|
||||
wifi_packet_received = room_member->BindOnWifiPacketReceived(OnWifiPacketReceived);
|
||||
} else {
|
||||
LOG_ERROR(Service_NWM, "Network isn't initalized");
|
||||
NGLOG_ERROR(Service_NWM, "Network isn't initalized");
|
||||
}
|
||||
|
||||
{
|
||||
@ -660,7 +660,8 @@ void NWM_UDS::InitializeWithVersion(Kernel::HLERequestContext& ctx) {
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.PushCopyObjects(connection_status_event);
|
||||
|
||||
LOG_DEBUG(Service_NWM, "called sharedmem_size=0x%08X, version=0x%08X", sharedmem_size, version);
|
||||
NGLOG_DEBUG(Service_NWM, "called sharedmem_size=0x{:08X}, version=0x{:08X}", sharedmem_size,
|
||||
version);
|
||||
}
|
||||
|
||||
void NWM_UDS::GetConnectionStatus(Kernel::HLERequestContext& ctx) {
|
||||
@ -679,7 +680,7 @@ void NWM_UDS::GetConnectionStatus(Kernel::HLERequestContext& ctx) {
|
||||
connection_status.changed_nodes = 0;
|
||||
}
|
||||
|
||||
LOG_DEBUG(Service_NWM, "called");
|
||||
NGLOG_DEBUG(Service_NWM, "called");
|
||||
}
|
||||
|
||||
void NWM_UDS::GetNodeInformation(Kernel::HLERequestContext& ctx) {
|
||||
@ -710,7 +711,7 @@ void NWM_UDS::GetNodeInformation(Kernel::HLERequestContext& ctx) {
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.PushRaw<NodeInfo>(*itr);
|
||||
}
|
||||
LOG_DEBUG(Service_NWM, "called");
|
||||
NGLOG_DEBUG(Service_NWM, "called");
|
||||
}
|
||||
|
||||
void NWM_UDS::Bind(Kernel::HLERequestContext& ctx) {
|
||||
@ -721,13 +722,13 @@ void NWM_UDS::Bind(Kernel::HLERequestContext& ctx) {
|
||||
u8 data_channel = rp.Pop<u8>();
|
||||
u16 network_node_id = rp.Pop<u16>();
|
||||
|
||||
LOG_DEBUG(Service_NWM, "called");
|
||||
NGLOG_DEBUG(Service_NWM, "called");
|
||||
|
||||
if (data_channel == 0 || bind_node_id == 0) {
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(ResultCode(ErrorDescription::NotAuthorized, ErrorModule::UDS,
|
||||
ErrorSummary::WrongArgument, ErrorLevel::Usage));
|
||||
LOG_WARNING(Service_NWM, "data_channel = %d, bind_node_id = %d", data_channel,
|
||||
NGLOG_WARNING(Service_NWM, "data_channel = {}, bind_node_id = {}", data_channel,
|
||||
bind_node_id);
|
||||
return;
|
||||
}
|
||||
@ -737,7 +738,7 @@ void NWM_UDS::Bind(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(ResultCode(ErrorDescription::OutOfMemory, ErrorModule::UDS,
|
||||
ErrorSummary::OutOfResource, ErrorLevel::Status));
|
||||
LOG_WARNING(Service_NWM, "max bind nodes");
|
||||
NGLOG_WARNING(Service_NWM, "max bind nodes");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -746,7 +747,7 @@ void NWM_UDS::Bind(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(ResultCode(ErrorDescription::TooLarge, ErrorModule::UDS,
|
||||
ErrorSummary::WrongArgument, ErrorLevel::Usage));
|
||||
LOG_WARNING(Service_NWM, "MinRecvBufferSize");
|
||||
NGLOG_WARNING(Service_NWM, "MinRecvBufferSize");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -807,7 +808,7 @@ void NWM_UDS::BeginHostingNetwork(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
// TODO(Subv): Store the passphrase and verify it when attempting a connection.
|
||||
|
||||
LOG_DEBUG(Service_NWM, "called");
|
||||
NGLOG_DEBUG(Service_NWM, "called");
|
||||
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(connection_status_mutex);
|
||||
@ -867,7 +868,7 @@ void NWM_UDS::BeginHostingNetwork(Kernel::HLERequestContext& ctx) {
|
||||
CoreTiming::ScheduleEvent(msToCycles(DefaultBeaconInterval * MillisecondsPerTU),
|
||||
beacon_broadcast_event, 0);
|
||||
|
||||
LOG_DEBUG(Service_NWM, "An UDS network has been created.");
|
||||
NGLOG_DEBUG(Service_NWM, "An UDS network has been created.");
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
@ -876,7 +877,7 @@ void NWM_UDS::BeginHostingNetwork(Kernel::HLERequestContext& ctx) {
|
||||
void NWM_UDS::UpdateNetworkAttribute(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestParser rp(ctx, 0x07, 2, 0);
|
||||
rp.Skip(2, false);
|
||||
LOG_WARNING(Service_NWM, "stubbed");
|
||||
NGLOG_WARNING(Service_NWM, "stubbed");
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
}
|
||||
@ -893,7 +894,7 @@ void NWM_UDS::DestroyNetwork(Kernel::HLERequestContext& ctx) {
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
rb.Push(ResultCode(ErrCodes::WrongStatus, ErrorModule::UDS, ErrorSummary::InvalidState,
|
||||
ErrorLevel::Status));
|
||||
LOG_WARNING(Service_NWM, "called with status %u", connection_status.status);
|
||||
NGLOG_WARNING(Service_NWM, "called with status {}", connection_status.status);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -915,7 +916,7 @@ void NWM_UDS::DestroyNetwork(Kernel::HLERequestContext& ctx) {
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
|
||||
LOG_DEBUG(Service_NWM, "called");
|
||||
NGLOG_DEBUG(Service_NWM, "called");
|
||||
}
|
||||
|
||||
void NWM_UDS::DisconnectNetwork(Kernel::HLERequestContext& ctx) {
|
||||
@ -933,7 +934,7 @@ void NWM_UDS::DisconnectNetwork(Kernel::HLERequestContext& ctx) {
|
||||
connection_status.status = static_cast<u32>(NetworkStatus::ConnectedAsHost);
|
||||
connection_status.network_node_id = tmp_node_id;
|
||||
node_map.clear();
|
||||
LOG_DEBUG(Service_NWM, "called as a host");
|
||||
NGLOG_DEBUG(Service_NWM, "called as a host");
|
||||
rb.Push(ResultCode(ErrCodes::WrongStatus, ErrorModule::UDS, ErrorSummary::InvalidState,
|
||||
ErrorLevel::Status));
|
||||
return;
|
||||
@ -960,7 +961,7 @@ void NWM_UDS::DisconnectNetwork(Kernel::HLERequestContext& ctx) {
|
||||
channel_data.clear();
|
||||
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
LOG_DEBUG(Service_NWM, "called");
|
||||
NGLOG_DEBUG(Service_NWM, "called");
|
||||
}
|
||||
|
||||
void NWM_UDS::SendTo(Kernel::HLERequestContext& ctx) {
|
||||
@ -991,7 +992,7 @@ void NWM_UDS::SendTo(Kernel::HLERequestContext& ctx) {
|
||||
}
|
||||
|
||||
if (dest_node_id == connection_status.network_node_id) {
|
||||
LOG_ERROR(Service_NWM, "tried to send packet to itself");
|
||||
NGLOG_ERROR(Service_NWM, "tried to send packet to itself");
|
||||
rb.Push(ResultCode(ErrorDescription::NotFound, ErrorModule::UDS,
|
||||
ErrorSummary::WrongArgument, ErrorLevel::Status));
|
||||
return;
|
||||
@ -1000,7 +1001,7 @@ void NWM_UDS::SendTo(Kernel::HLERequestContext& ctx) {
|
||||
Network::MacAddress dest_address;
|
||||
|
||||
if (flags >> 2) {
|
||||
LOG_ERROR(Service_NWM, "Unexpected flags 0x%02X", flags);
|
||||
NGLOG_ERROR(Service_NWM, "Unexpected flags 0x{:02X}", flags);
|
||||
}
|
||||
|
||||
if ((flags & (0x1 << 1)) || dest_node_id == 0xFFFF) {
|
||||
@ -1012,7 +1013,7 @@ void NWM_UDS::SendTo(Kernel::HLERequestContext& ctx) {
|
||||
std::find_if(node_map.begin(), node_map.end(),
|
||||
[dest_node_id](const auto& node) { return node.second == dest_node_id; });
|
||||
if (destination == node_map.end()) {
|
||||
LOG_ERROR(Service_NWM, "tried to send packet to unknown dest id %u", dest_node_id);
|
||||
NGLOG_ERROR(Service_NWM, "tried to send packet to unknown dest id {}", dest_node_id);
|
||||
rb.Push(ResultCode(ErrorDescription::NotFound, ErrorModule::UDS,
|
||||
ErrorSummary::WrongArgument, ErrorLevel::Status));
|
||||
return;
|
||||
@ -1132,7 +1133,7 @@ void NWM_UDS::GetChannel(Kernel::HLERequestContext& ctx) {
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.Push(channel);
|
||||
|
||||
LOG_DEBUG(Service_NWM, "called");
|
||||
NGLOG_DEBUG(Service_NWM, "called");
|
||||
}
|
||||
|
||||
void NWM_UDS::ConnectToNetwork(Kernel::HLERequestContext& ctx) {
|
||||
@ -1162,10 +1163,10 @@ void NWM_UDS::ConnectToNetwork(Kernel::HLERequestContext& ctx) {
|
||||
// TODO(B3N30): Add error handling for host full and timeout
|
||||
IPC::RequestBuilder rb(ctx, 0x1E, 1, 0);
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
LOG_DEBUG(Service_NWM, "connection sequence finished");
|
||||
NGLOG_DEBUG(Service_NWM, "connection sequence finished");
|
||||
});
|
||||
|
||||
LOG_DEBUG(Service_NWM, "called");
|
||||
NGLOG_DEBUG(Service_NWM, "called");
|
||||
}
|
||||
|
||||
void NWM_UDS::SetApplicationData(Kernel::HLERequestContext& ctx) {
|
||||
@ -1176,7 +1177,7 @@ void NWM_UDS::SetApplicationData(Kernel::HLERequestContext& ctx) {
|
||||
const std::vector<u8> application_data = rp.PopStaticBuffer();
|
||||
ASSERT(application_data.size() == size);
|
||||
|
||||
LOG_DEBUG(Service_NWM, "called");
|
||||
NGLOG_DEBUG(Service_NWM, "called");
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
||||
|
||||
@ -1201,7 +1202,7 @@ void NWM_UDS::DecryptBeaconData(Kernel::HLERequestContext& ctx) {
|
||||
const std::vector<u8> encrypted_data0_buffer = rp.PopStaticBuffer();
|
||||
const std::vector<u8> encrypted_data1_buffer = rp.PopStaticBuffer();
|
||||
|
||||
LOG_DEBUG(Service_NWM, "called");
|
||||
NGLOG_DEBUG(Service_NWM, "called");
|
||||
|
||||
NetworkInfo net_info;
|
||||
std::memcpy(&net_info, network_struct_buffer.data(), sizeof(net_info));
|
||||
|
@ -209,7 +209,7 @@ static std::vector<u8> DecryptDataFrame(const std::vector<u8>& encrypted_payload
|
||||
df.Get(pdata.data(), size);
|
||||
return pdata;
|
||||
} catch (CryptoPP::Exception&) {
|
||||
LOG_ERROR(Service_NWM, "failed to decrypt");
|
||||
NGLOG_ERROR(Service_NWM, "failed to decrypt");
|
||||
}
|
||||
|
||||
return {};
|
||||
@ -263,7 +263,7 @@ static std::vector<u8> EncryptDataFrame(const std::vector<u8>& payload,
|
||||
df.Get(cipher.data(), size);
|
||||
return cipher;
|
||||
} catch (CryptoPP::Exception&) {
|
||||
LOG_ERROR(Service_NWM, "failed to encrypt");
|
||||
NGLOG_ERROR(Service_NWM, "failed to encrypt");
|
||||
}
|
||||
|
||||
return {};
|
||||
|
Loading…
Reference in New Issue
Block a user