Alexander Afanasyev | c74a602 | 2011-08-15 20:01:35 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2011 UCLA |
| 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 | * |
Ilya Moiseenko | 25f7d4d | 2011-09-29 18:41:06 -0700 | [diff] [blame] | 18 | * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu> |
Alexander Afanasyev | 122f378 | 2013-02-02 00:04:40 -0800 | [diff] [blame] | 19 | * Ilya Moiseenko <iliamo@cs.ucla.edu> |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 20 | */ |
| 21 | |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 22 | #ifndef NDN_STACK_HELPER_H |
| 23 | #define NDN_STACK_HELPER_H |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 24 | |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 25 | #include "ns3/packet.h" |
| 26 | #include "ns3/ptr.h" |
| 27 | #include "ns3/object-factory.h" |
Alexander Afanasyev | c39f0b4 | 2011-11-28 12:51:12 -0800 | [diff] [blame] | 28 | #include "ns3/nstime.h" |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 29 | |
| 30 | namespace ns3 { |
| 31 | |
| 32 | class Node; |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 33 | |
| 34 | namespace ndn { |
| 35 | |
| 36 | class FaceContainer; |
| 37 | class Face; |
Alexander Afanasyev | c17e4bd | 2013-02-17 14:31:56 -0800 | [diff] [blame] | 38 | class NetDeviceFace; |
| 39 | class L3Protocol; |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 40 | |
| 41 | /** |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 42 | * \ingroup ndn |
| 43 | * \defgroup ndn-helpers Helpers |
Alexander Afanasyev | 0ab833e | 2011-08-18 15:49:13 -0700 | [diff] [blame] | 44 | */ |
| 45 | /** |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 46 | * \ingroup ndn-helpers |
| 47 | * \brief Adding Ndn functionality to existing Nodes. |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 48 | * |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 49 | * This helper enables pcap and ascii tracing of events in the ndn stack |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 50 | * associated with a node. This is substantially similar to the tracing that |
| 51 | * happens in device helpers, but the important difference is that, well, there |
| 52 | * is no device. This means that the creation of output file names will change, |
| 53 | * and also the user-visible methods will not reference devices and therefore |
| 54 | * the number of trace enable methods is reduced. |
| 55 | * |
| 56 | * Normally we eschew multiple inheritance, however, the classes |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 57 | * PcapUserHelperForNdn and AsciiTraceUserHelperForNdn are treated as |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 58 | * "mixins". A mixin is a self-contained class that encapsulates a general |
| 59 | * attribute or a set of functionality that may be of interest to many other |
| 60 | * classes. |
| 61 | */ |
Alexander Afanasyev | 122f378 | 2013-02-02 00:04:40 -0800 | [diff] [blame] | 62 | class StackHelper |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 63 | { |
| 64 | public: |
| 65 | /** |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 66 | * \brief Create a new NdnStackHelper with a default NDN_FLOODING forwarding stategy |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 67 | */ |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 68 | StackHelper(); |
Alexander Afanasyev | 122f378 | 2013-02-02 00:04:40 -0800 | [diff] [blame] | 69 | |
Ilya Moiseenko | 25f7d4d | 2011-09-29 18:41:06 -0700 | [diff] [blame] | 70 | /** |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 71 | * \brief Destroy the NdnStackHelper |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 72 | */ |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 73 | virtual ~StackHelper (); |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 74 | |
| 75 | /** |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 76 | * @brief Set parameters of NdnL3Protocol |
Alexander Afanasyev | 3a4a0b3 | 2012-06-28 14:14:22 -0700 | [diff] [blame] | 77 | */ |
| 78 | void |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 79 | SetStackAttributes (const std::string &attr1 = "", const std::string &value1 = "", |
| 80 | const std::string &attr2 = "", const std::string &value2 = "", |
| 81 | const std::string &attr3 = "", const std::string &value3 = "", |
| 82 | const std::string &attr4 = "", const std::string &value4 = ""); |
Alexander Afanasyev | 122f378 | 2013-02-02 00:04:40 -0800 | [diff] [blame] | 83 | |
| 84 | |
Alexander Afanasyev | 3a4a0b3 | 2012-06-28 14:14:22 -0700 | [diff] [blame] | 85 | /** |
| 86 | * @brief Set forwarding strategy class and its attributes |
| 87 | * @param forwardingStrategyClass string containing name of the forwarding strategy class |
Alexander Afanasyev | 0ab833e | 2011-08-18 15:49:13 -0700 | [diff] [blame] | 88 | * |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 89 | * Valid options are "ns3::NdnFloodingStrategy" (default) and "ns3::NdnBestRouteStrategy" |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 90 | * |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 91 | * Other strategies can be implemented, inheriting ns3::NdnForwardingStrategy class |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 92 | */ |
Alexander Afanasyev | 0ab833e | 2011-08-18 15:49:13 -0700 | [diff] [blame] | 93 | void |
Alexander Afanasyev | 3a4a0b3 | 2012-06-28 14:14:22 -0700 | [diff] [blame] | 94 | SetForwardingStrategy (const std::string &forwardingStrategyClass, |
| 95 | const std::string &attr1 = "", const std::string &value1 = "", |
| 96 | const std::string &attr2 = "", const std::string &value2 = "", |
| 97 | const std::string &attr3 = "", const std::string &value3 = "", |
| 98 | const std::string &attr4 = "", const std::string &value4 = ""); |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 99 | |
| 100 | /** |
Alexander Afanasyev | 3a4a0b3 | 2012-06-28 14:14:22 -0700 | [diff] [blame] | 101 | * @brief Set content store class and its attributes |
| 102 | * @param contentStoreClass string, representing class of the content store |
Alexander Afanasyev | d9fecdd | 2012-06-08 16:22:24 -0700 | [diff] [blame] | 103 | */ |
| 104 | void |
Alexander Afanasyev | 3a4a0b3 | 2012-06-28 14:14:22 -0700 | [diff] [blame] | 105 | SetContentStore (const std::string &contentStoreClass, |
| 106 | const std::string &attr1 = "", const std::string &value1 = "", |
| 107 | const std::string &attr2 = "", const std::string &value2 = "", |
| 108 | const std::string &attr3 = "", const std::string &value3 = "", |
| 109 | const std::string &attr4 = "", const std::string &value4 = ""); |
| 110 | |
| 111 | /** |
| 112 | * @brief Set PIT class and its attributes |
| 113 | * @param pitClass string, representing class of PIT |
| 114 | */ |
| 115 | void |
| 116 | SetPit (const std::string &pitClass, |
| 117 | const std::string &attr1 = "", const std::string &value1 = "", |
| 118 | const std::string &attr2 = "", const std::string &value2 = "", |
| 119 | const std::string &attr3 = "", const std::string &value3 = "", |
| 120 | const std::string &attr4 = "", const std::string &value4 = ""); |
Alexander Afanasyev | 122f378 | 2013-02-02 00:04:40 -0800 | [diff] [blame] | 121 | |
Alexander Afanasyev | d9fecdd | 2012-06-08 16:22:24 -0700 | [diff] [blame] | 122 | /** |
Alexander Afanasyev | 3a4a0b3 | 2012-06-28 14:14:22 -0700 | [diff] [blame] | 123 | * @brief Set FIB class and its attributes |
| 124 | * @param pitClass string, representing class of FIB |
| 125 | */ |
| 126 | void |
| 127 | SetFib (const std::string &fibClass, |
| 128 | const std::string &attr1 = "", const std::string &value1 = "", |
| 129 | const std::string &attr2 = "", const std::string &value2 = "", |
| 130 | const std::string &attr3 = "", const std::string &value3 = "", |
| 131 | const std::string &attr4 = "", const std::string &value4 = ""); |
| 132 | |
Alexander Afanasyev | c17e4bd | 2013-02-17 14:31:56 -0800 | [diff] [blame] | 133 | typedef Callback< Ptr<NetDeviceFace>, Ptr<Node>, Ptr<L3Protocol>, Ptr<NetDevice> > NetDeviceFaceCreateCallback; |
Alexander Afanasyev | 122f378 | 2013-02-02 00:04:40 -0800 | [diff] [blame] | 134 | |
| 135 | /** |
| 136 | * @brief Add callback to create and configure instance of the face, based on supplied Ptr<Node> and Ptr<NetDevice> |
| 137 | * |
| 138 | * It is possible to set up several callbacks for different NetDevice types. |
| 139 | * |
| 140 | * Currently, there is only one specialized callback for PointToPointNetDevice, which creates face and sets limits (if enabled) |
| 141 | * based on PointToPoint link parameters |
| 142 | * |
| 143 | * If none of the callbacks fit the TypeId of NetDevice, a default callback is used (DefaultNetDeviceCallback) |
| 144 | */ |
| 145 | void |
| 146 | AddNetDeviceFaceCreateCallback (TypeId netDeviceType, NetDeviceFaceCreateCallback callback); |
| 147 | |
Alexander Afanasyev | 3a4a0b3 | 2012-06-28 14:14:22 -0700 | [diff] [blame] | 148 | /** |
Alexander Afanasyev | 2a269f7 | 2013-06-06 22:59:33 -0700 | [diff] [blame] | 149 | * @brief Update callback to create and configure instance of the face, based on supplied Ptr<Node> and Ptr<NetDevice> |
| 150 | * |
| 151 | * It is possible to set up several callbacks for different NetDevice types. |
| 152 | * |
| 153 | * Using this method, it is possible to override Face creation for PointToPointNetDevices |
| 154 | */ |
| 155 | void |
| 156 | UpdateNetDeviceFaceCreateCallback (TypeId netDeviceType, NetDeviceFaceCreateCallback callback); |
| 157 | |
| 158 | /** |
| 159 | * @brief Remove callback to create and configure instance of the face, based on supplied Ptr<Node> and Ptr<NetDevice> |
| 160 | */ |
| 161 | void |
| 162 | RemoveNetDeviceFaceCreateCallback (TypeId netDeviceType, NetDeviceFaceCreateCallback callback); |
| 163 | |
| 164 | /** |
Alexander Afanasyev | 1145314 | 2011-11-25 16:13:33 -0800 | [diff] [blame] | 165 | * @brief Enable Interest limits (disabled by default) |
Alexander Afanasyev | c39f0b4 | 2011-11-28 12:51:12 -0800 | [diff] [blame] | 166 | * |
| 167 | * @param enable Enable or disable limits |
| 168 | * @param avgRtt Average RTT |
Alexander Afanasyev | 772f51b | 2013-08-01 18:53:25 -0700 | [diff] [blame] | 169 | * @param avgData Average size of contentObject packets (including all headers) |
Alexander Afanasyev | c39f0b4 | 2011-11-28 12:51:12 -0800 | [diff] [blame] | 170 | * @param avgInterest Average size of interest packets (including all headers) |
Alexander Afanasyev | 1145314 | 2011-11-25 16:13:33 -0800 | [diff] [blame] | 171 | */ |
| 172 | void |
Alexander Afanasyev | 772f51b | 2013-08-01 18:53:25 -0700 | [diff] [blame] | 173 | EnableLimits (bool enable = true, Time avgRtt=Seconds(0.1), uint32_t avgData=1100, uint32_t avgInterest=40); |
Alexander Afanasyev | 122f378 | 2013-02-02 00:04:40 -0800 | [diff] [blame] | 174 | |
Alexander Afanasyev | 1145314 | 2011-11-25 16:13:33 -0800 | [diff] [blame] | 175 | /** |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 176 | * \brief Install Ndn stack on the node |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 177 | * |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 178 | * This method will assert if called on a node that already has Ndn object |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 179 | * installed on it |
Alexander Afanasyev | 122f378 | 2013-02-02 00:04:40 -0800 | [diff] [blame] | 180 | * |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 181 | * \param nodeName The name of the node on which to install the stack. |
Alexander Afanasyev | 0ab833e | 2011-08-18 15:49:13 -0700 | [diff] [blame] | 182 | * |
| 183 | * \returns list of installed faces in the form of a smart pointer |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 184 | * to NdnFaceContainer object |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 185 | */ |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 186 | Ptr<FaceContainer> |
Alexander Afanasyev | fd25826 | 2012-11-23 14:59:19 -0800 | [diff] [blame] | 187 | Install (const std::string &nodeName) const; |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 188 | |
| 189 | /** |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 190 | * \brief Install Ndn stack on the node |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 191 | * |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 192 | * This method will assert if called on a node that already has Ndn object |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 193 | * installed on it |
Alexander Afanasyev | 122f378 | 2013-02-02 00:04:40 -0800 | [diff] [blame] | 194 | * |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 195 | * \param node The node on which to install the stack. |
Alexander Afanasyev | 0ab833e | 2011-08-18 15:49:13 -0700 | [diff] [blame] | 196 | * |
| 197 | * \returns list of installed faces in the form of a smart pointer |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 198 | * to FaceContainer object |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 199 | */ |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 200 | Ptr<FaceContainer> |
Alexander Afanasyev | 0ab833e | 2011-08-18 15:49:13 -0700 | [diff] [blame] | 201 | Install (Ptr<Node> node) const; |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 202 | |
| 203 | /** |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 204 | * \brief Install Ndn stack on each node in the input container |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 205 | * |
| 206 | * The program will assert if this method is called on a container with a node |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 207 | * that already has an ndn object aggregated to it. |
Alexander Afanasyev | 122f378 | 2013-02-02 00:04:40 -0800 | [diff] [blame] | 208 | * |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 209 | * \param c NodeContainer that holds the set of nodes on which to install the |
| 210 | * new stacks. |
Alexander Afanasyev | 0ab833e | 2011-08-18 15:49:13 -0700 | [diff] [blame] | 211 | * |
| 212 | * \returns list of installed faces in the form of a smart pointer |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 213 | * to FaceContainer object |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 214 | */ |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 215 | Ptr<FaceContainer> |
Alexander Afanasyev | fd25826 | 2012-11-23 14:59:19 -0800 | [diff] [blame] | 216 | Install (const NodeContainer &c) const; |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 217 | |
| 218 | /** |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 219 | * \brief Install Ndn stack on all nodes in the simulation |
Alexander Afanasyev | 0ab833e | 2011-08-18 15:49:13 -0700 | [diff] [blame] | 220 | * |
| 221 | * \returns list of installed faces in the form of a smart pointer |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 222 | * to FaceContainer object |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 223 | */ |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 224 | Ptr<FaceContainer> |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 225 | InstallAll () const; |
| 226 | |
| 227 | /** |
Alexander Afanasyev | fd25826 | 2012-11-23 14:59:19 -0800 | [diff] [blame] | 228 | * \brief Add forwarding entry to FIB |
Alexander Afanasyev | 0ab833e | 2011-08-18 15:49:13 -0700 | [diff] [blame] | 229 | * |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 230 | * \param nodeName Node name |
| 231 | * \param prefix Routing prefix |
| 232 | * \param faceId Face index |
| 233 | * \param metric Routing metric |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 234 | */ |
Alexander Afanasyev | b762684 | 2012-01-12 13:43:33 -0800 | [diff] [blame] | 235 | static void |
Alexander Afanasyev | fd25826 | 2012-11-23 14:59:19 -0800 | [diff] [blame] | 236 | AddRoute (const std::string &nodeName, const std::string &prefix, uint32_t faceId, int32_t metric); |
Alexander Afanasyev | 52e9aa9 | 2011-11-15 20:23:20 -0800 | [diff] [blame] | 237 | |
| 238 | /** |
Alexander Afanasyev | fd25826 | 2012-11-23 14:59:19 -0800 | [diff] [blame] | 239 | * \brief Add forwarding entry to FIB |
Alexander Afanasyev | 52e9aa9 | 2011-11-15 20:23:20 -0800 | [diff] [blame] | 240 | * |
Alexander Afanasyev | 8bedcaf | 2012-07-20 15:30:44 -0700 | [diff] [blame] | 241 | * \param nodeName Node |
| 242 | * \param prefix Routing prefix |
| 243 | * \param faceId Face index |
| 244 | * \param metric Routing metric |
| 245 | */ |
| 246 | static void |
Alexander Afanasyev | fd25826 | 2012-11-23 14:59:19 -0800 | [diff] [blame] | 247 | AddRoute (Ptr<Node> node, const std::string &prefix, uint32_t faceId, int32_t metric); |
Alexander Afanasyev | 8bedcaf | 2012-07-20 15:30:44 -0700 | [diff] [blame] | 248 | |
| 249 | /** |
Alexander Afanasyev | fd25826 | 2012-11-23 14:59:19 -0800 | [diff] [blame] | 250 | * \brief Add forwarding entry to FIB |
Alexander Afanasyev | 8bedcaf | 2012-07-20 15:30:44 -0700 | [diff] [blame] | 251 | * |
Alexander Afanasyev | 52e9aa9 | 2011-11-15 20:23:20 -0800 | [diff] [blame] | 252 | * \param node Node |
| 253 | * \param prefix Routing prefix |
| 254 | * \param face Face |
| 255 | * \param metric Routing metric |
| 256 | */ |
Alexander Afanasyev | b762684 | 2012-01-12 13:43:33 -0800 | [diff] [blame] | 257 | static void |
Alexander Afanasyev | fd25826 | 2012-11-23 14:59:19 -0800 | [diff] [blame] | 258 | AddRoute (Ptr<Node> node, const std::string &prefix, Ptr<Face> face, int32_t metric); |
Alexander Afanasyev | 4a5c2c1 | 2011-12-12 18:50:57 -0800 | [diff] [blame] | 259 | |
| 260 | /** |
Alexander Afanasyev | fd25826 | 2012-11-23 14:59:19 -0800 | [diff] [blame] | 261 | * @brief Add forwarding entry to FIB (work only with point-to-point links) |
| 262 | * |
| 263 | * \param node Node |
| 264 | * \param prefix Routing prefix |
| 265 | * \param otherNode The other node, to which interests (will be used to infer face id |
| 266 | * \param metric Routing metric |
| 267 | */ |
| 268 | static void |
| 269 | AddRoute (Ptr<Node> node, const std::string &prefix, Ptr<Node> otherNode, int32_t metric); |
| 270 | |
| 271 | /** |
| 272 | * @brief Add forwarding entry to FIB (work only with point-to-point links) |
| 273 | * |
| 274 | * \param nodeName Node name (refer to ns3::Names) |
| 275 | * \param prefix Routing prefix |
| 276 | * \param otherNode The other node name, to which interests (will be used to infer face id (refer to ns3::Names) |
| 277 | * \param metric Routing metric |
| 278 | */ |
| 279 | static void |
| 280 | AddRoute (const std::string &nodeName, const std::string &prefix, const std::string &otherNodeName, int32_t metric); |
Alexander Afanasyev | 122f378 | 2013-02-02 00:04:40 -0800 | [diff] [blame] | 281 | |
Alexander Afanasyev | fd25826 | 2012-11-23 14:59:19 -0800 | [diff] [blame] | 282 | /** |
Alexander Afanasyev | 4a5c2c1 | 2011-12-12 18:50:57 -0800 | [diff] [blame] | 283 | * \brief Set flag indicating necessity to install default routes in FIB |
| 284 | */ |
| 285 | void |
| 286 | SetDefaultRoutes (bool needSet); |
Alexander Afanasyev | 52e9aa9 | 2011-11-15 20:23:20 -0800 | [diff] [blame] | 287 | |
Alexander Afanasyev | 1145314 | 2011-11-25 16:13:33 -0800 | [diff] [blame] | 288 | private: |
Alexander Afanasyev | 122f378 | 2013-02-02 00:04:40 -0800 | [diff] [blame] | 289 | Ptr<NetDeviceFace> |
Alexander Afanasyev | c17e4bd | 2013-02-17 14:31:56 -0800 | [diff] [blame] | 290 | DefaultNetDeviceCallback (Ptr<Node> node, Ptr<L3Protocol> ndn, Ptr<NetDevice> netDevice) const; |
Alexander Afanasyev | 122f378 | 2013-02-02 00:04:40 -0800 | [diff] [blame] | 291 | |
| 292 | Ptr<NetDeviceFace> |
Alexander Afanasyev | c17e4bd | 2013-02-17 14:31:56 -0800 | [diff] [blame] | 293 | PointToPointNetDeviceCallback (Ptr<Node> node, Ptr<L3Protocol> ndn, Ptr<NetDevice> netDevice) const; |
Alexander Afanasyev | 122f378 | 2013-02-02 00:04:40 -0800 | [diff] [blame] | 294 | |
| 295 | private: |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 296 | StackHelper (const StackHelper &); |
| 297 | StackHelper &operator = (const StackHelper &o); |
Alexander Afanasyev | 122f378 | 2013-02-02 00:04:40 -0800 | [diff] [blame] | 298 | |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 299 | private: |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 300 | ObjectFactory m_ndnFactory; |
Alexander Afanasyev | 1145314 | 2011-11-25 16:13:33 -0800 | [diff] [blame] | 301 | ObjectFactory m_strategyFactory; |
Alexander Afanasyev | d9fecdd | 2012-06-08 16:22:24 -0700 | [diff] [blame] | 302 | ObjectFactory m_contentStoreFactory; |
Alexander Afanasyev | 3a4a0b3 | 2012-06-28 14:14:22 -0700 | [diff] [blame] | 303 | ObjectFactory m_pitFactory; |
| 304 | ObjectFactory m_fibFactory; |
Alexander Afanasyev | 122f378 | 2013-02-02 00:04:40 -0800 | [diff] [blame] | 305 | |
Alexander Afanasyev | fd25826 | 2012-11-23 14:59:19 -0800 | [diff] [blame] | 306 | bool m_limitsEnabled; |
Alexander Afanasyev | c39f0b4 | 2011-11-28 12:51:12 -0800 | [diff] [blame] | 307 | Time m_avgRtt; |
Alexander Afanasyev | 772f51b | 2013-08-01 18:53:25 -0700 | [diff] [blame] | 308 | uint32_t m_avgDataSize; |
Alexander Afanasyev | c39f0b4 | 2011-11-28 12:51:12 -0800 | [diff] [blame] | 309 | uint32_t m_avgInterestSize; |
Alexander Afanasyev | 122f378 | 2013-02-02 00:04:40 -0800 | [diff] [blame] | 310 | bool m_needSetDefaultRoutes; |
| 311 | |
Alexander Afanasyev | 2a269f7 | 2013-06-06 22:59:33 -0700 | [diff] [blame] | 312 | typedef std::list< std::pair<TypeId, NetDeviceFaceCreateCallback> > NetDeviceCallbackList; |
| 313 | NetDeviceCallbackList m_netDeviceCallbacks; |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 314 | }; |
| 315 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 316 | } // namespace ndn |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 317 | } // namespace ns3 |
| 318 | |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 319 | #endif /* NDN_STACK_HELPER_H */ |