tylerliu | 01d63ca | 2020-10-06 16:29:23 -0700 | [diff] [blame] | 1 | // |
| 2 | // Created by Tyler on 10/6/20. |
| 3 | // |
| 4 | |
| 5 | #include "assignment-random.hpp" |
| 6 | #include <ndn-cxx/util/random.hpp> |
| 7 | |
| 8 | namespace ndn { |
| 9 | namespace ndncert { |
| 10 | |
| 11 | _LOG_INIT(ndncert.assignment.random); |
tylerliu | afb27a0 | 2020-10-06 17:20:06 -0700 | [diff] [blame] | 12 | |
tylerliu | 01d63ca | 2020-10-06 16:29:23 -0700 | [diff] [blame] | 13 | NDNCERT_REGISTER_FUNCFACTORY(AssignmentRandom, "random"); |
| 14 | |
| 15 | AssignmentRandom::AssignmentRandom() |
| 16 | : NameAssignmentFuncFactory("random") |
| 17 | { |
| 18 | } |
| 19 | |
| 20 | NameAssignmentFunc |
| 21 | AssignmentRandom::getFunction(const std::string &factoryParam) { |
| 22 | return [](const std::vector<std::tuple<std::string, std::string>>){ |
| 23 | std::vector<PartialName> names; |
| 24 | names.emplace_back(to_string(random::generateSecureWord64())); |
| 25 | return names; |
| 26 | }; |
| 27 | } |
| 28 | |
| 29 | } |
| 30 | } |