blob: 0328ecd9907071bc46f84f5549b0018fa728c06a [file] [log] [blame]
akmhoque3d06e792014-05-27 16:23:20 -05001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (c) 2014 University of Memphis,
4 * Regents of the University of California
5 *
6 * This file is part of NLSR (Named-data Link State Routing).
7 * See AUTHORS.md for complete list of NLSR authors and contributors.
8 *
9 * NLSR is free software: you can redistribute it and/or modify it under the terms
10 * of the GNU General Public License as published by the Free Software Foundation,
11 * either version 3 of the License, or (at your option) any later version.
12 *
13 * NLSR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
14 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
19 *
20 * \author A K M Mahmudul Hoque <ahoque1@memphis.edu>
21 * \author Minsheng Zhang <mzhang4@memphis.edu>
22 *
23 **/
akmhoque53353462014-04-22 08:43:45 -050024#include <iostream>
25#include <fstream>
akmhoque157b0a42014-05-13 00:26:37 -050026#include <boost/algorithm/string.hpp>
27#include <boost/property_tree/info_parser.hpp>
28#include <boost/property_tree/ptree.hpp>
akmhoque674b0b12014-05-20 14:33:28 -050029#include <boost/filesystem.hpp>
akmhoque53353462014-04-22 08:43:45 -050030
akmhoque157b0a42014-05-13 00:26:37 -050031#include <ndn-cxx/name.hpp>
32
akmhoque53353462014-04-22 08:43:45 -050033#include "conf-parameter.hpp"
akmhoque157b0a42014-05-13 00:26:37 -050034#include "conf-file-processor.hpp"
akmhoque53353462014-04-22 08:43:45 -050035#include "adjacent.hpp"
akmhoque157b0a42014-05-13 00:26:37 -050036#include "utility/name-helper.hpp"
akmhoque53353462014-04-22 08:43:45 -050037
akmhoque53353462014-04-22 08:43:45 -050038namespace nlsr {
39
40using namespace std;
41
akmhoque157b0a42014-05-13 00:26:37 -050042bool
akmhoqueb6450b12014-04-24 00:01:03 -050043ConfFileProcessor::processConfFile()
akmhoque53353462014-04-22 08:43:45 -050044{
akmhoque157b0a42014-05-13 00:26:37 -050045 bool ret = true;
46 ifstream inputFile;
47 inputFile.open(m_confFileName.c_str());
48 if (!inputFile.is_open()) {
49 string msg = "Failed to read configuration file: ";
50 msg += m_confFileName;
51 cerr << msg << endl;
akmhoquead5fe952014-06-26 13:34:12 -050052 return false;
akmhoque157b0a42014-05-13 00:26:37 -050053 }
54 ret = load(inputFile);
55 inputFile.close();
56 return ret;
57}
58
59bool
60ConfFileProcessor::load(istream& input)
61{
Alexander Afanasyev8388ec62014-08-16 18:38:57 -070062 ConfigSection pt;
akmhoque157b0a42014-05-13 00:26:37 -050063 bool ret = true;
64 try {
65 boost::property_tree::read_info(input, pt);
66 }
67 catch (const boost::property_tree::info_parser_error& error) {
68 stringstream msg;
69 std::cerr << "Failed to parse configuration file " << std::endl;
70 std::cerr << m_confFileName << std::endl;
71 return false;
72 }
Alexander Afanasyev8388ec62014-08-16 18:38:57 -070073
74 for (ConfigSection::const_iterator tn = pt.begin();
akmhoque157b0a42014-05-13 00:26:37 -050075 tn != pt.end(); ++tn) {
Alexander Afanasyev8388ec62014-08-16 18:38:57 -070076 ret = processSection(tn->first, tn->second);
akmhoque157b0a42014-05-13 00:26:37 -050077 if (ret == false) {
78 break;
79 }
80 }
81 return ret;
82}
83
84bool
Alexander Afanasyev8388ec62014-08-16 18:38:57 -070085ConfFileProcessor::processSection(const std::string& sectionName, const ConfigSection& section)
akmhoque157b0a42014-05-13 00:26:37 -050086{
87 bool ret = true;
Alexander Afanasyev8388ec62014-08-16 18:38:57 -070088 if (sectionName == "general")
akmhoque53353462014-04-22 08:43:45 -050089 {
Alexander Afanasyev8388ec62014-08-16 18:38:57 -070090 ret = processConfSectionGeneral(section);
akmhoque157b0a42014-05-13 00:26:37 -050091 }
Alexander Afanasyev8388ec62014-08-16 18:38:57 -070092 else if (sectionName == "neighbors")
akmhoque157b0a42014-05-13 00:26:37 -050093 {
Alexander Afanasyev8388ec62014-08-16 18:38:57 -070094 ret = processConfSectionNeighbors(section);
akmhoque157b0a42014-05-13 00:26:37 -050095 }
Alexander Afanasyev8388ec62014-08-16 18:38:57 -070096 else if (sectionName == "hyperbolic")
akmhoque157b0a42014-05-13 00:26:37 -050097 {
Alexander Afanasyev8388ec62014-08-16 18:38:57 -070098 ret = processConfSectionHyperbolic(section);
akmhoque157b0a42014-05-13 00:26:37 -050099 }
Alexander Afanasyev8388ec62014-08-16 18:38:57 -0700100 else if (sectionName == "fib")
akmhoque157b0a42014-05-13 00:26:37 -0500101 {
Alexander Afanasyev8388ec62014-08-16 18:38:57 -0700102 ret = processConfSectionFib(section);
akmhoque157b0a42014-05-13 00:26:37 -0500103 }
Alexander Afanasyev8388ec62014-08-16 18:38:57 -0700104 else if (sectionName == "advertising")
akmhoque157b0a42014-05-13 00:26:37 -0500105 {
Alexander Afanasyev8388ec62014-08-16 18:38:57 -0700106 ret = processConfSectionAdvertising(section);
akmhoque157b0a42014-05-13 00:26:37 -0500107 }
Alexander Afanasyev8388ec62014-08-16 18:38:57 -0700108 else if (sectionName == "security")
Yingdi Yu20e3a6e2014-05-26 23:16:10 -0700109 {
Alexander Afanasyev8388ec62014-08-16 18:38:57 -0700110 ret = processConfSectionSecurity(section);
Yingdi Yu20e3a6e2014-05-26 23:16:10 -0700111 }
akmhoque157b0a42014-05-13 00:26:37 -0500112 else
113 {
Alexander Afanasyev8388ec62014-08-16 18:38:57 -0700114 std::cerr << "Wrong configuration section: " << sectionName << std::endl;
akmhoque157b0a42014-05-13 00:26:37 -0500115 }
116 return ret;
117}
118
119bool
Alexander Afanasyev8388ec62014-08-16 18:38:57 -0700120ConfFileProcessor::processConfSectionGeneral(const ConfigSection& section)
akmhoque157b0a42014-05-13 00:26:37 -0500121{
122 try {
Alexander Afanasyev8388ec62014-08-16 18:38:57 -0700123 std::string network = section.get<string>("network");
124 std::string site = section.get<string>("site");
125 std::string router = section.get<string>("router");
akmhoque157b0a42014-05-13 00:26:37 -0500126 ndn::Name networkName(network);
127 if (!networkName.empty()) {
128 m_nlsr.getConfParameter().setNetwork(networkName);
129 }
130 else {
131 cerr << " Network can not be null or empty or in bad URI format :(!" << endl;
132 return false;
133 }
134 ndn::Name siteName(site);
135 if (!siteName.empty()) {
136 m_nlsr.getConfParameter().setSiteName(siteName);
137 }
138 else {
139 cerr << "Site can not be null or empty or in bad URI format:( !" << endl;
140 return false;
141 }
142 ndn::Name routerName(router);
143 if (!routerName.empty()) {
144 m_nlsr.getConfParameter().setRouterName(routerName);
145 }
146 else {
147 cerr << " Router name can not be null or empty or in bad URI format:( !" << endl;
148 return false;
149 }
150 }
151 catch (const std::exception& ex) {
152 cerr << ex.what() << endl;
153 return false;
154 }
Yingdi Yu20e3a6e2014-05-26 23:16:10 -0700155
akmhoque157b0a42014-05-13 00:26:37 -0500156 try {
Alexander Afanasyev8388ec62014-08-16 18:38:57 -0700157 int32_t lsaRefreshTime = section.get<int32_t>("lsa-refresh-time");
akmhoque157b0a42014-05-13 00:26:37 -0500158 if (lsaRefreshTime >= LSA_REFRESH_TIME_MIN &&
159 lsaRefreshTime <= LSA_REFRESH_TIME_MAX) {
160 m_nlsr.getConfParameter().setLsaRefreshTime(lsaRefreshTime);
161 }
162 else {
163 std::cerr << "Wrong value for lsa-refresh-time ";
164 std::cerr << "Allowed value: " << LSA_REFRESH_TIME_MIN << "-";;
165 std::cerr << LSA_REFRESH_TIME_MAX << std::endl;
166 return false;
167 }
168 }
169 catch (const std::exception& ex) {
170 std::cerr << ex.what() << std::endl;
171 return false;
172 }
Yingdi Yu20e3a6e2014-05-26 23:16:10 -0700173
akmhoque157b0a42014-05-13 00:26:37 -0500174 try {
Alexander Afanasyev8388ec62014-08-16 18:38:57 -0700175 std::string logLevel = section.get<string>("log-level");
akmhoque157b0a42014-05-13 00:26:37 -0500176 if ( boost::iequals(logLevel, "info") || boost::iequals(logLevel, "debug")) {
177 m_nlsr.getConfParameter().setLogLevel(logLevel);
178 }
179 else {
180 std::cerr << "Wrong value for log-level ";
181 std::cerr << "Allowed value: INFO, DEBUG" << std::endl;
182 return false;
183 }
184 }
185 catch (const std::exception& ex) {
186 std::cerr << ex.what() << std::endl;
187 return false;
188 }
Yingdi Yu20e3a6e2014-05-26 23:16:10 -0700189
akmhoque674b0b12014-05-20 14:33:28 -0500190 try {
Alexander Afanasyev8388ec62014-08-16 18:38:57 -0700191 std::string logDir = section.get<string>("log-dir");
akmhoque674b0b12014-05-20 14:33:28 -0500192 if (boost::filesystem::exists(logDir)) {
193 if (boost::filesystem::is_directory(logDir)) {
194 std::string testFileName=logDir+"/test.log";
195 ofstream testOutFile;
196 testOutFile.open(testFileName.c_str());
197 if (testOutFile.is_open() && testOutFile.good()) {
198 m_nlsr.getConfParameter().setLogDir(logDir);
199 }
200 else {
201 std::cerr << "User does not have read and write permission on the directory";
202 std::cerr << std::endl;
203 return false;
204 }
205 testOutFile.close();
206 remove(testFileName.c_str());
207 }
208 else {
209 std::cerr << "Provided path is not a directory" << std::endl;
210 return false;
211 }
212 }
213 else {
214 std::cerr << "Log directory provided does not exists" << std::endl;
215 return false;
216 }
217 }
218 catch (const std::exception& ex) {
219 std::cerr << "You must configure log directory" << std::endl;
220 std::cerr << ex.what() << std::endl;
221 return false;
222 }
223 try {
Alexander Afanasyev8388ec62014-08-16 18:38:57 -0700224 std::string seqDir = section.get<string>("seq-dir");
akmhoque674b0b12014-05-20 14:33:28 -0500225 if (boost::filesystem::exists(seqDir)) {
226 if (boost::filesystem::is_directory(seqDir)) {
227 std::string testFileName=seqDir+"/test.seq";
228 ofstream testOutFile;
229 testOutFile.open(testFileName.c_str());
230 if (testOutFile.is_open() && testOutFile.good()) {
231 m_nlsr.getConfParameter().setSeqFileDir(seqDir);
232 }
233 else {
234 std::cerr << "User does not have read and write permission on the directory";
235 std::cerr << std::endl;
236 return false;
237 }
238 testOutFile.close();
239 remove(testFileName.c_str());
240 }
241 else {
242 std::cerr << "Provided path is not a directory" << std::endl;
243 return false;
244 }
245 }
246 else {
247 std::cerr << "Seq directory provided does not exists" << std::endl;
248 return false;
249 }
250 }
251 catch (const std::exception& ex) {
252 std::cerr << "You must configure sequence directory" << std::endl;
253 std::cerr << ex.what() << std::endl;
254 return false;
255 }
Yingdi Yu20e3a6e2014-05-26 23:16:10 -0700256
akmhoque157b0a42014-05-13 00:26:37 -0500257 return true;
258}
259
260bool
Alexander Afanasyev8388ec62014-08-16 18:38:57 -0700261ConfFileProcessor::processConfSectionNeighbors(const ConfigSection& section)
akmhoque157b0a42014-05-13 00:26:37 -0500262{
263 try {
Alexander Afanasyev8388ec62014-08-16 18:38:57 -0700264 int retrials = section.get<int>("hello-retries");
akmhoque157b0a42014-05-13 00:26:37 -0500265 if (retrials >= HELLO_RETRIES_MIN && retrials <= HELLO_RETRIES_MAX) {
266 m_nlsr.getConfParameter().setInterestRetryNumber(retrials);
267 }
268 else {
269 std::cerr << "Wrong value for hello-retries. ";
270 std::cerr << "Allowed value:" << HELLO_RETRIES_MIN << "-";
271 std::cerr << HELLO_RETRIES_MAX << std::endl;
272 return false;
273 }
274 }
275 catch (const std::exception& ex) {
276 std::cerr << ex.what() << std::endl;
277 return false;
278 }
279 try {
Alexander Afanasyev8388ec62014-08-16 18:38:57 -0700280 int timeOut = section.get<int>("hello-timeout");
akmhoque157b0a42014-05-13 00:26:37 -0500281 if (timeOut >= HELLO_TIMEOUT_MIN && timeOut <= HELLO_TIMEOUT_MAX) {
282 m_nlsr.getConfParameter().setInterestResendTime(timeOut);
283 }
284 else {
285 std::cerr << "Wrong value for hello-timeout. ";
286 std::cerr << "Allowed value:" << HELLO_TIMEOUT_MIN << "-";
287 std::cerr << HELLO_TIMEOUT_MAX << std::endl;
288 return false;
289 }
290 }
291 catch (const std::exception& ex) {
292 std::cerr << ex.what() << std::endl;
293 }
294 try {
Alexander Afanasyev8388ec62014-08-16 18:38:57 -0700295 int interval = section.get<int>("hello-interval");
akmhoque157b0a42014-05-13 00:26:37 -0500296 if (interval >= HELLO_INTERVAL_MIN && interval <= HELLO_INTERVAL_MAX) {
297 m_nlsr.getConfParameter().setInfoInterestInterval(interval);
298 }
299 else {
300 std::cerr << "Wrong value for hello-interval. ";
301 std::cerr << "Allowed value:" << HELLO_INTERVAL_MIN << "-";
302 std::cerr << HELLO_INTERVAL_MAX << std::endl;
303 return false;
304 }
305 }
306 catch (const std::exception& ex) {
307 std::cerr << ex.what() << std::endl;
308 }
Alexander Afanasyev8388ec62014-08-16 18:38:57 -0700309 for (ConfigSection::const_iterator tn =
310 section.begin(); tn != section.end(); ++tn) {
Yingdi Yu20e3a6e2014-05-26 23:16:10 -0700311
akmhoque157b0a42014-05-13 00:26:37 -0500312 if (tn->first == "neighbor")
akmhoque53353462014-04-22 08:43:45 -0500313 {
akmhoque157b0a42014-05-13 00:26:37 -0500314 try {
Alexander Afanasyev8388ec62014-08-16 18:38:57 -0700315 ConfigSection CommandAttriTree = tn->second;
akmhoque157b0a42014-05-13 00:26:37 -0500316 std::string name = CommandAttriTree.get<std::string>("name");
317 std::string faceUri = CommandAttriTree.get<std::string>("face-uri");
318 double linkCost = CommandAttriTree.get<double>("link-cost",
319 Adjacent::DEFAULT_LINK_COST);
320 ndn::Name neighborName(name);
321 if (!neighborName.empty()) {
akmhoquec04e7272014-07-02 11:00:14 -0500322 Adjacent adj(name, faceUri, linkCost, ADJACENT_STATUS_INACTIVE, 0, 0);
akmhoque157b0a42014-05-13 00:26:37 -0500323 m_nlsr.getAdjacencyList().insert(adj);
324 }
325 else {
akmhoque674b0b12014-05-20 14:33:28 -0500326 std::cerr << " Wrong command format ! [name /nbr/name/ \n face-uri /uri\n]";
akmhoque157b0a42014-05-13 00:26:37 -0500327 std::cerr << " or bad URI format" << std::endl;
akmhoque53353462014-04-22 08:43:45 -0500328 }
329 }
akmhoque157b0a42014-05-13 00:26:37 -0500330 catch (const std::exception& ex) {
331 std::cerr << ex.what() << std::endl;
332 return false;
333 }
akmhoque53353462014-04-22 08:43:45 -0500334 }
335 }
akmhoque157b0a42014-05-13 00:26:37 -0500336 return true;
akmhoque53353462014-04-22 08:43:45 -0500337}
338
akmhoque157b0a42014-05-13 00:26:37 -0500339bool
Alexander Afanasyev8388ec62014-08-16 18:38:57 -0700340ConfFileProcessor::processConfSectionHyperbolic(const ConfigSection& section)
akmhoque53353462014-04-22 08:43:45 -0500341{
akmhoque157b0a42014-05-13 00:26:37 -0500342 std::string state;
343 try {
Alexander Afanasyev8388ec62014-08-16 18:38:57 -0700344 state= section.get<string>("state","off");
akmhoque157b0a42014-05-13 00:26:37 -0500345 if (boost::iequals(state, "off")) {
346 m_nlsr.getConfParameter().setHyperbolicState(HYPERBOLIC_STATE_OFF);
347 }
348 else if (boost::iequals(state, "on")) {
349 m_nlsr.getConfParameter().setHyperbolicState(HYPERBOLIC_STATE_ON);
350 }
351 else if (state == "dry-run") {
352 m_nlsr.getConfParameter().setHyperbolicState(HYPERBOLIC_STATE_DRY_RUN);
353 }
354 else {
355 std::cerr << "Wrong format for hyperbolic state." << std::endl;
356 std::cerr << "Allowed value: off, on, dry-run" << std::endl;
357 return false;
358 }
akmhoque53353462014-04-22 08:43:45 -0500359 }
akmhoque157b0a42014-05-13 00:26:37 -0500360 catch (const std::exception& ex) {
361 std::cerr << ex.what() << std::endl;
362 return false;
akmhoque53353462014-04-22 08:43:45 -0500363 }
Yingdi Yu20e3a6e2014-05-26 23:16:10 -0700364
akmhoque157b0a42014-05-13 00:26:37 -0500365 try {
366 /* Radius and angle is mandatory configuration parameter in hyperbolic section.
367 * Even if router can have hyperbolic routing calculation off but other router
368 * in the network may use hyperbolic routing calculation for FIB generation.
369 * So each router need to advertise its hyperbolic coordinates in the network
370 */
Alexander Afanasyev8388ec62014-08-16 18:38:57 -0700371 double radius = section.get<double>("radius");
372 double angle = section.get<double>("angle");
akmhoque157b0a42014-05-13 00:26:37 -0500373 if (!m_nlsr.getConfParameter().setCorR(radius)) {
374 return false;
375 }
376 m_nlsr.getConfParameter().setCorTheta(angle);
akmhoque53353462014-04-22 08:43:45 -0500377 }
akmhoque157b0a42014-05-13 00:26:37 -0500378 catch (const std::exception& ex) {
379 std::cerr << ex.what() << std::endl;
380 if (state == "on" || state == "dry-run") {
381 return false;
382 }
akmhoque53353462014-04-22 08:43:45 -0500383 }
Yingdi Yu20e3a6e2014-05-26 23:16:10 -0700384
akmhoque157b0a42014-05-13 00:26:37 -0500385 return true;
akmhoque53353462014-04-22 08:43:45 -0500386}
387
akmhoque157b0a42014-05-13 00:26:37 -0500388bool
Alexander Afanasyev8388ec62014-08-16 18:38:57 -0700389ConfFileProcessor::processConfSectionFib(const ConfigSection& section)
akmhoque53353462014-04-22 08:43:45 -0500390{
akmhoque157b0a42014-05-13 00:26:37 -0500391 try {
392 int maxFacesPerPrefixNumber =
Alexander Afanasyev8388ec62014-08-16 18:38:57 -0700393 section.get<int>("max-faces-per-prefix");
akmhoque157b0a42014-05-13 00:26:37 -0500394 if (maxFacesPerPrefixNumber >= MAX_FACES_PER_PREFIX_MIN &&
395 maxFacesPerPrefixNumber <= MAX_FACES_PER_PREFIX_MAX)
akmhoque53353462014-04-22 08:43:45 -0500396 {
akmhoque157b0a42014-05-13 00:26:37 -0500397 m_nlsr.getConfParameter().setMaxFacesPerPrefix(maxFacesPerPrefixNumber);
akmhoque53353462014-04-22 08:43:45 -0500398 }
akmhoque157b0a42014-05-13 00:26:37 -0500399 else {
400 std::cerr << "Wrong value for max-faces-per-prefix. ";
akmhoque157b0a42014-05-13 00:26:37 -0500401 std::cerr << MAX_FACES_PER_PREFIX_MIN << std::endl;
402 return false;
akmhoque53353462014-04-22 08:43:45 -0500403 }
akmhoque53353462014-04-22 08:43:45 -0500404 }
akmhoque157b0a42014-05-13 00:26:37 -0500405 catch (const std::exception& ex) {
406 cerr << ex.what() << endl;
407 return false;
408 }
409 return true;
akmhoque53353462014-04-22 08:43:45 -0500410}
411
akmhoque157b0a42014-05-13 00:26:37 -0500412bool
Alexander Afanasyev8388ec62014-08-16 18:38:57 -0700413ConfFileProcessor::processConfSectionAdvertising(const ConfigSection& section)
akmhoque53353462014-04-22 08:43:45 -0500414{
Alexander Afanasyev8388ec62014-08-16 18:38:57 -0700415 for (ConfigSection::const_iterator tn =
416 section.begin(); tn != section.end(); ++tn) {
akmhoque157b0a42014-05-13 00:26:37 -0500417 if (tn->first == "prefix") {
418 try {
419 std::string prefix = tn->second.data();
420 ndn::Name namePrefix(prefix);
421 if (!namePrefix.empty()) {
422 m_nlsr.getNamePrefixList().insert(namePrefix);
423 }
424 else {
akmhoque674b0b12014-05-20 14:33:28 -0500425 std::cerr << " Wrong command format ! [prefix /name/prefix] or bad URI" << std::endl;
akmhoque157b0a42014-05-13 00:26:37 -0500426 return false;
427 }
428 }
429 catch (const std::exception& ex) {
430 std::cerr << ex.what() << std::endl;
431 return false;
432 }
akmhoque53353462014-04-22 08:43:45 -0500433 }
akmhoque53353462014-04-22 08:43:45 -0500434 }
akmhoque157b0a42014-05-13 00:26:37 -0500435 return true;
akmhoque53353462014-04-22 08:43:45 -0500436}
Yingdi Yu20e3a6e2014-05-26 23:16:10 -0700437
438bool
Alexander Afanasyev8388ec62014-08-16 18:38:57 -0700439ConfFileProcessor::processConfSectionSecurity(const ConfigSection& section)
Yingdi Yu20e3a6e2014-05-26 23:16:10 -0700440{
441 ConfigSection::const_iterator it = section.begin();
442
443 if (it == section.end() || it->first != "validator")
444 {
445 std::cerr << "Error: Expect validator section!" << std::endl;
446 return false;
447 }
448
449 m_nlsr.loadValidator(it->second, m_confFileName);
akmhoqued57f3672014-06-10 10:41:32 -0500450 it++;
Yingdi Yu20e3a6e2014-05-26 23:16:10 -0700451
452 for (; it != section.end(); it++)
453 {
454 using namespace boost::filesystem;
455 if (it->first != "cert-to-publish")
456 {
457 std::cerr << "Error: Expect cert-to-publish!" << std::endl;
458 return false;
459 }
460
461 std::string file = it->second.data();
462 path certfilePath = absolute(file, path(m_confFileName).parent_path());
463 ndn::shared_ptr<ndn::IdentityCertificate> idCert =
464 ndn::io::load<ndn::IdentityCertificate>(certfilePath.string());
465
466 if (!static_cast<bool>(idCert))
467 {
468 std::cerr << "Error: Cannot load cert-to-publish: " << file << "!" << std::endl;
469 return false;
470 }
471
472 m_nlsr.loadCertToPublish(idCert);
473 }
474
475 return true;
476}
477
Alexander Afanasyev8388ec62014-08-16 18:38:57 -0700478} // namespace nlsr