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 | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 33 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 34 | #include "conf-parameter.hpp" |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 35 | #include "adjacency-list.hpp" |
| 36 | #include "name-prefix-list.hpp" |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 37 | #include "lsdb.hpp" |
| 38 | #include "sequencing-manager.hpp" |
| 39 | #include "route/routing-table.hpp" |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 40 | #include "route/name-prefix-table.hpp" |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 41 | #include "route/fib.hpp" |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 42 | #include "communication/sync-logic-handler.hpp" |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 43 | #include "hello-protocol.hpp" |
akmhoque | 2bb198e | 2014-02-28 11:46:27 -0600 | [diff] [blame] | 44 | |
Yingdi Yu | 20e3a6e | 2014-05-26 23:16:10 -0700 | [diff] [blame] | 45 | #include "validator.hpp" |
| 46 | |
akmhoque | 2bb198e | 2014-02-28 11:46:27 -0600 | [diff] [blame] | 47 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 48 | namespace nlsr { |
| 49 | |
Yingdi Yu | 20e3a6e | 2014-05-26 23:16:10 -0700 | [diff] [blame] | 50 | static ndn::Name DEFAULT_BROADCAST_PREFIX("/ndn/broadcast"); |
| 51 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 52 | class Nlsr |
| 53 | { |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 54 | class Error : public std::runtime_error |
| 55 | { |
| 56 | public: |
| 57 | explicit |
| 58 | Error(const std::string& what) |
| 59 | : std::runtime_error(what) |
| 60 | { |
| 61 | } |
| 62 | }; |
| 63 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 64 | public: |
akmhoque | e176515 | 2014-06-30 11:32:01 -0500 | [diff] [blame] | 65 | typedef ndn::function<void(const ndn::nfd::ControlParameters&)> CommandSucceedCallback; |
| 66 | |
| 67 | typedef ndn::function<void(uint32_t/*code*/,const std::string&/*reason*/)> CommandFailCallback; |
| 68 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 69 | Nlsr() |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 70 | : m_scheduler(m_nlsrFace.getIoService()) |
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") |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 77 | , m_nlsrLsdb(*this) |
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) |
| 82 | , m_routingTable() |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 83 | , m_fib(*this, m_nlsrFace) |
| 84 | , m_namePrefixTable(*this) |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 85 | , m_syncLogicHandler(m_nlsrFace.getIoService()) |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 86 | , m_helloProtocol(*this) |
Yingdi Yu | 20e3a6e | 2014-05-26 23:16:10 -0700 | [diff] [blame] | 87 | |
| 88 | , m_certificateCache(new ndn::CertificateCacheTtl(m_nlsrFace.getIoService())) |
| 89 | , m_validator(m_nlsrFace, DEFAULT_BROADCAST_PREFIX, m_certificateCache) |
akmhoque | e176515 | 2014-06-30 11:32:01 -0500 | [diff] [blame] | 90 | |
| 91 | , m_controller(m_nlsrFace) |
| 92 | , m_nFacesToCreate(0) |
| 93 | , m_nFacesCreated(0) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 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 | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 156 | ndn::Scheduler& |
| 157 | getScheduler() |
| 158 | { |
| 159 | return m_scheduler; |
| 160 | } |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 161 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 162 | ndn::Face& |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 163 | getNlsrFace() |
| 164 | { |
| 165 | return m_nlsrFace; |
| 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 | SequencingManager& |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 169 | getSequencingManager() |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 170 | { |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 171 | return m_sequencingManager; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 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 | Lsdb& |
| 175 | getLsdb() |
| 176 | { |
| 177 | return m_nlsrLsdb; |
| 178 | } |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 179 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 180 | RoutingTable& |
| 181 | getRoutingTable() |
| 182 | { |
| 183 | return m_routingTable; |
| 184 | } |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 185 | |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 186 | NamePrefixTable& |
| 187 | getNamePrefixTable() |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 188 | { |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 189 | return m_namePrefixTable; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 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 | Fib& |
| 193 | getFib() |
| 194 | { |
| 195 | return m_fib; |
| 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 | long int |
| 199 | getAdjBuildCount() |
| 200 | { |
| 201 | return 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 |
| 205 | incrementAdjBuildCount() |
| 206 | { |
| 207 | m_adjBuildCount++; |
| 208 | } |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 209 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 210 | void |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 211 | setAdjBuildCount(int64_t abc) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 212 | { |
| 213 | m_adjBuildCount = abc; |
| 214 | } |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 215 | |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 216 | bool |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 217 | getIsBuildAdjLsaSheduled() |
| 218 | { |
| 219 | return m_isBuildAdjLsaSheduled; |
| 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 | void |
| 223 | setIsBuildAdjLsaSheduled(bool iabls) |
| 224 | { |
| 225 | m_isBuildAdjLsaSheduled = iabls; |
| 226 | } |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 227 | |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 228 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 229 | void |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 230 | setApiPort(int32_t ap) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 231 | { |
| 232 | m_apiPort = ap; |
| 233 | } |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 234 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 235 | int32_t |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 236 | getApiPort() |
| 237 | { |
| 238 | return m_apiPort; |
| 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 | bool |
| 242 | getIsRoutingTableCalculating() |
| 243 | { |
| 244 | return m_isRoutingTableCalculating; |
| 245 | } |
akmhoque | 85d8833 | 2014-02-17 21:11:21 -0600 | [diff] [blame] | 246 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 247 | void |
| 248 | setIsRoutingTableCalculating(bool irtc) |
| 249 | { |
| 250 | m_isRoutingTableCalculating = irtc; |
| 251 | } |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 252 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 253 | bool |
| 254 | getIsRouteCalculationScheduled() |
| 255 | { |
| 256 | return m_isRouteCalculationScheduled; |
| 257 | } |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 258 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 259 | void |
| 260 | setIsRouteCalculationScheduled(bool ircs) |
| 261 | { |
| 262 | m_isRouteCalculationScheduled = ircs; |
| 263 | } |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 264 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 265 | SyncLogicHandler& |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 266 | getSyncLogicHandler() |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 267 | { |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 268 | return m_syncLogicHandler; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 269 | } |
akmhoque | 2bb198e | 2014-02-28 11:46:27 -0600 | [diff] [blame] | 270 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 271 | void |
| 272 | initialize(); |
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 273 | |
Yingdi Yu | 20e3a6e | 2014-05-26 23:16:10 -0700 | [diff] [blame] | 274 | void |
akmhoque | e176515 | 2014-06-30 11:32:01 -0500 | [diff] [blame] | 275 | start(); |
| 276 | |
| 277 | void |
Yingdi Yu | 20e3a6e | 2014-05-26 23:16:10 -0700 | [diff] [blame] | 278 | intializeKey(); |
| 279 | |
| 280 | void |
| 281 | loadValidator(boost::property_tree::ptree section, |
| 282 | const std::string& filename) |
| 283 | { |
| 284 | m_validator.load(section, filename); |
| 285 | } |
| 286 | |
| 287 | Validator& |
| 288 | getValidator() |
| 289 | { |
| 290 | return m_validator; |
| 291 | } |
| 292 | |
| 293 | void |
| 294 | loadCertToPublish(ndn::shared_ptr<ndn::IdentityCertificate> certificate) |
| 295 | { |
| 296 | if (static_cast<bool>(certificate)) |
| 297 | m_certToPublish[certificate->getName().getPrefix(-1)] = certificate; // key is cert name |
| 298 | // without version |
| 299 | } |
| 300 | |
| 301 | ndn::shared_ptr<const ndn::IdentityCertificate> |
| 302 | getCertificate(const ndn::Name& certificateNameWithoutVersion) |
| 303 | { |
| 304 | CertMap::iterator it = m_certToPublish.find(certificateNameWithoutVersion); |
| 305 | |
| 306 | if (it != m_certToPublish.end()) |
| 307 | { |
| 308 | return it->second; |
| 309 | } |
| 310 | |
| 311 | return m_certificateCache->getCertificate(certificateNameWithoutVersion); |
| 312 | } |
| 313 | |
| 314 | ndn::KeyChain& |
| 315 | getKeyChain() |
| 316 | { |
| 317 | return m_keyChain; |
| 318 | } |
| 319 | |
| 320 | const ndn::Name& |
| 321 | getDefaultCertName() |
| 322 | { |
| 323 | return m_defaultCertName; |
| 324 | } |
| 325 | |
akmhoque | e176515 | 2014-06-30 11:32:01 -0500 | [diff] [blame] | 326 | void |
| 327 | createFace(const std::string& faceUri, |
akmhoque | e176515 | 2014-06-30 11:32:01 -0500 | [diff] [blame] | 328 | const CommandSucceedCallback& onSuccess, |
| 329 | const CommandFailCallback& onFailure); |
| 330 | |
| 331 | void |
| 332 | destroyFaces(); |
| 333 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 334 | private: |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 335 | void |
| 336 | registerPrefixes(); |
| 337 | |
Yingdi Yu | 20e3a6e | 2014-05-26 23:16:10 -0700 | [diff] [blame] | 338 | void |
| 339 | registerKeyPrefix(); |
| 340 | |
| 341 | void |
| 342 | onKeyInterest(const ndn::Name& name, const ndn::Interest& interest); |
| 343 | |
| 344 | void |
| 345 | onKeyPrefixRegSuccess(const ndn::Name& name); |
| 346 | |
akmhoque | e176515 | 2014-06-30 11:32:01 -0500 | [diff] [blame] | 347 | void |
| 348 | onCreateFaceSuccess(const ndn::nfd::ControlParameters& commandSuccessResult); |
| 349 | |
| 350 | void |
| 351 | onCreateFaceFailure(int32_t code, const std::string& error); |
| 352 | |
| 353 | void |
| 354 | createFaces(); |
| 355 | |
| 356 | void |
| 357 | onDestroyFaceSuccess(const ndn::nfd::ControlParameters& commandSuccessResult); |
| 358 | |
| 359 | void |
| 360 | onDestroyFaceFailure(int32_t code, const std::string& error); |
| 361 | |
| 362 | void |
| 363 | destroyFace(const std::string& faceUri); |
| 364 | |
| 365 | void |
| 366 | destroyFaceInNfd(const ndn::nfd::ControlParameters& faceDestroyResult); |
| 367 | |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 368 | private: |
Yingdi Yu | 20e3a6e | 2014-05-26 23:16:10 -0700 | [diff] [blame] | 369 | typedef std::map<ndn::Name, ndn::shared_ptr<ndn::IdentityCertificate> > CertMap; |
| 370 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 371 | ndn::Face m_nlsrFace; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 372 | ndn::Scheduler m_scheduler; |
| 373 | ConfParameter m_confParam; |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 374 | AdjacencyList m_adjacencyList; |
| 375 | NamePrefixList m_namePrefixList; |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 376 | SequencingManager m_sequencingManager; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 377 | bool m_isDaemonProcess; |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 378 | std::string m_configFileName; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 379 | Lsdb m_nlsrLsdb; |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 380 | int64_t m_adjBuildCount; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 381 | bool m_isBuildAdjLsaSheduled; |
| 382 | bool m_isRouteCalculationScheduled; |
| 383 | bool m_isRoutingTableCalculating; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 384 | RoutingTable m_routingTable; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 385 | Fib m_fib; |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 386 | NamePrefixTable m_namePrefixTable; |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 387 | SyncLogicHandler m_syncLogicHandler; |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 388 | int32_t m_apiPort; |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 389 | HelloProtocol m_helloProtocol; |
Yingdi Yu | 20e3a6e | 2014-05-26 23:16:10 -0700 | [diff] [blame] | 390 | |
| 391 | ndn::shared_ptr<ndn::CertificateCacheTtl> m_certificateCache; |
| 392 | CertMap m_certToPublish; |
| 393 | Validator m_validator; |
| 394 | ndn::KeyChain m_keyChain; |
| 395 | ndn::Name m_defaultIdentity; |
| 396 | ndn::Name m_defaultCertName; |
akmhoque | e176515 | 2014-06-30 11:32:01 -0500 | [diff] [blame] | 397 | |
| 398 | ndn::nfd::Controller m_controller; |
| 399 | int32_t m_nFacesToCreate; |
| 400 | int32_t m_nFacesCreated; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 401 | }; |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 402 | |
akmhoque | b1710aa | 2014-02-19 17:13:36 -0600 | [diff] [blame] | 403 | } //namespace nlsr |
| 404 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 405 | #endif //NLSR_HPP |