blob: a609725d0f394f3f88a98f8455062aa470af987e [file] [log] [blame]
Alexander Afanasyeva9034b02014-01-26 18:32:02 -08001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (C) 2014 Named Data Networking Project
4 * See COPYING for copyright and distribution information.
5 */
6
7#include "tcp-face.hpp"
8
Alexander Afanasyev18bbf812014-01-29 01:40:23 -08009namespace nfd {
Alexander Afanasyeva9034b02014-01-26 18:32:02 -080010
Alexander Afanasyev3958b012014-01-31 15:06:13 -080011NFD_LOG_INCLASS_TEMPLATE_SPECIALIZATION_DEFINE(StreamFace, TcpFace::protocol, "TcpFace");
12
Junxiao Shi8c8d2182014-01-30 22:33:00 -070013TcpFace::TcpFace(const shared_ptr<TcpFace::protocol::socket>& socket)
14 : StreamFace<protocol>(socket)
Alexander Afanasyeva9034b02014-01-26 18:32:02 -080015{
16}
17
Alexander Afanasyev8ad71ba2014-01-27 00:07:14 -080018void
19TcpFace::sendInterest(const Interest& interest)
20{
Alexander Afanasyevd32cb962014-01-28 12:43:47 -080021 m_socket->async_send(boost::asio::buffer(interest.wireEncode().wire(),
22 interest.wireEncode().size()),
23 bind(&TcpFace::handleSend, this, _1, interest.wireEncode()));
24
25 // anything else should be done here?
Alexander Afanasyev8ad71ba2014-01-27 00:07:14 -080026}
27
28void
29TcpFace::sendData(const Data& data)
30{
Alexander Afanasyevd32cb962014-01-28 12:43:47 -080031 m_socket->async_send(boost::asio::buffer(data.wireEncode().wire(),
32 data.wireEncode().size()),
33 bind(&TcpFace::handleSend, this, _1, data.wireEncode()));
34
35 // anything else should be done here?
Alexander Afanasyev8ad71ba2014-01-27 00:07:14 -080036}
37
Alexander Afanasyev18bbf812014-01-29 01:40:23 -080038} // namespace nfd