Yingdi Yu | 9236c43 | 2013-10-18 11:29:25 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /* |
| 3 | * Copyright (c) 2013, Regents of the University of California |
| 4 | * Yingdi Yu |
| 5 | * |
| 6 | * BSD license, See the LICENSE file for more information |
| 7 | * |
| 8 | * Author: Yingdi Yu <yingdi@cs.ucla.edu> |
| 9 | */ |
| 10 | |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 11 | #ifndef CHRONOS_CONTACT_MANAGER_H |
| 12 | #define CHRONOS_CONTACT_MANAGER_H |
Yingdi Yu | 9236c43 | 2013-10-18 11:29:25 -0700 | [diff] [blame] | 13 | |
Yingdi Yu | 4685b1b | 2013-10-18 17:05:02 -0700 | [diff] [blame] | 14 | #include <QObject> |
Yingdi Yu | 9236c43 | 2013-10-18 11:29:25 -0700 | [diff] [blame] | 15 | |
Yingdi Yu | 4685b1b | 2013-10-18 17:05:02 -0700 | [diff] [blame] | 16 | #ifndef Q_MOC_RUN |
| 17 | #include "contact-storage.h" |
Yingdi Yu | 4685b1b | 2013-10-18 17:05:02 -0700 | [diff] [blame] | 18 | #include "endorse-certificate.h" |
Yingdi Yu | 2ac40fb | 2013-10-21 13:38:38 -0700 | [diff] [blame] | 19 | #include "profile.h" |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 20 | #include "endorse-info.pb.h" |
| 21 | #include "endorse-collection.pb.h" |
Yingdi Yu | fa0b6a0 | 2014-04-30 14:26:42 -0700 | [diff] [blame] | 22 | #include <ndn-cxx/face.hpp> |
| 23 | #include <ndn-cxx/security/key-chain.hpp> |
| 24 | #include <ndn-cxx/security/validator.hpp> |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 25 | #include <boost/thread/locks.hpp> |
| 26 | #include <boost/thread/recursive_mutex.hpp> |
Yingdi Yu | 4685b1b | 2013-10-18 17:05:02 -0700 | [diff] [blame] | 27 | #endif |
| 28 | |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 29 | namespace chronos{ |
| 30 | |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 31 | typedef ndn::function<void(const ndn::Interest&)> TimeoutNotify; |
| 32 | typedef std::vector<ndn::shared_ptr<Contact> > ContactList; |
Yingdi Yu | 4685b1b | 2013-10-18 17:05:02 -0700 | [diff] [blame] | 33 | |
| 34 | class ContactManager : public QObject |
Yingdi Yu | 9236c43 | 2013-10-18 11:29:25 -0700 | [diff] [blame] | 35 | { |
Yingdi Yu | 4685b1b | 2013-10-18 17:05:02 -0700 | [diff] [blame] | 36 | Q_OBJECT |
| 37 | |
Yingdi Yu | 9236c43 | 2013-10-18 11:29:25 -0700 | [diff] [blame] | 38 | public: |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 39 | ContactManager(ndn::shared_ptr<ndn::Face> m_face, |
Yingdi Yu | 76dd800 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 40 | QObject* parent = 0); |
Yingdi Yu | 9236c43 | 2013-10-18 11:29:25 -0700 | [diff] [blame] | 41 | |
| 42 | ~ContactManager(); |
| 43 | |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 44 | ndn::shared_ptr<Contact> |
| 45 | getContact(const ndn::Name& identity) |
| 46 | { |
| 47 | return m_contactStorage->getContact(identity); |
| 48 | } |
Yingdi Yu | 4685b1b | 2013-10-18 17:05:02 -0700 | [diff] [blame] | 49 | |
| 50 | void |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 51 | getContactList(ContactList& contactList) |
| 52 | { |
| 53 | contactList.clear(); |
| 54 | contactList.insert(contactList.end(), m_contactList.begin(), m_contactList.end()); |
| 55 | } |
Yingdi Yu | 06f572b | 2014-03-11 15:46:10 -0700 | [diff] [blame] | 56 | private: |
| 57 | ndn::shared_ptr<ndn::IdentityCertificate> |
| 58 | loadTrustAnchor(); |
| 59 | |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 60 | void |
| 61 | initializeSecurity(); |
Yingdi Yu | b2e747d | 2013-11-05 23:06:43 -0800 | [diff] [blame] | 62 | |
| 63 | void |
| 64 | fetchCollectEndorse(const ndn::Name& identity); |
| 65 | |
| 66 | void |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 67 | fetchEndorseCertificateInternal(const ndn::Name& identity, int certIndex); |
Yingdi Yu | ae8217c | 2013-11-09 00:03:26 -0800 | [diff] [blame] | 68 | |
| 69 | void |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 70 | prepareEndorseInfo(const ndn::Name& identity); |
| 71 | |
| 72 | // PROFILE: self-endorse-certificate |
Yingdi Yu | fa0b6a0 | 2014-04-30 14:26:42 -0700 | [diff] [blame] | 73 | void |
| 74 | onDnsSelfEndorseCertValidated(const ndn::shared_ptr<const ndn::Data>& selfEndorseCertificate, |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 75 | const ndn::Name& identity); |
Yingdi Yu | 4685b1b | 2013-10-18 17:05:02 -0700 | [diff] [blame] | 76 | |
Yingdi Yu | b2e747d | 2013-11-05 23:06:43 -0800 | [diff] [blame] | 77 | void |
Yingdi Yu | fa0b6a0 | 2014-04-30 14:26:42 -0700 | [diff] [blame] | 78 | onDnsSelfEndorseCertValidationFailed(const ndn::shared_ptr<const ndn::Data>& selfEndorseCertificate, |
Yingdi Yu | 5a5ff20 | 2014-03-17 10:03:02 -0700 | [diff] [blame] | 79 | const std::string& failInfo, |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 80 | const ndn::Name& identity); |
Yingdi Yu | 9236c43 | 2013-10-18 11:29:25 -0700 | [diff] [blame] | 81 | |
Yingdi Yu | b2e747d | 2013-11-05 23:06:43 -0800 | [diff] [blame] | 82 | void |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 83 | onDnsSelfEndorseCertTimeoutNotify(const ndn::Interest& interest, |
| 84 | const ndn::Name& identity); |
Yingdi Yu | fa0b6a0 | 2014-04-30 14:26:42 -0700 | [diff] [blame] | 85 | |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 86 | // ENDORSED: endorse-collection |
| 87 | void |
Yingdi Yu | fa0b6a0 | 2014-04-30 14:26:42 -0700 | [diff] [blame] | 88 | onDnsCollectEndorseValidated(const ndn::shared_ptr<const ndn::Data>& data, |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 89 | const ndn::Name& identity); |
Yingdi Yu | b2e747d | 2013-11-05 23:06:43 -0800 | [diff] [blame] | 90 | |
Yingdi Yu | 76dd800 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 91 | void |
Yingdi Yu | 5a5ff20 | 2014-03-17 10:03:02 -0700 | [diff] [blame] | 92 | onDnsCollectEndorseValidationFailed(const ndn::shared_ptr<const ndn::Data>& data, |
| 93 | const std::string& failInfo, |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 94 | const ndn::Name& identity); |
Yingdi Yu | ae8217c | 2013-11-09 00:03:26 -0800 | [diff] [blame] | 95 | |
| 96 | void |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 97 | onDnsCollectEndorseTimeoutNotify(const ndn::Interest& interest, |
Yingdi Yu | fa0b6a0 | 2014-04-30 14:26:42 -0700 | [diff] [blame] | 98 | const ndn::Name& identity); |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 99 | |
| 100 | // PROFILE-CERT: endorse-certificate |
| 101 | void |
| 102 | onEndorseCertificateInternal(const ndn::Interest& interest, |
Yingdi Yu | fa0b6a0 | 2014-04-30 14:26:42 -0700 | [diff] [blame] | 103 | ndn::Data& data, |
| 104 | const ndn::Name& identity, |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 105 | int certIndex, |
| 106 | std::string hash); |
Yingdi Yu | ae8217c | 2013-11-09 00:03:26 -0800 | [diff] [blame] | 107 | |
Yingdi Yu | 7223269 | 2013-11-12 17:50:21 -0800 | [diff] [blame] | 108 | void |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 109 | onEndorseCertificateInternalTimeout(const ndn::Interest& interest, |
Yingdi Yu | fa0b6a0 | 2014-04-30 14:26:42 -0700 | [diff] [blame] | 110 | const ndn::Name& identity, |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 111 | int certIndex); |
| 112 | |
| 113 | // Collect endorsement |
| 114 | void |
| 115 | collectEndorsement(); |
| 116 | |
| 117 | void |
| 118 | onDnsEndorseeValidated(const ndn::shared_ptr<const ndn::Data>& data); |
| 119 | |
| 120 | void |
Yingdi Yu | 5a5ff20 | 2014-03-17 10:03:02 -0700 | [diff] [blame] | 121 | onDnsEndorseeValidationFailed(const ndn::shared_ptr<const ndn::Data>& data, |
| 122 | const std::string& failInfo); |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 123 | |
| 124 | void |
| 125 | onDnsEndorseeTimeoutNotify(const ndn::Interest& interest); |
| 126 | |
| 127 | void |
| 128 | decreaseCollectStatus(); |
| 129 | |
| 130 | void |
| 131 | publishCollectEndorsedDataInDNS(); |
| 132 | |
| 133 | // Identity certificate |
| 134 | void |
| 135 | onIdentityCertValidated(const ndn::shared_ptr<const ndn::Data>& data); |
Yingdi Yu | fa0b6a0 | 2014-04-30 14:26:42 -0700 | [diff] [blame] | 136 | |
Yingdi Yu | 76dd800 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 137 | void |
Yingdi Yu | 5a5ff20 | 2014-03-17 10:03:02 -0700 | [diff] [blame] | 138 | onIdentityCertValidationFailed(const ndn::shared_ptr<const ndn::Data>& data, |
| 139 | const std::string& failInfo); |
Yingdi Yu | 76dd800 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 140 | |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 141 | void |
| 142 | onIdentityCertTimeoutNotify(const ndn::Interest& interest); |
| 143 | |
| 144 | void |
| 145 | decreaseIdCertCount(); |
| 146 | |
| 147 | // Publish self-endorse certificate |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 148 | ndn::shared_ptr<EndorseCertificate> |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 149 | getSignedSelfEndorseCertificate(const Profile& profile); |
Yingdi Yu | b2e747d | 2013-11-05 23:06:43 -0800 | [diff] [blame] | 150 | |
Yingdi Yu | 4685b1b | 2013-10-18 17:05:02 -0700 | [diff] [blame] | 151 | void |
Yingdi Yu | 76dd800 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 152 | publishSelfEndorseCertificateInDNS(const EndorseCertificate& selfEndorseCertificate); |
Yingdi Yu | 4685b1b | 2013-10-18 17:05:02 -0700 | [diff] [blame] | 153 | |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 154 | // Publish endorse certificate |
Yingdi Yu | fa0b6a0 | 2014-04-30 14:26:42 -0700 | [diff] [blame] | 155 | ndn::shared_ptr<EndorseCertificate> |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 156 | generateEndorseCertificate(const ndn::Name& identity); |
Yingdi Yu | 76dd800 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 157 | |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 158 | void |
| 159 | publishEndorseCertificateInDNS(const EndorseCertificate& endorseCertificate); |
| 160 | |
| 161 | // Communication |
| 162 | void |
Yingdi Yu | 76dd800 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 163 | sendInterest(const ndn::Interest& interest, |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 164 | const ndn::OnDataValidated& onValidated, |
| 165 | const ndn::OnDataValidationFailed& onValidationFailed, |
Yingdi Yu | 76dd800 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 166 | const TimeoutNotify& timeoutNotify, |
Yingdi Yu | 68de61d | 2014-01-16 19:13:03 -0800 | [diff] [blame] | 167 | int retry = 1); |
Yingdi Yu | 76dd800 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 168 | |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 169 | void |
Yingdi Yu | fa0b6a0 | 2014-04-30 14:26:42 -0700 | [diff] [blame] | 170 | onTargetData(const ndn::Interest& interest, |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 171 | const ndn::Data& data, |
| 172 | const ndn::OnDataValidated& onValidated, |
| 173 | const ndn::OnDataValidationFailed& onValidationFailed); |
Yingdi Yu | 76dd800 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 174 | |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 175 | void |
Yingdi Yu | fa0b6a0 | 2014-04-30 14:26:42 -0700 | [diff] [blame] | 176 | onTargetTimeout(const ndn::Interest& interest, |
Yingdi Yu | 76dd800 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 177 | int retry, |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 178 | const ndn::OnDataValidated& onValidated, |
| 179 | const ndn::OnDataValidationFailed& onValidationFailed, |
Yingdi Yu | 76dd800 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 180 | const TimeoutNotify& timeoutNotify); |
| 181 | |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 182 | // DNS listener |
Yingdi Yu | b2e747d | 2013-11-05 23:06:43 -0800 | [diff] [blame] | 183 | void |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 184 | onDnsInterest(const ndn::Name& prefix, const ndn::Interest& interest); |
Yingdi Yu | fa0b6a0 | 2014-04-30 14:26:42 -0700 | [diff] [blame] | 185 | |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 186 | void |
| 187 | onDnsRegisterFailed(const ndn::Name& prefix, const std::string& failInfo); |
Yingdi Yu | b2e747d | 2013-11-05 23:06:43 -0800 | [diff] [blame] | 188 | |
Yingdi Yu | 4685b1b | 2013-10-18 17:05:02 -0700 | [diff] [blame] | 189 | signals: |
Yingdi Yu | 8e13583 | 2013-11-09 20:12:31 -0800 | [diff] [blame] | 190 | void |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 191 | contactEndorseInfoReady(const chronos::EndorseInfo& endorseInfo); |
| 192 | |
| 193 | void |
| 194 | contactInfoFetchFailed(const QString& identity); |
| 195 | |
| 196 | void |
| 197 | idCertNameListReady(const QStringList& certNameList); |
Yingdi Yu | fa0b6a0 | 2014-04-30 14:26:42 -0700 | [diff] [blame] | 198 | |
Yingdi Yu | 4685b1b | 2013-10-18 17:05:02 -0700 | [diff] [blame] | 199 | void |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 200 | nameListReady(const QStringList& certNameList); |
Yingdi Yu | 4685b1b | 2013-10-18 17:05:02 -0700 | [diff] [blame] | 201 | |
Yingdi Yu | b2e747d | 2013-11-05 23:06:43 -0800 | [diff] [blame] | 202 | void |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 203 | idCertReady(const ndn::IdentityCertificate& idCert); |
Yingdi Yu | b2e747d | 2013-11-05 23:06:43 -0800 | [diff] [blame] | 204 | |
| 205 | void |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 206 | contactAliasListReady(const QStringList& aliasList); |
Yingdi Yu | b2e747d | 2013-11-05 23:06:43 -0800 | [diff] [blame] | 207 | |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 208 | void |
| 209 | contactIdListReady(const QStringList& idList); |
| 210 | |
| 211 | void |
Yingdi Yu | fa0b6a0 | 2014-04-30 14:26:42 -0700 | [diff] [blame] | 212 | contactInfoReady(const QString& identity, |
| 213 | const QString& name, |
| 214 | const QString& institute, |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 215 | bool isIntro); |
| 216 | |
| 217 | void |
| 218 | warning(const QString& msg); |
| 219 | |
| 220 | public slots: |
| 221 | void |
| 222 | onIdentityUpdated(const QString& identity); |
| 223 | |
| 224 | void |
| 225 | onFetchContactInfo(const QString& identity); |
Yingdi Yu | fa0b6a0 | 2014-04-30 14:26:42 -0700 | [diff] [blame] | 226 | |
Yingdi Yu | ae8217c | 2013-11-09 00:03:26 -0800 | [diff] [blame] | 227 | void |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 228 | onAddFetchedContact(const QString& identity); |
Yingdi Yu | b2e747d | 2013-11-05 23:06:43 -0800 | [diff] [blame] | 229 | |
| 230 | void |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 231 | onUpdateProfile(); |
Yingdi Yu | b2e747d | 2013-11-05 23:06:43 -0800 | [diff] [blame] | 232 | |
Yingdi Yu | ae8217c | 2013-11-09 00:03:26 -0800 | [diff] [blame] | 233 | void |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 234 | onRefreshBrowseContact(); |
Yingdi Yu | ae8217c | 2013-11-09 00:03:26 -0800 | [diff] [blame] | 235 | |
Yingdi Yu | 7223269 | 2013-11-12 17:50:21 -0800 | [diff] [blame] | 236 | void |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 237 | onFetchIdCert(const QString& certName); |
Yingdi Yu | 7223269 | 2013-11-12 17:50:21 -0800 | [diff] [blame] | 238 | |
| 239 | void |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 240 | onAddFetchedContactIdCert(const QString& identity); |
Yingdi Yu | 7223269 | 2013-11-12 17:50:21 -0800 | [diff] [blame] | 241 | |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 242 | void |
| 243 | onWaitForContactList(); |
| 244 | |
| 245 | void |
| 246 | onWaitForContactInfo(const QString& identity); |
Yingdi Yu | fa0b6a0 | 2014-04-30 14:26:42 -0700 | [diff] [blame] | 247 | |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 248 | void |
| 249 | onRemoveContact(const QString& identity); |
| 250 | |
| 251 | void |
| 252 | onUpdateAlias(const QString& identity, const QString& alias); |
| 253 | |
| 254 | void |
| 255 | onUpdateIsIntroducer(const QString& identity, bool isIntro); |
| 256 | |
| 257 | void |
| 258 | onUpdateEndorseCertificate(const QString& identity); |
| 259 | |
Yingdi Yu | 9236c43 | 2013-10-18 11:29:25 -0700 | [diff] [blame] | 260 | private: |
Yingdi Yu | 93adb1a | 2014-01-16 10:30:26 -0800 | [diff] [blame] | 261 | |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 262 | class FetchedInfo { |
| 263 | public: |
| 264 | ndn::shared_ptr<EndorseCertificate> m_selfEndorseCert; |
| 265 | ndn::shared_ptr<EndorseCollection> m_endorseCollection; |
| 266 | std::vector<ndn::shared_ptr<EndorseCertificate> > m_endorseCertList; |
| 267 | ndn::shared_ptr<EndorseInfo> m_endorseInfo; |
| 268 | }; |
| 269 | |
| 270 | typedef std::map<ndn::Name, FetchedInfo> BufferedContacts; |
| 271 | typedef std::map<ndn::Name, ndn::shared_ptr<ndn::IdentityCertificate> > BufferedIdCerts; |
| 272 | |
| 273 | typedef boost::recursive_mutex RecLock; |
| 274 | typedef boost::unique_lock<RecLock> UniqueRecLock; |
| 275 | |
| 276 | // Conf |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 277 | ndn::shared_ptr<ContactStorage> m_contactStorage; |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 278 | ndn::shared_ptr<ndn::Validator> m_validator; |
| 279 | ndn::shared_ptr<ndn::Face> m_face; |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 280 | ndn::KeyChain m_keyChain; |
| 281 | ndn::Name m_identity; |
| 282 | ContactList m_contactList; |
| 283 | |
| 284 | // Buffer |
| 285 | BufferedContacts m_bufferedContacts; |
| 286 | BufferedIdCerts m_bufferedIdCerts; |
| 287 | |
| 288 | // Tmp Dns |
| 289 | const ndn::RegisteredPrefixId* m_dnsListenerId; |
| 290 | |
| 291 | RecLock m_collectCountMutex; |
| 292 | int m_collectCount; |
| 293 | |
| 294 | RecLock m_idCertCountMutex; |
| 295 | int m_idCertCount; |
Yingdi Yu | 9236c43 | 2013-10-18 11:29:25 -0700 | [diff] [blame] | 296 | }; |
| 297 | |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 298 | } // namespace chronos |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 299 | |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 300 | #endif //CHRONOS_CONTACT_MANAGER_H |