Alexander Afanasyev | c169a81 | 2014-05-20 20:37:29 -0400 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
Jeff Thompson | aa4e6db | 2013-07-15 17:25:23 -0700 | [diff] [blame] | 2 | /** |
Alexander Afanasyev | c169a81 | 2014-05-20 20:37:29 -0400 | [diff] [blame] | 3 | * Copyright (c) 2013-2014 Regents of the University of California. |
Alexander Afanasyev | dfa52c4 | 2014-04-24 21:10:11 -0700 | [diff] [blame] | 4 | * |
| 5 | * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions). |
Alexander Afanasyev | dfa52c4 | 2014-04-24 21:10:11 -0700 | [diff] [blame] | 6 | * |
Alexander Afanasyev | c169a81 | 2014-05-20 20:37:29 -0400 | [diff] [blame] | 7 | * ndn-cxx library is free software: you can redistribute it and/or modify it under the |
| 8 | * terms of the GNU Lesser General Public License as published by the Free Software |
| 9 | * Foundation, either version 3 of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY |
| 12 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
| 13 | * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
| 14 | * |
| 15 | * You should have received copies of the GNU General Public License and GNU Lesser |
| 16 | * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see |
| 17 | * <http://www.gnu.org/licenses/>. |
| 18 | * |
| 19 | * See AUTHORS.md for complete list of ndn-cxx authors and contributors. |
Alexander Afanasyev | dfa52c4 | 2014-04-24 21:10:11 -0700 | [diff] [blame] | 20 | * |
| 21 | * Based on code originally written by Jeff Thompson <jefft0@remap.ucla.edu> |
Jeff Thompson | aa4e6db | 2013-07-15 17:25:23 -0700 | [diff] [blame] | 22 | */ |
| 23 | |
Jeff Thompson | b9e3c8e | 2013-08-02 11:42:51 -0700 | [diff] [blame] | 24 | #ifndef NDN_FACE_HPP |
Jeff Thompson | a0d18c9 | 2013-08-06 13:55:32 -0700 | [diff] [blame] | 25 | #define NDN_FACE_HPP |
Jeff Thompson | aa4e6db | 2013-07-15 17:25:23 -0700 | [diff] [blame] | 26 | |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 27 | #include "common.hpp" |
Alexander Afanasyev | 258ec2b | 2014-05-14 16:15:37 -0700 | [diff] [blame] | 28 | |
| 29 | #include "name.hpp" |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 30 | #include "interest.hpp" |
Alexander Afanasyev | 258ec2b | 2014-05-14 16:15:37 -0700 | [diff] [blame] | 31 | #include "interest-filter.hpp" |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 32 | #include "data.hpp" |
Alexander Afanasyev | 984ad19 | 2014-05-02 19:11:15 -0700 | [diff] [blame] | 33 | #include "security/identity-certificate.hpp" |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 34 | |
Alexander Afanasyev | 258ec2b | 2014-05-14 16:15:37 -0700 | [diff] [blame] | 35 | namespace boost { |
| 36 | namespace asio { |
| 37 | class io_service; |
| 38 | } |
| 39 | } |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 40 | |
Jeff Thompson | aa4e6db | 2013-07-15 17:25:23 -0700 | [diff] [blame] | 41 | namespace ndn { |
| 42 | |
Alexander Afanasyev | 258ec2b | 2014-05-14 16:15:37 -0700 | [diff] [blame] | 43 | class Transport; |
| 44 | |
| 45 | class PendingInterestId; |
| 46 | class RegisteredPrefixId; |
| 47 | class InterestFilterId; |
| 48 | |
Alexander Afanasyev | ee8bb1e | 2014-05-02 17:39:54 -0700 | [diff] [blame] | 49 | namespace nfd { |
| 50 | class Controller; |
| 51 | } |
Alexander Afanasyev | ee8bb1e | 2014-05-02 17:39:54 -0700 | [diff] [blame] | 52 | |
Jeff Thompson | fe08e5a | 2013-08-13 11:15:59 -0700 | [diff] [blame] | 53 | /** |
Alexander Afanasyev | 984ad19 | 2014-05-02 19:11:15 -0700 | [diff] [blame] | 54 | * @brief Callback called when expressed Interest gets satisfied with Data packet |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 55 | */ |
| 56 | typedef function<void(const Interest&, Data&)> OnData; |
| 57 | |
| 58 | /** |
Alexander Afanasyev | 984ad19 | 2014-05-02 19:11:15 -0700 | [diff] [blame] | 59 | * @brief Callback called when expressed Interest times out |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 60 | */ |
| 61 | typedef function<void(const Interest&)> OnTimeout; |
| 62 | |
| 63 | /** |
Alexander Afanasyev | 984ad19 | 2014-05-02 19:11:15 -0700 | [diff] [blame] | 64 | * @brief Callback called when incoming Interest matches the specified InterestFilter |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 65 | */ |
Alexander Afanasyev | 9016496 | 2014-03-06 08:29:59 +0000 | [diff] [blame] | 66 | typedef function<void (const InterestFilter&, const Interest&)> OnInterest; |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 67 | |
| 68 | /** |
Alexander Afanasyev | 984ad19 | 2014-05-02 19:11:15 -0700 | [diff] [blame] | 69 | * @brief Callback called when registerPrefix or setInterestFilter command succeeds |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 70 | */ |
Alexander Afanasyev | 984ad19 | 2014-05-02 19:11:15 -0700 | [diff] [blame] | 71 | typedef function<void(const Name&)> RegisterPrefixSuccessCallback; |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 72 | |
Alexander Afanasyev | 984ad19 | 2014-05-02 19:11:15 -0700 | [diff] [blame] | 73 | /** |
| 74 | * @brief Callback called when registerPrefix or setInterestFilter command fails |
| 75 | */ |
| 76 | typedef function<void(const Name&, const std::string&)> RegisterPrefixFailureCallback; |
| 77 | |
| 78 | /** |
| 79 | * @brief Callback called when unregisterPrefix or unsetInterestFilter command succeeds |
| 80 | */ |
| 81 | typedef function<void()> UnregisterPrefixSuccessCallback; |
| 82 | |
| 83 | /** |
| 84 | * @brief Callback called when unregisterPrefix or unsetInterestFilter command fails |
| 85 | */ |
| 86 | typedef function<void(const std::string&)> UnregisterPrefixFailureCallback; |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 87 | |
| 88 | |
| 89 | /** |
| 90 | * @brief Abstraction to communicate with local or remote NDN forwarder |
Jeff Thompson | fe08e5a | 2013-08-13 11:15:59 -0700 | [diff] [blame] | 91 | */ |
Alexander Afanasyev | 8460afb | 2014-02-15 20:31:42 -0800 | [diff] [blame] | 92 | class Face : noncopyable |
| 93 | { |
Jeff Thompson | aa4e6db | 2013-07-15 17:25:23 -0700 | [diff] [blame] | 94 | public: |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 95 | class Error : public std::runtime_error |
| 96 | { |
| 97 | public: |
| 98 | explicit |
| 99 | Error(const std::string& what) |
| 100 | : std::runtime_error(what) |
| 101 | { |
| 102 | } |
| 103 | }; |
Alexander Afanasyev | b790d95 | 2014-01-24 12:07:53 -0800 | [diff] [blame] | 104 | |
| 105 | /** |
Alexander Afanasyev | 691c3ce | 2014-04-23 14:28:04 -0700 | [diff] [blame] | 106 | * @brief Create a new Face using the default transport (UnixTransport) |
| 107 | * |
Steve DiBenedetto | c07b3a2 | 2014-03-19 12:32:52 -0600 | [diff] [blame] | 108 | * @throws ConfigFile::Error on configuration file parse failure |
| 109 | * @throws Face::Error on unsupported protocol |
Alexander Afanasyev | b790d95 | 2014-01-24 12:07:53 -0800 | [diff] [blame] | 110 | */ |
Alexander Afanasyev | f7ca320 | 2014-02-14 22:28:31 -0800 | [diff] [blame] | 111 | Face(); |
Alexander Afanasyev | e2e0d75 | 2014-01-03 13:30:30 -0800 | [diff] [blame] | 112 | |
| 113 | /** |
Alexander Afanasyev | 691c3ce | 2014-04-23 14:28:04 -0700 | [diff] [blame] | 114 | * @brief Create a new Face using the default transport (UnixTransport) |
| 115 | * |
| 116 | * @deprecated This constructor is deprecated. Use `Face(boost::asio::io_service&)` |
| 117 | * instead. |
| 118 | * |
| 119 | * @param ioService A shared pointer to boost::io_service object that should control all |
| 120 | * IO operations |
Steve DiBenedetto | c07b3a2 | 2014-03-19 12:32:52 -0600 | [diff] [blame] | 121 | * @throws ConfigFile::Error on configuration file parse failure |
| 122 | * @throws Face::Error on unsupported protocol |
Jeff Thompson | fe08e5a | 2013-08-13 11:15:59 -0700 | [diff] [blame] | 123 | */ |
Alexander Afanasyev | 9c57818 | 2014-05-14 17:28:28 -0700 | [diff] [blame] | 124 | DEPRECATED( |
Alexander Afanasyev | f7ca320 | 2014-02-14 22:28:31 -0800 | [diff] [blame] | 125 | explicit |
Alexander Afanasyev | 9c57818 | 2014-05-14 17:28:28 -0700 | [diff] [blame] | 126 | Face(const shared_ptr<boost::asio::io_service>& ioService)); |
Alexander Afanasyev | 7682ccb | 2014-02-20 10:29:35 -0800 | [diff] [blame] | 127 | |
Jeff Thompson | fe08e5a | 2013-08-13 11:15:59 -0700 | [diff] [blame] | 128 | /** |
Alexander Afanasyev | 691c3ce | 2014-04-23 14:28:04 -0700 | [diff] [blame] | 129 | * @brief Create a new Face using the default transport (UnixTransport) |
| 130 | * |
| 131 | * @par Usage examples: |
| 132 | * |
| 133 | * Face face1; |
| 134 | * Face face2(face1.getIoService()); |
| 135 | * |
| 136 | * // Now the following ensures that events on both faces are processed |
| 137 | * face1.processEvents(); |
| 138 | * // or face1.getIoService().run(); |
| 139 | * |
| 140 | * @par or |
| 141 | * |
| 142 | * boost::asio::io_service ioService; |
| 143 | * Face face1(ioService); |
| 144 | * Face face2(ioService); |
| 145 | * ... |
| 146 | * |
| 147 | * ioService.run(); |
| 148 | * |
| 149 | * @param ioService A reference to boost::io_service object that should control all |
| 150 | * IO operations. |
| 151 | * @throws ConfigFile::Error on configuration file parse failure |
| 152 | * @throws Face::Error on unsupported protocol |
| 153 | */ |
| 154 | explicit |
| 155 | Face(boost::asio::io_service& ioService); |
| 156 | |
| 157 | /** |
| 158 | * @brief Create a new Face using TcpTransport |
| 159 | * |
Alexander Afanasyev | 984ad19 | 2014-05-02 19:11:15 -0700 | [diff] [blame] | 160 | * @param host The host of the NDN forwarder |
| 161 | * @param port (optional) The port or service name of the NDN forwarder (**default**: "6363") |
| 162 | * |
Steve DiBenedetto | c07b3a2 | 2014-03-19 12:32:52 -0600 | [diff] [blame] | 163 | * @throws Face::Error on unsupported protocol |
Jeff Thompson | fe08e5a | 2013-08-13 11:15:59 -0700 | [diff] [blame] | 164 | */ |
Alexander Afanasyev | 7682ccb | 2014-02-20 10:29:35 -0800 | [diff] [blame] | 165 | Face(const std::string& host, const std::string& port = "6363"); |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 166 | |
| 167 | /** |
Alexander Afanasyev | 691c3ce | 2014-04-23 14:28:04 -0700 | [diff] [blame] | 168 | * @brief Create a new Face using the given Transport |
Alexander Afanasyev | 984ad19 | 2014-05-02 19:11:15 -0700 | [diff] [blame] | 169 | * |
| 170 | * @param transport A shared_ptr to a Transport object used for communication |
| 171 | * |
Steve DiBenedetto | c07b3a2 | 2014-03-19 12:32:52 -0600 | [diff] [blame] | 172 | * @throws Face::Error on unsupported protocol |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 173 | */ |
Alexander Afanasyev | f7ca320 | 2014-02-14 22:28:31 -0800 | [diff] [blame] | 174 | explicit |
| 175 | Face(const shared_ptr<Transport>& transport); |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 176 | |
| 177 | /** |
Alexander Afanasyev | 691c3ce | 2014-04-23 14:28:04 -0700 | [diff] [blame] | 178 | * @brief Create a new Face using the given Transport and IO service object |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 179 | * |
Alexander Afanasyev | 691c3ce | 2014-04-23 14:28:04 -0700 | [diff] [blame] | 180 | * @sa Face(boost::asio::io_service&) |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 181 | * |
Steve DiBenedetto | c07b3a2 | 2014-03-19 12:32:52 -0600 | [diff] [blame] | 182 | * @throws Face::Error on unsupported protocol |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 183 | */ |
| 184 | Face(const shared_ptr<Transport>& transport, |
Alexander Afanasyev | 691c3ce | 2014-04-23 14:28:04 -0700 | [diff] [blame] | 185 | boost::asio::io_service& ioService); |
Alexander Afanasyev | 7682ccb | 2014-02-20 10:29:35 -0800 | [diff] [blame] | 186 | |
Jeff Thompson | 4fe4551 | 2013-08-23 14:06:38 -0700 | [diff] [blame] | 187 | /** |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 188 | * @brief Express Interest |
| 189 | * |
Alexander Afanasyev | 984ad19 | 2014-05-02 19:11:15 -0700 | [diff] [blame] | 190 | * @param interest An Interest to be expressed |
| 191 | * @param onData Callback to be called when a matching data packet is received |
| 192 | * @param onTimeout (optional) A function object to call if the interest times out |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 193 | * |
Alexander Afanasyev | 984ad19 | 2014-05-02 19:11:15 -0700 | [diff] [blame] | 194 | * @return The pending interest ID which can be used with removePendingInterest |
Alexander Afanasyev | 49bb1fb | 2014-07-21 12:54:01 -0700 | [diff] [blame] | 195 | * |
| 196 | * @throws Error when Interest size exceeds maximum limit (MAX_NDN_PACKET_SIZE) |
Jeff Thompson | 4fe4551 | 2013-08-23 14:06:38 -0700 | [diff] [blame] | 197 | */ |
Alexander Afanasyev | b790d95 | 2014-01-24 12:07:53 -0800 | [diff] [blame] | 198 | const PendingInterestId* |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 199 | expressInterest(const Interest& interest, |
| 200 | const OnData& onData, const OnTimeout& onTimeout = OnTimeout()); |
Jeff Thompson | 4fe4551 | 2013-08-23 14:06:38 -0700 | [diff] [blame] | 201 | |
| 202 | /** |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 203 | * @brief Express Interest using name and Interest template |
| 204 | * |
| 205 | * @param name Name of the Interest |
| 206 | * @param tmpl Interest template to fill parameters |
Alexander Afanasyev | 984ad19 | 2014-05-02 19:11:15 -0700 | [diff] [blame] | 207 | * @param onData Callback to be called when a matching data packet is received |
| 208 | * @param onTimeout (optional) A function object to call if the interest times out |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 209 | * |
Alexander Afanasyev | 984ad19 | 2014-05-02 19:11:15 -0700 | [diff] [blame] | 210 | * @return Opaque pending interest ID which can be used with removePendingInterest |
Alexander Afanasyev | 49bb1fb | 2014-07-21 12:54:01 -0700 | [diff] [blame] | 211 | * |
| 212 | * @throws Error when Interest size exceeds maximum limit (MAX_NDN_PACKET_SIZE) |
Jeff Thompson | 7aec025 | 2013-08-22 17:29:57 -0700 | [diff] [blame] | 213 | */ |
Alexander Afanasyev | b790d95 | 2014-01-24 12:07:53 -0800 | [diff] [blame] | 214 | const PendingInterestId* |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 215 | expressInterest(const Name& name, |
Alexander Afanasyev | 7682ccb | 2014-02-20 10:29:35 -0800 | [diff] [blame] | 216 | const Interest& tmpl, |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 217 | const OnData& onData, const OnTimeout& onTimeout = OnTimeout()); |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 218 | |
Jeff Thompson | 1109514 | 2013-10-01 16:20:28 -0700 | [diff] [blame] | 219 | /** |
Alexander Afanasyev | 984ad19 | 2014-05-02 19:11:15 -0700 | [diff] [blame] | 220 | * @brief Cancel previously expressed Interest |
Alexander Afanasyev | 691c3ce | 2014-04-23 14:28:04 -0700 | [diff] [blame] | 221 | * |
Jeff Thompson | 1109514 | 2013-10-01 16:20:28 -0700 | [diff] [blame] | 222 | * @param pendingInterestId The ID returned from expressInterest. |
| 223 | */ |
| 224 | void |
Alexander Afanasyev | 7682ccb | 2014-02-20 10:29:35 -0800 | [diff] [blame] | 225 | removePendingInterest(const PendingInterestId* pendingInterestId); |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 226 | |
Jeff Thompson | 432c8be | 2013-08-09 16:16:08 -0700 | [diff] [blame] | 227 | /** |
Alexander Afanasyev | 984ad19 | 2014-05-02 19:11:15 -0700 | [diff] [blame] | 228 | * @brief Set InterestFilter to dispatch incoming matching interest to onInterest |
| 229 | * callback and register the filtered prefix with the connected NDN forwarder |
| 230 | * |
| 231 | * This version of setInterestFilter combines setInterestFilter and registerPrefix |
| 232 | * operations and is intended to be used when only one filter for the same prefix needed |
| 233 | * to be set. When multiple names sharing the same prefix should be dispatched to |
| 234 | * different callbacks, use one registerPrefix call, followed (in onSuccess callback) by |
| 235 | * a series of setInterestFilter calls. |
Alexander Afanasyev | 691c3ce | 2014-04-23 14:28:04 -0700 | [diff] [blame] | 236 | * |
Alexander Afanasyev | 9016496 | 2014-03-06 08:29:59 +0000 | [diff] [blame] | 237 | * @param interestFilter Interest filter (prefix part will be registered with the forwarder) |
Alexander Afanasyev | 984ad19 | 2014-05-02 19:11:15 -0700 | [diff] [blame] | 238 | * @param onInterest A callback to be called when a matching interest is received |
| 239 | * @param onSuccess A callback to be called when prefixRegister command succeeds |
| 240 | * @param onFailure A callback to be called when prefixRegister command fails |
Alexander Afanasyev | 0866f51 | 2014-08-11 13:25:09 -0700 | [diff] [blame] | 241 | * @param flags (optional) RIB flags (not used when direct FIB management is requested) |
Alexander Afanasyev | 984ad19 | 2014-05-02 19:11:15 -0700 | [diff] [blame] | 242 | * @param certificate (optional) A certificate under which the prefix registration |
| 243 | * command interest is signed. When omitted, a default certificate |
| 244 | * of the default identity is used to sign the registration command |
Alexander Afanasyev | 691c3ce | 2014-04-23 14:28:04 -0700 | [diff] [blame] | 245 | * |
Alexander Afanasyev | 984ad19 | 2014-05-02 19:11:15 -0700 | [diff] [blame] | 246 | * @return Opaque registered prefix ID which can be used with unsetInterestFilter or |
| 247 | * removeRegisteredPrefix |
Jeff Thompson | 86507bc | 2013-08-23 20:51:38 -0700 | [diff] [blame] | 248 | */ |
Alexander Afanasyev | b790d95 | 2014-01-24 12:07:53 -0800 | [diff] [blame] | 249 | const RegisteredPrefixId* |
Alexander Afanasyev | 9016496 | 2014-03-06 08:29:59 +0000 | [diff] [blame] | 250 | setInterestFilter(const InterestFilter& interestFilter, |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 251 | const OnInterest& onInterest, |
Alexander Afanasyev | 984ad19 | 2014-05-02 19:11:15 -0700 | [diff] [blame] | 252 | const RegisterPrefixSuccessCallback& onSuccess, |
| 253 | const RegisterPrefixFailureCallback& onFailure, |
Alexander Afanasyev | 0866f51 | 2014-08-11 13:25:09 -0700 | [diff] [blame] | 254 | const IdentityCertificate& certificate = IdentityCertificate(), |
| 255 | uint64_t flags = nfd::ROUTE_FLAG_CHILD_INHERIT); |
Jeff Thompson | 1109514 | 2013-10-01 16:20:28 -0700 | [diff] [blame] | 256 | |
| 257 | /** |
Alexander Afanasyev | 1b01c31 | 2014-05-26 16:58:10 +0300 | [diff] [blame] | 258 | * @brief Set InterestFilter to dispatch incoming matching interest to onInterest |
| 259 | * callback and register the filtered prefix with the connected NDN forwarder |
| 260 | * |
| 261 | * This version of setInterestFilter combines setInterestFilter and registerPrefix |
| 262 | * operations and is intended to be used when only one filter for the same prefix needed |
| 263 | * to be set. When multiple names sharing the same prefix should be dispatched to |
| 264 | * different callbacks, use one registerPrefix call, followed (in onSuccess callback) by |
| 265 | * a series of setInterestFilter calls. |
| 266 | * |
| 267 | * @param interestFilter Interest filter (prefix part will be registered with the forwarder) |
| 268 | * @param onInterest A callback to be called when a matching interest is received |
| 269 | * @param onFailure A callback to be called when prefixRegister command fails |
Alexander Afanasyev | 0866f51 | 2014-08-11 13:25:09 -0700 | [diff] [blame] | 270 | * @param flags (optional) RIB flags (not used when direct FIB management is requested) |
Alexander Afanasyev | 1b01c31 | 2014-05-26 16:58:10 +0300 | [diff] [blame] | 271 | * @param certificate (optional) A certificate under which the prefix registration |
| 272 | * command interest is signed. When omitted, a default certificate |
| 273 | * of the default identity is used to sign the registration command |
| 274 | * |
| 275 | * @return Opaque registered prefix ID which can be used with unsetInterestFilter or |
| 276 | * removeRegisteredPrefix |
Yingdi Yu | e66bf2a | 2014-04-28 17:07:36 -0700 | [diff] [blame] | 277 | */ |
| 278 | const RegisteredPrefixId* |
Alexander Afanasyev | 9016496 | 2014-03-06 08:29:59 +0000 | [diff] [blame] | 279 | setInterestFilter(const InterestFilter& interestFilter, |
Yingdi Yu | e66bf2a | 2014-04-28 17:07:36 -0700 | [diff] [blame] | 280 | const OnInterest& onInterest, |
Alexander Afanasyev | 984ad19 | 2014-05-02 19:11:15 -0700 | [diff] [blame] | 281 | const RegisterPrefixFailureCallback& onFailure, |
Alexander Afanasyev | 0866f51 | 2014-08-11 13:25:09 -0700 | [diff] [blame] | 282 | const IdentityCertificate& certificate = IdentityCertificate(), |
| 283 | uint64_t flags = nfd::ROUTE_FLAG_CHILD_INHERIT); |
Yingdi Yu | e66bf2a | 2014-04-28 17:07:36 -0700 | [diff] [blame] | 284 | |
| 285 | /** |
Alexander Afanasyev | 984ad19 | 2014-05-02 19:11:15 -0700 | [diff] [blame] | 286 | * @brief Set InterestFilter to dispatch incoming matching interest to onInterest |
| 287 | * callback and register the filtered prefix with the connected NDN forwarder |
| 288 | * |
| 289 | * This version of setInterestFilter combines setInterestFilter and registerPrefix |
| 290 | * operations and is intended to be used when only one filter for the same prefix needed |
| 291 | * to be set. When multiple names sharing the same prefix should be dispatched to |
| 292 | * different callbacks, use one registerPrefix call, followed (in onSuccess callback) by |
| 293 | * a series of setInterestFilter calls. |
Yingdi Yu | e66bf2a | 2014-04-28 17:07:36 -0700 | [diff] [blame] | 294 | * |
Alexander Afanasyev | 9016496 | 2014-03-06 08:29:59 +0000 | [diff] [blame] | 295 | * @param interestFilter Interest filter (prefix part will be registered with the forwarder) |
Alexander Afanasyev | 984ad19 | 2014-05-02 19:11:15 -0700 | [diff] [blame] | 296 | * @param onInterest A callback to be called when a matching interest is received |
| 297 | * @param onSuccess A callback to be called when prefixRegister command succeeds |
| 298 | * @param onFailure A callback to be called when prefixRegister command fails |
| 299 | * @param identity A signing identity. A command interest is signed under the default |
| 300 | * certificate of this identity |
Alexander Afanasyev | 0866f51 | 2014-08-11 13:25:09 -0700 | [diff] [blame] | 301 | * @param flags (optional) RIB flags (not used when direct FIB management is requested) |
Yingdi Yu | e66bf2a | 2014-04-28 17:07:36 -0700 | [diff] [blame] | 302 | * |
Alexander Afanasyev | 984ad19 | 2014-05-02 19:11:15 -0700 | [diff] [blame] | 303 | * @return Opaque registered prefix ID which can be used with removeRegisteredPrefix |
Yingdi Yu | e66bf2a | 2014-04-28 17:07:36 -0700 | [diff] [blame] | 304 | */ |
| 305 | const RegisteredPrefixId* |
Alexander Afanasyev | 9016496 | 2014-03-06 08:29:59 +0000 | [diff] [blame] | 306 | setInterestFilter(const InterestFilter& interestFilter, |
Yingdi Yu | e66bf2a | 2014-04-28 17:07:36 -0700 | [diff] [blame] | 307 | const OnInterest& onInterest, |
Alexander Afanasyev | 984ad19 | 2014-05-02 19:11:15 -0700 | [diff] [blame] | 308 | const RegisterPrefixSuccessCallback& onSuccess, |
| 309 | const RegisterPrefixFailureCallback& onFailure, |
Alexander Afanasyev | 0866f51 | 2014-08-11 13:25:09 -0700 | [diff] [blame] | 310 | const Name& identity, |
| 311 | uint64_t flags = nfd::ROUTE_FLAG_CHILD_INHERIT); |
Yingdi Yu | e66bf2a | 2014-04-28 17:07:36 -0700 | [diff] [blame] | 312 | |
| 313 | /** |
Alexander Afanasyev | 1b01c31 | 2014-05-26 16:58:10 +0300 | [diff] [blame] | 314 | * @brief Set InterestFilter to dispatch incoming matching interest to onInterest |
| 315 | * callback and register the filtered prefix with the connected NDN forwarder |
| 316 | * |
| 317 | * This version of setInterestFilter combines setInterestFilter and registerPrefix |
| 318 | * operations and is intended to be used when only one filter for the same prefix needed |
| 319 | * to be set. When multiple names sharing the same prefix should be dispatched to |
| 320 | * different callbacks, use one registerPrefix call, followed (in onSuccess callback) by |
| 321 | * a series of setInterestFilter calls. |
| 322 | * |
| 323 | * @param interestFilter Interest filter (prefix part will be registered with the forwarder) |
| 324 | * @param onInterest A callback to be called when a matching interest is received |
| 325 | * @param onFailure A callback to be called when prefixRegister command fails |
| 326 | * @param identity A signing identity. A command interest is signed under the default |
| 327 | * certificate of this identity |
Alexander Afanasyev | 0866f51 | 2014-08-11 13:25:09 -0700 | [diff] [blame] | 328 | * @param flags (optional) RIB flags (not used when direct FIB management is requested) |
Alexander Afanasyev | 1b01c31 | 2014-05-26 16:58:10 +0300 | [diff] [blame] | 329 | * |
| 330 | * @return Opaque registered prefix ID which can be used with removeRegisteredPrefix |
Alexander Afanasyev | 984ad19 | 2014-05-02 19:11:15 -0700 | [diff] [blame] | 331 | */ |
| 332 | const RegisteredPrefixId* |
| 333 | setInterestFilter(const InterestFilter& interestFilter, |
| 334 | const OnInterest& onInterest, |
| 335 | const RegisterPrefixFailureCallback& onFailure, |
Alexander Afanasyev | 0866f51 | 2014-08-11 13:25:09 -0700 | [diff] [blame] | 336 | const Name& identity, |
| 337 | uint64_t flags = nfd::ROUTE_FLAG_CHILD_INHERIT); |
Alexander Afanasyev | 984ad19 | 2014-05-02 19:11:15 -0700 | [diff] [blame] | 338 | |
| 339 | /** |
| 340 | * @brief Set InterestFilter to dispatch incoming matching interest to onInterest callback |
| 341 | * |
| 342 | * @param interestFilter Interest |
| 343 | * @param onInterest A callback to be called when a matching interest is received |
| 344 | * |
| 345 | * This method modifies library's FIB only, and does not register the prefix with the |
| 346 | * forwarder. It will always succeed. To register prefix with the forwarder, use |
| 347 | * registerPrefix, or use the setInterestFilter overload taking two callbacks. |
| 348 | * |
| 349 | * @return Opaque interest filter ID which can be used with unsetInterestFilter |
| 350 | */ |
| 351 | const InterestFilterId* |
| 352 | setInterestFilter(const InterestFilter& interestFilter, |
| 353 | const OnInterest& onInterest); |
| 354 | |
| 355 | |
| 356 | /** |
| 357 | * @brief Register prefix with the connected NDN forwarder |
| 358 | * |
| 359 | * This method only modifies forwarder's RIB (or FIB) and does not associate any |
| 360 | * onInterest callbacks. Use setInterestFilter method to dispatch incoming Interests to |
| 361 | * the right callbacks. |
| 362 | * |
| 363 | * @param prefix A prefix to register with the connected NDN forwarder |
| 364 | * @param onSuccess A callback to be called when prefixRegister command succeeds |
| 365 | * @param onFailure A callback to be called when prefixRegister command fails |
| 366 | * @param certificate (optional) A certificate under which the prefix registration |
| 367 | * command interest is signed. When omitted, a default certificate |
| 368 | * of the default identity is used to sign the registration command |
Alexander Afanasyev | 0866f51 | 2014-08-11 13:25:09 -0700 | [diff] [blame] | 369 | * @param flags (optional) RIB flags (not used when direct FIB management is requested) |
Alexander Afanasyev | 984ad19 | 2014-05-02 19:11:15 -0700 | [diff] [blame] | 370 | * |
| 371 | * @return The registered prefix ID which can be used with unregisterPrefix |
| 372 | */ |
| 373 | const RegisteredPrefixId* |
| 374 | registerPrefix(const Name& prefix, |
| 375 | const RegisterPrefixSuccessCallback& onSuccess, |
| 376 | const RegisterPrefixFailureCallback& onFailure, |
Alexander Afanasyev | 0866f51 | 2014-08-11 13:25:09 -0700 | [diff] [blame] | 377 | const IdentityCertificate& certificate = IdentityCertificate(), |
| 378 | uint64_t flags = nfd::ROUTE_FLAG_CHILD_INHERIT); |
Alexander Afanasyev | 984ad19 | 2014-05-02 19:11:15 -0700 | [diff] [blame] | 379 | |
| 380 | /** |
| 381 | * @brief Register prefix with the connected NDN forwarder and call onInterest when a matching |
| 382 | * interest is received. |
| 383 | * |
| 384 | * This method only modifies forwarder's RIB (or FIB) and does not associate any |
| 385 | * onInterest callbacks. Use setInterestFilter method to dispatch incoming Interests to |
| 386 | * the right callbacks. |
| 387 | * |
| 388 | * @param prefix A prefix to register with the connected NDN forwarder |
| 389 | * @param onSuccess A callback to be called when prefixRegister command succeeds |
| 390 | * @param onFailure A callback to be called when prefixRegister command fails |
| 391 | * @param identity A signing identity. A command interest is signed under the default |
| 392 | * certificate of this identity |
Alexander Afanasyev | 0866f51 | 2014-08-11 13:25:09 -0700 | [diff] [blame] | 393 | * @param flags (optional) RIB flags (not used when direct FIB management is requested) |
Alexander Afanasyev | 984ad19 | 2014-05-02 19:11:15 -0700 | [diff] [blame] | 394 | * |
| 395 | * @return The registered prefix ID which can be used with unregisterPrefix |
| 396 | */ |
| 397 | const RegisteredPrefixId* |
| 398 | registerPrefix(const Name& prefix, |
| 399 | const RegisterPrefixSuccessCallback& onSuccess, |
| 400 | const RegisterPrefixFailureCallback& onFailure, |
Alexander Afanasyev | 0866f51 | 2014-08-11 13:25:09 -0700 | [diff] [blame] | 401 | const Name& identity, |
| 402 | uint64_t flags = nfd::ROUTE_FLAG_CHILD_INHERIT); |
Alexander Afanasyev | 984ad19 | 2014-05-02 19:11:15 -0700 | [diff] [blame] | 403 | |
| 404 | /** |
Alexander Afanasyev | 1b01c31 | 2014-05-26 16:58:10 +0300 | [diff] [blame] | 405 | * @brief Remove the registered prefix entry with the registeredPrefixId |
Alexander Afanasyev | 691c3ce | 2014-04-23 14:28:04 -0700 | [diff] [blame] | 406 | * |
| 407 | * This does not affect another registered prefix with a different registeredPrefixId, |
| 408 | * even it if has the same prefix name. If there is no entry with the |
| 409 | * registeredPrefixId, do nothing. |
| 410 | * |
Alexander Afanasyev | ee8bb1e | 2014-05-02 17:39:54 -0700 | [diff] [blame] | 411 | * unsetInterestFilter will use the same credentials as original |
| 412 | * setInterestFilter/registerPrefix command |
| 413 | * |
Alexander Afanasyev | 984ad19 | 2014-05-02 19:11:15 -0700 | [diff] [blame] | 414 | * @param registeredPrefixId The ID returned from registerPrefix |
Jeff Thompson | 1109514 | 2013-10-01 16:20:28 -0700 | [diff] [blame] | 415 | */ |
| 416 | void |
Alexander Afanasyev | 7682ccb | 2014-02-20 10:29:35 -0800 | [diff] [blame] | 417 | unsetInterestFilter(const RegisteredPrefixId* registeredPrefixId); |
Alexander Afanasyev | a557d5a | 2013-12-28 21:59:03 -0800 | [diff] [blame] | 418 | |
Alexander Afanasyev | ee8bb1e | 2014-05-02 17:39:54 -0700 | [diff] [blame] | 419 | /** |
Alexander Afanasyev | 984ad19 | 2014-05-02 19:11:15 -0700 | [diff] [blame] | 420 | * @brief Remove previously set InterestFilter from library's FIB |
| 421 | * |
| 422 | * This method always succeeds and will **NOT** send any request to the connected |
| 423 | * forwarder. |
| 424 | * |
| 425 | * @param interestFilterId The ID returned from setInterestFilter. |
| 426 | */ |
| 427 | void |
| 428 | unsetInterestFilter(const InterestFilterId* interestFilterId); |
| 429 | |
| 430 | /** |
| 431 | * @brief Deregister prefix from RIB (or FIB) |
| 432 | * |
| 433 | * unregisterPrefix will use the same credentials as original |
| 434 | * setInterestFilter/registerPrefix command |
| 435 | * |
| 436 | * If registeredPrefixId was obtained using setInterestFilter, the corresponding |
| 437 | * InterestFilter will be unset too. |
| 438 | * |
Alexander Afanasyev | 770827c | 2014-05-13 17:42:55 -0700 | [diff] [blame] | 439 | * @param registeredPrefixId The ID returned from registerPrefix |
| 440 | * @param onSuccess Callback to be called when operation succeeds |
| 441 | * @param onFailure Callback to be called when operation fails |
Alexander Afanasyev | 984ad19 | 2014-05-02 19:11:15 -0700 | [diff] [blame] | 442 | */ |
| 443 | void |
| 444 | unregisterPrefix(const RegisteredPrefixId* registeredPrefixId, |
| 445 | const UnregisterPrefixSuccessCallback& onSuccess, |
| 446 | const UnregisterPrefixFailureCallback& onFailure); |
| 447 | |
| 448 | /** |
Alexander Afanasyev | ee8bb1e | 2014-05-02 17:39:54 -0700 | [diff] [blame] | 449 | * @brief (FOR DEBUG PURPOSES ONLY) Request direct NFD FIB management |
| 450 | */ |
Yingdi Yu | e66bf2a | 2014-04-28 17:07:36 -0700 | [diff] [blame] | 451 | void |
Alexander Afanasyev | ee8bb1e | 2014-05-02 17:39:54 -0700 | [diff] [blame] | 452 | setDirectFibManagement(bool isDirectFibManagementRequested = false); |
Yingdi Yu | e66bf2a | 2014-04-28 17:07:36 -0700 | [diff] [blame] | 453 | |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 454 | /** |
Alexander Afanasyev | a557d5a | 2013-12-28 21:59:03 -0800 | [diff] [blame] | 455 | * @brief Publish data packet |
| 456 | * |
Alexander Afanasyev | 691c3ce | 2014-04-23 14:28:04 -0700 | [diff] [blame] | 457 | * This method can be called to satisfy the incoming Interest or to put Data packet into |
Alexander Afanasyev | 6a05b4b | 2014-07-18 17:23:00 -0700 | [diff] [blame] | 458 | * the cache of the local NDN forwarder. |
| 459 | * |
| 460 | * @param data Data packet to publish. It is highly recommended to use Data packet that |
| 461 | * was created using make_shared<Data>(...). Otherwise, put() will make an |
| 462 | * extra copy of the Data packet to ensure validity of published Data until |
| 463 | * asynchronous put() operation finishes. |
Alexander Afanasyev | 49bb1fb | 2014-07-21 12:54:01 -0700 | [diff] [blame] | 464 | * |
| 465 | * @throws Error when Data size exceeds maximum limit (MAX_NDN_PACKET_SIZE) |
Alexander Afanasyev | a557d5a | 2013-12-28 21:59:03 -0800 | [diff] [blame] | 466 | */ |
| 467 | void |
Alexander Afanasyev | 7682ccb | 2014-02-20 10:29:35 -0800 | [diff] [blame] | 468 | put(const Data& data); |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 469 | |
Jeff Thompson | 86507bc | 2013-08-23 20:51:38 -0700 | [diff] [blame] | 470 | /** |
Alexander Afanasyev | 691c3ce | 2014-04-23 14:28:04 -0700 | [diff] [blame] | 471 | * @brief Process any data to receive or call timeout callbacks. |
Alexander Afanasyev | a557d5a | 2013-12-28 21:59:03 -0800 | [diff] [blame] | 472 | * |
| 473 | * This call will block forever (default timeout == 0) to process IO on the face. |
| 474 | * To exit, one expected to call face.shutdown() from one of the callback methods. |
| 475 | * |
Alexander Afanasyev | 691c3ce | 2014-04-23 14:28:04 -0700 | [diff] [blame] | 476 | * If positive timeout is specified, then processEvents will exit after this timeout, if |
| 477 | * not stopped earlier with face.shutdown() or when all active events finish. The call |
| 478 | * can be called repeatedly, if desired. |
Alexander Afanasyev | a557d5a | 2013-12-28 21:59:03 -0800 | [diff] [blame] | 479 | * |
Alexander Afanasyev | 691c3ce | 2014-04-23 14:28:04 -0700 | [diff] [blame] | 480 | * If negative timeout is specified, then processEvents will not block and process only |
| 481 | * pending events. |
Alexander Afanasyev | f75a0aa | 2014-01-09 14:29:22 -0800 | [diff] [blame] | 482 | * |
Alexander Afanasyev | 984ad19 | 2014-05-02 19:11:15 -0700 | [diff] [blame] | 483 | * @param timeout maximum time to block the thread |
Alexander Afanasyev | 691c3ce | 2014-04-23 14:28:04 -0700 | [diff] [blame] | 484 | * @param keepThread Keep thread in a blocked state (in event processing), even when |
| 485 | * there are no outstanding events (e.g., no Interest/Data is expected) |
| 486 | * |
| 487 | * @throw This may throw an exception for reading data or in the callback for processing |
| 488 | * the data. If you call this from an main event loop, you may want to catch and |
| 489 | * log/disregard all exceptions. |
Jeff Thompson | 432c8be | 2013-08-09 16:16:08 -0700 | [diff] [blame] | 490 | */ |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 491 | void |
Alexander Afanasyev | aa0e7da | 2014-03-17 14:37:33 -0700 | [diff] [blame] | 492 | processEvents(const time::milliseconds& timeout = time::milliseconds::zero(), |
| 493 | bool keepThread = false); |
Jeff Thompson | 432c8be | 2013-08-09 16:16:08 -0700 | [diff] [blame] | 494 | |
Alexander Afanasyev | 691c3ce | 2014-04-23 14:28:04 -0700 | [diff] [blame] | 495 | /** |
| 496 | * @brief Shutdown face operations |
| 497 | * |
| 498 | * This method cancels all pending operations and closes connection to NDN Forwarder. |
| 499 | * |
| 500 | * Note that this method does not stop IO service and if the same IO service is shared |
| 501 | * between multiple Faces or with other IO objects (e.g., Scheduler). |
| 502 | */ |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 503 | void |
Jeff Thompson | 0050abe | 2013-09-17 12:50:25 -0700 | [diff] [blame] | 504 | shutdown(); |
Yingdi Yu | 0d92081 | 2014-01-30 14:50:57 -0800 | [diff] [blame] | 505 | |
Alexander Afanasyev | 691c3ce | 2014-04-23 14:28:04 -0700 | [diff] [blame] | 506 | /** |
| 507 | * @brief Get shared_ptr of the IO service object |
| 508 | * |
| 509 | * @deprecated Use getIoService instead |
| 510 | */ |
Alexander Afanasyev | 9c57818 | 2014-05-14 17:28:28 -0700 | [diff] [blame] | 511 | DEPRECATED( |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 512 | shared_ptr<boost::asio::io_service> |
Alexander Afanasyev | 9c57818 | 2014-05-14 17:28:28 -0700 | [diff] [blame] | 513 | ioService()) |
Alexander Afanasyev | 691c3ce | 2014-04-23 14:28:04 -0700 | [diff] [blame] | 514 | { |
| 515 | return m_ioService; |
| 516 | } |
| 517 | |
| 518 | /** |
| 519 | * @brief Get reference to IO service object |
| 520 | */ |
| 521 | boost::asio::io_service& |
| 522 | getIoService() |
| 523 | { |
| 524 | return *m_ioService; |
| 525 | } |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 526 | |
| 527 | private: |
Steve DiBenedetto | c07b3a2 | 2014-03-19 12:32:52 -0600 | [diff] [blame] | 528 | /** |
| 529 | * @throws Face::Error on unsupported protocol |
| 530 | */ |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 531 | void |
Alexander Afanasyev | 7682ccb | 2014-02-20 10:29:35 -0800 | [diff] [blame] | 532 | construct(const shared_ptr<Transport>& transport, |
Alexander Afanasyev | 505646e | 2014-02-24 20:13:37 -0800 | [diff] [blame] | 533 | const shared_ptr<boost::asio::io_service>& ioService); |
Steve DiBenedetto | c07b3a2 | 2014-03-19 12:32:52 -0600 | [diff] [blame] | 534 | |
| 535 | bool |
| 536 | isSupportedNfdProtocol(const std::string& protocol); |
| 537 | |
| 538 | bool |
| 539 | isSupportedNrdProtocol(const std::string& protocol); |
| 540 | |
Alexander Afanasyev | 691c3ce | 2014-04-23 14:28:04 -0700 | [diff] [blame] | 541 | class ProcessEventsTimeout |
| 542 | { |
| 543 | }; |
| 544 | |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 545 | void |
Alexander Afanasyev | 6d48bc1 | 2014-02-18 00:10:51 -0800 | [diff] [blame] | 546 | onReceiveElement(const Block& wire); |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 547 | |
Alexander Afanasyev | 7dced46 | 2014-03-19 15:12:32 -0700 | [diff] [blame] | 548 | void |
| 549 | asyncShutdown(); |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 550 | |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 551 | static void |
| 552 | fireProcessEventsTimeout(const boost::system::error_code& error); |
| 553 | |
Jeff Thompson | b982b6d | 2013-07-15 18:15:45 -0700 | [diff] [blame] | 554 | private: |
Alexander Afanasyev | f39c537 | 2014-02-17 19:42:56 -0800 | [diff] [blame] | 555 | shared_ptr<boost::asio::io_service> m_ioService; |
Alexander Afanasyev | fdbfc6d | 2014-04-14 15:12:11 -0700 | [diff] [blame] | 556 | |
Alexander Afanasyev | f39c537 | 2014-02-17 19:42:56 -0800 | [diff] [blame] | 557 | shared_ptr<Transport> m_transport; |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 558 | |
Alexander Afanasyev | 258ec2b | 2014-05-14 16:15:37 -0700 | [diff] [blame] | 559 | shared_ptr<nfd::Controller> m_nfdController; |
Alexander Afanasyev | ee8bb1e | 2014-05-02 17:39:54 -0700 | [diff] [blame] | 560 | bool m_isDirectNfdFibManagementRequested; |
Steve DiBenedetto | c07b3a2 | 2014-03-19 12:32:52 -0600 | [diff] [blame] | 561 | |
Alexander Afanasyev | 258ec2b | 2014-05-14 16:15:37 -0700 | [diff] [blame] | 562 | class Impl; |
| 563 | shared_ptr<Impl> m_impl; |
Jeff Thompson | aa4e6db | 2013-07-15 17:25:23 -0700 | [diff] [blame] | 564 | }; |
| 565 | |
Steve DiBenedetto | c07b3a2 | 2014-03-19 12:32:52 -0600 | [diff] [blame] | 566 | inline bool |
| 567 | Face::isSupportedNfdProtocol(const std::string& protocol) |
| 568 | { |
| 569 | return protocol == "nfd-0.1"; |
| 570 | } |
| 571 | |
| 572 | inline bool |
| 573 | Face::isSupportedNrdProtocol(const std::string& protocol) |
| 574 | { |
| 575 | return protocol == "nrd-0.1"; |
| 576 | } |
| 577 | |
Alexander Afanasyev | ee8bb1e | 2014-05-02 17:39:54 -0700 | [diff] [blame] | 578 | inline void |
| 579 | Face::setDirectFibManagement(bool isDirectFibManagementRequested/* = false*/) |
Steve DiBenedetto | c07b3a2 | 2014-03-19 12:32:52 -0600 | [diff] [blame] | 580 | { |
Alexander Afanasyev | ee8bb1e | 2014-05-02 17:39:54 -0700 | [diff] [blame] | 581 | m_isDirectNfdFibManagementRequested = isDirectFibManagementRequested; |
Steve DiBenedetto | c07b3a2 | 2014-03-19 12:32:52 -0600 | [diff] [blame] | 582 | } |
| 583 | |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 584 | } // namespace ndn |
Jeff Thompson | aa4e6db | 2013-07-15 17:25:23 -0700 | [diff] [blame] | 585 | |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 586 | #endif // NDN_FACE_HPP |