Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| 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 | * |
| 18 | * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu> |
| 19 | */ |
| 20 | |
| 21 | #ifndef CCNX_GLOBAL_ROUTING_HELPER_H |
| 22 | #define CCNX_GLOBAL_ROUTING_HELPER_H |
| 23 | |
| 24 | #include "ns3/ptr.h" |
| 25 | |
| 26 | namespace ns3 { |
| 27 | |
| 28 | class Node; |
Alexander Afanasyev | ce81014 | 2012-04-17 15:50:36 -0700 | [diff] [blame] | 29 | class NodeContainer; |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 30 | class Channel; |
| 31 | |
Alexander Afanasyev | ce81014 | 2012-04-17 15:50:36 -0700 | [diff] [blame] | 32 | /** |
| 33 | * @ingroup ccnx |
| 34 | * @brief Helper for CcnxGlobalRouter interface |
| 35 | */ |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 36 | class CcnxGlobalRoutingHelper |
| 37 | { |
| 38 | public: |
Alexander Afanasyev | ce81014 | 2012-04-17 15:50:36 -0700 | [diff] [blame] | 39 | /** |
| 40 | * @brief Install CcnxGlobalRouter interface on a node |
| 41 | * |
| 42 | * Note that CcnxGlobalRouter will also be installed on all connected nodes and channels |
| 43 | * |
| 44 | * @param node Node to install CcnxGlobalRouter interface |
| 45 | */ |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 46 | void |
| 47 | Install (Ptr<Node> node); |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 48 | |
Alexander Afanasyev | ce81014 | 2012-04-17 15:50:36 -0700 | [diff] [blame] | 49 | |
| 50 | /** |
| 51 | * @brief Install CcnxGlobalRouter interface on nodes |
| 52 | * |
| 53 | * Note that CcnxGlobalRouter will also be installed on all connected nodes and channels |
| 54 | * |
| 55 | * @param nodes NodeContainer to install CcnxGlobalRouter interface |
| 56 | */ |
| 57 | void |
| 58 | Install (const NodeContainer &nodes); |
| 59 | |
| 60 | /** |
| 61 | * @brief Install CcnxGlobalRouter interface on all nodes |
| 62 | */ |
| 63 | void |
| 64 | InstallAll (); |
| 65 | |
| 66 | /** |
| 67 | * @brief Add `prefix' as origin on `node' |
| 68 | * @param prefix Prefix that is originated by node, e.g., node is a producer for this prefix |
| 69 | * @param node Pointer to a node |
| 70 | */ |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 71 | void |
| 72 | AddOrigin (const std::string &prefix, Ptr<Node> node); |
| 73 | |
Alexander Afanasyev | ce81014 | 2012-04-17 15:50:36 -0700 | [diff] [blame] | 74 | /** |
Alexander Afanasyev | 06d3a61 | 2012-04-17 22:25:40 -0700 | [diff] [blame] | 75 | * @brief Add `prefix' as origin on all `nodes' |
| 76 | * @param prefix Prefix that is originated by nodes |
| 77 | * @param nodes NodeContainer |
| 78 | */ |
| 79 | void |
| 80 | AddOrigins (const std::string &prefix, const NodeContainer &nodes); |
| 81 | |
| 82 | /** |
Alexander Afanasyev | ce81014 | 2012-04-17 15:50:36 -0700 | [diff] [blame] | 83 | * @brief Add `prefix' as origin on node `nodeName' |
| 84 | * @param prefix Prefix that is originated by node, e.g., node is a producer for this prefix |
| 85 | * @param nodeName Name of the node that is associated with Ptr<Node> using ns3::Names |
| 86 | */ |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 87 | void |
| 88 | AddOrigin (const std::string &prefix, const std::string &nodeName); |
| 89 | |
Alexander Afanasyev | ce81014 | 2012-04-17 15:50:36 -0700 | [diff] [blame] | 90 | /** |
| 91 | * @brief Calculate for every node shortest path trees and install routes to all prefix origins |
| 92 | */ |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 93 | void |
| 94 | CalculateRoutes (); |
Alexander Afanasyev | ce81014 | 2012-04-17 15:50:36 -0700 | [diff] [blame] | 95 | |
| 96 | private: |
| 97 | void |
| 98 | Install (Ptr<Channel> channel); |
Alexander Afanasyev | ad3757f | 2012-04-17 10:27:59 -0700 | [diff] [blame] | 99 | }; |
| 100 | |
| 101 | } |
| 102 | |
| 103 | #endif // CCNX_GLOBAL_ROUTING_HELPER_H |