Files
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

64 lines
1.8 KiB
C++

#include "cases/security/signing.hpp"
#include "cases/security/validation.hpp"
#include "options.hpp"
#include <boost/program_options.hpp>
#include <iostream>
#include <memory>
namespace po = boost::program_options;
std::unique_ptr<Case> parse_options(int argc, const char *argv[])
{
po::options_description global("Global options");
global.add_options()
("case", po::value<std::string>(), "Case to execute.")
("subargs", po::value<std::vector<std::string>>(), "Arguments for case.");
po::positional_options_description pos;
pos.add("case", 1);
pos.add("subargs", -1);
po::variables_map vm;
po::parsed_options parsed = po::command_line_parser(argc, argv)
.options(global)
.positional(pos)
.allow_unregistered()
.run();
po::store(parsed, vm);
po::notify(vm);
std::string available_commands = "Available cases: security-validation, security-signing";
if (!vm.count("case")) {
std::cerr << global << std::endl;
std::cerr << available_commands << std::endl;
return nullptr;
}
std::string name = vm["case"].as<std::string>();
std::unique_ptr<Case> instance;
if (name == "--help") {
std::cerr << global << std::endl;
std::cerr << available_commands << std::endl;
} else if (name == "security-signing") {
instance.reset(new SecuritySigningCase());
} else if (name == "security-validation") {
instance.reset(new SecurityValidationCase());
} else {
throw std::runtime_error("Unknown benchmark case.");
}
std::vector<std::string> opts = po::collect_unrecognized(parsed.options, po::include_positional);
opts.erase(opts.begin());
if (!instance->parse(opts)) {
return nullptr;
}
return instance;
}