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); |
| 12 | NDNCERT_REGISTER_FUNCFACTORY(AssignmentRandom, "random"); |
| 13 | |
| 14 | AssignmentRandom::AssignmentRandom() |
| 15 | : NameAssignmentFuncFactory("random") |
| 16 | { |
| 17 | } |
| 18 | |
| 19 | NameAssignmentFunc |
| 20 | AssignmentRandom::getFunction(const std::string &factoryParam) { |
| 21 | return [](const std::vector<std::tuple<std::string, std::string>>){ |
| 22 | std::vector<PartialName> names; |
| 23 | names.emplace_back(to_string(random::generateSecureWord64())); |
| 24 | return names; |
| 25 | }; |
| 26 | } |
| 27 | |
| 28 | } |
| 29 | } |