extract arp into its own static library; add empty arp::init() called from dispatch_init to anchor the .o so the self-registration constructor links in

This commit is contained in:
Ian Gulliver
2026-05-01 13:35:40 -07:00
parent f64cdcaacf
commit 2d7ff98b82
5 changed files with 18 additions and 1 deletions

25
arp/arp.h Normal file
View File

@@ -0,0 +1,25 @@
#pragma once
#include <span>
#include "eth.h"
#include "ipv4.h"
#include "span_writer.h"
namespace arp {
struct __attribute__((packed)) header {
uint16_t htype;
uint16_t ptype;
uint8_t hlen;
uint8_t plen;
uint16_t oper;
eth::mac_addr sha;
ipv4::ip4_addr spa;
eth::mac_addr tha;
ipv4::ip4_addr tpa;
};
static_assert(sizeof(header) == 28);
void init();
void handle(std::span<const uint8_t> frame, span_writer& tx);
} // namespace arp