aboutsummaryrefslogtreecommitdiff
path: root/src/core/hle/service/nwm/uds_data.cpp
diff options
context:
space:
mode:
authorB3n30 <bene_thomas@web.de>2017-09-25 08:16:27 +0200
committerGitHub <noreply@github.com>2017-09-25 08:16:27 +0200
commitd673d508dd1ca463dc72ff68b5582ee56d62f142 (patch)
treee6c7d39198a7bb7a0b8d07c89bb15854ddd4c8e8 /src/core/hle/service/nwm/uds_data.cpp
parenta81536f53fb5adbae6556711893698a40a578ef0 (diff)
Services/UDS: Added a function to send EAPoL-Start packets (#2920)
* Services/UDS: Added a function to generate the EAPoL-Start packet body. * Services/UDS: Added filter for beacons. * Services/UDS: Lock a mutex when accessing connection_status from both the emulation and network thread. * Services/UDS: Handle the Association Response frame and respond with the EAPoL-Start frame. * fixup: make use of current_node, changed received_beacons into a list, mutex and assert corrections * fixup: fix damn clang-format
Diffstat (limited to 'src/core/hle/service/nwm/uds_data.cpp')
-rw-r--r--src/core/hle/service/nwm/uds_data.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/core/hle/service/nwm/uds_data.cpp b/src/core/hle/service/nwm/uds_data.cpp
index 8c6742dba..0fd9b8b8c 100644
--- a/src/core/hle/service/nwm/uds_data.cpp
+++ b/src/core/hle/service/nwm/uds_data.cpp
@@ -274,5 +274,26 @@ std::vector<u8> GenerateDataPayload(const std::vector<u8>& data, u8 channel, u16
return buffer;
}
+std::vector<u8> GenerateEAPoLStartFrame(u16 association_id, const NodeInfo& node_info) {
+ EAPoLStartPacket eapol_start{};
+ eapol_start.association_id = association_id;
+ eapol_start.friend_code_seed = node_info.friend_code_seed;
+
+ for (int i = 0; i < node_info.username.size(); ++i)
+ eapol_start.username[i] = node_info.username[i];
+
+ // Note: The network_node_id and unknown bytes seem to be uninitialized in the NWM module.
+ // TODO(B3N30): The last 8 bytes seem to have a fixed value of 07 88 15 00 04 e9 13 00 in
+ // EAPoL-Start packets from different 3DSs to the same host during a Super Smash Bros. 4 game.
+ // Find out what that means.
+
+ std::vector<u8> eapol_buffer(sizeof(EAPoLStartPacket));
+ std::memcpy(eapol_buffer.data(), &eapol_start, sizeof(eapol_start));
+
+ std::vector<u8> buffer = GenerateLLCHeader(EtherType::EAPoL);
+ buffer.insert(buffer.end(), eapol_buffer.begin(), eapol_buffer.end());
+ return buffer;
+}
+
} // namespace NWM
} // namespace Service