blob: c2108346f1019a26c60790352d4f9ab9dec01a85 [file] [log] [blame]
Alexander Afanasyev0fb80b92013-07-20 08:20:50 -07001/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2013 University of California, Los Angeles
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 * : Saran Tarnoi <saran.tarnoi@gmail.com>
20 */
21
22#ifndef NDN_LINK_CONTROL_HELPER_H
23#define NDN_LINK_CONTROL_HELPER_H
24
Spyridon Mastorakis53e922f2014-10-17 17:29:26 -070025#include "ns3/ndnSIM/model/ndn-common.hpp"
26
Alexander Afanasyev0fb80b92013-07-20 08:20:50 -070027#include "ns3/ptr.h"
28#include "ns3/node.h"
29
30namespace ns3 {
31namespace ndn {
32
33/**
Alexander Afanasyev79206512013-07-27 16:49:12 -070034 * @ingroup ndn-helpers
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080035 * @brief Helper class to control the up or down statuss of an NDN link connecting two specific
36 * nodes
Alexander Afanasyev0fb80b92013-07-20 08:20:50 -070037 */
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080038class LinkControlHelper {
Alexander Afanasyev0fb80b92013-07-20 08:20:50 -070039public:
40 /**
41 * @brief Fail NDN link between two nodes
42 *
43 * The helper will attempt to find NDN link between node1 and
44 * node2 and set NDN face to DOWN state
45 *
46 * Note that only PointToPointChannels are supported by this helper method
47 *
48 * @param node1 one node
49 * @param node2 another node
50 */
51 static void
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080052 FailLink(Ptr<Node> node1, Ptr<Node> node2);
Alexander Afanasyev0fb80b92013-07-20 08:20:50 -070053
54 /**
55 * @brief Fail NDN link between two nodes
56 *
57 * The helper will attempt to find NDN link between node1 and
58 * node2 and set NDN face to DOWN state
59 *
60 * Note that only PointToPointChannels are supported by this helper method
61 *
62 * This variant uses node names registered by Names class
63 *
64 * @param node1 one node's name
65 * @param node2 another node's name
66 */
67 static void
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080068 FailLinkByName(const std::string& node1, const std::string& node2);
Alexander Afanasyev0fb80b92013-07-20 08:20:50 -070069
70 /**
71 * @brief Re-enable NDN link between two nodes
72 *
73 * The helper will attempt to find NDN link between node1 and
74 * node2 and set NDN face to UP state
75 *
76 * Note that only PointToPointChannels are supported by this helper method
77 *
78 * @param node1 one node
79 * @param node2 another node
80 */
81 static void
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080082 UpLink(Ptr<Node> node1, Ptr<Node> node2);
83
Alexander Afanasyev0fb80b92013-07-20 08:20:50 -070084 /**
85 * @brief Re-enable NDN link between two nodes
86 *
87 * The helper will attempt to find NDN link between node1 and
88 * node2 and set NDN face to UP state
89 *
90 * Note that only PointToPointChannels are supported by this helper method
91 *
92 * This variant uses node names registered by Names class
93 *
94 * @param node1 one node's name
95 * @param node2 another node's name
96 */
97 static void
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080098 UpLinkByName(const std::string& node1, const std::string& node2);
Alexander Afanasyev0fb80b92013-07-20 08:20:50 -070099}; // end: LinkControlHelper
100
Alexander Afanasyev0fb80b92013-07-20 08:20:50 -0700101} // ndn
102} // ns3
103
104#endif // NDN_LINK_CONTROL_HELPER_H