blob: d5d6d9cc2f120b898d866e176f772a35b2ffc356 [file] [log] [blame]
Alexander Afanasyevf4e24522013-06-24 14:11:57 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2/*
3 * Copyright (c) 2013 University of California, Los Angeles
4 * Alexander Afanasyev
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation;
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
20 */
21
22#ifndef NDN_IP_FACES_HELPER_H
23#define NDN_IP_FACES_HELPER_H
24
25#include "ns3/ptr.h"
Alexander Afanasyevaa84fae2013-07-27 12:01:37 -070026#include "ns3/nstime.h"
Alexander Afanasyevf4e24522013-06-24 14:11:57 -070027#include "ns3/ipv4-address.h"
28
29namespace ns3 {
30
31class Node;
32class NodeContainer;
33class Channel;
34
35namespace ndn {
36
37/**
38 * @ingroup ndn
39 * @brief Helper for NDN IP-based face creation
40 */
41class IpFacesHelper
42{
43public:
44 /**
45 * @brief Install IpFaceStack interface on a node
46 * @param node Node to install IpFaceStack interface
47 */
Alexander Afanasyevaa84fae2013-07-27 12:01:37 -070048 static void
Alexander Afanasyevf4e24522013-06-24 14:11:57 -070049 Install (Ptr<Node> node);
50
51 /**
52 * @brief Install IpFaceStack interface on nodes
53 * @param nodes NodeContainer to install IpFaceStack interface
54 */
Alexander Afanasyevaa84fae2013-07-27 12:01:37 -070055 static void
Alexander Afanasyevf4e24522013-06-24 14:11:57 -070056 Install (const NodeContainer &nodes);
57
58 /**
59 * @brief Install IpFaceStack interface on all nodes
60 */
Alexander Afanasyevaa84fae2013-07-27 12:01:37 -070061 static void
Alexander Afanasyevf4e24522013-06-24 14:11:57 -070062 InstallAll ();
63
64 /**
65 * @brief Create TCP face
Alexander Afanasyevaa84fae2013-07-27 12:01:37 -070066 * @param when Time when to create face (use `Seconds (0)' if face should be created right away)
67 * @param node Node to add TCP face (will initiate connection)
68 * @param address IP address to connect (using standard 9695 port)
69 * @param prefix Prefix to associate with the face
70 * @param metric Metric that will be assigned to the face
71 *
72 * This call schedules connection initiation and after successful connection it will add new face
73 * to NDN stack and add the requested route
74 *
75 * If face has been already created before (same IP address), then this call will simply
76 * update FIB with requested prefix
Alexander Afanasyevf4e24522013-06-24 14:11:57 -070077 */
Alexander Afanasyevaa84fae2013-07-27 12:01:37 -070078 static void
79 CreateTcpFace (const Time &when, Ptr<Node> node, Ipv4Address address, const std::string &prefix, int16_t metric = 1);
Alexander Afanasyevf4e24522013-06-24 14:11:57 -070080};
81
82} // namespace ndn
83} // namespace ns3
84
85#endif // NDN_IP_FACES_HELPER_H