protocol specific IP address overrides

pull/1/head
Tom Early 5 years ago
parent e4d1c8d058
commit a22b4d1d51

@ -78,7 +78,9 @@ Configuring, compiling and maintaining your reflector build is easy! Start the c
./rconfig ./rconfig
``` ```
There are only a few things that need to be specified. Most important are, the reflector callsign and the IP addresses for the IPv4 and IPv6 listen ports and a transcoder port, if there is a transcoder. Dual-stack operation is enabled by specifying both an IPv4 and IPv6 address. IPv6-only single stack can be specified by leaving the IPv6 address set to `none`. It's even possible to operate in an IPv6-only configuration by leaving the IPv4 address to the default `none`. Obviously the transcoder is only specified for an XLX reflector. If you are building an XLX system with a transcoder, you can also specify which channels get transcoder support. There are also true/false flags to prevent G3 support and so that you can build executables that will support gdb debugging. There are only a few things that need to be specified. Most important are, the reflector callsign and the IP addresses for the IPv4 and IPv6 listen ports and a transcoder port, if there is a transcoder. Dual-stack operation is enabled by specifying both an IPv4 and IPv6 address. IPv6-only single stack can be specified by leaving the IPv6 address set to `none`. It's even possible to operate in an IPv6-only configuration by leaving the IPv4 address to the default `none`. You can override the ip addresses for any of the supported protocol and this is done in a sub-menu. This would allow you to install other Ham-related services that might use the same ports, like a Smart Group Server.
Obviously the transcoder is only specified for an XLX reflector. If your reflector is configured with a transcoder, you can specify which configured modules will be transcoded. If you are building an XLX system with a transcoder, you can also specify which channels get transcoder support. There are also true/false flags to prevent G3 support and so that you can build executables that will support gdb debugging.
You can support your own YSF frequency database. This is very useful for hot-spots that use YSF linking. These linked hot-spots can then use the *WiresX* command on their radios to be able to connect to any configured XLX module. Users can register their TX and RX frequency (typically the same for most hot-spot configurations) on http:<*xlx url*>/wiresx/login.php. Once their hot-spot is registered, XLX will return the correct frequency for their hot-spot when a *WiresX* command is sent to the reflector. You'll need to enable YSF auto-linking, specify a default module and define a database name, user and user password. When you write you XLX configuration, a database **configure.sql** script will be built to not only create the database and database user, but also the table for the hot-spot frequency data. You can support your own YSF frequency database. This is very useful for hot-spots that use YSF linking. These linked hot-spots can then use the *WiresX* command on their radios to be able to connect to any configured XLX module. Users can register their TX and RX frequency (typically the same for most hot-spot configurations) on http:<*xlx url*>/wiresx/login.php. Once their hot-spot is registered, XLX will return the correct frequency for their hot-spot when a *WiresX* command is sent to the reflector. You'll need to enable YSF auto-linking, specify a default module and define a database name, user and user password. When you write you XLX configuration, a database **configure.sql** script will be built to not only create the database and database user, but also the table for the hot-spot frequency data.

@ -15,7 +15,8 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
SetBooleanValue () { SetBooleanValue ()
{
local dvname local dvname
local cv local cv
if [ -z $2 ]; then if [ -z $2 ]; then
@ -43,7 +44,8 @@ SetBooleanValue () {
fi fi
} }
EvaluateVar () { EvaluateVar ()
{
if [ -z ${!1+x} ]; then if [ -z ${!1+x} ]; then
if [ -z "${!2}" ]; then if [ -z "${!2}" ]; then
echo "'' <DEFAULT>" echo "'' <DEFAULT>"
@ -59,7 +61,8 @@ EvaluateVar () {
fi fi
} }
WriteMemFile () { WriteMemFile ()
{
local file local file
file="$rcfg" file="$rcfg"
echo "# created on `date`" > $file echo "# created on `date`" > $file
@ -67,6 +70,22 @@ WriteMemFile () {
[ -z ${nummod+x} ] || echo "nummod=$nummod" >> $file [ -z ${nummod+x} ] || echo "nummod=$nummod" >> $file
[ -z ${ip4addr+x} ] || echo "ip4addr='$ip4addr'" >> $file [ -z ${ip4addr+x} ] || echo "ip4addr='$ip4addr'" >> $file
[ -z ${ip6addr+x} ] || echo "ip6addr='$ip6addr'" >> $file [ -z ${ip6addr+x} ] || echo "ip6addr='$ip6addr'" >> $file
[ -z ${refv4addr+x} ] || echo "refv4addr='$refv4addr'" >> $file
[ -z ${refv6addr+x} ] || echo "refv6addr='$refv6addr'" >> $file
[ -z ${dcsv4addr+x} ] || echo "dcsv4addr='$dcsv4addr'" >> $file
[ -z ${dcsv6addr+x} ] || echo "dcsv6addr='$dcsv6addr'" >> $file
[ -z ${xrfv4addr+x} ] || echo "xrfv4addr='$xrfv4addr'" >> $file
[ -z ${xrfv6addr+x} ] || echo "xrfv6addr='$xrfv6addr'" >> $file
[ -z ${g3_v4addr+x} ] || echo "g3_v4addr='$g3_v4addr'" >> $file
# [ -z ${g3_v6addr+x} ] || echo "g3_v6addr='$g3_v6addr'" >> $file
[ -z ${dmrv4addr+x} ] || echo "dmrv4addr='$dmrv4addr'" >> $file
[ -z ${dmrv6addr+x} ] || echo "dmrv6addr='$dmrv6addr'" >> $file
[ -z ${dmpv4addr+x} ] || echo "dmpv4addr='$dmpv4addr'" >> $file
[ -z ${dmpv6addr+x} ] || echo "dmpv6addr='$dmpv6addr'" >> $file
[ -z ${ysfv4addr+x} ] || echo "ysfv4addr='$ysfv4addr'" >> $file
[ -z ${ysfv6addr+x} ] || echo "ysfv6addr='$ysfv6addr'" >> $file
[ -z ${xlxv4addr+x} ] || echo "xlxv4addr='$xlxv4addr'" >> $file
[ -z ${xlxv6addr+x} ] || echo "xlxv6addr='$xlxv6addr'" >> $file
[ -z ${tcaddress+x} ] || echo "tcaddress='$tcaddress'" >> $file [ -z ${tcaddress+x} ] || echo "tcaddress='$tcaddress'" >> $file
[ -z ${tcmodules+x} ] || echo "tcmodules='$tcmodules'" >> $file [ -z ${tcmodules+x} ] || echo "tcmodules='$tcmodules'" >> $file
[ -z ${ysfautolink+x} ] || echo "ysfautolink=$ysfautolink" >> $file [ -z ${ysfautolink+x} ] || echo "ysfautolink=$ysfautolink" >> $file
@ -79,7 +98,8 @@ WriteMemFile () {
[ -z ${dbsupport+x} ] || echo "dbsupport=$dbsupport" >> $file [ -z ${dbsupport+x} ] || echo "dbsupport=$dbsupport" >> $file
} }
WriteSRCHFile () { WriteSRCHFile ()
{
local file m local file m
file="$srch" file="$srch"
echo "// Created on `date`" > $file echo "// Created on `date`" > $file
@ -92,14 +112,62 @@ WriteSRCHFile () {
else else
echo "#define NB_OF_MODULES ${nummod}" >> $file echo "#define NB_OF_MODULES ${nummod}" >> $file
fi fi
[ -z ${ip4addr+x} ] || echo "#define LISTEN_IPV4 \"${ip4addr}\"" >> $file if [ ! -z ${ip4addr+x} ]; then
[ -z ${ip6addr+x} ] || echo "#define LISTEN_IPV6 \"${ip6addr}\"" >> $file echo "#define LISTEN_IPV4 \"${ip4addr}\"" >> $file
if [ ! -z ${tcaddress+x} ]; then if [ ! -z ${refv4addr+x} ]; then
echo "#define TRANSCODER_IP \"${tcaddress}\"" >> $file echo "#define LISTEN_V4_DPLUS \"$refv4addr\"" >> $file
if [ -z ${tcmodules+x} ]; then fi
echo "#define TRANSCODED_MODULES \"${tcmodules_d}\"" >> $file if [ ! -z ${dcsv4addr+x} ]; then
else echo "#define LISTEN_V4_DCS \"$dcsv4addr\"" >> $file
echo "#define TRANSCODED_MODULES \"${tcmodules}\"" >> $file fi
if [ ! -z ${xrfv4addr+x} ]; then
echo "#define LISTEN_V4_DEXTRA \"$xrfv4addr\"" >> $file
fi
if [[ "$g3support" == true ]] && [ ! -z ${g3_v4addr+x} ]; then
echo "#define LISTEN_V4_G3 \"$g3_v4addr\"" >> $file
fi
if [[ "$callsign" == XLX* ]]; then
if [ ! -z ${dmrv4addr+x} ]; then
echo "#define LISTEN_V4_DMRMMDVM \"$dmrv4addr\"" >> $file
fi
if [ ! -z ${dmpv4addr+x} ]; then
echo "#define LISTEN_V4_DMRPLUS \"$dmpv4addr\"" >> $file
fi
if [ ! -z ${ysfv4addr+x} ]; then
echo "#define LISTEN_V4_YSF \"$ysfv4addr\"" >> $file
fi
if [ ! -z ${xlxv4addr+x} ]; then
echo "#define LISTEN_V4_XLX \"$xlxv4addr\"" >> $file
fi
fi
fi
if [ ! -z ${ip6addr+x} ]; then
echo "#define LISTEN_IPV6 \"${ip6addr}\"" >> $file
if [ ! -z ${refv6addr+x} ]; then
echo "#define LISTEN_V6_PLUS \"$refv6addr\"" >> $file
fi
if [ ! -z ${dcsv6addr+x} ]; then
echo "#define LISTEN_V6_DCS \"$dcsv6addr\"" >> $file
fi
if [ ! -z ${refv6addr+x} ]; then
echo "#define LISTEN_V6_DEXTRA \"$xrfv6addr\"" >> $file
fi
if [[ "$g3support" == true ]] && [ ! -z ${g3_v6addr+x} ]; then
echo "#define LISTEN_V4_G3 \"$g3_v6addr\"" >> $file
fi
if [[ "$callsign" == XLX* ]]; then
if [ ! -z ${dmrv6addr+x} ]; then
echo "#define LISTEN_V4_DMRMMDVM \"$dmrv6addr\"" >> $file
fi
if [ ! -z ${dmpv6addr+x} ]; then
echo "#define LISTEN_V4_DMRPLUS \"$dmpv6addr\"" >> $file
fi
if [ ! -z ${ysfv6addr+x} ]; then
echo "#define LISTEN_V4_YSF \"$ysfv6addr\"" >> $file
fi
if [ ! -z ${xlxv6addr+x} ]; then
echo "#define LISTEN_V4_XLX \"$xlxv6addr\"" >> $file
fi
fi fi
fi fi
if [[ "$callsign" == XLX* ]]; then if [[ "$callsign" == XLX* ]]; then
@ -122,6 +190,14 @@ WriteSRCHFile () {
echo '#define YSF_DB_SUPPORT false' >> $file echo '#define YSF_DB_SUPPORT false' >> $file
fi fi
fi fi
if [ ! -z ${tcaddress+x} ]; then
echo "#define TRANSCODER_IP \"${tcaddress}\"" >> $file
if [ -z ${tcmodules+x} ]; then
echo "#define TRANSCODED_MODULES \"${tcmodules_d}\"" >> $file
else
echo "#define TRANSCODED_MODULES \"${tcmodules}\"" >> $file
fi
fi
if [ -z ${g3support+x} ]; then if [ -z ${g3support+x} ]; then
m=${g3support_d} m=${g3support_d}
else else
@ -132,7 +208,8 @@ WriteSRCHFile () {
fi fi
} }
WriteSRCMKFile () { WriteSRCMKFile ()
{
local file local file
file="$srcm" file="$srcm"
echo "# Created on `date`" > $file echo "# Created on `date`" > $file
@ -156,14 +233,16 @@ WriteSRCMKFile () {
fi fi
} }
WriteAmbeHFile () { WriteAmbeHFile ()
{
local file local file
file="$ambh" file="$ambh"
echo "// Created on `date`" > $file echo "// Created on `date`" > $file
echo "#define TRANSCODER_IP \"${tcaddress}\"" >> $file echo "#define TRANSCODER_IP \"${tcaddress}\"" >> $file
} }
WriteAmbeMKFile () { WriteAmbeMKFile ()
{
local file local file
file="$ambm" file="$ambm"
echo "# created on `date`" > $file echo "# created on `date`" > $file
@ -174,7 +253,8 @@ WriteAmbeMKFile () {
fi fi
} }
WriteCfgPhpFile () { WriteCfgPhpFile ()
{
cat << EOF > $ysfs cat << EOF > $ysfs
<?php <?php
define('DB_SERVER', 'localhost'); define('DB_SERVER', 'localhost');
@ -189,7 +269,8 @@ if (\$link === false) { die("ERROR: Could not connect. " . mysqli_connect_error(
EOF EOF
} }
WriteDBCreateFile () { WriteDBCreateFile ()
{
cat << EOF > $dbcr cat << EOF > $dbcr
CREATE DATABASE IF NOT EXISTS ${ysfdbname}; CREATE DATABASE IF NOT EXISTS ${ysfdbname};
USE ${ysfdbname}; USE ${ysfdbname};
@ -206,7 +287,8 @@ FLUSH PRIVILEGES;
EOF EOF
} }
WriteCFGFiles () { WriteCFGFiles ()
{
WriteMemFile WriteMemFile
WriteSRCHFile WriteSRCHFile
WriteSRCMKFile WriteSRCMKFile
@ -246,6 +328,84 @@ ListCFGFiles ()
fi fi
} }
AddressMenu ()
{
while [[ "$key" != q* ]]
do
clear
echo
echo " IP Address For Each Protocol"
echo
if [ ! -z ${ip4addr+x} ]; then echo " p4 : DPlus IPv4 address = '$refv4addr'"; fi
if [ ! -z ${ip6addr+x} ]; then echo " p6 : DPlus IPv6 address = '$refv6addr'"; fi
if [ ! -z ${ip4addr+x} ]; then echo " c4 : DCS IPv4 address = '$dcsv4addr'"; fi
if [ ! -z ${ip6addr+x} ]; then echo " c6 : DCS IPV6 address = '$dcsv6addr'"; fi
if [ ! -z ${ip4addr+x} ]; then echo " e4 : DExtra IPv4 address = '$xrfv4addr'"; fi
if [ ! -z ${ip6addr+x} ]; then echo " e6 : DExtra IPv6 address = '$xrfv6addr'"; fi
if [[ "$g3support" == true ]]; then
if [ ! -z ${ip4addr+x} ]; then echo " g4 : G3 IPv4 address = '$g3_v4addr'"; fi
# if [ ! -z ${ip6addr+x} ]; then echo " g6 : G3 IPv6 address = '$g3_v6addr'"; fi
fi
if [[ "$callsign" == XLX* ]]; then
if [ ! -z ${ip4addr+x} ]; then echo " d4 : DMR IPv4 address = '$dmrv4addr'"; fi
if [ ! -z ${ip6addr+x} ]; then echo " d6 : DMR IPv6 address = '$dmrv6addr'"; fi
if [ ! -z ${ip4addr+x} ]; then echo " m4 : DMR+ IPv4 address = '$dmpv4addr'"; fi
if [ ! -z ${ip6addr+x} ]; then echo " m6 : DMR+ IPV6 address = '$dmpv6addr'"; fi
if [ ! -z ${ip4addr+x} ]; then echo " y4 : YSF IPv4 address = '$ysfv4addr'"; fi
if [ ! -z ${ip6addr+x} ]; then echo " y6 : YSF IPv6 address = '$ysfv6addr'"; fi
if [ ! -z ${ip4addr+x} ]; then echo " x4 : XLX IPv4 address = '$xlxv4addr'"; fi
if [ ! -z ${ip6addr+x} ]; then echo " x6 : XLX IPv6 address = '$xlxv6addr'"; fi
fi
echo
echo "xx : Clear all Protocol addresses"
echo
echo "q : Return to main menu"
echo "u : Unset the value of <key>."
echo
read -p "Please input <key> <value> : " key value garbage
if [[ "$key" == p4* ]]; then refv4addr="$value"
elif [[ "$key" == p6* ]]; then refv6addr="$value"
elif [[ "$key" == c4* ]]; then dcsv4addr="$value"
elif [[ "$key" == c6* ]]; then dcsv6addr="$value"
elif [[ "$key" == e4* ]]; then xrfv4addr="$value"
elif [[ "$key" == e6* ]]; then xrfv6addr="$value"
elif [[ "$key" == g4* ]]; then g3_v4addr="$value"
# elif [[ "$key" == g6* ]]; then g3_v6addr="$value"
elif [[ "$key" == d4* ]]; then dmrv4addr="$value"
elif [[ "$key" == d6* ]]; then dmrv6addr="$value"
elif [[ "$key" == m4* ]]; then dmpv4addr="$value"
elif [[ "$key" == m6* ]]; then dmpv6addr="$value"
elif [[ "$key" == y4* ]]; then ysfv4addr="$value"
elif [[ "$key" == y6* ]]; then ysfv6addr="$value"
elif [[ "$key" == x4* ]]; then xlxv4addr="$value"
elif [[ "$key" == x6* ]]; then xlxv6addr="$value"
elif [[ "$key" == xx* ]]; then unset {dcs,dmr,xrf,g3_,dmp,ref,xlx,ysf}v{4,6}addr
elif [[ "$key" == u* ]]; then
if [[ "$value" == p4* ]]; then unset refv4addr
elif [[ "$value" == p6* ]]; then unset refv6addr
elif [[ "$value" == c4* ]]; then unset dcsv4addr
elif [[ "$value" == c6* ]]; then unset dcsv6addr
elif [[ "$value" == e4* ]]; then unset xrfv4addr
elif [[ "$value" == e6* ]]; then unset xrfv6addr
elif [[ "$value" == g4* ]]; then unset g3_v4addr
# elif [[ "$value" == g6* ]]; then unset g3_v6addr
elif [[ "$value" == d4* ]]; then unset dmrv4addr
elif [[ "$value" == d6* ]]; then unset dmrv6addr
elif [[ "$value" == m4* ]]; then unset dmpv4addr
elif [[ "$value" == m6* ]]; then unset dmpv6addr
elif [[ "$value" == y4* ]]; then unset ysfv4addr
elif [[ "$value" == y6* ]]; then unset ysfv6addr
elif [[ "$value" == x4* ]]; then unset xlxv4addr
elif [[ "$value" == x6* ]]; then unset xlxv6addr
fi
fi
if [[ "$callsign" != XLX* ]]; then unset {dmr,dmp,ysf,xlx}v{4,6}v{4,6}addr; fi
if [ -z ${ip4addr+x} ]; then unset {ref,dcs,xrf,dmr,dmp,ysf,xlx,g3_}v4addr; fi
if [ -z ${ip6addr+x} ]; then unset {ref,dcs,xrf,dmr,dmp,ysf,xlx,g3_}v6addr; fi
if [[ "$g3support" != true ]]; then unset g3_v{4,6}addr; fi
done
}
# Execution starts here! # Execution starts here!
# file locations # file locations
rcfg='reflector.cfg' rcfg='reflector.cfg'
@ -307,17 +467,27 @@ while [[ "$key" != q* ]]
do do
clear clear
echo echo
echo " Reflector Configuration, Version #200813" echo " Reflector Configuration, Version #200821"
echo echo
echo " ******* REFLECTOR ********"
echo -n "cs : Reflector Callsign = "; EvaluateVar callsign{,_d} echo -n "cs : Reflector Callsign = "; EvaluateVar callsign{,_d}
echo -n "nm : Number of Modules = "; EvaluateVar nummod{,_d} echo -n "nm : Number of Modules = "; EvaluateVar nummod{,_d}
echo -n "g3 : Icom G3 Support = "; EvaluateVar g3support{,_d}
echo " ******* ADDRESSES ********"
echo -n "i4 : IPv4 Listen Address = "; EvaluateVar ip4addr{,_d} echo -n "i4 : IPv4 Listen Address = "; EvaluateVar ip4addr{,_d}
echo -n "i6 : IPv6 Listen Address = "; EvaluateVar ip6addr{,_d} echo -n "i6 : IPv6 Listen Address = "; EvaluateVar ip6addr{,_d}
if [ ! -z ${ip4addr+x} ] || [ ! -z ${ip6addr+x} ]; then
if [[ "$callsign" == XLX* ]] || [[ "$callsign" == XRF* ]]; then
echo "am : Protocol IP Address Override Sub-menu"
fi
fi
if [[ "$callsign" == XLX* ]]; then if [[ "$callsign" == XLX* ]]; then
echo " ******* TRANSCODER ********"
echo -n "tc : Transcoder Address = "; EvaluateVar tcaddress{,_d} echo -n "tc : Transcoder Address = "; EvaluateVar tcaddress{,_d}
if [ ! -z ${tcaddress+x} ]; then if [ ! -z ${tcaddress+x} ]; then
echo -n "tm : Transcoder Modules = "; EvaluateVar tcmodules{,_d} echo -n "tm : Transcoder Modules = "; EvaluateVar tcmodules{,_d}
fi fi
echo " ******* SYSTEM FUSION ********"
echo -n "ye : YSF Autolink Enable = "; EvaluateVar ysfautolink{,_d} echo -n "ye : YSF Autolink Enable = "; EvaluateVar ysfautolink{,_d}
if [ ! -z ${ysfautolink+x} ]; then if [ ! -z ${ysfautolink+x} ]; then
if [[ "$ysfautolink" == true ]]; then if [[ "$ysfautolink" == true ]]; then
@ -331,7 +501,7 @@ do
echo -n "yp : YSF Database Password = "; EvaluateVar ysfdbpw{,_d} echo -n "yp : YSF Database Password = "; EvaluateVar ysfdbpw{,_d}
fi fi
fi fi
echo -n "g3 : Icom G3 Support = "; EvaluateVar g3support{,_d} echo " ******* DEBUGGING ********"
echo -n "db : Debugging Support = "; EvaluateVar dbsupport{,_d} echo -n "db : Debugging Support = "; EvaluateVar dbsupport{,_d}
echo echo
if [[ "$callsign" == XLX* ]] || [[ "$callsign" == XRF* ]]; then if [[ "$callsign" == XLX* ]] || [[ "$callsign" == XRF* ]]; then
@ -342,11 +512,18 @@ do
echo echo
read -p "Please input <key> <value> - omit value to toggle a true/false : " key value garbage read -p "Please input <key> <value> - omit value to toggle a true/false : " key value garbage
if [[ "$key" == cs* && ( ${value^^} == XRF* || ${value^^} == XLX* ) ]]; then if [[ "$key" == am* ]]; then
if [ ! -z ${ip4addr+x} ] || [ ! -z ${ip6addr+x} ];then
if [[ "$callsign" == XLX* ]] || [[ "$callsign" == XRF* ]]; then
AddressMenu
key="continue"
fi
fi
elif [[ "$key" == cs* && ( ${value^^} == XRF* || ${value^^} == XLX* ) ]]; then
callsign="${value^^}" callsign="${value^^}"
callsign="${callsign:0:6}" callsign="${callsign:0:6}"
if [[ "$callsign" == XRF* ]]; then if [[ "$callsign" == XRF* ]]; then
unset tcaddress tcmodules ysfautolink ysfmodule ysflocaldb ysfdbname ysfdbuser ysfdbpw unset tcaddress tcmodules ysf{autolink,module,localdb,dbname,dbuser,dbpw} {dmr,dmp,ysf,xlx}v{4,6}addr
fi fi
elif [[ "$key" == nm* ]]; then nummod="$value" elif [[ "$key" == nm* ]]; then nummod="$value"
elif [[ "$key" == i4* ]]; then ip4addr="$value" elif [[ "$key" == i4* ]]; then ip4addr="$value"
@ -368,15 +545,15 @@ do
ListCFGFiles ListCFGFiles
exit 0 exit 0
elif [[ "$key" == u* ]]; then elif [[ "$key" == u* ]]; then
if [[ "$value" == cs* ]]; then unset callsign if [[ "$value" == cs* ]]; then unset callsign {ref,dcs,xrf,dmr,dmp,ysf,xlx,g3_}v{4,6}addr
elif [[ "$value" == nm* ]]; then unset nummod elif [[ "$value" == nm* ]]; then unset nummod
elif [[ "$value" == i4* ]]; then unset ip4addr elif [[ "$value" == i4* ]]; then unset ip4addr {ref,dcs,xrf,dmr,dmp,ysf,xlx,g3_}v4addr
elif [[ "$value" == i6* ]]; then unset ip6addr elif [[ "$value" == i6* ]]; then unset ip6addr {ref,dcs,xrf,dmr,dmp,ysf,xlx,g3_}v6addr
elif [[ "$value" == tc* ]]; then unset tcaddress elif [[ "$value" == tc* ]]; then unset tcaddress
elif [[ "$value" == tm* ]]; then unset tcmodules elif [[ "$value" == tm* ]]; then unset tcmodules
elif [[ "$value" == ye* ]]; then unset ysfautolink ysfmodule elif [[ "$value" == ye* ]]; then unset ysfautolink ysfmodule
elif [[ "$value" == ym* ]]; then unset ysfmodule elif [[ "$value" == ym* ]]; then unset ysfmodule
elif [[ "$value" == g3* ]]; then unset g3support elif [[ "$value" == g3* ]]; then unset g3support g3_v{4,6}addr
elif [[ "$value" == db* ]]; then unset dbsupport elif [[ "$value" == db* ]]; then unset dbsupport
elif [[ "$value" == yl* ]]; then unset ysflocaldb ysfdbname ysfdbuser ysfdbpw elif [[ "$value" == yl* ]]; then unset ysflocaldb ysfdbname ysfdbuser ysfdbpw
elif [[ "$value" == yd* ]]; then unset ysfdbname elif [[ "$value" == yd* ]]; then unset ysfdbname

@ -36,7 +36,7 @@ endif
LDFLAGS=-pthread LDFLAGS=-pthread
XRFSRCS = cbuffer.cpp ccallsign.cpp ccallsignlist.cpp ccallsignlistitem.cpp cclient.cpp cclients.cpp cdcsclient.cpp cdcsprotocol.cpp cdextraclient.cpp cdextrapeer.cpp cdextraprotocol.cpp cdplusclient.cpp cdplusprotocol.cpp cdvframepacket.cpp cdvheaderpacket.cpp cdvlastframepacket.cpp cgatekeeper.cpp cip.cpp cnotification.cpp cpacket.cpp cpacketstream.cpp cpeercallsignlist.cpp cpeer.cpp cpeers.cpp cprotocol.cpp cprotocols.cpp creflector.cpp ctimepoint.cpp cudpsocket.cpp cuser.cpp cusers.cpp cversion.cpp main.cpp XRFSRCS = cbuffer.cpp ccallsign.cpp ccallsignlist.cpp ccallsignlistitem.cpp cclient.cpp cclients.cpp cdcsclient.cpp cdcsprotocol.cpp cdextraclient.cpp cdextrapeer.cpp cdextraprotocol.cpp cdplusclient.cpp cdplusprotocol.cpp cdvframepacket.cpp cdvheaderpacket.cpp cdvlastframepacket.cpp cgatekeeper.cpp cip.cpp cnotification.cpp cpacket.cpp cpacketstream.cpp cpeercallsignlist.cpp cpeer.cpp cpeers.cpp cprotoaddress.cpp cprotocol.cpp cprotocols.cpp creflector.cpp ctimepoint.cpp cudpsocket.cpp cuser.cpp cusers.cpp cversion.cpp main.cpp
XLXSRCS = cbmclient.cpp cbmpeer.cpp cbptc19696.cpp ccrc.cpp cdmriddir.cpp cdmriddirfile.cpp cdmriddirhttp.cpp cdmrmmdvmclient.cpp cdmrmmdvmprotocol.cpp cdmrplusclient.cpp cdmrplusprotocol.cpp cgolay2087.cpp cgolay24128.cpp chamming.cpp cqr1676.cpp crs129.cpp csemaphore.cpp cutils.cpp cwiresxcmd.cpp cwiresxcmdhandler.cpp cwiresxinfo.cpp cxlxclient.cpp cxlxprotocol.cpp cxlxpeer.cpp cysfclient.cpp cysfconvolution.cpp cysffich.cpp cysfnode.cpp cysfnodedir.cpp cysfnodedirfile.cpp cysfnodedirhttp.cpp cysfpayload.cpp cysfprotocol.cpp cysfutils.cpp XLXSRCS = cbmclient.cpp cbmpeer.cpp cbptc19696.cpp ccrc.cpp cdmriddir.cpp cdmriddirfile.cpp cdmriddirhttp.cpp cdmrmmdvmclient.cpp cdmrmmdvmprotocol.cpp cdmrplusclient.cpp cdmrplusprotocol.cpp cgolay2087.cpp cgolay24128.cpp chamming.cpp cqr1676.cpp crs129.cpp csemaphore.cpp cutils.cpp cwiresxcmd.cpp cwiresxcmdhandler.cpp cwiresxinfo.cpp cxlxclient.cpp cxlxprotocol.cpp cxlxpeer.cpp cysfclient.cpp cysfconvolution.cpp cysffich.cpp cysfnode.cpp cysfnodedir.cpp cysfnodedirfile.cpp cysfnodedirhttp.cpp cysfpayload.cpp cysfprotocol.cpp cysfutils.cpp
G3SRCS = cg3client.cpp cg3protocol.cpp crawsocket.cpp cudpmsgsocket.cpp G3SRCS = cg3client.cpp cg3protocol.cpp crawsocket.cpp cudpmsgsocket.cpp

@ -89,12 +89,12 @@ bool CCodecStream::Init(uint16 uiPort)
// create socket address, family based on transcoder listen address // create socket address, family based on transcoder listen address
#ifdef LISTEN_IPV4 #ifdef LISTEN_IPV4
#ifdef LISTEN_IPV6 #ifdef LISTEN_IPV6
s = (AF_INET == m_Ip.GetFamily()) ? g_Reflector.GetListenIPv4() : g_Reflector.GetListenIPv6(); s = (AF_INET == m_Ip.GetFamily()) ? g_Reflector.m_Address.GetV4Address(PROTOCOL_ANY).c_str() : g_Reflector.m_Address.GetV6Address(PROTOCOL_ANY).c_str();
#else #else
s = g_Reflector.GetListenIPv4(); s = g_Reflector.m_Address.GetV4Address(PROTOCOL_ANY).c_str();
#endif #endif
#else #else
s = g_Reflector.GetListenIPv6(); s = g_Reflector.m_Address.GetV6Address(PROTOCOL_ANY).c_str();
#endif #endif
CIp ip(m_Ip.GetFamily(), m_uiPort, s); CIp ip(m_Ip.GetFamily(), m_uiPort, s);

@ -33,10 +33,10 @@
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
// operation // operation
bool CDcsProtocol::Init(void) bool CDcsProtocol::Initialize(const char *type, const int ptype, const uint16 port, const bool has_ipv4, const bool has_ipv6)
{ {
// base class // base class
if (! CProtocol::Initialize("DCS", DCS_PORT, DSTAR_IPV4, DSTAR_IPV6)) if (! CProtocol::Initialize(type, ptype, port, has_ipv4, has_ipv6))
return false; return false;
// update time // update time

@ -51,7 +51,7 @@ class CDcsProtocol : public CProtocol
{ {
public: public:
// initialization // initialization
bool Init(void); bool Initialize(const char *type, const int ptype, const uint16 port, const bool has_ipv4, const bool has_ipv6);
// task // task
void Task(void); void Task(void);

@ -35,10 +35,10 @@
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
// operation // operation
bool CDextraProtocol::Initialize(const char *type, const uint16 port, const bool has_ipv4, const bool has_ipv6) bool CDextraProtocol::Initialize(const char *type, int ptype, const uint16 port, const bool has_ipv4, const bool has_ipv6)
{ {
// base class // base class
if (! CProtocol::Initialize(type, port, has_ipv4, has_ipv6)) if (! CProtocol::Initialize(type, ptype, port, has_ipv4, has_ipv6))
return false; return false;
// update time // update time

@ -59,7 +59,7 @@ class CDextraProtocol : public CProtocol
{ {
public: public:
// initialization // initialization
bool Initialize(const char *type, const uint16 port, const bool has_ipv4, const bool has_ipv6); bool Initialize(const char *type, const int ptype, const uint16 port, const bool has_ipv4, const bool has_ipv6);
// task // task
void Task(void); void Task(void);

@ -54,10 +54,10 @@ static uint8 g_DmrSyncMSData[] = { 0x0D,0x5D,0x7F,0x77,0xFD,0x75,0x70 };
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
// operation // operation
bool CDmrmmdvmProtocol::Initialize(const char *type, const uint16 port, const bool has_ipv4, const bool has_ipv6) bool CDmrmmdvmProtocol::Initialize(const char *type, const int ptype, const uint16 port, const bool has_ipv4, const bool has_ipv6)
{ {
// base class // base class
if (! CProtocol::Initialize(type, port, has_ipv4, has_ipv6)) if (! CProtocol::Initialize(type, ptype, port, has_ipv4, has_ipv6))
return false; return false;
// update time // update time

@ -68,7 +68,7 @@ class CDmrmmdvmProtocol : public CProtocol
{ {
public: public:
// initialization // initialization
bool Initialize(const char *type, const uint16 port, const bool has_ipv4, const bool has_ipv6); bool Initialize(const char *type, const int ptype, const uint16 port, const bool has_ipv4, const bool has_ipv6);
// task // task
void Task(void); void Task(void);

@ -47,10 +47,10 @@ static uint8 g_DmrSyncMSData[] = { 0x0D,0x5D,0x7F,0x77,0xFD,0x75,0x70 };
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
// operation // operation
bool CDmrplusProtocol::Initialize(const char *type, const uint16 port, const bool has_ipv4, const bool has_ipv6) bool CDmrplusProtocol::Initialize(const char *type, const int ptype, const uint16 port, const bool has_ipv4, const bool has_ipv6)
{ {
// base class // base class
if (! CProtocol::Initialize(type, port, has_ipv4, has_ipv6)) if (! CProtocol::Initialize(type, ptype, port, has_ipv4, has_ipv6))
return false; return false;
// update time // update time

@ -57,7 +57,7 @@ class CDmrplusProtocol : public CProtocol
{ {
public: public:
// initialization // initialization
bool Initialize(const char *type, const uint16 port, const bool has_ipv4, const bool has_ipv6); bool Initialize(const char *type, const int pytpe, const uint16 port, const bool has_ipv4, const bool has_ipv6);
// task // task
void Task(void); void Task(void);

@ -34,10 +34,10 @@
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
// operation // operation
bool CDplusProtocol::Initialize(const char *type, const uint16 port, const bool has_ipv4, const bool has_ipv6) bool CDplusProtocol::Initialize(const char *type, const int ptype, const uint16 port, const bool has_ipv4, const bool has_ipv6)
{ {
// base class // base class
if (! CProtocol::Initialize(type, port, has_ipv4, has_ipv6)) if (! CProtocol::Initialize(type, ptype, port, has_ipv4, has_ipv6))
return false; return false;
// update time // update time

@ -52,7 +52,7 @@ class CDplusProtocol : public CProtocol
{ {
public: public:
// initialization // initialization
bool Initialize(const char *type, const uint16 port, const bool has_ipv4, const bool has_ipv6); bool Initialize(const char *type, const int ptype, const uint16 port, const bool has_ipv4, const bool has_ipv6);
// task // task
void Task(void); void Task(void);

@ -38,7 +38,8 @@
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
// operation // operation
bool CG3Protocol::Initialize(const char */*type*/, const uint16 /*port*/, const bool /*has_ipv4*/, const bool /*has_ipv6*/) bool CG3Protocol::Initialize(const char */*type*/, const int /*type*/, const uint16 /*port*/, const bool /*has_ipv4*/, const bool /*has_ipv6*/)
// everything is hard coded until ICOM gets their act together and start supporting IPv6
{ {
ReadOptions(); ReadOptions();
@ -52,7 +53,7 @@ bool CG3Protocol::Initialize(const char */*type*/, const uint16 /*port*/, const
//m_ReflectorCallsign.PatchCallsign(0, (const uint8 *)"XLX", 3); //m_ReflectorCallsign.PatchCallsign(0, (const uint8 *)"XLX", 3);
// create our sockets // create our sockets
CIp ip(AF_INET, G3_DV_PORT, g_Reflector.GetListenIPv4()); CIp ip(AF_INET, G3_DV_PORT, g_Reflector.m_Address.GetV4Address(PROTOCOL_G3).c_str());
if ( ip.IsSet() ) if ( ip.IsSet() )
{ {
if (! m_Socket4.Open(ip)) if (! m_Socket4.Open(ip))
@ -61,6 +62,8 @@ bool CG3Protocol::Initialize(const char */*type*/, const uint16 /*port*/, const
else else
return false; return false;
std::cout << "Listening on " << ip << std::endl;
//create helper socket //create helper socket
ip.SetPort(G3_PRESENCE_PORT); ip.SetPort(G3_PRESENCE_PORT);
if (! m_PresenceSocket.Open(ip)) if (! m_PresenceSocket.Open(ip))

@ -67,7 +67,7 @@ public:
CG3Protocol() : m_GwAddress(0u), m_Modules("*"), m_LastModTime(0) {} CG3Protocol() : m_GwAddress(0u), m_Modules("*"), m_LastModTime(0) {}
// initialization // initialization
bool Initialize(const char *type, const uint16 port, const bool has_ipv4, const bool has_ipv6); bool Initialize(const char *type, const int ptype, const uint16 port, const bool has_ipv4, const bool has_ipv6);
// close // close
void Close(void); void Close(void);

@ -0,0 +1,100 @@
//
// Copyright © 2020 Thomas A. Eary, N7TAE
//
// ----------------------------------------------------------------------------
// This file is part of xlxd.
//
// xlxd is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// xlxd is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Foobar. If not, see <http://www.gnu.org/licenses/>.
// ----------------------------------------------------------------------------
#include "cprotoaddress.h"
CProtoAddress::CProtoAddress()
{
#ifdef LISTEN_IPV4
v4address[PROTOCOL_ANY] = LISTEN_IPV4;
#endif
#ifdef LISTEN_V4_DPLUS
v4address[PROTOCOL_DPLUS] = LISTEN_V4_DPLUS;
#endif
#ifdef LISTEN_V4_DCS
v4address[PROTOCOL_DCS] = LISTEN_V4_DCS;
#endif
#ifdef LISTEN_V4_DEXTRA
v4address[PROTOCOL_DEXTRA] = LISTEN_V4_DEXTRA;
#endif
#ifdef LISTEN_V4_DMRMMDVM
v4address[PROTOCOL_DMRMMDVM] = LISTEN_V4_DMRMMDVM;
#endif
#ifdef LISTEN_V4_DMRPLUS
v4address[PROTOCOL_DMRPLUS] = LISTEN_V4_DMRPLUS;
#endif
#ifdef LISTEN_V4_YSF
v4address[PROTOCOL_YSF] = LISTEN_V4_YSF;
#endif
#ifdef LISTEN_V4_XLX
v4address[PROTOCOL_XLX] = LISTEN_V4_XLX;
#endif
#ifdef LISTEN_V4_G3
v4address[PROTOCOL_G3] = LISTEN_V4_G3;
#endif
#ifdef LISTEN_IPV6
v6address[PROTOCOL_ANY] = LISTEN_IPV6;
#endif
#ifdef LISTEN_V6_DPLUS
v6address[PROTOCOL_DPLUS] = LISTEN_V6_DPLUS;
#endif
#ifdef LISTEN_V6_DCS
v6address[PROTOCOL_DCS] = LISTEN_V6_DCS;
#endif
#ifdef LISTEN_V6_DEXTRA
v6address[PROTOCOL_DEXTRA] = LISTEN_V6_DEXTRA;
#endif
#ifdef LISTEN_V6_DMRMMDVM
v6address[PROTOCOL_DMRMMDVM] = LISTEN_V6_DMRMMDVM;
#endif
#ifdef LISTEN_V6_DMRPLUS
v6address[PROTOCOL_DMRPLUS] = LISTEN_V6_DMRPLUS;
#endif
#ifdef LISTEN_V6_YSF
v6address[PROTOCOL_YSF] = LISTEN_V6_YSF;
#endif
#ifdef LISTEN_V6_XLX
v6address[PROTOCOL_XLX] = LISTEN_V6_XLX;
#endif
#ifdef LISTEN_V6_G3
v6address[PROTOCOL_G3] = LISTEN_V6_G3;
#endif
}
#ifdef LISTEN_IPV4
std::string CProtoAddress::GetV4Address(int protocol)
{
if (v4address.end() == v4address.find(protocol))
return v4address[PROTOCOL_ANY];
else
return v4address[protocol];
}
#endif
#ifdef LISTEN_IPV4
std::string CProtoAddress::GetV6Address(int protocol)
{
if (v6address.end() == v6address.find(protocol))
return v6address[PROTOCOL_ANY];
else
return v6address[protocol];
}
#endif

@ -0,0 +1,46 @@
#pragma once
//
// Copyright © 2020 Thomas A. Eary, N7TAE
//
// ----------------------------------------------------------------------------
// This file is part of xlxd.
//
// xlxd is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// xlxd is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Foobar. If not, see <http://www.gnu.org/licenses/>.
// ----------------------------------------------------------------------------
#include <unordered_map>
#include <string>
#include "main.h"
class CProtoAddress
{
public:
CProtoAddress();
#ifdef LISTEN_IPV4
std::string GetV4Address(int protocol);
#endif
#ifdef LISTEN_IPV6
std::string GetV6Address(int protocol);
#endif
private:
#ifdef LISTEN_IPV4
std::unordered_map<int, std::string> v4address;
#endif
#ifdef LISTEN_IPV6
std::unordered_map<int, std::string> v6address;
#endif
};

@ -56,7 +56,7 @@ CProtocol::~CProtocol()
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
// initialization // initialization
bool CProtocol::Initialize(const char *type, const uint16 port, const bool has_ipv4, const bool has_ipv6) bool CProtocol::Initialize(const char *type, int ptype, const uint16 port, const bool has_ipv4, const bool has_ipv6)
{ {
// init reflector apparent callsign // init reflector apparent callsign
m_ReflectorCallsign = g_Reflector.GetCallsign(); m_ReflectorCallsign = g_Reflector.GetCallsign();
@ -72,19 +72,20 @@ bool CProtocol::Initialize(const char *type, const uint16 port, const bool has_i
#ifdef LISTEN_IPV4 #ifdef LISTEN_IPV4
if (has_ipv4) if (has_ipv4)
{ {
CIp ip4(AF_INET, port, g_Reflector.GetListenIPv4()); CIp ip4(AF_INET, port, g_Reflector.m_Address.GetV4Address(ptype).c_str());
if ( ip4.IsSet() ) if ( ip4.IsSet() )
{ {
if (! m_Socket4.Open(ip4)) if (! m_Socket4.Open(ip4))
return false; return false;
} }
std::cout << "Listening on " << ip4 << std::endl;
} }
#endif #endif
#ifdef LISTEN_IPV6 #ifdef LISTEN_IPV6
if (has_ipv6) if (has_ipv6)
{ {
CIp ip6(AF_INET6, port, g_Reflector.GetListenIPv6()); CIp ip6(AF_INET6, port, g_Reflector.m_Address.GetV6Address(ptype).c_str());
if ( ip6.IsSet() ) if ( ip6.IsSet() )
{ {
if (! m_Socket6.Open(ip6)) if (! m_Socket6.Open(ip6))
@ -92,6 +93,7 @@ bool CProtocol::Initialize(const char *type, const uint16 port, const bool has_i
m_Socket4.Close(); m_Socket4.Close();
return false; return false;
} }
std::cout << "Listening on " << ip6 << std::endl;
} }
} }
#endif #endif
@ -107,7 +109,6 @@ bool CProtocol::Initialize(const char *type, const uint16 port, const bool has_i
return false; return false;
} }
std::cout << "Initialized " << (type ? type : "DMR") << " protocol on port " << port << std::endl;
return true; return true;
} }

@ -77,7 +77,7 @@ public:
virtual ~CProtocol(); virtual ~CProtocol();
// initialization // initialization
virtual bool Initialize(const char *type, const uint16 port, const bool has_ipv4, const bool has_ipv6); virtual bool Initialize(const char *type, const int ptype, const uint16 port, const bool has_ipv4, const bool has_ipv6);
virtual void Close(void); virtual void Close(void);
// queue // queue

@ -54,38 +54,38 @@ bool CProtocols::Init(void)
m_Mutex.lock(); m_Mutex.lock();
{ {
m_Protocols.emplace_back(std::unique_ptr<CDextraProtocol>(new CDextraProtocol)); m_Protocols.emplace_back(std::unique_ptr<CDextraProtocol>(new CDextraProtocol));
if (! m_Protocols.back()->Initialize("XRF", DEXTRA_PORT, DSTAR_IPV4, DSTAR_IPV6)) if (! m_Protocols.back()->Initialize("XRF", PROTOCOL_DEXTRA, DEXTRA_PORT, DSTAR_IPV4, DSTAR_IPV6))
return false; return false;
m_Protocols.emplace_back(std::unique_ptr<CDplusProtocol>(new CDplusProtocol)); m_Protocols.emplace_back(std::unique_ptr<CDplusProtocol>(new CDplusProtocol));
if (! m_Protocols.back()->Initialize("REF", DPLUS_PORT, DSTAR_IPV4, DSTAR_IPV6)) if (! m_Protocols.back()->Initialize("REF", PROTOCOL_DPLUS, DPLUS_PORT, DSTAR_IPV4, DSTAR_IPV6))
return false; return false;
m_Protocols.emplace_back(std::unique_ptr<CDcsProtocol>(new CDcsProtocol)); m_Protocols.emplace_back(std::unique_ptr<CDcsProtocol>(new CDcsProtocol));
if (! m_Protocols.back()->Initialize("DCS", DCS_PORT, DSTAR_IPV4, DSTAR_IPV6)) if (! m_Protocols.back()->Initialize("DCS", PROTOCOL_DCS, DCS_PORT, DSTAR_IPV4, DSTAR_IPV6))
return false; return false;
#ifndef NO_XLX #ifndef NO_XLX
m_Protocols.emplace_back(std::unique_ptr<CDmrmmdvmProtocol>(new CDmrmmdvmProtocol)); m_Protocols.emplace_back(std::unique_ptr<CDmrmmdvmProtocol>(new CDmrmmdvmProtocol));
if (! m_Protocols.back()->Initialize(nullptr, DMRMMDVM_PORT, DMR_IPV4, DMR_IPV6)) if (! m_Protocols.back()->Initialize(nullptr, PROTOCOL_DMRMMDVM, DMRMMDVM_PORT, DMR_IPV4, DMR_IPV6))
return false; return false;
m_Protocols.emplace_back(std::unique_ptr<CDmrplusProtocol>(new CDmrplusProtocol)); m_Protocols.emplace_back(std::unique_ptr<CDmrplusProtocol>(new CDmrplusProtocol));
if (! m_Protocols.back()->Initialize(nullptr, DMRPLUS_PORT, DMR_IPV4, DMR_IPV6)) if (! m_Protocols.back()->Initialize(nullptr, PROTOCOL_DMRPLUS, DMRPLUS_PORT, DMR_IPV4, DMR_IPV6))
return false; return false;
m_Protocols.emplace_back(std::unique_ptr<CYsfProtocol>(new CYsfProtocol)); m_Protocols.emplace_back(std::unique_ptr<CYsfProtocol>(new CYsfProtocol));
if (! m_Protocols.back()->Initialize("YSF", YSF_PORT, YSF_IPV4, YSF_IPV6)) if (! m_Protocols.back()->Initialize("YSF", PROTOCOL_YSF, YSF_PORT, YSF_IPV4, YSF_IPV6))
return false; return false;
m_Protocols.emplace_back(std::unique_ptr<CXlxProtocol>(new CXlxProtocol)); m_Protocols.emplace_back(std::unique_ptr<CXlxProtocol>(new CXlxProtocol));
if (! m_Protocols.back()->Initialize("XLX", XLX_PORT, DMR_IPV4, DMR_IPV6)) if (! m_Protocols.back()->Initialize("XLX", PROTOCOL_XLX, XLX_PORT, DMR_IPV4, DMR_IPV6))
return false; return false;
#endif #endif
#ifndef NO_G3 #ifndef NO_G3
m_Protocols.emplace_back(std::unique_ptr<CG3Protocol>(new CG3Protocol)); m_Protocols.emplace_back(std::unique_ptr<CG3Protocol>(new CG3Protocol));
if (! m_Protocols.back()->Initialize("XLX", G3_DV_PORT, DMR_IPV4, DMR_IPV6)) if (! m_Protocols.back()->Initialize("XLX", PROTOCOL_G3, G3_DV_PORT, DMR_IPV4, DMR_IPV6))
return false; return false;
#endif #endif

@ -26,6 +26,7 @@
#ifndef creflector_h #ifndef creflector_h
#define creflector_h #define creflector_h
#include "cprotoaddress.h"
#include "cusers.h" #include "cusers.h"
#include "cclients.h" #include "cclients.h"
#include "cpeers.h" #include "cpeers.h"
@ -59,16 +60,6 @@ public:
void SetCallsign(const CCallsign &callsign) { m_Callsign = callsign; } void SetCallsign(const CCallsign &callsign) { m_Callsign = callsign; }
const CCallsign &GetCallsign(void) const { return m_Callsign; } const CCallsign &GetCallsign(void) const { return m_Callsign; }
#ifdef LISTEN_IPV4
void SetListenIPv4(const char *a, const int n) { memset(m_IPv4, 0, n); strncpy(m_IPv4, a, n-1); }
const char *GetListenIPv4(void) const { return m_IPv4; }
#endif
#ifdef LISTEN_IPV6
void SetListenIPv6(const char *a, const int n) { memset(m_IPv6, 0, n); strncpy(m_IPv6, a, n-1); }
const char *GetListenIPv6(void) const { return m_IPv6; }
#endif
#ifdef TRANSCODER_IP #ifdef TRANSCODER_IP
void SetTranscoderIp(const char *a, const int n) { memset(m_AmbedIp, 0, n); strncpy(m_AmbedIp, a, n-1); } void SetTranscoderIp(const char *a, const int n) { memset(m_AmbedIp, 0, n); strncpy(m_AmbedIp, a, n-1); }
const char *GetTranscoderIp(void) const { return m_AmbedIp; } const char *GetTranscoderIp(void) const { return m_AmbedIp; }
@ -95,6 +86,9 @@ public:
CUsers *GetUsers(void) { m_Users.Lock(); return &m_Users; } CUsers *GetUsers(void) { m_Users.Lock(); return &m_Users; }
void ReleaseUsers(void) { m_Users.Unlock(); } void ReleaseUsers(void) { m_Users.Unlock(); }
// IP Addresses
CProtoAddress m_Address;
// get // get
bool IsValidModule(char c) const { return (GetModuleIndex(c) >= 0); } bool IsValidModule(char c) const { return (GetModuleIndex(c) >= 0); }
int GetModuleIndex(char) const; int GetModuleIndex(char) const;
@ -135,12 +129,6 @@ protected:
protected: protected:
// identity // identity
CCallsign m_Callsign; CCallsign m_Callsign;
#ifdef LISTEN_IPV4
char m_IPv4[INET_ADDRSTRLEN];
#endif
#ifdef LISTEN_IPV6
char m_IPv6[INET6_ADDRSTRLEN];
#endif
#ifdef TRANSCODER_IP #ifdef TRANSCODER_IP
char m_AmbedIp[INET6_ADDRSTRLEN]; char m_AmbedIp[INET6_ADDRSTRLEN];
#endif #endif

@ -82,12 +82,12 @@ bool CTranscoder::Init(void)
// now open the transcoder port // now open the transcoder port
#ifdef LISTEN_IPV4 #ifdef LISTEN_IPV4
#ifdef LISTEN_IPV6 #ifdef LISTEN_IPV6
s = (AF_INET == m_Ip.GetFamily()) ? g_Reflector.GetListenIPv4() : g_Reflector.GetListenIPv6(); s = (AF_INET == m_Ip.GetFamily()) ? g_Reflector.m_Address.GetV4Address(PROTOCOL_ANY).c_str() : g_Reflector.m_Address.GetV6Address(PROTOCOL_ANY).c_str();
#else #else
s = g_Reflector.GetListenIPv4(); s = g_Reflector.m_Address.GetV4Address(PROTOCOL_ANY).c_str();
#endif #endif
#else #else
s = g_Reflector.GetListenIPv6(); s = g_Reflector.m_address.GetV6Address(PROTOCOL_ANY).c_str();
#endif #endif
CIp tc(m_Ip.GetFamily(), TRANSCODER_PORT, s); CIp tc(m_Ip.GetFamily(), TRANSCODER_PORT, s);

@ -35,9 +35,9 @@
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
// operation // operation
bool CXlxProtocol::Initialize(const char *type, const uint16 port, const bool has_ipv4, const bool has_ipv6) bool CXlxProtocol::Initialize(const char *type, const int ptype, const uint16 port, const bool has_ipv4, const bool has_ipv6)
{ {
if (! CProtocol::Initialize(type, port, has_ipv4, has_ipv6)) if (! CProtocol::Initialize(type, ptype, port, has_ipv4, has_ipv6))
return false; return false;
// update time // update time

@ -41,7 +41,7 @@ class CXlxProtocol : public CDextraProtocol
{ {
public: public:
// initialization // initialization
bool Initialize(const char *type, const uint16 port, const bool has_ipv4, const bool has_ipv6); bool Initialize(const char *type, const int ptype, const uint16 port, const bool has_ipv4, const bool has_ipv6);
// task // task
void Task(void); void Task(void);

@ -45,10 +45,10 @@ CYsfProtocol::CYsfProtocol()
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
// operation // operation
bool CYsfProtocol::Initialize(const char *type, const uint16 port, const bool has_ipv4, const bool has_ipv6) bool CYsfProtocol::Initialize(const char *type, const int ptype, const uint16 port, const bool has_ipv4, const bool has_ipv6)
{ {
// base class // base class
if (! CProtocol::Initialize(type, port, has_ipv4, has_ipv6)) if (! CProtocol::Initialize(type, ptype, port, has_ipv4, has_ipv6))
return false; return false;
// init the wiresx cmd handler // init the wiresx cmd handler

@ -74,7 +74,7 @@ public:
CYsfProtocol(); CYsfProtocol();
// initialization // initialization
bool Initialize(const char *type, const uint16 port, const bool has_ipv4, const bool has_ipv6); bool Initialize(const char *type, const int ptype, const uint16 port, const bool has_ipv4, const bool has_ipv6);
void Close(void); void Close(void);
// task // task

@ -56,14 +56,6 @@ int main()
// initialize reflector // initialize reflector
g_Reflector.SetCallsign(cs.c_str()); g_Reflector.SetCallsign(cs.c_str());
#ifdef LISTEN_IPV4
g_Reflector.SetListenIPv4(LISTEN_IPV4, INET_ADDRSTRLEN);
#endif
#ifdef LISTEN_IPV6
g_Reflector.SetListenIPv6(LISTEN_IPV6, INET6_ADDRSTRLEN);
#endif
#ifdef TRANSCODER_IP #ifdef TRANSCODER_IP
g_Reflector.SetTranscoderIp(TRANSCODER_IP, INET6_ADDRSTRLEN); g_Reflector.SetTranscoderIp(TRANSCODER_IP, INET6_ADDRSTRLEN);
#endif #endif
@ -76,20 +68,7 @@ int main()
return EXIT_FAILURE; return EXIT_FAILURE;
} }
std::cout << "Reflector " << g_Reflector.GetCallsign() << "started and listening on "; std::cout << "Reflector " << g_Reflector.GetCallsign() << "started and listening" << std::endl;
#if defined LISTEN_IPV4
std::cout << g_Reflector.GetListenIPv4() << " for IPv4";
#if defined LISTEN_IPV6
std::cout << " and " << g_Reflector.GetListenIPv6() << " for IPv6" << std::endl;
#else
std::cout << std::endl;
#endif
#elif defined LISTEN_IPV6
std::cout << g_Reflector.GetListenIPv6() << " for IPv6" << std::endl;
#else
std::cout << "...ABORTING! No IP addresses defined!" << std::endl;
return EXIT_FAILURE;
#endif
// write new pid file // write new pid file
std::ofstream ofs(PIDFILE_PATH, std::ofstream::out); std::ofstream ofs(PIDFILE_PATH, std::ofstream::out);

@ -79,8 +79,6 @@
// protocols --------------------------------------------------- // protocols ---------------------------------------------------
#define NB_OF_PROTOCOLS 8
#define PROTOCOL_ANY -1 #define PROTOCOL_ANY -1
#define PROTOCOL_NONE 0 #define PROTOCOL_NONE 0
#define PROTOCOL_DEXTRA 1 #define PROTOCOL_DEXTRA 1

Loading…
Cancel
Save

Powered by TurnKey Linux.