/* -*- 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_FACE_TCP_FACE_HPP
#define NFD_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:
  explicit
  TcpFace(const shared_ptr<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:
  explicit
  TcpLocalFace(const shared_ptr<protocol::socket>& socket, bool isOnDemand);
};


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

} // namespace nfd

#endif // NFD_FACE_TCP_FACE_HPP
