blob: 41c0f8c38735d935134e2f35f41b0b1b0d39fbbb [file] [log] [blame]
Vince Lehmanc57c64b2015-08-10 12:21:31 -05001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
Davide Pesaventoe3c741d2019-01-29 20:28:15 -05002/*
3 * Copyright (c) 2014-2019, The University of Memphis,
Vince Lehmanc57c64b2015-08-10 12:21:31 -05004 * Regents of the University of California,
5 * Arizona Board of Regents.
6 *
7 * This file is part of NLSR (Named-data Link State Routing).
8 * See AUTHORS.md for complete list of NLSR authors and contributors.
9 *
10 * NLSR is free software: you can redistribute it and/or modify it under the terms
11 * of the GNU General Public License as published by the Free Software Foundation,
12 * either version 3 of the License, or (at your option) any later version.
13 *
14 * NLSR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
15 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 * PURPOSE. See the GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along with
19 * NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
20 **/
21
22#include "nlsr-runner.hpp"
Vince Lehmanc57c64b2015-08-10 12:21:31 -050023
24namespace nlsr {
25
Ashlesh Gawande85998a12017-12-07 22:22:13 -060026NlsrRunner::NlsrRunner(ndn::Face& face, ConfParameter& confParam)
27 : m_face(face)
28 , m_confParam(confParam)
29 , m_nlsr(m_face, m_keyChain, m_confParam)
Vince Lehmanc57c64b2015-08-10 12:21:31 -050030{
Vince Lehmanc57c64b2015-08-10 12:21:31 -050031}
32
33void
34NlsrRunner::run()
35{
Ashlesh Gawande7e3f6d72019-01-25 13:13:43 -060036 m_nlsr.initialize();
Davide Pesaventoe3c741d2019-01-29 20:28:15 -050037
Vince Lehmanc57c64b2015-08-10 12:21:31 -050038 try {
Ashlesh Gawande85998a12017-12-07 22:22:13 -060039 m_face.processEvents();
Vince Lehmanc57c64b2015-08-10 12:21:31 -050040 }
Davide Pesaventoe3c741d2019-01-29 20:28:15 -050041 catch (...) {
Vince Lehmanc57c64b2015-08-10 12:21:31 -050042 m_nlsr.getFib().clean();
Davide Pesaventoe3c741d2019-01-29 20:28:15 -050043 throw;
Vince Lehmanc57c64b2015-08-10 12:21:31 -050044 }
45}
46
Vince Lehmanc57c64b2015-08-10 12:21:31 -050047} // namespace nlsr