mirror of
https://github.com/nostar/urfd.git
synced 2026-11-08 04:19:39 +00:00
protocol is now a enum class
This commit is contained in:
1 parent
63c3302681
commit
048bb6d9ba
47 files changed
+207
-337
No files matched your search
@@ -33,9 +33,9 @@ public:
|
||||
virtual ~CBmClient() {};
|
||||
|
||||
// identity
|
||||
int GetProtocol(void) const { return PROTOCOL_XLX; }
|
||||
EProtocol GetProtocol(void) const { return EProtocol::ulx; }
|
||||
int GetProtocolRevision(void) const { return XLX_PROTOCOL_REVISION_2; }
|
||||
const char *GetProtocolName(void) const { return "XLX"; }
|
||||
const char *GetProtocolName(void) const { return "ULX"; }
|
||||
int GetCodec(void) const { return CODEC_AMBE2PLUS; }
|
||||
bool IsPeer(void) const { return true; }
|
||||
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ public:
|
||||
bool IsAlive(void) const;
|
||||
|
||||
// identity
|
||||
int GetProtocol(void) const { return PROTOCOL_XLX; }
|
||||
EProtocol GetProtocol(void) const { return EProtocol::ulx; }
|
||||
const char *GetProtocolName(void) const { return "XLX"; }
|
||||
|
||||
// revision helper
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@ public:
|
||||
void SetReflectorModule(char c) { m_ReflectorModule = c; }
|
||||
|
||||
// identity
|
||||
virtual int GetProtocol(void) const { return PROTOCOL_NONE; }
|
||||
virtual EProtocol GetProtocol(void) const { return EProtocol::none; }
|
||||
virtual int GetProtocolRevision(void) const { return 0; }
|
||||
virtual int GetCodec(void) const { return CODEC_NONE; }
|
||||
virtual const char *GetProtocolName(void) const { return "none"; }
|
||||
|
||||
@@ -125,7 +125,7 @@ std::shared_ptr<CClient> CClients::FindClient(const CIp &Ip)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<CClient> CClients::FindClient(const CIp &Ip, int Protocol)
|
||||
std::shared_ptr<CClient> CClients::FindClient(const CIp &Ip, const EProtocol Protocol)
|
||||
{
|
||||
// find client
|
||||
for ( auto it=begin(); it!=end(); it++ )
|
||||
@@ -140,7 +140,7 @@ std::shared_ptr<CClient> CClients::FindClient(const CIp &Ip, int Protocol)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<CClient> CClients::FindClient(const CIp &Ip, int Protocol, char ReflectorModule)
|
||||
std::shared_ptr<CClient> CClients::FindClient(const CIp &Ip, const EProtocol Protocol, const char ReflectorModule)
|
||||
{
|
||||
// find client
|
||||
for ( auto it=begin(); it!=end(); it++ )
|
||||
@@ -155,7 +155,7 @@ std::shared_ptr<CClient> CClients::FindClient(const CIp &Ip, int Protocol, char
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<CClient> CClients::FindClient(const CCallsign &Callsign, const CIp &Ip, int Protocol)
|
||||
std::shared_ptr<CClient> CClients::FindClient(const CCallsign &Callsign, const CIp &Ip, const EProtocol Protocol)
|
||||
{
|
||||
// find client
|
||||
for ( auto it=begin(); it!=end(); it++ )
|
||||
@@ -169,7 +169,7 @@ std::shared_ptr<CClient> CClients::FindClient(const CCallsign &Callsign, const C
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<CClient> CClients::FindClient(const CCallsign &Callsign, char module, const CIp &Ip, int Protocol)
|
||||
std::shared_ptr<CClient> CClients::FindClient(const CCallsign &Callsign, char module, const CIp &Ip, const EProtocol Protocol)
|
||||
{
|
||||
// find client
|
||||
for ( auto it=begin(); it!=end(); it++ )
|
||||
@@ -183,7 +183,7 @@ std::shared_ptr<CClient> CClients::FindClient(const CCallsign &Callsign, char mo
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<CClient> CClients::FindClient(const CCallsign &Callsign, int Protocol)
|
||||
std::shared_ptr<CClient> CClients::FindClient(const CCallsign &Callsign, const EProtocol Protocol)
|
||||
{
|
||||
// find client
|
||||
for ( auto it=begin(); it!=end(); it++ )
|
||||
@@ -200,7 +200,7 @@ std::shared_ptr<CClient> CClients::FindClient(const CCallsign &Callsign, int Pro
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// iterate on clients
|
||||
|
||||
std::shared_ptr<CClient> CClients::FindNextClient(int Protocol, std::list<std::shared_ptr<CClient>>::iterator &it)
|
||||
std::shared_ptr<CClient> CClients::FindNextClient(const EProtocol Protocol, std::list<std::shared_ptr<CClient>>::iterator &it)
|
||||
{
|
||||
while ( it != end() )
|
||||
{
|
||||
@@ -213,7 +213,7 @@ std::shared_ptr<CClient> CClients::FindNextClient(int Protocol, std::list<std::s
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<CClient> CClients::FindNextClient(const CIp &Ip, int Protocol, std::list<std::shared_ptr<CClient>>::iterator &it)
|
||||
std::shared_ptr<CClient> CClients::FindNextClient(const CIp &Ip, const EProtocol Protocol, std::list<std::shared_ptr<CClient>>::iterator &it)
|
||||
{
|
||||
while ( it != end() )
|
||||
{
|
||||
@@ -226,7 +226,7 @@ std::shared_ptr<CClient> CClients::FindNextClient(const CIp &Ip, int Protocol, s
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<CClient> CClients::FindNextClient(const CCallsign &Callsign, const CIp &Ip, int Protocol, std::list<std::shared_ptr<CClient>>::iterator &it)
|
||||
std::shared_ptr<CClient> CClients::FindNextClient(const CCallsign &Callsign, const CIp &Ip, const EProtocol Protocol, std::list<std::shared_ptr<CClient>>::iterator &it)
|
||||
{
|
||||
while ( it != end() )
|
||||
{
|
||||
|
||||
+8
-8
@@ -55,16 +55,16 @@ public:
|
||||
|
||||
// find clients
|
||||
std::shared_ptr<CClient> FindClient(const CIp &);
|
||||
std::shared_ptr<CClient> FindClient(const CIp &, int);
|
||||
std::shared_ptr<CClient> FindClient(const CIp &, int, char);
|
||||
std::shared_ptr<CClient> FindClient(const CCallsign &, const CIp &, int);
|
||||
std::shared_ptr<CClient> FindClient(const CCallsign &, char, const CIp &, int);
|
||||
std::shared_ptr<CClient> FindClient(const CCallsign &, int);
|
||||
std::shared_ptr<CClient> FindClient(const CIp &, const EProtocol);
|
||||
std::shared_ptr<CClient> FindClient(const CIp &, const EProtocol, const char);
|
||||
std::shared_ptr<CClient> FindClient(const CCallsign &, const CIp &, const EProtocol);
|
||||
std::shared_ptr<CClient> FindClient(const CCallsign &, char, const CIp &, const EProtocol);
|
||||
std::shared_ptr<CClient> FindClient(const CCallsign &, const EProtocol);
|
||||
|
||||
// iterate on clients
|
||||
std::shared_ptr<CClient> FindNextClient(int, std::list<std::shared_ptr<CClient>>::iterator &);
|
||||
std::shared_ptr<CClient> FindNextClient(const CIp &, int, std::list<std::shared_ptr<CClient>>::iterator &);
|
||||
std::shared_ptr<CClient> FindNextClient(const CCallsign &, const CIp &, int, std::list<std::shared_ptr<CClient>>::iterator &);
|
||||
std::shared_ptr<CClient> FindNextClient(const EProtocol, std::list<std::shared_ptr<CClient>>::iterator &);
|
||||
std::shared_ptr<CClient> FindNextClient(const CIp &, const EProtocol, std::list<std::shared_ptr<CClient>>::iterator &);
|
||||
std::shared_ptr<CClient> FindNextClient(const CCallsign &, const CIp &, const EProtocol, std::list<std::shared_ptr<CClient>>::iterator &);
|
||||
|
||||
protected:
|
||||
// data
|
||||
|
||||
@@ -83,14 +83,14 @@ bool CCodecStream::Init(uint16_t uiPort)
|
||||
// create socket address, family based on transcoder listen address
|
||||
#ifdef LISTEN_IPV4
|
||||
#ifdef LISTEN_IPV6
|
||||
const auto paddr = (AF_INET == m_Ip.GetFamily()) ? g_Reflector.m_Address.GetV4Address(PROTOCOL_ANY) : g_Reflector.m_Address.GetV6Address(PROTOCOL_ANY);
|
||||
auto paddr = (AF_INET == m_Ip.GetFamily()) ? LISTEN_IPV4 : LISTEN_IPV6;
|
||||
#else
|
||||
const auto paddr = g_Reflector.m_Address.GetV4Address(PROTOCOL_ANY);
|
||||
auto paddr = LISTEN_IPV4;
|
||||
#endif
|
||||
#else
|
||||
const auto paddr = g_Reflector.m_Address.GetV6Address(PROTOCOL_ANY);
|
||||
auto paddr = LISTEN_IPV6;
|
||||
#endif
|
||||
CIp ip(m_Ip.GetFamily(), m_uiPort, paddr.c_str());
|
||||
CIp ip(m_Ip.GetFamily(), m_uiPort, paddr);
|
||||
|
||||
// create our socket
|
||||
if (ip.IsSet())
|
||||
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
virtual ~CDcsClient() {};
|
||||
|
||||
// identity
|
||||
int GetProtocol(void) const { return PROTOCOL_DCS; }
|
||||
EProtocol GetProtocol(void) const { return EProtocol::dcs; }
|
||||
const char *GetProtocolName(void) const { return "DCS"; }
|
||||
int GetCodec(void) const { return CODEC_AMBEPLUS; }
|
||||
bool IsNode(void) const { return true; }
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// operation
|
||||
|
||||
bool CDcsProtocol::Initialize(const char *type, const int ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6)
|
||||
bool CDcsProtocol::Initialize(const char *type, const EProtocol ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6)
|
||||
{
|
||||
// base class
|
||||
if (! CProtocol::Initialize(type, ptype, port, has_ipv4, has_ipv6))
|
||||
@@ -68,7 +68,7 @@ void CDcsProtocol::Task(void)
|
||||
if ( IsValidDvPacket(Buffer, Header, Frame) )
|
||||
{
|
||||
// callsign muted?
|
||||
if ( g_GateKeeper.MayTransmit(Header->GetMyCallsign(), Ip, PROTOCOL_DCS, Header->GetRpt2Module()) )
|
||||
if ( g_GateKeeper.MayTransmit(Header->GetMyCallsign(), Ip, EProtocol::dcs, Header->GetRpt2Module()) )
|
||||
{
|
||||
OnDvHeaderPacketIn(Header, Ip);
|
||||
|
||||
@@ -89,7 +89,7 @@ void CDcsProtocol::Task(void)
|
||||
std::cout << "DCS connect packet for module " << ToLinkModule << " from " << Callsign << " at " << Ip << std::endl;
|
||||
|
||||
// callsign authorized?
|
||||
if ( g_GateKeeper.MayLink(Callsign, Ip, PROTOCOL_DCS) && g_Reflector.IsValidModule(ToLinkModule) )
|
||||
if ( g_GateKeeper.MayLink(Callsign, Ip, EProtocol::dcs) && g_Reflector.IsValidModule(ToLinkModule) )
|
||||
{
|
||||
// valid module ?
|
||||
if ( g_Reflector.IsValidModule(ToLinkModule) )
|
||||
@@ -125,7 +125,7 @@ void CDcsProtocol::Task(void)
|
||||
|
||||
// find client
|
||||
CClients *clients = g_Reflector.GetClients();
|
||||
std::shared_ptr<CClient>client = clients->FindClient(Ip, PROTOCOL_DCS);
|
||||
std::shared_ptr<CClient>client = clients->FindClient(Ip, EProtocol::dcs);
|
||||
if ( client != nullptr )
|
||||
{
|
||||
// remove it
|
||||
@@ -144,7 +144,7 @@ void CDcsProtocol::Task(void)
|
||||
CClients *clients = g_Reflector.GetClients();
|
||||
auto it = clients->begin();
|
||||
std::shared_ptr<CClient>client = nullptr;
|
||||
while ( (client = clients->FindNextClient(Callsign, Ip, PROTOCOL_DCS, it)) != nullptr )
|
||||
while ( (client = clients->FindNextClient(Callsign, Ip, EProtocol::dcs, it)) != nullptr )
|
||||
{
|
||||
client->Alive();
|
||||
}
|
||||
@@ -202,7 +202,7 @@ void CDcsProtocol::OnDvHeaderPacketIn(std::unique_ptr<CDvHeaderPacket> &Header,
|
||||
CCallsign rpt2(Header->GetRpt2Callsign());
|
||||
|
||||
// find this client
|
||||
std::shared_ptr<CClient>client = g_Reflector.GetClients()->FindClient(Ip, PROTOCOL_DCS);
|
||||
std::shared_ptr<CClient>client = g_Reflector.GetClients()->FindClient(Ip, EProtocol::dcs);
|
||||
if ( client )
|
||||
{
|
||||
// get client callsign
|
||||
@@ -273,7 +273,7 @@ void CDcsProtocol::HandleQueue(void)
|
||||
CClients *clients = g_Reflector.GetClients();
|
||||
auto it = clients->begin();
|
||||
std::shared_ptr<CClient>client = nullptr;
|
||||
while ( (client = clients->FindNextClient(PROTOCOL_DCS, it)) != nullptr )
|
||||
while ( (client = clients->FindNextClient(EProtocol::dcs, it)) != nullptr )
|
||||
{
|
||||
// is this client busy ?
|
||||
if ( !client->IsAMaster() && (client->GetReflectorModule() == packet->GetModuleId()) )
|
||||
@@ -305,7 +305,7 @@ void CDcsProtocol::HandleKeepalives(void)
|
||||
CClients *clients = g_Reflector.GetClients();
|
||||
auto it = clients->begin();
|
||||
std::shared_ptr<CClient>client = nullptr;
|
||||
while ( (client = clients->FindNextClient(PROTOCOL_DCS, it)) != nullptr )
|
||||
while ( (client = clients->FindNextClient(EProtocol::dcs, it)) != nullptr )
|
||||
{
|
||||
// encode client's specific keepalive packet
|
||||
CBuffer keepalive2;
|
||||
|
||||
@@ -44,7 +44,7 @@ class CDcsProtocol : public CProtocol
|
||||
{
|
||||
public:
|
||||
// initialization
|
||||
bool Initialize(const char *type, const int ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6);
|
||||
bool Initialize(const char *type, const EProtocol ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6);
|
||||
|
||||
// task
|
||||
void Task(void);
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
virtual ~CDextraClient() {};
|
||||
|
||||
// identity
|
||||
int GetProtocol(void) const { return PROTOCOL_DEXTRA; }
|
||||
EProtocol GetProtocol(void) const { return EProtocol::dextra; }
|
||||
int GetProtocolRevision(void) const { return m_ProtRev; }
|
||||
const char *GetProtocolName(void) const { return "DExtra"; }
|
||||
int GetCodec(void) const { return CODEC_AMBEPLUS; }
|
||||
|
||||
@@ -34,8 +34,8 @@ public:
|
||||
bool IsAlive(void) const;
|
||||
|
||||
// identity
|
||||
int GetProtocol(void) const { return PROTOCOL_DEXTRA; }
|
||||
const char *GetProtocolName(void) const { return "DExtra"; }
|
||||
EProtocol GetProtocol(void) const { return EProtocol::dextra; }
|
||||
const char *GetProtocolName(void) const { return "DExtra"; }
|
||||
|
||||
// revision helper
|
||||
static int GetProtocolRevision(const CVersion &);
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// operation
|
||||
|
||||
bool CDextraProtocol::Initialize(const char *type, int ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6)
|
||||
bool CDextraProtocol::Initialize(const char *type, const EProtocol ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6)
|
||||
{
|
||||
// base class
|
||||
if (! CProtocol::Initialize(type, ptype, port, has_ipv4, has_ipv6))
|
||||
@@ -75,7 +75,7 @@ void CDextraProtocol::Task(void)
|
||||
else if ( IsValidDvHeaderPacket(Buffer, Header) )
|
||||
{
|
||||
// callsign muted?
|
||||
if ( g_GateKeeper.MayTransmit(Header->GetMyCallsign(), Ip, PROTOCOL_DEXTRA, Header->GetRpt2Module()) )
|
||||
if ( g_GateKeeper.MayTransmit(Header->GetMyCallsign(), Ip, EProtocol::dextra, Header->GetRpt2Module()) )
|
||||
{
|
||||
OnDvHeaderPacketIn(Header, Ip);
|
||||
}
|
||||
@@ -89,7 +89,7 @@ void CDextraProtocol::Task(void)
|
||||
std::cout << "DExtra connect packet for module " << ToLinkModule << " from " << Callsign << " at " << Ip << " rev " << ProtRev << std::endl;
|
||||
|
||||
// callsign authorized?
|
||||
if ( g_GateKeeper.MayLink(Callsign, Ip, PROTOCOL_DEXTRA) )
|
||||
if ( g_GateKeeper.MayLink(Callsign, Ip, EProtocol::dextra) )
|
||||
{
|
||||
// valid module ?
|
||||
if ( g_Reflector.IsValidModule(ToLinkModule) )
|
||||
@@ -103,7 +103,7 @@ void CDextraProtocol::Task(void)
|
||||
|
||||
// already connected ?
|
||||
CPeers *peers = g_Reflector.GetPeers();
|
||||
if ( peers->FindPeer(Callsign, Ip, PROTOCOL_DEXTRA) == nullptr )
|
||||
if ( peers->FindPeer(Callsign, Ip, EProtocol::dextra) == nullptr )
|
||||
{
|
||||
// create the new peer
|
||||
// this also create one client per module
|
||||
@@ -147,7 +147,7 @@ void CDextraProtocol::Task(void)
|
||||
|
||||
// find client & remove it
|
||||
CClients *clients = g_Reflector.GetClients();
|
||||
std::shared_ptr<CClient>client = clients->FindClient(Ip, PROTOCOL_DEXTRA);
|
||||
std::shared_ptr<CClient>client = clients->FindClient(Ip, EProtocol::dextra);
|
||||
if ( client != nullptr )
|
||||
{
|
||||
// ack disconnect packet
|
||||
@@ -173,7 +173,7 @@ void CDextraProtocol::Task(void)
|
||||
CClients *clients = g_Reflector.GetClients();
|
||||
auto it = clients->begin();
|
||||
std::shared_ptr<CClient>client = nullptr;
|
||||
while ( (client = clients->FindNextClient(Callsign, Ip, PROTOCOL_DEXTRA, it)) != nullptr )
|
||||
while ( (client = clients->FindNextClient(Callsign, Ip, EProtocol::dextra, it)) != nullptr )
|
||||
{
|
||||
client->Alive();
|
||||
}
|
||||
@@ -234,7 +234,7 @@ void CDextraProtocol::HandleQueue(void)
|
||||
CClients *clients = g_Reflector.GetClients();
|
||||
auto it = clients->begin();
|
||||
std::shared_ptr<CClient>client = nullptr;
|
||||
while ( (client = clients->FindNextClient(PROTOCOL_DEXTRA, it)) != nullptr )
|
||||
while ( (client = clients->FindNextClient(EProtocol::dextra, it)) != nullptr )
|
||||
{
|
||||
// is this client busy ?
|
||||
if ( !client->IsAMaster() && (client->GetReflectorModule() == packet->GetModuleId()) )
|
||||
@@ -268,7 +268,7 @@ void CDextraProtocol::HandleKeepalives(void)
|
||||
CClients *clients = g_Reflector.GetClients();
|
||||
auto it = clients->begin();
|
||||
std::shared_ptr<CClient>client = nullptr;
|
||||
while ( (client = clients->FindNextClient(PROTOCOL_DEXTRA, it)) != nullptr )
|
||||
while ( (client = clients->FindNextClient(EProtocol::dextra, it)) != nullptr )
|
||||
{
|
||||
// send keepalive
|
||||
Send(keepalive, client->GetIp());
|
||||
@@ -283,7 +283,7 @@ void CDextraProtocol::HandleKeepalives(void)
|
||||
else if ( !client->IsAlive() )
|
||||
{
|
||||
CPeers *peers = g_Reflector.GetPeers();
|
||||
std::shared_ptr<CPeer>peer = peers->FindPeer(client->GetCallsign(), client->GetIp(), PROTOCOL_DEXTRA);
|
||||
std::shared_ptr<CPeer>peer = peers->FindPeer(client->GetCallsign(), client->GetIp(), EProtocol::dextra);
|
||||
if ( peer != nullptr && peer->GetReflectorModules()[0] == client->GetReflectorModule() )
|
||||
{
|
||||
// no, but this is a peer client, so it will be handled below
|
||||
@@ -309,7 +309,7 @@ void CDextraProtocol::HandleKeepalives(void)
|
||||
CPeers *peers = g_Reflector.GetPeers();
|
||||
auto pit = peers->begin();
|
||||
std::shared_ptr<CPeer>peer = nullptr;
|
||||
while ( (peer = peers->FindNextPeer(PROTOCOL_DEXTRA, pit)) != nullptr )
|
||||
while ( (peer = peers->FindNextPeer(EProtocol::dextra, pit)) != nullptr )
|
||||
{
|
||||
// keepalives are sent between clients
|
||||
|
||||
@@ -349,7 +349,7 @@ void CDextraProtocol::HandlePeerLinks(void)
|
||||
// if not, disconnect
|
||||
auto pit = peers->begin();
|
||||
std::shared_ptr<CPeer>peer = nullptr;
|
||||
while ( (peer = peers->FindNextPeer(PROTOCOL_DEXTRA, pit)) != nullptr )
|
||||
while ( (peer = peers->FindNextPeer(EProtocol::dextra, pit)) != nullptr )
|
||||
{
|
||||
if ( list->FindListItem(peer->GetCallsign()) == nullptr )
|
||||
{
|
||||
@@ -370,7 +370,7 @@ void CDextraProtocol::HandlePeerLinks(void)
|
||||
continue;
|
||||
if ( strlen((*it).GetModules()) != 2 )
|
||||
continue;
|
||||
if ( peers->FindPeer((*it).GetCallsign(), PROTOCOL_DEXTRA) == nullptr )
|
||||
if ( peers->FindPeer((*it).GetCallsign(), EProtocol::dextra) == nullptr )
|
||||
{
|
||||
// resolve again peer's IP in case it's a dynamic IP
|
||||
(*it).ResolveIp();
|
||||
@@ -407,7 +407,7 @@ void CDextraProtocol::OnDvHeaderPacketIn(std::unique_ptr<CDvHeaderPacket> &Heade
|
||||
CCallsign rpt2(Header->GetRpt2Callsign());
|
||||
|
||||
// find this client
|
||||
std::shared_ptr<CClient>client = g_Reflector.GetClients()->FindClient(Ip, PROTOCOL_DEXTRA);
|
||||
std::shared_ptr<CClient>client = g_Reflector.GetClients()->FindClient(Ip, EProtocol::dextra);
|
||||
if ( client )
|
||||
{
|
||||
// get client callsign
|
||||
|
||||
@@ -52,7 +52,7 @@ class CDextraProtocol : public CProtocol
|
||||
{
|
||||
public:
|
||||
// initialization
|
||||
bool Initialize(const char *type, const int ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6);
|
||||
bool Initialize(const char *type, const EProtocol ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6);
|
||||
|
||||
// task
|
||||
void Task(void);
|
||||
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
virtual ~CDmrmmdvmClient() {};
|
||||
|
||||
// identity
|
||||
int GetProtocol(void) const { return PROTOCOL_DMRMMDVM; }
|
||||
EProtocol GetProtocol(void) const { return EProtocol::dmrmmdvm; }
|
||||
const char *GetProtocolName(void) const { return "DMRMmdvm"; }
|
||||
int GetCodec(void) const { return CODEC_AMBE2PLUS; }
|
||||
bool IsNode(void) const { return true; }
|
||||
|
||||
@@ -47,7 +47,7 @@ static uint8_t g_DmrSyncMSData[] = { 0x0D,0x5D,0x7F,0x77,0xFD,0x75,0x70 };
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// operation
|
||||
|
||||
bool CDmrmmdvmProtocol::Initialize(const char *type, const int ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6)
|
||||
bool CDmrmmdvmProtocol::Initialize(const char *type, const EProtocol ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6)
|
||||
{
|
||||
// base class
|
||||
if (! CProtocol::Initialize(type, ptype, port, has_ipv4, has_ipv6))
|
||||
@@ -105,7 +105,7 @@ void CDmrmmdvmProtocol::Task(void)
|
||||
else if ( IsValidDvHeaderPacket(Buffer, Header, &Cmd, &CallType) )
|
||||
{
|
||||
// callsign muted?
|
||||
if ( g_GateKeeper.MayTransmit(Header->GetMyCallsign(), Ip, PROTOCOL_DMRMMDVM) )
|
||||
if ( g_GateKeeper.MayTransmit(Header->GetMyCallsign(), Ip, EProtocol::dmrmmdvm) )
|
||||
{
|
||||
// handle it
|
||||
OnDvHeaderPacketIn(Header, Ip, Cmd, CallType);
|
||||
@@ -120,7 +120,7 @@ void CDmrmmdvmProtocol::Task(void)
|
||||
std::cout << "DMRmmdvm connect packet from " << Callsign << " at " << Ip << std::endl;
|
||||
|
||||
// callsign authorized?
|
||||
if ( g_GateKeeper.MayLink(Callsign, Ip, PROTOCOL_DMRMMDVM) )
|
||||
if ( g_GateKeeper.MayLink(Callsign, Ip, EProtocol::dmrmmdvm) )
|
||||
{
|
||||
// acknowledge the request
|
||||
EncodeConnectAckPacket(&Buffer, Callsign, m_uiAuthSeed);
|
||||
@@ -139,7 +139,7 @@ void CDmrmmdvmProtocol::Task(void)
|
||||
std::cout << "DMRmmdvm authentication packet from " << Callsign << " at " << Ip << std::endl;
|
||||
|
||||
// callsign authorized?
|
||||
if ( g_GateKeeper.MayLink(Callsign, Ip, PROTOCOL_DMRMMDVM) )
|
||||
if ( g_GateKeeper.MayLink(Callsign, Ip, EProtocol::dmrmmdvm) )
|
||||
{
|
||||
// acknowledge the request
|
||||
EncodeAckPacket(&Buffer, Callsign);
|
||||
@@ -147,7 +147,7 @@ void CDmrmmdvmProtocol::Task(void)
|
||||
|
||||
// add client if needed
|
||||
CClients *clients = g_Reflector.GetClients();
|
||||
std::shared_ptr<CClient>client = clients->FindClient(Callsign, Ip, PROTOCOL_DMRMMDVM);
|
||||
std::shared_ptr<CClient>client = clients->FindClient(Callsign, Ip, EProtocol::dmrmmdvm);
|
||||
// client already connected ?
|
||||
if ( client == nullptr )
|
||||
{
|
||||
@@ -177,7 +177,7 @@ void CDmrmmdvmProtocol::Task(void)
|
||||
|
||||
// find client & remove it
|
||||
CClients *clients = g_Reflector.GetClients();
|
||||
std::shared_ptr<CClient>client = clients->FindClient(Ip, PROTOCOL_DMRMMDVM);
|
||||
std::shared_ptr<CClient>client = clients->FindClient(Ip, EProtocol::dmrmmdvm);
|
||||
if ( client != nullptr )
|
||||
{
|
||||
clients->RemoveClient(client);
|
||||
@@ -200,7 +200,7 @@ void CDmrmmdvmProtocol::Task(void)
|
||||
CClients *clients = g_Reflector.GetClients();
|
||||
auto it = clients->begin();
|
||||
std::shared_ptr<CClient>client = nullptr;
|
||||
while ( (client = clients->FindNextClient(Callsign, Ip, PROTOCOL_DMRMMDVM, it)) != nullptr )
|
||||
while ( (client = clients->FindNextClient(Callsign, Ip, EProtocol::dmrmmdvm, it)) != nullptr )
|
||||
{
|
||||
// acknowledge
|
||||
EncodeKeepAlivePacket(&Buffer, client);
|
||||
@@ -273,7 +273,7 @@ void CDmrmmdvmProtocol::OnDvHeaderPacketIn(std::unique_ptr<CDvHeaderPacket> &Hea
|
||||
CCallsign rpt2(Header->GetRpt2Callsign());
|
||||
// no stream open yet, open a new one
|
||||
// firstfind this client
|
||||
std::shared_ptr<CClient>client = g_Reflector.GetClients()->FindClient(Ip, PROTOCOL_DMRMMDVM);
|
||||
std::shared_ptr<CClient>client = g_Reflector.GetClients()->FindClient(Ip, EProtocol::dmrmmdvm);
|
||||
if ( client )
|
||||
{
|
||||
// process cmd if any
|
||||
@@ -413,7 +413,7 @@ void CDmrmmdvmProtocol::HandleQueue(void)
|
||||
CClients *clients = g_Reflector.GetClients();
|
||||
auto it = clients->begin();
|
||||
std::shared_ptr<CClient>client = nullptr;
|
||||
while ( (client = clients->FindNextClient(PROTOCOL_DMRMMDVM, it)) != nullptr )
|
||||
while ( (client = clients->FindNextClient(EProtocol::dmrmmdvm, it)) != nullptr )
|
||||
{
|
||||
// is this client busy ?
|
||||
if ( !client->IsAMaster() && (client->GetReflectorModule() == packet->GetModuleId()) )
|
||||
@@ -442,7 +442,7 @@ void CDmrmmdvmProtocol::HandleKeepalives(void)
|
||||
CClients *clients = g_Reflector.GetClients();
|
||||
auto it = clients->begin();
|
||||
std::shared_ptr<CClient>client = nullptr;
|
||||
while ( (client = clients->FindNextClient(PROTOCOL_DMRMMDVM, it)) != nullptr )
|
||||
while ( (client = clients->FindNextClient(EProtocol::dmrmmdvm, it)) != nullptr )
|
||||
{
|
||||
// is this client busy ?
|
||||
if ( client->IsAMaster() )
|
||||
|
||||
@@ -60,7 +60,7 @@ class CDmrmmdvmProtocol : public CProtocol
|
||||
{
|
||||
public:
|
||||
// initialization
|
||||
bool Initialize(const char *type, const int ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6);
|
||||
bool Initialize(const char *type, const EProtocol ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6);
|
||||
|
||||
// task
|
||||
void Task(void);
|
||||
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
virtual ~CDmrplusClient() {};
|
||||
|
||||
// identity
|
||||
int GetProtocol(void) const { return PROTOCOL_DMRPLUS; }
|
||||
EProtocol GetProtocol(void) const { return EProtocol::dmrplus; }
|
||||
const char *GetProtocolName(void) const { return "DMRplus"; }
|
||||
int GetCodec(void) const { return CODEC_AMBE2PLUS; }
|
||||
bool IsNode(void) const { return true; }
|
||||
|
||||
@@ -40,7 +40,7 @@ static uint8_t g_DmrSyncMSData[] = { 0x0D,0x5D,0x7F,0x77,0xFD,0x75,0x70 };
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// operation
|
||||
|
||||
bool CDmrplusProtocol::Initialize(const char *type, const int ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6)
|
||||
bool CDmrplusProtocol::Initialize(const char *type, const EProtocol ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6)
|
||||
{
|
||||
// base class
|
||||
if (! CProtocol::Initialize(type, ptype, port, has_ipv4, has_ipv6))
|
||||
@@ -93,7 +93,7 @@ void CDmrplusProtocol::Task(void)
|
||||
else if ( IsValidDvHeaderPacket(Ip, Buffer, Header) )
|
||||
{
|
||||
// callsign muted?
|
||||
if ( g_GateKeeper.MayTransmit(Header->GetMyCallsign(), Ip, PROTOCOL_DMRPLUS) )
|
||||
if ( g_GateKeeper.MayTransmit(Header->GetMyCallsign(), Ip, EProtocol::dmrplus) )
|
||||
{
|
||||
// handle it
|
||||
OnDvHeaderPacketIn(Header, Ip);
|
||||
@@ -104,7 +104,7 @@ void CDmrplusProtocol::Task(void)
|
||||
//std::cout << "DMRplus keepalive/connect packet for module " << ToLinkModule << " from " << Callsign << " at " << Ip << std::endl;
|
||||
|
||||
// callsign authorized?
|
||||
if ( g_GateKeeper.MayLink(Callsign, Ip, PROTOCOL_DMRPLUS) )
|
||||
if ( g_GateKeeper.MayLink(Callsign, Ip, EProtocol::dmrplus) )
|
||||
{
|
||||
// acknowledge the request
|
||||
EncodeConnectAckPacket(&Buffer);
|
||||
@@ -112,7 +112,7 @@ void CDmrplusProtocol::Task(void)
|
||||
|
||||
// add client if needed
|
||||
CClients *clients = g_Reflector.GetClients();
|
||||
std::shared_ptr<CClient>client = clients->FindClient(Callsign, Ip, PROTOCOL_DMRPLUS);
|
||||
std::shared_ptr<CClient>client = clients->FindClient(Callsign, Ip, EProtocol::dmrplus);
|
||||
// client already connected ?
|
||||
if ( client == nullptr )
|
||||
{
|
||||
@@ -142,7 +142,7 @@ void CDmrplusProtocol::Task(void)
|
||||
|
||||
// find client & remove it
|
||||
CClients *clients = g_Reflector.GetClients();
|
||||
std::shared_ptr<CClient>client = clients->FindClient(Ip, PROTOCOL_DMRPLUS);
|
||||
std::shared_ptr<CClient>client = clients->FindClient(Ip, EProtocol::dmrplus);
|
||||
if ( client != nullptr )
|
||||
{
|
||||
clients->RemoveClient(client);
|
||||
@@ -196,7 +196,7 @@ void CDmrplusProtocol::OnDvHeaderPacketIn(std::unique_ptr<CDvHeaderPacket> &Head
|
||||
|
||||
// no stream open yet, open a new one
|
||||
// find this client
|
||||
std::shared_ptr<CClient>client = g_Reflector.GetClients()->FindClient(Ip, PROTOCOL_DMRPLUS);
|
||||
std::shared_ptr<CClient>client = g_Reflector.GetClients()->FindClient(Ip, EProtocol::dmrplus);
|
||||
if ( client )
|
||||
{
|
||||
// and try to open the stream
|
||||
@@ -278,7 +278,7 @@ void CDmrplusProtocol::HandleQueue(void)
|
||||
CClients *clients = g_Reflector.GetClients();
|
||||
auto it = clients->begin();
|
||||
std::shared_ptr<CClient>client = nullptr;
|
||||
while ( (client = clients->FindNextClient(PROTOCOL_DMRPLUS, it)) != nullptr )
|
||||
while ( (client = clients->FindNextClient(EProtocol::dmrplus, it)) != nullptr )
|
||||
{
|
||||
// is this client busy ?
|
||||
if ( !client->IsAMaster() && (client->GetReflectorModule() == packet->GetModuleId()) )
|
||||
@@ -304,7 +304,7 @@ void CDmrplusProtocol::SendBufferToClients(const CBuffer &buffer, uint8_t module
|
||||
CClients *clients = g_Reflector.GetClients();
|
||||
auto it = clients->begin();
|
||||
std::shared_ptr<CClient>client = nullptr;
|
||||
while ( (client = clients->FindNextClient(PROTOCOL_DMRPLUS, it)) != nullptr )
|
||||
while ( (client = clients->FindNextClient(EProtocol::dmrplus, it)) != nullptr )
|
||||
{
|
||||
// is this client busy ?
|
||||
if ( !client->IsAMaster() && (client->GetReflectorModule() == module) )
|
||||
@@ -334,7 +334,7 @@ void CDmrplusProtocol::HandleKeepalives(void)
|
||||
CClients *clients = g_Reflector.GetClients();
|
||||
auto it = clients->begin();
|
||||
std::shared_ptr<CClient>client = nullptr;
|
||||
while ( (client = clients->FindNextClient(PROTOCOL_DMRPLUS, it)) != nullptr )
|
||||
while ( (client = clients->FindNextClient(EProtocol::dmrplus, it)) != nullptr )
|
||||
{
|
||||
// is this client busy ?
|
||||
if ( client->IsAMaster() )
|
||||
|
||||
@@ -50,7 +50,7 @@ class CDmrplusProtocol : public CProtocol
|
||||
{
|
||||
public:
|
||||
// initialization
|
||||
bool Initialize(const char *type, const int pytpe, const uint16_t port, const bool has_ipv4, const bool has_ipv6);
|
||||
bool Initialize(const char *type, const EProtocol pytpe, const uint16_t port, const bool has_ipv4, const bool has_ipv6);
|
||||
|
||||
// task
|
||||
void Task(void);
|
||||
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
virtual ~CDplusClient() {};
|
||||
|
||||
// identity
|
||||
int GetProtocol(void) const { return PROTOCOL_DPLUS; }
|
||||
EProtocol GetProtocol(void) const { return EProtocol::dplus; }
|
||||
const char *GetProtocolName(void) const { return "DPlus"; }
|
||||
int GetCodec(void) const { return CODEC_AMBEPLUS; }
|
||||
bool IsNode(void) const { return true; }
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// operation
|
||||
|
||||
bool CDplusProtocol::Initialize(const char *type, const int ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6)
|
||||
bool CDplusProtocol::Initialize(const char *type, const EProtocol ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6)
|
||||
{
|
||||
// base class
|
||||
if (! CProtocol::Initialize(type, ptype, port, has_ipv4, has_ipv6))
|
||||
@@ -73,7 +73,7 @@ void CDplusProtocol::Task(void)
|
||||
else if ( IsValidDvHeaderPacket(Buffer, Header) )
|
||||
{
|
||||
// is muted?
|
||||
if ( g_GateKeeper.MayTransmit(Header->GetMyCallsign(), Ip, PROTOCOL_DPLUS, Header->GetRpt2Module()) )
|
||||
if ( g_GateKeeper.MayTransmit(Header->GetMyCallsign(), Ip, EProtocol::dplus, Header->GetRpt2Module()) )
|
||||
{
|
||||
// handle it
|
||||
OnDvHeaderPacketIn(Header, Ip);
|
||||
@@ -95,7 +95,7 @@ void CDplusProtocol::Task(void)
|
||||
std::cout << "DPlus login packet from " << Callsign << " at " << Ip << std::endl;
|
||||
|
||||
// callsign authorized?
|
||||
if ( g_GateKeeper.MayLink(Callsign, Ip, PROTOCOL_DPLUS) )
|
||||
if ( g_GateKeeper.MayLink(Callsign, Ip, EProtocol::dplus) )
|
||||
{
|
||||
// acknowledge the request
|
||||
EncodeLoginAckPacket(&Buffer);
|
||||
@@ -119,7 +119,7 @@ void CDplusProtocol::Task(void)
|
||||
|
||||
// find client
|
||||
CClients *clients = g_Reflector.GetClients();
|
||||
std::shared_ptr<CClient>client = clients->FindClient(Ip, PROTOCOL_DPLUS);
|
||||
std::shared_ptr<CClient>client = clients->FindClient(Ip, EProtocol::dplus);
|
||||
if ( client != nullptr )
|
||||
{
|
||||
// remove it
|
||||
@@ -138,7 +138,7 @@ void CDplusProtocol::Task(void)
|
||||
CClients *clients = g_Reflector.GetClients();
|
||||
auto it = clients->begin();
|
||||
std::shared_ptr<CClient>client = nullptr;
|
||||
while ( (client = clients->FindNextClient(Ip, PROTOCOL_DPLUS, it)) != nullptr )
|
||||
while ( (client = clients->FindNextClient(Ip, EProtocol::dplus, it)) != nullptr )
|
||||
{
|
||||
client->Alive();
|
||||
}
|
||||
@@ -193,7 +193,7 @@ void CDplusProtocol::OnDvHeaderPacketIn(std::unique_ptr<CDvHeaderPacket> &Header
|
||||
if ( g_Reflector.IsValidModule(rpt2.GetModule()) )
|
||||
{
|
||||
// find this client
|
||||
std::shared_ptr<CClient>client = g_Reflector.GetClients()->FindClient(Ip, PROTOCOL_DPLUS);
|
||||
std::shared_ptr<CClient>client = g_Reflector.GetClients()->FindClient(Ip, EProtocol::dplus);
|
||||
if ( client )
|
||||
{
|
||||
// now we know if it's a dextra dongle or a genuine dplus node
|
||||
@@ -262,7 +262,7 @@ void CDplusProtocol::HandleQueue(void)
|
||||
CClients *clients = g_Reflector.GetClients();
|
||||
auto it = clients->begin();
|
||||
std::shared_ptr<CClient>client = nullptr;
|
||||
while ( (client = clients->FindNextClient(PROTOCOL_DPLUS, it)) != nullptr )
|
||||
while ( (client = clients->FindNextClient(EProtocol::dplus, it)) != nullptr )
|
||||
{
|
||||
// is this client busy ?
|
||||
if ( !client->IsAMaster() )
|
||||
@@ -352,7 +352,7 @@ void CDplusProtocol::HandleKeepalives(void)
|
||||
CClients *clients = g_Reflector.GetClients();
|
||||
auto it = clients->begin();
|
||||
std::shared_ptr<CClient>client = nullptr;
|
||||
while ( (client = clients->FindNextClient(PROTOCOL_DPLUS, it)) != nullptr )
|
||||
while ( (client = clients->FindNextClient(EProtocol::dplus, it)) != nullptr )
|
||||
{
|
||||
// send keepalive
|
||||
//std::cout << "Sending DPlus packet @ " << client->GetIp() << std::endl;
|
||||
|
||||
@@ -39,7 +39,7 @@ class CDplusProtocol : public CProtocol
|
||||
{
|
||||
public:
|
||||
// initialization
|
||||
bool Initialize(const char *type, const int ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6);
|
||||
bool Initialize(const char *type, const EProtocol ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6);
|
||||
|
||||
// task
|
||||
void Task(void);
|
||||
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
virtual ~CG3Client() {};
|
||||
|
||||
// identity
|
||||
int GetProtocol(void) const { return PROTOCOL_G3; }
|
||||
EProtocol GetProtocol(void) const { return EProtocol::g3; }
|
||||
const char *GetProtocolName(void) const { return "Terminal/AP"; }
|
||||
int GetCodec(void) const { return CODEC_AMBEPLUS; }
|
||||
bool IsNode(void) const { return true; }
|
||||
|
||||
+11
-12
@@ -31,7 +31,7 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// operation
|
||||
|
||||
bool CG3Protocol::Initialize(const char */*type*/, const int /*type*/, const uint16_t /*port*/, const bool /*has_ipv4*/, const bool /*has_ipv6*/)
|
||||
bool CG3Protocol::Initialize(const char */*type*/, const EProtocol /*type*/, const uint16_t /*port*/, const bool /*has_ipv4*/, const bool /*has_ipv6*/)
|
||||
// everything is hard coded until ICOM gets their act together and start supporting IPv6
|
||||
{
|
||||
ReadOptions();
|
||||
@@ -46,8 +46,7 @@ bool CG3Protocol::Initialize(const char */*type*/, const int /*type*/, const uin
|
||||
//m_ReflectorCallsign.PatchCallsign(0, (const uint8_t *)"XLX", 3);
|
||||
|
||||
// create our sockets
|
||||
auto s = g_Reflector.m_Address.GetV4Address(PROTOCOL_G3);
|
||||
CIp ip(AF_INET, G3_DV_PORT, s.c_str());
|
||||
CIp ip(AF_INET, G3_DV_PORT, LISTEN_IPV4);
|
||||
if ( ip.IsSet() )
|
||||
{
|
||||
if (! m_Socket4.Open(ip))
|
||||
@@ -181,7 +180,7 @@ void CG3Protocol::PresenceTask(void)
|
||||
CClients *clients = g_Reflector.GetClients();
|
||||
auto it = clients->begin();
|
||||
std::shared_ptr<CClient>extant = nullptr;
|
||||
while ( (extant = clients->FindNextClient(PROTOCOL_G3, it)) != nullptr )
|
||||
while ( (extant = clients->FindNextClient(EProtocol::g3, it)) != nullptr )
|
||||
{
|
||||
CIp ClIp = extant->GetIp();
|
||||
if (ClIp.GetAddr() == Ip.GetAddr())
|
||||
@@ -195,7 +194,7 @@ void CG3Protocol::PresenceTask(void)
|
||||
it = clients->begin();
|
||||
|
||||
// do we already have a client with the same call (IP changed)?
|
||||
while ( (extant = clients->FindNextClient(PROTOCOL_G3, it)) != nullptr )
|
||||
while ( (extant = clients->FindNextClient(EProtocol::g3, it)) != nullptr )
|
||||
{
|
||||
if (extant->GetCallsign().HasSameCallsign(Terminal))
|
||||
{
|
||||
@@ -347,7 +346,7 @@ void CG3Protocol::IcmpTask(void)
|
||||
CClients *clients = g_Reflector.GetClients();
|
||||
auto it = clients->begin();
|
||||
std::shared_ptr<CClient>client = nullptr;
|
||||
while ( (client = clients->FindNextClient(PROTOCOL_G3, it)) != nullptr )
|
||||
while ( (client = clients->FindNextClient(EProtocol::g3, it)) != nullptr )
|
||||
{
|
||||
CIp ClientIp = client->GetIp();
|
||||
if (ClientIp.GetAddr() == Ip.GetAddr())
|
||||
@@ -383,7 +382,7 @@ void CG3Protocol::Task(void)
|
||||
CClients *clients = g_Reflector.GetClients();
|
||||
auto it = clients->begin();
|
||||
std::shared_ptr<CClient>client = nullptr;
|
||||
while ( (client = clients->FindNextClient(PROTOCOL_G3, it)) != nullptr )
|
||||
while ( (client = clients->FindNextClient(EProtocol::g3, it)) != nullptr )
|
||||
{
|
||||
ClIp = client->GetIp();
|
||||
if (ClIp.GetAddr() == Ip.GetAddr())
|
||||
@@ -408,7 +407,7 @@ void CG3Protocol::Task(void)
|
||||
else if ( IsValidDvHeaderPacket(Buffer, Header) )
|
||||
{
|
||||
// callsign muted?
|
||||
if ( g_GateKeeper.MayTransmit(Header->GetMyCallsign(), Ip, PROTOCOL_G3, Header->GetRpt2Module()) )
|
||||
if ( g_GateKeeper.MayTransmit(Header->GetMyCallsign(), Ip, EProtocol::g3, Header->GetRpt2Module()) )
|
||||
{
|
||||
// handle it
|
||||
OnDvHeaderPacketIn(Header, *BaseIp);
|
||||
@@ -464,7 +463,7 @@ void CG3Protocol::HandleQueue(void)
|
||||
CClients *clients = g_Reflector.GetClients();
|
||||
auto it = clients->begin();
|
||||
std::shared_ptr<CClient>client = nullptr;
|
||||
while ( (client = clients->FindNextClient(PROTOCOL_G3, it)) != nullptr )
|
||||
while ( (client = clients->FindNextClient(EProtocol::g3, it)) != nullptr )
|
||||
{
|
||||
// is this client busy ?
|
||||
if ( !client->IsAMaster() && (client->GetReflectorModule() == packet->GetModuleId()) )
|
||||
@@ -497,7 +496,7 @@ void CG3Protocol::HandleKeepalives(void)
|
||||
CClients *clients = g_Reflector.GetClients();
|
||||
auto it = clients->begin();
|
||||
std::shared_ptr<CClient>client = nullptr;
|
||||
while ( (client = clients->FindNextClient(PROTOCOL_G3, it)) != nullptr )
|
||||
while ( (client = clients->FindNextClient(EProtocol::g3, it)) != nullptr )
|
||||
{
|
||||
if (!client->IsAlive())
|
||||
{
|
||||
@@ -537,7 +536,7 @@ void CG3Protocol::OnDvHeaderPacketIn(std::unique_ptr<CDvHeaderPacket> &Header, c
|
||||
CClients *clients = g_Reflector.GetClients();
|
||||
auto it = clients->begin();
|
||||
std::shared_ptr<CClient>client = nullptr;
|
||||
while ( (client = clients->FindNextClient(PROTOCOL_G3, it)) != nullptr )
|
||||
while ( (client = clients->FindNextClient(EProtocol::g3, it)) != nullptr )
|
||||
{
|
||||
CIp ClIp = client->GetIp();
|
||||
if (ClIp.GetAddr() == Ip.GetAddr())
|
||||
@@ -705,7 +704,7 @@ void CG3Protocol::NeedReload(void)
|
||||
CClients *clients = g_Reflector.GetClients();
|
||||
auto it = clients->begin();
|
||||
std::shared_ptr<CClient>client = nullptr;
|
||||
while ( (client = clients->FindNextClient(PROTOCOL_G3, it)) != nullptr )
|
||||
while ( (client = clients->FindNextClient(EProtocol::g3, it)) != nullptr )
|
||||
{
|
||||
char module = client->GetReflectorModule();
|
||||
if (!strchr(m_Modules.c_str(), module) && !strchr(m_Modules.c_str(), '*'))
|
||||
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
CG3Protocol() : m_GwAddress(0u), m_Modules("*"), m_LastModTime(0) {}
|
||||
|
||||
// initialization
|
||||
bool Initialize(const char *type, const int ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6);
|
||||
bool Initialize(const char *type, const EProtocol ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6);
|
||||
|
||||
// close
|
||||
void Close(void);
|
||||
|
||||
+49
-23
@@ -75,21 +75,21 @@ void CGateKeeper::Close(void)
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// authorisations
|
||||
|
||||
bool CGateKeeper::MayLink(const CCallsign &callsign, const CIp &ip, int protocol, char *modules) const
|
||||
bool CGateKeeper::MayLink(const CCallsign &callsign, const CIp &ip, EProtocol protocol, char *modules) const
|
||||
{
|
||||
bool ok = true;
|
||||
|
||||
switch (protocol)
|
||||
{
|
||||
// repeaters
|
||||
case PROTOCOL_DEXTRA:
|
||||
case PROTOCOL_DPLUS:
|
||||
case PROTOCOL_DCS:
|
||||
case PROTOCOL_DMRPLUS:
|
||||
case PROTOCOL_DMRMMDVM:
|
||||
case PROTOCOL_YSF:
|
||||
case EProtocol::dextra:
|
||||
case EProtocol::dplus:
|
||||
case EProtocol::dcs:
|
||||
case EProtocol::dmrplus:
|
||||
case EProtocol::dmrmmdvm:
|
||||
case EProtocol::ysf:
|
||||
#ifndef NO_G3
|
||||
case PROTOCOL_G3:
|
||||
case EProtocol::g3:
|
||||
#endif
|
||||
// first check is IP & callsigned listed OK
|
||||
ok &= IsNodeListedOk(callsign, ip);
|
||||
@@ -97,12 +97,12 @@ bool CGateKeeper::MayLink(const CCallsign &callsign, const CIp &ip, int protocol
|
||||
break;
|
||||
|
||||
// XLX interlinks
|
||||
case PROTOCOL_XLX:
|
||||
case EProtocol::ulx:
|
||||
ok &= IsPeerListedOk(callsign, ip, modules);
|
||||
break;
|
||||
|
||||
// unsupported
|
||||
case PROTOCOL_NONE:
|
||||
case EProtocol::none:
|
||||
default:
|
||||
ok = false;
|
||||
break;
|
||||
@@ -111,29 +111,29 @@ bool CGateKeeper::MayLink(const CCallsign &callsign, const CIp &ip, int protocol
|
||||
// report
|
||||
if ( !ok )
|
||||
{
|
||||
std::cout << "Gatekeeper blocking linking of " << callsign << " @ " << ip << " using protocol " << protocol << std::endl;
|
||||
std::cout << "Gatekeeper blocking linking of " << callsign << " @ " << ip << " using protocol " << ProtocolName(protocol) << std::endl;
|
||||
}
|
||||
|
||||
// done
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool CGateKeeper::MayTransmit(const CCallsign &callsign, const CIp &ip, int protocol, char module) const
|
||||
bool CGateKeeper::MayTransmit(const CCallsign &callsign, const CIp &ip, const EProtocol protocol, char module) const
|
||||
{
|
||||
bool ok = true;
|
||||
|
||||
switch (protocol)
|
||||
{
|
||||
// repeaters, protocol specific
|
||||
case PROTOCOL_ANY:
|
||||
case PROTOCOL_DEXTRA:
|
||||
case PROTOCOL_DPLUS:
|
||||
case PROTOCOL_DCS:
|
||||
case PROTOCOL_DMRPLUS:
|
||||
case PROTOCOL_DMRMMDVM:
|
||||
case PROTOCOL_YSF:
|
||||
case EProtocol::any:
|
||||
case EProtocol::dextra:
|
||||
case EProtocol::dplus:
|
||||
case EProtocol::dcs:
|
||||
case EProtocol::dmrplus:
|
||||
case EProtocol::dmrmmdvm:
|
||||
case EProtocol::ysf:
|
||||
#ifndef NO_G3
|
||||
case PROTOCOL_G3:
|
||||
case EProtocol::g3:
|
||||
#endif
|
||||
// first check is IP & callsigned listed OK
|
||||
ok = ok && IsNodeListedOk(callsign, ip, module);
|
||||
@@ -141,12 +141,12 @@ bool CGateKeeper::MayTransmit(const CCallsign &callsign, const CIp &ip, int prot
|
||||
break;
|
||||
|
||||
// XLX interlinks
|
||||
case PROTOCOL_XLX:
|
||||
case EProtocol::ulx:
|
||||
ok = ok && IsPeerListedOk(callsign, ip, module);
|
||||
break;
|
||||
|
||||
// unsupported
|
||||
case PROTOCOL_NONE:
|
||||
case EProtocol::none:
|
||||
default:
|
||||
ok = false;
|
||||
break;
|
||||
@@ -155,7 +155,7 @@ bool CGateKeeper::MayTransmit(const CCallsign &callsign, const CIp &ip, int prot
|
||||
// report
|
||||
if ( !ok )
|
||||
{
|
||||
std::cout << "Gatekeeper blocking transmitting of " << callsign << " @ " << ip << " using protocol " << protocol << std::endl;
|
||||
std::cout << "Gatekeeper blocking transmitting of " << callsign << " @ " << ip << " using protocol " << ProtocolName(protocol) << std::endl;
|
||||
}
|
||||
|
||||
// done
|
||||
@@ -264,3 +264,29 @@ bool CGateKeeper::IsPeerListedOk(const CCallsign &callsign, const CIp &ip, char
|
||||
// done
|
||||
return ok;
|
||||
}
|
||||
|
||||
const std::string CGateKeeper::ProtocolName(const EProtocol p) const
|
||||
{
|
||||
switch (p) {
|
||||
case EProtocol::any:
|
||||
return "ANY";
|
||||
case EProtocol::dcs:
|
||||
return "DCS";
|
||||
case EProtocol::dextra:
|
||||
return "DExtra";
|
||||
case EProtocol::dmrmmdvm:
|
||||
return "MMDVM DMR";
|
||||
case EProtocol::dmrplus:
|
||||
return "DMR+";
|
||||
case EProtocol::ulx:
|
||||
return "ULX";
|
||||
case EProtocol::ysf:
|
||||
return "YSF";
|
||||
#ifndef NO_G3
|
||||
case EProtocol::g3:
|
||||
return "Icom G3";
|
||||
#endif
|
||||
default:
|
||||
return "NONE";
|
||||
}
|
||||
}
|
||||
@@ -42,8 +42,8 @@ public:
|
||||
void Close(void);
|
||||
|
||||
// authorizations
|
||||
bool MayLink(const CCallsign &, const CIp &, int, char * = nullptr) const;
|
||||
bool MayTransmit(const CCallsign &, const CIp &, int = PROTOCOL_ANY, char = ' ') const;
|
||||
bool MayLink(const CCallsign &, const CIp &, const EProtocol, char * = nullptr) const;
|
||||
bool MayTransmit(const CCallsign &, const CIp &, EProtocol = EProtocol::any, char = ' ') const;
|
||||
|
||||
// peer list handeling
|
||||
CPeerCallsignList *GetPeerList(void) { m_PeerList.Lock(); return &m_PeerList; }
|
||||
@@ -57,6 +57,7 @@ protected:
|
||||
bool IsNodeListedOk(const CCallsign &, const CIp &, char = ' ') const;
|
||||
bool IsPeerListedOk(const CCallsign &, const CIp &, char) const;
|
||||
bool IsPeerListedOk(const CCallsign &, const CIp &, char *) const;
|
||||
const std::string ProtocolName(EProtocol) const;
|
||||
|
||||
protected:
|
||||
// data
|
||||
|
||||
+3
-10
@@ -71,17 +71,10 @@
|
||||
|
||||
// protocols ---------------------------------------------------
|
||||
|
||||
#define PROTOCOL_ANY -1
|
||||
#define PROTOCOL_NONE 0
|
||||
#define PROTOCOL_DEXTRA 1
|
||||
#define PROTOCOL_DPLUS 2
|
||||
#define PROTOCOL_DCS 3
|
||||
#define PROTOCOL_XLX 4
|
||||
#define PROTOCOL_DMRPLUS 5
|
||||
#define PROTOCOL_DMRMMDVM 6
|
||||
#define PROTOCOL_YSF 7
|
||||
#ifndef NO_G3
|
||||
#define PROTOCOL_G3 8
|
||||
enum class EProtocol { any, none, dextra, dplus, dcs, ulx, dmrplus, dmrmmdvm, ysf, g3 };
|
||||
#else
|
||||
enum class EProtocol { any, none, dextra, dplus, dcs, xlx, dmrplus, dmrmmdvm, ysf };
|
||||
#endif
|
||||
|
||||
// DExtra
|
||||
|
||||
+1
-7
@@ -36,18 +36,16 @@ endif
|
||||
|
||||
LDFLAGS=-pthread
|
||||
|
||||
XRFSRCS = Buffer.cpp Callsign.cpp CallsignList.cpp CallsignListItem.cpp Client.cpp Clients.cpp DCSClient.cpp DCSProtocol.cpp DExtraClient.cpp DExtraPeer.cpp DExtraProtocol.cpp DPlusClient.cpp DPlusProtocol.cpp DVFramePacket.cpp DVHeaderPacket.cpp DVLastFramePacket.cpp GateKeeper.cpp IP.cpp Notification.cpp Packet.cpp PacketStream.cpp PeerCallsignList.cpp Peer.cpp Peers.cpp ProtoAddress.cpp Protocol.cpp Protocols.cpp Reflector.cpp UDPSocket.cpp User.cpp Users.cpp Version.cpp Main.cpp
|
||||
XRFSRCS = Buffer.cpp Callsign.cpp CallsignList.cpp CallsignListItem.cpp Client.cpp Clients.cpp DCSClient.cpp DCSProtocol.cpp DExtraClient.cpp DExtraPeer.cpp DExtraProtocol.cpp DPlusClient.cpp DPlusProtocol.cpp DVFramePacket.cpp DVHeaderPacket.cpp DVLastFramePacket.cpp GateKeeper.cpp IP.cpp Notification.cpp Packet.cpp PacketStream.cpp PeerCallsignList.cpp Peer.cpp Peers.cpp Protocol.cpp Protocols.cpp Reflector.cpp UDPSocket.cpp User.cpp Users.cpp Version.cpp Main.cpp
|
||||
XLXSRCS = BMClient.cpp BMPeer.cpp BPTC19696.cpp CRC.cpp DMRIdDir.cpp DMRIdDirFile.cpp DMRIdDirHttp.cpp DMRMMDVMClient.cpp DMRMMDVMProtocol.cpp DMRPlusClient.cpp DMRPlusProtocol.cpp Golay2087.cpp Golay24128.cpp Hamming.cpp QR1676.cpp RS129.cpp Semaphore.cpp Utils.cpp WiresXCmd.cpp WiresXCmdHandler.cpp WiresXInfo.cpp ULXClient.cpp ULXProtocol.cpp ULXPeer.cpp YSFClient.cpp YSFConvolution.cpp YSFFich.cpp YSFNode.cpp YSFNodeDir.cpp YSFNodeDirFile.cpp YSFNodeDirHttp.cpp YSFPayload.cpp YSFProtocol.cpp YSFUtils.cpp
|
||||
G3SRCS = G3Client.cpp G3Protocol.cpp RawSocket.cpp UDPMsgSocket.cpp
|
||||
|
||||
SRCS = $(XRFSRCS)
|
||||
|
||||
ifeq ($(is_xlx), true)
|
||||
SRCS += $(XLXSRCS)
|
||||
ifeq ($(ysf_db), true)
|
||||
LDFLAGS += `mysql_config --libs`
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef tc_ip
|
||||
SRCS += Transcoder.cpp CodecStream.cpp
|
||||
@@ -60,11 +58,7 @@ endif
|
||||
OBJS = $(SRCS:.cpp=.o)
|
||||
DEPS = $(SRCS:.cpp=.d)
|
||||
|
||||
ifeq ($(is_xlx), true)
|
||||
EXE=ulxd
|
||||
else
|
||||
EXE=xrfd
|
||||
endif
|
||||
|
||||
all : $(EXE)
|
||||
|
||||
|
||||
+2
-2
@@ -46,9 +46,9 @@ public:
|
||||
// set
|
||||
|
||||
// identity
|
||||
virtual int GetProtocol(void) const { return PROTOCOL_NONE; }
|
||||
virtual EProtocol GetProtocol(void) const { return EProtocol::none; }
|
||||
virtual int GetProtocolRevision(void) const { return 0; }
|
||||
virtual const char *GetProtocolName(void) const { return "none"; }
|
||||
virtual const char *GetProtocolName(void) const { return "NONE"; }
|
||||
|
||||
// status
|
||||
virtual bool IsAMaster(void) const;
|
||||
|
||||
+4
-4
@@ -107,7 +107,7 @@ void CPeers::RemovePeer(std::shared_ptr<CPeer> peer)
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// find peers
|
||||
|
||||
std::shared_ptr<CPeer> CPeers::FindPeer(const CIp &Ip, int Protocol)
|
||||
std::shared_ptr<CPeer> CPeers::FindPeer(const CIp &Ip, const EProtocol Protocol)
|
||||
{
|
||||
for ( auto it=begin(); it!=end(); it++ )
|
||||
{
|
||||
@@ -120,7 +120,7 @@ std::shared_ptr<CPeer> CPeers::FindPeer(const CIp &Ip, int Protocol)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<CPeer> CPeers::FindPeer(const CCallsign &Callsign, const CIp &Ip, int Protocol)
|
||||
std::shared_ptr<CPeer> CPeers::FindPeer(const CCallsign &Callsign, const CIp &Ip, const EProtocol Protocol)
|
||||
{
|
||||
for ( auto it=begin(); it!=end(); it++ )
|
||||
{
|
||||
@@ -133,7 +133,7 @@ std::shared_ptr<CPeer> CPeers::FindPeer(const CCallsign &Callsign, const CIp &Ip
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<CPeer> CPeers::FindPeer(const CCallsign &Callsign, int Protocol)
|
||||
std::shared_ptr<CPeer> CPeers::FindPeer(const CCallsign &Callsign, const EProtocol Protocol)
|
||||
{
|
||||
for ( auto it=begin(); it!=end(); it++ )
|
||||
{
|
||||
@@ -150,7 +150,7 @@ std::shared_ptr<CPeer> CPeers::FindPeer(const CCallsign &Callsign, int Protocol)
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// iterate on peers
|
||||
|
||||
std::shared_ptr<CPeer> CPeers::FindNextPeer(int Protocol, std::list<std::shared_ptr<CPeer>>::iterator &it)
|
||||
std::shared_ptr<CPeer> CPeers::FindNextPeer(const EProtocol Protocol, std::list<std::shared_ptr<CPeer>>::iterator &it)
|
||||
{
|
||||
while ( it!=end() )
|
||||
{
|
||||
|
||||
+4
-4
@@ -45,12 +45,12 @@ public:
|
||||
std::list<std::shared_ptr<CPeer>>::const_iterator cend() const { return m_Peers.cend(); }
|
||||
|
||||
// find peers
|
||||
std::shared_ptr<CPeer> FindPeer(const CIp &, int);
|
||||
std::shared_ptr<CPeer> FindPeer(const CCallsign &, const CIp &, int);
|
||||
std::shared_ptr<CPeer> FindPeer(const CCallsign &, int);
|
||||
std::shared_ptr<CPeer> FindPeer(const CIp &, const EProtocol);
|
||||
std::shared_ptr<CPeer> FindPeer(const CCallsign &, const CIp &, const EProtocol);
|
||||
std::shared_ptr<CPeer> FindPeer(const CCallsign &, const EProtocol);
|
||||
|
||||
// iterate on peers
|
||||
std::shared_ptr<CPeer> FindNextPeer(int, std::list<std::shared_ptr<CPeer>>::iterator &);
|
||||
std::shared_ptr<CPeer> FindNextPeer(const EProtocol, std::list<std::shared_ptr<CPeer>>::iterator &);
|
||||
|
||||
protected:
|
||||
// data
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
// ulxd -- 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 "ProtoAddress.h"
|
||||
|
||||
CProtoAddress::CProtoAddress()
|
||||
{
|
||||
#ifdef LISTEN_IPV4
|
||||
v4address[PROTOCOL_ANY] = LISTEN_IPV4;
|
||||
#endif
|
||||
#ifdef LISTEN_V4_DPLUS
|
||||
v4address[PROTOCOL_DPLUS] = LISTEN_V4_DPLUS;
|
||||
#endif
|
||||
#ifdef LISTEN_V4_DCS
|
||||
v4address[PROTOCOL_DCS] = LISTEN_V4_DCS;
|
||||
#endif
|
||||
#ifdef LISTEN_V4_DEXTRA
|
||||
v4address[PROTOCOL_DEXTRA] = LISTEN_V4_DEXTRA;
|
||||
#endif
|
||||
#ifdef LISTEN_V4_DMRMMDVM
|
||||
v4address[PROTOCOL_DMRMMDVM] = LISTEN_V4_DMRMMDVM;
|
||||
#endif
|
||||
#ifdef LISTEN_V4_DMRPLUS
|
||||
v4address[PROTOCOL_DMRPLUS] = LISTEN_V4_DMRPLUS;
|
||||
#endif
|
||||
#ifdef LISTEN_V4_YSF
|
||||
v4address[PROTOCOL_YSF] = LISTEN_V4_YSF;
|
||||
#endif
|
||||
#ifdef LISTEN_V4_XLX
|
||||
v4address[PROTOCOL_XLX] = LISTEN_V4_XLX;
|
||||
#endif
|
||||
#ifdef LISTEN_V4_G3
|
||||
v4address[PROTOCOL_G3] = LISTEN_V4_G3;
|
||||
#endif
|
||||
|
||||
#ifdef LISTEN_IPV6
|
||||
v6address[PROTOCOL_ANY] = LISTEN_IPV6;
|
||||
#endif
|
||||
#ifdef LISTEN_V6_DPLUS
|
||||
v6address[PROTOCOL_DPLUS] = LISTEN_V6_DPLUS;
|
||||
#endif
|
||||
#ifdef LISTEN_V6_DCS
|
||||
v6address[PROTOCOL_DCS] = LISTEN_V6_DCS;
|
||||
#endif
|
||||
#ifdef LISTEN_V6_DEXTRA
|
||||
v6address[PROTOCOL_DEXTRA] = LISTEN_V6_DEXTRA;
|
||||
#endif
|
||||
#ifdef LISTEN_V6_DMRMMDVM
|
||||
v6address[PROTOCOL_DMRMMDVM] = LISTEN_V6_DMRMMDVM;
|
||||
#endif
|
||||
#ifdef LISTEN_V6_DMRPLUS
|
||||
v6address[PROTOCOL_DMRPLUS] = LISTEN_V6_DMRPLUS;
|
||||
#endif
|
||||
#ifdef LISTEN_V6_YSF
|
||||
v6address[PROTOCOL_YSF] = LISTEN_V6_YSF;
|
||||
#endif
|
||||
#ifdef LISTEN_V6_XLX
|
||||
v6address[PROTOCOL_XLX] = LISTEN_V6_XLX;
|
||||
#endif
|
||||
#ifdef LISTEN_V6_G3
|
||||
v6address[PROTOCOL_G3] = LISTEN_V6_G3;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef LISTEN_IPV4
|
||||
std::string CProtoAddress::GetV4Address(int protocol)
|
||||
{
|
||||
if (v4address.end() == v4address.find(protocol))
|
||||
return v4address[PROTOCOL_ANY];
|
||||
else
|
||||
return v4address[protocol];
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LISTEN_IPV6
|
||||
std::string CProtoAddress::GetV6Address(int protocol)
|
||||
{
|
||||
if (v6address.end() == v6address.find(protocol))
|
||||
return v6address[PROTOCOL_ANY];
|
||||
else
|
||||
return v6address[protocol];
|
||||
}
|
||||
#endif
|
||||
@@ -1,42 +0,0 @@
|
||||
// ulxd -- 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/>.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <unordered_map>
|
||||
#include <string>
|
||||
|
||||
#include "Main.h"
|
||||
|
||||
class CProtoAddress
|
||||
{
|
||||
public:
|
||||
CProtoAddress();
|
||||
#ifdef LISTEN_IPV4
|
||||
std::string GetV4Address(int protocol);
|
||||
#endif
|
||||
#ifdef LISTEN_IPV6
|
||||
std::string GetV6Address(int protocol);
|
||||
#endif
|
||||
|
||||
private:
|
||||
#ifdef LISTEN_IPV4
|
||||
std::unordered_map<int, std::string> v4address;
|
||||
#endif
|
||||
#ifdef LISTEN_IPV6
|
||||
std::unordered_map<int, std::string> v6address;
|
||||
#endif
|
||||
};
|
||||
@@ -49,7 +49,7 @@ CProtocol::~CProtocol()
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// initialization
|
||||
|
||||
bool CProtocol::Initialize(const char *type, int ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6)
|
||||
bool CProtocol::Initialize(const char *type, const EProtocol ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6)
|
||||
{
|
||||
// init reflector apparent callsign
|
||||
m_ReflectorCallsign = g_Reflector.GetCallsign();
|
||||
@@ -65,8 +65,7 @@ bool CProtocol::Initialize(const char *type, int ptype, const uint16_t port, con
|
||||
#ifdef LISTEN_IPV4
|
||||
if (has_ipv4)
|
||||
{
|
||||
const auto s = g_Reflector.m_Address.GetV4Address(ptype);
|
||||
CIp ip4(AF_INET, port, s.c_str());
|
||||
CIp ip4(AF_INET, port, LISTEN_IPV4);
|
||||
if ( ip4.IsSet() )
|
||||
{
|
||||
if (! m_Socket4.Open(ip4))
|
||||
@@ -79,7 +78,7 @@ bool CProtocol::Initialize(const char *type, int ptype, const uint16_t port, con
|
||||
#ifdef LISTEN_IPV6
|
||||
if (has_ipv6)
|
||||
{
|
||||
CIp ip6(AF_INET6, port, g_Reflector.m_Address.GetV6Address(ptype).c_str());
|
||||
CIp ip6(AF_INET6, port, LISTEN_IPV6);
|
||||
if ( ip6.IsSet() )
|
||||
{
|
||||
if (! m_Socket6.Open(ip6))
|
||||
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
virtual ~CProtocol();
|
||||
|
||||
// initialization
|
||||
virtual bool Initialize(const char *type, const int ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6);
|
||||
virtual bool Initialize(const char *type, const EProtocol ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6);
|
||||
virtual void Close(void);
|
||||
|
||||
// queue
|
||||
|
||||
@@ -45,36 +45,36 @@ bool CProtocols::Init(void)
|
||||
m_Mutex.lock();
|
||||
{
|
||||
m_Protocols.emplace_back(std::unique_ptr<CDextraProtocol>(new CDextraProtocol));
|
||||
if (! m_Protocols.back()->Initialize("XRF", PROTOCOL_DEXTRA, DEXTRA_PORT, DSTAR_IPV4, DSTAR_IPV6))
|
||||
if (! m_Protocols.back()->Initialize("XRF", EProtocol::dextra, DEXTRA_PORT, DSTAR_IPV4, DSTAR_IPV6))
|
||||
return false;
|
||||
|
||||
m_Protocols.emplace_back(std::unique_ptr<CDplusProtocol>(new CDplusProtocol));
|
||||
if (! m_Protocols.back()->Initialize("REF", PROTOCOL_DPLUS, DPLUS_PORT, DSTAR_IPV4, DSTAR_IPV6))
|
||||
if (! m_Protocols.back()->Initialize("REF", EProtocol::dplus, DPLUS_PORT, DSTAR_IPV4, DSTAR_IPV6))
|
||||
return false;
|
||||
|
||||
m_Protocols.emplace_back(std::unique_ptr<CDcsProtocol>(new CDcsProtocol));
|
||||
if (! m_Protocols.back()->Initialize("DCS", PROTOCOL_DCS, DCS_PORT, DSTAR_IPV4, DSTAR_IPV6))
|
||||
if (! m_Protocols.back()->Initialize("DCS", EProtocol::dcs, DCS_PORT, DSTAR_IPV4, DSTAR_IPV6))
|
||||
return false;
|
||||
|
||||
m_Protocols.emplace_back(std::unique_ptr<CDmrmmdvmProtocol>(new CDmrmmdvmProtocol));
|
||||
if (! m_Protocols.back()->Initialize(nullptr, PROTOCOL_DMRMMDVM, DMRMMDVM_PORT, DMR_IPV4, DMR_IPV6))
|
||||
if (! m_Protocols.back()->Initialize(nullptr, EProtocol::dmrmmdvm, DMRMMDVM_PORT, DMR_IPV4, DMR_IPV6))
|
||||
return false;
|
||||
|
||||
m_Protocols.emplace_back(std::unique_ptr<CDmrplusProtocol>(new CDmrplusProtocol));
|
||||
if (! m_Protocols.back()->Initialize(nullptr, PROTOCOL_DMRPLUS, DMRPLUS_PORT, DMR_IPV4, DMR_IPV6))
|
||||
if (! m_Protocols.back()->Initialize(nullptr, EProtocol::dmrplus, DMRPLUS_PORT, DMR_IPV4, DMR_IPV6))
|
||||
return false;
|
||||
|
||||
m_Protocols.emplace_back(std::unique_ptr<CYsfProtocol>(new CYsfProtocol));
|
||||
if (! m_Protocols.back()->Initialize("YSF", PROTOCOL_YSF, YSF_PORT, YSF_IPV4, YSF_IPV6))
|
||||
if (! m_Protocols.back()->Initialize("YSF", EProtocol::ysf, YSF_PORT, YSF_IPV4, YSF_IPV6))
|
||||
return false;
|
||||
|
||||
m_Protocols.emplace_back(std::unique_ptr<CUlxProtocol>(new CUlxProtocol));
|
||||
if (! m_Protocols.back()->Initialize("XLX", PROTOCOL_XLX, XLX_PORT, DMR_IPV4, DMR_IPV6))
|
||||
if (! m_Protocols.back()->Initialize("XLX", EProtocol::ulx, XLX_PORT, DMR_IPV4, DMR_IPV6))
|
||||
return false;
|
||||
|
||||
#ifndef NO_G3
|
||||
m_Protocols.emplace_back(std::unique_ptr<CG3Protocol>(new CG3Protocol));
|
||||
if (! m_Protocols.back()->Initialize("XLX", PROTOCOL_G3, G3_DV_PORT, DMR_IPV4, DMR_IPV6))
|
||||
if (! m_Protocols.back()->Initialize("XLX", EProtocol::g3, G3_DV_PORT, DMR_IPV4, DMR_IPV6))
|
||||
return false;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ProtoAddress.h"
|
||||
#include "Users.h"
|
||||
#include "Clients.h"
|
||||
#include "Peers.h"
|
||||
@@ -78,9 +77,6 @@ public:
|
||||
CUsers *GetUsers(void) { m_Users.Lock(); return &m_Users; }
|
||||
void ReleaseUsers(void) { m_Users.Unlock(); }
|
||||
|
||||
// IP Addresses
|
||||
CProtoAddress m_Address;
|
||||
|
||||
// get
|
||||
bool IsValidModule(char c) const { return (GetModuleIndex(c) >= 0); }
|
||||
int GetModuleIndex(char) const;
|
||||
|
||||
@@ -76,14 +76,14 @@ bool CTranscoder::Init(void)
|
||||
// now open the transcoder port
|
||||
#ifdef LISTEN_IPV4
|
||||
#ifdef LISTEN_IPV6
|
||||
const auto paddr = (AF_INET == m_Ip.GetFamily()) ? g_Reflector.m_Address.GetV4Address(PROTOCOL_ANY) : g_Reflector.m_Address.GetV6Address(PROTOCOL_ANY);
|
||||
auto paddr = (AF_INET == m_Ip.GetFamily()) ? LISTEN_IPV4 : LISTEN_IPV6;
|
||||
#else
|
||||
const auto paddr = g_Reflector.m_Address.GetV4Address(PROTOCOL_ANY);
|
||||
auto paddr = LISTEN_IPV4;
|
||||
#endif
|
||||
#else
|
||||
const auto paddr = g_Reflector.m_address.GetV6Address(PROTOCOL_ANY);
|
||||
auto paddr = LISTEN_IPV6;
|
||||
#endif
|
||||
CIp tc(m_Ip.GetFamily(), TRANSCODER_PORT, paddr.c_str());
|
||||
CIp tc(m_Ip.GetFamily(), TRANSCODER_PORT, paddr);
|
||||
|
||||
// create our socket
|
||||
if (tc.IsSet())
|
||||
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
virtual ~CUlxClient() {};
|
||||
|
||||
// identity
|
||||
int GetProtocol(void) const { return PROTOCOL_XLX; }
|
||||
EProtocol GetProtocol(void) const { return EProtocol::ulx; }
|
||||
int GetProtocolRevision(void) const { return m_ProtRev; }
|
||||
const char *GetProtocolName(void) const { return "XLX"; }
|
||||
int GetCodec(void) const;
|
||||
|
||||
+2
-2
@@ -33,8 +33,8 @@ public:
|
||||
bool IsAlive(void) const;
|
||||
|
||||
// identity
|
||||
int GetProtocol(void) const { return PROTOCOL_XLX; }
|
||||
const char *GetProtocolName(void) const { return "XLX"; }
|
||||
EProtocol GetProtocol(void) const { return EProtocol::ulx; }
|
||||
const char *GetProtocolName(void) const { return "ULX"; }
|
||||
|
||||
// revision helper
|
||||
static int GetProtocolRevision(const CVersion &);
|
||||
|
||||
+12
-12
@@ -28,7 +28,7 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// operation
|
||||
|
||||
bool CUlxProtocol::Initialize(const char *type, const int ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6)
|
||||
bool CUlxProtocol::Initialize(const char *type, const EProtocol ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6)
|
||||
{
|
||||
if (! CProtocol::Initialize(type, ptype, port, has_ipv4, has_ipv6))
|
||||
return false;
|
||||
@@ -88,7 +88,7 @@ void CUlxProtocol::Task(void)
|
||||
std::cout << "XLX (" << Version.GetMajor() << "." << Version.GetMinor() << "." << Version.GetRevision() << ") connect packet for modules " << Modules << " from " << Callsign << " at " << Ip << std::endl;
|
||||
|
||||
// callsign authorized?
|
||||
if ( g_GateKeeper.MayLink(Callsign, Ip, PROTOCOL_XLX, Modules) )
|
||||
if ( g_GateKeeper.MayLink(Callsign, Ip, EProtocol::ulx, Modules) )
|
||||
{
|
||||
// acknowledge connecting request
|
||||
// following is version dependent
|
||||
@@ -98,7 +98,7 @@ void CUlxProtocol::Task(void)
|
||||
{
|
||||
// already connected ?
|
||||
CPeers *peers = g_Reflector.GetPeers();
|
||||
if ( peers->FindPeer(Callsign, Ip, PROTOCOL_XLX) == nullptr )
|
||||
if ( peers->FindPeer(Callsign, Ip, EProtocol::ulx) == nullptr )
|
||||
{
|
||||
// acknowledge the request
|
||||
EncodeConnectAckPacket(&Buffer, Modules);
|
||||
@@ -129,11 +129,11 @@ void CUlxProtocol::Task(void)
|
||||
std::cout << "XLX ack packet for modules " << Modules << " from " << Callsign << " at " << Ip << std::endl;
|
||||
|
||||
// callsign authorized?
|
||||
if ( g_GateKeeper.MayLink(Callsign, Ip, PROTOCOL_XLX, Modules) )
|
||||
if ( g_GateKeeper.MayLink(Callsign, Ip, EProtocol::ulx, Modules) )
|
||||
{
|
||||
// already connected ?
|
||||
CPeers *peers = g_Reflector.GetPeers();
|
||||
if ( peers->FindPeer(Callsign, Ip, PROTOCOL_XLX) == nullptr )
|
||||
if ( peers->FindPeer(Callsign, Ip, EProtocol::ulx) == nullptr )
|
||||
{
|
||||
// create the new peer
|
||||
// this also create one client per module
|
||||
@@ -152,7 +152,7 @@ void CUlxProtocol::Task(void)
|
||||
|
||||
// find peer
|
||||
CPeers *peers = g_Reflector.GetPeers();
|
||||
std::shared_ptr<CPeer>peer = peers->FindPeer(Ip, PROTOCOL_XLX);
|
||||
std::shared_ptr<CPeer>peer = peers->FindPeer(Ip, EProtocol::ulx);
|
||||
if ( peer != nullptr )
|
||||
{
|
||||
// remove it from reflector peer list
|
||||
@@ -172,7 +172,7 @@ void CUlxProtocol::Task(void)
|
||||
|
||||
// find peer
|
||||
CPeers *peers = g_Reflector.GetPeers();
|
||||
std::shared_ptr<CPeer>peer = peers->FindPeer(Ip, PROTOCOL_XLX);
|
||||
std::shared_ptr<CPeer>peer = peers->FindPeer(Ip, EProtocol::ulx);
|
||||
if ( peer != nullptr )
|
||||
{
|
||||
// keep it alive
|
||||
@@ -247,7 +247,7 @@ void CUlxProtocol::HandleQueue(void)
|
||||
CClients *clients = g_Reflector.GetClients();
|
||||
auto it = clients->begin();
|
||||
std::shared_ptr<CClient>client = nullptr;
|
||||
while ( (client = clients->FindNextClient(PROTOCOL_XLX, it)) != nullptr )
|
||||
while ( (client = clients->FindNextClient(EProtocol::ulx, it)) != nullptr )
|
||||
{
|
||||
// is this client busy ?
|
||||
if ( !client->IsAMaster() && (client->GetReflectorModule() == packet->GetModuleId()) )
|
||||
@@ -298,7 +298,7 @@ void CUlxProtocol::HandleKeepalives(void)
|
||||
CPeers *peers = g_Reflector.GetPeers();
|
||||
auto pit = peers->begin();
|
||||
std::shared_ptr<CPeer>peer = nullptr;
|
||||
while ( (peer = peers->FindNextPeer(PROTOCOL_XLX, pit)) != nullptr )
|
||||
while ( (peer = peers->FindNextPeer(EProtocol::ulx, pit)) != nullptr )
|
||||
{
|
||||
// send keepalive
|
||||
Send(keepalive, peer->GetIp());
|
||||
@@ -340,7 +340,7 @@ void CUlxProtocol::HandlePeerLinks(void)
|
||||
// if not, disconnect
|
||||
auto pit = peers->begin();
|
||||
std::shared_ptr<CPeer>peer = nullptr;
|
||||
while ( (peer = peers->FindNextPeer(PROTOCOL_XLX, pit)) != nullptr )
|
||||
while ( (peer = peers->FindNextPeer(EProtocol::ulx, pit)) != nullptr )
|
||||
{
|
||||
if ( list->FindListItem(peer->GetCallsign()) == nullptr )
|
||||
{
|
||||
@@ -359,7 +359,7 @@ void CUlxProtocol::HandlePeerLinks(void)
|
||||
{
|
||||
if ( (*it).GetCallsign().HasSameCallsignWithWildcard(CCallsign("XRF*")) )
|
||||
continue;
|
||||
if ( peers->FindPeer((*it).GetCallsign(), PROTOCOL_XLX) == nullptr )
|
||||
if ( peers->FindPeer((*it).GetCallsign(), EProtocol::ulx) == nullptr )
|
||||
{
|
||||
// resolve again peer's IP in case it's a dynamic IP
|
||||
(*it).ResolveIp();
|
||||
@@ -404,7 +404,7 @@ void CUlxProtocol::OnDvHeaderPacketIn(std::unique_ptr<CDvHeaderPacket> &Header,
|
||||
CCallsign rpt2(Header->GetRpt2Callsign());
|
||||
// no stream open yet, open a new one
|
||||
// find this client
|
||||
std::shared_ptr<CClient>client = g_Reflector.GetClients()->FindClient(Ip, PROTOCOL_XLX, Header->GetRpt2Module());
|
||||
std::shared_ptr<CClient>client = g_Reflector.GetClients()->FindClient(Ip, EProtocol::ulx, Header->GetRpt2Module());
|
||||
if ( client )
|
||||
{
|
||||
// and try to open the stream
|
||||
|
||||
@@ -34,7 +34,7 @@ class CUlxProtocol : public CDextraProtocol
|
||||
{
|
||||
public:
|
||||
// initialization
|
||||
bool Initialize(const char *type, const int ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6);
|
||||
bool Initialize(const char *type, const EProtocol ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6);
|
||||
|
||||
// task
|
||||
void Task(void);
|
||||
|
||||
@@ -149,7 +149,7 @@ void CWiresxCmdHandler::Task(void)
|
||||
// find our client and the module it's currentlink linked to
|
||||
cModule = ' ';
|
||||
CClients *clients = g_Reflector.GetClients();
|
||||
std::shared_ptr<CClient>client = clients->FindClient(Cmd.GetCallsign(), Cmd.GetIp(), PROTOCOL_YSF);
|
||||
std::shared_ptr<CClient>client = clients->FindClient(Cmd.GetCallsign(), Cmd.GetIp(), EProtocol::ysf);
|
||||
if ( client )
|
||||
{
|
||||
cModule = client->GetReflectorModule();
|
||||
@@ -179,7 +179,7 @@ void CWiresxCmdHandler::Task(void)
|
||||
ReplyToWiresxConnReqPacket(Cmd.GetIp(), Info, cModule);
|
||||
// change client's module
|
||||
CClients *clients = g_Reflector.GetClients();
|
||||
std::shared_ptr<CClient>client = clients->FindClient(Cmd.GetCallsign(), Cmd.GetIp(), PROTOCOL_YSF);
|
||||
std::shared_ptr<CClient>client = clients->FindClient(Cmd.GetCallsign(), Cmd.GetIp(), EProtocol::ysf);
|
||||
if ( client )
|
||||
{
|
||||
client->SetReflectorModule(cModule);
|
||||
@@ -198,7 +198,7 @@ void CWiresxCmdHandler::Task(void)
|
||||
// change client's module
|
||||
{
|
||||
CClients *clients = g_Reflector.GetClients();
|
||||
std::shared_ptr<CClient>client = clients->FindClient(Cmd.GetCallsign(), Cmd.GetIp(), PROTOCOL_YSF);
|
||||
std::shared_ptr<CClient>client = clients->FindClient(Cmd.GetCallsign(), Cmd.GetIp(), EProtocol::ysf);
|
||||
if ( client != nullptr )
|
||||
{
|
||||
client->SetReflectorModule(' ');
|
||||
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
virtual ~CYsfClient() {};
|
||||
|
||||
// identity
|
||||
int GetProtocol(void) const { return PROTOCOL_YSF; }
|
||||
EProtocol GetProtocol(void) const { return EProtocol::ysf; }
|
||||
const char *GetProtocolName(void) const { return "YSF"; }
|
||||
int GetCodec(void) const { return CODEC_AMBE2PLUS; }
|
||||
bool IsNode(void) const { return true; }
|
||||
|
||||
@@ -38,7 +38,7 @@ CYsfProtocol::CYsfProtocol()
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// operation
|
||||
|
||||
bool CYsfProtocol::Initialize(const char *type, const int ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6)
|
||||
bool CYsfProtocol::Initialize(const char *type, const EProtocol ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6)
|
||||
{
|
||||
// base class
|
||||
if (! CProtocol::Initialize(type, ptype, port, has_ipv4, has_ipv6))
|
||||
@@ -119,7 +119,7 @@ void CYsfProtocol::Task(void)
|
||||
else if ( IsValidDvHeaderPacket(Ip, Fich, Buffer, Header, Frames) )
|
||||
{
|
||||
// node linked and callsign muted?
|
||||
if ( g_GateKeeper.MayTransmit(Header->GetMyCallsign(), Ip, PROTOCOL_YSF, Header->GetRpt2Module()) )
|
||||
if ( g_GateKeeper.MayTransmit(Header->GetMyCallsign(), Ip, EProtocol::ysf, Header->GetRpt2Module()) )
|
||||
{
|
||||
// handle it
|
||||
OnDvHeaderPacketIn(Header, Ip);
|
||||
@@ -138,7 +138,7 @@ void CYsfProtocol::Task(void)
|
||||
//std::cout << "YSF keepalive/connect packet from " << Callsign << " at " << Ip << std::endl;
|
||||
|
||||
// callsign authorized?
|
||||
if ( g_GateKeeper.MayLink(Callsign, Ip, PROTOCOL_YSF) )
|
||||
if ( g_GateKeeper.MayLink(Callsign, Ip, EProtocol::ysf) )
|
||||
{
|
||||
// acknowledge the request
|
||||
EncodeConnectAckPacket(&Buffer);
|
||||
@@ -146,7 +146,7 @@ void CYsfProtocol::Task(void)
|
||||
|
||||
// add client if needed
|
||||
CClients *clients = g_Reflector.GetClients();
|
||||
std::shared_ptr<CClient>client = clients->FindClient(Callsign, Ip, PROTOCOL_YSF);
|
||||
std::shared_ptr<CClient>client = clients->FindClient(Callsign, Ip, EProtocol::ysf);
|
||||
// client already connected ?
|
||||
if ( client == nullptr )
|
||||
{
|
||||
@@ -240,7 +240,7 @@ void CYsfProtocol::OnDvHeaderPacketIn(std::unique_ptr<CDvHeaderPacket> &Header,
|
||||
CCallsign rpt2(Header->GetRpt2Callsign());
|
||||
|
||||
// find this client
|
||||
std::shared_ptr<CClient>client = g_Reflector.GetClients()->FindClient(Ip, PROTOCOL_YSF);
|
||||
std::shared_ptr<CClient>client = g_Reflector.GetClients()->FindClient(Ip, EProtocol::ysf);
|
||||
if ( client )
|
||||
{
|
||||
// get client callsign
|
||||
@@ -328,7 +328,7 @@ void CYsfProtocol::HandleQueue(void)
|
||||
CClients *clients = g_Reflector.GetClients();
|
||||
auto it = clients->begin();
|
||||
std::shared_ptr<CClient>client = nullptr;
|
||||
while ( (client = clients->FindNextClient(PROTOCOL_YSF, it)) != nullptr )
|
||||
while ( (client = clients->FindNextClient(EProtocol::ysf, it)) != nullptr )
|
||||
{
|
||||
// is this client busy ?
|
||||
if ( !client->IsAMaster() && (client->GetReflectorModule() == packet->GetModuleId()) )
|
||||
@@ -357,7 +357,7 @@ void CYsfProtocol::HandleKeepalives(void)
|
||||
CClients *clients = g_Reflector.GetClients();
|
||||
auto it = clients->begin();
|
||||
std::shared_ptr<CClient>client = nullptr;
|
||||
while ( (client = clients->FindNextClient(PROTOCOL_YSF, it)) != nullptr )
|
||||
while ( (client = clients->FindNextClient(EProtocol::ysf, it)) != nullptr )
|
||||
{
|
||||
// is this client busy ?
|
||||
if ( client->IsAMaster() )
|
||||
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
CYsfProtocol();
|
||||
|
||||
// initialization
|
||||
bool Initialize(const char *type, const int ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6);
|
||||
bool Initialize(const char *type, const EProtocol ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6);
|
||||
void Close(void);
|
||||
|
||||
// task
|
||||
|
||||
Reference in new issue
Block a user