mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
Merge pull request #10691 from AdmiralCurtiss/tcp-header-std-array
Common/Network: Use std::array in IPv4Header.
This commit is contained in:
commit
1e64d21d40
@ -102,8 +102,8 @@ IPv4Header::IPv4Header(u16 data_size, u8 ip_proto, const sockaddr_in& from, cons
|
|||||||
flags_fragment_offset = htons(0x4000);
|
flags_fragment_offset = htons(0x4000);
|
||||||
ttl = 0x40;
|
ttl = 0x40;
|
||||||
protocol = ip_proto;
|
protocol = ip_proto;
|
||||||
std::memcpy(&source_addr, &from.sin_addr, IPV4_ADDR_LEN);
|
std::memcpy(source_addr.data(), &from.sin_addr, IPV4_ADDR_LEN);
|
||||||
std::memcpy(&destination_addr, &to.sin_addr, IPV4_ADDR_LEN);
|
std::memcpy(destination_addr.data(), &to.sin_addr, IPV4_ADDR_LEN);
|
||||||
|
|
||||||
header_checksum = htons(ComputeNetworkChecksum(this, Size()));
|
header_checksum = htons(ComputeNetworkChecksum(this, Size()));
|
||||||
}
|
}
|
||||||
|
@ -58,8 +58,8 @@ struct IPv4Header
|
|||||||
u8 ttl = 0;
|
u8 ttl = 0;
|
||||||
u8 protocol = 0;
|
u8 protocol = 0;
|
||||||
u16 header_checksum = 0;
|
u16 header_checksum = 0;
|
||||||
u8 source_addr[IPV4_ADDR_LEN]{};
|
std::array<u8, IPV4_ADDR_LEN> source_addr{};
|
||||||
u8 destination_addr[IPV4_ADDR_LEN]{};
|
std::array<u8, IPV4_ADDR_LEN> destination_addr{};
|
||||||
};
|
};
|
||||||
static_assert(sizeof(IPv4Header) == IPv4Header::SIZE);
|
static_assert(sizeof(IPv4Header) == IPv4Header::SIZE);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user