CppWAMP
C++11 client library for the WAMP protocol
uds.hpp
Go to the documentation of this file.
1 /*------------------------------------------------------------------------------
2  Copyright Butterfly Energy Systems 2014-2015, 2022.
3  Distributed under the Boost Software License, Version 1.0.
4  http://www.boost.org/LICENSE_1_0.txt
5 ------------------------------------------------------------------------------*/
6 
7 #ifndef CPPWAMP_UDS_HPP
8 #define CPPWAMP_UDS_HPP
9 
10 //------------------------------------------------------------------------------
14 //------------------------------------------------------------------------------
15 
16 #include <cassert>
17 #include <memory>
18 #include <string>
19 #include <utility>
20 #include "api.hpp"
21 #include "asiodefs.hpp"
22 #include "connector.hpp"
23 #include "traits.hpp"
24 #include "udspath.hpp"
25 
26 #ifndef CPPWAMP_COMPILED_LIB
27 #include "internal/asioconnector.hpp"
28 #include "internal/rawsockconnector.hpp"
29 #include "internal/udsopener.hpp"
30 #endif
31 
32 namespace wamp
33 {
34 
35 //------------------------------------------------------------------------------
45 //------------------------------------------------------------------------------
46 template <typename TCodec>
47 CPPWAMP_API Connector::Ptr connector(
48  AnyIoExecutor exec,
49  UdsPath path
50 );
51 
52 #ifndef CPPWAMP_COMPILED_LIB
53 template <typename TCodec>
54 CPPWAMP_API Connector::Ptr connector(AnyIoExecutor exec, UdsPath path)
55 {
56  using Endpoint = internal::AsioConnector<internal::UdsOpener>;
57  using ConcreteConnector = internal::RawsockConnector<TCodec, Endpoint>;
58  return ConcreteConnector::create(exec, std::move(path));
59 }
60 #endif
61 
62 
63 //------------------------------------------------------------------------------
74 //------------------------------------------------------------------------------
75 template <typename TCodec, typename TExecutionContext>
76 CPPWAMP_ENABLED_TYPE(Connector::Ptr, isExecutionContext<TExecutionContext>())
77 connector(
78  TExecutionContext& context,
80  UdsPath path
81 )
82 {
83  return connector<TCodec>(context.get_executor(), std::move(path));
84 }
85 
86 } // namespace wamp
87 
88 #endif // CPPWAMP_UDS_HPP
wamp::UdsPath
Contains a Unix domain socket path, as well as other socket options.
Definition: udspath.hpp:95
wamp::AnyIoExecutor
boost::asio::any_io_executor AnyIoExecutor
Polymorphic executor for all I/O objects.
Definition: asiodefs.hpp:27
udspath.hpp
Contains facilities for specifying Unix domain socket transport parameters and options.
connector.hpp
Contains the declaration of the Connector abstract base class.
api.hpp
Defines macros related to exporting/importing APIs.
wamp::Connector::Ptr
std::shared_ptr< Connector > Ptr
Shared pointer to a Connector.
Definition: connector.hpp:43
asiodefs.hpp
Common type definitions used by transports that rely on Boost.Asio.
wamp
Definition: anyhandler.hpp:36
traits.hpp
Contains general-purpose type traits.