Zhenkai Zhu | 8d935c8 | 2012-03-06 10:44:12 -0800 | [diff] [blame] | 1 | /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /* |
| 3 | * Copyright (c) 2012 University of California, Los Angeles |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License version 2 as |
| 7 | * published by the Free Software Foundation; |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 17 | * |
| 18 | * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu> |
Chaoyi Bian | 3e1eb16 | 2012-04-03 16:59:32 -0700 | [diff] [blame] | 19 | * Chaoyi Bian <bcy@pku.edu.cn> |
Alexander Afanasyev | c103019 | 2012-03-08 22:21:28 -0800 | [diff] [blame] | 20 | * Alexander Afanasyev <alexander.afanasyev@ucla.edu> |
Yingdi Yu | 6d638f0 | 2014-01-24 11:01:21 -0800 | [diff] [blame^] | 21 | * Yingdi Yu <yingdi@cs.ucla.edu> |
Zhenkai Zhu | 8d935c8 | 2012-03-06 10:44:12 -0800 | [diff] [blame] | 22 | */ |
| 23 | |
Chaoyi Bian | 11f294f | 2012-03-08 14:28:06 -0800 | [diff] [blame] | 24 | #ifndef SYNC_LOGIC_H |
| 25 | #define SYNC_LOGIC_H |
Alexander Afanasyev | 45fba08 | 2012-03-12 18:05:24 -0700 | [diff] [blame] | 26 | |
Zhenkai Zhu | 8d935c8 | 2012-03-06 10:44:12 -0800 | [diff] [blame] | 27 | #include <boost/shared_ptr.hpp> |
Alexander Afanasyev | 750d187 | 2012-03-12 15:33:56 -0700 | [diff] [blame] | 28 | #include <boost/thread/recursive_mutex.hpp> |
Alexander Afanasyev | 45fba08 | 2012-03-12 18:05:24 -0700 | [diff] [blame] | 29 | #include <boost/random.hpp> |
Zhenkai Zhu | ce66e21 | 2012-03-12 22:27:19 -0700 | [diff] [blame] | 30 | #include <memory> |
Zhenkai Zhu | d5aec4b | 2012-10-09 12:01:19 -0700 | [diff] [blame] | 31 | #include <map> |
Alexander Afanasyev | 387ac95 | 2012-03-11 23:49:27 -0700 | [diff] [blame] | 32 | |
Yingdi Yu | e815471 | 2014-01-21 10:20:14 -0800 | [diff] [blame] | 33 | #include <ndn-cpp-dev/face.hpp> |
| 34 | #include <ndn-cpp-dev/security/verifier.hpp> |
| 35 | #include <ndn-cpp-dev/security/key-chain.hpp> |
Yingdi Yu | 46c9f1a | 2013-12-18 15:15:46 +0800 | [diff] [blame] | 36 | |
Zhenkai Zhu | 8d935c8 | 2012-03-06 10:44:12 -0800 | [diff] [blame] | 37 | #include "sync-interest-table.h" |
Zhenkai Zhu | 8d935c8 | 2012-03-06 10:44:12 -0800 | [diff] [blame] | 38 | #include "sync-diff-state.h" |
| 39 | #include "sync-full-state.h" |
Chaoyi Bian | 4194b74 | 2012-03-08 17:21:35 -0800 | [diff] [blame] | 40 | #include "sync-std-name-info.h" |
Alexander Afanasyev | 45fba08 | 2012-03-12 18:05:24 -0700 | [diff] [blame] | 41 | #include "sync-scheduler.h" |
Yingdi Yu | 5e0af3e | 2014-01-15 19:33:25 -0800 | [diff] [blame] | 42 | #include "sec-policy-sync.h" |
Zhenkai Zhu | 8d935c8 | 2012-03-06 10:44:12 -0800 | [diff] [blame] | 43 | |
Alexander Afanasyev | c103019 | 2012-03-08 22:21:28 -0800 | [diff] [blame] | 44 | #include "sync-diff-state-container.h" |
| 45 | |
Alexander Afanasyev | 860e6fe | 2012-03-15 17:30:31 -0700 | [diff] [blame] | 46 | #ifdef _DEBUG |
| 47 | #ifdef HAVE_LOG4CXX |
| 48 | #include <log4cxx/logger.h> |
| 49 | #endif |
| 50 | #endif |
| 51 | |
Alexander Afanasyev | 181d7e5 | 2012-04-09 13:54:11 -0700 | [diff] [blame] | 52 | #ifdef NS3_MODULE |
| 53 | #include <ns3/application.h> |
Alexander Afanasyev | 73f7f9a | 2012-04-09 15:45:47 -0700 | [diff] [blame] | 54 | #include <ns3/random-variable.h> |
Alexander Afanasyev | 181d7e5 | 2012-04-09 13:54:11 -0700 | [diff] [blame] | 55 | #endif |
| 56 | |
Zhenkai Zhu | 8d935c8 | 2012-03-06 10:44:12 -0800 | [diff] [blame] | 57 | namespace Sync { |
| 58 | |
Zhenkai Zhu | 1cb2929 | 2012-05-31 22:54:34 -0700 | [diff] [blame] | 59 | struct MissingDataInfo { |
| 60 | std::string prefix; |
| 61 | SeqNo low; |
| 62 | SeqNo high; |
| 63 | }; |
| 64 | |
Zhenkai Zhu | 8d935c8 | 2012-03-06 10:44:12 -0800 | [diff] [blame] | 65 | /** |
| 66 | * \ingroup sync |
Zhenkai Zhu | aae8152 | 2012-03-06 11:05:44 -0800 | [diff] [blame] | 67 | * @brief A wrapper for SyncApp, which handles ccnx related things (process |
| 68 | * interests and data) |
Zhenkai Zhu | 8d935c8 | 2012-03-06 10:44:12 -0800 | [diff] [blame] | 69 | */ |
Zhenkai Zhu | b9f1959 | 2012-10-16 14:27:38 -0700 | [diff] [blame] | 70 | |
Chaoyi Bian | 11f294f | 2012-03-08 14:28:06 -0800 | [diff] [blame] | 71 | class SyncLogic |
Alexander Afanasyev | 181d7e5 | 2012-04-09 13:54:11 -0700 | [diff] [blame] | 72 | #ifdef NS3_MODULE |
| 73 | : public ns3::Application |
| 74 | #endif |
Zhenkai Zhu | 8d935c8 | 2012-03-06 10:44:12 -0800 | [diff] [blame] | 75 | { |
| 76 | public: |
Zhenkai Zhu | 1cb2929 | 2012-05-31 22:54:34 -0700 | [diff] [blame] | 77 | //typedef boost::function< void ( const std::string &/*prefix*/, const SeqNo &/*newSeq*/, const SeqNo &/*oldSeq*/ ) > LogicUpdateCallback; |
| 78 | typedef boost::function< void (const std::vector<MissingDataInfo> & ) > LogicUpdateCallback; |
Alexander Afanasyev | d95c231 | 2013-11-07 13:45:34 -0800 | [diff] [blame] | 79 | typedef boost::function< void (const std::string &/*prefix*/ ) > LogicRemoveCallback; |
Zhenkai Zhu | b9f1959 | 2012-10-16 14:27:38 -0700 | [diff] [blame] | 80 | typedef boost::function< void (const std::string &)> LogicPerBranchCallback; |
Chaoyi Bian | 89ee2dc | 2012-03-09 14:06:01 -0800 | [diff] [blame] | 81 | |
Alexander Afanasyev | c103019 | 2012-03-08 22:21:28 -0800 | [diff] [blame] | 82 | /** |
Alexander Afanasyev | 172d2b7 | 2012-03-08 23:43:39 -0800 | [diff] [blame] | 83 | * @brief Constructor |
Alexander Afanasyev | c103019 | 2012-03-08 22:21:28 -0800 | [diff] [blame] | 84 | * @param syncPrefix the name prefix to use for the Sync Interest |
Alexander Afanasyev | 03a58b7 | 2012-03-12 18:11:56 -0700 | [diff] [blame] | 85 | * @param onUpdate function that will be called when new state is detected |
| 86 | * @param onRemove function that will be called when state is removed |
Alexander Afanasyev | 172d2b7 | 2012-03-08 23:43:39 -0800 | [diff] [blame] | 87 | * @param ccnxHandle ccnx handle |
Alexander Afanasyev | c103019 | 2012-03-08 22:21:28 -0800 | [diff] [blame] | 88 | * the app data when new remote names are learned |
| 89 | */ |
Yingdi Yu | 43e7161 | 2013-10-30 22:19:31 -0700 | [diff] [blame] | 90 | SyncLogic (const ndn::Name& syncPrefix, |
Yingdi Yu | 5e0af3e | 2014-01-15 19:33:25 -0800 | [diff] [blame] | 91 | ndn::ptr_lib::shared_ptr<SecPolicySync> syncPolicyManager, |
Yingdi Yu | 6e235db | 2013-12-27 08:40:53 +0800 | [diff] [blame] | 92 | ndn::ptr_lib::shared_ptr<ndn::Face> face, |
Alexander Afanasyev | 750d187 | 2012-03-12 15:33:56 -0700 | [diff] [blame] | 93 | LogicUpdateCallback onUpdate, |
Zhenkai Zhu | ce66e21 | 2012-03-12 22:27:19 -0700 | [diff] [blame] | 94 | LogicRemoveCallback onRemove); |
Zhenkai Zhu | 46b26a1 | 2012-03-06 13:51:16 -0800 | [diff] [blame] | 95 | |
Yingdi Yu | 43e7161 | 2013-10-30 22:19:31 -0700 | [diff] [blame] | 96 | SyncLogic (const ndn::Name& syncPrefix, |
Yingdi Yu | 5e0af3e | 2014-01-15 19:33:25 -0800 | [diff] [blame] | 97 | ndn::ptr_lib::shared_ptr<SecPolicySync> syncPolicyManager, |
Yingdi Yu | 6e235db | 2013-12-27 08:40:53 +0800 | [diff] [blame] | 98 | ndn::ptr_lib::shared_ptr<ndn::Face> face, |
Zhenkai Zhu | b9f1959 | 2012-10-16 14:27:38 -0700 | [diff] [blame] | 99 | LogicPerBranchCallback onUpdateBranch); |
| 100 | |
Alexander Afanasyev | c103019 | 2012-03-08 22:21:28 -0800 | [diff] [blame] | 101 | ~SyncLogic (); |
Chaoyi Bian | 89ee2dc | 2012-03-09 14:06:01 -0800 | [diff] [blame] | 102 | |
Alexander Afanasyev | c103019 | 2012-03-08 22:21:28 -0800 | [diff] [blame] | 103 | /** |
| 104 | * a wrapper for the same func in SyncApp |
| 105 | */ |
Yingdi Yu | 6d638f0 | 2014-01-24 11:01:21 -0800 | [diff] [blame^] | 106 | void addLocalNames (const ndn::Name &prefix, uint32_t session, uint32_t seq); |
Zhenkai Zhu | 46b26a1 | 2012-03-06 13:51:16 -0800 | [diff] [blame] | 107 | |
Alexander Afanasyev | c103019 | 2012-03-08 22:21:28 -0800 | [diff] [blame] | 108 | /** |
| 109 | * @brief respond to the Sync Interest; a lot of logic needs to go in here |
| 110 | * @param interest the Sync Interest in string format |
| 111 | */ |
Yingdi Yu | 46c9f1a | 2013-12-18 15:15:46 +0800 | [diff] [blame] | 112 | void respondSyncInterest (ndn::ptr_lib::shared_ptr<ndn::Interest> interest); |
Zhenkai Zhu | 46b26a1 | 2012-03-06 13:51:16 -0800 | [diff] [blame] | 113 | |
Alexander Afanasyev | c103019 | 2012-03-08 22:21:28 -0800 | [diff] [blame] | 114 | /** |
| 115 | * @brief process the fetched sync data |
Chaoyi Bian | 633255f | 2012-03-09 21:25:38 -0800 | [diff] [blame] | 116 | * @param name the data name |
Alexander Afanasyev | c103019 | 2012-03-08 22:21:28 -0800 | [diff] [blame] | 117 | * @param dataBuffer the sync data |
| 118 | */ |
Yingdi Yu | 46c9f1a | 2013-12-18 15:15:46 +0800 | [diff] [blame] | 119 | void respondSyncData (ndn::ptr_lib::shared_ptr<ndn::Data> data); |
Zhenkai Zhu | 8d935c8 | 2012-03-06 10:44:12 -0800 | [diff] [blame] | 120 | |
Zhenkai Zhu | 0efa37b | 2012-03-12 13:54:12 -0700 | [diff] [blame] | 121 | /** |
| 122 | * @brief remove a participant's subtree from the sync tree |
Alexander Afanasyev | 03a58b7 | 2012-03-12 18:11:56 -0700 | [diff] [blame] | 123 | * @param prefix the name prefix for the participant |
Zhenkai Zhu | 0efa37b | 2012-03-12 13:54:12 -0700 | [diff] [blame] | 124 | */ |
Yingdi Yu | 6d638f0 | 2014-01-24 11:01:21 -0800 | [diff] [blame^] | 125 | void remove (const ndn::Name &prefix); |
Zhenkai Zhu | 0efa37b | 2012-03-12 13:54:12 -0700 | [diff] [blame] | 126 | |
Zhenkai Zhu | e566093 | 2012-06-04 15:25:20 -0700 | [diff] [blame] | 127 | std::string |
| 128 | getRootDigest(); |
| 129 | |
Alexander Afanasyev | 387ac95 | 2012-03-11 23:49:27 -0700 | [diff] [blame] | 130 | #ifdef _DEBUG |
Alexander Afanasyev | 45fba08 | 2012-03-12 18:05:24 -0700 | [diff] [blame] | 131 | Scheduler & |
Alexander Afanasyev | bf2b436 | 2012-03-12 23:55:09 -0700 | [diff] [blame] | 132 | getScheduler () { return m_scheduler; } |
Alexander Afanasyev | 387ac95 | 2012-03-11 23:49:27 -0700 | [diff] [blame] | 133 | #endif |
Alexander Afanasyev | 181d7e5 | 2012-04-09 13:54:11 -0700 | [diff] [blame] | 134 | |
Alexander Afanasyev | 181d7e5 | 2012-04-09 13:54:11 -0700 | [diff] [blame] | 135 | #ifdef NS3_MODULE |
Alexander Afanasyev | 40942f4 | 2012-04-21 20:53:16 -0700 | [diff] [blame] | 136 | public: |
Alexander Afanasyev | 181d7e5 | 2012-04-09 13:54:11 -0700 | [diff] [blame] | 137 | virtual void StartApplication (); |
| 138 | virtual void StopApplication (); |
| 139 | #endif |
Alexander Afanasyev | 387ac95 | 2012-03-11 23:49:27 -0700 | [diff] [blame] | 140 | |
Zhenkai Zhu | eb1d865 | 2012-12-23 15:25:39 -0800 | [diff] [blame] | 141 | void stop(); |
| 142 | |
Alexander Afanasyev | 5548c04 | 2012-10-04 19:10:09 -0700 | [diff] [blame] | 143 | void |
| 144 | printState () const; |
| 145 | |
Zhenkai Zhu | d5aec4b | 2012-10-09 12:01:19 -0700 | [diff] [blame] | 146 | std::map<std::string, bool> |
| 147 | getBranchPrefixes() const; |
| 148 | |
Zhenkai Zhu | 8d935c8 | 2012-03-06 10:44:12 -0800 | [diff] [blame] | 149 | private: |
Yingdi Yu | 6e235db | 2013-12-27 08:40:53 +0800 | [diff] [blame] | 150 | // void |
| 151 | // connectToDaemon(); |
Yingdi Yu | 46c9f1a | 2013-12-18 15:15:46 +0800 | [diff] [blame] | 152 | |
Yingdi Yu | 6e235db | 2013-12-27 08:40:53 +0800 | [diff] [blame] | 153 | // void |
| 154 | // onConnectionData(const ndn::ptr_lib::shared_ptr<const ndn::Interest>& interest, |
| 155 | // const ndn::ptr_lib::shared_ptr<ndn::Data>& data); |
Yingdi Yu | 46c9f1a | 2013-12-18 15:15:46 +0800 | [diff] [blame] | 156 | |
Yingdi Yu | 6e235db | 2013-12-27 08:40:53 +0800 | [diff] [blame] | 157 | // void |
| 158 | // onConnectionDataTimeout(const ndn::ptr_lib::shared_ptr<const ndn::Interest>& interest); |
Yingdi Yu | 46c9f1a | 2013-12-18 15:15:46 +0800 | [diff] [blame] | 159 | |
| 160 | void |
Alexander Afanasyev | 45fba08 | 2012-03-12 18:05:24 -0700 | [diff] [blame] | 161 | delayedChecksLoop (); |
Alexander Afanasyev | 387ac95 | 2012-03-11 23:49:27 -0700 | [diff] [blame] | 162 | |
| 163 | void |
Yingdi Yu | 46c9f1a | 2013-12-18 15:15:46 +0800 | [diff] [blame] | 164 | onSyncInterest (const ndn::ptr_lib::shared_ptr<const ndn::Name>& prefix, |
| 165 | const ndn::ptr_lib::shared_ptr<const ndn::Interest>& interest, |
| 166 | ndn::Transport& transport, |
| 167 | uint64_t registeredPrefixId); |
Yingdi Yu | 43e7161 | 2013-10-30 22:19:31 -0700 | [diff] [blame] | 168 | |
| 169 | void |
Yingdi Yu | 46c9f1a | 2013-12-18 15:15:46 +0800 | [diff] [blame] | 170 | onSyncRegisterFailed(const ndn::ptr_lib::shared_ptr<const ndn::Name>& prefix); |
| 171 | |
| 172 | void |
| 173 | onSyncData(const ndn::ptr_lib::shared_ptr<const ndn::Interest>& interest, |
| 174 | const ndn::ptr_lib::shared_ptr<ndn::Data>& data, |
Yingdi Yu | 46c9f1a | 2013-12-18 15:15:46 +0800 | [diff] [blame] | 175 | const ndn::OnVerified& onVerified, |
| 176 | const ndn::OnVerifyFailed& onVerifyFailed); |
| 177 | |
| 178 | void |
| 179 | onSyncDataTimeout(const ndn::ptr_lib::shared_ptr<const ndn::Interest>& interest, |
| 180 | int retry, |
Yingdi Yu | 46c9f1a | 2013-12-18 15:15:46 +0800 | [diff] [blame] | 181 | const ndn::OnVerified& onVerified, |
| 182 | const ndn::OnVerifyFailed& onVerifyFailed); |
| 183 | |
| 184 | void |
| 185 | onSyncDataVerifyFailed(const ndn::ptr_lib::shared_ptr<ndn::Data>& data); |
| 186 | |
| 187 | void |
| 188 | onSyncDataVerified(const ndn::ptr_lib::shared_ptr<ndn::Data>& data); |
| 189 | |
| 190 | void |
Yingdi Yu | 6d638f0 | 2014-01-24 11:01:21 -0800 | [diff] [blame^] | 191 | processSyncInterest (const ndn::Name &name, |
Alexander Afanasyev | f3c03a9 | 2012-05-09 12:00:37 -0700 | [diff] [blame] | 192 | DigestConstPtr digest, bool timedProcessing=false); |
| 193 | |
| 194 | void |
Yingdi Yu | 6d638f0 | 2014-01-24 11:01:21 -0800 | [diff] [blame^] | 195 | processSyncData (const ndn::Name &name, |
Zhenkai Zhu | 3cfdcb9 | 2012-06-06 15:20:10 -0700 | [diff] [blame] | 196 | DigestConstPtr digest, const char *wireData, size_t len); |
Alexander Afanasyev | 387ac95 | 2012-03-11 23:49:27 -0700 | [diff] [blame] | 197 | |
Alexander Afanasyev | 45fba08 | 2012-03-12 18:05:24 -0700 | [diff] [blame] | 198 | void |
Yingdi Yu | 6d638f0 | 2014-01-24 11:01:21 -0800 | [diff] [blame^] | 199 | processSyncRecoveryInterest (const ndn::Name &name, |
Alexander Afanasyev | f3c03a9 | 2012-05-09 12:00:37 -0700 | [diff] [blame] | 200 | DigestConstPtr digest); |
| 201 | |
Alexander Afanasyev | 45fba08 | 2012-03-12 18:05:24 -0700 | [diff] [blame] | 202 | void |
Alexander Afanasyev | 235c6d7 | 2012-03-15 22:28:43 -0700 | [diff] [blame] | 203 | insertToDiffLog (DiffStatePtr diff); |
Alexander Afanasyev | 1b449c4 | 2012-03-13 20:24:07 -0700 | [diff] [blame] | 204 | |
| 205 | void |
Alexander Afanasyev | f3c03a9 | 2012-05-09 12:00:37 -0700 | [diff] [blame] | 206 | satisfyPendingSyncInterests (DiffStateConstPtr diff); |
Zhenkai Zhu | 8d935c8 | 2012-03-06 10:44:12 -0800 | [diff] [blame] | 207 | |
Alexander Afanasyev | f3c03a9 | 2012-05-09 12:00:37 -0700 | [diff] [blame] | 208 | boost::tuple<DigestConstPtr, std::string> |
Yingdi Yu | 6d638f0 | 2014-01-24 11:01:21 -0800 | [diff] [blame^] | 209 | convertNameToDigestAndType (const ndn::Name &name); |
Alexander Afanasyev | f3c03a9 | 2012-05-09 12:00:37 -0700 | [diff] [blame] | 210 | |
| 211 | void |
| 212 | sendSyncInterest (); |
| 213 | |
| 214 | void |
Alexander Afanasyev | 46eb526 | 2012-05-10 16:30:35 -0700 | [diff] [blame] | 215 | sendSyncRecoveryInterests (DigestConstPtr digest); |
| 216 | |
| 217 | void |
Yingdi Yu | 6d638f0 | 2014-01-24 11:01:21 -0800 | [diff] [blame^] | 218 | sendSyncData (const ndn::Name &name, |
Alexander Afanasyev | f3c03a9 | 2012-05-09 12:00:37 -0700 | [diff] [blame] | 219 | DigestConstPtr digest, StateConstPtr state); |
Alexander Afanasyev | 8023738 | 2012-10-04 10:20:47 -0700 | [diff] [blame] | 220 | |
Zhenkai Zhu | 2d3e270 | 2012-10-15 14:18:05 -0700 | [diff] [blame] | 221 | void |
Yingdi Yu | 6d638f0 | 2014-01-24 11:01:21 -0800 | [diff] [blame^] | 222 | sendSyncData (const ndn::Name &name, |
Zhenkai Zhu | 2d3e270 | 2012-10-15 14:18:05 -0700 | [diff] [blame] | 223 | DigestConstPtr digest, SyncStateMsg &msg); |
| 224 | |
Alexander Afanasyev | 8023738 | 2012-10-04 10:20:47 -0700 | [diff] [blame] | 225 | size_t |
| 226 | getNumberOfBranches () const; |
Alexander Afanasyev | f3c03a9 | 2012-05-09 12:00:37 -0700 | [diff] [blame] | 227 | |
Zhenkai Zhu | 8d935c8 | 2012-03-06 10:44:12 -0800 | [diff] [blame] | 228 | private: |
Alexander Afanasyev | f3c03a9 | 2012-05-09 12:00:37 -0700 | [diff] [blame] | 229 | FullStatePtr m_state; |
Chaoyi Bian | 89ee2dc | 2012-03-09 14:06:01 -0800 | [diff] [blame] | 230 | DiffStateContainer m_log; |
Alexander Afanasyev | 8023738 | 2012-10-04 10:20:47 -0700 | [diff] [blame] | 231 | mutable boost::recursive_mutex m_stateMutex; |
Alexander Afanasyev | 750d187 | 2012-03-12 15:33:56 -0700 | [diff] [blame] | 232 | |
Yingdi Yu | 6d638f0 | 2014-01-24 11:01:21 -0800 | [diff] [blame^] | 233 | ndn::Name m_outstandingInterestName; |
Alexander Afanasyev | c103019 | 2012-03-08 22:21:28 -0800 | [diff] [blame] | 234 | SyncInterestTable m_syncInterestTable; |
| 235 | |
Yingdi Yu | 43e7161 | 2013-10-30 22:19:31 -0700 | [diff] [blame] | 236 | ndn::Name m_syncPrefix; |
Alexander Afanasyev | 750d187 | 2012-03-12 15:33:56 -0700 | [diff] [blame] | 237 | LogicUpdateCallback m_onUpdate; |
| 238 | LogicRemoveCallback m_onRemove; |
Zhenkai Zhu | b9f1959 | 2012-10-16 14:27:38 -0700 | [diff] [blame] | 239 | LogicPerBranchCallback m_onUpdateBranch; |
| 240 | bool m_perBranch; |
Yingdi Yu | 5e0af3e | 2014-01-15 19:33:25 -0800 | [diff] [blame] | 241 | ndn::ptr_lib::shared_ptr<SecPolicySync> m_policy; |
Yingdi Yu | 0cb0f2b | 2014-01-09 13:51:16 -0800 | [diff] [blame] | 242 | ndn::ptr_lib::shared_ptr<ndn::Verifier> m_verifier; |
| 243 | ndn::ptr_lib::shared_ptr<ndn::KeyChain> m_keyChain; |
Yingdi Yu | 46c9f1a | 2013-12-18 15:15:46 +0800 | [diff] [blame] | 244 | ndn::ptr_lib::shared_ptr<ndn::Face> m_face; |
Yingdi Yu | 46c9f1a | 2013-12-18 15:15:46 +0800 | [diff] [blame] | 245 | uint64_t m_syncRegisteredPrefixId; |
Chaoyi Bian | 89ee2dc | 2012-03-09 14:06:01 -0800 | [diff] [blame] | 246 | |
Alexander Afanasyev | bf2b436 | 2012-03-12 23:55:09 -0700 | [diff] [blame] | 247 | Scheduler m_scheduler; |
Chaoyi Bian | 633255f | 2012-03-09 21:25:38 -0800 | [diff] [blame] | 248 | |
Alexander Afanasyev | 73f7f9a | 2012-04-09 15:45:47 -0700 | [diff] [blame] | 249 | #ifndef NS3_MODULE |
Alexander Afanasyev | 45fba08 | 2012-03-12 18:05:24 -0700 | [diff] [blame] | 250 | boost::mt19937 m_randomGenerator; |
| 251 | boost::variate_generator<boost::mt19937&, boost::uniform_int<> > m_rangeUniformRandom; |
Alexander Afanasyev | 085742a | 2012-04-26 12:24:57 -0700 | [diff] [blame] | 252 | boost::variate_generator<boost::mt19937&, boost::uniform_int<> > m_reexpressionJitter; |
Alexander Afanasyev | 73f7f9a | 2012-04-09 15:45:47 -0700 | [diff] [blame] | 253 | #else |
| 254 | ns3::UniformVariable m_rangeUniformRandom; |
Alexander Afanasyev | 085742a | 2012-04-26 12:24:57 -0700 | [diff] [blame] | 255 | ns3::UniformVariable m_reexpressionJitter; |
Alexander Afanasyev | 73f7f9a | 2012-04-09 15:45:47 -0700 | [diff] [blame] | 256 | #endif |
Alexander Afanasyev | bf2b436 | 2012-03-12 23:55:09 -0700 | [diff] [blame] | 257 | |
Alexander Afanasyev | 3a22913 | 2012-04-25 15:07:26 -0700 | [diff] [blame] | 258 | static const int m_unknownDigestStoreTime = 10; // seconds |
Alexander Afanasyev | 89571f1 | 2012-04-23 13:44:57 -0700 | [diff] [blame] | 259 | #ifdef NS3_MODULE |
Alexander Afanasyev | 3a22913 | 2012-04-25 15:07:26 -0700 | [diff] [blame] | 260 | static const int m_syncResponseFreshness = 100; // milliseconds |
Alexander Afanasyev | 5560861 | 2012-04-30 13:24:50 -0700 | [diff] [blame] | 261 | static const int m_syncInterestReexpress = 10; // seconds |
Alexander Afanasyev | 3a22913 | 2012-04-25 15:07:26 -0700 | [diff] [blame] | 262 | // don't forget to adjust value in SyncCcnxWrapper |
Alexander Afanasyev | 40942f4 | 2012-04-21 20:53:16 -0700 | [diff] [blame] | 263 | #else |
Zhenkai Zhu | 60e8cb3 | 2012-06-04 17:29:30 -0700 | [diff] [blame] | 264 | static const int m_syncResponseFreshness = 4; |
Alexander Afanasyev | 89571f1 | 2012-04-23 13:44:57 -0700 | [diff] [blame] | 265 | static const int m_syncInterestReexpress = 4; |
Alexander Afanasyev | 40942f4 | 2012-04-21 20:53:16 -0700 | [diff] [blame] | 266 | #endif |
Alexander Afanasyev | bf2b436 | 2012-03-12 23:55:09 -0700 | [diff] [blame] | 267 | |
Alexander Afanasyev | a76010b | 2012-05-24 21:31:49 -0700 | [diff] [blame] | 268 | static const int m_defaultRecoveryRetransmitInterval = 200; // milliseconds |
| 269 | uint32_t m_recoveryRetransmissionInterval; // milliseconds |
| 270 | |
Alexander Afanasyev | bf2b436 | 2012-03-12 23:55:09 -0700 | [diff] [blame] | 271 | enum EventLabels |
| 272 | { |
| 273 | DELAYED_INTEREST_PROCESSING = 1, |
Alexander Afanasyev | 46eb526 | 2012-05-10 16:30:35 -0700 | [diff] [blame] | 274 | REEXPRESSING_INTEREST = 2, |
| 275 | REEXPRESSING_RECOVERY_INTEREST = 3 |
Alexander Afanasyev | bf2b436 | 2012-03-12 23:55:09 -0700 | [diff] [blame] | 276 | }; |
Zhenkai Zhu | 8d935c8 | 2012-03-06 10:44:12 -0800 | [diff] [blame] | 277 | }; |
| 278 | |
| 279 | |
| 280 | } // Sync |
| 281 | |
Zhenkai Zhu | 1ac6f80 | 2012-03-06 17:40:27 -0800 | [diff] [blame] | 282 | #endif // SYNC_APP_WRAPPER_H |