mirror of
https://github.com/mfontanini/libtins
synced 2026-01-25 11:41:35 +01:00
Started fixing endianess issues.
This commit is contained in:
@@ -52,7 +52,7 @@ ARP::ARP(IPv4Address target_ip, IPv4Address sender_ip,
|
||||
}
|
||||
|
||||
ARP::ARP(const uint8_t *buffer, uint32_t total_sz)
|
||||
: PDU(Utils::net_to_host_s(Constants::Ethernet::ARP))
|
||||
: PDU(Utils::to_be<uint16_t>(Constants::Ethernet::ARP))
|
||||
{
|
||||
if(total_sz < sizeof(arphdr))
|
||||
throw runtime_error("Not enough size for an ARP header in the buffer.");
|
||||
@@ -79,11 +79,11 @@ void ARP::target_ip_addr(IPv4Address new_tgt_ip_addr) {
|
||||
}
|
||||
|
||||
void ARP::hw_addr_format(uint16_t new_hw_addr_fmt) {
|
||||
this->_arp.ar_hrd = Utils::net_to_host_s(new_hw_addr_fmt);
|
||||
this->_arp.ar_hrd = Utils::to_be(new_hw_addr_fmt);
|
||||
}
|
||||
|
||||
void ARP::prot_addr_format(uint16_t new_prot_addr_fmt) {
|
||||
this->_arp.ar_pro = Utils::net_to_host_s(new_prot_addr_fmt);
|
||||
this->_arp.ar_pro = Utils::to_be(new_prot_addr_fmt);
|
||||
}
|
||||
|
||||
void ARP::hw_addr_length(uint8_t new_hw_addr_len) {
|
||||
@@ -95,7 +95,7 @@ void ARP::prot_addr_length(uint8_t new_prot_addr_len) {
|
||||
}
|
||||
|
||||
void ARP::opcode(Flags new_opcode) {
|
||||
this->_arp.ar_op = Utils::net_to_host_s(new_opcode);
|
||||
this->_arp.ar_op = Utils::to_be<uint16_t>(new_opcode);
|
||||
}
|
||||
|
||||
uint32_t ARP::header_size() const {
|
||||
|
||||
Reference in New Issue
Block a user