Merge pull request #5 from n7tae/main

fixes for AutolinkModule parameters and radmin
pull/8/head
nostar 1 year ago committed by GitHub
commit 6fe69ec68c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -37,7 +37,7 @@ IPv4Binding = 0.0.0.0
# Modules = ABCDEFGHIJKLMNOPQRSTUVWXYZ # Modules = ABCDEFGHIJKLMNOPQRSTUVWXYZ
Modules = ADMSZ Modules = ADMSZ
# Create Descriptions as needed... # Create Descriptions as needed...
DescriptionA = Transcoded DescriptionA = All Modes
DescriptionD = DMR Chat DescriptionD = DMR Chat
DescriptionM = M17 Chat DescriptionM = M17 Chat
DescriptionS = DStar Chat DescriptionS = DStar Chat
@ -91,7 +91,7 @@ Port = 10017
[USRP] [USRP]
Enable = false Enable = false
Callsign = ALLSTAR # set to NONE if you don't want to create this client Callsign = ALLSTAR
IPAddress = 1.2.3.4 # the IP address of the USRP client (the Allstar node) IPAddress = 1.2.3.4 # the IP address of the USRP client (the Allstar node)
RxPort = 34000 RxPort = 34000
TxPort = 32000 TxPort = 32000

@ -152,7 +152,7 @@ if ($CallingHome['Active']) {
<span class="icon-bar"></span> <span class="icon-bar"></span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
</button> </button>
<span class="navbar-brand"><?php echo $Reflector->GetReflectorName(); ?> Multiprotocol Reflector</span> <span class="navbar-brand"><?php echo str_replace("XLX", "URF", $Reflector->GetReflectorName()); ?> Universal Reflector</span>
</div> </div>
<div id="navbar" class="navbar-collapse collapse"> <div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">

@ -35,7 +35,7 @@ UninstallReflector () {
} }
InstallReflector () { InstallReflector () {
if [ "$tcaddress" != none ]; then if [ "$tcport" != 0 ]; then
pushd ../tcd pushd ../tcd
sudo make install || read -p "<Enter> to continue: " ans sudo make install || read -p "<Enter> to continue: " ans
popd popd
@ -63,22 +63,19 @@ InstallReflector () {
urfserv='/etc/systemd/system/urfd.service' urfserv='/etc/systemd/system/urfd.service'
tcdserv='/etc/systemd/system/tcd.service' tcdserv='/etc/systemd/system/tcd.service'
# default values, we only need a few
tcaddress='none'
if [[ $# -eq 1 ]]; then if [[ $# -eq 1 ]]; then
if [ -e $1 ]; then if [ -e $1 ]; then
echo $1 found echo $1 found
callsign=$(awk '$1 == "Callsign"{print $3}' $1) callsign=$(awk '$1 == "Callsign"{print $3; exit}' $1)
tcaddress=$(awk '$1 == "Transcoder"{print $3}' $1) tcport=$(awk '$1 == "Port"{print $3; exit}' $1)
else else
echo "$1 not found" echo "$1 not found"
exit 1 exit 1
fi fi
else else
if [[ -e reflector/urfd.ini ]]; then if [[ -e reflector/urfd.ini ]]; then
callsign=$(awk '$1 == "Callsign"{print $3}' reflector/urfd.ini) callsign=$(awk '$1 == "Callsign"{print $3; exit}' reflector/urfd.ini)
tcaddress=$(awk '$1 == "Transcoder"{print $3}' reflector/urfd.ini) tcport=$(awk '$1 == "Port"{print $3; exit}' reflector/urfd.ini)
else else
echo "ERROR: could not find reflector/urfd.ini! You'll have to specify it." echo "ERROR: could not find reflector/urfd.ini! You'll have to specify it."
echo "Usage: ./radmin PATH-TO-INI-FILE" echo "Usage: ./radmin PATH-TO-INI-FILE"
@ -97,7 +94,7 @@ do
ps -aux | grep -e urfd -e tcd | grep -v grep | grep -v radmin ps -aux | grep -e urfd -e tcd | grep -v grep | grep -v radmin
fi fi
echo echo
echo " Reflector Administration, Version #230308" echo " Reflector Administration, Version #240808"
echo echo
git status | head -1 git status | head -1
echo echo
@ -116,13 +113,17 @@ do
else else
if [[ "$callsign" == URF* ]]; then if [[ "$callsign" == URF* ]]; then
if [ -e reflector/urfd ]; then if [ -e reflector/urfd ]; then
if [[ "$tcaddress" == none ]]; then if [[ "$tcport" == 0 ]]; then
echo "is : Install URF reflector without transcoder" echo "is : Install URF reflector without transcoder"
else else
if [ -e ../tcd/tcd ]; then if [ -e ../tcd/tcd ]; then
echo "is : Install URF reflector and transcoder" echo "is : Install URF reflector and transcoder"
else
echo "HELP! Transcoder port is set, but tcd executable not found!"
fi fi
fi fi
else
echo "HELP! urfd executable not found!"
fi fi
fi fi
fi fi

@ -85,11 +85,11 @@ void CClient::WriteXml(std::ofstream &xmlFile)
xmlFile << "\t<LinkedModule>" << m_ReflectorModule << "</LinkedModule>" << std::endl; xmlFile << "\t<LinkedModule>" << m_ReflectorModule << "</LinkedModule>" << std::endl;
xmlFile << "\t<Protocol>" << GetProtocolName() << "</Protocol>" << std::endl; xmlFile << "\t<Protocol>" << GetProtocolName() << "</Protocol>" << std::endl;
char mbstr[100]; char mbstr[100];
if (std::strftime(mbstr, sizeof(mbstr), "%A %c", std::localtime(&m_ConnectTime))) if (std::strftime(mbstr, sizeof(mbstr), "%FT%TZ", std::gmtime(&m_ConnectTime)))
{ {
xmlFile << "\t<ConnectTime>" << mbstr << "</ConnectTime>" << std::endl; xmlFile << "\t<ConnectTime>" << mbstr << "</ConnectTime>" << std::endl;
} }
if (std::strftime(mbstr, sizeof(mbstr), "%A %c", std::localtime(&m_LastHeardTime))) if (std::strftime(mbstr, sizeof(mbstr), "%FT%TZ", std::gmtime(&m_LastHeardTime)))
{ {
xmlFile << "\t<LastHeardTime>" << mbstr << "</LastHeardTime>" << std::endl; xmlFile << "\t<LastHeardTime>" << mbstr << "</LastHeardTime>" << std::endl;
} }

@ -819,21 +819,19 @@ bool CConfigure::isDefined(ErrorLevel level, const std::string &section, const s
return false; return false;
} }
void CConfigure::checkAutoLink(const std::string &section, const std::string &pname, const std::string &key, bool &rval) void CConfigure::checkAutoLink(const std::string &section, const std::string &pname, const std::string &key, bool &rval) const
{ {
if (data.contains(key)) const auto autolinkModule = GetAutolinkModule(key);
if (' ' != autolinkModule)
{ {
auto ismods = data.contains(g_Keys.modules.modules); auto ismods = data.contains(g_Keys.modules.modules);
const auto mods(ismods ? data[g_Keys.modules.modules].get<std::string>() : ""); const auto mods(ismods ? data[g_Keys.modules.modules].get<std::string>() : "");
const auto c = data[key].get<std::string>().at(0); if (std::string::npos == mods.find(autolinkModule))
if (std::string::npos == mods.find(c))
{ {
std::cerr << "ERROR: [" << section << ']' << pname << " module '" << c << "' not a configured module" << std::endl; std::cerr << "ERROR: [" << section << ']' << pname << " module '" << autolinkModule << "' not a configured module" << std::endl;
rval = true; rval = true;
} }
} }
else
data[key] = nullptr;
} }
std::string CConfigure::getDataRefreshType(ERefreshType type) const std::string CConfigure::getDataRefreshType(ERefreshType type) const
@ -988,7 +986,7 @@ bool CConfigure::GetBoolean(const std::string &key) const
char CConfigure::GetAutolinkModule(const std::string &key) const char CConfigure::GetAutolinkModule(const std::string &key) const
{ {
char c = 0; char c = ' ';
if (data.contains(key)) if (data.contains(key))
{ {
if (data[key].is_string()) if (data[key].is_string())

@ -57,5 +57,5 @@ private:
void checkFile(const std::string &section, const std::string &key, const std::string &filepath) const; void checkFile(const std::string &section, const std::string &key, const std::string &filepath) const;
void setAutolink(const std::string &section, const std::string &key, const std::string &value); void setAutolink(const std::string &section, const std::string &key, const std::string &value);
bool isDefined(ErrorLevel level, const std::string &section, const std::string &pname, const std::string &key, bool &rval); bool isDefined(ErrorLevel level, const std::string &section, const std::string &pname, const std::string &key, bool &rval);
void checkAutoLink(const std::string &section, const std::string &pname, const std::string &key, bool &rval); void checkAutoLink(const std::string &section, const std::string &pname, const std::string &key, bool &rval) const;
}; };

@ -62,7 +62,7 @@ CURLcode CCurlGet::GetURL(const std::string &url, std::stringstream &ss, long ti
} }
if (code != CURLE_OK) if (code != CURLE_OK)
{ {
std::cout << "ERROR: was not able retrieve data at '" << url << "'\nCurl returned: " << code << std::endl; std::cout << "WARNING: was not able retrieve data at '" << url << "'\nCurl returned: " << code << std::endl;
} }
return code; return code;
} }

@ -28,7 +28,7 @@ SJsonKeys g_Keys;
CReflector g_Reflector; CReflector g_Reflector;
CGateKeeper g_GateKeeper; CGateKeeper g_GateKeeper;
CConfigure g_Configure; CConfigure g_Configure;
CVersion g_Version(3,1,3); // The major byte should only change if the interlink packet changes! CVersion g_Version(3,1,4); // The major byte should only change if the interlink packet changes!
CLookupDmr g_LDid; CLookupDmr g_LDid;
CLookupNxdn g_LNid; CLookupNxdn g_LNid;
CLookupYsf g_LYtr; CLookupYsf g_LYtr;

@ -133,7 +133,7 @@ void CNXDNProtocol::Task(void)
auto newclient = std::make_shared<CNXDNClient>(Callsign, Ip); auto newclient = std::make_shared<CNXDNClient>(Callsign, Ip);
// aautolink, if enabled // aautolink, if enabled
if (m_AutolinkModule) if (' ' != m_AutolinkModule)
newclient->SetReflectorModule(m_AutolinkModule); newclient->SetReflectorModule(m_AutolinkModule);
// and append // and append

@ -122,7 +122,7 @@ void CP25Protocol::Task(void)
auto newclient = std::make_shared<CP25Client>(Callsign, Ip); auto newclient = std::make_shared<CP25Client>(Callsign, Ip);
// aautolink, if enabled // aautolink, if enabled
if (m_AutolinkModule) if (' ' != m_AutolinkModule)
newclient->SetReflectorModule(m_AutolinkModule); newclient->SetReflectorModule(m_AutolinkModule);
// and append // and append

@ -114,11 +114,11 @@ void CPeer::WriteXml(std::ofstream &xmlFile)
xmlFile << "\t<LinkedModule>" << m_ReflectorModules << "</LinkedModule>" << std::endl; xmlFile << "\t<LinkedModule>" << m_ReflectorModules << "</LinkedModule>" << std::endl;
xmlFile << "\t<Protocol>" << GetProtocolName() << "</Protocol>" << std::endl; xmlFile << "\t<Protocol>" << GetProtocolName() << "</Protocol>" << std::endl;
char mbstr[100]; char mbstr[100];
if (std::strftime(mbstr, sizeof(mbstr), "%A %c", std::localtime(&m_ConnectTime))) if (std::strftime(mbstr, sizeof(mbstr), "%FT%TZ", std::gmtime(&m_ConnectTime)))
{ {
xmlFile << "\t<ConnectTime>" << mbstr << "</ConnectTime>" << std::endl; xmlFile << "\t<ConnectTime>" << mbstr << "</ConnectTime>" << std::endl;
} }
if (std::strftime(mbstr, sizeof(mbstr), "%A %c", std::localtime(&m_LastHeardTime))) if (std::strftime(mbstr, sizeof(mbstr), "%FT%TZ", std::gmtime(&m_LastHeardTime)))
{ {
xmlFile << "\t<LastHeardTime>" << mbstr << "</LastHeardTime>" << std::endl; xmlFile << "\t<LastHeardTime>" << mbstr << "</LastHeardTime>" << std::endl;
} }

@ -532,9 +532,9 @@ void CReflector::PutDHTConfig()
std::ostringstream ss; std::ostringstream ss;
ss << g_Version; ss << g_Version;
cfg.version.assign(ss.str()); cfg.version.assign(ss.str());
cfg.almod[toUType(EUrfdAlMod::nxdn)] = g_Configure.GetString(g_Keys.nxdn.autolinkmod).at(0); cfg.almod[toUType(EUrfdAlMod::nxdn)] = g_Configure.GetAutolinkModule(g_Keys.nxdn.autolinkmod);
cfg.almod[toUType(EUrfdAlMod::p25)] = g_Configure.GetString(g_Keys.p25.autolinkmod).at(0); cfg.almod[toUType(EUrfdAlMod::p25)] = g_Configure.GetAutolinkModule(g_Keys.p25.autolinkmod);
cfg.almod[toUType(EUrfdAlMod::ysf)] = g_Configure.GetString(g_Keys.ysf.autolinkmod).at(0); cfg.almod[toUType(EUrfdAlMod::ysf)] = g_Configure.GetAutolinkModule(g_Keys.ysf.autolinkmod);
cfg.ysffreq[toUType(EUrfdTxRx::rx)] = g_Configure.GetUnsigned(g_Keys.ysf.defaultrxfreq); cfg.ysffreq[toUType(EUrfdTxRx::rx)] = g_Configure.GetUnsigned(g_Keys.ysf.defaultrxfreq);
cfg.ysffreq[toUType(EUrfdTxRx::tx)] = g_Configure.GetUnsigned(g_Keys.ysf.defaulttxfreq); cfg.ysffreq[toUType(EUrfdTxRx::tx)] = g_Configure.GetUnsigned(g_Keys.ysf.defaulttxfreq);
cfg.refid[toUType(EUrfdRefId::nxdn)] = g_Configure.GetUnsigned(g_Keys.nxdn.reflectorid); cfg.refid[toUType(EUrfdRefId::nxdn)] = g_Configure.GetUnsigned(g_Keys.nxdn.reflectorid);

@ -37,7 +37,6 @@ public:
void Close(); // close all open sockets void Close(); // close all open sockets
void Close(char module); // close a specific module void Close(char module); // close a specific module
void Close(int fd); // close a specific file descriptor void Close(int fd); // close a specific file descriptor
bool receive(int fd, STCPacket *packet);
// All bool functions, except Server Receive, return true if there was an error // All bool functions, except Server Receive, return true if there was an error
bool Send(const STCPacket *packet); bool Send(const STCPacket *packet);
@ -46,6 +45,7 @@ public:
char GetMod(int fd) const; char GetMod(int fd) const;
protected: protected:
bool receive(int fd, STCPacket *packet);
std::vector<struct pollfd> m_Pfd; std::vector<struct pollfd> m_Pfd;
std::string m_Modules; std::string m_Modules;
}; };

@ -70,7 +70,7 @@ void CUser::WriteXml(std::ofstream &xmlFile)
xmlFile << "\t<Via peer>" << m_Xlx << "</Via peer>" << std::endl; xmlFile << "\t<Via peer>" << m_Xlx << "</Via peer>" << std::endl;
char mbstr[100]; char mbstr[100];
if (std::strftime(mbstr, sizeof(mbstr), "%A %c", std::localtime(&m_LastHeardTime))) if (std::strftime(mbstr, sizeof(mbstr), "%FT%TZ", std::gmtime(&m_LastHeardTime)))
{ {
xmlFile << "\t<LastHeardTime>" << mbstr << "</LastHeardTime>" << std::endl; xmlFile << "\t<LastHeardTime>" << mbstr << "</LastHeardTime>" << std::endl;
} }

@ -164,7 +164,7 @@ void CYsfProtocol::Task(void)
auto newclient = std::make_shared<CYsfClient>(Callsign, Ip); auto newclient = std::make_shared<CYsfClient>(Callsign, Ip);
// aautolink, if enabled // aautolink, if enabled
if (m_AutolinkModule) if (' ' != m_AutolinkModule)
newclient->SetReflectorModule(m_AutolinkModule); newclient->SetReflectorModule(m_AutolinkModule);
// and append // and append

Loading…
Cancel
Save

Powered by TurnKey Linux.