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