4 #include "config/config.h" 5 #include "crypto/keymanager.h" 6 #include "http/httpinterface.h" 7 #include "storage/invstorage.h" 8 #include "uptane/secondaryinterface.h" 10 const int MaxInitializationAttempts = 3;
15 std::shared_ptr<HttpInterface> http_client_in,
KeyManager& keys_in,
16 const std::map<
Uptane::EcuSerial, std::shared_ptr<Uptane::SecondaryInterface> >& secondaries_in);
18 class Error :
public std::runtime_error {
20 Error(
const std::string& what) : std::runtime_error(std::string(
"Initializer error: ") + what) {}
24 KeyGenerationError(
const std::string& what) :
Error(std::string(
"Could not generate uptane key pair: ") + what) {}
28 StorageError(
const std::string& what) :
Error(std::string(
"Storage error: ") + what) {}
32 ServerError(
const std::string& what) :
Error(std::string(
"Server error: ") + what) {}
41 std::shared_ptr<INvStorage> storage_;
42 std::shared_ptr<HttpInterface> http_client_;
44 const std::map<Uptane::EcuSerial, Uptane::SecondaryInterface::Ptr>& secondaries_;
45 std::vector<SecondaryInfo> sec_info_;
49 void initEcuSerials();
50 void resetEcuSerials();
51 void initPrimaryEcuKeys();
55 void initSecondaryInfo();
56 void initEcuRegister();
57 bool loadSetTlsCreds();
58 void initEcuReportCounter();
61 #endif // INITIALIZER_H_