Replace ip::address::to_string() with ip::make_address() to support Boost 1.87, see #197
This commit is contained in:
parent
201cf28196
commit
efcf95522b
@ -79,11 +79,11 @@ std::shared_ptr<Config> 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";
|
||||
}
|
||||
|
@ -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<std::mutex> 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<std::mutex> 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 "
|
||||
|
@ -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";
|
||||
|
@ -206,7 +206,7 @@ std::pair<bool, RtspSource> RtspClient::process(
|
||||
<< crc16(reinterpret_cast<const uint8_t*>(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;
|
||||
|
@ -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 */
|
||||
|
@ -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);
|
||||
|
@ -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_};
|
||||
};
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user