/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
 * Copyright (c) 2014  Regents of the University of California,
 *                     Arizona Board of Regents,
 *                     Colorado State University,
 *                     University Pierre & Marie Curie, Sorbonne University,
 *                     Washington University in St. Louis,
 *                     Beijing Institute of Technology
 *
 * This file is part of NFD (Named Data Networking Forwarding Daemon).
 * See AUTHORS.md for complete list of NFD authors and contributors.
 *
 * NFD is free software: you can redistribute it and/or modify it under the terms
 * of the GNU General Public License as published by the Free Software Foundation,
 * either version 3 of the License, or (at your option) any later version.
 *
 * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 * PURPOSE.  See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
 **/

#ifndef NFD_DAEMON_FACE_TCP_FACE_HPP
#define NFD_DAEMON_FACE_TCP_FACE_HPP

#include "stream-face.hpp"

namespace nfd {

/**
 * \brief Implementation of Face abstraction that uses TCP
 *        as underlying transport mechanism
 */
class TcpFace : public StreamFace<boost::asio::ip::tcp>
{
public:
  TcpFace(const FaceUri& remoteUri, const FaceUri& localUri,
          protocol::socket socket, bool isOnDemand);
};


/**
 * \brief Implementation of Face abstraction that uses TCP
 *        as underlying transport mechanism and is used for
 *        local communication (can enable LocalControlHeader)
 */
class TcpLocalFace : public StreamFace<boost::asio::ip::tcp, LocalFace>
{
public:
  TcpLocalFace(const FaceUri& remoteUri, const FaceUri& localUri,
               protocol::socket socket, bool isOnDemand);
};


/** \brief Class validating use of TcpLocalFace
 */
template<>
struct StreamFaceValidator<TcpLocalFace::protocol, LocalFace>
{
  /** Check that local endpoint is loopback
   *
   *  @throws Face::Error if validation failed
   */
  static void
  validateSocket(const TcpLocalFace::protocol::socket& socket)
  {
    if (!socket.local_endpoint().address().is_loopback() ||
        !socket.remote_endpoint().address().is_loopback())
      {
        BOOST_THROW_EXCEPTION(Face::Error("TcpLocalFace can be created only on a loopback "
                                          "address"));
      }
  }
};

} // namespace nfd

#endif // NFD_DAEMON_FACE_TCP_FACE_HPP
