1
0
Fork 0

Merge branch 'master' into IPv6

ycs232-kbc
Jonathan Naylor 4 years ago
commit 91f04abddb

@ -70,6 +70,7 @@ m_aprsPort(0U),
m_aprsSuffix(), m_aprsSuffix(),
m_aprsDescription(), m_aprsDescription(),
m_networkStartup(), m_networkStartup(),
m_networkOptions(),
m_networkInactivityTimeout(0U), m_networkInactivityTimeout(0U),
m_networkRevert(false), m_networkRevert(false),
m_networkDebug(false), m_networkDebug(false),
@ -234,6 +235,8 @@ bool CConf::read()
} else if (section == SECTION_NETWORK) { } else if (section == SECTION_NETWORK) {
if (::strcmp(key, "Startup") == 0) if (::strcmp(key, "Startup") == 0)
m_networkStartup = value; m_networkStartup = value;
else if (::strcmp(key, "Options") == 0)
m_networkOptions = value;
else if (::strcmp(key, "InactivityTimeout") == 0) else if (::strcmp(key, "InactivityTimeout") == 0)
m_networkInactivityTimeout = (unsigned int)::atoi(value); m_networkInactivityTimeout = (unsigned int)::atoi(value);
else if (::strcmp(key, "Revert") == 0) else if (::strcmp(key, "Revert") == 0)
@ -399,12 +402,12 @@ unsigned int CConf::getLogFileLevel() const
std::string CConf::getLogFilePath() const std::string CConf::getLogFilePath() const
{ {
return m_logFilePath; return m_logFilePath;
} }
std::string CConf::getLogFileRoot() const std::string CConf::getLogFileRoot() const
{ {
return m_logFileRoot; return m_logFileRoot;
} }
bool CConf::getAPRSEnabled() const bool CConf::getAPRSEnabled() const
@ -437,6 +440,11 @@ std::string CConf::getNetworkStartup() const
return m_networkStartup; return m_networkStartup;
} }
std::string CConf::getNetworkOptions() const
{
return m_networkOptions;
}
unsigned int CConf::getNetworkInactivityTimeout() const unsigned int CConf::getNetworkInactivityTimeout() const
{ {
return m_networkInactivityTimeout; return m_networkInactivityTimeout;
@ -459,7 +467,7 @@ bool CConf::getYSFNetworkEnabled() const
unsigned int CConf::getYSFNetworkPort() const unsigned int CConf::getYSFNetworkPort() const
{ {
return m_ysfNetworkPort; return m_ysfNetworkPort;
} }
std::string CConf::getYSFNetworkHosts() const std::string CConf::getYSFNetworkHosts() const

@ -67,6 +67,7 @@ public:
// The Network section // The Network section
std::string getNetworkStartup() const; std::string getNetworkStartup() const;
std::string getNetworkOptions() const;
unsigned int getNetworkInactivityTimeout() const; unsigned int getNetworkInactivityTimeout() const;
bool getNetworkRevert() const; bool getNetworkRevert() const;
bool getNetworkDebug() const; bool getNetworkDebug() const;
@ -134,6 +135,7 @@ private:
std::string m_aprsDescription; std::string m_aprsDescription;
std::string m_networkStartup; std::string m_networkStartup;
std::string m_networkOptions;
unsigned int m_networkInactivityTimeout; unsigned int m_networkInactivityTimeout;
bool m_networkRevert; bool m_networkRevert;
bool m_networkDebug; bool m_networkDebug;

@ -89,6 +89,7 @@ m_fcsNetwork(NULL),
m_linkType(LINK_NONE), m_linkType(LINK_NONE),
m_current(), m_current(),
m_startup(), m_startup(),
m_options(),
m_exclude(false), m_exclude(false),
m_inactivityTimer(1000U), m_inactivityTimer(1000U),
m_lostTimer(1000U, 120U), m_lostTimer(1000U, 120U),
@ -259,6 +260,7 @@ int CYSFGateway::run()
} }
m_startup = m_conf.getNetworkStartup(); m_startup = m_conf.getNetworkStartup();
m_options = m_conf.getNetworkOptions();
bool revert = m_conf.getNetworkRevert(); bool revert = m_conf.getNetworkRevert();
bool wiresXCommandPassthrough = m_conf.getWiresXCommandPassthrough(); bool wiresXCommandPassthrough = m_conf.getWiresXCommandPassthrough();
@ -808,6 +810,8 @@ void CYSFGateway::startupLinking()
m_linkType = LINK_NONE; m_linkType = LINK_NONE;
bool ok = m_fcsNetwork->writeLink(m_startup); bool ok = m_fcsNetwork->writeLink(m_startup);
m_fcsNetwork->setOptions(m_options);
if (ok) { if (ok) {
LogMessage("Automatic (re-)connection to %s", m_startup.c_str()); LogMessage("Automatic (re-)connection to %s", m_startup.c_str());
@ -828,6 +832,8 @@ void CYSFGateway::startupLinking()
if (reflector != NULL) { if (reflector != NULL) {
LogMessage("Automatic (re-)connection to %5.5s - \"%s\"", reflector->m_id.c_str(), reflector->m_name.c_str()); LogMessage("Automatic (re-)connection to %5.5s - \"%s\"", reflector->m_id.c_str(), reflector->m_name.c_str());
m_ysfNetwork->setOptions(m_options);
m_wiresX->setReflector(reflector); m_wiresX->setReflector(reflector);
m_ysfNetwork->setDestination(reflector->m_name, reflector->m_addr, reflector->m_addrLen); m_ysfNetwork->setDestination(reflector->m_name, reflector->m_addr, reflector->m_addrLen);

@ -59,6 +59,7 @@ private:
LINK_TYPE m_linkType; LINK_TYPE m_linkType;
std::string m_current; std::string m_current;
std::string m_startup; std::string m_startup;
std::string m_options;
bool m_exclude; bool m_exclude;
CTimer m_inactivityTimer; CTimer m_inactivityTimer;
CTimer m_lostTimer; CTimer m_lostTimer;

@ -39,6 +39,8 @@ Suffix=Y
[Network] [Network]
# Startup=FCS00120 # Startup=FCS00120
# Startup=Alabama-Link # Startup=Alabama-Link
# book DG-ID for Reflector
# Options=20;21;
InactivityTimeout=10 InactivityTimeout=10
Revert=0 Revert=0
Debug=0 Debug=0

@ -33,6 +33,7 @@ m_debug(debug),
m_addr(), m_addr(),
m_addrLen(0U), m_addrLen(0U),
m_poll(NULL), m_poll(NULL),
m_options(NULL),
m_unlink(NULL), m_unlink(NULL),
m_buffer(1000U, "YSF Network Buffer"), m_buffer(1000U, "YSF Network Buffer"),
m_pollTimer(1000U, 5U), m_pollTimer(1000U, 5U),
@ -45,12 +46,16 @@ m_linked(false)
m_unlink = new unsigned char[14U]; m_unlink = new unsigned char[14U];
::memcpy(m_unlink + 0U, "YSFU", 4U); ::memcpy(m_unlink + 0U, "YSFU", 4U);
m_options = new unsigned char[50U];
::memcpy(m_options + 0U, "YSFO", 4U);
std::string node = callsign; std::string node = callsign;
node.resize(YSF_CALLSIGN_LENGTH, ' '); node.resize(YSF_CALLSIGN_LENGTH, ' ');
for (unsigned int i = 0U; i < YSF_CALLSIGN_LENGTH; i++) { for (unsigned int i = 0U; i < YSF_CALLSIGN_LENGTH; i++) {
m_poll[i + 4U] = node.at(i); m_poll[i + 4U] = node.at(i);
m_unlink[i + 4U] = node.at(i); m_unlink[i + 4U] = node.at(i);
m_options[i + 4U] = node.at(i);
} }
} }
@ -60,6 +65,7 @@ m_debug(debug),
m_addr(), m_addr(),
m_addrLen(0U), m_addrLen(0U),
m_poll(NULL), m_poll(NULL),
m_options(NULL),
m_unlink(NULL), m_unlink(NULL),
m_buffer(1000U, "YSF Network Buffer"), m_buffer(1000U, "YSF Network Buffer"),
m_pollTimer(1000U, 5U), m_pollTimer(1000U, 5U),
@ -72,12 +78,16 @@ m_linked(false)
m_unlink = new unsigned char[14U]; m_unlink = new unsigned char[14U];
::memcpy(m_unlink + 0U, "YSFU", 4U); ::memcpy(m_unlink + 0U, "YSFU", 4U);
m_options = new unsigned char[50U];
::memcpy(m_options + 0U, "YSFO", 4U);
std::string node = callsign; std::string node = callsign;
node.resize(YSF_CALLSIGN_LENGTH, ' '); node.resize(YSF_CALLSIGN_LENGTH, ' ');
for (unsigned int i = 0U; i < YSF_CALLSIGN_LENGTH; i++) { for (unsigned int i = 0U; i < YSF_CALLSIGN_LENGTH; i++) {
m_poll[i + 4U] = node.at(i); m_poll[i + 4U] = node.at(i);
m_unlink[i + 4U] = node.at(i); m_unlink[i + 4U] = node.at(i);
m_options[i + 4U] = node.at(i);
} }
} }
@ -131,6 +141,22 @@ void CYSFNetwork::writePoll(unsigned int count)
for (unsigned int i = 0U; i < count; i++) for (unsigned int i = 0U; i < count; i++)
m_socket.write(m_poll, 14U, m_addr, m_addrLen); m_socket.write(m_poll, 14U, m_addr, m_addrLen);
if (m_options != NULL)
m_socket.write(m_options, 50U, m_addr, m_addrLen);
}
void CYSFNetwork::setOptions(const std::string& options)
{
std::string opt = options;
if (opt.size() < 1)
return;
opt.resize(50, ' ');
for (unsigned int i = 0U; i < (50 - 4 - YSF_CALLSIGN_LENGTH); i++)
m_options[i + 4U + YSF_CALLSIGN_LENGTH] = opt.at(i);
} }
void CYSFNetwork::writeUnlink(unsigned int count) void CYSFNetwork::writeUnlink(unsigned int count)
@ -172,6 +198,9 @@ void CYSFNetwork::clock(unsigned int ms)
LogMessage("Linked to %s", m_name.c_str()); LogMessage("Linked to %s", m_name.c_str());
m_linked = true; m_linked = true;
if (m_options != NULL)
m_socket.write(m_options, 50U, m_addr, m_addrLen);
} }
if (m_debug) if (m_debug)

@ -41,6 +41,7 @@ public:
void write(const unsigned char* data); void write(const unsigned char* data);
void writePoll(unsigned int count = 1U); void writePoll(unsigned int count = 1U);
void setOptions(const std::string& options = NULL);
void writeUnlink(unsigned int count = 1U); void writeUnlink(unsigned int count = 1U);
unsigned int read(unsigned char* data); unsigned int read(unsigned char* data);
@ -55,6 +56,7 @@ private:
sockaddr_storage m_addr; sockaddr_storage m_addr;
unsigned int m_addrLen; unsigned int m_addrLen;
unsigned char* m_poll; unsigned char* m_poll;
unsigned char* m_options;
unsigned char* m_unlink; unsigned char* m_unlink;
CRingBuffer<unsigned char> m_buffer; CRingBuffer<unsigned char> m_buffer;
CTimer m_pollTimer; CTimer m_pollTimer;

@ -172,12 +172,12 @@ unsigned int CConf::getLogFileLevel() const
std::string CConf::getLogFilePath() const std::string CConf::getLogFilePath() const
{ {
return m_logFilePath; return m_logFilePath;
} }
std::string CConf::getLogFileRoot() const std::string CConf::getLogFileRoot() const
{ {
return m_logFileRoot; return m_logFileRoot;
} }
unsigned int CConf::getNetworkPort() const unsigned int CConf::getNetworkPort() const

Loading…
Cancel
Save