X-Git-Url: https://git.sesse.net/?p=cubemap;a=blobdiff_plain;f=config.cpp;h=f474f8c495f2cd07c624bd87a9e7a0f4d58f3f6c;hp=f1b05c1821035819debc55d364c05189a774fed9;hb=0eac9253f23925734e256c63081e157c68c70704;hpb=98b8cb22fe22f6a8b46a47cd5fa00dcf2bcd6fd5 diff --git a/config.cpp b/config.cpp index f1b05c1..f474f8c 100644 --- a/config.cpp +++ b/config.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -290,6 +291,26 @@ bool parse_udpstream(const ConfigLine &line, Config *config) udpstream.pacing_rate = atoi(pacing_rate_it->second.c_str()) * 1024 / 8; } + // Parse the TTL. The same value is used for unicast and multicast. + map::const_iterator ttl_it = line.parameters.find("ttl"); + if (ttl_it == line.parameters.end()) { + udpstream.ttl = -1; + } else { + udpstream.ttl = atoi(ttl_it->second.c_str()); + } + + // Parse the multicast interface index. + map::const_iterator multicast_iface_it = line.parameters.find("multicast_output_interface"); + if (multicast_iface_it == line.parameters.end()) { + udpstream.multicast_iface_index = -1; + } else { + udpstream.multicast_iface_index = if_nametoindex(multicast_iface_it->second.c_str()); + if (udpstream.multicast_iface_index == 0) { + log(ERROR, "Interface '%s' does not exist", multicast_iface_it->second.c_str()); + return false; + } + } + config->udpstreams.push_back(udpstream); return true; }