NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: 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; -*- */
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 namespace nfd {
33 namespace face {
34 
35 class Face;
36 
40 typedef function<void(const shared_ptr<Face>& newFace)> FaceCreatedCallback;
41 
44 typedef function<void(uint32_t status, const std::string& reason)> FaceCreationFailedCallback;
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 
89 void
90 connectFaceClosedSignal(Face& face, const std::function<void()>& f);
91 
92 } // namespace face
93 } // namespace nfd
94 
95 #endif // NFD_DAEMON_FACE_CHANNEL_HPP
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
virtual size_t size() const =0
Returns the number of faces in the channel.
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.
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
const FaceUri & getUri() const
Definition: channel.hpp:59
represents the underlying protocol and address used by a Face
Definition: face-uri.hpp:43
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
function< void(const shared_ptr< Face > &newFace)> FaceCreatedCallback
Prototype for the callback that is invoked when a face is created (in response to an incoming connect...
Definition: channel.hpp:35