/* -*- 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 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:
  TcpLocalFace(const shared_ptr<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())
      {
        throw Face::Error("TcpLocalFace can be created only on a loopback address");
      }
  }
};

} // namespace nfd

#endif // NFD_DAEMON_FACE_TCP_FACE_HPP
