diff -Naur kea-2.6.1.orig/src/lib/asiolink/io_address.cc kea-2.6.1/src/lib/asiolink/io_address.cc
old
|
new
|
|
37 | 37 | // because we'd like to throw our own exception on failure. |
38 | 38 | IOAddress::IOAddress(const std::string& address_str) { |
39 | 39 | boost::system::error_code err; |
40 | | asio_address_ = ip::address::from_string(address_str, err); |
| 40 | asio_address_ = ip::make_address(address_str, err); |
41 | 41 | if (err) { |
42 | 42 | isc_throw(IOError, "Failed to convert string to address '" |
43 | 43 | << address_str << "': " << err.message()); |
… |
… |
|
116 | 116 | uint32_t |
117 | 117 | IOAddress::toUint32() const { |
118 | 118 | if (asio_address_.is_v4()) { |
| 119 | #if BOOST_VERSION < 108000 |
119 | 120 | return (asio_address_.to_v4().to_ulong()); |
| 121 | #else |
| 122 | return (asio_address_.to_v4().to_uint()); |
| 123 | #endif |
| 124 | |
120 | 125 | } else { |
121 | 126 | isc_throw(BadValue, "Can't convert " << toText() |
122 | 127 | << " address to IPv4."); |
diff -Naur kea-2.6.1.orig/src/lib/asiolink/io_service.cc kea-2.6.1/src/lib/asiolink/io_service.cc
old
|
new
|
|
29 | 29 | public: |
30 | 30 | /// @brief The constructor. |
31 | 31 | IOServiceImpl() : |
32 | | io_service_(), |
33 | | work_(new boost::asio::io_service::work(io_service_)) { |
| 32 | io_context_() { |
34 | 33 | }; |
35 | 34 | |
36 | 35 | /// @brief The destructor. |
… |
… |
|
42 | 41 | /// This method does not return control to the caller until |
43 | 42 | /// the @ref stop() or @ref stopWork() method is called via some handler. |
44 | 43 | void run() { |
45 | | io_service_.run(); |
| 44 | io_context_.run(); |
46 | 45 | }; |
47 | 46 | |
48 | 47 | /// @brief Run the underlying event loop for a single event. |
… |
… |
|
53 | 52 | /// |
54 | 53 | /// @return The number of handlers that were executed. |
55 | 54 | size_t runOne() { |
56 | | return (static_cast<size_t>(io_service_.run_one())); |
| 55 | return (static_cast<size_t>(io_context_.run_one())); |
57 | 56 | }; |
58 | 57 | |
59 | 58 | /// @brief Run the underlying event loop for a ready events. |
… |
… |
|
63 | 62 | /// |
64 | 63 | /// @return The number of handlers that were executed. |
65 | 64 | size_t poll() { |
66 | | return (static_cast<size_t>(io_service_.poll())); |
| 65 | return (static_cast<size_t>(io_context_.poll())); |
67 | 66 | }; |
68 | 67 | |
69 | 68 | /// @brief Run the underlying event loop for a ready events. |
… |
… |
|
73 | 72 | /// |
74 | 73 | /// @return The number of handlers that were executed. |
75 | 74 | size_t pollOne() { |
76 | | return (static_cast<size_t>(io_service_.poll_one())); |
| 75 | return (static_cast<size_t>(io_context_.poll_one())); |
77 | 76 | }; |
78 | 77 | |
79 | 78 | /// @brief Stop the underlying event loop. |
80 | 79 | /// |
81 | 80 | /// This will return the control to the caller of the @ref run() method. |
82 | 81 | void stop() { |
83 | | io_service_.stop(); |
| 82 | io_context_.stop(); |
84 | 83 | } |
85 | 84 | |
86 | 85 | /// @brief Indicates if the IOService has been stopped. |
87 | 86 | /// |
88 | 87 | /// @return true if the IOService has been stopped, false otherwise. |
89 | 88 | bool stopped() const { |
90 | | return (io_service_.stopped()); |
| 89 | return (io_context_.stopped()); |
91 | 90 | } |
92 | 91 | |
93 | 92 | /// @brief Restarts the IOService in preparation for a subsequent @ref run() invocation. |
94 | 93 | void restart() { |
95 | | io_service_.reset(); |
| 94 | io_context_.restart(); |
96 | 95 | } |
97 | 96 | |
98 | 97 | /// @brief Removes IO service work object to let it finish running |
99 | 98 | /// when all handlers have been invoked. |
100 | 99 | void stopWork() { |
101 | | work_.reset(); |
| 100 | io_context_.stop(); |
102 | 101 | } |
103 | 102 | |
104 | 103 | /// @brief Return the native @c io_service object used in this wrapper. |
… |
… |
|
107 | 106 | /// that share the same @c io_service with the authoritative server. |
108 | 107 | /// It will eventually be removed once the wrapper interface is |
109 | 108 | /// generalized. |
110 | | boost::asio::io_service& getInternalIOService() { |
111 | | return (io_service_); |
| 109 | boost::asio::io_context& getInternalIOService() { |
| 110 | return (io_context_); |
112 | 111 | } |
113 | 112 | |
114 | 113 | /// @brief Post a callback on the IO service. |
115 | 114 | /// |
116 | 115 | /// @param callback The callback to be run on the IO service. |
117 | 116 | void post(const std::function<void ()>& callback) { |
118 | | io_service_.post(callback); |
| 117 | boost::asio::post(io_context_, callback); |
119 | 118 | } |
120 | 119 | |
121 | 120 | private: |
122 | | boost::asio::io_service io_service_; |
123 | | boost::shared_ptr<boost::asio::io_service::work> work_; |
| 121 | boost::asio::io_context io_context_; |
124 | 122 | }; |
125 | 123 | |
diff -Naur kea-2.6.1.orig/src/lib/asiolink/io_service.h kea-2.6.1/src/lib/asiolink/io_service.h
old
|
new
|
|
107 | 107 | /// generalized. |
108 | 108 | /// |
109 | 109 | /// @return The internal io_service object. |
110 | | boost::asio::io_service& getInternalIOService(); |
| 110 | boost::asio::io_context& getInternalIOService(); |
111 | 111 | |
112 | 112 | /// @brief Post a callback to the end of the queue. |
113 | 113 | /// |
diff -Naur kea-2.6.1.orig/src/lib/asiolink/tcp_endpoint.h kea-2.6.1/src/lib/asiolink/tcp_endpoint.h
old
|
new
|
|
42 | 42 | /// \param port The TCP port number of the endpoint. |
43 | 43 | TCPEndpoint(const IOAddress& address, const unsigned short port) : |
44 | 44 | asio_endpoint_placeholder_( |
| 45 | #if BOOST_VERSION < 108000 |
45 | 46 | new boost::asio::ip::tcp::endpoint(boost::asio::ip::address::from_string(address.toText()), |
| 47 | #else |
| 48 | new boost::asio::ip::tcp::endpoint(boost::asio::ip::make_address(address.toText()), |
| 49 | #endif |
| 50 | |
46 | 51 | port)), |
47 | 52 | asio_endpoint_(*asio_endpoint_placeholder_) |
48 | 53 | {} |
diff -Naur kea-2.6.1.orig/src/lib/asiolink/udp_endpoint.h kea-2.6.1/src/lib/asiolink/udp_endpoint.h
old
|
new
|
|
42 | 42 | /// \param port The UDP port number of the endpoint. |
43 | 43 | UDPEndpoint(const IOAddress& address, const unsigned short port) : |
44 | 44 | asio_endpoint_placeholder_( |
| 45 | #if BOOST_VERSION < 108000 |
45 | 46 | new boost::asio::ip::udp::endpoint(boost::asio::ip::address::from_string(address.toText()), |
| 47 | #else |
| 48 | new boost::asio::ip::udp::endpoint(boost::asio::ip::make_address(address.toText()), |
| 49 | #endif |
46 | 50 | port)), |
47 | 51 | asio_endpoint_(*asio_endpoint_placeholder_) |
48 | 52 | {} |
diff -Naur kea-2.6.1.orig/src/lib/asiolink/unix_domain_socket.cc kea-2.6.1/src/lib/asiolink/unix_domain_socket.cc
old
|
new
|
|
83 | 83 | /// @param buffer Buffers holding the data to be sent. |
84 | 84 | /// @param handler User supplied callback to be invoked when data have |
85 | 85 | /// been sent or sending error is signalled. |
| 86 | #if BOOST_VERSION < 108000 |
86 | 87 | void doSend(const boost::asio::const_buffers_1& buffer, |
87 | 88 | const UnixDomainSocket::Handler& handler); |
88 | | |
| 89 | #else |
| 90 | void doSend(const boost::asio::const_buffer& buffer, |
| 91 | const UnixDomainSocket::Handler& handler); |
| 92 | #endif |
89 | 93 | |
90 | 94 | /// @brief Local handler invoked as a result of asynchronous send. |
91 | 95 | /// |
… |
… |
|
102 | 106 | /// @param buffer Buffers holding the data to be sent. |
103 | 107 | /// @param ec Error code returned as a result of sending the data. |
104 | 108 | /// @param length Length of the data sent. |
| 109 | #if BOOST_VERSION < 108000 |
105 | 110 | void sendHandler(const UnixDomainSocket::Handler& remote_handler, |
106 | 111 | const boost::asio::const_buffers_1& buffer, |
107 | 112 | const boost::system::error_code& ec, |
108 | 113 | size_t length); |
| 114 | #else |
| 115 | void sendHandler(const UnixDomainSocket::Handler& remote_handler, |
| 116 | const boost::asio::const_buffer& buffer, |
| 117 | const boost::system::error_code& ec, |
| 118 | size_t length); |
| 119 | #endif |
109 | 120 | |
110 | 121 | /// @brief Asynchronously receive data over the socket. |
111 | 122 | /// |
… |
… |
|
127 | 138 | /// @param buffer A buffer into which the data should be received. |
128 | 139 | /// @param handler User supplied callback invoked when data have been |
129 | 140 | /// received on an error is signalled. |
| 141 | #if BOOST_VERSION < 108000 |
130 | 142 | void doReceive(const boost::asio::mutable_buffers_1& buffer, |
131 | 143 | const UnixDomainSocket::Handler& handler); |
132 | | |
| 144 | #else |
| 145 | void doReceive(const boost::asio::mutable_buffer& buffer, |
| 146 | const UnixDomainSocket::Handler& handler); |
| 147 | #endif |
133 | 148 | /// @brief Local handler invoked as a result of asynchronous receive. |
134 | 149 | /// |
135 | 150 | /// This handler is invoked as a result of asynchronous receive. It is a |
… |
… |
|
145 | 160 | /// @param buffer Buffer into which the data are received. |
146 | 161 | /// @param ec Error code returned as a result of asynchronous receive. |
147 | 162 | /// @param length Size of the received data. |
| 163 | #if BOOST_VERSION < 108000 |
148 | 164 | void receiveHandler(const UnixDomainSocket::Handler& remote_handler, |
149 | 165 | const boost::asio::mutable_buffers_1& buffer, |
150 | 166 | const boost::system::error_code& ec, |
151 | 167 | size_t length); |
152 | | |
| 168 | #else |
| 169 | void receiveHandler(const UnixDomainSocket::Handler& remote_handler, |
| 170 | const boost::asio::mutable_buffer& buffer, |
| 171 | const boost::system::error_code& ec, |
| 172 | size_t length); |
| 173 | #endif |
153 | 174 | /// @brief Disables read and write operations on the socket. |
154 | 175 | void shutdown(); |
155 | 176 | |
… |
… |
|
196 | 217 | doSend(boost::asio::buffer(data, length), handler); |
197 | 218 | } |
198 | 219 | |
| 220 | #if BOOST_VERSION < 108000 |
199 | 221 | void |
200 | 222 | UnixDomainSocketImpl::doSend(const boost::asio::const_buffers_1& buffer, |
201 | 223 | const UnixDomainSocket::Handler& handler) { |
| 224 | #else |
| 225 | void |
| 226 | UnixDomainSocketImpl::doSend(const boost::asio::const_buffer& buffer, |
| 227 | const UnixDomainSocket::Handler& handler) { |
| 228 | #endif |
202 | 229 | auto local_handler = std::bind(&UnixDomainSocketImpl::sendHandler, |
203 | 230 | shared_from_this(), |
204 | 231 | handler, buffer, ph::_1, ph::_2); |
205 | 232 | socket_.async_send(buffer, local_handler); |
206 | 233 | } |
207 | 234 | |
| 235 | #if BOOST_VERSION < 108000 |
208 | 236 | void |
209 | 237 | UnixDomainSocketImpl::sendHandler(const UnixDomainSocket::Handler& remote_handler, |
210 | 238 | const boost::asio::const_buffers_1& buffer, |
211 | 239 | const boost::system::error_code& ec, |
212 | 240 | size_t length) { |
| 241 | #else |
| 242 | void |
| 243 | UnixDomainSocketImpl::sendHandler(const UnixDomainSocket::Handler& remote_handler, |
| 244 | const boost::asio::const_buffer& buffer, |
| 245 | const boost::system::error_code& ec, |
| 246 | size_t length) { |
| 247 | #endif |
213 | 248 | // The asynchronous send may return EWOULDBLOCK or EAGAIN on some |
214 | 249 | // operating systems. In this case, we simply retry hoping that it |
215 | 250 | // will succeed next time. The user's callback never sees these |
… |
… |
|
229 | 264 | doReceive(boost::asio::buffer(data, length), handler); |
230 | 265 | } |
231 | 266 | |
| 267 | #if BOOST_VERSION < 108000 |
232 | 268 | void |
233 | 269 | UnixDomainSocketImpl::doReceive(const boost::asio::mutable_buffers_1& buffer, |
234 | 270 | const UnixDomainSocket::Handler& handler) { |
| 271 | #else |
| 272 | void |
| 273 | UnixDomainSocketImpl::doReceive(const boost::asio::mutable_buffer& buffer, |
| 274 | const UnixDomainSocket::Handler& handler) { |
| 275 | #endif |
235 | 276 | auto local_handler = std::bind(&UnixDomainSocketImpl::receiveHandler, |
236 | 277 | shared_from_this(), |
237 | 278 | handler, buffer, ph::_1, ph::_2); |
238 | 279 | socket_.async_receive(buffer, 0, local_handler); |
239 | 280 | } |
240 | 281 | |
| 282 | #if BOOST_VERSION < 108000 |
241 | 283 | void |
242 | 284 | UnixDomainSocketImpl::receiveHandler(const UnixDomainSocket::Handler& remote_handler, |
243 | 285 | const boost::asio::mutable_buffers_1& buffer, |
244 | 286 | const boost::system::error_code& ec, |
245 | 287 | size_t length) { |
| 288 | #else |
| 289 | void |
| 290 | UnixDomainSocketImpl::receiveHandler(const UnixDomainSocket::Handler& remote_handler, |
| 291 | const boost::asio::mutable_buffer& buffer, |
| 292 | const boost::system::error_code& ec, |
| 293 | size_t length) { |
| 294 | #endif |
| 295 | |
246 | 296 | // The asynchronous receive may return EWOULDBLOCK or EAGAIN on some |
247 | 297 | // operating systems. In this case, we simply retry hoping that it |
248 | 298 | // will succeed next time. The user's callback never sees these |
diff -Naur kea-2.6.1.orig/src/lib/dhcp/iface_mgr.cc kea-2.6.1/src/lib/dhcp/iface_mgr.cc
old
|
new
|
|
1034 | 1034 | } |
1035 | 1035 | |
1036 | 1036 | // Create socket that will be used to connect to remote endpoint. |
| 1037 | #if BOOST_VERSION < 108000 |
1037 | 1038 | boost::asio::io_service io_service; |
| 1039 | #else |
| 1040 | boost::asio::io_context io_service; |
| 1041 | #endif |
1038 | 1042 | boost::asio::ip::udp::socket sock(io_service); |
1039 | 1043 | |
| 1044 | |
1040 | 1045 | boost::system::error_code err_code; |
1041 | 1046 | // If remote address is broadcast address we have to |
1042 | 1047 | // allow this on the socket. |