akmhoque | 3d06e79 | 2014-05-27 16:23:20 -0500 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
Vince Lehman | c2e51f6 | 2015-01-20 15:03:11 -0600 | [diff] [blame] | 3 | * Copyright (c) 2014-2015, The University of Memphis, |
| 4 | * Regents of the University of California, |
| 5 | * Arizona Board of Regents. |
akmhoque | 3d06e79 | 2014-05-27 16:23:20 -0500 | [diff] [blame] | 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/>. |
akmhoque | 3d06e79 | 2014-05-27 16:23:20 -0500 | [diff] [blame] | 20 | **/ |
Vince Lehman | c2e51f6 | 2015-01-20 15:03:11 -0600 | [diff] [blame] | 21 | |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 22 | #ifndef NLSR_HPP |
| 23 | #define NLSR_HPP |
| 24 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 25 | #include <boost/cstdint.hpp> |
| 26 | #include <stdexcept> |
| 27 | |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 28 | #include <ndn-cxx/face.hpp> |
| 29 | #include <ndn-cxx/security/key-chain.hpp> |
Yingdi Yu | 20e3a6e | 2014-05-26 23:16:10 -0700 | [diff] [blame] | 30 | #include <ndn-cxx/security/certificate-cache-ttl.hpp> |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 31 | #include <ndn-cxx/util/scheduler.hpp> |
akmhoque | c04e727 | 2014-07-02 11:00:14 -0500 | [diff] [blame] | 32 | #include <ndn-cxx/management/nfd-face-event-notification.hpp> |
akmhoque | 060d302 | 2014-08-12 13:35:06 -0500 | [diff] [blame] | 33 | #include <ndn-cxx/management/nfd-face-monitor.hpp> |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 34 | |
Vince Lehman | 0a7da61 | 2014-10-29 14:39:29 -0500 | [diff] [blame] | 35 | #include "common.hpp" |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 36 | #include "conf-parameter.hpp" |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 37 | #include "adjacency-list.hpp" |
| 38 | #include "name-prefix-list.hpp" |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 39 | #include "lsdb.hpp" |
| 40 | #include "sequencing-manager.hpp" |
| 41 | #include "route/routing-table.hpp" |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 42 | #include "route/name-prefix-table.hpp" |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 43 | #include "route/fib.hpp" |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 44 | #include "communication/sync-logic-handler.hpp" |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 45 | #include "hello-protocol.hpp" |
Vince Lehman | 7b61658 | 2014-10-17 16:25:39 -0500 | [diff] [blame] | 46 | #include "test-access-control.hpp" |
Jiewen Tan | a0497d8 | 2015-02-02 21:59:18 -0800 | [diff] [blame] | 47 | #include "publisher/lsdb-dataset-interest-handler.hpp" |
akmhoque | 2bb198e | 2014-02-28 11:46:27 -0600 | [diff] [blame] | 48 | |
Yingdi Yu | 20e3a6e | 2014-05-26 23:16:10 -0700 | [diff] [blame] | 49 | #include "validator.hpp" |
| 50 | |
akmhoque | 2bb198e | 2014-02-28 11:46:27 -0600 | [diff] [blame] | 51 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 52 | namespace nlsr { |
| 53 | |
Yingdi Yu | 20e3a6e | 2014-05-26 23:16:10 -0700 | [diff] [blame] | 54 | static ndn::Name DEFAULT_BROADCAST_PREFIX("/ndn/broadcast"); |
| 55 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 56 | class Nlsr |
| 57 | { |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 58 | class Error : public std::runtime_error |
| 59 | { |
| 60 | public: |
| 61 | explicit |
| 62 | Error(const std::string& what) |
| 63 | : std::runtime_error(what) |
| 64 | { |
| 65 | } |
| 66 | }; |
| 67 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 68 | public: |
Vince Lehman | 904c241 | 2014-09-23 19:36:11 -0500 | [diff] [blame] | 69 | Nlsr(boost::asio::io_service& ioService, ndn::Scheduler& scheduler, ndn::Face& face) |
| 70 | : m_nlsrFace(face) |
Vince Lehman | 7c60329 | 2014-09-11 17:48:16 -0500 | [diff] [blame] | 71 | , m_scheduler(scheduler) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 72 | , m_confParam() |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 73 | , m_adjacencyList() |
| 74 | , m_namePrefixList() |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 75 | , m_sequencingManager() |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 76 | , m_isDaemonProcess(false) |
| 77 | , m_configFileName("nlsr.conf") |
Vince Lehman | 0bcf9a3 | 2014-12-10 11:24:45 -0600 | [diff] [blame] | 78 | , m_nlsrLsdb(*this, scheduler, m_syncLogicHandler) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 79 | , m_adjBuildCount(0) |
| 80 | , m_isBuildAdjLsaSheduled(false) |
| 81 | , m_isRouteCalculationScheduled(false) |
| 82 | , m_isRoutingTableCalculating(false) |
Vince Lehman | 7c60329 | 2014-09-11 17:48:16 -0500 | [diff] [blame] | 83 | , m_routingTable(scheduler) |
Vince Lehman | b7079a1 | 2014-11-04 12:45:50 -0600 | [diff] [blame] | 84 | , m_fib(m_nlsrFace, scheduler, m_adjacencyList, m_confParam, m_keyChain) |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 85 | , m_namePrefixTable(*this) |
Vince Lehman | 0bcf9a3 | 2014-12-10 11:24:45 -0600 | [diff] [blame] | 86 | , m_syncLogicHandler(m_nlsrFace, m_nlsrLsdb, m_confParam, m_sequencingManager) |
Vince Lehman | 7c60329 | 2014-09-11 17:48:16 -0500 | [diff] [blame] | 87 | , m_helloProtocol(*this, scheduler) |
| 88 | , m_certificateCache(new ndn::CertificateCacheTtl(ioService)) |
Yingdi Yu | 20e3a6e | 2014-05-26 23:16:10 -0700 | [diff] [blame] | 89 | , m_validator(m_nlsrFace, DEFAULT_BROADCAST_PREFIX, m_certificateCache) |
akmhoque | 060d302 | 2014-08-12 13:35:06 -0500 | [diff] [blame] | 90 | , m_faceMonitor(m_nlsrFace) |
Vince Lehman | 7b61658 | 2014-10-17 16:25:39 -0500 | [diff] [blame] | 91 | , m_firstHelloInterval(FIRST_HELLO_INTERVAL_DEFAULT) |
akmhoque | 060d302 | 2014-08-12 13:35:06 -0500 | [diff] [blame] | 92 | { |
Vince Lehman | f814205 | 2015-01-21 11:11:36 -0600 | [diff] [blame] | 93 | m_faceMonitor.onNotification.connect(bind(&Nlsr::onFaceEventNotification, this, _1)); |
akmhoque | 060d302 | 2014-08-12 13:35:06 -0500 | [diff] [blame] | 94 | m_faceMonitor.start(); |
| 95 | } |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 96 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 97 | void |
| 98 | registrationFailed(const ndn::Name& name); |
| 99 | |
| 100 | void |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 101 | onRegistrationSuccess(const ndn::Name& name); |
| 102 | |
| 103 | void |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 104 | setInfoInterestFilter(); |
| 105 | |
| 106 | void |
| 107 | setLsaInterestFilter(); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 108 | |
| 109 | void |
| 110 | startEventLoop(); |
| 111 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 112 | void |
| 113 | usage(const std::string& progname); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 114 | |
| 115 | std::string |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 116 | getConfFileName() const |
Yingdi Yu | 40cd1c3 | 2014-04-17 15:02:17 -0700 | [diff] [blame] | 117 | { |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 118 | return m_configFileName; |
Yingdi Yu | 40cd1c3 | 2014-04-17 15:02:17 -0700 | [diff] [blame] | 119 | } |
| 120 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 121 | void |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 122 | setConfFileName(const std::string& fileName) |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 123 | { |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 124 | m_configFileName = fileName; |
| 125 | } |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 126 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 127 | bool |
| 128 | getIsSetDaemonProcess() |
| 129 | { |
| 130 | return m_isDaemonProcess; |
| 131 | } |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 132 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 133 | void |
| 134 | setIsDaemonProcess(bool value) |
| 135 | { |
| 136 | m_isDaemonProcess = value; |
| 137 | } |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 138 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 139 | ConfParameter& |
| 140 | getConfParameter() |
| 141 | { |
| 142 | return m_confParam; |
| 143 | } |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 144 | |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 145 | AdjacencyList& |
| 146 | getAdjacencyList() |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 147 | { |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 148 | return m_adjacencyList; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 149 | } |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 150 | |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 151 | NamePrefixList& |
| 152 | getNamePrefixList() |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 153 | { |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 154 | return m_namePrefixList; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 155 | } |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 156 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 157 | ndn::Face& |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 158 | getNlsrFace() |
| 159 | { |
| 160 | return m_nlsrFace; |
| 161 | } |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 162 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 163 | SequencingManager& |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 164 | getSequencingManager() |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 165 | { |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 166 | return m_sequencingManager; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 167 | } |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 168 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 169 | Lsdb& |
| 170 | getLsdb() |
| 171 | { |
| 172 | return m_nlsrLsdb; |
| 173 | } |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 174 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 175 | RoutingTable& |
| 176 | getRoutingTable() |
| 177 | { |
| 178 | return m_routingTable; |
| 179 | } |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 180 | |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 181 | NamePrefixTable& |
| 182 | getNamePrefixTable() |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 183 | { |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 184 | return m_namePrefixTable; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 185 | } |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 186 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 187 | Fib& |
| 188 | getFib() |
| 189 | { |
| 190 | return m_fib; |
| 191 | } |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 192 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 193 | long int |
| 194 | getAdjBuildCount() |
| 195 | { |
| 196 | return m_adjBuildCount; |
| 197 | } |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 198 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 199 | void |
| 200 | incrementAdjBuildCount() |
| 201 | { |
| 202 | m_adjBuildCount++; |
| 203 | } |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 204 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 205 | void |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 206 | setAdjBuildCount(int64_t abc) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 207 | { |
| 208 | m_adjBuildCount = abc; |
| 209 | } |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 210 | |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 211 | bool |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 212 | getIsBuildAdjLsaSheduled() |
| 213 | { |
| 214 | return m_isBuildAdjLsaSheduled; |
| 215 | } |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 216 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 217 | void |
| 218 | setIsBuildAdjLsaSheduled(bool iabls) |
| 219 | { |
| 220 | m_isBuildAdjLsaSheduled = iabls; |
| 221 | } |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 222 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 223 | bool |
| 224 | getIsRoutingTableCalculating() |
| 225 | { |
| 226 | return m_isRoutingTableCalculating; |
| 227 | } |
akmhoque | 85d8833 | 2014-02-17 21:11:21 -0600 | [diff] [blame] | 228 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 229 | void |
| 230 | setIsRoutingTableCalculating(bool irtc) |
| 231 | { |
| 232 | m_isRoutingTableCalculating = irtc; |
| 233 | } |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 234 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 235 | bool |
| 236 | getIsRouteCalculationScheduled() |
| 237 | { |
| 238 | return m_isRouteCalculationScheduled; |
| 239 | } |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 240 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 241 | void |
| 242 | setIsRouteCalculationScheduled(bool ircs) |
| 243 | { |
| 244 | m_isRouteCalculationScheduled = ircs; |
| 245 | } |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 246 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 247 | SyncLogicHandler& |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 248 | getSyncLogicHandler() |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 249 | { |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 250 | return m_syncLogicHandler; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 251 | } |
akmhoque | 2bb198e | 2014-02-28 11:46:27 -0600 | [diff] [blame] | 252 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 253 | void |
| 254 | initialize(); |
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 255 | |
Yingdi Yu | 20e3a6e | 2014-05-26 23:16:10 -0700 | [diff] [blame] | 256 | void |
akmhoque | 443ad81 | 2014-07-29 10:26:56 -0500 | [diff] [blame] | 257 | initializeKey(); |
Yingdi Yu | 20e3a6e | 2014-05-26 23:16:10 -0700 | [diff] [blame] | 258 | |
| 259 | void |
| 260 | loadValidator(boost::property_tree::ptree section, |
| 261 | const std::string& filename) |
| 262 | { |
| 263 | m_validator.load(section, filename); |
| 264 | } |
| 265 | |
| 266 | Validator& |
| 267 | getValidator() |
| 268 | { |
| 269 | return m_validator; |
| 270 | } |
| 271 | |
| 272 | void |
| 273 | loadCertToPublish(ndn::shared_ptr<ndn::IdentityCertificate> certificate) |
| 274 | { |
| 275 | if (static_cast<bool>(certificate)) |
| 276 | m_certToPublish[certificate->getName().getPrefix(-1)] = certificate; // key is cert name |
| 277 | // without version |
| 278 | } |
| 279 | |
| 280 | ndn::shared_ptr<const ndn::IdentityCertificate> |
| 281 | getCertificate(const ndn::Name& certificateNameWithoutVersion) |
| 282 | { |
| 283 | CertMap::iterator it = m_certToPublish.find(certificateNameWithoutVersion); |
| 284 | |
| 285 | if (it != m_certToPublish.end()) |
| 286 | { |
| 287 | return it->second; |
| 288 | } |
| 289 | |
| 290 | return m_certificateCache->getCertificate(certificateNameWithoutVersion); |
| 291 | } |
| 292 | |
| 293 | ndn::KeyChain& |
| 294 | getKeyChain() |
| 295 | { |
| 296 | return m_keyChain; |
| 297 | } |
| 298 | |
| 299 | const ndn::Name& |
| 300 | getDefaultCertName() |
| 301 | { |
| 302 | return m_defaultCertName; |
| 303 | } |
| 304 | |
akmhoque | e176515 | 2014-06-30 11:32:01 -0500 | [diff] [blame] | 305 | void |
| 306 | createFace(const std::string& faceUri, |
akmhoque | e176515 | 2014-06-30 11:32:01 -0500 | [diff] [blame] | 307 | const CommandSucceedCallback& onSuccess, |
| 308 | const CommandFailCallback& onFailure); |
| 309 | |
| 310 | void |
| 311 | destroyFaces(); |
| 312 | |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 313 | void |
akmhoque | c04e727 | 2014-07-02 11:00:14 -0500 | [diff] [blame] | 314 | setStrategies(); |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 315 | |
akmhoque | 0494c25 | 2014-07-23 23:46:44 -0500 | [diff] [blame] | 316 | void |
| 317 | daemonize(); |
| 318 | |
Vince Lehman | 7b61658 | 2014-10-17 16:25:39 -0500 | [diff] [blame] | 319 | uint32_t |
| 320 | getFirstHelloInterval() const |
| 321 | { |
| 322 | return m_firstHelloInterval; |
| 323 | } |
| 324 | |
akmhoque | 393d4ff | 2014-07-16 14:27:03 -0500 | [diff] [blame] | 325 | private: |
Yingdi Yu | 20e3a6e | 2014-05-26 23:16:10 -0700 | [diff] [blame] | 326 | void |
| 327 | registerKeyPrefix(); |
| 328 | |
| 329 | void |
| 330 | onKeyInterest(const ndn::Name& name, const ndn::Interest& interest); |
| 331 | |
| 332 | void |
| 333 | onKeyPrefixRegSuccess(const ndn::Name& name); |
| 334 | |
akmhoque | e176515 | 2014-06-30 11:32:01 -0500 | [diff] [blame] | 335 | void |
akmhoque | e176515 | 2014-06-30 11:32:01 -0500 | [diff] [blame] | 336 | onDestroyFaceSuccess(const ndn::nfd::ControlParameters& commandSuccessResult); |
| 337 | |
| 338 | void |
| 339 | onDestroyFaceFailure(int32_t code, const std::string& error); |
| 340 | |
| 341 | void |
akmhoque | c04e727 | 2014-07-02 11:00:14 -0500 | [diff] [blame] | 342 | onFaceEventNotification(const ndn::nfd::FaceEventNotification& faceEventNotification); |
akmhoque | e176515 | 2014-06-30 11:32:01 -0500 | [diff] [blame] | 343 | |
Vince Lehman | 7b61658 | 2014-10-17 16:25:39 -0500 | [diff] [blame] | 344 | void |
| 345 | setFirstHelloInterval(uint32_t interval) |
| 346 | { |
| 347 | m_firstHelloInterval = interval; |
| 348 | } |
| 349 | |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 350 | private: |
Yingdi Yu | 20e3a6e | 2014-05-26 23:16:10 -0700 | [diff] [blame] | 351 | typedef std::map<ndn::Name, ndn::shared_ptr<ndn::IdentityCertificate> > CertMap; |
| 352 | |
Vince Lehman | 904c241 | 2014-09-23 19:36:11 -0500 | [diff] [blame] | 353 | ndn::Face& m_nlsrFace; |
Vince Lehman | 7c60329 | 2014-09-11 17:48:16 -0500 | [diff] [blame] | 354 | ndn::Scheduler& m_scheduler; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 355 | ConfParameter m_confParam; |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 356 | AdjacencyList m_adjacencyList; |
| 357 | NamePrefixList m_namePrefixList; |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 358 | SequencingManager m_sequencingManager; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 359 | bool m_isDaemonProcess; |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 360 | std::string m_configFileName; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 361 | Lsdb m_nlsrLsdb; |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 362 | int64_t m_adjBuildCount; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 363 | bool m_isBuildAdjLsaSheduled; |
| 364 | bool m_isRouteCalculationScheduled; |
| 365 | bool m_isRoutingTableCalculating; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 366 | RoutingTable m_routingTable; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 367 | Fib m_fib; |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 368 | NamePrefixTable m_namePrefixTable; |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 369 | SyncLogicHandler m_syncLogicHandler; |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 370 | HelloProtocol m_helloProtocol; |
Jiewen Tan | a0497d8 | 2015-02-02 21:59:18 -0800 | [diff] [blame] | 371 | std::unique_ptr<LsdbDatasetInterestHandler> m_lsdbDatasetHandler; |
Yingdi Yu | 20e3a6e | 2014-05-26 23:16:10 -0700 | [diff] [blame] | 372 | |
Vince Lehman | 7b61658 | 2014-10-17 16:25:39 -0500 | [diff] [blame] | 373 | private: |
Yingdi Yu | 20e3a6e | 2014-05-26 23:16:10 -0700 | [diff] [blame] | 374 | ndn::shared_ptr<ndn::CertificateCacheTtl> m_certificateCache; |
| 375 | CertMap m_certToPublish; |
| 376 | Validator m_validator; |
| 377 | ndn::KeyChain m_keyChain; |
| 378 | ndn::Name m_defaultIdentity; |
| 379 | ndn::Name m_defaultCertName; |
akmhoque | e176515 | 2014-06-30 11:32:01 -0500 | [diff] [blame] | 380 | |
akmhoque | 060d302 | 2014-08-12 13:35:06 -0500 | [diff] [blame] | 381 | ndn::nfd::FaceMonitor m_faceMonitor; |
Vince Lehman | 7b61658 | 2014-10-17 16:25:39 -0500 | [diff] [blame] | 382 | |
| 383 | uint32_t m_firstHelloInterval; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 384 | }; |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 385 | |
akmhoque | b1710aa | 2014-02-19 17:13:36 -0600 | [diff] [blame] | 386 | } //namespace nlsr |
| 387 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 388 | #endif //NLSR_HPP |