Files
MicrOBU/obu-firmware/external/vanetza-idf/tools/fuzz-harness/router_fuzzing_context.cpp
T
Ashin Walpola d107534eb2 Keep vanetza-idf in obu-firmware, so a plain clone builds the firmware
obu-firmware builds against the vanetza-idf C-ITS library, which until now
came from the colleague's microbu-esp32c5 tree beside the repository and was
not tracked here, so a clone of this repository could not build the firmware
it ships. The library alone is now part of obu-firmware, as
obu-firmware/external/vanetza-idf: their external/vanetza-idf at commit
cf4b99f, unchanged (9775 files; see its PROVENANCE.md). CMake takes it from
there by default; -DVANETZA_IDF_DIR still points the build elsewhere.

The rest of the colleague's tree (their own VAM firmware, PKI tooling,
station-link Python tools, the V2X2MAP bridge) stays out of this repository
and gitignored; nothing is pushed to their repository. NOTES.md, docs/06,
TODO.md and the pcap verifier's usage line point at the new location.
2026-09-24 10:56:05 +02:00

46 lines
1.4 KiB
C++

#include "router_fuzzing_context.hpp"
namespace vanetza
{
class FuzzingRequestInterface : public dcc::RequestInterface
{
void request(const dcc::DataRequest&, std::unique_ptr<ChunkPacket>) override {}
};
class FuzzingTransportInterface : public geonet::TransportInterface
{
void indicate(const geonet::DataIndication&, std::unique_ptr<geonet::UpPacket>) override {}
};
RouterFuzzingContext::RouterFuzzingContext() :
runtime(vanetza::Clock::at("2010-12-23 18:29")),
security(runtime),
req_ifc(std::make_unique<FuzzingRequestInterface>()),
ind_ifc(std::make_unique<FuzzingTransportInterface>())
{
initialize();
}
void RouterFuzzingContext::initialize()
{
router = std::make_unique<geonet::Router>(runtime, mib);
router->set_security_entity(&security.entity());
router->set_access_interface(req_ifc.get());
router->set_transport_handler(geonet::UpperProtocol::BTP_B, ind_ifc.get());
geonet::Address gn_addr;
gn_addr.mid(MacAddress{0, 0, 0, 0, 0, 1});
router->set_address(gn_addr);
}
void RouterFuzzingContext::indicate(ByteBuffer&& buffer)
{
MacAddress source { 0, 0, 0, 0, 0, 2 };
MacAddress destination { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
auto packet = std::make_unique<geonet::UpPacket>(CohesivePacket { std::move(buffer), OsiLayer::Network });
router->indicate(std::move(packet), source, destination);
}
} // namespace vanetza