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

@@ -16,6 +16,8 @@ using net_frame_callback = bool (*)(std::span<const uint8_t> frame);
using frame_cb_list = callback_list<net_frame_callback, 16>;
using frame_cb_handle = frame_cb_list::node*;
using ethertype_handler = void (*)(std::span<const uint8_t> frame, span_writer& tx);
inline constexpr uint16_t PICOMAP_PORT_BE = __builtin_bswap16(28781);
bool net_init();
@@ -24,3 +26,4 @@ frame_cb_handle net_add_frame_callback(net_frame_callback cb);
void net_remove_frame_callback(frame_cb_handle h);
void net_poll(std::span<uint8_t> tx);
void net_send_raw(std::span<const uint8_t> data);
void net_register_ethertype(uint16_t ethertype_be, ethertype_handler fn);