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