16 hardware_type = p.u16();
17 protocol_type = p.u16();
18 hardware_address_size = p.u8();
19 protocol_address_size = p.u8();
22 if (not supported()) {
27 for (
auto &
byte : sender_ethernet_address) {
30 sender_ip_address = p.u32();
33 for (
auto &
byte : target_ethernet_address) {
36 target_ip_address = p.u32();
44 ((opcode == OPCODE_REQUEST) or (opcode == OPCODE_REPLY));
48 if (not supported()) {
50 "ARPMessage::serialize(): unsupported field combination (must be Ethernet/IP, and request or reply)");
61 for (
auto &
byte : sender_ethernet_address) {
67 for (
auto &
byte : target_ethernet_address) {
77 string opcode_str =
"(unknown type)";
78 if (opcode == OPCODE_REQUEST) {
79 opcode_str =
"REQUEST";
81 if (opcode == OPCODE_REPLY) {
84 ss <<
"opcode=" << opcode_str <<
", sender=" <<
::to_string(sender_ethernet_address) <<
"/"
85 << inet_ntoa({htobe32(sender_ip_address)}) <<
", target=" << ::
to_string(target_ethernet_address) <<
"/"
86 << inet_ntoa({htobe32(target_ip_address)});