1
0
Fork 0

First compiling version.

ycs232-kbc
Jonathan Naylor 4 years ago
parent af2be04fc8
commit 852a3a0518

1
.gitignore vendored

@ -13,6 +13,7 @@ x64
*.user *.user
*.VC.db *.VC.db
.vs .vs
DGIdGateway/DGIdGateway
YSFGateway/YSFGateway YSFGateway/YSFGateway
YSFParrot/YSFParrot YSFParrot/YSFParrot
YSFReflector/YSFReflector YSFReflector/YSFReflector

@ -19,6 +19,7 @@
#include "YSFReflectors.h" #include "YSFReflectors.h"
#include "DGIdGateway.h" #include "DGIdGateway.h"
#include "DGIdNetwork.h" #include "DGIdNetwork.h"
#include "IMRSNetwork.h"
#include "YSFNetwork.h" #include "YSFNetwork.h"
#include "FCSNetwork.h" #include "FCSNetwork.h"
#include "UDPSocket.h" #include "UDPSocket.h"
@ -171,7 +172,6 @@ int CDGIdGateway::run()
::close(STDERR_FILENO); ::close(STDERR_FILENO);
} }
#endif #endif
m_callsign = m_conf.getCallsign(); m_callsign = m_conf.getCallsign();
m_suffix = m_conf.getSuffix(); m_suffix = m_conf.getSuffix();
@ -181,9 +181,7 @@ int CDGIdGateway::run()
std::string myAddress = m_conf.getMyAddress(); std::string myAddress = m_conf.getMyAddress();
unsigned int myPort = m_conf.getMyPort(); unsigned int myPort = m_conf.getMyPort();
CYSFNetwork rptNetwork(myAddress, myPort, m_callsign, debug); CYSFNetwork rptNetwork(myAddress, myPort, "MMDVM", rptAddress, rptPort, m_callsign, debug);
rptNetwork.setDestination("MMDVM", rptAddress, rptPort);
ret = rptNetwork.open(); ret = rptNetwork.open();
if (!ret) { if (!ret) {
::LogError("Cannot open the repeater network port"); ::LogError("Cannot open the repeater network port");
@ -192,7 +190,6 @@ int CDGIdGateway::run()
} }
std::string fileName = m_conf.getYSFNetHosts(); std::string fileName = m_conf.getYSFNetHosts();
CYSFReflectors* reflectors = new CYSFReflectors(fileName); CYSFReflectors* reflectors = new CYSFReflectors(fileName);
reflectors->load(); reflectors->load();
@ -230,33 +227,27 @@ int CDGIdGateway::run()
CYSFReflector* reflector = reflectors->findByName(name); CYSFReflector* reflector = reflectors->findByName(name);
if (reflector != NULL) { if (reflector != NULL) {
CYSFNetwork* ysf = new CYSFNetwork(local, m_callsign, debug); dgIdNetwork[dgid] = new CYSFNetwork(local, reflector->m_name, reflector->m_address, reflector->m_port, m_callsign, debug);;
ysf->setDestination(reflector->m_name, reflector->m_address, reflector->m_port);
dgIdNetwork[dgid] = ysf;
dgIdNetwork[dgid]->m_modes = YSF_DT_VD_MODE1 | YSF_DT_VD_MODE2 | YSF_DT_VOICE_FR_MODE | YSF_DT_DATA_FR_MODE; dgIdNetwork[dgid]->m_modes = YSF_DT_VD_MODE1 | YSF_DT_VD_MODE2 | YSF_DT_VOICE_FR_MODE | YSF_DT_DATA_FR_MODE;
dgIdNetwork[dgid]->m_static = statc; dgIdNetwork[dgid]->m_static = statc;
dgIdNetwork[dgid]->m_rfHangTime = rfHangTime; dgIdNetwork[dgid]->m_rfHangTime = rfHangTime;
dgIdNetwork[dgid]->m_netHangTime = netHangTime; dgIdNetwork[dgid]->m_netHangTime = netHangTime;
} }
/*
} else if (type == "IMRS") { } else if (type == "IMRS") {
dgIdNetwork[dgid] = new CIMRSNetwork; std::vector<IMRSDestination*> destinations = (*it)->m_destinations;
dgIdNetwork[dgid] = new CIMRSNetwork(destinations, debug);
dgIdNetwork[dgid]->m_modes = YSF_DT_VD_MODE1 | YSF_DT_VD_MODE2 | YSF_DT_VOICE_FR_MODE | YSF_DT_DATA_FR_MODE; dgIdNetwork[dgid]->m_modes = YSF_DT_VD_MODE1 | YSF_DT_VD_MODE2 | YSF_DT_VOICE_FR_MODE | YSF_DT_DATA_FR_MODE;
dgIdNetwork[dgid]->m_static = statc; dgIdNetwork[dgid]->m_static = statc;
dgIdNetwork[dgid]->m_rfHangTime = rfHangTime; dgIdNetwork[dgid]->m_rfHangTime = rfHangTime;
dgIdNetwork[dgid]->m_netHangTime = netHangTime; dgIdNetwork[dgid]->m_netHangTime = netHangTime;
*/
} else if (type == "Parrot") { } else if (type == "Parrot") {
in_addr address = CUDPSocket::lookup((*it)->m_address); in_addr address = CUDPSocket::lookup((*it)->m_address);
unsigned int port = (*it)->m_port; unsigned int port = (*it)->m_port;
unsigned int local = (*it)->m_local; unsigned int local = (*it)->m_local;
if (address.s_addr != INADDR_NONE) { if (address.s_addr != INADDR_NONE) {
CYSFNetwork* ysf = new CYSFNetwork(local, m_callsign, debug); dgIdNetwork[dgid] = new CYSFNetwork(local, "PARROT", address, port, m_callsign, debug);;
ysf->setDestination("PARROT", address, port);
dgIdNetwork[dgid] = ysf;
dgIdNetwork[dgid]->m_modes = YSF_DT_VD_MODE1 | YSF_DT_VD_MODE2 | YSF_DT_VOICE_FR_MODE | YSF_DT_DATA_FR_MODE; dgIdNetwork[dgid]->m_modes = YSF_DT_VD_MODE1 | YSF_DT_VD_MODE2 | YSF_DT_VOICE_FR_MODE | YSF_DT_DATA_FR_MODE;
dgIdNetwork[dgid]->m_static = statc; dgIdNetwork[dgid]->m_static = statc;
dgIdNetwork[dgid]->m_rfHangTime = rfHangTime; dgIdNetwork[dgid]->m_rfHangTime = rfHangTime;
@ -268,10 +259,7 @@ int CDGIdGateway::run()
unsigned int local = (*it)->m_local; unsigned int local = (*it)->m_local;
if (address.s_addr != INADDR_NONE) { if (address.s_addr != INADDR_NONE) {
CYSFNetwork* ysf = new CYSFNetwork(local, m_callsign, debug); dgIdNetwork[dgid] = new CYSFNetwork(local, "YSF2DMR", address, port, m_callsign, debug);;
ysf->setDestination("YSF2DMR", address, port);
dgIdNetwork[dgid] = ysf;
dgIdNetwork[dgid]->m_modes = YSF_DT_VD_MODE1 | YSF_DT_VD_MODE2; dgIdNetwork[dgid]->m_modes = YSF_DT_VD_MODE1 | YSF_DT_VD_MODE2;
dgIdNetwork[dgid]->m_static = statc; dgIdNetwork[dgid]->m_static = statc;
dgIdNetwork[dgid]->m_rfHangTime = rfHangTime; dgIdNetwork[dgid]->m_rfHangTime = rfHangTime;
@ -283,10 +271,7 @@ int CDGIdGateway::run()
unsigned int local = (*it)->m_local; unsigned int local = (*it)->m_local;
if (address.s_addr != INADDR_NONE) { if (address.s_addr != INADDR_NONE) {
CYSFNetwork* ysf = new CYSFNetwork(local, m_callsign, debug); dgIdNetwork[dgid] = new CYSFNetwork(local, "YSF2NXDN", address, port, m_callsign, debug);;
ysf->setDestination("YSF2NXDN", address, port);
dgIdNetwork[dgid] = ysf;
dgIdNetwork[dgid]->m_modes = YSF_DT_VD_MODE1 | YSF_DT_VD_MODE2; dgIdNetwork[dgid]->m_modes = YSF_DT_VD_MODE1 | YSF_DT_VD_MODE2;
dgIdNetwork[dgid]->m_static = statc; dgIdNetwork[dgid]->m_static = statc;
dgIdNetwork[dgid]->m_rfHangTime = rfHangTime; dgIdNetwork[dgid]->m_rfHangTime = rfHangTime;
@ -298,10 +283,7 @@ int CDGIdGateway::run()
unsigned int local = (*it)->m_local; unsigned int local = (*it)->m_local;
if (address.s_addr != INADDR_NONE) { if (address.s_addr != INADDR_NONE) {
CYSFNetwork* ysf = new CYSFNetwork(local, m_callsign, debug); dgIdNetwork[dgid] = new CYSFNetwork(local, "YSF2P25", address, port, m_callsign, debug);;
ysf->setDestination("YSF2P25", address, port);
dgIdNetwork[dgid] = ysf;
dgIdNetwork[dgid]->m_modes = YSF_DT_VOICE_FR_MODE; dgIdNetwork[dgid]->m_modes = YSF_DT_VOICE_FR_MODE;
dgIdNetwork[dgid]->m_static = statc; dgIdNetwork[dgid]->m_static = statc;
dgIdNetwork[dgid]->m_rfHangTime = rfHangTime; dgIdNetwork[dgid]->m_rfHangTime = rfHangTime;
@ -370,11 +352,11 @@ int CDGIdGateway::run()
if (currentDGId != 0U && dgIdNetwork[currentDGId] != NULL) { if (currentDGId != 0U && dgIdNetwork[currentDGId] != NULL) {
// Only allow the wanted modes through // Only allow the wanted modes through
if ((dgIdNetwork[currentDGId]->m_modes & dt) != 0U) { if ((dgIdNetwork[currentDGId]->m_modes & dt) != 0U)
dgIdNetwork[currentDGId]->write(currentDGId, buffer); dgIdNetwork[currentDGId]->write(currentDGId, buffer);
inactivityTimer.setTimeout(dgIdNetwork[currentDGId]->m_rfHangTime);
inactivityTimer.start(); inactivityTimer.setTimeout(dgIdNetwork[currentDGId]->m_rfHangTime);
} inactivityTimer.start();
} }
} }
@ -397,6 +379,7 @@ int CDGIdGateway::run()
fich.encode(buffer + 35U); fich.encode(buffer + 35U);
rptNetwork.write(0U, buffer); rptNetwork.write(0U, buffer);
inactivityTimer.setTimeout(dgIdNetwork[i]->m_netHangTime); inactivityTimer.setTimeout(dgIdNetwork[i]->m_netHangTime);
inactivityTimer.start(); inactivityTimer.start();
@ -414,10 +397,12 @@ int CDGIdGateway::run()
stopWatch.start(); stopWatch.start();
rptNetwork.clock(ms); rptNetwork.clock(ms);
for (unsigned int i = 0U; i < 100U; i++) {
for (unsigned int i = 1U; i < 100U; i++) {
if (dgIdNetwork[i] != NULL) if (dgIdNetwork[i] != NULL)
dgIdNetwork[i]->clock(ms); dgIdNetwork[i]->clock(ms);
} }
if (m_writer != NULL) if (m_writer != NULL)
m_writer->clock(ms); m_writer->clock(ms);
@ -428,7 +413,7 @@ int CDGIdGateway::run()
dgIdNetwork[currentDGId]->unlink(); dgIdNetwork[currentDGId]->unlink();
dgIdNetwork[currentDGId]->unlink(); dgIdNetwork[currentDGId]->unlink();
} }
}
LogDebug("DG-ID set to 0 via timeout"); LogDebug("DG-ID set to 0 via timeout");
currentDGId = 0U; currentDGId = 0U;

@ -53,6 +53,8 @@ m_state(FCS_UNLINKED)
::memcpy(m_ping + 4U, callsign.c_str(), callsign.size()); ::memcpy(m_ping + 4U, callsign.c_str(), callsign.size());
::memset(m_ping + 10U, 0x00U, 15U); ::memset(m_ping + 10U, 0x00U, 15U);
::memcpy(m_ping + 10U, reflector.c_str(), 8U); ::memcpy(m_ping + 10U, reflector.c_str(), 8U);
m_print = reflector.substr(0U, 6U) + "-" + reflector.substr(6U);
} }
CFCSNetwork::~CFCSNetwork() CFCSNetwork::~CFCSNetwork()
@ -79,7 +81,7 @@ bool CFCSNetwork::open()
return m_socket.open(); return m_socket.open();
} }
void CFCSNetwork::write(const unsigned char* data) void CFCSNetwork::write(unsigned int dgid, const unsigned char* data)
{ {
assert(data != NULL); assert(data != NULL);
@ -99,29 +101,26 @@ void CFCSNetwork::write(const unsigned char* data)
void CFCSNetwork::link() void CFCSNetwork::link()
{ {
if (m_state != FCS_LINKED) { if (m_state == FCS_LINKING || m_state == FCS_LINKED)
std::string name = m_reflector.substr(0U, 6U); return;
if (m_addresses.count(name) == 0U) {
LogError("Unknown FCS reflector - %s", name.c_str()); std::string name = m_reflector.substr(0U, 6U);
return; if (m_addresses.count(name) == 0U) {
} LogError("Unknown FCS reflector - %s", name.c_str());
return;
m_address = m_addresses[name];
if (m_address.s_addr == INADDR_NONE) {
LogError("FCS reflector %s has no address", name.c_str());
return;
}
} }
m_print = m_reflector.substr(0U, 6U) + "-" + m_reflector.substr(6U); m_address = m_addresses[name];
if (m_address.s_addr == INADDR_NONE) {
LogError("FCS reflector %s has no address", name.c_str());
return;
}
m_state = FCS_LINKING; m_state = FCS_LINKING;
m_pingTimer.start(); m_pingTimer.start();
writePing(); writePing();
return true;
} }
void CFCSNetwork::unlink() void CFCSNetwork::unlink()
@ -183,7 +182,7 @@ void CFCSNetwork::clock(unsigned int ms)
} }
} }
unsigned int CFCSNetwork::read(unsigned char* data) unsigned int CFCSNetwork::read(unsigned int dgid, unsigned char* data)
{ {
assert(data != NULL); assert(data != NULL);

@ -0,0 +1,72 @@
/*
* Copyright (C) 2009-2014,2016,2017,2018,2020 by Jonathan Naylor G4KLX
*
* This program 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 2 of the License, or
* (at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "IMRSNetwork.h"
#include "YSFDefines.h"
#include "Utils.h"
#include "Log.h"
#include <cstdio>
#include <cassert>
#include <cstring>
CIMRSNetwork::CIMRSNetwork(const std::vector<IMRSDestination*>& destinations, bool debug)
{
}
CIMRSNetwork::~CIMRSNetwork()
{
}
bool CIMRSNetwork::open()
{
LogMessage("Opening IMRS network connection");
return true;
}
void CIMRSNetwork::write(unsigned int dgid, const unsigned char* data)
{
assert(data != NULL);
}
void CIMRSNetwork::link()
{
}
void CIMRSNetwork::unlink()
{
}
void CIMRSNetwork::clock(unsigned int ms)
{
}
unsigned int CIMRSNetwork::read(unsigned int dgid, unsigned char* data)
{
assert(data != NULL);
return 0U;
}
void CIMRSNetwork::close()
{
LogMessage("Closing IMRS network connection");
}

@ -0,0 +1,51 @@
/*
* Copyright (C) 2009-2014,2016,2017,2018,2020 by Jonathan Naylor G4KLX
*
* This program 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 2 of the License, or
* (at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef IMRSNetwork_H
#define IMRSNetwork_H
#include "DGIdNetwork.h"
#include "YSFDefines.h"
#include "Conf.h"
#include <cstdint>
#include <string>
class CIMRSNetwork : public CDGIdNetwork {
public:
CIMRSNetwork(const std::vector<IMRSDestination*>& destinations, bool debug);
virtual ~CIMRSNetwork();
virtual bool open();
virtual void link();
virtual void write(unsigned int dgId, const unsigned char* data);
virtual unsigned int read(unsigned int dgId, unsigned char* data);
virtual void clock(unsigned int ms);
virtual void unlink();
virtual void close();
private:
};
#endif

@ -11,8 +11,9 @@ LIBS = -lm -lpthread
LDFLAGS = -g LDFLAGS = -g
OBJECTS = APRSWriter.o Conf.o CRC.o DGIdGateway.o DGIdNetwork.o FCSNetwork.o Golay24128.o GPS.o Log.o StopWatch.o Sync.o Thread.o Timer.o \ OBJECTS = APRSWriter.o Conf.o CRC.o DGIdGateway.o DGIdNetwork.o FCSNetwork.o Golay24128.o GPS.o IMRSNetwork.o \
UDPSocket.o Utils.o YSFConvolution.o YSFFICH.o YSFNetwork.o YSFPayload.o YSFReflectors.o Log.o StopWatch.o Sync.o Thread.o Timer.o UDPSocket.o Utils.o YSFConvolution.o YSFFICH.o YSFNetwork.o \
YSFPayload.o YSFReflectors.o
all: DGIdGateway all: DGIdGateway

@ -19,6 +19,6 @@
#if !defined(VERSION_H) #if !defined(VERSION_H)
#define VERSION_H #define VERSION_H
const char* VERSION = "20200803"; const char* VERSION = "20200819";
#endif #endif

@ -111,7 +111,7 @@ bool CYSFFICH::decode(const unsigned char* bytes)
m_fich[4U] = ((b2 << 4) & 0xF0U) | ((b3 >> 8) & 0x0FU); m_fich[4U] = ((b2 << 4) & 0xF0U) | ((b3 >> 8) & 0x0FU);
m_fich[5U] = (b3 >> 0) & 0xFFU; m_fich[5U] = (b3 >> 0) & 0xFFU;
return CCRC::checkCCITT162(m_fich, 6U); return CCRC::checkCCITT16(m_fich, 6U);
} }
void CYSFFICH::encode(unsigned char* bytes) void CYSFFICH::encode(unsigned char* bytes)
@ -121,7 +121,7 @@ void CYSFFICH::encode(unsigned char* bytes)
// Skip the sync bytes // Skip the sync bytes
bytes += YSF_SYNC_LENGTH_BYTES; bytes += YSF_SYNC_LENGTH_BYTES;
CCRC::addCCITT162(m_fich, 6U); CCRC::addCCITT16(m_fich, 6U);
unsigned int b0 = ((m_fich[0U] << 4) & 0xFF0U) | ((m_fich[1U] >> 4) & 0x00FU); unsigned int b0 = ((m_fich[0U] << 4) & 0xFF0U) | ((m_fich[1U] >> 4) & 0x00FU);
unsigned int b1 = ((m_fich[1U] << 8) & 0xF00U) | ((m_fich[2U] >> 0) & 0x0FFU); unsigned int b1 = ((m_fich[1U] << 8) & 0xF00U) | ((m_fich[2U] >> 0) & 0x0FFU);

@ -27,16 +27,16 @@
const unsigned int BUFFER_LENGTH = 200U; const unsigned int BUFFER_LENGTH = 200U;
CYSFNetwork::CYSFNetwork(const std::string& address, unsigned int port, const std::string& callsign, bool debug) : CYSFNetwork::CYSFNetwork(const std::string& localAddress, unsigned int localPort, const std::string& name, const in_addr& address, unsigned int port, const std::string& callsign, bool debug) :
m_socket(address, port), m_socket(localAddress, localPort),
m_debug(debug), m_debug(debug),
m_address(), m_address(address),
m_port(0U), m_port(port),
m_poll(NULL), m_poll(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),
m_name(), m_name(name),
m_linked(false) m_linked(false)
{ {
m_poll = new unsigned char[14U]; m_poll = new unsigned char[14U];
@ -49,20 +49,22 @@ m_linked(false)
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);
} }
} }
CYSFNetwork::CYSFNetwork(unsigned int port, const std::string& callsign, bool debug) : CYSFNetwork::CYSFNetwork(unsigned int localPort, const std::string& name, const in_addr& address, unsigned int port, const std::string& callsign, bool debug) :
m_socket(port), m_socket(localPort),
m_debug(debug), m_debug(debug),
m_address(), m_address(address),
m_port(0U), m_port(port),
m_poll(NULL), m_poll(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),
m_name(name),
m_linked(false)
{ {
m_poll = new unsigned char[14U]; m_poll = new unsigned char[14U];
::memcpy(m_poll + 0U, "YSFP", 4U); ::memcpy(m_poll + 0U, "YSFP", 4U);
@ -91,56 +93,33 @@ bool CYSFNetwork::open()
return m_socket.open(); return m_socket.open();
} }
void CYSFNetwork::setDestination(const std::string& name, const in_addr& address, unsigned int port) void CYSFNetwork::write(unsigned int dgid, const unsigned char* data)
{
m_name = name;
m_address = address;
m_port = port;
m_linked = false;
}
void CYSFNetwork::clearDestination()
{
m_address.s_addr = INADDR_NONE;
m_port = 0U;
m_linked = false;
m_pollTimer.stop();
}
void CYSFNetwork::write(const unsigned char* data)
{ {
assert(data != NULL); assert(data != NULL);
if (m_port == 0U)
return;
if (m_debug) if (m_debug)
CUtils::dump(1U, "YSF Network Data Sent", data, 155U); CUtils::dump(1U, "YSF Network Data Sent", data, 155U);
m_socket.write(data, 155U, m_address, m_port); m_socket.write(data, 155U, m_address, m_port);
} }
void CYSFNetwork::writePoll(unsigned int count) void CYSFNetwork::link()
{ {
if (m_port == 0U) writePoll();
return; }
void CYSFNetwork::writePoll()
{
m_pollTimer.start(); m_pollTimer.start();
for (unsigned int i = 0U; i < count; i++) m_socket.write(m_poll, 14U, m_address, m_port);
m_socket.write(m_poll, 14U, m_address, m_port);
} }
void CYSFNetwork::writeUnlink(unsigned int count) void CYSFNetwork::unlink()
{ {
m_pollTimer.stop(); m_pollTimer.stop();
if (m_port == 0U) m_socket.write(m_unlink, 14U, m_address, m_port);
return;
for (unsigned int i = 0U; i < count; i++)
m_socket.write(m_unlink, 14U, m_address, m_port);
m_linked = false; m_linked = false;
} }
@ -183,7 +162,7 @@ void CYSFNetwork::clock(unsigned int ms)
m_buffer.addData(buffer, length); m_buffer.addData(buffer, length);
} }
unsigned int CYSFNetwork::read(unsigned char* data) unsigned int CYSFNetwork::read(unsigned int dgid, unsigned char* data)
{ {
assert(data != NULL); assert(data != NULL);

@ -30,25 +30,22 @@
class CYSFNetwork : public CDGIdNetwork { class CYSFNetwork : public CDGIdNetwork {
public: public:
CYSFNetwork(const std::string& address, unsigned int port, const std::string& callsign, bool debug); CYSFNetwork(const std::string& localAddress, unsigned int localPort, const std::string& name, const in_addr& address, unsigned int port, const std::string& callsign, bool debug);
CYSFNetwork(unsigned int port, const std::string& callsign, bool debug); CYSFNetwork(unsigned int localPort, const std::string& name, const in_addr& address, unsigned int port, const std::string& callsign, bool debug);
virtual ~CYSFNetwork(); virtual ~CYSFNetwork();
virtual bool open(); virtual bool open();
virtual void link(); virtual void link();
void setDestination(const std::string& name, const in_addr& address, unsigned int port);
virtual void write(unsigned int dgId, const unsigned char* data); virtual void write(unsigned int dgId, const unsigned char* data);
void writePoll(unsigned int count = 1U);
virtual void unlink();
virtual unsigned int read(unsigned int dgId, unsigned char* data); virtual unsigned int read(unsigned int dgId, unsigned char* data);
virtual void clock(unsigned int ms); virtual void clock(unsigned int ms);
virtual void unlink();
virtual void close(); virtual void close();
private: private:
@ -62,6 +59,8 @@ private:
CTimer m_pollTimer; CTimer m_pollTimer;
std::string m_name; std::string m_name;
bool m_linked; bool m_linked;
void writePoll();
}; };
#endif #endif

Loading…
Cancel
Save