cpp-msgpack-rpc
0.2.0
An RPC library implementing MessagePack RPC.
Toggle main menu visibility
Loading...
Searching...
No Matches
i_acceptor.h
Go to the documentation of this file.
1
/*
2
* Copyright 2023 MusicScience37 (Kenta Kabashima)
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
20
#pragma once
21
22
#include <functional>
23
#include <memory>
24
25
#include "
msgpack_rpc/addresses/i_address.h
"
26
#include "
msgpack_rpc/transport/i_connection.h
"
27
28
namespace
msgpack_rpc::transport
{
29
33
class
IAcceptor {
34
public
:
42
using
ConnectionCallback
=
43
std::function<void(std::shared_ptr<IConnection>)>;
44
51
virtual
void
start
(
ConnectionCallback
on_connection) = 0;
52
56
virtual
void
stop
() = 0;
57
63
[[nodiscard]]
virtual
const
addresses::IAddress
&
local_address
()
64
const noexcept = 0;
65
66
IAcceptor(const IAcceptor&) = delete;
67
IAcceptor(IAcceptor&&) = delete;
68
IAcceptor& operator=(const IAcceptor&) = delete;
69
IAcceptor& operator=(IAcceptor&&) = delete;
70
72
virtual ~IAcceptor() noexcept = default;
73
74
protected:
76
IAcceptor() noexcept = default;
77
};
78
79
}
// namespace msgpack_rpc::transport
msgpack_rpc::addresses::IAddress
Interface of addresses.
Definition
i_address.h:31
msgpack_rpc::transport::IAcceptor::ConnectionCallback
std::function< void(std::shared_ptr< IConnection >)> ConnectionCallback
Type of callback functions called when a connection is accepted.
Definition
i_acceptor.h:42
msgpack_rpc::transport::IAcceptor::start
virtual void start(ConnectionCallback on_connection)=0
Start process of this acceptor.
msgpack_rpc::transport::IAcceptor::local_address
virtual const addresses::IAddress & local_address() const noexcept=0
Get the address of the local endpoint.
msgpack_rpc::transport::IAcceptor::stop
virtual void stop()=0
Stop this acceptor.
i_address.h
Definition of IAddress.
i_connection.h
Definition of IConnection class.
msgpack_rpc::transport
Namespace of transport of messages.
Definition
backends.h:31
include
msgpack_rpc
transport
i_acceptor.h
Generated on
for cpp-msgpack-rpc by
1.18.0