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:
@@ -6,9 +6,9 @@ add_subdirectory(debug_log)
|
|||||||
add_subdirectory(msgpack)
|
add_subdirectory(msgpack)
|
||||||
add_subdirectory(eth)
|
add_subdirectory(eth)
|
||||||
add_subdirectory(ipv4)
|
add_subdirectory(ipv4)
|
||||||
|
add_subdirectory(arp)
|
||||||
|
|
||||||
add_library(limen STATIC
|
add_library(limen STATIC
|
||||||
src/arp.cpp
|
|
||||||
src/dispatch.cpp
|
src/dispatch.cpp
|
||||||
src/flash.cpp
|
src/flash.cpp
|
||||||
src/handlers.cpp
|
src/handlers.cpp
|
||||||
@@ -31,6 +31,7 @@ target_link_libraries(limen PUBLIC
|
|||||||
msgpack
|
msgpack
|
||||||
eth
|
eth
|
||||||
ipv4
|
ipv4
|
||||||
|
arp
|
||||||
pico_stdlib
|
pico_stdlib
|
||||||
pico_sha256
|
pico_sha256
|
||||||
)
|
)
|
||||||
|
|||||||
11
arp/CMakeLists.txt
Normal file
11
arp/CMakeLists.txt
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
add_library(arp STATIC arp.cpp)
|
||||||
|
|
||||||
|
target_include_directories(arp PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
|
target_compile_options(arp PRIVATE -Wall -Wextra -Wno-unused-parameter)
|
||||||
|
|
||||||
|
target_link_libraries(arp PUBLIC
|
||||||
|
util
|
||||||
|
eth
|
||||||
|
ipv4
|
||||||
|
)
|
||||||
@@ -41,6 +41,8 @@ void handle(std::span<const uint8_t> frame, span_writer& tx) {
|
|||||||
eth::send_raw(buf.span());
|
eth::send_raw(buf.span());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void init() {}
|
||||||
|
|
||||||
__attribute__((constructor))
|
__attribute__((constructor))
|
||||||
static void register_ethertype() {
|
static void register_ethertype() {
|
||||||
eth::register_ethertype(eth::ETH_ARP, handle);
|
eth::register_ethertype(eth::ETH_ARP, handle);
|
||||||
@@ -19,6 +19,7 @@ struct __attribute__((packed)) header {
|
|||||||
};
|
};
|
||||||
static_assert(sizeof(header) == 28);
|
static_assert(sizeof(header) == 28);
|
||||||
|
|
||||||
|
void init();
|
||||||
void handle(std::span<const uint8_t> frame, span_writer& tx);
|
void handle(std::span<const uint8_t> frame, span_writer& tx);
|
||||||
|
|
||||||
} // namespace arp
|
} // namespace arp
|
||||||
@@ -5,6 +5,7 @@
|
|||||||
#include "timer_queue.h"
|
#include "timer_queue.h"
|
||||||
#include "eth.h"
|
#include "eth.h"
|
||||||
#include "ipv4.h"
|
#include "ipv4.h"
|
||||||
|
#include "arp.h"
|
||||||
#include "igmp.h"
|
#include "igmp.h"
|
||||||
#include "udp.h"
|
#include "udp.h"
|
||||||
#include "debug_log.h"
|
#include "debug_log.h"
|
||||||
@@ -37,6 +38,7 @@ void dispatch_init(uint16_t port_be) {
|
|||||||
udp::register_port(port_be, on_udp_message);
|
udp::register_port(port_be, on_udp_message);
|
||||||
eth::init();
|
eth::init();
|
||||||
ipv4::init();
|
ipv4::init();
|
||||||
|
arp::init();
|
||||||
dispatch_schedule_ms(60000, igmp_reannounce);
|
dispatch_schedule_ms(60000, igmp_reannounce);
|
||||||
dlog("dispatch_init complete");
|
dlog("dispatch_init complete");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user