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