NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
tcp-face.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
25 #ifndef NFD_DAEMON_FACE_TCP_FACE_HPP
26 #define NFD_DAEMON_FACE_TCP_FACE_HPP
27 
28 #include "stream-face.hpp"
29 
30 namespace nfd {
31 
36 class TcpFace : public StreamFace<boost::asio::ip::tcp>
37 {
38 public:
39  TcpFace(const FaceUri& remoteUri, const FaceUri& localUri,
40  protocol::socket socket, bool isOnDemand);
41 };
42 
43 
49 class TcpLocalFace : public StreamFace<boost::asio::ip::tcp, LocalFace>
50 {
51 public:
52  TcpLocalFace(const FaceUri& remoteUri, const FaceUri& localUri,
53  protocol::socket socket, bool isOnDemand);
54 };
55 
56 
59 template<>
61 {
66  static void
67  validateSocket(const TcpLocalFace::protocol::socket& socket)
68  {
69  if (!socket.local_endpoint().address().is_loopback() ||
70  !socket.remote_endpoint().address().is_loopback())
71  {
72  BOOST_THROW_EXCEPTION(Face::Error("TcpLocalFace can be created only on a loopback "
73  "address"));
74  }
75  }
76 };
77 
78 } // namespace nfd
79 
80 #endif // NFD_DAEMON_FACE_TCP_FACE_HPP
Face-related error.
Definition: face.hpp:63
TcpFace(const FaceUri &remoteUri, const FaceUri &localUri, protocol::socket socket, bool isOnDemand)
Definition: tcp-face.cpp:35
represents the underlying protocol and address used by a Face
Definition: face-uri.hpp:44
Class allowing validation of the StreamFace use.
static void validateSocket(const TcpLocalFace::protocol::socket &socket)
Check that local endpoint is loopback.
Definition: tcp-face.hpp:67
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:38
TcpLocalFace
Definition: tcp-face.cpp:31
represents a face
Definition: local-face.hpp:40
Implementation of Face abstraction that uses TCP as underlying transport mechanism and is used for lo...
Definition: tcp-face.hpp:49
Implementation of Face abstraction that uses TCP as underlying transport mechanism.
Definition: tcp-face.hpp:36