Alexander Afanasyev | a9034b0 | 2014-01-26 18:32:02 -0800 | [diff] [blame] | 1 | /* -*- 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 Afanasyev | 18bbf81 | 2014-01-29 01:40:23 -0800 | [diff] [blame] | 9 | namespace nfd { |
Alexander Afanasyev | a9034b0 | 2014-01-26 18:32:02 -0800 | [diff] [blame] | 10 | |
Alexander Afanasyev | 3958b01 | 2014-01-31 15:06:13 -0800 | [diff] [blame] | 11 | NFD_LOG_INCLASS_TEMPLATE_SPECIALIZATION_DEFINE(StreamFace, TcpFace::protocol, "TcpFace"); |
| 12 | |
Junxiao Shi | 8c8d218 | 2014-01-30 22:33:00 -0700 | [diff] [blame] | 13 | TcpFace::TcpFace(const shared_ptr<TcpFace::protocol::socket>& socket) |
| 14 | : StreamFace<protocol>(socket) |
Alexander Afanasyev | a9034b0 | 2014-01-26 18:32:02 -0800 | [diff] [blame] | 15 | { |
| 16 | } |
| 17 | |
Alexander Afanasyev | 8ad71ba | 2014-01-27 00:07:14 -0800 | [diff] [blame] | 18 | void |
| 19 | TcpFace::sendInterest(const Interest& interest) |
| 20 | { |
Alexander Afanasyev | d32cb96 | 2014-01-28 12:43:47 -0800 | [diff] [blame] | 21 | 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 Afanasyev | 8ad71ba | 2014-01-27 00:07:14 -0800 | [diff] [blame] | 26 | } |
| 27 | |
| 28 | void |
| 29 | TcpFace::sendData(const Data& data) |
| 30 | { |
Alexander Afanasyev | d32cb96 | 2014-01-28 12:43:47 -0800 | [diff] [blame] | 31 | 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 Afanasyev | 8ad71ba | 2014-01-27 00:07:14 -0800 | [diff] [blame] | 36 | } |
| 37 | |
Alexander Afanasyev | 18bbf81 | 2014-01-29 01:40:23 -0800 | [diff] [blame] | 38 | } // namespace nfd |