mirror of https://github.com/nostar/urfd.git
parent
ed87b9e7f6
commit
436e0b00d9
@ -1,77 +0,0 @@
|
|||||||
//
|
|
||||||
// cxlxclient.cpp
|
|
||||||
// xlxd
|
|
||||||
//
|
|
||||||
// Created by Jean-Luc Deltombe (LX3JL) on 28/01/2016.
|
|
||||||
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
|
|
||||||
//
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// 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 <string.h>
|
|
||||||
#include "Main.h"
|
|
||||||
#include "XLXClient.h"
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// constructors
|
|
||||||
|
|
||||||
CXlxClient::CXlxClient()
|
|
||||||
{
|
|
||||||
m_ProtRev = EProtoRev::original;
|
|
||||||
}
|
|
||||||
|
|
||||||
CXlxClient::CXlxClient(const CCallsign &callsign, const CIp &ip, char reflectorModule, EProtoRev protRev)
|
|
||||||
: CClient(callsign, ip, reflectorModule)
|
|
||||||
{
|
|
||||||
m_ProtRev = protRev;
|
|
||||||
}
|
|
||||||
|
|
||||||
CXlxClient::CXlxClient(const CXlxClient &client)
|
|
||||||
: CClient(client)
|
|
||||||
{
|
|
||||||
m_ProtRev = client.m_ProtRev;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// identity
|
|
||||||
|
|
||||||
ECodecType CXlxClient::GetCodec(void) const
|
|
||||||
{
|
|
||||||
ECodecType codec;
|
|
||||||
|
|
||||||
switch ( GetProtocolRevision() )
|
|
||||||
{
|
|
||||||
case EProtoRev::original:
|
|
||||||
case EProtoRev::revised:
|
|
||||||
default:
|
|
||||||
codec = ECodecType::dstar;
|
|
||||||
break;
|
|
||||||
case EProtoRev::ambe:
|
|
||||||
codec = ECodecType::none;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return codec;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// status
|
|
||||||
|
|
||||||
bool CXlxClient::IsAlive(void) const
|
|
||||||
{
|
|
||||||
return (m_LastKeepaliveTime.time() < XLX_KEEPALIVE_TIMEOUT);
|
|
||||||
}
|
|
||||||
@ -1,50 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
|
|
||||||
|
|
||||||
// urfd -- The universal reflector
|
|
||||||
// Copyright © 2021 Thomas A. Early N7TAE
|
|
||||||
//
|
|
||||||
// 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 3 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, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
#include "Client.h"
|
|
||||||
|
|
||||||
class CXlxClient : public CClient
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
// constructors
|
|
||||||
CXlxClient();
|
|
||||||
CXlxClient(const CCallsign &, const CIp &, char = ' ', EProtoRev = EProtoRev::ambe);
|
|
||||||
CXlxClient(const CXlxClient &);
|
|
||||||
|
|
||||||
// destructor
|
|
||||||
virtual ~CXlxClient() {};
|
|
||||||
|
|
||||||
// identity
|
|
||||||
EProtocol GetProtocol(void) const { return EProtocol::xlx; }
|
|
||||||
EProtoRev GetProtocolRevision(void) const { return m_ProtRev; }
|
|
||||||
const char *GetProtocolName(void) const { return "XLX"; }
|
|
||||||
ECodecType GetCodec(void) const;
|
|
||||||
bool IsPeer(void) const { return true; }
|
|
||||||
|
|
||||||
// status
|
|
||||||
bool IsAlive(void) const;
|
|
||||||
|
|
||||||
// reporting
|
|
||||||
void WriteXml(std::ofstream &) {}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
// data
|
|
||||||
EProtoRev m_ProtRev;
|
|
||||||
};
|
|
||||||
@ -1,64 +0,0 @@
|
|||||||
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
|
|
||||||
|
|
||||||
// urfd -- The universal reflector
|
|
||||||
// Copyright © 2021 Thomas A. Early N7TAE
|
|
||||||
//
|
|
||||||
// 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 3 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, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "Main.h"
|
|
||||||
#include "Reflector.h"
|
|
||||||
#include "XLXPeer.h"
|
|
||||||
#include "XLXClient.h"
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// constructor
|
|
||||||
|
|
||||||
|
|
||||||
CXlxPeer::CXlxPeer()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
CXlxPeer::CXlxPeer(const CCallsign &callsign, const CIp &ip, const char *modules, const CVersion &version)
|
|
||||||
: CPeer(callsign, ip, modules, version)
|
|
||||||
{
|
|
||||||
// get protocol revision
|
|
||||||
EProtoRev protrev = GetProtocolRevision(version);
|
|
||||||
//std::cout << "Adding XLX peer with protocol revision " << protrev << std::endl;
|
|
||||||
|
|
||||||
// and construct all xlx clients
|
|
||||||
for ( unsigned i = 0; i < ::strlen(modules); i++ )
|
|
||||||
{
|
|
||||||
// create and append to vector
|
|
||||||
m_Clients.push_back(std::make_shared<CXlxClient>(callsign, ip, modules[i], protrev));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// status
|
|
||||||
|
|
||||||
bool CXlxPeer::IsAlive(void) const
|
|
||||||
{
|
|
||||||
return (m_LastKeepaliveTime.time() < XLX_KEEPALIVE_TIMEOUT);
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// revision helper
|
|
||||||
|
|
||||||
EProtoRev CXlxPeer::GetProtocolRevision(const CVersion &version)
|
|
||||||
{
|
|
||||||
return EProtoRev::ambe;
|
|
||||||
}
|
|
||||||
@ -1,41 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
|
|
||||||
|
|
||||||
// urfd -- The universal reflector
|
|
||||||
// Copyright © 2021 Thomas A. Early N7TAE
|
|
||||||
//
|
|
||||||
// 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 3 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, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
#include "Peer.h"
|
|
||||||
#include "XLXClient.h"
|
|
||||||
|
|
||||||
class CXlxPeer : public CPeer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
// constructors
|
|
||||||
CXlxPeer();
|
|
||||||
CXlxPeer(const CCallsign &, const CIp &, const char *, const CVersion &);
|
|
||||||
CXlxPeer(const CXlxPeer &) = delete;
|
|
||||||
|
|
||||||
// status
|
|
||||||
bool IsAlive(void) const;
|
|
||||||
|
|
||||||
// identity
|
|
||||||
EProtocol GetProtocol(void) const { return EProtocol::xlx; }
|
|
||||||
const char *GetProtocolName(void) const { return "XLX"; }
|
|
||||||
|
|
||||||
// revision helper
|
|
||||||
static EProtoRev GetProtocolRevision(const CVersion &);
|
|
||||||
};
|
|
||||||
Loading…
Reference in new issue