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 | |
Junxiao Shi | 8c8d218 | 2014-01-30 22:33:00 -0700 | [diff] [blame^] | 11 | TcpFace::TcpFace(const shared_ptr<TcpFace::protocol::socket>& socket) |
| 12 | : StreamFace<protocol>(socket) |
Alexander Afanasyev | a9034b0 | 2014-01-26 18:32:02 -0800 | [diff] [blame] | 13 | { |
| 14 | } |
| 15 | |
Alexander Afanasyev | 8ad71ba | 2014-01-27 00:07:14 -0800 | [diff] [blame] | 16 | void |
| 17 | TcpFace::sendInterest(const Interest& interest) |
| 18 | { |
Alexander Afanasyev | d32cb96 | 2014-01-28 12:43:47 -0800 | [diff] [blame] | 19 | m_socket->async_send(boost::asio::buffer(interest.wireEncode().wire(), |
| 20 | interest.wireEncode().size()), |
| 21 | bind(&TcpFace::handleSend, this, _1, interest.wireEncode())); |
| 22 | |
| 23 | // anything else should be done here? |
Alexander Afanasyev | 8ad71ba | 2014-01-27 00:07:14 -0800 | [diff] [blame] | 24 | } |
| 25 | |
| 26 | void |
| 27 | TcpFace::sendData(const Data& data) |
| 28 | { |
Alexander Afanasyev | d32cb96 | 2014-01-28 12:43:47 -0800 | [diff] [blame] | 29 | m_socket->async_send(boost::asio::buffer(data.wireEncode().wire(), |
| 30 | data.wireEncode().size()), |
| 31 | bind(&TcpFace::handleSend, this, _1, data.wireEncode())); |
| 32 | |
| 33 | // anything else should be done here? |
Alexander Afanasyev | 8ad71ba | 2014-01-27 00:07:14 -0800 | [diff] [blame] | 34 | } |
| 35 | |
Alexander Afanasyev | 18bbf81 | 2014-01-29 01:40:23 -0800 | [diff] [blame] | 36 | } // namespace nfd |