cpp-msgpack-rpc
0.2.0
An RPC library implementing MessagePack RPC.
Toggle main menu visibility
Loading...
Searching...
No Matches
unix_socket_address.h
Go to the documentation of this file.
1
/*
2
* Copyright 2024 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 "
msgpack_rpc/config.h
"
23
24
#if MSGPACK_RPC_HAS_UNIX_SOCKETS
25
26
#include <ostream>
27
#include <string>
28
29
#include <asio/local/stream_protocol.hpp>
30
#include <fmt/base.h>
31
32
#include "
msgpack_rpc/addresses/i_address.h
"
33
#include "
msgpack_rpc/addresses/uri.h
"
34
#include "msgpack_rpc/impl/msgpack_rpc_export.h"
35
36
namespace
msgpack_rpc::addresses
{
37
41
using
AsioUnixSocketAddress = asio::local::stream_protocol::endpoint;
42
46
class
MSGPACK_RPC_EXPORT UnixSocketAddress final :
public
IAddress
{
47
public
:
56
explicit
UnixSocketAddress(AsioUnixSocketAddress address);
57
63
[[nodiscard]] std::string file_path()
const
;
64
66
[[nodiscard]] URI to_uri()
const override
;
67
69
[[nodiscard]] std::string to_string()
const override
;
70
76
[[nodiscard]]
const
AsioUnixSocketAddress& asio_address()
const
;
77
85
[[nodiscard]]
bool
operator==
(
const
UnixSocketAddress& right)
const
;
86
94
[[nodiscard]]
bool
operator!=
(
const
UnixSocketAddress& right)
const
;
95
96
private
:
98
AsioUnixSocketAddress address_;
99
};
100
101
}
// namespace msgpack_rpc::addresses
102
103
namespace
fmt
{
104
109
template
<>
110
class
formatter<msgpack_rpc::addresses::UnixSocketAddress> {
111
public
:
118
constexpr
format_parse_context::iterator parse(
// NOLINT
119
format_parse_context& context) {
120
return
context.end();
121
}
122
130
MSGPACK_RPC_EXPORT format_context::iterator format(
// NOLINT
131
const
msgpack_rpc::addresses::UnixSocketAddress& val,
132
format_context& context)
const
;
133
};
134
135
}
// namespace fmt
136
144
MSGPACK_RPC_EXPORT std::ostream&
operator<<
(std::ostream& stream,
145
const
msgpack_rpc::addresses::UnixSocketAddress& address);
146
147
#endif
msgpack_rpc::addresses::IAddress
Interface of addresses.
Definition
i_address.h:31
config.h
Definitions of platform-specific macros.
i_address.h
Definition of IAddress.
fmt
Namespace of fmt library.
Definition
uri.h:113
msgpack_rpc::addresses
Namespace of addresses.
Definition
i_address.h:26
msgpack_rpc::messages::operator!=
bool operator!=(const MethodName &left, const MethodName &right) noexcept
Compare two method names.
Definition
method_name.h:127
msgpack_rpc::messages::operator==
bool operator==(const MethodName &left, const MethodName &right) noexcept
Compare two method names.
Definition
method_name.h:114
uri.h
Definition of URI class.
operator<<
std::ostream & operator<<(std::ostream &stream, const msgpack_rpc::addresses::URI &uri)
Format a URI.
Definition
uri.cpp:110
src
msgpack_rpc
addresses
unix_socket_address.h
Generated on
for cpp-msgpack-rpc by
1.18.0