MCPcopy Create free account
hub / github.com/OpenVPN/openvpn3-linux / LoadProtocolProfiles

Method LoadProtocolProfiles

addons/devposture/service.cpp:73–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71
72
73void Handler::LoadProtocolProfiles(const std::string &profile_dir)
74{
75 namespace fs = std::filesystem;
76
77 try
78 {
79 for (const auto &entry : fs::directory_iterator(profile_dir))
80 {
81 auto p = entry.path();
82
83 if (p.extension() == ".json")
84 {
85 std::ifstream profile_stream(p, std::ios::in | std::ios::binary);
86 Json::Value profile_json;
87
88 profile_stream >> profile_json;
89
90 profiles_[p.stem()] = profile_json;
91 }
92 }
93 }
94 catch (const std::exception &e)
95 {
96 using namespace std::string_literals;
97
98 signals_->LogError("Error parsing protocol profiles: "s + e.what());
99 }
100}
101
102
103Json::Value Handler::compose_json(const Module::Dictionary &dict, const Json::Value &result_mapping) const

Callers 1

devposture_mainFunction · 0.80

Calls 2

LogErrorMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected