mirror of
https://github.com/Lime3DS/Lime3DS
synced 2024-12-30 11:02:39 -06:00
nwm/uds_data: specify endianness for enum
This commit is contained in:
parent
e0336403ee
commit
41d53cee1f
2 changed files with 6 additions and 8 deletions
|
@ -26,7 +26,7 @@ using MacAddress = std::array<u8, 6>;
|
||||||
*/
|
*/
|
||||||
static std::vector<u8> GenerateLLCHeader(EtherType protocol) {
|
static std::vector<u8> GenerateLLCHeader(EtherType protocol) {
|
||||||
LLCHeader header{};
|
LLCHeader header{};
|
||||||
header.protocol = static_cast<u16>(protocol);
|
header.protocol = protocol;
|
||||||
|
|
||||||
std::vector<u8> buffer(sizeof(header));
|
std::vector<u8> buffer(sizeof(header));
|
||||||
memcpy(buffer.data(), &header, sizeof(header));
|
memcpy(buffer.data(), &header, sizeof(header));
|
||||||
|
@ -313,9 +313,7 @@ std::vector<u8> GenerateEAPoLStartFrame(u16 association_id, const NodeInfo& node
|
||||||
EtherType GetFrameEtherType(const std::vector<u8>& frame) {
|
EtherType GetFrameEtherType(const std::vector<u8>& frame) {
|
||||||
LLCHeader header;
|
LLCHeader header;
|
||||||
std::memcpy(&header, frame.data(), sizeof(header));
|
std::memcpy(&header, frame.data(), sizeof(header));
|
||||||
|
return header.protocol;
|
||||||
u16 ethertype = header.protocol;
|
|
||||||
return static_cast<EtherType>(ethertype);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 GetEAPoLFrameType(const std::vector<u8>& frame) {
|
u16 GetEAPoLFrameType(const std::vector<u8>& frame) {
|
||||||
|
|
|
@ -26,11 +26,11 @@ enum class EtherType : u16 { SecureData = 0x876D, EAPoL = 0x888E };
|
||||||
* and the OUI is always 0.
|
* and the OUI is always 0.
|
||||||
*/
|
*/
|
||||||
struct LLCHeader {
|
struct LLCHeader {
|
||||||
u8 dsap = static_cast<u8>(SAP::SNAPExtensionUsed);
|
SAP dsap = SAP::SNAPExtensionUsed;
|
||||||
u8 ssap = static_cast<u8>(SAP::SNAPExtensionUsed);
|
SAP ssap = SAP::SNAPExtensionUsed;
|
||||||
u8 control = static_cast<u8>(PDUControl::UnnumberedInformation);
|
PDUControl control = PDUControl::UnnumberedInformation;
|
||||||
std::array<u8, 3> OUI = {};
|
std::array<u8, 3> OUI = {};
|
||||||
u16_be protocol;
|
enum_be<EtherType> protocol;
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert(sizeof(LLCHeader) == 8, "LLCHeader has the wrong size");
|
static_assert(sizeof(LLCHeader) == 8, "LLCHeader has the wrong size");
|
||||||
|
|
Loading…
Reference in a new issue