diff options
| author | Jordan Woyak <jordan.woyak@gmail.com> | 2025-09-22 08:02:01 -0500 |
|---|---|---|
| committer | Jordan Woyak <jordan.woyak@gmail.com> | 2025-10-04 14:51:17 -0500 |
| commit | b2fef6ee1fcd820f8bdeee6cc48aa2912d334f72 (patch) | |
| tree | aefad7b2c1a4feaea932f5b36fd405d163e124d3 /Source/Core/Common/Network.h | |
| parent | b1e8de82a632f38424fd8acff36cf3db48e9802b (diff) | |
Common/Network: Add BluetoothAddress struct and string conversion functions.
Diffstat (limited to 'Source/Core/Common/Network.h')
| -rw-r--r-- | Source/Core/Common/Network.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Source/Core/Common/Network.h b/Source/Core/Common/Network.h index 87f1f3a444..8f446d7a38 100644 --- a/Source/Core/Common/Network.h +++ b/Source/Core/Common/Network.h @@ -36,6 +36,12 @@ enum DHCPConst }; using MACAddress = std::array<u8, MAC_ADDRESS_SIZE>; + +// Note: Bluetooth address display order is reverse of the storage order. +struct BluetoothAddress : std::array<u8, MAC_ADDRESS_SIZE> +{ +}; + constexpr std::size_t IPV4_ADDR_LEN = 4; using IPAddress = std::array<u8, IPV4_ADDR_LEN>; constexpr IPAddress IP_ADDR_ANY = {0, 0, 0, 0}; @@ -259,8 +265,13 @@ struct NetworkErrorState }; MACAddress GenerateMacAddress(MACConsumer type); + std::string MacAddressToString(const MACAddress& mac); std::optional<MACAddress> StringToMacAddress(std::string_view mac_string); + +std::string BluetoothAddressToString(BluetoothAddress bdaddr); +std::optional<BluetoothAddress> StringToBluetoothAddress(std::string_view str); + u16 ComputeNetworkChecksum(const void* data, u16 length, u32 initial_value = 0); u16 ComputeTCPNetworkChecksum(const IPAddress& from, const IPAddress& to, const void* data, u16 length, u8 protocol); |
