NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
channel.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2014-2018, Regents of the University of California,
4  * Arizona Board of Regents,
5  * Colorado State University,
6  * University Pierre & Marie Curie, Sorbonne University,
7  * Washington University in St. Louis,
8  * Beijing Institute of Technology,
9  * The University of Memphis.
10  *
11  * This file is part of NFD (Named Data Networking Forwarding Daemon).
12  * See AUTHORS.md for complete list of NFD authors and contributors.
13  *
14  * NFD is free software: you can redistribute it and/or modify it under the terms
15  * of the GNU General Public License as published by the Free Software Foundation,
16  * either version 3 of the License, or (at your option) any later version.
17  *
18  * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
19  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
20  * PURPOSE. See the GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License along with
23  * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
24  */
25 
26 #ifndef NFD_DAEMON_FACE_CHANNEL_HPP
27 #define NFD_DAEMON_FACE_CHANNEL_HPP
28 
29 #include "channel-log.hpp"
30 #include "face.hpp"
31 
32 #include <boost/logic/tribool.hpp>
33 
34 namespace nfd {
35 namespace face {
36 
40 using FaceCreatedCallback = function<void(const shared_ptr<Face>& face)>;
41 
44 using FaceCreationFailedCallback = function<void(uint32_t status, const std::string& reason)>;
45 
52 class Channel : noncopyable
53 {
54 public:
55  virtual
56  ~Channel();
57 
58  const FaceUri&
59  getUri() const
60  {
61  return m_uri;
62  }
63 
66  virtual bool
67  isListening() const = 0;
68 
71  virtual size_t
72  size() const = 0;
73 
74 protected:
75  void
76  setUri(const FaceUri& uri);
77 
78 private:
79  FaceUri m_uri;
80 };
81 
88 {
89 public:
90  // get rid of this constructor and use aggregate init + NSDMIs when we switch to C++14
91  FaceParams() noexcept
93  , wantLocalFields(false)
94  , wantLpReliability(false)
95  , wantCongestionMarking(boost::logic::indeterminate)
96  {
97  }
98 
99 public:
105  boost::logic::tribool wantCongestionMarking;
106 };
107 
115 void
116 connectFaceClosedSignal(Face& face, const std::function<void()>& f);
117 
118 } // namespace face
119 } // namespace nfd
120 
121 #endif // NFD_DAEMON_FACE_CHANNEL_HPP
Copyright (c) 2011-2015 Regents of the University of California.
void setUri(const FaceUri &uri)
Definition: channel.cpp:34
represent a channel that communicates on a local endpoint
Definition: channel.hpp:52
generalization of a network interface
Definition: face.hpp:67
function< void(const shared_ptr< Face > &face)> FaceCreatedCallback
Prototype for the callback that is invoked when a face is created (in response to an incoming connect...
Definition: channel.hpp:40
virtual size_t size() const =0
Returns the number of faces in the channel.
function< void(uint32_t status, const std::string &reason)> FaceCreationFailedCallback
Prototype for the callback that is invoked when a face fails to be created.
Definition: channel.hpp:44
void connectFaceClosedSignal(Face &face, const std::function< void()> &f)
invokes a callback when the face is closed
Definition: channel.cpp:40
virtual bool isListening() const =0
Returns whether the channel is listening.
Parameters used to set Transport properties or LinkService options on a newly created face...
Definition: channel.hpp:87
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
const FaceUri & getUri() const
Definition: channel.hpp:59
FaceParams() noexcept
Definition: channel.hpp:91
ndn::nfd::FacePersistency persistency
Definition: channel.hpp:100
ndn::optional< uint64_t > defaultCongestionThreshold
Definition: channel.hpp:102
represents the underlying protocol and address used by a Face
Definition: face-uri.hpp:44
ndn::optional< time::nanoseconds > baseCongestionMarkingInterval
Definition: channel.hpp:101
boost::logic::tribool wantCongestionMarking
Definition: channel.hpp:105