core: client API Majestic, modèles et CLI check
- libopenpu : validation VIN, modèles JSON (getAvailableUpdate, devices), classification ecuType -> type/guide, sélection des mises à jour - couche Transport abstraite + implémentation libcurl (proxy env, redirections, streaming, timeout d'inactivité) - tolérance au EOF TLS sans close_notify de la passerelle Majestic, limitée aux corps délimités par la fermeture (ni Content-Length ni chunked) - openpu-cli : check / raw-devices / raw-updates - tests doctest (VIN, parsing, classification, client API avec faux transport), fixtures dont une capture réelle anonymisée (NAC wave 2) - qualité : presets CMake (debug, asan, tidy), .clang-tidy, tools/check.sh (tests, ASan/UBSan, valgrind, clang-tidy, cppcheck) - validé contre l'API réelle sur 3 véhicules (NAC w4, RCC, NAC w2) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WDASLCiN764v685boRVYar
This commit is contained in:
1 parent
660a420a3e
commit
95704f9882
28 files changed
+1877
-2
No files matched your search
@@ -0,0 +1,35 @@
|
||||
#include "openpu/vin.hpp"
|
||||
|
||||
#include <cctype>
|
||||
|
||||
namespace openpu {
|
||||
|
||||
std::string normalizeVin(std::string_view input)
|
||||
{
|
||||
std::string out;
|
||||
out.reserve(input.size());
|
||||
for (char c : input) {
|
||||
const auto uc = static_cast<unsigned char>(c);
|
||||
if (std::isspace(uc) != 0)
|
||||
continue;
|
||||
out.push_back(static_cast<char>(std::toupper(uc)));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
bool isValidVin(std::string_view vin)
|
||||
{
|
||||
if (vin.size() != 17)
|
||||
return false;
|
||||
if (vin[0] != 'V' || (vin[1] != 'F' && vin[1] != 'R') || vin[2] != '3')
|
||||
return false;
|
||||
for (std::size_t i = 3; i < vin.size(); ++i) {
|
||||
const char c = vin[i];
|
||||
const bool ok = (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9');
|
||||
if (!ok)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace openpu
|
||||
Reference in new issue
Block a user