2 * This file is open source software, licensed to you under the terms
3 * of the Apache License, Version 2.0 (the "License"). See the NOTICE file
4 * distributed with this work for additional information regarding copyright
5 * ownership. You may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing,
12 * software distributed under the License is distributed on an
13 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 * KIND, either express or implied. See the License for the
15 * specific language governing permissions and limitations
19 * Copyright 2015 Cloudius Systems
24 #include <seastar/net/api.hh>
25 #include <seastar/core/memory.hh>
26 #include "../core/internal/api-level.hh"
33 class connected_socket_impl {
35 virtual ~connected_socket_impl() {}
36 virtual data_source source() = 0;
37 virtual data_source source(connected_socket_input_stream_config csisc);
38 virtual data_sink sink() = 0;
39 virtual void shutdown_input() = 0;
40 virtual void shutdown_output() = 0;
41 virtual void set_nodelay(bool nodelay) = 0;
42 virtual bool get_nodelay() const = 0;
43 virtual void set_keepalive(bool keepalive) = 0;
44 virtual bool get_keepalive() const = 0;
45 virtual void set_keepalive_parameters(const keepalive_params&) = 0;
46 virtual keepalive_params get_keepalive_parameters() const = 0;
47 virtual void set_sockopt(int level, int optname, const void* data, size_t len) = 0;
48 virtual int get_sockopt(int level, int optname, void* data, size_t len) const = 0;
53 virtual ~socket_impl() {}
54 virtual future<connected_socket> connect(socket_address sa, socket_address local, transport proto = transport::TCP) = 0;
55 virtual void set_reuseaddr(bool reuseaddr) = 0;
56 virtual bool get_reuseaddr() const = 0;
57 virtual void shutdown() = 0;
61 class server_socket_impl {
63 virtual ~server_socket_impl() {}
64 virtual future<accept_result> accept() = 0;
65 virtual void abort_accept() = 0;
66 virtual socket_address local_address() const = 0;
69 class udp_channel_impl {
71 virtual ~udp_channel_impl() {}
72 virtual socket_address local_address() const = 0;
73 virtual future<udp_datagram> receive() = 0;
74 virtual future<> send(const socket_address& dst, const char* msg) = 0;
75 virtual future<> send(const socket_address& dst, packet p) = 0;
76 virtual void shutdown_input() = 0;
77 virtual void shutdown_output() = 0;
78 virtual bool is_closed() const = 0;
79 virtual void close() = 0;
82 class network_interface_impl {
84 virtual ~network_interface_impl() {}
85 virtual uint32_t index() const = 0;
86 virtual uint32_t mtu() const = 0;
88 virtual const sstring& name() const = 0;
89 virtual const sstring& display_name() const = 0;
90 virtual const std::vector<net::inet_address>& addresses() const = 0;
91 virtual const std::vector<uint8_t> hardware_address() const = 0;
93 virtual bool is_loopback() const = 0;
94 virtual bool is_virtual() const = 0;
95 virtual bool is_up() const = 0;
96 virtual bool supports_ipv6() const = 0;