diff --git a/daemon/config.cpp b/daemon/config.cpp index 634fa49..2316248 100644 --- a/daemon/config.cpp +++ b/daemon/config.cpp @@ -79,11 +79,11 @@ std::shared_ptr Config::parse(const std::string& filename, config.streamer_player_buffer_files_num_ = 1; boost::system::error_code ec; - ip::address_v4::from_string(config.rtp_mcast_base_.c_str(), ec); + ip::make_address(config.rtp_mcast_base_.c_str(), ec); if (ec) { config.rtp_mcast_base_ = "239.1.0.1"; } - ip::address_v4::from_string(config.sap_mcast_addr_.c_str(), ec); + ip::make_address(config.sap_mcast_addr_.c_str(), ec); if (ec) { config.sap_mcast_addr_ = "224.2.127.254"; } diff --git a/daemon/igmp.hpp b/daemon/igmp.hpp index 71ad1b0..3cf83a0 100644 --- a/daemon/igmp.hpp +++ b/daemon/igmp.hpp @@ -40,7 +40,7 @@ class IGMP { bool join(const std::string& interface_ip, const std::string& mcast_ip) { uint32_t mcast_ip_addr = - ip::address_v4::from_string(mcast_ip.c_str()).to_ulong(); + ip::make_address(mcast_ip.c_str()).to_v4().to_ulong(); std::scoped_lock lock{mutex}; auto it = mcast_ref.find(mcast_ip_addr); @@ -50,9 +50,8 @@ class IGMP { } error_code ec; - ip::multicast::join_group option( - ip::address::from_string(mcast_ip).to_v4(), - ip::address::from_string(interface_ip).to_v4()); + ip::multicast::join_group option(ip::make_address(mcast_ip).to_v4(), + ip::make_address(interface_ip).to_v4()); socket_.set_option(option, ec); if (ec) { BOOST_LOG_TRIVIAL(error) << "igmp:: failed to joined multicast group " @@ -75,7 +74,7 @@ class IGMP { bool leave(const std::string& interface_ip, const std::string& mcast_ip) { uint32_t mcast_ip_addr = - ip::address_v4::from_string(mcast_ip.c_str()).to_ulong(); + ip::make_address(mcast_ip.c_str()).to_v4().to_ulong(); std::scoped_lock lock{mutex}; auto it = mcast_ref.find(mcast_ip_addr); @@ -88,9 +87,8 @@ class IGMP { } error_code ec; - ip::multicast::leave_group option( - ip::address::from_string(mcast_ip).to_v4(), - ip::address::from_string(interface_ip).to_v4()); + ip::multicast::leave_group option(ip::make_address(mcast_ip).to_v4(), + ip::make_address(interface_ip).to_v4()); socket_.set_option(option, ec); if (ec) { BOOST_LOG_TRIVIAL(error) << "igmp:: failed to leave multicast group " diff --git a/daemon/interface.cpp b/daemon/interface.cpp index 17402f1..8ccca65 100644 --- a/daemon/interface.cpp +++ b/daemon/interface.cpp @@ -171,7 +171,7 @@ bool ping(const std::string& ip) { io_context io_service; icmp::socket socket{io_service, icmp::v4()}; ip::icmp::endpoint destination(ip::icmp::v4(), - ip::address_v4::from_string(ip).to_ulong()); + ip::make_address(ip).to_v4().to_ulong()); socket.send_to(boost::asio::buffer(buffer, sizeof buffer), destination); } catch (...) { BOOST_LOG_TRIVIAL(error) << "ping:: send_to() failed"; diff --git a/daemon/rtsp_client.cpp b/daemon/rtsp_client.cpp index ff085e2..af9df89 100644 --- a/daemon/rtsp_client.cpp +++ b/daemon/rtsp_client.cpp @@ -206,7 +206,7 @@ std::pair RtspClient::process( << crc16(reinterpret_cast(res.body.c_str()), res.body.length()); /*<< std::hex << - * ip::address_v4::from_string(address.c_str()).to_ulong();*/ + * ip::make_address(address.c_str()).to_ulong();*/ rtsp_source.id = ss.str(); rtsp_source.source = "mDNS"; rtsp_source.address = address; diff --git a/daemon/rtsp_server.hpp b/daemon/rtsp_server.hpp index 971b7f4..eec1b3c 100644 --- a/daemon/rtsp_server.hpp +++ b/daemon/rtsp_server.hpp @@ -89,9 +89,9 @@ class RtspServer { : session_manager_(session_manager), config_(config), acceptor_(io_service_, - tcp::endpoint(boost::asio::ip::address::from_string( - config_->get_ip_addr_str()), - config_->get_rtsp_port())) {} + tcp::endpoint( + boost::asio::ip::make_address(config_->get_ip_addr_str()), + config_->get_rtsp_port())) {} bool init() { accept(); /* start rtsp server on a separate thread */ diff --git a/daemon/sap.cpp b/daemon/sap.cpp index cb7e3ae..be45383 100644 --- a/daemon/sap.cpp +++ b/daemon/sap.cpp @@ -27,7 +27,7 @@ using namespace boost::asio::ip; SAP::SAP(const std::string& sap_mcast_addr) : addr_(sap_mcast_addr) -// remote_endpoint_(ip::address::from_string(addr_), port) +// remote_endpoint_(ip::make_address(addr_), port) { socket_.open(boost::asio::ip::udp::v4()); socket_.set_option(udp::socket::reuse_address(true)); @@ -36,7 +36,7 @@ SAP::SAP(const std::string& sap_mcast_addr) } bool SAP::set_multicast_interface(const std::string& interface_ip) { - ip::address_v4 local_interface = ip::address_v4::from_string(interface_ip); + ip::address_v4 local_interface = ip::make_address(interface_ip).to_v4(); ip::multicast::outbound_interface oi_option(local_interface); boost::system::error_code ec; socket_.set_option(oi_option, ec); diff --git a/daemon/sap.hpp b/daemon/sap.hpp index b91f1de..c25bc92 100644 --- a/daemon/sap.hpp +++ b/daemon/sap.hpp @@ -65,9 +65,9 @@ class SAP { io_context io_service_; ip::udp::socket socket_{io_service_}; ip::udp::endpoint remote_endpoint_{ - ip::udp::endpoint(ip::address::from_string(addr_), port)}; + ip::udp::endpoint(ip::make_address(addr_), port)}; ip::udp::endpoint listen_endpoint_{ - ip::udp::endpoint(ip::address::from_string("0.0.0.0"), port)}; + ip::udp::endpoint(ip::make_address("0.0.0.0"), port)}; deadline_timer deadline_{io_service_}; }; diff --git a/daemon/session_manager.cpp b/daemon/session_manager.cpp index c997b2e..e0eecd2 100644 --- a/daemon/session_manager.cpp +++ b/daemon/session_manager.cpp @@ -255,7 +255,7 @@ bool SessionManager::parse_sdp(const std::string& sdp, StreamInfo& info) const { return false; } info.stream.m_ui32DestIP = - ip::address_v4::from_string(fields[2].c_str()).to_ulong(); + ip::make_address(fields[2].c_str()).to_v4().to_ulong(); if (info.stream.m_ui32DestIP == INADDR_NONE) { BOOST_LOG_TRIVIAL(error) << "session_manager:: invalid IPv4 " "connection address in SDP at line " @@ -524,13 +524,14 @@ std::error_code SessionManager::add_source(const StreamSource& source) { info.stream.m_ui32RTCPSrcIP = config_->get_ip_addr(); info.stream.m_ui32SrcIP = config_->get_ip_addr(); // only for Source boost::system::error_code ec; - ip::address_v4::from_string(source.address, ec); + ip::make_address(source.address, ec); if (!ec) { info.stream.m_ui32DestIP = - ip::address_v4::from_string(source.address).to_ulong(); + ip::make_address(source.address).to_v4().to_ulong(); } else { info.stream.m_ui32DestIP = - ip::address_v4::from_string(config_->get_rtp_mcast_base().c_str()) + ip::make_address(config_->get_rtp_mcast_base().c_str()) + .to_v4() .to_ulong() + source.id; }