1
0
mirror of https://github.com/ShaYmez/xlxd.git synced 2024-12-23 01:55:49 -05:00

xlxd 1.3.6

This commit is contained in:
LX3JL 2016-04-18 09:59:32 +02:00
parent 1b0125ef74
commit 2ed3b28de6
9 changed files with 96 additions and 65 deletions

BIN
dashboard/img/flags/nie.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

9
dashboard/pgs/country.csv Normal file → Executable file
View File

@ -6,7 +6,7 @@ American Samoa;AS;KH8
Andorra;AD;C3
Angola;AO;D2-D3
Anguilla;AI;VP2E
Antarctica;AQ;CE9-KC4
Antarctica;AQ;CE9
Antigua and Barbuda;AG;V2
Argentina;AR;LO-LP-LQ-LR-LS-LT-LU-LV-LW
Armenia;AM;EK
@ -104,7 +104,7 @@ India;IN;VU
Indonesia;ID;YB-YC-YD-YE-YF-YG-YH
Iran Islamic Republic of;IR;EP-EQ
Iraq;IQ;YI
Ireland;IE;EI-EJ-MI-GI
Ireland;IE;EI-EJ
Isle of Man;IM;GD-GT
Israel;IL;4X-4Z
Italy;IT;I0-I1-I2-I3-I4-I5-I6-I7-I8-I9-IK-IN-IQ-IR-IS-IT-IU-IV-IW-IZ
@ -162,6 +162,7 @@ Niger;NE;5U
Nigeria;NG;5N
Niue;NU;ZK2
Norfolk Island;NF;VK9N
Northern Ireland;NIE;GI-MI
Northern Mariana Islands;MP;KH0
Norway;NO;LA-LB-LC-LD-LE-LF-LG-LH-LI-LJ-LK-LL-LM-LN
Oman;OM;YP-YQ-YR
@ -174,7 +175,7 @@ Paraguay;PY;ZP
Peru;PE;OA-OB-OC
Philippines;PH;DU-DV-DW-DX-DY-DZ-4D-4E-4F-4G-4H-4I
Pitcairn;PN;VP6
Poland;PL;SN-SO-SP-SQ-SR
Poland;PL;3Z6-SN-SO-SP-SQ-SR
Portugal;PT;CT-CU3
Puerto Rico;PR;KP3-KP4
Qatar;QA;A7
@ -234,7 +235,7 @@ Uganda;UG;5X
Ukraine;UA;UR-US-UT-UU-UV-UW-UX-UY-UZ
United Arab Emirates;AE;A6
United Kingdom;GB;2E-M0-M1-M2-M3-M4-M5-M6-M7-M8-M9-MB-MM-G0-G1-G2-G3-G4-G5-G6-G7-G8-G9-GX
United States;US;K0-K1-K2-K3-K4-K5-K6-K7-K8-K9-KA-KB-KC-KD-KE-KF-KG-KI-KJ-KK-KM-KN-KO-KQ-KR-KS-KT-KU-KV-KW-KX-KY-KZ-W0-W1-W2-W3-W4-W5-W6-W7-W8-W9-WA-WB-WD-WV-WX-WZ-N0-N1-N2-N3-N4-N5-N6-N7-N8-N9-NE-NN-NO-NS-AA-AB-AC-AD-AE-AF-AG-AH-AI-AJ-AK
United States;US;K0-K1-K2-K3-K4-K5-K6-K7-K8-K9-KA-KB-KC-KD-KE-KF-KG-KI-KJ-KK-KM-KN-KO-KQ-KR-KS-KT-KU-KV-KW-KX-KY-KZ-W0-W1-W2-W3-W4-W5-W6-W7-W8-W9-WA-WB-WD-WF-WR-WV-WX-WZ-N0-N1-N2-N3-N4-N5-N6-N7-N8-N9-NE-NG-NN-NO-NQ-NS-NW-AA-AB-AC-AD-AE-AF-AG-AH-AI-AJ-AK
United States Minor Outlying Islands;UM;
Uruguay;UY;CV-CW-CX
Uzbekistan;UZ;UJ-UK-UL-UM

1 Afghanistan AF YA-T6
6 Andorra AD C3
7 Angola AO D2-D3
8 Anguilla AI VP2E
9 Antarctica AQ CE9-KC4 CE9
10 Antigua and Barbuda AG V2
11 Argentina AR LO-LP-LQ-LR-LS-LT-LU-LV-LW
12 Armenia AM EK
104 Indonesia ID YB-YC-YD-YE-YF-YG-YH
105 Iran Islamic Republic of IR EP-EQ
106 Iraq IQ YI
107 Ireland IE EI-EJ-MI-GI EI-EJ
108 Isle of Man IM GD-GT
109 Israel IL 4X-4Z
110 Italy IT I0-I1-I2-I3-I4-I5-I6-I7-I8-I9-IK-IN-IQ-IR-IS-IT-IU-IV-IW-IZ
162 Nigeria NG 5N
163 Niue NU ZK2
164 Norfolk Island NF VK9N
165 Northern Ireland NIE GI-MI
166 Northern Mariana Islands MP KH0
167 Norway NO LA-LB-LC-LD-LE-LF-LG-LH-LI-LJ-LK-LL-LM-LN
168 Oman OM YP-YQ-YR
175 Peru PE OA-OB-OC
176 Philippines PH DU-DV-DW-DX-DY-DZ-4D-4E-4F-4G-4H-4I
177 Pitcairn PN VP6
178 Poland PL SN-SO-SP-SQ-SR 3Z6-SN-SO-SP-SQ-SR
179 Portugal PT CT-CU3
180 Puerto Rico PR KP3-KP4
181 Qatar QA A7
235 Ukraine UA UR-US-UT-UU-UV-UW-UX-UY-UZ
236 United Arab Emirates AE A6
237 United Kingdom GB 2E-M0-M1-M2-M3-M4-M5-M6-M7-M8-M9-MB-MM-G0-G1-G2-G3-G4-G5-G6-G7-G8-G9-GX
238 United States US K0-K1-K2-K3-K4-K5-K6-K7-K8-K9-KA-KB-KC-KD-KE-KF-KG-KI-KJ-KK-KM-KN-KO-KQ-KR-KS-KT-KU-KV-KW-KX-KY-KZ-W0-W1-W2-W3-W4-W5-W6-W7-W8-W9-WA-WB-WD-WV-WX-WZ-N0-N1-N2-N3-N4-N5-N6-N7-N8-N9-NE-NN-NO-NS-AA-AB-AC-AD-AE-AF-AG-AH-AI-AJ-AK K0-K1-K2-K3-K4-K5-K6-K7-K8-K9-KA-KB-KC-KD-KE-KF-KG-KI-KJ-KK-KM-KN-KO-KQ-KR-KS-KT-KU-KV-KW-KX-KY-KZ-W0-W1-W2-W3-W4-W5-W6-W7-W8-W9-WA-WB-WD-WF-WR-WV-WX-WZ-N0-N1-N2-N3-N4-N5-N6-N7-N8-N9-NE-NG-NN-NO-NQ-NS-NW-AA-AB-AC-AD-AE-AF-AG-AH-AI-AJ-AK
239 United States Minor Outlying Islands UM
240 Uruguay UY CV-CW-CX
241 Uzbekistan UZ UJ-UK-UL-UM

2
readme
View File

@ -52,7 +52,7 @@ Debian 7 (Wheezy) 32 and 64bit:
# make clean
# make install
// copy startup script "xlxd"<EFBFBD> to /etc/init.d
// copy startup script "xlxd" to /etc/init.d
# cp ~/xlxd/scripts/xlxd /etc/init.d/xlxd
// adapt the default startup parameters to your needs

View File

@ -124,18 +124,30 @@ 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) )
if ( g_GateKeeper.MayLink(Callsign, Ip, PROTOCOL_DCS) && g_Reflector.IsValidModule(ToLinkModule) )
{
// acknowledge the request
EncodeConnectAckPacket(Callsign, ToLinkModule, &Buffer);
m_Socket.Send(Buffer, Ip);
// create the client
CDcsClient *client = new CDcsClient(Callsign, Ip, ToLinkModule);
// and append
g_Reflector.GetClients()->AddClient(client);
g_Reflector.ReleaseClients();
// valid module ?
if ( g_Reflector.IsValidModule(ToLinkModule) )
{
// acknowledge the request
EncodeConnectAckPacket(Callsign, ToLinkModule, &Buffer);
m_Socket.Send(Buffer, Ip);
// create the client
CDcsClient *client = new CDcsClient(Callsign, Ip, ToLinkModule);
// and append
g_Reflector.GetClients()->AddClient(client);
g_Reflector.ReleaseClients();
}
else
{
std::cout << "DCS node " << Callsign << " connect attempt on non-existing module" << std::endl;
// deny the request
EncodeConnectNackPacket(Callsign, ToLinkModule, &Buffer);
m_Socket.Send(Buffer, Ip);
}
}
else
{
@ -149,12 +161,16 @@ void CDcsProtocol::Task(void)
{
std::cout << "DCS disconnect packet from " << Callsign << " at " << Ip << std::endl;
// find client & remove it
// find client
CClients *clients = g_Reflector.GetClients();
CClient *client = clients->FindClient(Ip, PROTOCOL_DCS);
if ( client != NULL )
{
// remove it
clients->RemoveClient(client);
// and acknowledge the disconnect
EncodeConnectNackPacket(Callsign, ' ', &Buffer);
m_Socket.Send(Buffer, Ip);
}
g_Reflector.ReleaseClients();
}

View File

@ -112,16 +112,28 @@ void CDextraProtocol::Task(void)
// callsign authorized?
if ( g_GateKeeper.MayLink(Callsign, Ip, PROTOCOL_DEXTRA) )
{
// acknowledge the request
EncodeConnectAckPacket(&Buffer, ProtRev);
m_Socket.Send(Buffer, Ip);
// create the client
CDextraClient *client = new CDextraClient(Callsign, Ip, ToLinkModule, ProtRev);
// and append
g_Reflector.GetClients()->AddClient(client);
g_Reflector.ReleaseClients();
// valid module ?
if ( g_Reflector.IsValidModule(ToLinkModule) )
{
// acknowledge the request
EncodeConnectAckPacket(&Buffer, ProtRev);
m_Socket.Send(Buffer, Ip);
// create the client
CDextraClient *client = new CDextraClient(Callsign, Ip, ToLinkModule, ProtRev);
// and append
g_Reflector.GetClients()->AddClient(client);
g_Reflector.ReleaseClients();
}
else
{
std::cout << "DExtra node " << Callsign << " connect attempt on non-existing module" << std::endl;
// deny the request
EncodeConnectNackPacket(&Buffer);
m_Socket.Send(Buffer, Ip);
}
}
else
{

View File

@ -202,36 +202,44 @@ bool CDplusProtocol::OnDvHeaderPacketIn(CDvHeaderPacket *Header, const CIp &Ip)
// no stream open yet, open a new one
CCallsign via(Header->GetRpt1Callsign());
// find this client
CClient *client = g_Reflector.GetClients()->FindClient(Ip, PROTOCOL_DPLUS);
if ( client != NULL )
// first, check module is valid
if ( g_Reflector.IsValidModule(Header->GetRpt1Module()) )
{
// now we knwo if it's a dextra dongle or a genuine dplus node
if ( Header->GetRpt2Callsign().HasSameCallsignWithWidlcard(CCallsign("XRF*")) )
// find this client
CClient *client = g_Reflector.GetClients()->FindClient(Ip, PROTOCOL_DPLUS);
if ( client != NULL )
{
client->SetDextraDongle();
}
// now we know its module, let's update it
if ( !client->HasModule() )
{
client->SetModule(Header->GetRpt1Module());
}
// get client callsign
via = client->GetCallsign();
// and try to open the stream
if ( (stream = g_Reflector.OpenStream(Header, client)) != NULL )
{
// keep the handle
m_Streams.push_back(stream);
newstream = true;
// now we know if it's a dextra dongle or a genuine dplus node
if ( Header->GetRpt2Callsign().HasSameCallsignWithWidlcard(CCallsign("XRF*")) )
{
client->SetDextraDongle();
}
// now we know its module, let's update it
if ( !client->HasModule() )
{
client->SetModule(Header->GetRpt1Module());
}
// get client callsign
via = client->GetCallsign();
// and try to open the stream
if ( (stream = g_Reflector.OpenStream(Header, client)) != NULL )
{
// keep the handle
m_Streams.push_back(stream);
newstream = true;
}
}
// release
g_Reflector.ReleaseClients();
// update last heard
g_Reflector.GetUsers()->Hearing(Header->GetMyCallsign(), via);
g_Reflector.ReleaseUsers();
}
else
{
std::cout << "DPlus node " << via << " link attempt on non-existing module" << std::endl;
}
// release
g_Reflector.ReleaseClients();
// update last heard
g_Reflector.GetUsers()->Hearing(Header->GetMyCallsign(), via);
g_Reflector.ReleaseUsers();
}
else
{

View File

@ -77,7 +77,7 @@ public:
void ReleaseUsers(void) { m_Users.Unlock(); }
// get
bool IsValidModule(char c) const { return true; }
bool IsValidModule(char c) const { return (GetModuleIndex(c) >= 0); }
int GetModuleIndex(char) const;
char GetModuleLetter(int i) const { return 'A' + (char)i; }

View File

@ -131,11 +131,8 @@ void CXlxProtocol::Task(void)
m_Socket.Send(Buffer, Ip);
}
}
// done
g_Reflector.ReleaseClients();
}
else if ( IsValidDisconnectPacket(Buffer, &Callsign) )
{
@ -223,12 +220,10 @@ void CXlxProtocol::HandleQueue(void)
{
// is this client busy ?
// here check that origin module of the stream is listed in client xlx
// TODO: and check that client of origin is not another XLX to avoid loops
if ( !client->IsAMaster() && client->HasThisReflectorModule(packet->GetModuleId()) )
{
// no, send the packet
m_Socket.Send(buffer, client->GetIp());
}
}
g_Reflector.ReleaseClients();
@ -278,8 +273,7 @@ void CXlxProtocol::HandleKeepalives(void)
// remove it
std::cout << "XLX peer " << client->GetCallsign() << " keepalive timeout" << std::endl;
clients->RemoveClient(client);
}
}
}
g_Reflector.ReleaseClients();
}

View File

@ -48,7 +48,7 @@
#define VERSION_MAJOR 1
#define VERSION_MINOR 3
#define VERSION_REVISION 5
#define VERSION_REVISION 6
// global ------------------------------------------------------
@ -57,7 +57,7 @@
// reflector ---------------------------------------------------
#define NB_OF_MODULES 4
#define NB_OF_MODULES 8
// protocols ---------------------------------------------------
@ -87,8 +87,8 @@
// XLX
#define XLX_PORT 10002 // UDP port
#define XLX_KEEPALIVE_PERIOD 3 // in seconds
#define XLX_KEEPALIVE_TIMEOUT (XLX_KEEPALIVE_PERIOD*10) // in seconds
#define XLX_KEEPALIVE_PERIOD 1 // in seconds
#define XLX_KEEPALIVE_TIMEOUT (XLX_KEEPALIVE_PERIOD*30) // in seconds
// xml & json reporting -----------------------------------------