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 | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 23 | #ifndef NLSR_HELLO_PROTOCOL_HPP |
| 24 | #define NLSR_HELLO_PROTOCOL_HPP |
| 25 | |
| 26 | #include <boost/cstdint.hpp> |
| 27 | #include <ndn-cxx/face.hpp> |
| 28 | #include <ndn-cxx/util/scheduler.hpp> |
| 29 | |
| 30 | namespace nlsr { |
| 31 | |
| 32 | class Nlsr; |
| 33 | |
| 34 | class HelloProtocol |
| 35 | { |
| 36 | |
| 37 | public: |
| 38 | HelloProtocol(Nlsr& nlsr) |
| 39 | : m_nlsr(nlsr) |
| 40 | { |
| 41 | } |
| 42 | |
| 43 | public: |
| 44 | void |
| 45 | scheduleInterest(uint32_t seconds); |
| 46 | |
| 47 | void |
| 48 | expressInterest(const ndn::Name& interestNamePrefix, uint32_t seconds); |
| 49 | |
| 50 | void |
| 51 | sendScheduledInterest(uint32_t seconds); |
| 52 | |
| 53 | void |
| 54 | processInterest(const ndn::Name& name, const ndn::Interest& interest); |
| 55 | |
| 56 | private: |
| 57 | void |
| 58 | processInterestTimedOut(const ndn::Interest& interest); |
| 59 | |
| 60 | void |
Yingdi Yu | 20e3a6e | 2014-05-26 23:16:10 -0700 | [diff] [blame] | 61 | onContent(const ndn::Interest& interest, const ndn::Data& data); |
| 62 | |
| 63 | void |
| 64 | onContentValidated(const ndn::shared_ptr<const ndn::Data>& data); |
| 65 | |
| 66 | void |
| 67 | onContentValidationFailed(const ndn::shared_ptr<const ndn::Data>& data, |
| 68 | const std::string& msg); |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 69 | |
akmhoque | c04e727 | 2014-07-02 11:00:14 -0500 | [diff] [blame] | 70 | void |
| 71 | onRegistrationFailure(uint32_t code, const std::string& error); |
| 72 | |
| 73 | void |
| 74 | onRegistrationSuccess(const ndn::nfd::ControlParameters& commandSuccessResult, |
akmhoque | 8e0252b | 2014-07-07 16:04:44 -0500 | [diff] [blame] | 75 | const ndn::Name& neighbor); |
akmhoque | c04e727 | 2014-07-02 11:00:14 -0500 | [diff] [blame] | 76 | |
| 77 | void |
akmhoque | 8e0252b | 2014-07-07 16:04:44 -0500 | [diff] [blame] | 78 | registerPrefixes(const ndn::Name& adjName, const std::string& faceUri, |
akmhoque | bf11c5f | 2014-07-21 14:49:47 -0500 | [diff] [blame^] | 79 | double linkCost, const ndn::time::milliseconds& timeout); |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 80 | private: |
| 81 | Nlsr& m_nlsr; |
akmhoque | 157b0a4 | 2014-05-13 00:26:37 -0500 | [diff] [blame] | 82 | static const std::string INFO_COMPONENT; |
akmhoque | 93f1a07 | 2014-06-19 16:24:28 -0500 | [diff] [blame] | 83 | static const std::string NLSR_COMPONENT; |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame] | 84 | }; |
| 85 | |
| 86 | } //namespace nlsr |
| 87 | |
| 88 | #endif // NLSR_HELLO_PROTOCOL_HPP |