blob: 983c7b0a4de1ed712d32373530907da6bc073412 [file] [log] [blame]
Alexander Afanasyevad3757f2012-04-17 10:27:59 -07001/* -*- 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
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070021#ifndef NDN_GLOBAL_ROUTING_HELPER_H
22#define NDN_GLOBAL_ROUTING_HELPER_H
Alexander Afanasyevad3757f2012-04-17 10:27:59 -070023
24#include "ns3/ptr.h"
25
26namespace ns3 {
27
28class Node;
Alexander Afanasyevce810142012-04-17 15:50:36 -070029class NodeContainer;
Alexander Afanasyevad3757f2012-04-17 10:27:59 -070030class Channel;
31
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070032namespace ndn {
33
Alexander Afanasyevce810142012-04-17 15:50:36 -070034/**
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070035 * @ingroup ndn
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070036 * @brief Helper for GlobalRouter interface
Alexander Afanasyevce810142012-04-17 15:50:36 -070037 */
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070038class GlobalRoutingHelper
Alexander Afanasyevad3757f2012-04-17 10:27:59 -070039{
40public:
Alexander Afanasyevce810142012-04-17 15:50:36 -070041 /**
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070042 * @brief Install GlobalRouter interface on a node
Alexander Afanasyevce810142012-04-17 15:50:36 -070043 *
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070044 * Note that GlobalRouter will also be installed on all connected nodes and channels
Alexander Afanasyevce810142012-04-17 15:50:36 -070045 *
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070046 * @param node Node to install GlobalRouter interface
Alexander Afanasyevce810142012-04-17 15:50:36 -070047 */
Alexander Afanasyevad3757f2012-04-17 10:27:59 -070048 void
49 Install (Ptr<Node> node);
Alexander Afanasyevad3757f2012-04-17 10:27:59 -070050
Alexander Afanasyev49165862013-01-31 00:38:20 -080051
Alexander Afanasyevce810142012-04-17 15:50:36 -070052 /**
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070053 * @brief Install GlobalRouter interface on nodes
Alexander Afanasyevce810142012-04-17 15:50:36 -070054 *
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070055 * Note that GlobalRouter will also be installed on all connected nodes and channels
Alexander Afanasyevce810142012-04-17 15:50:36 -070056 *
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070057 * @param nodes NodeContainer to install GlobalRouter interface
Alexander Afanasyevce810142012-04-17 15:50:36 -070058 */
59 void
60 Install (const NodeContainer &nodes);
61
62 /**
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070063 * @brief Install GlobalRouter interface on all nodes
Alexander Afanasyevce810142012-04-17 15:50:36 -070064 */
65 void
66 InstallAll ();
67
68 /**
69 * @brief Add `prefix' as origin on `node'
70 * @param prefix Prefix that is originated by node, e.g., node is a producer for this prefix
71 * @param node Pointer to a node
72 */
Alexander Afanasyevad3757f2012-04-17 10:27:59 -070073 void
74 AddOrigin (const std::string &prefix, Ptr<Node> node);
75
Alexander Afanasyevce810142012-04-17 15:50:36 -070076 /**
Alexander Afanasyev06d3a612012-04-17 22:25:40 -070077 * @brief Add `prefix' as origin on all `nodes'
78 * @param prefix Prefix that is originated by nodes
79 * @param nodes NodeContainer
80 */
81 void
82 AddOrigins (const std::string &prefix, const NodeContainer &nodes);
Alexander Afanasyev49165862013-01-31 00:38:20 -080083
Alexander Afanasyev06d3a612012-04-17 22:25:40 -070084 /**
Alexander Afanasyevce810142012-04-17 15:50:36 -070085 * @brief Add `prefix' as origin on node `nodeName'
86 * @param prefix Prefix that is originated by node, e.g., node is a producer for this prefix
87 * @param nodeName Name of the node that is associated with Ptr<Node> using ns3::Names
88 */
Alexander Afanasyevad3757f2012-04-17 10:27:59 -070089 void
90 AddOrigin (const std::string &prefix, const std::string &nodeName);
91
Alexander Afanasyevce810142012-04-17 15:50:36 -070092 /**
Alexander Afanasyev49165862013-01-31 00:38:20 -080093 * @brief Add origin to each node based on the node's name (using Names class)
94 */
95 void
96 AddOriginsForAll ();
97
98 /**
Alexander Afanasyevce810142012-04-17 15:50:36 -070099 * @brief Calculate for every node shortest path trees and install routes to all prefix origins
100 */
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700101 void
102 CalculateRoutes ();
Alexander Afanasyevce810142012-04-17 15:50:36 -0700103
104private:
105 void
106 Install (Ptr<Channel> channel);
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700107};
108
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700109} // namespace ndn
110} // namespace ns3
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700111
Alexander Afanasyev4aac5572012-08-09 10:49:55 -0700112#endif // NDN_GLOBAL_ROUTING_HELPER_H