Ethertype handler registry: arp/ipv4 self-register via __attribute__((constructor)), drop threaded mac/ip/subnet params

This commit is contained in:
Ian Gulliver
2026-04-19 08:26:57 -07:00
parent 59829b569e
commit 7e493b7d70
6 changed files with 50 additions and 30 deletions

View File

@@ -36,6 +36,8 @@ static_assert(sizeof(header) == 20);
uint16_t checksum(const void* data, size_t len);
static constexpr ip4_addr SUBNET_BROADCAST = {169, 254, 255, 255};
template <typename Buf>
void prepend(Buf& buf, const eth::mac_addr& dst_mac, const eth::mac_addr& src_mac,
ip4_addr src_ip, ip4_addr dst_ip, uint8_t protocol,
@@ -55,7 +57,6 @@ void prepend(Buf& buf, const eth::mac_addr& dst_mac, const eth::mac_addr& src_ma
eth::prepend(buf, dst_mac, src_mac, eth::ETH_IPV4);
}
void handle(std::span<const uint8_t> frame, span_writer& tx,
eth::mac_addr our_mac, ip4_addr our_ip, ip4_addr subnet_broadcast);
void handle(std::span<const uint8_t> frame, span_writer& tx);
} // namespace ipv4