fixed some problems Doug found

pull/1/head
Tom Early 3 years ago
parent 217db1c376
commit 67fad002d3

@ -86,6 +86,8 @@ This will create seven files:
6. The `urfd.mk` file contains compile-time options for *urfd*. If you change the `BINDIR`, you'll need to update how `urfd.service` starts *urfd*.
7. The `urfd.ini` file contains the run-time options for *urfd* and will be discussed below.
You can acutally put the blacklist, whitelist, interlink, terminal and ini file anyplace and even rename them. Just make sure your ini file and service file have the proper, fully-qualified paths. The service file and the mk file need to be in your `urfd/Reflector` directory.
When you are done with the configuration files and ready to start the installation process, you can return to the main repository directory:
@ -113,6 +115,19 @@ There are three databases needed by *urfd*:
3. The *YSF Tx/Rx* database maps a callsign to a transmit/receive RF frequencies.
These databases can come from a URL or a file, or both. If you specify "both", then the file will be read after the URL.
#### Special *USRP* configuration
If configured, a *USRP* client is very unique. A *USRP* client (an AllStar node) doesn't support any connect or disconnect protocol. The USRP client simply sends and receives *USRP* voice packets. That means, if *USRP* is enabled, the client is created during initialization using the configured callsign, IP address and Tx/Rx ports.
If `FilePath` is defined, this should point to a text file listing special, listen-only client(s), one per line. Each line defining a read-only client contains an IP address, a port number, and a callsign. Here is an example:
```bash
1.2.3.1;34001;ALLSTR1;
1.2.3.4;34004;ALLSTR4;
```
If you want to create listen-only clients, but you don't need a configured read/write client, then set its `Callsign` to `NONE`.
### Helper apps
There are two, very useful helper applications, *inicheck* and *dbutil*. Both apps will show you a usage message if you execuate them without any arguments.
@ -126,7 +141,7 @@ The *dbutil* app can be used for serveral tasks relating to the three databases
- INIFLILE is the path to the infile that defines the location of the http and file sources for these three databases.
One at a time, *dbutil* can work with any of the three DATABASEs. It can read either the http or the file SOURCE. It can either show you the data entries that are syntactically correct or incorrect (ACTION).
### installing your system
### Installing your system
After you have written your configutation files, you can install your system:

@ -80,6 +80,7 @@ Port = 10017
[USRP]
Enable = false
IPAddress = 1.2.3.4 # the IP address of the USRP client (the Allstar node)
RxPort = 34000
TxPort = 32000
Module = A # this has to be a transcoded module!

@ -51,6 +51,7 @@
#define JG3 "G3"
#define JG3TERMINALPATH "G3TerminalPath"
#define JINTERLINKPATH "InterlinkPath"
#define JIPADDRESS "IPAddress"
#define JIPADDRESSES "IP Addresses"
#define JIPV4BINDING "IPv4Binding"
#define JIPV4EXTERNAL "IPv4External"
@ -398,6 +399,8 @@ bool CConfigure::ReadData(const std::string &path)
case ESection::usrp:
if (0 == key.compare(JENABLE))
data[g_Keys.usrp.enable] = IS_TRUE(value[0]);
else if (0 == key.compare(JIPADDRESS))
data[g_Keys.usrp.ip] = value;
else if (0 == key.compare(JTXPORT))
data[g_Keys.usrp.txport] = getUnsigned(value, "USRP TxPort", 1024, 65535, 32000);
else if (0 == key.compare(JRXPORT))
@ -688,6 +691,15 @@ bool CConfigure::ReadData(const std::string &path)
rval = true;
}
}
if (isDefined(ErrorLevel::fatal, JUSRP, JIPADDRESS, g_Keys.usrp.ip, rval))
{
// check for syntax
if (! std::regex_match(data[g_Keys.usrp.ip].get<std::string>(), IPv4RegEx))
{
std::cerr << "ERROR: [" << JUSRP << ']' << JIPADDRESS " '" << data[g_Keys.usrp.ip] << "' is malformed" << std::endl;
rval = true;
}
}
isDefined(ErrorLevel::fatal, JUSRP, JTXPORT, g_Keys.usrp.txport, rval);
isDefined(ErrorLevel::fatal, JUSRP, JRXPORT, g_Keys.usrp.rxport, rval);
isDefined(ErrorLevel::fatal, JUSRP, JCALLSIGN, g_Keys.usrp.callsign, rval);
@ -750,7 +762,6 @@ bool CConfigure::ReadData(const std::string &path)
checkFile(JFILES, JG3TERMINALPATH, data[g_Keys.files.terminal]);
}
return rval;
}
@ -883,6 +894,11 @@ ERefreshType CConfigure::GetRefreshType(const std::string &key) const
return type;
}
bool CConfigure::Contains(const std::string &key) const
{
return data.contains(key);
}
std::string CConfigure::GetString(const std::string &key) const
{
std::string str;
@ -917,11 +933,11 @@ unsigned CConfigure::GetUnsigned(const std::string &key) const
u = data[key].get<unsigned>();
}
else
std::cerr << "ERROR: GetString(): '" << key << "' is not an unsigned value" << std::endl;
std::cerr << "ERROR: GetUnsigned(): '" << key << "' is not an unsigned value" << std::endl;
}
else
{
std::cerr << "ERROR: GetString(): item at '" << key << "' is not defined" << std::endl;
std::cerr << "ERROR: GetUnsigned(): item at '" << key << "' is not defined" << std::endl;
}
return u;
}

@ -34,6 +34,7 @@ class CConfigure
public:
CConfigure();
bool ReadData(const std::string &path);
bool Contains(const std::string &key) const;
void Dump(bool justpublic) const;
std::string GetString(const std::string &key) const;
unsigned GetUnsigned(const std::string &key) const;

@ -49,8 +49,8 @@ struct SJsonKeys {
modules { "Modules", "TranscodedModules",
"DescriptionA", "DescriptionB", "DescriptionC", "DescriptionD", "DescriptionE", "DescriptionF", "DescriptionG", "DescriptionH", "DescriptionI", "DescriptionJ", "DescriptionK", "DescriptionL", "DescriptionM", "DescriptionN", "DescriptionO", "DescriptionP", "DescriptionQ", "DescriptionR", "DescriptionS", "DescriptionT", "DescriptionU", "DescriptionV", "DescriptionW", "DescriptionX", "DescriptionY", "DescriptionZ" };
struct USRP { const std::string enable, txport,rxport, module, callsign, filepath; }
usrp { "usrpEnable", "urspTxPort", "usrpRxPort", "usrpModule", "usrpCallsign", "usrpFilePath" };
struct USRP { const std::string enable, ip, txport, rxport, module, callsign, filepath; }
usrp { "usrpEnable", "usrpIpAddress", "urspTxPort", "usrpRxPort", "usrpModule", "usrpCallsign", "usrpFilePath" };
struct P25NXDN { const std::string port, autolinkmod, reflectorid; }
p25 { "P25Port", "P25AutolinkMod", "P25ReflectorID" },

@ -51,8 +51,9 @@ void CLookupYsf::UpdateContent(std::stringstream &ss, Eaction action)
std::getline(iss, tx_str, ';');
std::getline(iss, rx_str, ';');
cs.SetCallsign(cs_str, false);
auto ltx = atol(tx_str.c_str());
auto lrx = atol(rx_str.c_str());
auto ltx = atoll(tx_str.c_str());
auto lrx = atoll(rx_str.c_str());
unsigned x = sizeof(lrx);
if (ltx > 40000000 && ltx < 0x100000000 && lrx > 40000000 && lrx < 0x100000000 && cs.IsValid())
{
if (Eaction::parse == action)

@ -104,7 +104,7 @@ bool CReflector::Start(void)
}
}
// start the reporting threads
// start the reporting thread
try
{
m_XmlReportFuture = std::async(std::launch::async, &CReflector::XmlReportThread, this);
@ -298,8 +298,16 @@ void CReflector::RouterThread(const char ThisModule)
void CReflector::XmlReportThread()
{
const std::string xmlpath(g_Configure.GetString(g_Keys.files.xml));
const std::string jsnpath(g_Configure.GetString(g_Keys.files.json));
std::string xmlpath, jsonpath;
if (g_Configure.Contains(g_Keys.files.xml))
xmlpath.assign(g_Configure.GetString(g_Keys.files.xml));
if (g_Configure.Contains(g_Keys.files.json))
jsonpath.assign(g_Configure.GetString(g_Keys.files.json));
if (xmlpath.empty() && jsonpath.empty())
return; // nothing to do
while (keep_running)
{
// report to xml file
@ -322,12 +330,12 @@ void CReflector::XmlReportThread()
}
// json report
if (! jsnpath.empty())
if (! jsonpath.empty())
{
nlohmann::json jreport;
JsonReport(jreport);
std::ofstream jsonFile;
jsonFile.open(jsnpath, std::ios::out | std::ios::trunc);
jsonFile.open(jsonpath, std::ios::out | std::ios::trunc);
if (jsonFile.is_open())
{
jsonFile << jreport.dump();

@ -49,15 +49,20 @@ bool CUSRPProtocol::Initialize(const char *type, const EProtocol ptype, const ui
m_Module = g_Configure.GetAutolinkModule(g_Keys.usrp.module);
// create the one special USRP Tx/Rx client
m_Callsign.SetCallsign(g_Configure.GetString(g_Keys.usrp.callsign), false);
CIp ip(AF_INET, uint16_t(g_Configure.GetUnsigned(g_Keys.usrp.txport)), g_Configure.GetString(g_Keys.ip.ipv4bind).c_str());
auto newclient = std::make_shared<CUSRPClient>(m_Callsign, ip);
newclient->SetReflectorModule(m_Module);
g_Reflector.GetClients()->AddClient(newclient);
g_Reflector.ReleaseClients();
auto scs = g_Configure.GetString(g_Keys.usrp.callsign);
if (scs.compare("NONE"))
{
m_Callsign.SetCallsign(scs, false);
CIp ip(AF_INET, uint16_t(g_Configure.GetUnsigned(g_Keys.usrp.txport)), g_Configure.GetString(g_Keys.usrp.ip).c_str());
auto newclient = std::make_shared<CUSRPClient>(m_Callsign, ip);
newclient->SetReflectorModule(m_Module);
g_Reflector.GetClients()->AddClient(newclient);
g_Reflector.ReleaseClients();
}
// now create "listen-only" clients, as many as specified
file.open(g_Configure.GetString(g_Keys.usrp.filepath), std::ios::in | std::ios::binary | std::ios::ate);
if (g_Configure.Contains(g_Keys.usrp.filepath))
file.open(g_Configure.GetString(g_Keys.usrp.filepath), std::ios::in | std::ios::binary | std::ios::ate);
if ( file.is_open() )
{
// read file

Loading…
Cancel
Save

Powered by TurnKey Linux.