Apache Mesos
poll_socket.hpp
Go to the documentation of this file.
1 // Licensed under the Apache License, Version 2.0 (the "License");
2 // you may not use this file except in compliance with the License.
3 // You may obtain a copy of the License at
4 //
5 // http://www.apache.org/licenses/LICENSE-2.0
6 //
7 // Unless required by applicable law or agreed to in writing, software
8 // distributed under the License is distributed on an "AS IS" BASIS,
9 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 // See the License for the specific language governing permissions and
11 // limitations under the License
12 
13 #ifndef __PROCESS_POLL_SOCKET__
14 #define __PROCESS_POLL_SOCKET__
15 #include <memory>
16 
17 #include <process/socket.hpp>
18 
20 
21 #include <stout/try.hpp>
22 
23 namespace process {
24 namespace network {
25 namespace internal {
26 
27 class PollSocketImpl : public SocketImpl
28 {
29 public:
31 
33 
34  ~PollSocketImpl() override {}
35 
36  // Implementation of the SocketImpl interface.
37  Try<Nothing> listen(int backlog) override;
40  const Address& address) override;
41 #ifdef USE_SSL_SOCKET
43  const Address& address,
44  const openssl::TLSClientConfig& config) override;
45 #endif
46  Future<size_t> recv(char* data, size_t size) override;
47  Future<size_t> send(const char* data, size_t size) override;
48  Future<size_t> sendfile(int_fd fd, off_t offset, size_t size) override;
49  Kind kind() const override { return SocketImpl::Kind::POLL; }
50 };
51 
52 } // namespace internal {
53 } // namespace network {
54 } // namespace process {
55 
56 #endif // __PROCESS_POLL_SOCKET__
Future< std::shared_ptr< SocketImpl > > accept() override
Returns an implementation corresponding to the next pending connection for the listening socket...
Try< Bytes > size(const std::string &path, const FollowSymlink follow=FollowSymlink::FOLLOW_SYMLINK)
Definition: stat.hpp:130
Definition: check.hpp:33
PollSocketImpl(int_fd s)
Definition: poll_socket.hpp:32
int_fd s
Definition: socket.hpp:246
Kind
Available kinds of implementations.
Definition: socket.hpp:67
Definition: address.hpp:324
Future< size_t > recv(char *data, size_t size) override
Try< Address > address() const
Returns the Address with the assigned ip and assigned port.
Future< size_t > send(const char *data, size_t size) override
Implementation interface for a Socket.
Definition: socket.hpp:58
static Try< std::shared_ptr< SocketImpl > > create(int_fd s)
Future< size_t > sendfile(int_fd fd, off_t offset, size_t size) override
Definition: poll_socket.hpp:27
Kind kind() const override
Definition: poll_socket.hpp:49
Try< Nothing > listen(int backlog) override
Definition: attributes.hpp:24
Definition: executor.hpp:48
Future< Nothing > connect(const Address &address) override
int int_fd
Definition: int_fd.hpp:35
~PollSocketImpl() override
Definition: poll_socket.hpp:34
Definition: future.hpp:58