blob: eb3ac94e3972e36d8bb2fd5a69a2f6aff6991013 [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
9namespace ndn {
10
Alexander Afanasyevd32cb962014-01-28 12:43:47 -080011TcpFace::TcpFace(FaceId id,
12 const shared_ptr<TcpFace::protocol::socket>& socket)
13 : StreamFace<protocol>(id, socket)
Alexander Afanasyeva9034b02014-01-26 18:32:02 -080014{
15}
16
Alexander Afanasyev8ad71ba2014-01-27 00:07:14 -080017void
18TcpFace::sendInterest(const Interest& interest)
19{
Alexander Afanasyevd32cb962014-01-28 12:43:47 -080020 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 Afanasyev8ad71ba2014-01-27 00:07:14 -080025}
26
27void
28TcpFace::sendData(const Data& data)
29{
Alexander Afanasyevd32cb962014-01-28 12:43:47 -080030 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 Afanasyev8ad71ba2014-01-27 00:07:14 -080035}
36
Alexander Afanasyeva9034b02014-01-26 18:32:02 -080037} // namespace ndn