blob: ac92641d5a88e698350c473a5ed2b324e7ccf703 [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 Afanasyevce810142012-04-17 15:50:36 -070032/**
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070033 * @ingroup ndn
34 * @brief Helper for NdnGlobalRouter interface
Alexander Afanasyevce810142012-04-17 15:50:36 -070035 */
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070036class NdnGlobalRoutingHelper
Alexander Afanasyevad3757f2012-04-17 10:27:59 -070037{
38public:
Alexander Afanasyevce810142012-04-17 15:50:36 -070039 /**
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070040 * @brief Install NdnGlobalRouter interface on a node
Alexander Afanasyevce810142012-04-17 15:50:36 -070041 *
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070042 * Note that NdnGlobalRouter will also be installed on all connected nodes and channels
Alexander Afanasyevce810142012-04-17 15:50:36 -070043 *
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070044 * @param node Node to install NdnGlobalRouter interface
Alexander Afanasyevce810142012-04-17 15:50:36 -070045 */
Alexander Afanasyevad3757f2012-04-17 10:27:59 -070046 void
47 Install (Ptr<Node> node);
Alexander Afanasyevad3757f2012-04-17 10:27:59 -070048
Alexander Afanasyevce810142012-04-17 15:50:36 -070049
50 /**
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070051 * @brief Install NdnGlobalRouter interface on nodes
Alexander Afanasyevce810142012-04-17 15:50:36 -070052 *
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070053 * Note that NdnGlobalRouter will also be installed on all connected nodes and channels
Alexander Afanasyevce810142012-04-17 15:50:36 -070054 *
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070055 * @param nodes NodeContainer to install NdnGlobalRouter interface
Alexander Afanasyevce810142012-04-17 15:50:36 -070056 */
57 void
58 Install (const NodeContainer &nodes);
59
60 /**
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070061 * @brief Install NdnGlobalRouter interface on all nodes
Alexander Afanasyevce810142012-04-17 15:50:36 -070062 */
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 Afanasyevad3757f2012-04-17 10:27:59 -070071 void
72 AddOrigin (const std::string &prefix, Ptr<Node> node);
73
Alexander Afanasyevce810142012-04-17 15:50:36 -070074 /**
Alexander Afanasyev06d3a612012-04-17 22:25:40 -070075 * @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 Afanasyevce810142012-04-17 15:50:36 -070083 * @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 Afanasyevad3757f2012-04-17 10:27:59 -070087 void
88 AddOrigin (const std::string &prefix, const std::string &nodeName);
89
Alexander Afanasyevce810142012-04-17 15:50:36 -070090 /**
91 * @brief Calculate for every node shortest path trees and install routes to all prefix origins
92 */
Alexander Afanasyevad3757f2012-04-17 10:27:59 -070093 void
94 CalculateRoutes ();
Alexander Afanasyevce810142012-04-17 15:50:36 -070095
96private:
97 void
98 Install (Ptr<Channel> channel);
Alexander Afanasyevad3757f2012-04-17 10:27:59 -070099};
100
101}
102
Alexander Afanasyev4aac5572012-08-09 10:49:55 -0700103#endif // NDN_GLOBAL_ROUTING_HELPER_H