2 * Copyright (C) 2016 Simon Fels <morphis@gravedo.de>
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 #include "anbox/network/stream_socket_transport.h"
19 #include "anbox/common/variable_length_array.h"
20 #include "anbox/network/fd_socket_transmission.h"
22 #include <system_error>
25 #include <sys/epoll.h>
26 #include <sys/socket.h>
27 #include <sys/types.h>
30 #include <boost/exception/errinfo_errno.hpp>
31 #include <boost/throw_exception.hpp>
36 StreamSocketTransport::StreamSocketTransport(const std::string& socket_path,
37 const std::shared_ptr<Runtime>& rt)
38 : socket_(std::make_shared<boost::asio::local::stream_protocol::socket>(
41 socket_.connect(boost::asio::local::stream_protocol::endpoint(socket_path));
45 void StreamSocketTransport::register_observer(
46 std::shared_ptr<Observer> const& observer) {
47 this->observer_ = observer;
50 void StreamSocketTransport::unregister_observer(
51 std::shared_ptr<Observer> const& observer) {
52 if (this->observer_ != observer) return;
54 this->observer_.reset();
57 void StreamSocketTransport::send_message(std::vector<uint8_t> const& buffer) {}
59 void StreamSocketTransport::read_next_message() {
60 auto callback = std::bind(&StreamSocketTransport::on_read_size, this,
61 std::placeholders::_1, std::placeholders::_2);
64 void StreamSocketTransport::on_read_size(const boost::system::error_code& ec,
65 std::size_t bytes_read) {}
67 } // namespace network