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 #include <memory>
14 
15 #include <process/socket.hpp>
16 
17 #include <stout/try.hpp>
18 
19 namespace process {
20 namespace network {
21 namespace internal {
22 
23 class PollSocketImpl : public SocketImpl
24 {
25 public:
27 
29 
30  virtual ~PollSocketImpl() {}
31 
32  // Implementation of the SocketImpl interface.
33  virtual Try<Nothing> listen(int backlog);
35  virtual Future<Nothing> connect(const Address& address);
36  virtual Future<size_t> recv(char* data, size_t size);
37  virtual Future<size_t> send(const char* data, size_t size);
38  virtual Future<size_t> sendfile(int_fd fd, off_t offset, size_t size);
39  virtual Kind kind() const { return SocketImpl::Kind::POLL; }
40 };
41 
42 } // namespace internal {
43 } // namespace network {
44 } // namespace process {
Try< Bytes > size(const std::string &path, const FollowSymlink follow=FollowSymlink::FOLLOW_SYMLINK)
Definition: stat.hpp:121
Definition: check.hpp:33
virtual Kind kind() const
Definition: poll_socket.hpp:39
PollSocketImpl(int_fd s)
Definition: poll_socket.hpp:28
int_fd s
Definition: socket.hpp:230
Kind
Available kinds of implementations.
Definition: socket.hpp:65
Definition: address.hpp:276
virtual Future< std::shared_ptr< SocketImpl > > accept()
Returns an implementation corresponding to the next pending connection for the listening socket...
Try< Address > address() const
Returns the Address with the assigned ip and assigned port.
Implementation interface for a Socket.
Definition: socket.hpp:56
static Try< std::shared_ptr< SocketImpl > > create(int_fd s)
Definition: poll_socket.hpp:23
virtual Try< Nothing > listen(int backlog)
Definition: attributes.hpp:24
virtual Future< size_t > send(const char *data, size_t size)
Definition: executor.hpp:48
virtual Future< size_t > recv(char *data, size_t size)
int int_fd
Definition: int_fd.hpp:35
virtual Future< size_t > sendfile(int_fd fd, off_t offset, size_t size)
virtual Future< Nothing > connect(const Address &address)
virtual ~PollSocketImpl()
Definition: poll_socket.hpp:30
Definition: future.hpp:58