Remote Call Framework 3.4
Asio.hpp
1 
2 //******************************************************************************
3 // RCF - Remote Call Framework
4 //
5 // Copyright (c) 2005 - 2023, Delta V Software. All rights reserved.
6 // https://www.deltavsoft.com
7 //
8 // RCF is distributed under dual licenses - closed source or GPL.
9 // Consult your particular license for conditions of use.
10 //
11 // If you have not purchased a commercial license, you are using RCF under GPL terms.
12 //
13 // Version: 3.4
14 // Contact: support <at> deltavsoft.com
15 //
16 //******************************************************************************
17 
18 #ifndef INCLUDE_RCF_ASIO_HPP
19 #define INCLUDE_RCF_ASIO_HPP
20 
21 #include <algorithm> // std::min, std::max
22 
23 // VS 2013 Update 3 - a number of WinSock functions have been deprecated.
24 #ifdef _MSC_VER
25 #pragma warning(push)
26 #pragma warning(disable: 4996) // error C4996: 'WSAAddressToStringA': Use WSAAddressToStringW() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
27 #endif
28 
29 #include <RCF/Config.hpp>
30 #include <RCF/AsioFwd.hpp>
31 
32 #if defined(RCF_WINDOWS) || defined(__CYGWIN__)
33 # if defined(_WINSOCKAPI_) && !defined(_WINSOCK2API_)
34 # error WinSock.h has already been included. Define WIN32_LEAN_AND_MEAN in your build, to avoid implicit inclusion of WinSock.h.
35 # endif // defined(_WINSOCKAPI_) && !defined(_WINSOCK2API_)
36 #endif
37 
38 #ifdef RCF_USE_BOOST_ASIO
39 #include <boost/asio.hpp>
40 #else
41 #include <RCF/external/asio/asio.hpp>
42 #endif
43 
44 // Do we have local sockets?
45 #ifdef RCF_USE_BOOST_ASIO
46 #ifdef BOOST_ASIO_HAS_LOCAL_SOCKETS
47 #define RCF_HAS_LOCAL_SOCKETS
48 #endif
49 #else
50 #ifdef ASIO_HAS_LOCAL_SOCKETS
51 #define RCF_HAS_LOCAL_SOCKETS
52 #endif
53 #endif
54 
55 #include <RCF/AsioDeadlineTimer.hpp>
56 
57 namespace RCF {
58 
59 
60  typedef ASIO_NS::ip::tcp::socket AsioSocket;
61  typedef std::shared_ptr<AsioSocket> AsioSocketPtr;
62 
63  typedef ASIO_NS::const_buffer AsioConstBuffer;
64 
65  typedef AsioSocket TcpSocket;
66  typedef std::shared_ptr<TcpSocket> TcpSocketPtr;
67 
68 #ifdef RCF_HAS_LOCAL_SOCKETS
69 
70  using ASIO_NS::local::stream_protocol;
71  typedef stream_protocol::socket UnixLocalSocket;
72  typedef std::shared_ptr<UnixLocalSocket> UnixLocalSocketPtr;
73 
74 #else
75 
76  typedef TcpSocket UnixLocalSocket;
77  typedef TcpSocketPtr UnixLocalSocketPtr;
78 
79 #endif
80 
81 } // namespace RCF
82 
83 #ifdef _MSC_VER
84 #pragma warning(pop)
85 #endif
86 
87 #endif // ! INCLUDE_RCF_ASIO_HPP
Definition: AmiIoHandler.hpp:23