Jeff Thompson | 25b4e61 | 2013-10-10 16:03:24 -0700 | [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 | /** |
Jeff Thompson | 7687dc0 | 2013-09-13 11:54:07 -0700 | [diff] [blame] | 3 | * Copyright (C) 2013 Regents of the University of California. |
Jeff Thompson | aa4e6db | 2013-07-15 17:25:23 -0700 | [diff] [blame] | 4 | * See COPYING for copyright and distribution information. |
| 5 | */ |
| 6 | |
Jeff Thompson | b9e3c8e | 2013-08-02 11:42:51 -0700 | [diff] [blame] | 7 | #ifndef NDN_FACE_HPP |
Jeff Thompson | a0d18c9 | 2013-08-06 13:55:32 -0700 | [diff] [blame] | 8 | #define NDN_FACE_HPP |
Jeff Thompson | aa4e6db | 2013-07-15 17:25:23 -0700 | [diff] [blame] | 9 | |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 10 | #include "common.hpp" |
| 11 | #include "interest.hpp" |
| 12 | #include "data.hpp" |
| 13 | |
Alexander Afanasyev | e2e0d75 | 2014-01-03 13:30:30 -0800 | [diff] [blame] | 14 | #include "transport/transport.hpp" |
| 15 | #include "transport/unix-transport.hpp" |
Alexander Afanasyev | 20d2c58 | 2014-01-26 15:32:51 -0800 | [diff] [blame] | 16 | #include "transport/tcp-transport.hpp" |
Jeff Thompson | beb8b7d | 2013-07-16 15:49:21 -0700 | [diff] [blame] | 17 | |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 18 | #include "management/controller.hpp" |
| 19 | |
Alexander Afanasyev | aa0e7da | 2014-03-17 14:37:33 -0700 | [diff] [blame] | 20 | #include "util/scheduler.hpp" |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 21 | #include "detail/registered-prefix.hpp" |
| 22 | #include "detail/pending-interest.hpp" |
| 23 | |
Jeff Thompson | aa4e6db | 2013-07-15 17:25:23 -0700 | [diff] [blame] | 24 | namespace ndn { |
| 25 | |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 26 | struct PendingInterestId; |
| 27 | struct RegisteredPrefixId; |
| 28 | |
Jeff Thompson | fe08e5a | 2013-08-13 11:15:59 -0700 | [diff] [blame] | 29 | /** |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 30 | * An OnData function object is used to pass a callback to expressInterest. |
| 31 | */ |
| 32 | typedef function<void(const Interest&, Data&)> OnData; |
| 33 | |
| 34 | /** |
| 35 | * An OnTimeout function object is used to pass a callback to expressInterest. |
| 36 | */ |
| 37 | typedef function<void(const Interest&)> OnTimeout; |
| 38 | |
| 39 | /** |
| 40 | * An OnInterest function object is used to pass a callback to registerPrefix. |
| 41 | */ |
| 42 | typedef function<void (const Name&, const Interest&)> OnInterest; |
| 43 | |
| 44 | /** |
| 45 | * An OnRegisterFailed function object is used to report when registerPrefix fails. |
| 46 | */ |
| 47 | typedef function<void(const Name&, const std::string&)> OnSetInterestFilterFailed; |
| 48 | |
| 49 | |
| 50 | |
| 51 | /** |
| 52 | * @brief Abstraction to communicate with local or remote NDN forwarder |
Jeff Thompson | fe08e5a | 2013-08-13 11:15:59 -0700 | [diff] [blame] | 53 | */ |
Alexander Afanasyev | 8460afb | 2014-02-15 20:31:42 -0800 | [diff] [blame] | 54 | class Face : noncopyable |
| 55 | { |
Jeff Thompson | aa4e6db | 2013-07-15 17:25:23 -0700 | [diff] [blame] | 56 | public: |
Alexander Afanasyev | 7682ccb | 2014-02-20 10:29:35 -0800 | [diff] [blame] | 57 | struct Error : public std::runtime_error { Error(const std::string& what) : std::runtime_error(what) {} }; |
Alexander Afanasyev | b790d95 | 2014-01-24 12:07:53 -0800 | [diff] [blame] | 58 | |
| 59 | /** |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 60 | * @brief Create a new Face for communication with an NDN Forwarder using the default UnixTransport. |
Steve DiBenedetto | c07b3a2 | 2014-03-19 12:32:52 -0600 | [diff] [blame] | 61 | * @throws ConfigFile::Error on configuration file parse failure |
| 62 | * @throws Face::Error on unsupported protocol |
Alexander Afanasyev | b790d95 | 2014-01-24 12:07:53 -0800 | [diff] [blame] | 63 | */ |
Alexander Afanasyev | f7ca320 | 2014-02-14 22:28:31 -0800 | [diff] [blame] | 64 | Face(); |
Alexander Afanasyev | e2e0d75 | 2014-01-03 13:30:30 -0800 | [diff] [blame] | 65 | |
| 66 | /** |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 67 | * @brief Create a new Face for communication with an NDN Forwarder using the default UnixTransport. |
Alexander Afanasyev | b790d95 | 2014-01-24 12:07:53 -0800 | [diff] [blame] | 68 | * @param ioService A shared pointer to boost::io_service object that should control all IO operations |
Steve DiBenedetto | c07b3a2 | 2014-03-19 12:32:52 -0600 | [diff] [blame] | 69 | * @throws ConfigFile::Error on configuration file parse failure |
| 70 | * @throws Face::Error on unsupported protocol |
Jeff Thompson | fe08e5a | 2013-08-13 11:15:59 -0700 | [diff] [blame] | 71 | */ |
Alexander Afanasyev | f7ca320 | 2014-02-14 22:28:31 -0800 | [diff] [blame] | 72 | explicit |
Alexander Afanasyev | 7682ccb | 2014-02-20 10:29:35 -0800 | [diff] [blame] | 73 | Face(const shared_ptr<boost::asio::io_service>& ioService); |
| 74 | |
Jeff Thompson | fe08e5a | 2013-08-13 11:15:59 -0700 | [diff] [blame] | 75 | /** |
Jeff Thompson | 86507bc | 2013-08-23 20:51:38 -0700 | [diff] [blame] | 76 | * Create a new Face for communication with an NDN hub at host:port using the default TcpTransport. |
Jeff Thompson | fe08e5a | 2013-08-13 11:15:59 -0700 | [diff] [blame] | 77 | * @param host The host of the NDN hub. |
Alexander Afanasyev | 20d2c58 | 2014-01-26 15:32:51 -0800 | [diff] [blame] | 78 | * @param port The port or service name of the NDN hub. If omitted. use 6363. |
Steve DiBenedetto | c07b3a2 | 2014-03-19 12:32:52 -0600 | [diff] [blame] | 79 | * @throws Face::Error on unsupported protocol |
Jeff Thompson | fe08e5a | 2013-08-13 11:15:59 -0700 | [diff] [blame] | 80 | */ |
Alexander Afanasyev | 7682ccb | 2014-02-20 10:29:35 -0800 | [diff] [blame] | 81 | Face(const std::string& host, const std::string& port = "6363"); |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 82 | |
| 83 | /** |
| 84 | * Create a new Face for communication with an NDN hub with the given Transport object and connectionInfo. |
| 85 | * @param transport A shared_ptr to a Transport object used for communication. |
| 86 | * @param transport A shared_ptr to a Transport::ConnectionInfo to be used to connect to the transport. |
Steve DiBenedetto | c07b3a2 | 2014-03-19 12:32:52 -0600 | [diff] [blame] | 87 | * @throws Face::Error on unsupported protocol |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 88 | */ |
Alexander Afanasyev | f7ca320 | 2014-02-14 22:28:31 -0800 | [diff] [blame] | 89 | explicit |
| 90 | Face(const shared_ptr<Transport>& transport); |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 91 | |
| 92 | /** |
| 93 | * @brief Alternative (special use case) version of the constructor, can be used to aggregate |
| 94 | * several Faces within one processing thread |
| 95 | * |
| 96 | * <code> |
| 97 | * Face face1(...); |
| 98 | * Face face2(..., face1.getAsyncService()); |
| 99 | * |
| 100 | * // Now the following ensures that events on both faces are processed |
| 101 | * face1.processEvents(); |
| 102 | * </code> |
Steve DiBenedetto | c07b3a2 | 2014-03-19 12:32:52 -0600 | [diff] [blame] | 103 | * @throws Face::Error on unsupported protocol |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 104 | */ |
| 105 | Face(const shared_ptr<Transport>& transport, |
Alexander Afanasyev | 7682ccb | 2014-02-20 10:29:35 -0800 | [diff] [blame] | 106 | const shared_ptr<boost::asio::io_service>& ioService); |
| 107 | |
| 108 | /** |
Alexander Afanasyev | 505646e | 2014-02-24 20:13:37 -0800 | [diff] [blame] | 109 | * @brief Set controller used for prefix registration |
Alexander Afanasyev | 7682ccb | 2014-02-20 10:29:35 -0800 | [diff] [blame] | 110 | */ |
Alexander Afanasyev | 505646e | 2014-02-24 20:13:37 -0800 | [diff] [blame] | 111 | void |
| 112 | setController(const shared_ptr<Controller>& controller); |
Alexander Afanasyev | 20d2c58 | 2014-01-26 15:32:51 -0800 | [diff] [blame] | 113 | |
Jeff Thompson | 4fe4551 | 2013-08-23 14:06:38 -0700 | [diff] [blame] | 114 | /** |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 115 | * @brief Express Interest |
| 116 | * |
| 117 | * @param interest A reference to the Interest. This copies the Interest. |
| 118 | * @param onData A function object to call when a matching data packet is received. |
| 119 | * @param onTimeout A function object to call if the interest times out. |
| 120 | * If onTimeout is an empty OnTimeout(), this does not use it. |
| 121 | * |
Jeff Thompson | 1109514 | 2013-10-01 16:20:28 -0700 | [diff] [blame] | 122 | * @return The pending interest ID which can be used with removePendingInterest. |
Jeff Thompson | 4fe4551 | 2013-08-23 14:06:38 -0700 | [diff] [blame] | 123 | */ |
Alexander Afanasyev | b790d95 | 2014-01-24 12:07:53 -0800 | [diff] [blame] | 124 | const PendingInterestId* |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 125 | expressInterest(const Interest& interest, |
| 126 | const OnData& onData, const OnTimeout& onTimeout = OnTimeout()); |
Jeff Thompson | 4fe4551 | 2013-08-23 14:06:38 -0700 | [diff] [blame] | 127 | |
| 128 | /** |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 129 | * @brief Express Interest using name and Interest template |
| 130 | * |
| 131 | * @param name Name of the Interest |
| 132 | * @param tmpl Interest template to fill parameters |
| 133 | * @param onData A callback to call when a matching data packet is received. |
| 134 | * @param onTimeout A callback to call if the interest times out. |
| 135 | * If onTimeout is an empty OnTimeout(), this does not use it. |
| 136 | * |
Jeff Thompson | 1109514 | 2013-10-01 16:20:28 -0700 | [diff] [blame] | 137 | * @return The pending interest ID which can be used with removePendingInterest. |
Jeff Thompson | 7aec025 | 2013-08-22 17:29:57 -0700 | [diff] [blame] | 138 | */ |
Alexander Afanasyev | b790d95 | 2014-01-24 12:07:53 -0800 | [diff] [blame] | 139 | const PendingInterestId* |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 140 | expressInterest(const Name& name, |
Alexander Afanasyev | 7682ccb | 2014-02-20 10:29:35 -0800 | [diff] [blame] | 141 | const Interest& tmpl, |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 142 | const OnData& onData, const OnTimeout& onTimeout = OnTimeout()); |
| 143 | |
Jeff Thompson | 1109514 | 2013-10-01 16:20:28 -0700 | [diff] [blame] | 144 | /** |
| 145 | * Remove the pending interest entry with the pendingInterestId from the pending interest table. |
| 146 | * This does not affect another pending interest with a different pendingInterestId, even it if has the same interest name. |
| 147 | * If there is no entry with the pendingInterestId, do nothing. |
| 148 | * @param pendingInterestId The ID returned from expressInterest. |
| 149 | */ |
| 150 | void |
Alexander Afanasyev | 7682ccb | 2014-02-20 10:29:35 -0800 | [diff] [blame] | 151 | removePendingInterest(const PendingInterestId* pendingInterestId); |
Jeff Thompson | cdf7e25 | 2013-07-31 12:41:47 -0700 | [diff] [blame] | 152 | |
Jeff Thompson | 432c8be | 2013-08-09 16:16:08 -0700 | [diff] [blame] | 153 | /** |
Jeff Thompson | 86507bc | 2013-08-23 20:51:38 -0700 | [diff] [blame] | 154 | * Register prefix with the connected NDN hub and call onInterest when a matching interest is received. |
| 155 | * @param prefix A reference to a Name for the prefix to register. This copies the Name. |
| 156 | * @param onInterest A function object to call when a matching interest is received. This copies the function object, so you may need to |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 157 | * use ref() as appropriate. |
Jeff Thompson | 590ec23 | 2013-09-18 15:55:56 -0700 | [diff] [blame] | 158 | * @param onRegisterFailed A function object to call if failed to retrieve the connected hub’s ID or failed to register the prefix. |
| 159 | * This calls onRegisterFailed(prefix) where prefix is the prefix given to registerPrefix. |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 160 | * @param flags The flags for finer control of which interests are forward to the application. |
Jeff Thompson | 1109514 | 2013-10-01 16:20:28 -0700 | [diff] [blame] | 161 | * @return The registered prefix ID which can be used with removeRegisteredPrefix. |
Jeff Thompson | 86507bc | 2013-08-23 20:51:38 -0700 | [diff] [blame] | 162 | */ |
Alexander Afanasyev | b790d95 | 2014-01-24 12:07:53 -0800 | [diff] [blame] | 163 | const RegisteredPrefixId* |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 164 | setInterestFilter(const Name& prefix, |
| 165 | const OnInterest& onInterest, |
| 166 | const OnSetInterestFilterFailed& onSetInterestFilterFailed); |
Jeff Thompson | 1109514 | 2013-10-01 16:20:28 -0700 | [diff] [blame] | 167 | |
| 168 | /** |
| 169 | * Remove the registered prefix entry with the registeredPrefixId from the pending interest table. |
| 170 | * This does not affect another registered prefix with a different registeredPrefixId, even it if has the same prefix name. |
| 171 | * If there is no entry with the registeredPrefixId, do nothing. |
| 172 | * @param registeredPrefixId The ID returned from registerPrefix. |
| 173 | */ |
| 174 | void |
Alexander Afanasyev | 7682ccb | 2014-02-20 10:29:35 -0800 | [diff] [blame] | 175 | unsetInterestFilter(const RegisteredPrefixId* registeredPrefixId); |
Alexander Afanasyev | a557d5a | 2013-12-28 21:59:03 -0800 | [diff] [blame] | 176 | |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 177 | /** |
Alexander Afanasyev | a557d5a | 2013-12-28 21:59:03 -0800 | [diff] [blame] | 178 | * @brief Publish data packet |
| 179 | * |
| 180 | * This method can be called to satisfy the incoming Interest or to put Data packet into the cache |
| 181 | * of the local NDN forwarder |
| 182 | */ |
| 183 | void |
Alexander Afanasyev | 7682ccb | 2014-02-20 10:29:35 -0800 | [diff] [blame] | 184 | put(const Data& data); |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 185 | |
Jeff Thompson | 86507bc | 2013-08-23 20:51:38 -0700 | [diff] [blame] | 186 | /** |
Jeff Thompson | bf50a1a | 2013-08-20 18:01:01 -0700 | [diff] [blame] | 187 | * Process any data to receive or call timeout callbacks. |
Alexander Afanasyev | a557d5a | 2013-12-28 21:59:03 -0800 | [diff] [blame] | 188 | * |
| 189 | * This call will block forever (default timeout == 0) to process IO on the face. |
| 190 | * To exit, one expected to call face.shutdown() from one of the callback methods. |
| 191 | * |
Alexander Afanasyev | f75a0aa | 2014-01-09 14:29:22 -0800 | [diff] [blame] | 192 | * If positive timeout is specified, then processEvents will exit after this timeout, |
| 193 | * if not stopped earlier with face.shutdown() or when all active events finish. |
Alexander Afanasyev | a557d5a | 2013-12-28 21:59:03 -0800 | [diff] [blame] | 194 | * The call can be called repeatedly, if desired. |
| 195 | * |
Alexander Afanasyev | f75a0aa | 2014-01-09 14:29:22 -0800 | [diff] [blame] | 196 | * If negative timeout is specified, then processEvents will not block and process only pending |
| 197 | * events. |
| 198 | * |
Jeff Thompson | 432c8be | 2013-08-09 16:16:08 -0700 | [diff] [blame] | 199 | * @throw This may throw an exception for reading data or in the callback for processing the data. If you |
| 200 | * call this from an main event loop, you may want to catch and log/disregard all exceptions. |
| 201 | */ |
Jeff Thompson | 0050abe | 2013-09-17 12:50:25 -0700 | [diff] [blame] | 202 | void |
Alexander Afanasyev | aa0e7da | 2014-03-17 14:37:33 -0700 | [diff] [blame] | 203 | processEvents(const time::milliseconds& timeout = time::milliseconds::zero(), |
| 204 | bool keepThread = false); |
Jeff Thompson | 432c8be | 2013-08-09 16:16:08 -0700 | [diff] [blame] | 205 | |
Jeff Thompson | 0050abe | 2013-09-17 12:50:25 -0700 | [diff] [blame] | 206 | void |
| 207 | shutdown(); |
Yingdi Yu | 0d92081 | 2014-01-30 14:50:57 -0800 | [diff] [blame] | 208 | |
| 209 | shared_ptr<boost::asio::io_service> |
Alexander Afanasyev | f39c537 | 2014-02-17 19:42:56 -0800 | [diff] [blame] | 210 | ioService() { return m_ioService; } |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 211 | |
| 212 | private: |
Steve DiBenedetto | c07b3a2 | 2014-03-19 12:32:52 -0600 | [diff] [blame] | 213 | |
| 214 | /** |
| 215 | * @throws Face::Error on unsupported protocol |
| 216 | */ |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 217 | void |
Alexander Afanasyev | 7682ccb | 2014-02-20 10:29:35 -0800 | [diff] [blame] | 218 | construct(const shared_ptr<Transport>& transport, |
Alexander Afanasyev | 505646e | 2014-02-24 20:13:37 -0800 | [diff] [blame] | 219 | const shared_ptr<boost::asio::io_service>& ioService); |
Steve DiBenedetto | c07b3a2 | 2014-03-19 12:32:52 -0600 | [diff] [blame] | 220 | |
| 221 | bool |
| 222 | isSupportedNfdProtocol(const std::string& protocol); |
| 223 | |
| 224 | bool |
| 225 | isSupportedNrdProtocol(const std::string& protocol); |
| 226 | |
| 227 | bool |
| 228 | isSupportedNdndProtocol(const std::string& protocol); |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 229 | |
| 230 | struct ProcessEventsTimeout {}; |
| 231 | typedef std::list<shared_ptr<PendingInterest> > PendingInterestTable; |
| 232 | typedef std::list<shared_ptr<RegisteredPrefix> > RegisteredPrefixTable; |
| 233 | |
| 234 | void |
Alexander Afanasyev | 6d48bc1 | 2014-02-18 00:10:51 -0800 | [diff] [blame] | 235 | asyncExpressInterest(const shared_ptr<const Interest>& interest, |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 236 | const OnData& onData, const OnTimeout& onTimeout); |
| 237 | |
| 238 | void |
Alexander Afanasyev | 6d48bc1 | 2014-02-18 00:10:51 -0800 | [diff] [blame] | 239 | asyncRemovePendingInterest(const PendingInterestId* pendingInterestId); |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 240 | |
| 241 | void |
Alexander Afanasyev | 6d48bc1 | 2014-02-18 00:10:51 -0800 | [diff] [blame] | 242 | asyncUnsetInterestFilter(const RegisteredPrefixId* registeredPrefixId); |
Alexander Afanasyev | 12dfbad | 2014-02-11 14:42:46 -0800 | [diff] [blame] | 243 | |
| 244 | void |
Alexander Afanasyev | 52afb3f | 2014-03-07 09:05:35 +0000 | [diff] [blame] | 245 | finalizeUnsetInterestFilter(RegisteredPrefixTable::iterator item); |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 246 | |
| 247 | void |
Alexander Afanasyev | 6d48bc1 | 2014-02-18 00:10:51 -0800 | [diff] [blame] | 248 | onReceiveElement(const Block& wire); |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 249 | |
Alexander Afanasyev | 7dced46 | 2014-03-19 15:12:32 -0700 | [diff] [blame] | 250 | void |
| 251 | asyncShutdown(); |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 252 | |
| 253 | static void |
| 254 | fireProcessEventsTimeout(const boost::system::error_code& error); |
| 255 | |
Alexander Afanasyev | 42c8185 | 2014-02-25 21:37:26 -0800 | [diff] [blame] | 256 | void |
| 257 | satisfyPendingInterests(Data& data); |
| 258 | |
| 259 | void |
| 260 | processInterestFilters(Interest& interest); |
| 261 | |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 262 | void |
| 263 | checkPitExpire(); |
Yingdi Yu | f9fa52f | 2014-02-06 12:27:32 -0800 | [diff] [blame] | 264 | |
Jeff Thompson | b982b6d | 2013-07-15 18:15:45 -0700 | [diff] [blame] | 265 | private: |
Alexander Afanasyev | f39c537 | 2014-02-17 19:42:56 -0800 | [diff] [blame] | 266 | shared_ptr<boost::asio::io_service> m_ioService; |
| 267 | shared_ptr<boost::asio::io_service::work> m_ioServiceWork; // needed if thread needs to be preserved |
Alexander Afanasyev | aa0e7da | 2014-03-17 14:37:33 -0700 | [diff] [blame] | 268 | shared_ptr<monotonic_deadline_timer> m_pitTimeoutCheckTimer; |
Alexander Afanasyev | f39c537 | 2014-02-17 19:42:56 -0800 | [diff] [blame] | 269 | bool m_pitTimeoutCheckTimerActive; |
Alexander Afanasyev | aa0e7da | 2014-03-17 14:37:33 -0700 | [diff] [blame] | 270 | shared_ptr<monotonic_deadline_timer> m_processEventsTimeoutTimer; |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 271 | |
Alexander Afanasyev | f39c537 | 2014-02-17 19:42:56 -0800 | [diff] [blame] | 272 | shared_ptr<Transport> m_transport; |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 273 | |
Alexander Afanasyev | f39c537 | 2014-02-17 19:42:56 -0800 | [diff] [blame] | 274 | PendingInterestTable m_pendingInterestTable; |
| 275 | RegisteredPrefixTable m_registeredPrefixTable; |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 276 | |
| 277 | shared_ptr<Controller> m_fwController; |
Steve DiBenedetto | c07b3a2 | 2014-03-19 12:32:52 -0600 | [diff] [blame] | 278 | |
| 279 | ConfigFile m_config; |
Jeff Thompson | aa4e6db | 2013-07-15 17:25:23 -0700 | [diff] [blame] | 280 | }; |
| 281 | |
Steve DiBenedetto | c07b3a2 | 2014-03-19 12:32:52 -0600 | [diff] [blame] | 282 | inline bool |
| 283 | Face::isSupportedNfdProtocol(const std::string& protocol) |
| 284 | { |
| 285 | return protocol == "nfd-0.1"; |
| 286 | } |
| 287 | |
| 288 | inline bool |
| 289 | Face::isSupportedNrdProtocol(const std::string& protocol) |
| 290 | { |
| 291 | return protocol == "nrd-0.1"; |
| 292 | } |
| 293 | |
| 294 | inline bool |
| 295 | Face::isSupportedNdndProtocol(const std::string& protocol) |
| 296 | { |
| 297 | return protocol == "ndnd-tlv-0.7"; |
| 298 | } |
| 299 | |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 300 | } // namespace ndn |
Jeff Thompson | aa4e6db | 2013-07-15 17:25:23 -0700 | [diff] [blame] | 301 | |
Alexander Afanasyev | 0222fba | 2014-02-09 23:16:02 -0800 | [diff] [blame] | 302 | #endif // NDN_FACE_HPP |