feat(common): add Boost Asio aliases
Introduce aliases for Asio IP, TCP, UDP, and timer types to enhance code readability and structure.
This commit is contained in:
@@ -1,25 +1,30 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <boost/asio.hpp>
|
#include <boost/asio.hpp>
|
||||||
|
#include <boost/asio/ip/address.hpp>
|
||||||
#include <boost/program_options.hpp>
|
#include <boost/program_options.hpp>
|
||||||
#include <boost/system/error_code.hpp>
|
#include <boost/system/error_code.hpp>
|
||||||
|
|
||||||
// --- Error handling ---
|
// --- Error handling ---
|
||||||
using ErrorCode = boost::system::error_code;
|
using ErrorCode = boost::system::error_code;
|
||||||
|
|
||||||
// --- IO Context ---
|
// --- Asio types ---
|
||||||
using IoContext = boost::asio::io_context;
|
using IoContext = boost::asio::io_context;
|
||||||
|
using SteadyTimer = boost::asio::steady_timer;
|
||||||
|
|
||||||
// --- TCP ---
|
// --- Ip types ---
|
||||||
|
using IpAddress = boost::asio::ip::address;
|
||||||
|
|
||||||
|
// --- TCP types ---
|
||||||
using TcpSocket = boost::asio::ip::tcp::socket;
|
using TcpSocket = boost::asio::ip::tcp::socket;
|
||||||
using TcpAcceptor = boost::asio::ip::tcp::acceptor;
|
using TcpAcceptor = boost::asio::ip::tcp::acceptor;
|
||||||
using TcpEndpoint = boost::asio::ip::tcp::endpoint;
|
using TcpEndpoint = boost::asio::ip::tcp::endpoint;
|
||||||
|
|
||||||
// --- UDP (для DNS) ---
|
// --- UDP types ---
|
||||||
using UdpSocket = boost::asio::ip::udp::socket;
|
using UdpSocket = boost::asio::ip::udp::socket;
|
||||||
using UdpEndpoint = boost::asio::ip::udp::endpoint;
|
using UdpEndpoint = boost::asio::ip::udp::endpoint;
|
||||||
|
|
||||||
// --- Таймеры ---
|
// --- Timers ---
|
||||||
using SteadyTimer = boost::asio::steady_timer;
|
using SteadyTimer = boost::asio::steady_timer;
|
||||||
|
|
||||||
// --- Program options ---
|
// --- Program options ---
|
||||||
|
|||||||
Reference in New Issue
Block a user