diff --git a/src/BMClient.cpp b/src/BMClient.cpp
index 843c2c4..b220ec7 100644
--- a/src/BMClient.cpp
+++ b/src/BMClient.cpp
@@ -1,26 +1,20 @@
-//
-// cbmclient.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 20/01/2017.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include
#include "Main.h"
diff --git a/src/BMClient.h b/src/BMClient.h
index 2c16f4c..7d0c5ee 100644
--- a/src/BMClient.h
+++ b/src/BMClient.h
@@ -1,6 +1,6 @@
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
-// ulxd -- The ultimate Reflector
+// ulxd -- The universal Reflector
// Copyright © 2021 Thomas A. Early N7TAE
//
// This program is free software: you can redistribute it and/or modify
@@ -21,13 +21,6 @@
#include "Client.h"
#include "ULXClient.h"
-////////////////////////////////////////////////////////////////////////////////////////
-// define
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-// class
-
class CBmClient : public CClient
{
public:
diff --git a/src/BMPeer.cpp b/src/BMPeer.cpp
index 1bd456c..baf98f1 100644
--- a/src/BMPeer.cpp
+++ b/src/BMPeer.cpp
@@ -1,26 +1,21 @@
-//
-// cbmpeer.cpp
-// xlxd
-// Created by Jean-Luc Deltombe (LX3JL) on 10/12/2016.
// Copyright © 2016 Jean-Luc Deltombe (LX3JL). All rights reserved.
-// Copyright © 2020 Thomas A. Early, N7TAE
-//
-// ----------------------------------------------------------------------------
-// This file is part of xlxd.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+
#include "Main.h"
#include
diff --git a/src/BMPeer.h b/src/BMPeer.h
index 1170599..5520312 100644
--- a/src/BMPeer.h
+++ b/src/BMPeer.h
@@ -1,30 +1,22 @@
-//
-// BMPeer.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 20/01/2017.
// Copyright © 2016 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
-
-#ifndef cbmpeer_h
-#define cbmpeer_h
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+#pragma once
#include "Peer.h"
#include "BMClient.h"
@@ -54,6 +46,3 @@ public:
// revision helper
static int GetProtocolRevision(const CVersion &);
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cbmpeer_h */
diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index d5fef04..6d05f06 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -1,26 +1,20 @@
-//
-// cbuffer.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 02/11/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include
#include "Buffer.h"
diff --git a/src/Buffer.h b/src/Buffer.h
index c9a6f5c..7905d3d 100644
--- a/src/Buffer.h
+++ b/src/Buffer.h
@@ -1,30 +1,22 @@
-//
-// Buffer.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 02/11/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
-// Copyright © 2020 Thomas A. Early, N7TAE
-//
-// ----------------------------------------------------------------------------
-// This file is part of xlxd.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cbuffer_h
-#define cbuffer_h
+#pragma once
#include
#include
@@ -80,6 +72,3 @@ public:
protected:
std::vector m_data;
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cbuffer_h */
diff --git a/src/CBPTC19696.cpp b/src/CBPTC19696.cpp
index e298340..db537c6 100644
--- a/src/CBPTC19696.cpp
+++ b/src/CBPTC19696.cpp
@@ -1,31 +1,31 @@
-/*
- * Copyright (C) 2012 by Ian Wraith
- * Copyright (C) 2015 by Jonathan Naylor G4KLX
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include "CBPT19696.h"
-
-#include "Hamming.h"
-#include "Utils.h"
+// Copyright (C) 2012 by Ian Wraith
+// Copyright (C) 2015 by Jonathan Naylor G4KLX
+
+// 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 .
#include
#include
#include
+#include "CBPTC19696.h"
+
+#include "Hamming.h"
+#include "Utils.h"
+
CBPTC19696::CBPTC19696()
{
}
diff --git a/src/CBPTC19696.h b/src/CBPTC19696.h
index cbf584c..fd5f0ae 100644
--- a/src/CBPTC19696.h
+++ b/src/CBPTC19696.h
@@ -1,23 +1,22 @@
-/*
- * Copyright (C) 2015 by Jonathan Naylor G4KLX
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#if !defined(BPTC19696_H)
-#define BPTC19696_H
+// Copyright (C) 2015 by Jonathan Naylor G4KLX
+
+// 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 .
+
+#pragma once
class CBPTC19696
{
@@ -43,5 +42,3 @@ private:
void encodeErrorCheck();
void encodeExtractBinary(unsigned char* data);
};
-
-#endif
diff --git a/src/CNotificationQueue.h b/src/CNotificationQueue.h
index 3d50154..ae5e644 100644
--- a/src/CNotificationQueue.h
+++ b/src/CNotificationQueue.h
@@ -1,32 +1,22 @@
-//
-// NotificationQueue.h
-// xlxd
-//
-// Created by Jean-Luc on 05/12/2015.
// Copyright © 2015 Jean-Luc. All rights reserved.
-// Copyright © 2020 Thomas A. Early, N7TAE
-//
-// ----------------------------------------------------------------------------
-// This file is part of xlxd.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-
-
-#ifndef cnotificationqueue_h
-#define cnotificationqueue_h
+#pragma once
#include
#include
@@ -63,6 +53,3 @@ protected:
std::mutex m_Mutex;
std::queue queue;
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cnotificationqueue_h */
diff --git a/src/CRC.cpp b/src/CRC.cpp
index 93b20d1..b2241c3 100644
--- a/src/CRC.cpp
+++ b/src/CRC.cpp
@@ -1,20 +1,20 @@
-/*
- * Copyright (C) 2015,2016 by Jonathan Naylor G4KLX
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
+// Copyright (C) 2015,2016 by Jonathan Naylor G4KLX
+
+// 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 .
#include "CRC.h"
diff --git a/src/CRC.h b/src/CRC.h
index 90bca98..f291d53 100644
--- a/src/CRC.h
+++ b/src/CRC.h
@@ -1,23 +1,22 @@
-/*
- * Copyright (C) 2015,2016 by Jonathan Naylor G4KLX
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
+// Copyright (C) 2015,2016 by Jonathan Naylor G4KLX
-#if !defined(CRC_H)
-#define CRC_H
+// 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 .
+
+#pragma once
class CCRC
{
@@ -35,5 +34,3 @@ public:
static unsigned char addCRC(const unsigned char* in, unsigned int length);
};
-
-#endif
diff --git a/src/Callsign.cpp b/src/Callsign.cpp
index 92e2466..727f0bb 100644
--- a/src/Callsign.cpp
+++ b/src/Callsign.cpp
@@ -1,31 +1,25 @@
-//
-// ccallsign.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 31/10/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
#include
#include
-#include "cdmriddirfile.h"
+#include "DMRIdDirFile.h"
#include "DMRIdDirHttp.h"
#include "Callsign.h"
@@ -43,7 +37,7 @@ CCallsign::CCallsign()
#endif
}
-CCallsign::CCallsign(const char *sz, uint32 dmrid)
+CCallsign::CCallsign(const char *sz, uint32_t dmrid)
{
// blank all
::memset(m_Callsign, ' ', sizeof(m_Callsign));
@@ -168,7 +162,7 @@ void CCallsign::SetCallsign(const char *sz, bool UpdateDmrid)
#endif
}
-void CCallsign::SetCallsign(const uint8 *buffer, int len, bool UpdateDmrid)
+void CCallsign::SetCallsign(const uint8_t *buffer, int len, bool UpdateDmrid)
{
// set callsign
::memset(m_Callsign, ' ', sizeof(m_Callsign));
@@ -198,7 +192,7 @@ void CCallsign::SetCallsign(const uint8 *buffer, int len, bool UpdateDmrid)
}
#ifndef NO_XLX
-void CCallsign::SetDmrid(uint32 dmrid, bool UpdateCallsign)
+void CCallsign::SetDmrid(uint32_t dmrid, bool UpdateCallsign)
{
m_uiDmrid = dmrid;
if ( UpdateCallsign )
@@ -215,12 +209,12 @@ void CCallsign::SetDmrid(uint32 dmrid, bool UpdateCallsign)
}
}
-void CCallsign::SetDmrid(const uint8 *buffer, bool UpdateCallsign)
+void CCallsign::SetDmrid(const uint8_t *buffer, bool UpdateCallsign)
{
char sz[9];
::memcpy(sz, buffer, 8);
sz[8] = 0;
- SetDmrid((uint32)::strtol(sz, nullptr, 16), UpdateCallsign);
+ SetDmrid((uint32_t)::strtol(sz, nullptr, 16), UpdateCallsign);
}
#endif
@@ -236,7 +230,7 @@ void CCallsign::SetSuffix(const char *sz)
::memcpy(m_Suffix, sz, MIN(strlen(sz), sizeof(m_Suffix)));
}
-void CCallsign::SetSuffix(const uint8 *buffer, int len)
+void CCallsign::SetSuffix(const uint8_t *buffer, int len)
{
len = MIN(len, (int)sizeof(m_Suffix));
::memset(m_Suffix, ' ', sizeof(m_Suffix));
@@ -246,7 +240,7 @@ void CCallsign::SetSuffix(const uint8 *buffer, int len)
////////////////////////////////////////////////////////////////////////////////////////
// modify
-void CCallsign::PatchCallsign(int off, const uint8 *patch, int len)
+void CCallsign::PatchCallsign(int off, const uint8_t *patch, int len)
{
if ( off < CALLSIGN_LEN )
{
@@ -258,7 +252,7 @@ void CCallsign::PatchCallsign(int off, const uint8 *patch, int len)
////////////////////////////////////////////////////////////////////////////////////////
// get
-void CCallsign::GetCallsign(uint8 *buffer) const
+void CCallsign::GetCallsign(uint8_t *buffer) const
{
::memcpy(buffer, m_Callsign, sizeof(m_Callsign));
if ( HasModule() )
@@ -277,7 +271,7 @@ void CCallsign::GetCallsignString(char *sz) const
sz[i] = 0;
}
-void CCallsign::GetSuffix(uint8 *buffer) const
+void CCallsign::GetSuffix(uint8_t *buffer) const
{
::memcpy(buffer, m_Suffix, sizeof(m_Suffix));
}
diff --git a/src/Callsign.h b/src/Callsign.h
index bb858ee..262635c 100644
--- a/src/Callsign.h
+++ b/src/Callsign.h
@@ -1,29 +1,22 @@
+/// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// Callsign.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 31/10/2015.
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef ccallsign_h
-#define ccallsign_h
+#pragma once
////////////////////////////////////////////////////////////////////////////////////////
// define
@@ -40,7 +33,7 @@ class CCallsign
public:
// contructors
CCallsign();
- CCallsign(const char *, uint32 = 0);
+ CCallsign(const char *, uint32_t = 0);
// status
bool IsValid(void) const;
@@ -49,25 +42,25 @@ public:
// set
void SetCallsign(const char *, bool = true);
- void SetCallsign(const uint8 *, int, bool = true);
+ void SetCallsign(const uint8_t *, int, bool = true);
#ifndef NO_XLX
- void SetDmrid(uint32, bool = true);
- void SetDmrid(const uint8 *, bool = true);
+ void SetDmrid(uint32_t, bool = true);
+ void SetDmrid(const uint8_t *, bool = true);
#endif
void SetModule(char);
void SetSuffix(const char *);
- void SetSuffix(const uint8 *, int);
+ void SetSuffix(const uint8_t *, int);
// modify
- void PatchCallsign(int, const uint8 *, int);
+ void PatchCallsign(int, const uint8_t *, int);
// get
- void GetCallsign(uint8 *) const;
+ void GetCallsign(uint8_t *) const;
void GetCallsignString(char *) const;
#ifndef NO_XLX
- uint32 GetDmrid(void) const { return m_uiDmrid; }
+ uint32_t GetDmrid(void) const { return m_uiDmrid; }
#endif
- void GetSuffix(uint8 *) const;
+ void GetSuffix(uint8_t *) const;
char GetModule(void) const { return m_Module; }
// compare
@@ -93,9 +86,6 @@ protected:
char m_Module;
mutable char m_sz[CALLSIGN_LEN+CALLSUFFIX_LEN+5];
#ifndef NO_XLX
- uint32 m_uiDmrid;
+ uint32_t m_uiDmrid;
#endif
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* ccallsign_h */
diff --git a/src/CallsignList.cpp b/src/CallsignList.cpp
index c94a4c4..6c365b0 100644
--- a/src/CallsignList.cpp
+++ b/src/CallsignList.cpp
@@ -1,27 +1,20 @@
-//
-// ccallsignlist.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 30/12/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
-// Copyright © 2020 Thomas A. Early, N7TAE
-//
-// ----------------------------------------------------------------------------
-// This file is part of xlxd.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include
#include
diff --git a/src/CallsignList.h b/src/CallsignList.h
index 9d98654..2c6a521 100644
--- a/src/CallsignList.h
+++ b/src/CallsignList.h
@@ -1,32 +1,22 @@
-//
-// CallsignList.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 30/12/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
-// Copyright © 2020 Thomas A. Early, N7TAE
-//
-// ----------------------------------------------------------------------------
-// This file is part of xlxd.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
-
-
-#ifndef ccallsignlist_h
-#define ccallsignlist_h
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+#pragma once
#include "Main.h"
#include "CallsignListItem.h"
@@ -75,7 +65,3 @@ protected:
time_t m_LastModTime;
std::list m_Callsigns;
};
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* ccallsignlist_h */
diff --git a/src/CallsignListItem.cpp b/src/CallsignListItem.cpp
index 3ec0697..6b8e79b 100644
--- a/src/CallsignListItem.cpp
+++ b/src/CallsignListItem.cpp
@@ -1,26 +1,20 @@
-//
-// ccallsignlistitem.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 31/01/2016.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include
#include "Main.h"
diff --git a/src/CallsignListItem.h b/src/CallsignListItem.h
index cc33155..0906548 100644
--- a/src/CallsignListItem.h
+++ b/src/CallsignListItem.h
@@ -1,29 +1,22 @@
-//
-// CallsignListItem.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 31/01/2016.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef ccallsignlistitem_h
-#define ccallsignlistitem_h
+#pragma once
#include "Main.h"
#include "Callsign.h"
@@ -70,8 +63,3 @@ protected:
CIp m_Ip;
char m_Modules[27];
};
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-
-#endif /* ccallsignlistitem_h */
diff --git a/src/Client.cpp b/src/Client.cpp
index 0ffbdb2..47e1065 100644
--- a/src/Client.cpp
+++ b/src/Client.cpp
@@ -1,26 +1,20 @@
-//
-// cclient.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 31/10/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
#include
@@ -34,7 +28,7 @@ CClient::CClient()
{
m_ReflectorModule = ' ';
m_ModuleMastered = ' ';
- m_LastKeepaliveTime.Now();
+ m_LastKeepaliveTime.start();
m_ConnectTime = std::time(nullptr);
m_LastHeardTime = std::time(nullptr);
}
@@ -45,7 +39,7 @@ CClient::CClient(const CCallsign &callsign, const CIp &ip, char reflectorModule)
m_Callsign = callsign;
m_Ip = ip;
m_ModuleMastered = ' ';
- m_LastKeepaliveTime.Now();
+ m_LastKeepaliveTime.start();
m_ConnectTime = std::time(nullptr);
m_LastHeardTime = std::time(nullptr);
}
@@ -66,7 +60,7 @@ CClient::CClient(const CClient &client)
void CClient::Alive(void)
{
- m_LastKeepaliveTime.Now();
+ m_LastKeepaliveTime.time();
}
diff --git a/src/Client.h b/src/Client.h
index 27eaf90..f9d0d43 100644
--- a/src/Client.h
+++ b/src/Client.h
@@ -1,29 +1,22 @@
-//
-// Client.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 31/10/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cclient_h
-#define cclient_h
+#pragma once
#include "Timer.h"
#include "IP.h"
@@ -94,10 +87,7 @@ protected:
// status
char m_ModuleMastered;
- CTimePoint m_LastKeepaliveTime;
+ CTimer m_LastKeepaliveTime;
std::time_t m_ConnectTime;
std::time_t m_LastHeardTime;
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cclient_h */
diff --git a/src/Clients.cpp b/src/Clients.cpp
index 5bdba73..70ba461 100644
--- a/src/Clients.cpp
+++ b/src/Clients.cpp
@@ -1,27 +1,20 @@
-//
-// cclients.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 31/10/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
-// Copyright © 2020 Thomas A. Early, N7TAE
-//
-// ----------------------------------------------------------------------------
-// This file is part of xlxd.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
#include "Reflector.h"
diff --git a/src/Clients.h b/src/Clients.h
index 1b9f219..cb89ce4 100644
--- a/src/Clients.h
+++ b/src/Clients.h
@@ -1,30 +1,22 @@
-//
-// Clients.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 31/10/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
-// Copyright © 2020 Thomas A. Early, N7TAE
-//
-// ----------------------------------------------------------------------------
-// This file is part of xlxd.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cclients_h
-#define cclients_h
+#pragma once
#include "Client.h"
@@ -79,7 +71,3 @@ protected:
std::mutex m_Mutex;
std::list> m_Clients;
};
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cclients_h */
diff --git a/src/CodecStream.cpp b/src/CodecStream.cpp
index df48f3f..ee0e73f 100644
--- a/src/CodecStream.cpp
+++ b/src/CodecStream.cpp
@@ -1,26 +1,20 @@
-//
-// ccodecstream.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 13/04/2017.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
#include
@@ -36,7 +30,7 @@
////////////////////////////////////////////////////////////////////////////////////////
// constructor
-CCodecStream::CCodecStream(CPacketStream *PacketStream, uint16 uiId, uint8 uiCodecIn, uint8 uiCodecOut)
+CCodecStream::CCodecStream(CPacketStream *PacketStream, uint16_t uiId, uint8_t uiCodecIn, uint8_t uiCodecOut)
{
keep_running = true;
m_uiStreamId = uiId;
@@ -72,7 +66,7 @@ CCodecStream::~CCodecStream()
////////////////////////////////////////////////////////////////////////////////////////
// initialization
-bool CCodecStream::Init(uint16 uiPort)
+bool CCodecStream::Init(uint16_t uiPort)
{
m_bConnected = keep_running = false; // prepare for the worst
@@ -155,8 +149,8 @@ void CCodecStream::Task(void)
{
CBuffer Buffer;
CIp Ip;
- uint8 Ambe[AMBE_SIZE];
- uint8 DStarSync[] = { 0x55,0x2D,0x16 };
+ uint8_t Ambe[AMBE_SIZE];
+ uint8_t DStarSync[] = { 0x55,0x2D,0x16 };
// any packet from transcoder
if ( m_Socket.Receive(Buffer, Ip, 5) )
@@ -165,10 +159,10 @@ void CCodecStream::Task(void)
if ( IsValidAmbePacket(Buffer, Ambe) )
{
// tickle
- m_TimeoutTimer.Now();
+ m_TimeoutTimer.start();
// update statistics
- double ping = m_StatsTimer.DurationSinceNow();
+ double ping = m_StatsTimer.time();
if ( m_fPingMin == -1 )
{
m_fPingMin = ping;
@@ -222,7 +216,7 @@ void CCodecStream::Task(void)
// this assume that thread pushing the Packet
// have verified that the CodecStream is connected
// and that the packet needs transcoding
- m_StatsTimer.Now();
+ m_StatsTimer.start();
m_uiTotalPackets++;
EncodeAmbePacket(&Buffer, Frame->GetAmbe(m_uiCodecIn));
m_Socket.Send(Buffer, m_Ip, m_uiPort);
@@ -232,7 +226,7 @@ void CCodecStream::Task(void)
}
// handle timeout
- if ( !m_LocalQueue.empty() && (m_TimeoutTimer.DurationSinceNow() >= (TRANSCODER_AMBEPACKET_TIMEOUT/1000.0f)) )
+ if ( !m_LocalQueue.empty() && (m_TimeoutTimer.time() >= (TRANSCODER_AMBEPACKET_TIMEOUT/1000.0f)) )
{
//std::cout << "ambed packet timeout" << std::endl;
m_uiTimeoutPackets++;
@@ -242,7 +236,7 @@ void CCodecStream::Task(void)
////////////////////////////////////////////////////////////////////////////////////////
/// packet decoding helpers
-bool CCodecStream::IsValidAmbePacket(const CBuffer &Buffer, uint8 *Ambe)
+bool CCodecStream::IsValidAmbePacket(const CBuffer &Buffer, uint8_t *Ambe)
{
bool valid = false;
@@ -257,10 +251,10 @@ bool CCodecStream::IsValidAmbePacket(const CBuffer &Buffer, uint8 *Ambe)
////////////////////////////////////////////////////////////////////////////////////////
/// packet encoding helpers
-void CCodecStream::EncodeAmbePacket(CBuffer *Buffer, const uint8 *Ambe)
+void CCodecStream::EncodeAmbePacket(CBuffer *Buffer, const uint8_t *Ambe)
{
Buffer->clear();
Buffer->Append(m_uiCodecIn);
Buffer->Append(m_uiPid);
- Buffer->Append((uint8 *)Ambe, 9);
+ Buffer->Append((uint8_t *)Ambe, 9);
}
diff --git a/src/CodecStream.h b/src/CodecStream.h
index 3d08609..1c55b6f 100644
--- a/src/CodecStream.h
+++ b/src/CodecStream.h
@@ -1,29 +1,22 @@
-//
-// CodecStream.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 13/04/2017.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef ccodecstream_h
-#define ccodecstream_h
+#pragma once
#include "Semaphore.h"
#include "UDPSocket.h"
@@ -47,23 +40,23 @@ class CCodecStream : public CPacketQueue
{
public:
// constructor
- CCodecStream(CPacketStream *, uint16, uint8, uint8);
+ CCodecStream(CPacketStream *, uint16_t, uint8_t, uint8_t);
// destructor
virtual ~CCodecStream();
// initialization
- bool Init(uint16);
+ bool Init(uint16_t);
void Close(void);
// get
bool IsConnected(void) const { return m_bConnected; }
- uint16 GetStreamId(void) const { return m_uiStreamId; }
+ uint16_t GetStreamId(void) const { return m_uiStreamId; }
double GetPingMin(void) const { return m_fPingMin; }
double GetPingMax(void) const { return m_fPingMax; }
double GetPingAve(void) const { return (m_fPingCount != 0) ? m_fPingSum/m_fPingCount : 0; }
- uint32 GetTotalPackets(void) const { return m_uiTotalPackets; }
- uint32 GetTimeoutPackets(void) const { return m_uiTimeoutPackets; }
+ uint32_t GetTotalPackets(void) const { return m_uiTotalPackets; }
+ uint32_t GetTimeoutPackets(void) const { return m_uiTimeoutPackets; }
bool IsEmpty(void) const;
// task
@@ -73,19 +66,19 @@ public:
protected:
// packet decoding helpers
- bool IsValidAmbePacket(const CBuffer &, uint8 *);
+ bool IsValidAmbePacket(const CBuffer &, uint8_t *);
// packet encoding helpers
- void EncodeAmbePacket(CBuffer *, const uint8 *);
+ void EncodeAmbePacket(CBuffer *, const uint8_t *);
protected:
// data
- uint16 m_uiStreamId;
- uint16 m_uiPort;
- uint8 m_uiPid;
- uint8 m_uiCodecIn;
- uint8 m_uiCodecOut;
+ uint16_t m_uiStreamId;
+ uint16_t m_uiPort;
+ uint8_t m_uiPid;
+ uint8_t m_uiCodecIn;
+ uint8_t m_uiCodecOut;
// socket
CIp m_Ip;
@@ -93,24 +86,20 @@ protected:
bool m_bConnected;
// associated packet stream
- CPacketStream *m_PacketStream;
+ CPacketStream *m_PacketStream;
CPacketQueue m_LocalQueue;
// thread
std::atomic keep_running;
std::future m_Future;
- CTimePoint m_TimeoutTimer;
- CTimePoint m_StatsTimer;
+ CTimer m_TimeoutTimer;
+ CTimer m_StatsTimer;
// statistics
double m_fPingMin;
double m_fPingMax;
double m_fPingSum;
double m_fPingCount;
- uint32 m_uiTotalPackets;
- uint32 m_uiTimeoutPackets;
+ uint32_t m_uiTotalPackets;
+ uint32_t m_uiTimeoutPackets;
};
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* ccodecstream_h */
diff --git a/src/DCSClient.cpp b/src/DCSClient.cpp
index 2075384..1078b30 100644
--- a/src/DCSClient.cpp
+++ b/src/DCSClient.cpp
@@ -1,26 +1,20 @@
-//
-// cdcsclient.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 07/11/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
#include "DCSClient.h"
@@ -48,5 +42,5 @@ CDcsClient::CDcsClient(const CDcsClient &client)
bool CDcsClient::IsAlive(void) const
{
- return (m_LastKeepaliveTime.DurationSinceNow() < DCS_KEEPALIVE_TIMEOUT);
+ return (m_LastKeepaliveTime.time() < DCS_KEEPALIVE_TIMEOUT);
}
diff --git a/src/DCSClient.h b/src/DCSClient.h
index bf58065..ce7eb68 100644
--- a/src/DCSClient.h
+++ b/src/DCSClient.h
@@ -1,39 +1,25 @@
-//
-// DCSClient.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 07/11/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cdcsclient_h
-#define cdcsclient_h
+#pragma once
#include "Client.h"
-////////////////////////////////////////////////////////////////////////////////////////
-// define
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-// class
-
class CDcsClient : public CClient
{
public:
@@ -54,7 +40,3 @@ public:
// status
bool IsAlive(void) const;
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-
-#endif /* cdcsclient_h */
diff --git a/src/DCSProtocol.cpp b/src/DCSProtocol.cpp
index c09476d..bbd4394 100644
--- a/src/DCSProtocol.cpp
+++ b/src/DCSProtocol.cpp
@@ -1,46 +1,39 @@
-//
-// cdcsprotocol.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 07/11/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
-// Copyright © 2020 Thomas A. Early, N7TAE
-//
-// ----------------------------------------------------------------------------
-// This file is part of xlxd.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
#include
#include "DCSClient.h"
-#include "cdcsprotocol.h"
+#include "DCSProtocol.h"
#include "Reflector.h"
#include "GateKeeper.h"
////////////////////////////////////////////////////////////////////////////////////////
// operation
-bool CDcsProtocol::Initialize(const char *type, const int ptype, const uint16 port, const bool has_ipv4, const bool has_ipv6)
+bool CDcsProtocol::Initialize(const char *type, const int 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))
return false;
// update time
- m_LastKeepaliveTime.Now();
+ m_LastKeepaliveTime.start();
// done
return true;
@@ -178,13 +171,13 @@ void CDcsProtocol::Task(void)
HandleQueue();
// keep client alive
- if ( m_LastKeepaliveTime.DurationSinceNow() > DCS_KEEPALIVE_PERIOD )
+ if ( m_LastKeepaliveTime.time() > DCS_KEEPALIVE_PERIOD )
{
//
HandleKeepalives();
// update time
- m_LastKeepaliveTime.Now();
+ m_LastKeepaliveTime.start();
}
}
@@ -392,23 +385,23 @@ bool CDcsProtocol::IsValidKeepAlivePacket(const CBuffer &Buffer, CCallsign *call
bool CDcsProtocol::IsValidDvPacket(const CBuffer &Buffer, std::unique_ptr &header, std::unique_ptr &frame)
{
- uint8 tag[] = { '0','0','0','1' };
+ uint8_t tag[] = { '0','0','0','1' };
if ( (Buffer.size() >= 100) && (Buffer.Compare(tag, sizeof(tag)) == 0) )
{
// get the header
- header = std::unique_ptr(new CDvHeaderPacket((struct dstar_header *)&(Buffer.data()[4]), *((uint16 *)&(Buffer.data()[43])), 0x80));
+ header = std::unique_ptr(new CDvHeaderPacket((struct dstar_header *)&(Buffer.data()[4]), *((uint16_t *)&(Buffer.data()[43])), 0x80));
// get the frame
if ( Buffer.data()[45] & 0x40U )
{
// it's the last frame
- frame = std::unique_ptr(new CDvLastFramePacket((struct dstar_dvframe *)&(Buffer.data()[46]), *((uint16 *)&(Buffer.data()[43])), Buffer.data()[45]));
+ frame = std::unique_ptr(new CDvLastFramePacket((struct dstar_dvframe *)&(Buffer.data()[46]), *((uint16_t *)&(Buffer.data()[43])), Buffer.data()[45]));
}
else
{
// it's a regular DV frame
- frame = std::unique_ptr(new CDvFramePacket((struct dstar_dvframe *)&(Buffer.data()[46]), *((uint16 *)&(Buffer.data()[43])), Buffer.data()[45]));
+ frame = std::unique_ptr(new CDvFramePacket((struct dstar_dvframe *)&(Buffer.data()[46]), *((uint16_t *)&(Buffer.data()[43])), Buffer.data()[45]));
}
// check validity of packets
@@ -420,7 +413,7 @@ bool CDcsProtocol::IsValidDvPacket(const CBuffer &Buffer, std::unique_ptrClient)
{
- uint8 tag[] = { 0x0A,0x00,0x20,0x20 };
-
- Buffer->Set((uint8 *)(const char *)GetReflectorCallsign(), CALLSIGN_LEN-1);
- Buffer->Append((uint8)Client->GetReflectorModule());
- Buffer->Append((uint8)' ');
- Buffer->Append((uint8 *)(const char *)Client->GetCallsign(), CALLSIGN_LEN-1);
- Buffer->Append((uint8)Client->GetModule());
- Buffer->Append((uint8)Client->GetModule());
+ uint8_t tag[] = { 0x0A,0x00,0x20,0x20 };
+
+ Buffer->Set((uint8_t *)(const char *)GetReflectorCallsign(), CALLSIGN_LEN-1);
+ Buffer->Append((uint8_t)Client->GetReflectorModule());
+ Buffer->Append((uint8_t)' ');
+ Buffer->Append((uint8_t *)(const char *)Client->GetCallsign(), CALLSIGN_LEN-1);
+ Buffer->Append((uint8_t)Client->GetModule());
+ Buffer->Append((uint8_t)Client->GetModule());
Buffer->Append(tag, sizeof(tag));
}
void CDcsProtocol::EncodeConnectAckPacket(const CCallsign &Callsign, char ReflectorModule, CBuffer *Buffer)
{
- uint8 tag[] = { 'A','C','K',0x00 };
- uint8 cs[CALLSIGN_LEN];
+ uint8_t tag[] = { 'A','C','K',0x00 };
+ uint8_t cs[CALLSIGN_LEN];
Callsign.GetCallsign(cs);
Buffer->Set(cs, CALLSIGN_LEN-1);
- Buffer->Append((uint8)' ');
- Buffer->Append((uint8)Callsign.GetModule());
- Buffer->Append((uint8)ReflectorModule);
+ Buffer->Append((uint8_t)' ');
+ Buffer->Append((uint8_t)Callsign.GetModule());
+ Buffer->Append((uint8_t)ReflectorModule);
Buffer->Append(tag, sizeof(tag));
}
void CDcsProtocol::EncodeConnectNackPacket(const CCallsign &Callsign, char ReflectorModule, CBuffer *Buffer)
{
- uint8 tag[] = { 'N','A','K',0x00 };
- uint8 cs[CALLSIGN_LEN];
+ uint8_t tag[] = { 'N','A','K',0x00 };
+ uint8_t cs[CALLSIGN_LEN];
Callsign.GetCallsign(cs);
Buffer->Set(cs, CALLSIGN_LEN-1);
- Buffer->Append((uint8)' ');
- Buffer->Append((uint8)Callsign.GetModule());
- Buffer->Append((uint8)ReflectorModule);
+ Buffer->Append((uint8_t)' ');
+ Buffer->Append((uint8_t)Callsign.GetModule());
+ Buffer->Append((uint8_t)ReflectorModule);
Buffer->Append(tag, sizeof(tag));
}
void CDcsProtocol::EncodeDisconnectPacket(CBuffer *Buffer, std::shared_ptrClient)
{
- Buffer->Set((uint8 *)(const char *)Client->GetCallsign(), CALLSIGN_LEN-1);
- Buffer->Append((uint8)' ');
- Buffer->Append((uint8)Client->GetModule());
- Buffer->Append((uint8)0x00);
- Buffer->Append((uint8 *)(const char *)GetReflectorCallsign(), CALLSIGN_LEN-1);
- Buffer->Append((uint8)' ');
- Buffer->Append((uint8)0x00);
+ Buffer->Set((uint8_t *)(const char *)Client->GetCallsign(), CALLSIGN_LEN-1);
+ Buffer->Append((uint8_t)' ');
+ Buffer->Append((uint8_t)Client->GetModule());
+ Buffer->Append((uint8_t)0x00);
+ Buffer->Append((uint8_t *)(const char *)GetReflectorCallsign(), CALLSIGN_LEN-1);
+ Buffer->Append((uint8_t)' ');
+ Buffer->Append((uint8_t)0x00);
}
-void CDcsProtocol::EncodeDvPacket(const CDvHeaderPacket &Header, const CDvFramePacket &DvFrame, uint32 iSeq, CBuffer *Buffer) const
+void CDcsProtocol::EncodeDvPacket(const CDvHeaderPacket &Header, const CDvFramePacket &DvFrame, uint32_t iSeq, CBuffer *Buffer) const
{
- uint8 tag[] = { '0','0','0','1' };
+ uint8_t tag[] = { '0','0','0','1' };
struct dstar_header DstarHeader;
Header.ConvertToDstarStruct(&DstarHeader);
Buffer->Set(tag, sizeof(tag));
- Buffer->Append((uint8 *)&DstarHeader, sizeof(struct dstar_header) - sizeof(uint16));
+ Buffer->Append((uint8_t *)&DstarHeader, sizeof(struct dstar_header) - sizeof(uint16_t));
Buffer->Append(DvFrame.GetStreamId());
- Buffer->Append((uint8)(DvFrame.GetPacketId() % 21));
- Buffer->Append((uint8 *)DvFrame.GetAmbe(), AMBE_SIZE);
- Buffer->Append((uint8 *)DvFrame.GetDvData(), DVDATA_SIZE);
- Buffer->Append((uint8)((iSeq >> 0) & 0xFF));
- Buffer->Append((uint8)((iSeq >> 8) & 0xFF));
- Buffer->Append((uint8)((iSeq >> 16) & 0xFF));
- Buffer->Append((uint8)0x01);
- Buffer->Append((uint8)0x00, 38);
+ Buffer->Append((uint8_t)(DvFrame.GetPacketId() % 21));
+ Buffer->Append((uint8_t *)DvFrame.GetAmbe(), AMBE_SIZE);
+ Buffer->Append((uint8_t *)DvFrame.GetDvData(), DVDATA_SIZE);
+ Buffer->Append((uint8_t)((iSeq >> 0) & 0xFF));
+ Buffer->Append((uint8_t)((iSeq >> 8) & 0xFF));
+ Buffer->Append((uint8_t)((iSeq >> 16) & 0xFF));
+ Buffer->Append((uint8_t)0x01);
+ Buffer->Append((uint8_t)0x00, 38);
}
-void CDcsProtocol::EncodeDvLastPacket(const CDvHeaderPacket &Header, const CDvFramePacket &DvFrame, uint32 iSeq, CBuffer *Buffer) const
+void CDcsProtocol::EncodeDvLastPacket(const CDvHeaderPacket &Header, const CDvFramePacket &DvFrame, uint32_t iSeq, CBuffer *Buffer) const
{
EncodeDvPacket(Header, DvFrame, iSeq, Buffer);
(Buffer->data())[45] |= 0x40;
diff --git a/src/DCSProtocol.h b/src/DCSProtocol.h
index d802bcc..b6240af 100644
--- a/src/DCSProtocol.h
+++ b/src/DCSProtocol.h
@@ -1,32 +1,25 @@
-//
-// cdcsprotocol.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 07/11/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cdcsprotocol_h
-#define cdcsprotocol_h
+#pragma once
#include "Timer.h"
-#include "DCSProtocol.h"
+#include "Protocol.h"
#include "DVHeaderPacket.h"
#include "DVFramePacket.h"
#include "DVLastFramePacket.h"
@@ -44,14 +37,14 @@ public:
~CDcsStreamCacheItem() {}
CDvHeaderPacket m_dvHeader;
- uint32 m_iSeqCounter;
+ uint32_t m_iSeqCounter;
};
class CDcsProtocol : public CProtocol
{
public:
// initialization
- bool Initialize(const char *type, const int ptype, const uint16 port, const bool has_ipv4, const bool has_ipv6);
+ bool Initialize(const char *type, const int ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6);
// task
void Task(void);
@@ -79,16 +72,13 @@ protected:
void EncodeConnectAckPacket(const CCallsign &, char, CBuffer *);
void EncodeConnectNackPacket(const CCallsign &, char, CBuffer *);
void EncodeDisconnectPacket(CBuffer *, std::shared_ptr);
- void EncodeDvPacket(const CDvHeaderPacket &, const CDvFramePacket &, uint32, CBuffer *) const;
- void EncodeDvLastPacket(const CDvHeaderPacket &, const CDvFramePacket &, uint32, CBuffer *) const;
+ void EncodeDvPacket(const CDvHeaderPacket &, const CDvFramePacket &, uint32_t, CBuffer *) const;
+ void EncodeDvLastPacket(const CDvHeaderPacket &, const CDvFramePacket &, uint32_t, CBuffer *) const;
protected:
// for keep alive
- CTimePoint m_LastKeepaliveTime;
+ CTimer m_LastKeepaliveTime;
// for queue header caches
std::array m_StreamsCache;
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cdcsprotocol_h */
diff --git a/src/DExtraClient.cpp b/src/DExtraClient.cpp
index 20fa003..5577a8a 100644
--- a/src/DExtraClient.cpp
+++ b/src/DExtraClient.cpp
@@ -1,26 +1,20 @@
-//
-// cdextraclient.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 31/10/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
#include "DExtraClient.h"
@@ -51,5 +45,5 @@ CDextraClient::CDextraClient(const CDextraClient &client)
bool CDextraClient::IsAlive(void) const
{
- return (m_LastKeepaliveTime.DurationSinceNow() < DEXTRA_KEEPALIVE_TIMEOUT);
+ return (m_LastKeepaliveTime.time() < DEXTRA_KEEPALIVE_TIMEOUT);
}
diff --git a/src/DExtraClient.h b/src/DExtraClient.h
index 13ff2f0..0c5eafb 100644
--- a/src/DExtraClient.h
+++ b/src/DExtraClient.h
@@ -1,29 +1,22 @@
-//
-// DExtraClient.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 31/10/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cdextraclient_h
-#define cdextraclient_h
+#pragma once
#include "Client.h"
@@ -59,6 +52,3 @@ protected:
// data
int m_ProtRev;
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cdextraclient_h */
diff --git a/src/DExtraPeer.cpp b/src/DExtraPeer.cpp
index ffb547d..2c2a21e 100644
--- a/src/DExtraPeer.cpp
+++ b/src/DExtraPeer.cpp
@@ -1,27 +1,21 @@
-//
-// cdextrapeer.cpp
-// xlxd
-//
// Created by Antony Chazapis (SV9OAN) on 25/2/2018.
// Copyright © 2016 Jean-Luc Deltombe (LX3JL). All rights reserved.
-// Copyright © 2020 Thomas A. Early, N7TAE
-//
-// ----------------------------------------------------------------------------
-// This file is part of xlxd.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
#include
diff --git a/src/DExtraPeer.h b/src/DExtraPeer.h
index be1b571..02364d3 100644
--- a/src/DExtraPeer.h
+++ b/src/DExtraPeer.h
@@ -1,40 +1,27 @@
-//
-// DExtraPeer.h
-// xlxd
-//
// Created by Antony Chazapis (SV9OAN) on 25/2/2018.
// Copyright © 2016 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cdextrapeer_h
-#define cdextrapeer_h
+#pragma once
#include "Peer.h"
#include "DExtraClient.h"
-////////////////////////////////////////////////////////////////////////////////////////
-// define
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-// class
-
class CDextraPeer : public CPeer
{
public:
@@ -53,6 +40,3 @@ public:
// revision helper
static int GetProtocolRevision(const CVersion &);
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cdextrapeer_h */
diff --git a/src/DExtraProtocol.cpp b/src/DExtraProtocol.cpp
index 48c4f12..6b4799e 100644
--- a/src/DExtraProtocol.cpp
+++ b/src/DExtraProtocol.cpp
@@ -1,27 +1,20 @@
-//
-// cdextraprotocol.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 01/11/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
-// Copyright © 2020 Thomas A. Early, N7TAE
-//
-// ----------------------------------------------------------------------------
-// This file is part of xlxd.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
#include
@@ -35,7 +28,7 @@
////////////////////////////////////////////////////////////////////////////////////////
// operation
-bool CDextraProtocol::Initialize(const char *type, int ptype, const uint16 port, const bool has_ipv4, const bool has_ipv6)
+bool CDextraProtocol::Initialize(const char *type, int 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))
@@ -499,10 +492,10 @@ bool CDextraProtocol::IsValidKeepAlivePacket(const CBuffer &Buffer, CCallsign *c
bool CDextraProtocol::IsValidDvHeaderPacket(const CBuffer &Buffer, std::unique_ptr &header)
{
- if ( 56==Buffer.size() && 0==Buffer.Compare((uint8 *)"DSVT", 4) && 0x10U==Buffer.data()[4] && 0x20U==Buffer.data()[8] )
+ if ( 56==Buffer.size() && 0==Buffer.Compare((uint8_t *)"DSVT", 4) && 0x10U==Buffer.data()[4] && 0x20U==Buffer.data()[8] )
{
// create packet
- header = std::unique_ptr(new CDvHeaderPacket((struct dstar_header *)&(Buffer.data()[15]), *((uint16 *)&(Buffer.data()[12])), 0x80));
+ header = std::unique_ptr(new CDvHeaderPacket((struct dstar_header *)&(Buffer.data()[15]), *((uint16_t *)&(Buffer.data()[12])), 0x80));
// check validity of packet
if ( header && header->IsValid() )
return true;
@@ -512,10 +505,10 @@ bool CDextraProtocol::IsValidDvHeaderPacket(const CBuffer &Buffer, std::unique_p
bool CDextraProtocol::IsValidDvFramePacket(const CBuffer &Buffer, std::unique_ptr &dvframe)
{
- if ( 27==Buffer.size() && 0==Buffer.Compare((uint8 *)"DSVT", 4) && 0x20U==Buffer.data()[4] && 0x20U==Buffer.data()[8] && 0U==(Buffer.data()[14] & 0x40U) )
+ if ( 27==Buffer.size() && 0==Buffer.Compare((uint8_t *)"DSVT", 4) && 0x20U==Buffer.data()[4] && 0x20U==Buffer.data()[8] && 0U==(Buffer.data()[14] & 0x40U) )
{
// create packet
- dvframe = std::unique_ptr(new CDvFramePacket((struct dstar_dvframe *)&(Buffer.data()[15]), *((uint16 *)&(Buffer.data()[12])), Buffer.data()[14]));
+ dvframe = std::unique_ptr(new CDvFramePacket((struct dstar_dvframe *)&(Buffer.data()[15]), *((uint16_t *)&(Buffer.data()[12])), Buffer.data()[14]));
// check validity of packet
if ( dvframe && dvframe->IsValid() )
return true;
@@ -525,10 +518,10 @@ bool CDextraProtocol::IsValidDvFramePacket(const CBuffer &Buffer, std::unique_pt
bool CDextraProtocol::IsValidDvLastFramePacket(const CBuffer &Buffer, std::unique_ptr &dvframe)
{
- if ( 27==Buffer.size() && 0==Buffer.Compare((uint8 *)"DSVT", 4) && 0x20U==Buffer.data()[4] && 0x20U==Buffer.data()[8] && (Buffer.data()[14] & 0x40) )
+ if ( 27==Buffer.size() && 0==Buffer.Compare((uint8_t *)"DSVT", 4) && 0x20U==Buffer.data()[4] && 0x20U==Buffer.data()[8] && (Buffer.data()[14] & 0x40) )
{
// create packet
- dvframe = std::unique_ptr(new CDvLastFramePacket((struct dstar_dvframe *)&(Buffer.data()[15]), *((uint16 *)&(Buffer.data()[12])), Buffer.data()[14]));
+ dvframe = std::unique_ptr(new CDvLastFramePacket((struct dstar_dvframe *)&(Buffer.data()[15]), *((uint16_t *)&(Buffer.data()[12])), Buffer.data()[14]));
// check validity of packet
if ( dvframe && dvframe->IsValid() )
return true;
@@ -546,12 +539,12 @@ void CDextraProtocol::EncodeKeepAlivePacket(CBuffer *Buffer)
void CDextraProtocol::EncodeConnectPacket(CBuffer *Buffer, const char *Modules)
{
- uint8 lm = (uint8)Modules[0];
- uint8 rm = (uint8)Modules[1];
- Buffer->Set((uint8 *)(const char *)GetReflectorCallsign(), CALLSIGN_LEN);
+ uint8_t lm = (uint8_t)Modules[0];
+ uint8_t rm = (uint8_t)Modules[1];
+ Buffer->Set((uint8_t *)(const char *)GetReflectorCallsign(), CALLSIGN_LEN);
Buffer->Append(lm);
Buffer->Append(rm);
- Buffer->Append((uint8)0);
+ Buffer->Append((uint8_t)0);
}
void CDextraProtocol::EncodeConnectAckPacket(CBuffer *Buffer, int ProtRev)
@@ -560,18 +553,18 @@ void CDextraProtocol::EncodeConnectAckPacket(CBuffer *Buffer, int ProtRev)
if ( ProtRev == 2 )
{
// XRFxxx
- uint8 rm = (Buffer->data())[8];
- uint8 lm = (Buffer->data())[9];
+ uint8_t rm = (Buffer->data())[8];
+ uint8_t lm = (Buffer->data())[9];
Buffer->clear();
- Buffer->Set((uint8 *)(const char *)GetReflectorCallsign(), CALLSIGN_LEN);
+ Buffer->Set((uint8_t *)(const char *)GetReflectorCallsign(), CALLSIGN_LEN);
Buffer->Append(lm);
Buffer->Append(rm);
- Buffer->Append((uint8)0);
+ Buffer->Append((uint8_t)0);
}
else
{
// regular repeater
- uint8 tag[] = { 'A','C','K',0 };
+ uint8_t tag[] = { 'A','C','K',0 };
Buffer->resize(Buffer->size()-1);
Buffer->Append(tag, sizeof(tag));
}
@@ -579,49 +572,49 @@ void CDextraProtocol::EncodeConnectAckPacket(CBuffer *Buffer, int ProtRev)
void CDextraProtocol::EncodeConnectNackPacket(CBuffer *Buffer)
{
- uint8 tag[] = { 'N','A','K',0 };
+ uint8_t tag[] = { 'N','A','K',0 };
Buffer->resize(Buffer->size()-1);
Buffer->Append(tag, sizeof(tag));
}
void CDextraProtocol::EncodeDisconnectPacket(CBuffer *Buffer, char Module)
{
- uint8 tag[] = { ' ',0 };
- Buffer->Set((uint8 *)(const char *)GetReflectorCallsign(), CALLSIGN_LEN);
- Buffer->Append((uint8)Module);
+ uint8_t tag[] = { ' ',0 };
+ Buffer->Set((uint8_t *)(const char *)GetReflectorCallsign(), CALLSIGN_LEN);
+ Buffer->Append((uint8_t)Module);
Buffer->Append(tag, sizeof(tag));
}
void CDextraProtocol::EncodeDisconnectedPacket(CBuffer *Buffer)
{
- uint8 tag[] = { 'D','I','S','C','O','N','N','E','C','T','E','D' };
+ uint8_t tag[] = { 'D','I','S','C','O','N','N','E','C','T','E','D' };
Buffer->Set(tag, sizeof(tag));
}
bool CDextraProtocol::EncodeDvHeaderPacket(const CDvHeaderPacket &Packet, CBuffer *Buffer) const
{
- uint8 tag[] = { 'D','S','V','T',0x10,0x00,0x00,0x00,0x20,0x00,0x01,0x02 };
+ uint8_t tag[] = { 'D','S','V','T',0x10,0x00,0x00,0x00,0x20,0x00,0x01,0x02 };
struct dstar_header DstarHeader;
Packet.ConvertToDstarStruct(&DstarHeader);
Buffer->Set(tag, sizeof(tag));
Buffer->Append(Packet.GetStreamId());
- Buffer->Append((uint8)0x80);
- Buffer->Append((uint8 *)&DstarHeader, sizeof(struct dstar_header));
+ Buffer->Append((uint8_t)0x80);
+ Buffer->Append((uint8_t *)&DstarHeader, sizeof(struct dstar_header));
return true;
}
bool CDextraProtocol::EncodeDvFramePacket(const CDvFramePacket &Packet, CBuffer *Buffer) const
{
- uint8 tag[] = { 'D','S','V','T',0x20,0x00,0x00,0x00,0x20,0x00,0x01,0x02 };
+ uint8_t tag[] = { 'D','S','V','T',0x20,0x00,0x00,0x00,0x20,0x00,0x01,0x02 };
Buffer->Set(tag, sizeof(tag));
Buffer->Append(Packet.GetStreamId());
- Buffer->Append((uint8)(Packet.GetPacketId() % 21));
- Buffer->Append((uint8 *)Packet.GetAmbe(), AMBE_SIZE);
- Buffer->Append((uint8 *)Packet.GetDvData(), DVDATA_SIZE);
+ Buffer->Append((uint8_t)(Packet.GetPacketId() % 21));
+ Buffer->Append((uint8_t *)Packet.GetAmbe(), AMBE_SIZE);
+ Buffer->Append((uint8_t *)Packet.GetDvData(), DVDATA_SIZE);
return true;
@@ -629,12 +622,12 @@ bool CDextraProtocol::EncodeDvFramePacket(const CDvFramePacket &Packet, CBuffer
bool CDextraProtocol::EncodeDvLastFramePacket(const CDvLastFramePacket &Packet, CBuffer *Buffer) const
{
- uint8 tag1[] = { 'D','S','V','T',0x20,0x00,0x00,0x00,0x20,0x00,0x01,0x02 };
- uint8 tag2[] = { 0x55,0xC8,0x7A,0x00,0x00,0x00,0x00,0x00,0x00,0x25,0x1A,0xC6 };
+ uint8_t tag1[] = { 'D','S','V','T',0x20,0x00,0x00,0x00,0x20,0x00,0x01,0x02 };
+ uint8_t tag2[] = { 0x55,0xC8,0x7A,0x00,0x00,0x00,0x00,0x00,0x00,0x25,0x1A,0xC6 };
Buffer->Set(tag1, sizeof(tag1));
Buffer->Append(Packet.GetStreamId());
- Buffer->Append((uint8)((Packet.GetPacketId() % 21) | 0x40));
+ Buffer->Append((uint8_t)((Packet.GetPacketId() % 21) | 0x40));
Buffer->Append(tag2, sizeof(tag2));
return true;
diff --git a/src/DExtraProtocol.h b/src/DExtraProtocol.h
index 2984348..844ce88 100644
--- a/src/DExtraProtocol.h
+++ b/src/DExtraProtocol.h
@@ -1,29 +1,22 @@
-//
-// DExtraProtocol.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 01/11/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cdextraprotocol_h
-#define cdextraprotocol_h
+#pragma once
#include "Timer.h"
#include "DCSProtocol.h"
@@ -59,7 +52,7 @@ class CDextraProtocol : public CProtocol
{
public:
// initialization
- bool Initialize(const char *type, const int ptype, const uint16 port, const bool has_ipv4, const bool has_ipv6);
+ bool Initialize(const char *type, const int ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6);
// task
void Task(void);
@@ -99,6 +92,3 @@ protected:
CTimePoint m_LastKeepaliveTime;
CTimePoint m_LastPeersLinkTime;
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cdextraprotocol_h */
diff --git a/src/DMRIdDir.cpp b/src/DMRIdDir.cpp
index ffe0ffc..7fb82d4 100644
--- a/src/DMRIdDir.cpp
+++ b/src/DMRIdDir.cpp
@@ -1,32 +1,26 @@
-//
-// cdmriddir.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 08/10/2016.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include
#include "Main.h"
#include "Reflector.h"
#include "DMRIdDir.h"
-#include "cdmriddirfile.h"
+#include "DMRIdDirFile.h"
#include "DMRIdDirHttp.h"
////////////////////////////////////////////////////////////////////////////////////////
@@ -78,7 +72,7 @@ void CDmridDir::Thread()
{
// Wait DMRIDDB_REFRESH_RATE minutes
for (int i=0; i<30*DMRIDDB_REFRESH_RATE && keep_running; i++)
- CTimePoint::TaskSleepFor(2000);
+ std::this_thread::sleep_for(std::chrono::milliseconds(2000));
// have lists files changed ?
if ( NeedReload() )
@@ -111,7 +105,7 @@ bool CDmridDir::Reload(void)
////////////////////////////////////////////////////////////////////////////////////////
// find
-const CCallsign *CDmridDir::FindCallsign(uint32 dmrid)
+const CCallsign *CDmridDir::FindCallsign(uint32_t dmrid)
{
auto found = m_CallsignMap.find(dmrid);
if ( found != m_CallsignMap.end() )
@@ -121,7 +115,7 @@ const CCallsign *CDmridDir::FindCallsign(uint32 dmrid)
return nullptr;
}
-uint32 CDmridDir::FindDmrid(const CCallsign &callsign)
+uint32_t CDmridDir::FindDmrid(const CCallsign &callsign)
{
auto found = m_DmridMap.find(callsign);
if ( found != m_DmridMap.end() )
diff --git a/src/DMRIdDir.h b/src/DMRIdDir.h
index d526697..ccd2b08 100644
--- a/src/DMRIdDir.h
+++ b/src/DMRIdDir.h
@@ -1,29 +1,22 @@
-//
-// DMRIdDir.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 08/10/2016.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cdmriddir_h
-#define cdmriddir_h
+#pragma once
#include
#include
@@ -65,8 +58,8 @@ public:
virtual bool RefreshContent(const CBuffer &) { return false; }
// find
- const CCallsign *FindCallsign(uint32);
- uint32 FindDmrid(const CCallsign &);
+ const CCallsign *FindCallsign(uint32_t);
+ uint32_t FindDmrid(const CCallsign &);
protected:
// thread
@@ -79,17 +72,14 @@ protected:
protected:
// data
- std::map m_CallsignMap;
- std::map m_DmridMap;
+ std::map m_CallsignMap;
+ std::map m_DmridMap;
// Lock()
- std::mutex m_Mutex;
+ std::mutex m_Mutex;
// thread
std::atomic keep_running;
std::future m_Future;
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cdmriddir_h */
diff --git a/src/DMRIdDirFile.cpp b/src/DMRIdDirFile.cpp
new file mode 100644
index 0000000..c886481
--- /dev/null
+++ b/src/DMRIdDirFile.cpp
@@ -0,0 +1,159 @@
+// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// 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 .
+
+#include
+#include
+#include
+#include "Main.h"
+#include "DMRIdDirFile.h"
+
+
+#if (DMRIDDB_USE_RLX_SERVER == 0)
+CDmridDirFile g_DmridDir;
+#endif
+
+////////////////////////////////////////////////////////////////////////////////////////
+// constructor & destructor
+
+CDmridDirFile::CDmridDirFile()
+{
+ ::memset(&m_LastModTime, 0, sizeof(time_t));
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////
+// init & close
+
+bool CDmridDirFile::Init(void)
+{
+ return CDmridDir::Init();
+}
+
+////////////////////////////////////////////////////////////////////////////////////////
+// refresh
+
+bool CDmridDirFile::NeedReload(void)
+{
+ bool needReload = false;
+
+ time_t time;
+ if ( GetLastModTime(&time) )
+ {
+ needReload = time != m_LastModTime;
+ }
+ return needReload;
+}
+
+bool CDmridDirFile::LoadContent(CBuffer *buffer)
+{
+ bool ok = false;
+ std::ifstream file;
+ std::streampos size;
+
+ // open file
+ file.open(DMRIDDB_PATH, std::ios::in | std::ios::binary | std::ios::ate);
+ if ( file.is_open() )
+ {
+ // read file
+ size = file.tellg();
+ if ( size > 0 )
+ {
+ // read file into buffer
+ buffer->resize((int)size+1);
+ file.seekg (0, std::ios::beg);
+ file.read((char *)buffer->data(), (int)size);
+
+ // close file
+ file.close();
+
+ // update time
+ GetLastModTime(&m_LastModTime);
+
+ // done
+ ok = true;
+ }
+ }
+
+ // done
+ return ok;
+}
+
+bool CDmridDirFile::RefreshContent(const CBuffer &buffer)
+{
+ bool ok = false;
+
+ // clear directory
+ m_CallsignMap.clear();
+ m_DmridMap.clear();
+
+ // scan buffer
+ if ( buffer.size() > 0 )
+ {
+ // crack it
+ char *ptr1 = (char *)buffer.data();
+ char *ptr2;
+
+ // get next line
+ while ( (ptr2 = ::strchr(ptr1, '\n')) != nullptr )
+ {
+ *ptr2 = 0;
+ // get items
+ char *dmrid;
+ char *callsign;
+ if ( ((dmrid = ::strtok(ptr1, ";")) != nullptr) && IsValidDmrid(dmrid) )
+ {
+ if ( ((callsign = ::strtok(nullptr, ";")) != nullptr) )
+ {
+ // new entry
+ uint32_t ui = atoi(dmrid);
+ CCallsign cs(callsign, ui);
+ if ( cs.IsValid() )
+ {
+ m_CallsignMap.insert(std::pair(ui, cs));
+ m_DmridMap.insert(std::pair(cs,ui));
+ }
+ }
+ }
+ // next line
+ ptr1 = ptr2+1;
+ }
+
+ // done
+ ok = true;
+ }
+
+ // report
+ std::cout << "Read " << m_DmridMap.size() << " DMR ids from file " << DMRIDDB_PATH << std::endl;
+
+ // done
+ return ok;
+}
+
+
+bool CDmridDirFile::GetLastModTime(time_t *time)
+{
+ bool ok = false;
+
+ struct stat fileStat;
+ if( ::stat(DMRIDDB_PATH, &fileStat) != -1 )
+ {
+ *time = fileStat.st_mtime;
+ ok = true;
+ }
+ return ok;
+}
diff --git a/src/DMRIdDirFile.h b/src/DMRIdDirFile.h
new file mode 100644
index 0000000..75883bf
--- /dev/null
+++ b/src/DMRIdDirFile.h
@@ -0,0 +1,47 @@
+// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// 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 .
+
+#pragma once
+
+#include "DMRIdDir.h"
+
+class CDmridDirFile : public CDmridDir
+{
+public:
+ // constructor
+ CDmridDirFile();
+
+ // destructor
+ ~CDmridDirFile() {}
+
+ // init & close
+ bool Init(void);
+
+ // refresh
+ bool LoadContent(CBuffer *);
+ bool RefreshContent(const CBuffer &);
+
+protected:
+ // reload helpers
+ bool NeedReload(void);
+ bool GetLastModTime(time_t *);
+
+protected:
+ // data
+ time_t m_LastModTime;
+};
diff --git a/src/DMRIdDirHttp.cpp b/src/DMRIdDirHttp.cpp
index bf5beb0..e61a030 100644
--- a/src/DMRIdDirHttp.cpp
+++ b/src/DMRIdDirHttp.cpp
@@ -1,26 +1,20 @@
-//
-// cdmriddirhttp.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 29/12/2017.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include
#include "Main.h"
@@ -68,12 +62,12 @@ bool CDmridDirHttp::RefreshContent(const CBuffer &buffer)
if ( ((callsign = ::strtok(nullptr, ";")) != nullptr) )
{
// new entry
- uint32 ui = atoi(dmrid);
+ uint32_t ui = atoi(dmrid);
CCallsign cs(callsign, ui);
if ( cs.IsValid() )
{
- m_CallsignMap.insert(std::pair(ui, cs));
- m_DmridMap.insert(std::pair(cs,ui));
+ m_CallsignMap.insert(std::pair(ui, cs));
+ m_DmridMap.insert(std::pair(cs,ui));
}
}
}
@@ -148,7 +142,7 @@ bool CDmridDirHttp::HttpGet(const char *hostname, const char *filename, int port
len = read(sock_id, buf, 1440);
if ( len > 0 )
{
- buffer->Append((uint8 *)buf, (int)len);
+ buffer->Append((uint8_t *)buf, (int)len);
ok = true;
}
//}
@@ -156,7 +150,7 @@ bool CDmridDirHttp::HttpGet(const char *hostname, const char *filename, int port
}
while (!done);
- buffer->Append((uint8)0);
+ buffer->Append((uint8_t)0);
// and disconnect
close(sock_id);
diff --git a/src/DMRIdDirHttp.h b/src/DMRIdDirHttp.h
index 60056d1..9a19250 100644
--- a/src/DMRIdDirHttp.h
+++ b/src/DMRIdDirHttp.h
@@ -1,34 +1,25 @@
-//
-// DMRIdDirHttp.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 29/12/2017.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cdmriddirhttp_h
-#define cdmriddirhttp_h
+#pragma once
#include "DMRIdDir.h"
-////////////////////////////////////////////////////////////////////////////////////////
-
class CDmridDirHttp : public CDmridDir
{
public:
@@ -47,6 +38,3 @@ protected:
bool NeedReload(void) { return true; }
bool HttpGet(const char *, const char *, int, CBuffer *);
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cdmriddirhttp_h */
diff --git a/src/DMRMMDVMClient.cpp b/src/DMRMMDVMClient.cpp
index 24132e6..e3c0f02 100644
--- a/src/DMRMMDVMClient.cpp
+++ b/src/DMRMMDVMClient.cpp
@@ -1,29 +1,23 @@
-//
-// cdmrmmdvmclient.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 04/03/2017.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
-#include "DMMMDVMClient.h"
+#include "DMRMMDVMClient.h"
////////////////////////////////////////////////////////////////////////////////////////
@@ -48,5 +42,5 @@ CDmrmmdvmClient::CDmrmmdvmClient(const CDmrmmdvmClient &client)
bool CDmrmmdvmClient::IsAlive(void) const
{
- return (m_LastKeepaliveTime.DurationSinceNow() < DMRMMDVM_KEEPALIVE_TIMEOUT);
+ return (m_LastKeepaliveTime.time() < DMRMMDVM_KEEPALIVE_TIMEOUT);
}
diff --git a/src/DMRMMDVMClient.h b/src/DMRMMDVMClient.h
index f61b16d..041c0df 100644
--- a/src/DMRMMDVMClient.h
+++ b/src/DMRMMDVMClient.h
@@ -1,39 +1,25 @@
-//
-// DMMMDVMClient.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 04/03/2017.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cdmrmmdvmclient_h
-#define cdmrmmdvmclient_h
+#pragma once
#include "Client.h"
-////////////////////////////////////////////////////////////////////////////////////////
-// define
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-// class
-
class CDmrmmdvmClient : public CClient
{
public:
@@ -54,7 +40,3 @@ public:
// status
bool IsAlive(void) const;
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-
-#endif /* cdmrmmdvmclient_h */
diff --git a/src/DMRMMDVMProtocol.cpp b/src/DMRMMDVMProtocol.cpp
index 0abdcc4..9542b87 100644
--- a/src/DMRMMDVMProtocol.cpp
+++ b/src/DMRMMDVMProtocol.cpp
@@ -1,35 +1,28 @@
-//
-// cdmrmmdvmprotocol.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 104/03/2017.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
-// Copyright © 2020 Thomas A. Early, N7TAE
-//
-// ----------------------------------------------------------------------------
-// This file is part of xlxd.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
#include
-#include "DMMMDVMClient.h"
-#include "DMMMDVMProtocol.h"
+#include "DMRMMDVMClient.h"
+#include "DMRMMDVMProtocol.h"
#include "Reflector.h"
#include "GateKeeper.h"
-#include "CBPT19696.h"
+#include "CBPTC19696.h"
#include "RS129.h"
#include "Golay2087.h"
#include "QR1676.h"
@@ -45,16 +38,16 @@
////////////////////////////////////////////////////////////////////////////////////////
// constants
-static uint8 g_DmrSyncBSVoice[] = { 0x07,0x55,0xFD,0x7D,0xF7,0x5F,0x70 };
-static uint8 g_DmrSyncBSData[] = { 0x0D,0xFF,0x57,0xD7,0x5D,0xF5,0xD0 };
-static uint8 g_DmrSyncMSVoice[] = { 0x07,0xF7,0xD5,0xDD,0x57,0xDF,0xD0 };
-static uint8 g_DmrSyncMSData[] = { 0x0D,0x5D,0x7F,0x77,0xFD,0x75,0x70 };
+static uint8_t g_DmrSyncBSVoice[] = { 0x07,0x55,0xFD,0x7D,0xF7,0x5F,0x70 };
+static uint8_t g_DmrSyncBSData[] = { 0x0D,0xFF,0x57,0xD7,0x5D,0xF5,0xD0 };
+static uint8_t g_DmrSyncMSVoice[] = { 0x07,0xF7,0xD5,0xDD,0x57,0xDF,0xD0 };
+static uint8_t g_DmrSyncMSData[] = { 0x0D,0x5D,0x7F,0x77,0xFD,0x75,0x70 };
////////////////////////////////////////////////////////////////////////////////////////
// operation
-bool CDmrmmdvmProtocol::Initialize(const char *type, const int ptype, const uint16 port, const bool has_ipv4, const bool has_ipv6)
+bool CDmrmmdvmProtocol::Initialize(const char *type, const int 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))
@@ -66,7 +59,7 @@ bool CDmrmmdvmProtocol::Initialize(const char *type, const int ptype, const uint
// random number generator
time_t t;
::srand((unsigned) time(&t));
- m_uiAuthSeed = (uint32)rand();
+ m_uiAuthSeed = (uint32_t)rand();
// done
return true;
@@ -83,8 +76,8 @@ void CDmrmmdvmProtocol::Task(void)
CIp Ip;
CCallsign Callsign;
int iRssi;
- uint8 Cmd;
- uint8 CallType;
+ uint8_t Cmd;
+ uint8_t CallType;
std::unique_ptr Header;
std::unique_ptr LastFrame;
std::array, 3> Frames;
@@ -261,7 +254,7 @@ void CDmrmmdvmProtocol::Task(void)
////////////////////////////////////////////////////////////////////////////////////////
// streams helpers
-void CDmrmmdvmProtocol::OnDvHeaderPacketIn(std::unique_ptr &Header, const CIp &Ip, uint8 cmd, uint8 CallType)
+void CDmrmmdvmProtocol::OnDvHeaderPacketIn(std::unique_ptr &Header, const CIp &Ip, uint8_t cmd, uint8_t CallType)
{
bool lastheard = false;
@@ -478,12 +471,12 @@ void CDmrmmdvmProtocol::HandleKeepalives(void)
bool CDmrmmdvmProtocol::IsValidKeepAlivePacket(const CBuffer &Buffer, CCallsign *callsign)
{
- uint8 tag[] = { 'R','P','T','P','I','N','G' };
+ uint8_t tag[] = { 'R','P','T','P','I','N','G' };
bool valid = false;
if ( (Buffer.size() == 11) && (Buffer.Compare(tag, sizeof(tag)) == 0) )
{
- uint32 uiRptrId = MAKEDWORD(MAKEWORD(Buffer.data()[10],Buffer.data()[9]),MAKEWORD(Buffer.data()[8],Buffer.data()[7]));
+ uint32_t uiRptrId = MAKEDWORD(MAKEWORD(Buffer.data()[10],Buffer.data()[9]),MAKEWORD(Buffer.data()[8],Buffer.data()[7]));
callsign->SetDmrid(uiRptrId, true);
callsign->SetModule(MMDVM_MODULE_ID);
valid = callsign->IsValid();
@@ -493,12 +486,12 @@ bool CDmrmmdvmProtocol::IsValidKeepAlivePacket(const CBuffer &Buffer, CCallsign
bool CDmrmmdvmProtocol::IsValidConnectPacket(const CBuffer &Buffer, CCallsign *callsign, const CIp &Ip)
{
- uint8 tag[] = { 'R','P','T','L' };
+ uint8_t tag[] = { 'R','P','T','L' };
bool valid = false;
if ( (Buffer.size() == 8) && (Buffer.Compare(tag, sizeof(tag)) == 0) )
{
- uint32 uiRptrId = MAKEDWORD(MAKEWORD(Buffer.data()[7],Buffer.data()[6]),MAKEWORD(Buffer.data()[5],Buffer.data()[4]));
+ uint32_t uiRptrId = MAKEDWORD(MAKEWORD(Buffer.data()[7],Buffer.data()[6]),MAKEWORD(Buffer.data()[5],Buffer.data()[4]));
callsign->SetDmrid(uiRptrId, true);
callsign->SetModule(MMDVM_MODULE_ID);
valid = callsign->IsValid();
@@ -512,12 +505,12 @@ bool CDmrmmdvmProtocol::IsValidConnectPacket(const CBuffer &Buffer, CCallsign *c
bool CDmrmmdvmProtocol::IsValidAuthenticationPacket(const CBuffer &Buffer, CCallsign *callsign, const CIp &Ip)
{
- uint8 tag[] = { 'R','P','T','K' };
+ uint8_t tag[] = { 'R','P','T','K' };
bool valid = false;
if ( (Buffer.size() == 40) && (Buffer.Compare(tag, sizeof(tag)) == 0) )
{
- uint32 uiRptrId = MAKEDWORD(MAKEWORD(Buffer.data()[7],Buffer.data()[6]),MAKEWORD(Buffer.data()[5],Buffer.data()[4]));
+ uint32_t uiRptrId = MAKEDWORD(MAKEWORD(Buffer.data()[7],Buffer.data()[6]),MAKEWORD(Buffer.data()[5],Buffer.data()[4]));
callsign->SetDmrid(uiRptrId, true);
callsign->SetModule(MMDVM_MODULE_ID);
valid = callsign->IsValid();
@@ -532,12 +525,12 @@ bool CDmrmmdvmProtocol::IsValidAuthenticationPacket(const CBuffer &Buffer, CCall
bool CDmrmmdvmProtocol::IsValidDisconnectPacket(const CBuffer &Buffer, CCallsign *callsign)
{
- uint8 tag[] = { 'R','P','T','C','L' };
+ uint8_t tag[] = { 'R','P','T','C','L' };
bool valid = false;
if ( (Buffer.size() == 13) && (Buffer.Compare(tag, sizeof(tag)) == 0) )
{
- uint32 uiRptrId = MAKEDWORD(MAKEWORD(Buffer.data()[7],Buffer.data()[6]),MAKEWORD(Buffer.data()[5],Buffer.data()[4]));
+ uint32_t uiRptrId = MAKEDWORD(MAKEWORD(Buffer.data()[7],Buffer.data()[6]),MAKEWORD(Buffer.data()[5],Buffer.data()[4]));
callsign->SetDmrid(uiRptrId, true);
callsign->SetModule(MMDVM_MODULE_ID);
valid = callsign->IsValid();
@@ -547,12 +540,12 @@ bool CDmrmmdvmProtocol::IsValidDisconnectPacket(const CBuffer &Buffer, CCallsign
bool CDmrmmdvmProtocol::IsValidConfigPacket(const CBuffer &Buffer, CCallsign *callsign, const CIp &Ip)
{
- uint8 tag[] = { 'R','P','T','C' };
+ uint8_t tag[] = { 'R','P','T','C' };
bool valid = false;
if ( (Buffer.size() == 302) && (Buffer.Compare(tag, sizeof(tag)) == 0) )
{
- uint32 uiRptrId = MAKEDWORD(MAKEWORD(Buffer.data()[7],Buffer.data()[6]),MAKEWORD(Buffer.data()[5],Buffer.data()[4]));
+ uint32_t uiRptrId = MAKEDWORD(MAKEWORD(Buffer.data()[7],Buffer.data()[6]),MAKEWORD(Buffer.data()[5],Buffer.data()[4]));
callsign->SetDmrid(uiRptrId, true);
callsign->SetModule(MMDVM_MODULE_ID);
valid = callsign->IsValid();
@@ -567,12 +560,12 @@ bool CDmrmmdvmProtocol::IsValidConfigPacket(const CBuffer &Buffer, CCallsign *ca
bool CDmrmmdvmProtocol::IsValidOptionPacket(const CBuffer &Buffer, CCallsign *callsign)
{
- uint8 tag[] = { 'R','P','T','O' };
+ uint8_t tag[] = { 'R','P','T','O' };
bool valid = false;
if ( (Buffer.size() >= 8) && (Buffer.Compare(tag, sizeof(tag)) == 0) )
{
- uint32 uiRptrId = MAKEDWORD(MAKEWORD(Buffer.data()[7],Buffer.data()[6]),MAKEWORD(Buffer.data()[5],Buffer.data()[4]));
+ uint32_t uiRptrId = MAKEDWORD(MAKEWORD(Buffer.data()[7],Buffer.data()[6]),MAKEWORD(Buffer.data()[5],Buffer.data()[4]));
callsign->SetDmrid(uiRptrId, true);
callsign->SetModule(MMDVM_MODULE_ID);
valid = callsign->IsValid();
@@ -582,7 +575,7 @@ bool CDmrmmdvmProtocol::IsValidOptionPacket(const CBuffer &Buffer, CCallsign *ca
bool CDmrmmdvmProtocol::IsValidRssiPacket(const CBuffer &Buffer, CCallsign *callsign, int *rssi)
{
- uint8 tag[] = { 'R','P','T','I','N','T','R' };
+ uint8_t tag[] = { 'R','P','T','I','N','T','R' };
bool valid = false;
if ( (Buffer.size() == 17) && (Buffer.Compare(tag, sizeof(tag)) == 0) )
@@ -595,26 +588,26 @@ bool CDmrmmdvmProtocol::IsValidRssiPacket(const CBuffer &Buffer, CCallsign *call
return valid;
}
-bool CDmrmmdvmProtocol::IsValidDvHeaderPacket(const CBuffer &Buffer, std::unique_ptr &header, uint8 *cmd, uint8 *CallType)
+bool CDmrmmdvmProtocol::IsValidDvHeaderPacket(const CBuffer &Buffer, std::unique_ptr &header, uint8_t *cmd, uint8_t *CallType)
{
- uint8 tag[] = { 'D','M','R','D' };
+ uint8_t tag[] = { 'D','M','R','D' };
*cmd = CMD_NONE;
if ( (Buffer.size() == 55) && (Buffer.Compare(tag, sizeof(tag)) == 0) )
{
// frame details
- uint8 uiFrameType = (Buffer.data()[15] & 0x30) >> 4;
- uint8 uiSlot = (Buffer.data()[15] & 0x80) ? DMR_SLOT2 : DMR_SLOT1;
- uint8 uiCallType = (Buffer.data()[15] & 0x40) ? DMR_PRIVATE_CALL : DMR_GROUP_CALL;
- uint8 uiSlotType = Buffer.data()[15] & 0x0F;
+ uint8_t uiFrameType = (Buffer.data()[15] & 0x30) >> 4;
+ uint8_t uiSlot = (Buffer.data()[15] & 0x80) ? DMR_SLOT2 : DMR_SLOT1;
+ uint8_t uiCallType = (Buffer.data()[15] & 0x40) ? DMR_PRIVATE_CALL : DMR_GROUP_CALL;
+ uint8_t uiSlotType = Buffer.data()[15] & 0x0F;
//std::cout << (int)uiSlot << std::endl;
if ( (uiFrameType == DMRMMDVM_FRAMETYPE_DATASYNC) &&
(uiSlot == DMRMMDVM_REFLECTOR_SLOT) &&
(uiSlotType == MMDVM_SLOTTYPE_HEADER) )
{
// extract sync
- uint8 dmrsync[7];
+ uint8_t dmrsync[7];
dmrsync[0] = Buffer.data()[33] & 0x0F;
::memcpy(&dmrsync[1], &Buffer.data()[34], 5);
dmrsync[6] = Buffer.data()[39] & 0xF0;
@@ -624,16 +617,16 @@ bool CDmrmmdvmProtocol::IsValidDvHeaderPacket(const CBuffer &Buffer, std::unique
{
// get payload
//CBPTC19696 bptc;
- //uint8 lcdata[12];
+ //uint8_t lcdata[12];
//bptc.decode(&(Buffer.data()[20]), lcdata);
// crack DMR header
- //uint8 uiSeqId = Buffer.data()[4];
- uint32 uiSrcId = MAKEDWORD(MAKEWORD(Buffer.data()[7],Buffer.data()[6]),MAKEWORD(Buffer.data()[5],0));
- uint32 uiDstId = MAKEDWORD(MAKEWORD(Buffer.data()[10],Buffer.data()[9]),MAKEWORD(Buffer.data()[8],0));
- uint32 uiRptrId = MAKEDWORD(MAKEWORD(Buffer.data()[14],Buffer.data()[13]),MAKEWORD(Buffer.data()[12],Buffer.data()[11]));
- //uint8 uiVoiceSeq = (Buffer.data()[15] & 0x0F);
- uint32 uiStreamId = *(uint32 *)(&Buffer.data()[16]);
+ //uint8_t uiSeqId = Buffer.data()[4];
+ uint32_t uiSrcId = MAKEDWORD(MAKEWORD(Buffer.data()[7],Buffer.data()[6]),MAKEWORD(Buffer.data()[5],0));
+ uint32_t uiDstId = MAKEDWORD(MAKEWORD(Buffer.data()[10],Buffer.data()[9]),MAKEWORD(Buffer.data()[8],0));
+ uint32_t uiRptrId = MAKEDWORD(MAKEWORD(Buffer.data()[14],Buffer.data()[13]),MAKEWORD(Buffer.data()[12],Buffer.data()[11]));
+ //uint8_t uiVoiceSeq = (Buffer.data()[15] & 0x0F);
+ uint32_t uiStreamId = *(uint32_t *)(&Buffer.data()[16]);
// call type
*CallType = uiCallType;
@@ -671,30 +664,30 @@ bool CDmrmmdvmProtocol::IsValidDvHeaderPacket(const CBuffer &Buffer, std::unique
bool CDmrmmdvmProtocol::IsValidDvFramePacket(const CBuffer &Buffer, std::array, 3> &frames)
{
- uint8 tag[] = { 'D','M','R','D' };
+ uint8_t tag[] = { 'D','M','R','D' };
if ( (Buffer.size() == 55) && (Buffer.Compare(tag, sizeof(tag)) == 0) )
{
// frame details
- uint8 uiFrameType = (Buffer.data()[15] & 0x30) >> 4;
- uint8 uiSlot = (Buffer.data()[15] & 0x80) ? DMR_SLOT2 : DMR_SLOT1;
- uint8 uiCallType = (Buffer.data()[15] & 0x40) ? DMR_PRIVATE_CALL : DMR_GROUP_CALL;
+ uint8_t uiFrameType = (Buffer.data()[15] & 0x30) >> 4;
+ uint8_t uiSlot = (Buffer.data()[15] & 0x80) ? DMR_SLOT2 : DMR_SLOT1;
+ uint8_t uiCallType = (Buffer.data()[15] & 0x40) ? DMR_PRIVATE_CALL : DMR_GROUP_CALL;
if ( ((uiFrameType == DMRMMDVM_FRAMETYPE_VOICE) || (uiFrameType == DMRMMDVM_FRAMETYPE_VOICESYNC)) &&
(uiSlot == DMRMMDVM_REFLECTOR_SLOT) && (uiCallType == DMR_GROUP_CALL) )
{
// crack DMR header
- //uint8 uiSeqId = Buffer.data()[4];
- //uint32 uiSrcId = MAKEDWORD(MAKEWORD(Buffer.data()[7],Buffer.data()[6]),MAKEWORD(Buffer.data()[5],0));
- //uint32 uiDstId = MAKEDWORD(MAKEWORD(Buffer.data()[10],Buffer.data()[9]),MAKEWORD(Buffer.data()[8],0));
- //uint32 uiRptrId = MAKEDWORD(MAKEWORD(Buffer.data()[14],Buffer.data()[13]),MAKEWORD(Buffer.data()[12],Buffer.data()[11]));
- uint8 uiVoiceSeq = (Buffer.data()[15] & 0x0F);
- uint32 uiStreamId = *(uint32 *)(&Buffer.data()[16]);
+ //uint8_t uiSeqId = Buffer.data()[4];
+ //uint32_t uiSrcId = MAKEDWORD(MAKEWORD(Buffer.data()[7],Buffer.data()[6]),MAKEWORD(Buffer.data()[5],0));
+ //uint32_t uiDstId = MAKEDWORD(MAKEWORD(Buffer.data()[10],Buffer.data()[9]),MAKEWORD(Buffer.data()[8],0));
+ //uint32_t uiRptrId = MAKEDWORD(MAKEWORD(Buffer.data()[14],Buffer.data()[13]),MAKEWORD(Buffer.data()[12],Buffer.data()[11]));
+ uint8_t uiVoiceSeq = (Buffer.data()[15] & 0x0F);
+ uint32_t uiStreamId = *(uint32_t *)(&Buffer.data()[16]);
// crack payload
- uint8 dmrframe[33];
- uint8 dmr3ambe[27];
- uint8 dmrambe[9];
- uint8 dmrsync[7];
+ uint8_t dmrframe[33];
+ uint8_t dmr3ambe[27];
+ uint8_t dmrambe[9];
+ uint8_t dmrsync[7];
// get the 33 bytes ambe
memcpy(dmrframe, &(Buffer.data()[20]), 33);
// extract the 3 ambe frames
@@ -735,22 +728,22 @@ bool CDmrmmdvmProtocol::IsValidDvFramePacket(const CBuffer &Buffer, std::array &frame)
{
- uint8 tag[] = { 'D','M','R','D' };
+ uint8_t tag[] = { 'D','M','R','D' };
if ( (Buffer.size() == 55) && (Buffer.Compare(tag, sizeof(tag)) == 0) )
{
// frame details
- uint8 uiFrameType = (Buffer.data()[15] & 0x30) >> 4;
- uint8 uiSlot = (Buffer.data()[15] & 0x80) ? DMR_SLOT2 : DMR_SLOT1;
- //uint8 uiCallType = (Buffer.data()[15] & 0x40) ? DMR_PRIVATE_CALL : DMR_GROUP_CALL;
- uint8 uiSlotType = Buffer.data()[15] & 0x0F;
+ uint8_t uiFrameType = (Buffer.data()[15] & 0x30) >> 4;
+ uint8_t uiSlot = (Buffer.data()[15] & 0x80) ? DMR_SLOT2 : DMR_SLOT1;
+ //uint8_t uiCallType = (Buffer.data()[15] & 0x40) ? DMR_PRIVATE_CALL : DMR_GROUP_CALL;
+ uint8_t uiSlotType = Buffer.data()[15] & 0x0F;
//std::cout << (int)uiSlot << std::endl;
if ( (uiFrameType == DMRMMDVM_FRAMETYPE_DATASYNC) &&
(uiSlot == DMRMMDVM_REFLECTOR_SLOT) &&
(uiSlotType == MMDVM_SLOTTYPE_TERMINATOR) )
{
// extract sync
- uint8 dmrsync[7];
+ uint8_t dmrsync[7];
dmrsync[0] = Buffer.data()[33] & 0x0F;
::memcpy(&dmrsync[1], &Buffer.data()[34], 5);
dmrsync[6] = Buffer.data()[39] & 0xF0;
@@ -760,19 +753,19 @@ bool CDmrmmdvmProtocol::IsValidDvLastFramePacket(const CBuffer &Buffer, std::uni
{
// get payload
//CBPTC19696 bptc;
- //uint8 lcdata[12];
+ //uint8_t lcdata[12];
//bptc.decode(&(Buffer.data()[20]), lcdata);
// crack DMR header
- //uint8 uiSeqId = Buffer.data()[4];
- //uint32 uiSrcId = MAKEDWORD(MAKEWORD(Buffer.data()[7],Buffer.data()[6]),MAKEWORD(Buffer.data()[5],0));
- //uint32 uiDstId = MAKEDWORD(MAKEWORD(Buffer.data()[10],Buffer.data()[9]),MAKEWORD(Buffer.data()[8],0));
- //uint32 uiRptrId = MAKEDWORD(MAKEWORD(Buffer.data()[14],Buffer.data()[13]),MAKEWORD(Buffer.data()[12],Buffer.data()[11]));
- //uint8 uiVoiceSeq = (Buffer.data()[15] & 0x0F);
- uint32 uiStreamId = *(uint32 *)(&Buffer.data()[16]);
+ //uint8_t uiSeqId = Buffer.data()[4];
+ //uint32_t uiSrcId = MAKEDWORD(MAKEWORD(Buffer.data()[7],Buffer.data()[6]),MAKEWORD(Buffer.data()[5],0));
+ //uint32_t uiDstId = MAKEDWORD(MAKEWORD(Buffer.data()[10],Buffer.data()[9]),MAKEWORD(Buffer.data()[8],0));
+ //uint32_t uiRptrId = MAKEDWORD(MAKEWORD(Buffer.data()[14],Buffer.data()[13]),MAKEWORD(Buffer.data()[12],Buffer.data()[11]));
+ //uint8_t uiVoiceSeq = (Buffer.data()[15] & 0x0F);
+ uint32_t uiStreamId = *(uint32_t *)(&Buffer.data()[16]);
// dummy ambe
- uint8 ambe[9];
+ uint8_t ambe[9];
::memset(ambe, 0, sizeof(ambe));
@@ -791,23 +784,23 @@ bool CDmrmmdvmProtocol::IsValidDvLastFramePacket(const CBuffer &Buffer, std::uni
void CDmrmmdvmProtocol::EncodeKeepAlivePacket(CBuffer *Buffer, std::shared_ptrClient)
{
- uint8 tag[] = { 'M','S','T','P','O','N','G' };
+ uint8_t tag[] = { 'M','S','T','P','O','N','G' };
Buffer->Set(tag, sizeof(tag));
- uint32 uiDmrId = Client->GetCallsign().GetDmrid();
- Buffer->Append((uint8 *)&uiDmrId, 4);
+ uint32_t uiDmrId = Client->GetCallsign().GetDmrid();
+ Buffer->Append((uint8_t *)&uiDmrId, 4);
}
void CDmrmmdvmProtocol::EncodeAckPacket(CBuffer *Buffer, const CCallsign &Callsign)
{
- uint8 tag[] = { 'R','P','T','A','C','K' };
+ uint8_t tag[] = { 'R','P','T','A','C','K' };
Buffer->Set(tag, sizeof(tag));
}
-void CDmrmmdvmProtocol::EncodeConnectAckPacket(CBuffer *Buffer, const CCallsign &Callsign, uint32 AuthSeed)
+void CDmrmmdvmProtocol::EncodeConnectAckPacket(CBuffer *Buffer, const CCallsign &Callsign, uint32_t AuthSeed)
{
- uint8 tag[] = { 'R','P','T','A','C','K' };
+ uint8_t tag[] = { 'R','P','T','A','C','K' };
Buffer->Set(tag, sizeof(tag));
Buffer->Append(AuthSeed);
@@ -815,55 +808,55 @@ void CDmrmmdvmProtocol::EncodeConnectAckPacket(CBuffer *Buffer, const CCallsign
void CDmrmmdvmProtocol::EncodeNackPacket(CBuffer *Buffer, const CCallsign &Callsign)
{
- uint8 tag[] = { 'M','S','T','N','A','K' };
+ uint8_t tag[] = { 'M','S','T','N','A','K' };
Buffer->Set(tag, sizeof(tag));
}
void CDmrmmdvmProtocol::EncodeClosePacket(CBuffer *Buffer, std::shared_ptrClient)
{
- uint8 tag[] = { 'M','S','T','C','L' };
+ uint8_t tag[] = { 'M','S','T','C','L' };
Buffer->Set(tag, sizeof(tag));
}
-bool CDmrmmdvmProtocol::EncodeDvHeaderPacket(const CDvHeaderPacket &Packet, uint8 seqid, CBuffer *Buffer) const
+bool CDmrmmdvmProtocol::EncodeDvHeaderPacket(const CDvHeaderPacket &Packet, uint8_t seqid, CBuffer *Buffer) const
{
- uint8 tag[] = { 'D','M','R','D' };
+ uint8_t tag[] = { 'D','M','R','D' };
Buffer->Set(tag, sizeof(tag));
// DMR header
// uiSeqId
- Buffer->Append((uint8)seqid);
+ Buffer->Append((uint8_t)seqid);
// uiSrcId
- uint32 uiSrcId = Packet.GetMyCallsign().GetDmrid();
+ uint32_t uiSrcId = Packet.GetMyCallsign().GetDmrid();
AppendDmrIdToBuffer(Buffer, uiSrcId);
// uiDstId = TG9
- uint32 uiDstId = 9; // ModuleToDmrDestId(Packet.GetRpt2Module());
+ uint32_t uiDstId = 9; // ModuleToDmrDestId(Packet.GetRpt2Module());
AppendDmrIdToBuffer(Buffer, uiDstId);
// uiRptrId
- uint32 uiRptrId = Packet.GetRpt1Callsign().GetDmrid();
+ uint32_t uiRptrId = Packet.GetRpt1Callsign().GetDmrid();
AppendDmrRptrIdToBuffer(Buffer, uiRptrId);
// uiBitField
- uint8 uiBitField =
+ uint8_t uiBitField =
(DMRMMDVM_FRAMETYPE_DATASYNC << 4) |
((DMRMMDVM_REFLECTOR_SLOT == DMR_SLOT2) ? 0x80 : 0x00) |
MMDVM_SLOTTYPE_HEADER;
- Buffer->Append((uint8)uiBitField);
+ Buffer->Append((uint8_t)uiBitField);
// uiStreamId
- uint32 uiStreamId = Packet.GetStreamId();
- Buffer->Append((uint32)uiStreamId);
+ uint32_t uiStreamId = Packet.GetStreamId();
+ Buffer->Append((uint32_t)uiStreamId);
// Payload
AppendVoiceLCToBuffer(Buffer, uiSrcId);
// BER
- Buffer->Append((uint8)0);
+ Buffer->Append((uint8_t)0);
// RSSI
- Buffer->Append((uint8)0);
+ Buffer->Append((uint8_t)0);
// done
return true;
@@ -872,25 +865,25 @@ bool CDmrmmdvmProtocol::EncodeDvHeaderPacket(const CDvHeaderPacket &Packet, uint
void CDmrmmdvmProtocol::EncodeDvPacket(
const CDvHeaderPacket &Header,
const CDvFramePacket &DvFrame0, const CDvFramePacket &DvFrame1, const CDvFramePacket &DvFrame2,
- uint8 seqid, CBuffer *Buffer) const
+ uint8_t seqid, CBuffer *Buffer) const
{
- uint8 tag[] = { 'D','M','R','D' };
+ uint8_t tag[] = { 'D','M','R','D' };
Buffer->Set(tag, sizeof(tag));
// DMR header
// uiSeqId
- Buffer->Append((uint8)seqid);
+ Buffer->Append((uint8_t)seqid);
// uiSrcId
- uint32 uiSrcId = Header.GetMyCallsign().GetDmrid();
+ uint32_t uiSrcId = Header.GetMyCallsign().GetDmrid();
AppendDmrIdToBuffer(Buffer, uiSrcId);
// uiDstId = TG9
- uint32 uiDstId = 9; // ModuleToDmrDestId(Header.GetRpt2Module());
+ uint32_t uiDstId = 9; // ModuleToDmrDestId(Header.GetRpt2Module());
AppendDmrIdToBuffer(Buffer, uiDstId);
// uiRptrId
- uint32 uiRptrId = Header.GetRpt1Callsign().GetDmrid();
+ uint32_t uiRptrId = Header.GetRpt1Callsign().GetDmrid();
AppendDmrRptrIdToBuffer(Buffer, uiRptrId);
// uiBitField
- uint8 uiBitField =
+ uint8_t uiBitField =
((DMRMMDVM_REFLECTOR_SLOT == DMR_SLOT2) ? 0x80 : 0x00);
if ( DvFrame0.GetDmrPacketId() == 0 )
{
@@ -901,21 +894,21 @@ void CDmrmmdvmProtocol::EncodeDvPacket(
uiBitField |= (DMRMMDVM_FRAMETYPE_VOICE << 4);
}
uiBitField |= (DvFrame0.GetDmrPacketId() & 0x0F);
- Buffer->Append((uint8)uiBitField);
+ Buffer->Append((uint8_t)uiBitField);
// uiStreamId
- uint32 uiStreamId = Header.GetStreamId();
- Buffer->Append((uint32)uiStreamId);
+ uint32_t uiStreamId = Header.GetStreamId();
+ Buffer->Append((uint32_t)uiStreamId);
// Payload
// frame0
Buffer->ReplaceAt(20, DvFrame0.GetAmbePlus(), 9);
// 1/2 frame1
Buffer->ReplaceAt(29, DvFrame1.GetAmbePlus(), 5);
- Buffer->ReplaceAt(33, (uint8)(Buffer->at(33) & 0xF0));
+ Buffer->ReplaceAt(33, (uint8_t)(Buffer->at(33) & 0xF0));
// 1/2 frame1
Buffer->ReplaceAt(39, DvFrame1.GetAmbePlus()+4, 5);
- Buffer->ReplaceAt(39, (uint8)(Buffer->at(39) & 0x0F));
+ Buffer->ReplaceAt(39, (uint8_t)(Buffer->at(39) & 0x0F));
// frame2
Buffer->ReplaceAt(44, DvFrame2.GetAmbePlus(), 9);
@@ -928,56 +921,56 @@ void CDmrmmdvmProtocol::EncodeDvPacket(
//dump.DebugDump(g_Reflector.m_DebugFile);
// BER
- Buffer->Append((uint8)0);
+ Buffer->Append((uint8_t)0);
// RSSI
- Buffer->Append((uint8)0);
+ Buffer->Append((uint8_t)0);
}
-void CDmrmmdvmProtocol::EncodeDvLastPacket(const CDvHeaderPacket &Packet, uint8 seqid, CBuffer *Buffer) const
+void CDmrmmdvmProtocol::EncodeDvLastPacket(const CDvHeaderPacket &Packet, uint8_t seqid, CBuffer *Buffer) const
{
- uint8 tag[] = { 'D','M','R','D' };
+ uint8_t tag[] = { 'D','M','R','D' };
Buffer->Set(tag, sizeof(tag));
// DMR header
// uiSeqId
- Buffer->Append((uint8)seqid);
+ Buffer->Append((uint8_t)seqid);
// uiSrcId
- uint32 uiSrcId = Packet.GetMyCallsign().GetDmrid();
+ uint32_t uiSrcId = Packet.GetMyCallsign().GetDmrid();
AppendDmrIdToBuffer(Buffer, uiSrcId);
// uiDstId
- uint32 uiDstId = 9; //ModuleToDmrDestId(Packet.GetRpt2Module());
+ uint32_t uiDstId = 9; //ModuleToDmrDestId(Packet.GetRpt2Module());
AppendDmrIdToBuffer(Buffer, uiDstId);
// uiRptrId
- uint32 uiRptrId = Packet.GetRpt1Callsign().GetDmrid();
+ uint32_t uiRptrId = Packet.GetRpt1Callsign().GetDmrid();
AppendDmrRptrIdToBuffer(Buffer, uiRptrId);
// uiBitField
- uint8 uiBitField =
+ uint8_t uiBitField =
(DMRMMDVM_FRAMETYPE_DATASYNC << 4) |
((DMRMMDVM_REFLECTOR_SLOT == DMR_SLOT2) ? 0x80 : 0x00) |
MMDVM_SLOTTYPE_TERMINATOR;
- Buffer->Append((uint8)uiBitField);
+ Buffer->Append((uint8_t)uiBitField);
// uiStreamId
- uint32 uiStreamId = Packet.GetStreamId();
- Buffer->Append((uint32)uiStreamId);
+ uint32_t uiStreamId = Packet.GetStreamId();
+ Buffer->Append((uint32_t)uiStreamId);
// Payload
AppendTerminatorLCToBuffer(Buffer, uiSrcId);
// BER
- Buffer->Append((uint8)0);
+ Buffer->Append((uint8_t)0);
// RSSI
- Buffer->Append((uint8)0);
+ Buffer->Append((uint8_t)0);
}
////////////////////////////////////////////////////////////////////////////////////////
// DestId to Module helper
-char CDmrmmdvmProtocol::DmrDstIdToModule(uint32 tg) const
+char CDmrmmdvmProtocol::DmrDstIdToModule(uint32_t tg) const
{
// is it a 4xxx ?
if ( (tg >= 4001) && (tg <= (4000 + NB_OF_MODULES)) )
@@ -987,33 +980,33 @@ char CDmrmmdvmProtocol::DmrDstIdToModule(uint32 tg) const
return ' ';
}
-uint32 CDmrmmdvmProtocol::ModuleToDmrDestId(char m) const
+uint32_t CDmrmmdvmProtocol::ModuleToDmrDestId(char m) const
{
- return (uint32)(m - 'A')+4001;
+ return (uint32_t)(m - 'A')+4001;
}
////////////////////////////////////////////////////////////////////////////////////////
// Buffer & LC helpers
-void CDmrmmdvmProtocol::AppendVoiceLCToBuffer(CBuffer *buffer, uint32 uiSrcId) const
+void CDmrmmdvmProtocol::AppendVoiceLCToBuffer(CBuffer *buffer, uint32_t uiSrcId) const
{
- uint8 payload[33];
+ uint8_t payload[33];
// fill payload
CBPTC19696 bptc;
::memset(payload, 0, sizeof(payload));
// LC data
- uint8 lc[12];
+ uint8_t lc[12];
{
::memset(lc, 0, sizeof(lc));
// uiDstId = TG9
lc[5] = 9;
// uiSrcId
- lc[6] = (uint8)LOBYTE(HIWORD(uiSrcId));
- lc[7] = (uint8)HIBYTE(LOWORD(uiSrcId));
- lc[8] = (uint8)LOBYTE(LOWORD(uiSrcId));
+ lc[6] = (uint8_t)LOBYTE(HIWORD(uiSrcId));
+ lc[7] = (uint8_t)HIBYTE(LOWORD(uiSrcId));
+ lc[8] = (uint8_t)LOBYTE(LOWORD(uiSrcId));
// parity
- uint8 parity[4];
+ uint8_t parity[4];
CRS129::encode(lc, 9, parity);
lc[9] = parity[2] ^ DMR_VOICE_LC_HEADER_CRC_MASK;
lc[10] = parity[1] ^ DMR_VOICE_LC_HEADER_CRC_MASK;
@@ -1024,7 +1017,7 @@ void CDmrmmdvmProtocol::AppendVoiceLCToBuffer(CBuffer *buffer, uint32 uiSrcId) c
// slot type
{
// slot type
- uint8 slottype[3];
+ uint8_t slottype[3];
::memset(slottype, 0, sizeof(slottype));
slottype[0] = (DMRMMDVM_REFLECTOR_COLOUR << 4) & 0xF0;
slottype[0] |= (DMR_DT_VOICE_LC_HEADER << 0) & 0x0FU;
@@ -1042,25 +1035,25 @@ void CDmrmmdvmProtocol::AppendVoiceLCToBuffer(CBuffer *buffer, uint32 uiSrcId) c
buffer->Append(payload, sizeof(payload));
}
-void CDmrmmdvmProtocol::AppendTerminatorLCToBuffer(CBuffer *buffer, uint32 uiSrcId) const
+void CDmrmmdvmProtocol::AppendTerminatorLCToBuffer(CBuffer *buffer, uint32_t uiSrcId) const
{
- uint8 payload[33];
+ uint8_t payload[33];
// fill payload
CBPTC19696 bptc;
::memset(payload, 0, sizeof(payload));
// LC data
- uint8 lc[12];
+ uint8_t lc[12];
{
::memset(lc, 0, sizeof(lc));
// uiDstId = TG9
lc[5] = 9;
// uiSrcId
- lc[6] = (uint8)LOBYTE(HIWORD(uiSrcId));
- lc[7] = (uint8)HIBYTE(LOWORD(uiSrcId));
- lc[8] = (uint8)LOBYTE(LOWORD(uiSrcId));
+ lc[6] = (uint8_t)LOBYTE(HIWORD(uiSrcId));
+ lc[7] = (uint8_t)HIBYTE(LOWORD(uiSrcId));
+ lc[8] = (uint8_t)LOBYTE(LOWORD(uiSrcId));
// parity
- uint8 parity[4];
+ uint8_t parity[4];
CRS129::encode(lc, 9, parity);
lc[9] = parity[2] ^ DMR_TERMINATOR_WITH_LC_CRC_MASK;
lc[10] = parity[1] ^ DMR_TERMINATOR_WITH_LC_CRC_MASK;
@@ -1071,7 +1064,7 @@ void CDmrmmdvmProtocol::AppendTerminatorLCToBuffer(CBuffer *buffer, uint32 uiSrc
// slot type
{
// slot type
- uint8 slottype[3];
+ uint8_t slottype[3];
::memset(slottype, 0, sizeof(slottype));
slottype[0] = (DMRMMDVM_REFLECTOR_COLOUR << 4) & 0xF0;
slottype[0] |= (DMR_DT_TERMINATOR_WITH_LC << 0) & 0x0FU;
@@ -1088,21 +1081,21 @@ void CDmrmmdvmProtocol::AppendTerminatorLCToBuffer(CBuffer *buffer, uint32 uiSrc
buffer->Append(payload, sizeof(payload));
}
-void CDmrmmdvmProtocol::ReplaceEMBInBuffer(CBuffer *buffer, uint8 uiDmrPacketId) const
+void CDmrmmdvmProtocol::ReplaceEMBInBuffer(CBuffer *buffer, uint8_t uiDmrPacketId) const
{
// voice packet A ?
if ( uiDmrPacketId == 0 )
{
// sync
- buffer->ReplaceAt(33, (uint8)(buffer->at(33) | (g_DmrSyncBSVoice[0] & 0x0F)));
+ buffer->ReplaceAt(33, (uint8_t)(buffer->at(33) | (g_DmrSyncBSVoice[0] & 0x0F)));
buffer->ReplaceAt(34, g_DmrSyncBSVoice+1, 5);
- buffer->ReplaceAt(39, (uint8)(buffer->at(39) | (g_DmrSyncBSVoice[6] & 0xF0)));
+ buffer->ReplaceAt(39, (uint8_t)(buffer->at(39) | (g_DmrSyncBSVoice[6] & 0xF0)));
}
// voice packet B,C,D,E ?
else if ( (uiDmrPacketId >= 1) && (uiDmrPacketId <= 4 ) )
{
// EMB LC
- uint8 emb[2];
+ uint8_t emb[2];
emb[0] = (DMRMMDVM_REFLECTOR_COLOUR << 4) & 0xF0;
//emb[0] |= PI ? 0x08U : 0x00;
//emb[0] |= (LCSS << 1) & 0x06;
@@ -1110,21 +1103,21 @@ void CDmrmmdvmProtocol::ReplaceEMBInBuffer(CBuffer *buffer, uint8 uiDmrPacketId)
// encode
CQR1676::encode(emb);
// and append
- buffer->ReplaceAt(33, (uint8)((buffer->at(33) & 0xF0) | ((emb[0U] >> 4) & 0x0F)));
- buffer->ReplaceAt(34, (uint8)((buffer->at(34) & 0x0F) | ((emb[0U] << 4) & 0xF0)));
- buffer->ReplaceAt(34, (uint8)(buffer->at(34) & 0xF0));
- buffer->ReplaceAt(35, (uint8)0);
- buffer->ReplaceAt(36, (uint8)0);
- buffer->ReplaceAt(37, (uint8)0);
- buffer->ReplaceAt(38, (uint8)(buffer->at(38) & 0x0F));
- buffer->ReplaceAt(38, (uint8)((buffer->at(38) & 0xF0) | ((emb[1U] >> 4) & 0x0F)));
- buffer->ReplaceAt(39, (uint8)((buffer->at(39) & 0x0F) | ((emb[1U] << 4) & 0xF0)));
+ buffer->ReplaceAt(33, (uint8_t)((buffer->at(33) & 0xF0) | ((emb[0U] >> 4) & 0x0F)));
+ buffer->ReplaceAt(34, (uint8_t)((buffer->at(34) & 0x0F) | ((emb[0U] << 4) & 0xF0)));
+ buffer->ReplaceAt(34, (uint8_t)(buffer->at(34) & 0xF0));
+ buffer->ReplaceAt(35, (uint8_t)0);
+ buffer->ReplaceAt(36, (uint8_t)0);
+ buffer->ReplaceAt(37, (uint8_t)0);
+ buffer->ReplaceAt(38, (uint8_t)(buffer->at(38) & 0x0F));
+ buffer->ReplaceAt(38, (uint8_t)((buffer->at(38) & 0xF0) | ((emb[1U] >> 4) & 0x0F)));
+ buffer->ReplaceAt(39, (uint8_t)((buffer->at(39) & 0x0F) | ((emb[1U] << 4) & 0xF0)));
}
// voice packet F
else
{
// nullptr
- uint8 emb[2];
+ uint8_t emb[2];
emb[0] = (DMRMMDVM_REFLECTOR_COLOUR << 4) & 0xF0;
//emb[0] |= PI ? 0x08U : 0x00;
//emb[0] |= (LCSS << 1) & 0x06;
@@ -1132,29 +1125,29 @@ void CDmrmmdvmProtocol::ReplaceEMBInBuffer(CBuffer *buffer, uint8 uiDmrPacketId)
// encode
CQR1676::encode(emb);
// and append
- buffer->ReplaceAt(33, (uint8)((buffer->at(33) & 0xF0) | ((emb[0U] >> 4) & 0x0F)));
- buffer->ReplaceAt(34, (uint8)((buffer->at(34) & 0x0F) | ((emb[0U] << 4) & 0xF0)));
- buffer->ReplaceAt(34, (uint8)(buffer->at(34) & 0xF0));
- buffer->ReplaceAt(35, (uint8)0);
- buffer->ReplaceAt(36, (uint8)0);
- buffer->ReplaceAt(37, (uint8)0);
- buffer->ReplaceAt(38, (uint8)(buffer->at(38) & 0x0F));
- buffer->ReplaceAt(38, (uint8)((buffer->at(38) & 0xF0) | ((emb[1U] >> 4) & 0x0F)));
- buffer->ReplaceAt(39, (uint8)((buffer->at(39) & 0x0F) | ((emb[1U] << 4) & 0xF0)));
+ buffer->ReplaceAt(33, (uint8_t)((buffer->at(33) & 0xF0) | ((emb[0U] >> 4) & 0x0F)));
+ buffer->ReplaceAt(34, (uint8_t)((buffer->at(34) & 0x0F) | ((emb[0U] << 4) & 0xF0)));
+ buffer->ReplaceAt(34, (uint8_t)(buffer->at(34) & 0xF0));
+ buffer->ReplaceAt(35, (uint8_t)0);
+ buffer->ReplaceAt(36, (uint8_t)0);
+ buffer->ReplaceAt(37, (uint8_t)0);
+ buffer->ReplaceAt(38, (uint8_t)(buffer->at(38) & 0x0F));
+ buffer->ReplaceAt(38, (uint8_t)((buffer->at(38) & 0xF0) | ((emb[1U] >> 4) & 0x0F)));
+ buffer->ReplaceAt(39, (uint8_t)((buffer->at(39) & 0x0F) | ((emb[1U] << 4) & 0xF0)));
}
}
-void CDmrmmdvmProtocol::AppendDmrIdToBuffer(CBuffer *buffer, uint32 id) const
+void CDmrmmdvmProtocol::AppendDmrIdToBuffer(CBuffer *buffer, uint32_t id) const
{
- buffer->Append((uint8)LOBYTE(HIWORD(id)));
- buffer->Append((uint8)HIBYTE(LOWORD(id)));
- buffer->Append((uint8)LOBYTE(LOWORD(id)));
+ buffer->Append((uint8_t)LOBYTE(HIWORD(id)));
+ buffer->Append((uint8_t)HIBYTE(LOWORD(id)));
+ buffer->Append((uint8_t)LOBYTE(LOWORD(id)));
}
-void CDmrmmdvmProtocol::AppendDmrRptrIdToBuffer(CBuffer *buffer, uint32 id) const
+void CDmrmmdvmProtocol::AppendDmrRptrIdToBuffer(CBuffer *buffer, uint32_t id) const
{
- buffer->Append((uint8)HIBYTE(HIWORD(id)));
- buffer->Append((uint8)LOBYTE(HIWORD(id)));
- buffer->Append((uint8)HIBYTE(LOWORD(id)));
- buffer->Append((uint8)LOBYTE(LOWORD(id)));
+ buffer->Append((uint8_t)HIBYTE(HIWORD(id)));
+ buffer->Append((uint8_t)LOBYTE(HIWORD(id)));
+ buffer->Append((uint8_t)HIBYTE(LOWORD(id)));
+ buffer->Append((uint8_t)LOBYTE(LOWORD(id)));
}
diff --git a/src/DMRMMDVMProtocol.h b/src/DMRMMDVMProtocol.h
index 3ddbd4e..3694350 100644
--- a/src/DMRMMDVMProtocol.h
+++ b/src/DMRMMDVMProtocol.h
@@ -1,30 +1,22 @@
-//
-// DMMMDVMProtocol.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 04/03/2017.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
-// Copyright © 2020 Thomas A. Early, N7TAE
-//
-// ----------------------------------------------------------------------------
-// This file is part of xlxd.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cdmrmmdvmprotocol_h
-#define cdmrmmdvmprotocol_h
+#pragma once
#include "Timer.h"
#include "DCSProtocol.h"
@@ -60,7 +52,7 @@ public:
CDvFramePacket m_dvFrame0;
CDvFramePacket m_dvFrame1;
- uint8 m_uiSeqId;
+ uint8_t m_uiSeqId;
};
@@ -68,7 +60,7 @@ class CDmrmmdvmProtocol : public CProtocol
{
public:
// initialization
- bool Initialize(const char *type, const int ptype, const uint16 port, const bool has_ipv4, const bool has_ipv6);
+ bool Initialize(const char *type, const int ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6);
// task
void Task(void);
@@ -81,7 +73,7 @@ protected:
void HandleKeepalives(void);
// stream helpers
- void OnDvHeaderPacketIn(std::unique_ptr &, const CIp &, uint8, uint8);
+ void OnDvHeaderPacketIn(std::unique_ptr &, const CIp &, uint8_t, uint8_t);
// packet decoding helpers
bool IsValidConnectPacket(const CBuffer &, CCallsign *, const CIp &);
@@ -91,30 +83,30 @@ protected:
bool IsValidOptionPacket(const CBuffer &, CCallsign *);
bool IsValidKeepAlivePacket(const CBuffer &, CCallsign *);
bool IsValidRssiPacket(const CBuffer &, CCallsign *, int *);
- bool IsValidDvHeaderPacket(const CBuffer &, std::unique_ptr &, uint8 *, uint8 *);
+ bool IsValidDvHeaderPacket(const CBuffer &, std::unique_ptr &, uint8_t *, uint8_t *);
bool IsValidDvFramePacket(const CBuffer &, std::array, 3> &);
bool IsValidDvLastFramePacket(const CBuffer &, std::unique_ptr &);
// packet encoding helpers
void EncodeKeepAlivePacket(CBuffer *, std::shared_ptr);
void EncodeAckPacket(CBuffer *, const CCallsign &);
- void EncodeConnectAckPacket(CBuffer *, const CCallsign &, uint32);
+ void EncodeConnectAckPacket(CBuffer *, const CCallsign &, uint32_t);
void EncodeNackPacket(CBuffer *, const CCallsign &);
void EncodeClosePacket(CBuffer *, std::shared_ptr);
- bool EncodeDvHeaderPacket(const CDvHeaderPacket &, uint8, CBuffer *) const;
- void EncodeDvPacket(const CDvHeaderPacket &, const CDvFramePacket &, const CDvFramePacket &, const CDvFramePacket &, uint8, CBuffer *) const;
- void EncodeDvLastPacket(const CDvHeaderPacket &, uint8, CBuffer *) const;
+ bool EncodeDvHeaderPacket(const CDvHeaderPacket &, uint8_t, CBuffer *) const;
+ void EncodeDvPacket(const CDvHeaderPacket &, const CDvFramePacket &, const CDvFramePacket &, const CDvFramePacket &, uint8_t, CBuffer *) const;
+ void EncodeDvLastPacket(const CDvHeaderPacket &, uint8_t, CBuffer *) const;
// dmr DstId to Module helper
- char DmrDstIdToModule(uint32) const;
- uint32 ModuleToDmrDestId(char) const;
+ char DmrDstIdToModule(uint32_t) const;
+ uint32_t ModuleToDmrDestId(char) const;
// Buffer & LC helpers
- void AppendVoiceLCToBuffer(CBuffer *, uint32) const;
- void AppendTerminatorLCToBuffer(CBuffer *, uint32) const;
- void ReplaceEMBInBuffer(CBuffer *, uint8) const;
- void AppendDmrIdToBuffer(CBuffer *, uint32) const;
- void AppendDmrRptrIdToBuffer(CBuffer *, uint32) const;
+ void AppendVoiceLCToBuffer(CBuffer *, uint32_t) const;
+ void AppendTerminatorLCToBuffer(CBuffer *, uint32_t) const;
+ void ReplaceEMBInBuffer(CBuffer *, uint8_t) const;
+ void AppendDmrIdToBuffer(CBuffer *, uint32_t) const;
+ void AppendDmrRptrIdToBuffer(CBuffer *, uint32_t) const;
protected:
@@ -122,15 +114,11 @@ protected:
CTimePoint m_LastKeepaliveTime;
// for stream id
- uint16 m_uiStreamId;
+ uint16_t m_uiStreamId;
// for queue header caches
std::array m_StreamsCache;
// for authentication
- uint32 m_uiAuthSeed;
+ uint32_t m_uiAuthSeed;
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-
-#endif /* cdmrmmdvmprotocol_h */
diff --git a/src/DMRPlusClient.cpp b/src/DMRPlusClient.cpp
index 9c791b2..723da83 100644
--- a/src/DMRPlusClient.cpp
+++ b/src/DMRPlusClient.cpp
@@ -1,29 +1,23 @@
-//
-// cdmrplusclient.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL on 10/01/2016.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
-#include "cdmrplusclient.h"
+#include "DMRPlusClient.h"
////////////////////////////////////////////////////////////////////////////////////////
@@ -48,5 +42,5 @@ CDmrplusClient::CDmrplusClient(const CDmrplusClient &client)
bool CDmrplusClient::IsAlive(void) const
{
- return (m_LastKeepaliveTime.DurationSinceNow() < DMRPLUS_KEEPALIVE_TIMEOUT);
+ return (m_LastKeepaliveTime.time() < DMRPLUS_KEEPALIVE_TIMEOUT);
}
diff --git a/src/DMRPlusClient.h b/src/DMRPlusClient.h
index c032140..f7992ed 100644
--- a/src/DMRPlusClient.h
+++ b/src/DMRPlusClient.h
@@ -1,39 +1,25 @@
-//
-// cdmrplusclient.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 10/01/2016.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cdmrplusclient_h
-#define cdmrplusclient_h
+#pragma once
#include "Client.h"
-////////////////////////////////////////////////////////////////////////////////////////
-// define
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-// class
-
class CDmrplusClient : public CClient
{
public:
@@ -54,6 +40,3 @@ public:
// status
bool IsAlive(void) const;
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cdmrplusclient_h */
diff --git a/src/DMRPlusProtocol.cpp b/src/DMRPlusProtocol.cpp
index f2e2910..18e9fd3 100644
--- a/src/DMRPlusProtocol.cpp
+++ b/src/DMRPlusProtocol.cpp
@@ -1,36 +1,29 @@
-//
-// cdmrplusprotocol.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 10/01/2016.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
-// Copyright © 2020 Thomas A. Early, N7TAE
-//
-// ----------------------------------------------------------------------------
-// This file is part of xlxd.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
#include
-#include "cdmrplusclient.h"
+#include "DMRPlusClient.h"
#include "DMRPlusProtocol.h"
#include "Reflector.h"
#include "GateKeeper.h"
#include "DMRIdDir.h"
-#include "CBPT19696.h"
+#include "CBPTC19696.h"
#include "RS129.h"
#include "Golay2087.h"
#include "QR1676.h"
@@ -38,16 +31,16 @@
////////////////////////////////////////////////////////////////////////////////////////
// constants
-static uint8 g_DmrSyncBSVoice[] = { 0x07,0x55,0xFD,0x7D,0xF7,0x5F,0x70 };
-static uint8 g_DmrSyncBSData[] = { 0x0D,0xFF,0x57,0xD7,0x5D,0xF5,0xD0 };
-static uint8 g_DmrSyncMSVoice[] = { 0x07,0xF7,0xD5,0xDD,0x57,0xDF,0xD0 };
-static uint8 g_DmrSyncMSData[] = { 0x0D,0x5D,0x7F,0x77,0xFD,0x75,0x70 };
+static uint8_t g_DmrSyncBSVoice[] = { 0x07,0x55,0xFD,0x7D,0xF7,0x5F,0x70 };
+static uint8_t g_DmrSyncBSData[] = { 0x0D,0xFF,0x57,0xD7,0x5D,0xF5,0xD0 };
+static uint8_t g_DmrSyncMSVoice[] = { 0x07,0xF7,0xD5,0xDD,0x57,0xDF,0xD0 };
+static uint8_t g_DmrSyncMSData[] = { 0x0D,0x5D,0x7F,0x77,0xFD,0x75,0x70 };
////////////////////////////////////////////////////////////////////////////////////////
// operation
-bool CDmrplusProtocol::Initialize(const char *type, const int ptype, const uint16 port, const bool has_ipv4, const bool has_ipv6)
+bool CDmrplusProtocol::Initialize(const char *type, const int 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))
@@ -303,7 +296,7 @@ void CDmrplusProtocol::HandleQueue(void)
m_Queue.Unlock();
}
-void CDmrplusProtocol::SendBufferToClients(const CBuffer &buffer, uint8 module)
+void CDmrplusProtocol::SendBufferToClients(const CBuffer &buffer, uint8_t module)
{
if ( buffer.size() > 0 )
{
@@ -377,7 +370,7 @@ bool CDmrplusProtocol::IsValidConnectPacket(const CBuffer &Buffer, CCallsign *ca
char sz[9];
::memcpy(sz, Buffer.data(), 8);
sz[8] = 0;
- uint32 dmrid = atoi(sz);
+ uint32_t dmrid = atoi(sz);
callsign->SetDmrid(dmrid, true);
callsign->SetModule(DMRPLUS_MODULE_ID);
::memcpy(sz, &Buffer.data()[8], 4);
@@ -400,7 +393,7 @@ bool CDmrplusProtocol::IsValidDisconnectPacket(const CBuffer &Buffer, CCallsign
char sz[9];
::memcpy(sz, Buffer.data(), 8);
sz[8] = 0;
- uint32 dmrid = atoi(sz);
+ uint32_t dmrid = atoi(sz);
callsign->SetDmrid(dmrid, true);
callsign->SetModule(DMRPLUS_MODULE_ID);
*reflectormodule = Buffer.data()[11] - '0' + 'A';
@@ -411,20 +404,20 @@ bool CDmrplusProtocol::IsValidDisconnectPacket(const CBuffer &Buffer, CCallsign
bool CDmrplusProtocol::IsValidDvHeaderPacket(const CIp &Ip, const CBuffer &Buffer, std::unique_ptr &Header)
{
- uint8 uiPacketType = Buffer.data()[8];
+ uint8_t uiPacketType = Buffer.data()[8];
if ( (Buffer.size() == 72) && ( uiPacketType == 2 ) )
{
// frame details
- uint8 uiSlot = (Buffer.data()[16] == 0x22) ? DMR_SLOT2 : DMR_SLOT1;
- uint8 uiCallType = (Buffer.data()[62] == 1) ? DMR_GROUP_CALL : DMR_PRIVATE_CALL;
- uint8 uiColourCode = Buffer.data()[20] & 0x0F;
+ uint8_t uiSlot = (Buffer.data()[16] == 0x22) ? DMR_SLOT2 : DMR_SLOT1;
+ uint8_t uiCallType = (Buffer.data()[62] == 1) ? DMR_GROUP_CALL : DMR_PRIVATE_CALL;
+ uint8_t uiColourCode = Buffer.data()[20] & 0x0F;
if ( (uiSlot == DMRPLUS_REFLECTOR_SLOT) && (uiCallType == DMR_GROUP_CALL) && (uiColourCode == DMRPLUS_REFLECTOR_COLOUR) )
{
// more frames details
- //uint8 uiSeqId = Buffer.data()[4];
- //uint8 uiVoiceSeq = (Buffer.data()[18] & 0x0F) - 7; // aka slot type
- uint32 uiDstId = *(uint32 *)(&Buffer.data()[64]) & 0x00FFFFFF;
- uint32 uiSrcId = *(uint32 *)(&Buffer.data()[68]) & 0x00FFFFFF;
+ //uint8_t uiSeqId = Buffer.data()[4];
+ //uint8_t uiVoiceSeq = (Buffer.data()[18] & 0x0F) - 7; // aka slot type
+ uint32_t uiDstId = *(uint32_t *)(&Buffer.data()[64]) & 0x00FFFFFF;
+ uint32_t uiSrcId = *(uint32_t *)(&Buffer.data()[68]) & 0x00FFFFFF;
// build DVHeader
CCallsign csMY = CCallsign("", uiSrcId);
@@ -432,7 +425,7 @@ bool CDmrplusProtocol::IsValidDvHeaderPacket(const CIp &Ip, const CBuffer &Buffe
rpt1.SetModule(DMRPLUS_MODULE_ID);
CCallsign rpt2 = m_ReflectorCallsign;
rpt2.SetModule(DmrDstIdToModule(uiDstId));
- uint32 uiStreamId = IpToStreamId(Ip);
+ uint32_t uiStreamId = IpToStreamId(Ip);
// and packet
Header = std::unique_ptr(new CDvHeaderPacket(uiSrcId, CCallsign("CQCQCQ"), rpt1, rpt2, uiStreamId, 0, 0));
@@ -445,26 +438,26 @@ bool CDmrplusProtocol::IsValidDvHeaderPacket(const CIp &Ip, const CBuffer &Buffe
bool CDmrplusProtocol::IsValidDvFramePacket(const CIp &Ip, const CBuffer &Buffer, std::array, 3> &frames)
{
- uint8 uiPacketType = Buffer.data()[8];
+ uint8_t uiPacketType = Buffer.data()[8];
if ( (Buffer.size() == 72) && ((uiPacketType == 1) || (uiPacketType == 3)) )
{
// frame details
- uint8 uiSlot = (Buffer.data()[16] == 0x22) ? DMR_SLOT2 : DMR_SLOT1;
- uint8 uiCallType = (Buffer.data()[62] == 1) ? DMR_GROUP_CALL : DMR_PRIVATE_CALL;
- uint8 uiColourCode = Buffer.data()[20] & 0x0F;
+ uint8_t uiSlot = (Buffer.data()[16] == 0x22) ? DMR_SLOT2 : DMR_SLOT1;
+ uint8_t uiCallType = (Buffer.data()[62] == 1) ? DMR_GROUP_CALL : DMR_PRIVATE_CALL;
+ uint8_t uiColourCode = Buffer.data()[20] & 0x0F;
if ( (uiSlot == DMRPLUS_REFLECTOR_SLOT) && (uiCallType == DMR_GROUP_CALL) && (uiColourCode == DMRPLUS_REFLECTOR_COLOUR) )
{
// more frames details
- //uint8 uiSeqId = Buffer.data()[4];
- uint8 uiVoiceSeq = (Buffer.data()[18] & 0x0F) - 7; // aka slot type
- //uint32 uiDstId = *(uint32 *)(&Buffer.data()[64]) & 0x00FFFFFF;
- //uint32 uiSrcId = *(uint32 *)(&Buffer.data()[68]) & 0x00FFFFFF;
+ //uint8_t uiSeqId = Buffer.data()[4];
+ uint8_t uiVoiceSeq = (Buffer.data()[18] & 0x0F) - 7; // aka slot type
+ //uint32_t uiDstId = *(uint32_t *)(&Buffer.data()[64]) & 0x00FFFFFF;
+ //uint32_t uiSrcId = *(uint32_t *)(&Buffer.data()[68]) & 0x00FFFFFF;
// crack payload
- uint8 dmrframe[33];
- uint8 dmr3ambe[27];
- uint8 dmrambe[9];
- uint8 dmrsync[7];
+ uint8_t dmrframe[33];
+ uint8_t dmr3ambe[27];
+ uint8_t dmrambe[9];
+ uint8_t dmrsync[7];
// get the 33 bytes ambe
memcpy(dmrframe, &(Buffer.data()[26]), 33);
// handle endianess
@@ -480,7 +473,7 @@ bool CDmrplusProtocol::IsValidDvFramePacket(const CIp &Ip, const CBuffer &Buffer
dmrsync[6] = dmrframe[19] & 0xF0;
// and create 3 dv frames
- uint32 uiStreamId = IpToStreamId(Ip);
+ uint32_t uiStreamId = IpToStreamId(Ip);
// frame1
memcpy(dmrambe, &dmr3ambe[0], 9);
frames[0] = std::unique_ptr(new CDvFramePacket(dmrambe, dmrsync, uiStreamId, uiVoiceSeq, 1));
@@ -514,19 +507,19 @@ bool CDmrplusProtocol::IsValidDvFramePacket(const CIp &Ip, const CBuffer &Buffer
void CDmrplusProtocol::EncodeConnectAckPacket(CBuffer *Buffer)
{
- uint8 tag[] = { 'A','C','K',' ','O','K',0x0A,0x00 };
+ uint8_t tag[] = { 'A','C','K',' ','O','K',0x0A,0x00 };
Buffer->Set(tag, sizeof(tag));
}
void CDmrplusProtocol::EncodeConnectNackPacket(CBuffer *Buffer)
{
- uint8 tag[] = { 'N','A','K',' ','O','K',0x0A,0x00 };
+ uint8_t tag[] = { 'N','A','K',' ','O','K',0x0A,0x00 };
Buffer->Set(tag, sizeof(tag));
}
bool CDmrplusProtocol::EncodeDvHeaderPacket(const CDvHeaderPacket &Packet, CBuffer *Buffer) const
{
- uint8 tag[] = { 0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x02,
+ uint8_t tag[] = { 0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x02,
0x00,0x05,0x01,0x02,0x00,0x00,0x00
} ;
Buffer->Set(tag, sizeof(tag));
@@ -536,32 +529,32 @@ bool CDmrplusProtocol::EncodeDvHeaderPacket(const CDvHeaderPacket &Packet, CBuff
// uiPktType
//Buffer->ReplaceAt(8, 2);
// uiSlot
- Buffer->Append((uint16)((DMRPLUS_REFLECTOR_SLOT == DMR_SLOT1) ? 0x1111 : 0x2222));
+ Buffer->Append((uint16_t)((DMRPLUS_REFLECTOR_SLOT == DMR_SLOT1) ? 0x1111 : 0x2222));
// uiSlotType
- Buffer->Append((uint16)0xEEEE);
+ Buffer->Append((uint16_t)0xEEEE);
// uiColourCode
- uint8 uiColourCode = DMRPLUS_REFLECTOR_COLOUR | (DMRPLUS_REFLECTOR_COLOUR << 4);
- Buffer->Append((uint8)uiColourCode);
- Buffer->Append((uint8)uiColourCode);
+ uint8_t uiColourCode = DMRPLUS_REFLECTOR_COLOUR | (DMRPLUS_REFLECTOR_COLOUR << 4);
+ Buffer->Append((uint8_t)uiColourCode);
+ Buffer->Append((uint8_t)uiColourCode);
// uiFrameType
- Buffer->Append((uint16)0x1111);
+ Buffer->Append((uint16_t)0x1111);
// reserved
- Buffer->Append((uint16)0x0000);
+ Buffer->Append((uint16_t)0x0000);
// payload
- uint32 uiSrcId = Packet.GetMyCallsign().GetDmrid() & 0x00FFFFFF;
- uint32 uiDstId = ModuleToDmrDestId(Packet.GetRpt2Module()) & 0x00FFFFFF;
- Buffer->Append((uint8)0x00, 34);
+ uint32_t uiSrcId = Packet.GetMyCallsign().GetDmrid() & 0x00FFFFFF;
+ uint32_t uiDstId = ModuleToDmrDestId(Packet.GetRpt2Module()) & 0x00FFFFFF;
+ Buffer->Append((uint8_t)0x00, 34);
Buffer->ReplaceAt(36, HIBYTE(HIWORD(uiSrcId)));
Buffer->ReplaceAt(38, LOBYTE(HIWORD(uiSrcId)));
Buffer->ReplaceAt(40, HIBYTE(LOWORD(uiSrcId)));
Buffer->ReplaceAt(42, LOBYTE(LOWORD(uiSrcId)));
// reserved
- Buffer->Append((uint16)0x0000);
+ Buffer->Append((uint16_t)0x0000);
// uiCallType
- Buffer->Append((uint8)0x01);
+ Buffer->Append((uint8_t)0x01);
// reserved
- Buffer->Append((uint8)0x00);
+ Buffer->Append((uint8_t)0x00);
// uiDstId
Buffer->Append(uiDstId);
// uiSrcId
@@ -574,10 +567,10 @@ bool CDmrplusProtocol::EncodeDvHeaderPacket(const CDvHeaderPacket &Packet, CBuff
void CDmrplusProtocol::EncodeDvPacket
(const CDvHeaderPacket &Header,
const CDvFramePacket &DvFrame0, const CDvFramePacket &DvFrame1, const CDvFramePacket &DvFrame2,
- uint8 seqid, CBuffer *Buffer) const
+ uint8_t seqid, CBuffer *Buffer) const
{
- uint8 tag[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
+ uint8_t tag[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
0x00,0x05,0x01,0x02,0x00,0x00,0x00
} ;
Buffer->Set(tag, sizeof(tag));
@@ -587,31 +580,31 @@ void CDmrplusProtocol::EncodeDvPacket
// uiPktType
//Buffer->ReplaceAt(8, 1);
// uiSlot
- Buffer->Append((uint16)((DMRPLUS_REFLECTOR_SLOT == DMR_SLOT1) ? 0x1111 : 0x2222));
+ Buffer->Append((uint16_t)((DMRPLUS_REFLECTOR_SLOT == DMR_SLOT1) ? 0x1111 : 0x2222));
// uiVoiceSeq
- uint8 uiVoiceSeq = (DvFrame0.GetDmrPacketId() + 7) | ((DvFrame0.GetDmrPacketId() + 7) << 4);
- Buffer->Append((uint8)uiVoiceSeq);
- Buffer->Append((uint8)uiVoiceSeq);
+ uint8_t uiVoiceSeq = (DvFrame0.GetDmrPacketId() + 7) | ((DvFrame0.GetDmrPacketId() + 7) << 4);
+ Buffer->Append((uint8_t)uiVoiceSeq);
+ Buffer->Append((uint8_t)uiVoiceSeq);
// uiColourCode
- uint8 uiColourCode = DMRPLUS_REFLECTOR_COLOUR | (DMRPLUS_REFLECTOR_COLOUR << 4);
- Buffer->Append((uint8)uiColourCode);
- Buffer->Append((uint8)uiColourCode);
+ uint8_t uiColourCode = DMRPLUS_REFLECTOR_COLOUR | (DMRPLUS_REFLECTOR_COLOUR << 4);
+ Buffer->Append((uint8_t)uiColourCode);
+ Buffer->Append((uint8_t)uiColourCode);
// uiFrameType
- Buffer->Append((uint16)0x1111);
+ Buffer->Append((uint16_t)0x1111);
// reserved
- Buffer->Append((uint16)0x0000);
+ Buffer->Append((uint16_t)0x0000);
// payload
- uint32 uiSrcId = Header.GetMyCallsign().GetDmrid() & 0x00FFFFFF;
- uint32 uiDstId = ModuleToDmrDestId(Header.GetRpt2Module()) & 0x00FFFFFF;
+ uint32_t uiSrcId = Header.GetMyCallsign().GetDmrid() & 0x00FFFFFF;
+ uint32_t uiDstId = ModuleToDmrDestId(Header.GetRpt2Module()) & 0x00FFFFFF;
// frame0
Buffer->ReplaceAt(26, DvFrame0.GetAmbePlus(), 9);
// 1/2 frame1
Buffer->ReplaceAt(35, DvFrame1.GetAmbePlus(), 5);
- Buffer->ReplaceAt(39, (uint8)(Buffer->at(39) & 0xF0));
+ Buffer->ReplaceAt(39, (uint8_t)(Buffer->at(39) & 0xF0));
// 1/2 frame1
Buffer->ReplaceAt(45, DvFrame1.GetAmbePlus()+4, 5);
- Buffer->ReplaceAt(45, (uint8)(Buffer->at(45) & 0x0F));
+ Buffer->ReplaceAt(45, (uint8_t)(Buffer->at(45) & 0x0F));
// frame2
Buffer->ReplaceAt(50, DvFrame2.GetAmbePlus(), 9);
@@ -619,12 +612,12 @@ void CDmrplusProtocol::EncodeDvPacket
ReplaceEMBInBuffer(Buffer, DvFrame0.GetDmrPacketId());
// reserved
- Buffer->Append((uint16)0x0000);
- Buffer->Append((uint8)0x00);
+ Buffer->Append((uint16_t)0x0000);
+ Buffer->Append((uint8_t)0x00);
// uiCallType
- Buffer->Append((uint8)0x01);
+ Buffer->Append((uint8_t)0x01);
// reserved
- Buffer->Append((uint8)0x00);
+ Buffer->Append((uint8_t)0x00);
// uiDstId
Buffer->Append(uiDstId);
// uiSrcId
@@ -634,11 +627,11 @@ void CDmrplusProtocol::EncodeDvPacket
SwapEndianess(&(Buffer->data()[26]), 34);
}
-void CDmrplusProtocol::SwapEndianess(uint8 *buffer, int len) const
+void CDmrplusProtocol::SwapEndianess(uint8_t *buffer, int len) const
{
for ( int i = 0; i < len; i += 2 )
{
- uint8 t = buffer[i];
+ uint8_t t = buffer[i];
buffer[i] = buffer[i+1];
buffer[i+1] = t;
}
@@ -648,7 +641,7 @@ void CDmrplusProtocol::SwapEndianess(uint8 *buffer, int len) const
////////////////////////////////////////////////////////////////////////////////////////
// SeqId helper
-uint8 CDmrplusProtocol::GetNextSeqId(uint8 uiSeqId) const
+uint8_t CDmrplusProtocol::GetNextSeqId(uint8_t uiSeqId) const
{
return (uiSeqId + 1) & 0xFF;
}
@@ -656,7 +649,7 @@ uint8 CDmrplusProtocol::GetNextSeqId(uint8 uiSeqId) const
////////////////////////////////////////////////////////////////////////////////////////
// DestId to Module helper
-char CDmrplusProtocol::DmrDstIdToModule(uint32 tg) const
+char CDmrplusProtocol::DmrDstIdToModule(uint32_t tg) const
{
// is it a 4xxx ?
if ( (tg >= 4001) && (tg <= (4000 + NB_OF_MODULES)) )
@@ -666,33 +659,33 @@ char CDmrplusProtocol::DmrDstIdToModule(uint32 tg) const
return ' ';
}
-uint32 CDmrplusProtocol::ModuleToDmrDestId(char m) const
+uint32_t CDmrplusProtocol::ModuleToDmrDestId(char m) const
{
- return (uint32)(m - 'A')+4001;
+ return (uint32_t)(m - 'A')+4001;
}
////////////////////////////////////////////////////////////////////////////////////////
// Buffer & LC helpers
-void CDmrplusProtocol::AppendVoiceLCToBuffer(CBuffer *buffer, uint32 uiSrcId) const
+void CDmrplusProtocol::AppendVoiceLCToBuffer(CBuffer *buffer, uint32_t uiSrcId) const
{
- uint8 payload[34];
+ uint8_t payload[34];
// fill payload
CBPTC19696 bptc;
::memset(payload, 0, sizeof(payload));
// LC data
- uint8 lc[12];
+ uint8_t lc[12];
{
::memset(lc, 0, sizeof(lc));
// uiDstId = TG9
lc[5] = 9;
// uiSrcId
- lc[6] = (uint8)LOBYTE(HIWORD(uiSrcId));
- lc[7] = (uint8)HIBYTE(LOWORD(uiSrcId));
- lc[8] = (uint8)LOBYTE(LOWORD(uiSrcId));
+ lc[6] = (uint8_t)LOBYTE(HIWORD(uiSrcId));
+ lc[7] = (uint8_t)HIBYTE(LOWORD(uiSrcId));
+ lc[8] = (uint8_t)LOBYTE(LOWORD(uiSrcId));
// parity
- uint8 parity[4];
+ uint8_t parity[4];
CRS129::encode(lc, 9, parity);
lc[9] = parity[2] ^ DMR_VOICE_LC_HEADER_CRC_MASK;
lc[10] = parity[1] ^ DMR_VOICE_LC_HEADER_CRC_MASK;
@@ -703,7 +696,7 @@ void CDmrplusProtocol::AppendVoiceLCToBuffer(CBuffer *buffer, uint32 uiSrcId) co
// slot type
{
// slot type
- uint8 slottype[3];
+ uint8_t slottype[3];
::memset(slottype, 0, sizeof(slottype));
slottype[0] = (DMRPLUS_REFLECTOR_COLOUR << 4) & 0xF0;
slottype[0] |= (DMR_DT_VOICE_LC_HEADER << 0) & 0x0FU;
@@ -721,21 +714,21 @@ void CDmrplusProtocol::AppendVoiceLCToBuffer(CBuffer *buffer, uint32 uiSrcId) co
buffer->Append(payload, sizeof(payload));
}
-void CDmrplusProtocol::ReplaceEMBInBuffer(CBuffer *buffer, uint8 uiDmrPacketId) const
+void CDmrplusProtocol::ReplaceEMBInBuffer(CBuffer *buffer, uint8_t uiDmrPacketId) const
{
// voice packet A ?
if ( uiDmrPacketId == 0 )
{
// sync
- buffer->ReplaceAt(39, (uint8)(buffer->at(39) | (g_DmrSyncBSVoice[0] & 0x0F)));
+ buffer->ReplaceAt(39, (uint8_t)(buffer->at(39) | (g_DmrSyncBSVoice[0] & 0x0F)));
buffer->ReplaceAt(40, g_DmrSyncBSVoice+1, 5);
- buffer->ReplaceAt(45, (uint8)(buffer->at(45) | (g_DmrSyncBSVoice[6] & 0xF0)));
+ buffer->ReplaceAt(45, (uint8_t)(buffer->at(45) | (g_DmrSyncBSVoice[6] & 0xF0)));
}
// voice packet B,C,D,E ?
else if ( (uiDmrPacketId >= 1) && (uiDmrPacketId <= 4 ) )
{
// EMB LC
- uint8 emb[2];
+ uint8_t emb[2];
emb[0] = (DMRMMDVM_REFLECTOR_COLOUR << 4) & 0xF0;
//emb[0] |= PI ? 0x08U : 0x00;
//emb[0] |= (LCSS << 1) & 0x06;
@@ -743,21 +736,21 @@ void CDmrplusProtocol::ReplaceEMBInBuffer(CBuffer *buffer, uint8 uiDmrPacketId)
// encode
CQR1676::encode(emb);
// and append
- buffer->ReplaceAt(39, (uint8)((buffer->at(39) & 0xF0) | ((emb[0U] >> 4) & 0x0F)));
- buffer->ReplaceAt(40, (uint8)((buffer->at(40) & 0x0F) | ((emb[0U] << 4) & 0xF0)));
- buffer->ReplaceAt(40, (uint8)(buffer->at(40) & 0xF0));
- buffer->ReplaceAt(41, (uint8)0);
- buffer->ReplaceAt(42, (uint8)0);
- buffer->ReplaceAt(43, (uint8)0);
- buffer->ReplaceAt(44, (uint8)(buffer->at(44) & 0x0F));
- buffer->ReplaceAt(44, (uint8)((buffer->at(44) & 0xF0) | ((emb[1U] >> 4) & 0x0F)));
- buffer->ReplaceAt(45, (uint8)((buffer->at(45) & 0x0F) | ((emb[1U] << 4) & 0xF0)));
+ buffer->ReplaceAt(39, (uint8_t)((buffer->at(39) & 0xF0) | ((emb[0U] >> 4) & 0x0F)));
+ buffer->ReplaceAt(40, (uint8_t)((buffer->at(40) & 0x0F) | ((emb[0U] << 4) & 0xF0)));
+ buffer->ReplaceAt(40, (uint8_t)(buffer->at(40) & 0xF0));
+ buffer->ReplaceAt(41, (uint8_t)0);
+ buffer->ReplaceAt(42, (uint8_t)0);
+ buffer->ReplaceAt(43, (uint8_t)0);
+ buffer->ReplaceAt(44, (uint8_t)(buffer->at(44) & 0x0F));
+ buffer->ReplaceAt(44, (uint8_t)((buffer->at(44) & 0xF0) | ((emb[1U] >> 4) & 0x0F)));
+ buffer->ReplaceAt(45, (uint8_t)((buffer->at(45) & 0x0F) | ((emb[1U] << 4) & 0xF0)));
}
// voice packet F
else
{
// nullptr
- uint8 emb[2];
+ uint8_t emb[2];
emb[0] = (DMRMMDVM_REFLECTOR_COLOUR << 4) & 0xF0;
//emb[0] |= PI ? 0x08U : 0x00;
//emb[0] |= (LCSS << 1) & 0x06;
@@ -765,15 +758,15 @@ void CDmrplusProtocol::ReplaceEMBInBuffer(CBuffer *buffer, uint8 uiDmrPacketId)
// encode
CQR1676::encode(emb);
// and append
- buffer->ReplaceAt(39, (uint8)((buffer->at(39) & 0xF0) | ((emb[0U] >> 4) & 0x0F)));
- buffer->ReplaceAt(40, (uint8)((buffer->at(40) & 0x0F) | ((emb[0U] << 4) & 0xF0)));
- buffer->ReplaceAt(40, (uint8)(buffer->at(40) & 0xF0));
- buffer->ReplaceAt(41, (uint8)0);
- buffer->ReplaceAt(42, (uint8)0);
- buffer->ReplaceAt(43, (uint8)0);
- buffer->ReplaceAt(44, (uint8)(buffer->at(44) & 0x0F));
- buffer->ReplaceAt(44, (uint8)((buffer->at(44) & 0xF0) | ((emb[1U] >> 4) & 0x0F)));
- buffer->ReplaceAt(45, (uint8)((buffer->at(45) & 0x0F) | ((emb[1U] << 4) & 0xF0)));
+ buffer->ReplaceAt(39, (uint8_t)((buffer->at(39) & 0xF0) | ((emb[0U] >> 4) & 0x0F)));
+ buffer->ReplaceAt(40, (uint8_t)((buffer->at(40) & 0x0F) | ((emb[0U] << 4) & 0xF0)));
+ buffer->ReplaceAt(40, (uint8_t)(buffer->at(40) & 0xF0));
+ buffer->ReplaceAt(41, (uint8_t)0);
+ buffer->ReplaceAt(42, (uint8_t)0);
+ buffer->ReplaceAt(43, (uint8_t)0);
+ buffer->ReplaceAt(44, (uint8_t)(buffer->at(44) & 0x0F));
+ buffer->ReplaceAt(44, (uint8_t)((buffer->at(44) & 0xF0) | ((emb[1U] >> 4) & 0x0F)));
+ buffer->ReplaceAt(45, (uint8_t)((buffer->at(45) & 0x0F) | ((emb[1U] << 4) & 0xF0)));
}
}
@@ -782,7 +775,7 @@ void CDmrplusProtocol::ReplaceEMBInBuffer(CBuffer *buffer, uint8 uiDmrPacketId)
// uiStreamId helpers
-uint32 CDmrplusProtocol::IpToStreamId(const CIp &ip) const
+uint32_t CDmrplusProtocol::IpToStreamId(const CIp &ip) const
{
- return ip.GetAddr() ^ (uint32)(MAKEDWORD(ip.GetPort(), ip.GetPort()));
+ return ip.GetAddr() ^ (uint32_t)(MAKEDWORD(ip.GetPort(), ip.GetPort()));
}
diff --git a/src/DMRPlusProtocol.h b/src/DMRPlusProtocol.h
index c0b7c15..612d6a5 100644
--- a/src/DMRPlusProtocol.h
+++ b/src/DMRPlusProtocol.h
@@ -1,29 +1,22 @@
-//
-// DMRPlusProtocol.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 10/01/2016.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cdmrplusprotocol_h
-#define cdmrplusprotocol_h
+#pragma once
#include "Timer.h"
#include "DCSProtocol.h"
@@ -49,7 +42,7 @@ public:
CDvFramePacket m_dvFrame0;
CDvFramePacket m_dvFrame1;
- uint8 m_uiSeqId;
+ uint8_t m_uiSeqId;
};
@@ -57,7 +50,7 @@ class CDmrplusProtocol : public CProtocol
{
public:
// initialization
- bool Initialize(const char *type, const int pytpe, const uint16 port, const bool has_ipv4, const bool has_ipv6);
+ bool Initialize(const char *type, const int pytpe, const uint16_t port, const bool has_ipv4, const bool has_ipv6);
// task
void Task(void);
@@ -65,7 +58,7 @@ public:
protected:
// queue helper
void HandleQueue(void);
- void SendBufferToClients(const CBuffer &, uint8);
+ void SendBufferToClients(const CBuffer &, uint8_t);
// keepalive helpers
void HandleKeepalives(void);
@@ -83,23 +76,23 @@ protected:
void EncodeConnectAckPacket(CBuffer *);
void EncodeConnectNackPacket(CBuffer *);
bool EncodeDvHeaderPacket(const CDvHeaderPacket &, CBuffer *) const;
- void EncodeDvPacket(const CDvHeaderPacket &, const CDvFramePacket &, const CDvFramePacket &, const CDvFramePacket &, uint8, CBuffer *) const;
- void SwapEndianess(uint8 *, int) const;
+ void EncodeDvPacket(const CDvHeaderPacket &, const CDvFramePacket &, const CDvFramePacket &, const CDvFramePacket &, uint8_t, CBuffer *) const;
+ void SwapEndianess(uint8_t *, int) const;
// dmr SeqId helper
- uint8 GetNextSeqId(uint8) const;
+ uint8_t GetNextSeqId(uint8_t) const;
// dmr DstId to Module helper
- char DmrDstIdToModule(uint32) const;
- uint32 ModuleToDmrDestId(char) const;
+ char DmrDstIdToModule(uint32_t) const;
+ uint32_t ModuleToDmrDestId(char) const;
// uiStreamId helpers
- uint32 IpToStreamId(const CIp &) const;
+ uint32_t IpToStreamId(const CIp &) const;
// Buffer & LC helpers
- void AppendVoiceLCToBuffer(CBuffer *, uint32) const;
- void AppendTerminatorLCToBuffer(CBuffer *, uint32) const;
- void ReplaceEMBInBuffer(CBuffer *, uint8) const;
+ void AppendVoiceLCToBuffer(CBuffer *, uint32_t) const;
+ void AppendTerminatorLCToBuffer(CBuffer *, uint32_t) const;
+ void ReplaceEMBInBuffer(CBuffer *, uint8_t) const;
protected:
@@ -109,8 +102,3 @@ protected:
// for queue header caches
std::array m_StreamsCache;
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-
-
-#endif /* cdmrplusprotocol_h */
diff --git a/src/DPlusClient.cpp b/src/DPlusClient.cpp
index 87cbf96..2560a9c 100644
--- a/src/DPlusClient.cpp
+++ b/src/DPlusClient.cpp
@@ -1,26 +1,20 @@
-//
-// cdplusclient.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 31/10/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
#include "DPlusClient.h"
@@ -51,7 +45,7 @@ CDplusClient::CDplusClient(const CDplusClient &client)
bool CDplusClient::IsAlive(void) const
{
- return (m_LastKeepaliveTime.DurationSinceNow() < DPLUS_KEEPALIVE_TIMEOUT);
+ return (m_LastKeepaliveTime.time() < DPLUS_KEEPALIVE_TIMEOUT);
}
void CDplusClient::SetMasterOfModule(char c)
diff --git a/src/DPlusClient.h b/src/DPlusClient.h
index fefc468..961e69a 100644
--- a/src/DPlusClient.h
+++ b/src/DPlusClient.h
@@ -1,38 +1,24 @@
-//
-// DPlusClient.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 31/10/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cdplusclient_h
-#define cdplusclient_h
+#pragma once
-#include "cclient.h"
-
-////////////////////////////////////////////////////////////////////////////////////////
-// define
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-// class
+#include "Client.h"
class CDplusClient : public CClient
{
@@ -61,6 +47,3 @@ protected:
// data
bool m_bDextraDongle;
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cdplusclient_h */
diff --git a/src/DPlusProtocol.cpp b/src/DPlusProtocol.cpp
index 6a15dce..7b138cc 100644
--- a/src/DPlusProtocol.cpp
+++ b/src/DPlusProtocol.cpp
@@ -1,27 +1,20 @@
-//
-// cdplusprotocol.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 01/11/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
-// Copyright © 2020 Thomas A. Early, N7TAE
-//
-// ----------------------------------------------------------------------------
-// This file is part of xlxd.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
#include
@@ -34,14 +27,14 @@
////////////////////////////////////////////////////////////////////////////////////////
// operation
-bool CDplusProtocol::Initialize(const char *type, const int ptype, const uint16 port, const bool has_ipv4, const bool has_ipv6)
+bool CDplusProtocol::Initialize(const char *type, const int 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))
return false;
// update time
- m_LastKeepaliveTime.Now();
+ m_LastKeepaliveTime.start();
// done
return true;
@@ -166,13 +159,13 @@ void CDplusProtocol::Task(void)
HandleQueue();
// keep client alive
- if ( m_LastKeepaliveTime.DurationSinceNow() > DPLUS_KEEPALIVE_PERIOD )
+ if ( m_LastKeepaliveTime.time() > DPLUS_KEEPALIVE_PERIOD )
{
//
HandleKeepalives();
// update time
- m_LastKeepaliveTime.Now();
+ m_LastKeepaliveTime.start();
}
}
@@ -320,7 +313,7 @@ void CDplusProtocol::SendDvHeader(CDvHeaderPacket *packet, CDplusClient *client)
// clone the packet and patch it
CDvHeaderPacket packet2(*((CDvHeaderPacket *)packet));
CCallsign rpt2 = packet2.GetRpt2Callsign();
- rpt2.PatchCallsign(0, (const uint8 *)"XRF", 3);
+ rpt2.PatchCallsign(0, (const uint8_t *)"XRF", 3);
packet2.SetRpt2Callsign(rpt2);
// encode it
@@ -392,13 +385,13 @@ void CDplusProtocol::HandleKeepalives(void)
bool CDplusProtocol::IsValidConnectPacket(const CBuffer &Buffer)
{
- uint8 tag[] = { 0x05,0x00,0x18,0x00,0x01 };
+ uint8_t tag[] = { 0x05,0x00,0x18,0x00,0x01 };
return (Buffer == CBuffer(tag, sizeof(tag)));
}
bool CDplusProtocol::IsValidLoginPacket(const CBuffer &Buffer, CCallsign *Callsign)
{
- uint8 Tag[] = { 0x1C,0xC0,0x04,0x00 };
+ uint8_t Tag[] = { 0x1C,0xC0,0x04,0x00 };
bool valid = false;
if ( (Buffer.size() == 28) &&(::memcmp(Buffer.data(), Tag, sizeof(Tag)) == 0) )
@@ -411,22 +404,22 @@ bool CDplusProtocol::IsValidLoginPacket(const CBuffer &Buffer, CCallsign *Callsi
bool CDplusProtocol::IsValidDisconnectPacket(const CBuffer &Buffer)
{
- uint8 tag[] = { 0x05,0x00,0x18,0x00,0x00 };
+ uint8_t tag[] = { 0x05,0x00,0x18,0x00,0x00 };
return (Buffer == CBuffer(tag, sizeof(tag)));
}
bool CDplusProtocol::IsValidKeepAlivePacket(const CBuffer &Buffer)
{
- uint8 tag[] = { 0x03,0x60,0x00 };
+ uint8_t tag[] = { 0x03,0x60,0x00 };
return (Buffer == CBuffer(tag, sizeof(tag)));
}
bool CDplusProtocol::IsValidDvHeaderPacket(const CBuffer &Buffer, std::unique_ptr &header)
{
- if ( 58==Buffer.size() && 0x3AU==Buffer.data()[0] && 0x80U==Buffer.data()[1] && 0==Buffer.Compare((uint8 *)"DSVT", 2, 4) && 0x10U==Buffer.data()[6] && 0x20U==Buffer.data()[10] )
+ if ( 58==Buffer.size() && 0x3AU==Buffer.data()[0] && 0x80U==Buffer.data()[1] && 0==Buffer.Compare((uint8_t *)"DSVT", 2, 4) && 0x10U==Buffer.data()[6] && 0x20U==Buffer.data()[10] )
{
// create packet
- header = std::unique_ptr(new CDvHeaderPacket((struct dstar_header *)&(Buffer.data()[17]), *((uint16 *)&(Buffer.data()[14])), 0x80));
+ header = std::unique_ptr(new CDvHeaderPacket((struct dstar_header *)&(Buffer.data()[17]), *((uint16_t *)&(Buffer.data()[14])), 0x80));
// check validity of packet
if ( header && header->IsValid() )
return true;
@@ -436,10 +429,10 @@ bool CDplusProtocol::IsValidDvHeaderPacket(const CBuffer &Buffer, std::unique_pt
bool CDplusProtocol::IsValidDvFramePacket(const CBuffer &Buffer, std::unique_ptr &dvframe)
{
- if ( 29==Buffer.size() && 0x1DU==Buffer.data()[0] && 0x80U==Buffer.data()[1] && 0==Buffer.Compare((uint8 *)"DSVT", 2, 4) && 0x20U==Buffer.data()[6] && 0x20U==Buffer.data()[10] )
+ if ( 29==Buffer.size() && 0x1DU==Buffer.data()[0] && 0x80U==Buffer.data()[1] && 0==Buffer.Compare((uint8_t *)"DSVT", 2, 4) && 0x20U==Buffer.data()[6] && 0x20U==Buffer.data()[10] )
{
// create packet
- dvframe = std::unique_ptr(new CDvFramePacket((struct dstar_dvframe *)&(Buffer.data()[17]), *((uint16 *)&(Buffer.data()[14])), Buffer.data()[16]));
+ dvframe = std::unique_ptr(new CDvFramePacket((struct dstar_dvframe *)&(Buffer.data()[17]), *((uint16_t *)&(Buffer.data()[14])), Buffer.data()[16]));
// check validity of packet
if ( dvframe && dvframe->IsValid() )
return true;
@@ -449,10 +442,10 @@ bool CDplusProtocol::IsValidDvFramePacket(const CBuffer &Buffer, std::unique_ptr
bool CDplusProtocol::IsValidDvLastFramePacket(const CBuffer &Buffer, std::unique_ptr &dvframe)
{
- if ( 32==Buffer.size() && 0==Buffer.Compare((uint8 *)"DSVT", 2, 4) && 0x20U==Buffer.data()[0] && 0x80U==Buffer.data()[1] && 0x20U==Buffer.data()[6] && 0x20U==Buffer.data()[10] )
+ if ( 32==Buffer.size() && 0==Buffer.Compare((uint8_t *)"DSVT", 2, 4) && 0x20U==Buffer.data()[0] && 0x80U==Buffer.data()[1] && 0x20U==Buffer.data()[6] && 0x20U==Buffer.data()[10] )
{
// create packet
- dvframe = std::unique_ptr(new CDvLastFramePacket((struct dstar_dvframe *)&(Buffer.data()[17]), *((uint16 *)&(Buffer.data()[14])), Buffer.data()[16]));
+ dvframe = std::unique_ptr(new CDvLastFramePacket((struct dstar_dvframe *)&(Buffer.data()[17]), *((uint16_t *)&(Buffer.data()[14])), Buffer.data()[16]));
// check validity of packet
if ( dvframe && dvframe->IsValid() )
return true;
@@ -466,53 +459,53 @@ bool CDplusProtocol::IsValidDvLastFramePacket(const CBuffer &Buffer, std::unique
void CDplusProtocol::EncodeKeepAlivePacket(CBuffer *Buffer)
{
- uint8 tag[] = { 0x03,0x60,0x00 };
+ uint8_t tag[] = { 0x03,0x60,0x00 };
Buffer->Set(tag, sizeof(tag));
}
void CDplusProtocol::EncodeLoginAckPacket(CBuffer *Buffer)
{
- uint8 tag[] = { 0x08,0xC0,0x04,0x00,'O','K','R','W' };
+ uint8_t tag[] = { 0x08,0xC0,0x04,0x00,'O','K','R','W' };
Buffer->Set(tag, sizeof(tag));
}
void CDplusProtocol::EncodeLoginNackPacket(CBuffer *Buffer)
{
- uint8 tag[] = { 0x08,0xC0,0x04,0x00,'B','U','S','Y' };
+ uint8_t tag[] = { 0x08,0xC0,0x04,0x00,'B','U','S','Y' };
Buffer->Set(tag, sizeof(tag));
}
void CDplusProtocol::EncodeDisconnectPacket(CBuffer *Buffer)
{
- uint8 tag[] = { 0x05,0x00,0x18,0x00,0x00 };
+ uint8_t tag[] = { 0x05,0x00,0x18,0x00,0x00 };
Buffer->Set(tag, sizeof(tag));
}
bool CDplusProtocol::EncodeDvHeaderPacket(const CDvHeaderPacket &Packet, CBuffer *Buffer) const
{
- uint8 tag[] = { 0x3A,0x80,0x44,0x53,0x56,0x54,0x10,0x00,0x00,0x00,0x20,0x00,0x01,0x02 };
+ uint8_t tag[] = { 0x3A,0x80,0x44,0x53,0x56,0x54,0x10,0x00,0x00,0x00,0x20,0x00,0x01,0x02 };
struct dstar_header DstarHeader;
Packet.ConvertToDstarStruct(&DstarHeader);
Buffer->Set(tag, sizeof(tag));
Buffer->Append(Packet.GetStreamId());
- Buffer->Append((uint8)0x80);
- Buffer->Append((uint8 *)&DstarHeader, sizeof(struct dstar_header));
+ Buffer->Append((uint8_t)0x80);
+ Buffer->Append((uint8_t *)&DstarHeader, sizeof(struct dstar_header));
return true;
}
bool CDplusProtocol::EncodeDvFramePacket(const CDvFramePacket &Packet, CBuffer *Buffer) const
{
- uint8 tag[] = { 0x1D,0x80,0x44,0x53,0x56,0x54,0x20,0x00,0x00,0x00,0x20,0x00,0x01,0x02 };
+ uint8_t tag[] = { 0x1D,0x80,0x44,0x53,0x56,0x54,0x20,0x00,0x00,0x00,0x20,0x00,0x01,0x02 };
Buffer->Set(tag, sizeof(tag));
Buffer->Append(Packet.GetStreamId());
- Buffer->Append((uint8)(Packet.GetPacketId() % 21));
- Buffer->Append((uint8 *)Packet.GetAmbe(), AMBE_SIZE);
- Buffer->Append((uint8 *)Packet.GetDvData(), DVDATA_SIZE);
+ Buffer->Append((uint8_t)(Packet.GetPacketId() % 21));
+ Buffer->Append((uint8_t *)Packet.GetAmbe(), AMBE_SIZE);
+ Buffer->Append((uint8_t *)Packet.GetDvData(), DVDATA_SIZE);
return true;
@@ -520,12 +513,12 @@ bool CDplusProtocol::EncodeDvFramePacket(const CDvFramePacket &Packet, CBuffer *
bool CDplusProtocol::EncodeDvLastFramePacket(const CDvLastFramePacket &Packet, CBuffer *Buffer) const
{
- uint8 tag1[] = { 0x20,0x80,0x44,0x53,0x56,0x54,0x20,0x00,0x81,0x00,0x20,0x00,0x01,0x02 };
- uint8 tag2[] = { 0x55,0xC8,0x7A,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x25,0x1A,0xC6 };
+ uint8_t tag1[] = { 0x20,0x80,0x44,0x53,0x56,0x54,0x20,0x00,0x81,0x00,0x20,0x00,0x01,0x02 };
+ uint8_t tag2[] = { 0x55,0xC8,0x7A,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x25,0x1A,0xC6 };
Buffer->Set(tag1, sizeof(tag1));
Buffer->Append(Packet.GetStreamId());
- Buffer->Append((uint8)((Packet.GetPacketId() % 21) | 0x40));
+ Buffer->Append((uint8_t)((Packet.GetPacketId() % 21) | 0x40));
Buffer->Append(tag2, sizeof(tag2));
return true;
diff --git a/src/DPlusProtocol.h b/src/DPlusProtocol.h
index 631f06b..ee14576 100644
--- a/src/DPlusProtocol.h
+++ b/src/DPlusProtocol.h
@@ -1,29 +1,22 @@
-//
-// DPlusProtocol.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 01/11/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cdplusprotocol_h
-#define cdplusprotocol_h
+#pragma once
#include "Timer.h"
#include "Protocol.h"
@@ -31,12 +24,6 @@
#include "DVFramePacket.h"
#include "DVLastFramePacket.h"
-////////////////////////////////////////////////////////////////////////////////////////
-// define
-
-////////////////////////////////////////////////////////////////////////////////////////
-// class
-
class CDplusClient;
class CDPlusStreamCacheItem
@@ -45,14 +32,14 @@ public:
CDPlusStreamCacheItem() { m_iSeqCounter = 0; }
CDvHeaderPacket m_dvHeader;
- uint8 m_iSeqCounter;
+ uint8_t m_iSeqCounter;
};
class CDplusProtocol : public CProtocol
{
public:
// initialization
- bool Initialize(const char *type, const int ptype, const uint16 port, const bool has_ipv4, const bool has_ipv6);
+ bool Initialize(const char *type, const int ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6);
// task
void Task(void);
@@ -89,11 +76,8 @@ protected:
protected:
// for keep alive
- CTimePoint m_LastKeepaliveTime;
+ CTimer m_LastKeepaliveTime;
// for queue header caches
std::array m_StreamsCache;
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cdplusprotocol_h */
diff --git a/src/DVFramePacket.cpp b/src/DVFramePacket.cpp
index 94cdd44..2ee61cb 100644
--- a/src/DVFramePacket.cpp
+++ b/src/DVFramePacket.cpp
@@ -1,30 +1,23 @@
-//
-// cdvframepacket.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 01/11/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-
-#include "Main.h"
#include
+#include "Main.h"
#include "DVFramePacket.h"
@@ -43,7 +36,7 @@ CDvFramePacket::CDvFramePacket()
// dstar constructor
-CDvFramePacket::CDvFramePacket(const struct dstar_dvframe *dvframe, uint16 sid, uint8 pid)
+CDvFramePacket::CDvFramePacket(const struct dstar_dvframe *dvframe, uint16_t sid, uint8_t pid)
: CPacket(sid, pid)
{
::memcpy(m_uiAmbe, dvframe->AMBE, sizeof(m_uiAmbe));
@@ -57,7 +50,7 @@ CDvFramePacket::CDvFramePacket(const struct dstar_dvframe *dvframe, uint16 sid,
#ifndef NO_XLX
// dmr constructor
-CDvFramePacket::CDvFramePacket(const uint8 *ambe, const uint8 *sync, uint16 sid, uint8 pid, uint8 spid)
+CDvFramePacket::CDvFramePacket(const uint8_t *ambe, const uint8_t *sync, uint16_t sid, uint8_t pid, uint8_t spid)
: CPacket(sid, pid, spid)
{
::memcpy(m_uiAmbePlus, ambe, sizeof(m_uiAmbePlus));
@@ -68,7 +61,7 @@ CDvFramePacket::CDvFramePacket(const uint8 *ambe, const uint8 *sync, uint16 sid,
// ysf constructor
-CDvFramePacket::CDvFramePacket(const uint8 *ambe, uint16 sid, uint8 pid, uint8 spid, uint8 fid)
+CDvFramePacket::CDvFramePacket(const uint8_t *ambe, uint16_t sid, uint8_t pid, uint8_t spid, uint8_t fid)
: CPacket(sid, pid, spid, fid)
{
::memcpy(m_uiAmbePlus, ambe, sizeof(m_uiAmbePlus));
@@ -80,9 +73,9 @@ CDvFramePacket::CDvFramePacket(const uint8 *ambe, uint16 sid, uint8 pid, uint8 s
// xlx constructor
CDvFramePacket::CDvFramePacket
-(uint16 sid,
- uint8 dstarpid, const uint8 *dstarambe, const uint8 *dstardvdata,
- uint8 dmrpid, uint8 dprspid, const uint8 *dmrambe, const uint8 *dmrsync)
+(uint16_t sid,
+ uint8_t dstarpid, const uint8_t *dstarambe, const uint8_t *dstardvdata,
+ uint8_t dmrpid, uint8_t dprspid, const uint8_t *dmrambe, const uint8_t *dmrsync)
: CPacket(sid, dstarpid, dmrpid, dprspid, 0xFF, 0xFF, 0xFF)
{
::memcpy(m_uiAmbe, dstarambe, sizeof(m_uiAmbe));
@@ -103,7 +96,7 @@ std::unique_ptr CDvFramePacket::Duplicate(void) const
////////////////////////////////////////////////////////////////////////////////////////
// get
-const uint8 *CDvFramePacket::GetAmbe(uint8 uiCodec) const
+const uint8_t *CDvFramePacket::GetAmbe(uint8_t uiCodec) const
{
switch (uiCodec)
{
@@ -121,12 +114,12 @@ const uint8 *CDvFramePacket::GetAmbe(uint8 uiCodec) const
////////////////////////////////////////////////////////////////////////////////////////
// set
-void CDvFramePacket::SetDvData(uint8 *DvData)
+void CDvFramePacket::SetDvData(uint8_t *DvData)
{
::memcpy(m_uiDvData, DvData, sizeof(m_uiDvData));
}
-void CDvFramePacket::SetAmbe(uint8 uiCodec, uint8 *Ambe)
+void CDvFramePacket::SetAmbe(uint8_t uiCodec, uint8_t *Ambe)
{
switch (uiCodec)
{
diff --git a/src/DVFramePacket.h b/src/DVFramePacket.h
index 52a0762..fbf1a36 100644
--- a/src/DVFramePacket.h
+++ b/src/DVFramePacket.h
@@ -1,29 +1,22 @@
-//
-// DVFramePacket.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 01/11/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cdvframepacket_h
-#define cdvframepacket_h
+#pragma once
#include "Packet.h"
@@ -40,8 +33,8 @@
struct __attribute__ ((__packed__))dstar_dvframe
{
- uint8 AMBE[AMBE_SIZE];
- uint8 DVDATA[DVDATA_SIZE];
+ uint8_t AMBE[AMBE_SIZE];
+ uint8_t DVDATA[DVDATA_SIZE];
};
////////////////////////////////////////////////////////////////////////////////////////
@@ -53,11 +46,11 @@ class CDvFramePacket : public CPacket
public:
// constructor
CDvFramePacket();
- CDvFramePacket(const struct dstar_dvframe *, uint16, uint8);
+ CDvFramePacket(const struct dstar_dvframe *, uint16_t, uint8_t);
#ifndef NO_XLX
- CDvFramePacket(const uint8 *, const uint8 *, uint16, uint8, uint8);
- CDvFramePacket(const uint8 *, uint16, uint8, uint8, uint8);
- CDvFramePacket(uint16, uint8, const uint8 *, const uint8 *, uint8, uint8, const uint8 *, const uint8 *);
+ CDvFramePacket(const uint8_t *, const uint8_t *, uint16_t, uint8_t, uint8_t);
+ CDvFramePacket(const uint8_t *, uint16_t, uint8_t, uint8_t, uint8_t);
+ CDvFramePacket(uint16_t, uint8_t, const uint8_t *, const uint8_t *, uint8_t, uint8_t, const uint8_t *, const uint8_t *);
#endif
// virtual duplication
@@ -70,39 +63,35 @@ public:
#endif
// get
- const uint8 *GetAmbe(uint8) const;
- const uint8 *GetAmbe(void) const { return m_uiAmbe; }
+ const uint8_t *GetAmbe(uint8_t) const;
+ const uint8_t *GetAmbe(void) const { return m_uiAmbe; }
#ifndef NO_XLX
- const uint8 *GetAmbePlus(void) const { return m_uiAmbePlus; }
- const uint8 *GetDvSync(void) const { return m_uiDvSync; }
+ const uint8_t *GetAmbePlus(void) const { return m_uiAmbePlus; }
+ const uint8_t *GetDvSync(void) const { return m_uiDvSync; }
#endif
- const uint8 *GetDvData(void) const { return m_uiDvData; }
+ const uint8_t *GetDvData(void) const { return m_uiDvData; }
// set
- void SetDvData(uint8 *);
- void SetAmbe(uint8, uint8 *);
+ void SetDvData(uint8_t *);
+ void SetAmbe(uint8_t, uint8_t *);
// operators
bool operator ==(const CDvFramePacket &) const;
protected:
// get
- uint8 *GetAmbeData(void) { return m_uiAmbe; }
+ uint8_t *GetAmbeData(void) { return m_uiAmbe; }
#ifndef NO_XLX
- uint8 *GetAmbePlusData(void) { return m_uiAmbePlus; }
+ uint8_t *GetAmbePlusData(void) { return m_uiAmbePlus; }
#endif
protected:
// data (dstar)
- uint8 m_uiAmbe[AMBE_SIZE];
- uint8 m_uiDvData[DVDATA_SIZE];
+ uint8_t m_uiAmbe[AMBE_SIZE];
+ uint8_t m_uiDvData[DVDATA_SIZE];
#ifndef NO_XLX
// data (dmr)
- uint8 m_uiAmbePlus[AMBEPLUS_SIZE];
- uint8 m_uiDvSync[DVSYNC_SIZE];
+ uint8_t m_uiAmbePlus[AMBEPLUS_SIZE];
+ uint8_t m_uiDvSync[DVSYNC_SIZE];
#endif
};
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cdvframepacket_h */
diff --git a/src/DVHeaderPacket.cpp b/src/DVHeaderPacket.cpp
index 7ceb682..e67ebe4 100644
--- a/src/DVHeaderPacket.cpp
+++ b/src/DVHeaderPacket.cpp
@@ -1,26 +1,20 @@
-//
-// cdvheaderpacket.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 01/11/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
#include
@@ -41,7 +35,7 @@ CDvHeaderPacket::CDvHeaderPacket()
// dstar constructor
-CDvHeaderPacket::CDvHeaderPacket(const struct dstar_header *buffer, uint16 sid, uint8 pid)
+CDvHeaderPacket::CDvHeaderPacket(const struct dstar_header *buffer, uint16_t sid, uint8_t pid)
: CPacket(sid, pid)
{
m_uiFlag1 = buffer->Flag1;
@@ -58,7 +52,7 @@ CDvHeaderPacket::CDvHeaderPacket(const struct dstar_header *buffer, uint16 sid,
#ifndef NO_XLX
// dmr constructor
-CDvHeaderPacket::CDvHeaderPacket(uint32 my, const CCallsign &ur, const CCallsign &rpt1, const CCallsign &rpt2, uint16 sid, uint8 pid, uint8 spid)
+CDvHeaderPacket::CDvHeaderPacket(uint32_t my, const CCallsign &ur, const CCallsign &rpt1, const CCallsign &rpt2, uint16_t sid, uint8_t pid, uint8_t spid)
: CPacket(sid, pid, spid)
{
m_uiFlag1 = 0;
@@ -73,7 +67,7 @@ CDvHeaderPacket::CDvHeaderPacket(uint32 my, const CCallsign &ur, const CCallsign
// YSF constructor
-CDvHeaderPacket::CDvHeaderPacket(const CCallsign &my, const CCallsign &ur, const CCallsign &rpt1, const CCallsign &rpt2, uint16 sid, uint8 pid)
+CDvHeaderPacket::CDvHeaderPacket(const CCallsign &my, const CCallsign &ur, const CCallsign &rpt1, const CCallsign &rpt2, uint16_t sid, uint8_t pid)
: CPacket(sid, pid, 0, 0)
{
m_uiFlag1 = 0;
diff --git a/src/DVHeaderPacket.h b/src/DVHeaderPacket.h
index 9c493c6..bb189f1 100644
--- a/src/DVHeaderPacket.h
+++ b/src/DVHeaderPacket.h
@@ -1,29 +1,22 @@
-//
-// DVHeaderPacket.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 01/11/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cdvheaderpacket_h
-#define cdvheaderpacket_h
+#pragma once
#include "Callsign.h"
#include "Packet.h"
@@ -39,17 +32,17 @@
struct __attribute__ ((__packed__))dstar_header
{
// flags
- uint8 Flag1;
- uint8 Flag2;
- uint8 Flag3;
+ uint8_t Flag1;
+ uint8_t Flag2;
+ uint8_t Flag3;
// callsigns
- uint8 RPT2[CALLSIGN_LEN];
- uint8 RPT1[CALLSIGN_LEN];
- uint8 UR[CALLSIGN_LEN];
- uint8 MY[CALLSIGN_LEN];
- uint8 SUFFIX[CALLSUFFIX_LEN];
+ uint8_t RPT2[CALLSIGN_LEN];
+ uint8_t RPT1[CALLSIGN_LEN];
+ uint8_t UR[CALLSIGN_LEN];
+ uint8_t MY[CALLSIGN_LEN];
+ uint8_t SUFFIX[CALLSUFFIX_LEN];
// crc
- uint16 Crc;
+ uint16_t Crc;
};
@@ -61,10 +54,10 @@ class CDvHeaderPacket : public CPacket
public:
// constructor
CDvHeaderPacket();
- CDvHeaderPacket(const struct dstar_header *, uint16, uint8);
+ CDvHeaderPacket(const struct dstar_header *, uint16_t, uint8_t);
#ifndef NO_XLX
- CDvHeaderPacket(uint32, const CCallsign &, const CCallsign &, const CCallsign &, uint16, uint8, uint8);
- CDvHeaderPacket(const CCallsign &, const CCallsign &, const CCallsign &, const CCallsign &, uint16, uint8);
+ CDvHeaderPacket(uint32_t, const CCallsign &, const CCallsign &, const CCallsign &, uint16_t, uint8_t, uint8_t);
+ CDvHeaderPacket(const CCallsign &, const CCallsign &, const CCallsign &, const CCallsign &, uint16_t, uint8_t);
#endif
// virtual duplication
@@ -103,19 +96,16 @@ public:
protected:
// data
- uint8 m_uiFlag1;
- uint8 m_uiFlag2;
- uint8 m_uiFlag3;
+ uint8_t m_uiFlag1;
+ uint8_t m_uiFlag2;
+ uint8_t m_uiFlag3;
CCallsign m_csUR;
CCallsign m_csRPT1;
CCallsign m_csRPT2;
CCallsign m_csMY;
- uint16 m_uiCrc;
+ uint16_t m_uiCrc;
#ifdef IMPLEMENT_CDVHEADERPACKET_CONST_CHAR_OPERATOR
// buffer
char m_sz[256];
#endif
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cdvheaderpacket_h */
diff --git a/src/DVLastFramePacket.cpp b/src/DVLastFramePacket.cpp
index 323dc7b..6832c84 100644
--- a/src/DVLastFramePacket.cpp
+++ b/src/DVLastFramePacket.cpp
@@ -1,26 +1,20 @@
-//
-// cdvlastframepacket.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 03/11/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
#include "DVLastFramePacket.h"
@@ -35,7 +29,7 @@ CDvLastFramePacket::CDvLastFramePacket()
// dstar constructor
-CDvLastFramePacket::CDvLastFramePacket(const struct dstar_dvframe *DvFrame, uint16 sid, uint8 pid)
+CDvLastFramePacket::CDvLastFramePacket(const struct dstar_dvframe *DvFrame, uint16_t sid, uint8_t pid)
: CDvFramePacket(DvFrame, sid, pid)
{
}
@@ -43,7 +37,7 @@ CDvLastFramePacket::CDvLastFramePacket(const struct dstar_dvframe *DvFrame, uint
#ifndef NO_XLX
// dmr constructor
-CDvLastFramePacket::CDvLastFramePacket(const uint8 *ambe, const uint8 *sync, uint16 sid, uint8 pid, uint8 spid)
+CDvLastFramePacket::CDvLastFramePacket(const uint8_t *ambe, const uint8_t *sync, uint16_t sid, uint8_t pid, uint8_t spid)
: CDvFramePacket(ambe, sync, sid, pid, spid)
{
}
@@ -51,16 +45,16 @@ CDvLastFramePacket::CDvLastFramePacket(const uint8 *ambe, const uint8 *sync, uin
// dstar + dmr constructor
CDvLastFramePacket::CDvLastFramePacket
-(uint16 sid,
- uint8 dstarpid, const uint8 *dstarambe, const uint8 *dstardvdata,
- uint8 dmrpid, uint8 dprspid, const uint8 *dmrambe, const uint8 *dmrsync)
+(uint16_t sid,
+ uint8_t dstarpid, const uint8_t *dstarambe, const uint8_t *dstardvdata,
+ uint8_t dmrpid, uint8_t dprspid, const uint8_t *dmrambe, const uint8_t *dmrsync)
: CDvFramePacket(sid, dstarpid, dstarambe, dstardvdata, dmrpid, dprspid, dmrambe, dmrsync)
{
}
// ysf constructor
-CDvLastFramePacket::CDvLastFramePacket(const uint8 *ambe, uint16 sid, uint8 pid, uint8 spid, uint8 fid)
+CDvLastFramePacket::CDvLastFramePacket(const uint8_t *ambe, uint16_t sid, uint8_t pid, uint8_t spid, uint8_t fid)
: CDvFramePacket(ambe, sid, pid, spid, fid)
{
}
diff --git a/src/DVLastFramePacket.h b/src/DVLastFramePacket.h
index b3ebe85..548d784 100644
--- a/src/DVLastFramePacket.h
+++ b/src/DVLastFramePacket.h
@@ -1,50 +1,35 @@
-//
-// DVLastFramePacket.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 03/11/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
-
-#ifndef cdvlastframepacket_h
-#define cdvlastframepacket_h
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+#pragma once
#include "DVFramePacket.h"
-////////////////////////////////////////////////////////////////////////////////////////
-// defines
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-// class
-
class CDvLastFramePacket : public CDvFramePacket
{
public:
// constructor
CDvLastFramePacket();
- CDvLastFramePacket(const struct dstar_dvframe *, uint16, uint8);
+ CDvLastFramePacket(const struct dstar_dvframe *, uint16_t, uint8_t);
#ifndef NO_XLX
- CDvLastFramePacket(const uint8 *, const uint8 *, uint16, uint8, uint8);
- CDvLastFramePacket(const uint8 *, uint16, uint8, uint8, uint8);
- CDvLastFramePacket(uint16, uint8, const uint8 *, const uint8 *, uint8, uint8, const uint8 *, const uint8 *);
+ CDvLastFramePacket(const uint8_t *, const uint8_t *, uint16_t, uint8_t, uint8_t);
+ CDvLastFramePacket(const uint8_t *, uint16_t, uint8_t, uint8_t, uint8_t);
+ CDvLastFramePacket(uint16_t, uint8_t, const uint8_t *, const uint8_t *, uint8_t, uint8_t, const uint8_t *, const uint8_t *);
#endif
CDvLastFramePacket(const CDvLastFramePacket &);
@@ -55,7 +40,3 @@ public:
bool IsLastPacket(void) const { return true; }
bool HasTranscodableAmbe(void) const { return false; }
};
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cdvlastframepacket_h */
diff --git a/src/G3Client.cpp b/src/G3Client.cpp
index e7b00f3..5e89fc7 100644
--- a/src/G3Client.cpp
+++ b/src/G3Client.cpp
@@ -1,26 +1,20 @@
-//
-// cg3client.cpp
-// xlxd
-//
-// Created by Marius Petrescu (YO2LOJ) on 03/06/2019.
// Copyright © 2019 Marius Petrescu (YO2LOJ). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
#include "G3Client.h"
@@ -49,5 +43,5 @@ CG3Client::CG3Client(const CG3Client &client)
bool CG3Client::IsAlive(void) const
{
- return (m_LastKeepaliveTime.DurationSinceNow() < G3_KEEPALIVE_TIMEOUT);
+ return (m_LastKeepaliveTime.time() < G3_KEEPALIVE_TIMEOUT);
}
diff --git a/src/G3Client.h b/src/G3Client.h
index 9f08d50..c3b91d2 100644
--- a/src/G3Client.h
+++ b/src/G3Client.h
@@ -1,39 +1,25 @@
-//
-// G3Client.h
-// xlxd
-//
-// Created by Marius Petrescu (YO2LOJ) on 03/06/2019.
// Copyright © 2019 Marius Petrescu (YO2LOJ). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cg3client_h
-#define cg3client_h
+#pragma once
#include "Client.h"
-////////////////////////////////////////////////////////////////////////////////////////
-// define
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-// class
-
class CG3Client : public CClient
{
public:
@@ -57,6 +43,3 @@ public:
protected:
// data
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cg3client_h */
diff --git a/src/G3Protocol.cpp b/src/G3Protocol.cpp
index 965118c..793d530 100644
--- a/src/G3Protocol.cpp
+++ b/src/G3Protocol.cpp
@@ -1,27 +1,20 @@
-//
-// cg3protocol.cpp
-// xlxd
-//
-// Created by Marius Petrescu (YO2LOJ) on 03/06/2019.
// Copyright © 2019 Marius Petrescu (YO2LOJ). All rights reserved.
-// Copyright © 2020 Thomas A. Early, N7TAE
-//
-// ----------------------------------------------------------------------------
-// This file is part of xlxd.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
#include
@@ -38,7 +31,7 @@
////////////////////////////////////////////////////////////////////////////////////////
// operation
-bool CG3Protocol::Initialize(const char */*type*/, const int /*type*/, const uint16 /*port*/, const bool /*has_ipv4*/, const bool /*has_ipv6*/)
+bool CG3Protocol::Initialize(const char */*type*/, const int /*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();
@@ -50,7 +43,7 @@ bool CG3Protocol::Initialize(const char */*type*/, const int /*type*/, const uin
keep_running = true;
// update the reflector callsign
- //m_ReflectorCallsign.PatchCallsign(0, (const uint8 *)"XLX", 3);
+ //m_ReflectorCallsign.PatchCallsign(0, (const uint8_t *)"XLX", 3);
// create our sockets
auto s = g_Reflector.m_Address.GetV4Address(PROTOCOL_G3);
@@ -93,7 +86,7 @@ bool CG3Protocol::Initialize(const char */*type*/, const int /*type*/, const uin
m_IcmpFuture = std::async(std::launch::async, &CG3Protocol::IcmpThread, this);
// update time
- m_LastKeepaliveTime.Now();
+ m_LastKeepaliveTime.start();
std::cout << "Initialized G3 Protocol, all threads started" << std::endl;
return true;
@@ -178,7 +171,7 @@ void CG3Protocol::PresenceTask(void)
if (m_GwAddress == 0)
{
- Buffer.Append(*(uint32 *)m_ConfigSocket.GetLocalAddr());
+ Buffer.Append(*(uint32_t *)m_ConfigSocket.GetLocalAddr());
}
else
{
@@ -295,24 +288,24 @@ void CG3Protocol::ConfigTask(void)
// UR
Buffer.resize(8);
- Buffer.Append((uint8 *)(const char *)Call, CALLSIGN_LEN - 1);
- Buffer.Append((uint8)module);
+ Buffer.Append((uint8_t *)(const char *)Call, CALLSIGN_LEN - 1);
+ Buffer.Append((uint8_t)module);
// RPT1
- Buffer.Append((uint8 *)(const char *)GetReflectorCallsign(), CALLSIGN_LEN - 1);
- Buffer.Append((uint8)'G');
+ Buffer.Append((uint8_t *)(const char *)GetReflectorCallsign(), CALLSIGN_LEN - 1);
+ Buffer.Append((uint8_t)'G');
// RPT2
- Buffer.Append((uint8 *)(const char *)GetReflectorCallsign(), CALLSIGN_LEN - 1);
+ Buffer.Append((uint8_t *)(const char *)GetReflectorCallsign(), CALLSIGN_LEN - 1);
if (isRepeaterCall)
{
- Buffer.Append((uint8)Call.GetModule());
+ Buffer.Append((uint8_t)Call.GetModule());
}
else
{
// routed - no module for now
- Buffer.Append((uint8)' ');
+ Buffer.Append((uint8_t)' ');
}
if (Buffer.data()[3] == 0x00)
@@ -321,7 +314,7 @@ void CG3Protocol::ConfigTask(void)
if (m_GwAddress == 0)
{
- Buffer.Append(*(uint32 *)m_ConfigSocket.GetLocalAddr());
+ Buffer.Append(*(uint32_t *)m_ConfigSocket.GetLocalAddr());
}
else
{
@@ -399,7 +392,7 @@ void CG3Protocol::Task(void)
client->Alive();
// supress host checks - no ping needed to trigger potential ICMPs
// the regular data flow will do it
- m_LastKeepaliveTime.Now();
+ m_LastKeepaliveTime.start();
break;
}
}
@@ -435,13 +428,13 @@ void CG3Protocol::Task(void)
HandleQueue();
// keep alive during idle if needed
- if ( m_LastKeepaliveTime.DurationSinceNow() > G3_KEEPALIVE_PERIOD )
+ if ( m_LastKeepaliveTime.time() > G3_KEEPALIVE_PERIOD )
{
// handle keep alives
HandleKeepalives();
// update time
- m_LastKeepaliveTime.Now();
+ m_LastKeepaliveTime.start();
// reload option if needed - called once every G3_KEEPALIVE_PERIOD
NeedReload();
@@ -457,7 +450,7 @@ void CG3Protocol::HandleQueue(void)
while ( !m_Queue.empty() )
{
// supress host checks
- m_LastKeepaliveTime.Now();
+ m_LastKeepaliveTime.start();
// get the packet
auto packet = m_Queue.front();
@@ -498,7 +491,7 @@ void CG3Protocol::HandleKeepalives(void)
// G3 Terminal mode does not support keepalive
// We will send some short packed and expect
// A ICMP unreachable on failure
- CBuffer keepalive((uint8 *)"PING", 4);
+ CBuffer keepalive((uint8_t *)"PING", 4);
// iterate on clients
CClients *clients = g_Reflector.GetClients();
@@ -599,10 +592,10 @@ void CG3Protocol::OnDvHeaderPacketIn(std::unique_ptr &Header, c
bool CG3Protocol::IsValidDvHeaderPacket(const CBuffer &Buffer, std::unique_ptr &header)
{
- if ( 56==Buffer.size() && 0==Buffer.Compare((uint8 *)"DSVT", 4) && 0x10U==Buffer.data()[4] && 0x20U==Buffer.data()[8] )
+ if ( 56==Buffer.size() && 0==Buffer.Compare((uint8_t *)"DSVT", 4) && 0x10U==Buffer.data()[4] && 0x20U==Buffer.data()[8] )
{
// create packet
- header = std::unique_ptr(new CDvHeaderPacket((struct dstar_header *)&(Buffer.data()[15]), *((uint16 *)&(Buffer.data()[12])), 0x80));
+ header = std::unique_ptr(new CDvHeaderPacket((struct dstar_header *)&(Buffer.data()[15]), *((uint16_t *)&(Buffer.data()[12])), 0x80));
// check validity of packet
if ( header && header->IsValid() )
return true;
@@ -612,10 +605,10 @@ bool CG3Protocol::IsValidDvHeaderPacket(const CBuffer &Buffer, std::unique_ptr &dvframe)
{
- if ( 27==Buffer.size() && 0==Buffer.Compare((uint8 *)"DSVT", 4) && 0x20U==Buffer.data()[4] && 0x20U==Buffer.data()[8] && 0U==(Buffer.data()[14] & 0x40U) )
+ if ( 27==Buffer.size() && 0==Buffer.Compare((uint8_t *)"DSVT", 4) && 0x20U==Buffer.data()[4] && 0x20U==Buffer.data()[8] && 0U==(Buffer.data()[14] & 0x40U) )
{
// create packet
- dvframe = std::unique_ptr(new CDvFramePacket((struct dstar_dvframe *)&(Buffer.data()[15]), *((uint16 *)&(Buffer.data()[12])), Buffer.data()[14]));
+ dvframe = std::unique_ptr(new CDvFramePacket((struct dstar_dvframe *)&(Buffer.data()[15]), *((uint16_t *)&(Buffer.data()[12])), Buffer.data()[14]));
// check validity of packet
if ( dvframe && dvframe->IsValid() )
return true;
@@ -625,10 +618,10 @@ bool CG3Protocol::IsValidDvFramePacket(const CBuffer &Buffer, std::unique_ptr &dvframe)
{
- if ( 27==Buffer.size() && 0==Buffer.Compare((uint8 *)"DSVT", 4) && 0x20U==Buffer.data()[4] && 0x20U==Buffer.data()[8] && (Buffer.data()[14] & 0x40U) )
+ if ( 27==Buffer.size() && 0==Buffer.Compare((uint8_t *)"DSVT", 4) && 0x20U==Buffer.data()[4] && 0x20U==Buffer.data()[8] && (Buffer.data()[14] & 0x40U) )
{
// create packet
- dvframe = std::unique_ptr(new CDvLastFramePacket((struct dstar_dvframe *)&(Buffer.data()[15]), *((uint16 *)&(Buffer.data()[12])), Buffer.data()[14]));
+ dvframe = std::unique_ptr(new CDvLastFramePacket((struct dstar_dvframe *)&(Buffer.data()[15]), *((uint16_t *)&(Buffer.data()[12])), Buffer.data()[14]));
// check validity of packet
if ( dvframe && dvframe->IsValid() )
return true;
@@ -641,28 +634,28 @@ bool CG3Protocol::IsValidDvLastFramePacket(const CBuffer &Buffer, std::unique_pt
bool CG3Protocol::EncodeDvHeaderPacket(const CDvHeaderPacket &Packet, CBuffer *Buffer) const
{
- uint8 tag[] = { 'D','S','V','T',0x10,0x00,0x00,0x00,0x20,0x00,0x01,0x02 };
+ uint8_t tag[] = { 'D','S','V','T',0x10,0x00,0x00,0x00,0x20,0x00,0x01,0x02 };
struct dstar_header DstarHeader;
Packet.ConvertToDstarStruct(&DstarHeader);
Buffer->Set(tag, sizeof(tag));
Buffer->Append(Packet.GetStreamId());
- Buffer->Append((uint8)0x80);
- Buffer->Append((uint8 *)&DstarHeader, sizeof(struct dstar_header));
+ Buffer->Append((uint8_t)0x80);
+ Buffer->Append((uint8_t *)&DstarHeader, sizeof(struct dstar_header));
return true;
}
bool CG3Protocol::EncodeDvFramePacket(const CDvFramePacket &Packet, CBuffer *Buffer) const
{
- uint8 tag[] = { 'D','S','V','T',0x20,0x00,0x00,0x00,0x20,0x00,0x01,0x02 };
+ uint8_t tag[] = { 'D','S','V','T',0x20,0x00,0x00,0x00,0x20,0x00,0x01,0x02 };
Buffer->Set(tag, sizeof(tag));
Buffer->Append(Packet.GetStreamId());
- Buffer->Append((uint8)(Packet.GetPacketId() % 21));
- Buffer->Append((uint8 *)Packet.GetAmbe(), AMBE_SIZE);
- Buffer->Append((uint8 *)Packet.GetDvData(), DVDATA_SIZE);
+ Buffer->Append((uint8_t)(Packet.GetPacketId() % 21));
+ Buffer->Append((uint8_t *)Packet.GetAmbe(), AMBE_SIZE);
+ Buffer->Append((uint8_t *)Packet.GetDvData(), DVDATA_SIZE);
return true;
@@ -670,12 +663,12 @@ bool CG3Protocol::EncodeDvFramePacket(const CDvFramePacket &Packet, CBuffer *Buf
bool CG3Protocol::EncodeDvLastFramePacket(const CDvLastFramePacket &Packet, CBuffer *Buffer) const
{
- uint8 tag1[] = { 'D','S','V','T',0x20,0x00,0x00,0x00,0x20,0x00,0x01,0x02 };
- uint8 tag2[] = { 0x55,0xC8,0x7A,0x00,0x00,0x00,0x00,0x00,0x00,0x25,0x1A,0xC6 };
+ uint8_t tag1[] = { 'D','S','V','T',0x20,0x00,0x00,0x00,0x20,0x00,0x01,0x02 };
+ uint8_t tag2[] = { 0x55,0xC8,0x7A,0x00,0x00,0x00,0x00,0x00,0x00,0x25,0x1A,0xC6 };
Buffer->Set(tag1, sizeof(tag1));
Buffer->Append(Packet.GetStreamId());
- Buffer->Append((uint8)((Packet.GetPacketId() % 21) | 0x40));
+ Buffer->Append((uint8_t)((Packet.GetPacketId() % 21) | 0x40));
Buffer->Append(tag2, sizeof(tag2));
return true;
diff --git a/src/G3Protocol.h b/src/G3Protocol.h
index ea260ca..cb3e5bf 100644
--- a/src/G3Protocol.h
+++ b/src/G3Protocol.h
@@ -1,29 +1,22 @@
-//
-// G3Protocol.h
-// xlxd
-//
-// Created by Marius Petrescu (YO2LOJ) on 03/06/2019.
// Copyright © 2019 Marius Petrescu (YO2LOJ). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cg3protocol_h
-#define cg3protocol_h
+#pragma once
#include
#include "Timer.h"
@@ -67,7 +60,7 @@ public:
CG3Protocol() : m_GwAddress(0u), m_Modules("*"), m_LastModTime(0) {}
// initialization
- bool Initialize(const char *type, const int ptype, const uint16 port, const bool has_ipv4, const bool has_ipv6);
+ bool Initialize(const char *type, const int ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6);
// close
void Close(void);
@@ -116,7 +109,7 @@ protected:
std::future m_PresenceFuture, m_ConfigFuture, m_IcmpFuture;
// time
- CTimePoint m_LastKeepaliveTime;
+ CTimer m_LastKeepaliveTime;
// sockets
CUdpSocket m_PresenceSocket;
@@ -124,10 +117,7 @@ protected:
CRawSocket m_IcmpRawSocket;
// optional params
- uint32 m_GwAddress;
+ uint32_t m_GwAddress;
std::string m_Modules;
time_t m_LastModTime;
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cg3protocol_h */
diff --git a/src/GateKeeper.cpp b/src/GateKeeper.cpp
index 744331a..403f239 100644
--- a/src/GateKeeper.cpp
+++ b/src/GateKeeper.cpp
@@ -1,26 +1,20 @@
-//
-// cgatekeeper.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 07/11/2015.
-// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
-//
-// ----------------------------------------------------------------------------
-// This file is part of xlxd.
+// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
#include "Timer.h"
@@ -185,7 +179,7 @@ void CGateKeeper::Thread()
{
// Wait 30 seconds
for (int i=0; i<15 && keep_running; i++)
- CTimePoint::TaskSleepFor(2000);
+ std::this_thread::sleep_for(std::chrono::milliseconds(2000));
// have lists files changed ?
if ( m_NodeWhiteList.NeedReload() )
diff --git a/src/GateKeeper.h b/src/GateKeeper.h
index bff57ed..1358a9d 100644
--- a/src/GateKeeper.h
+++ b/src/GateKeeper.h
@@ -1,29 +1,23 @@
-//
-// GateKeeper.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 07/11/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cgatekeeper_h
-#define cgatekeeper_h
+
+#pragma once
#include "Main.h"
#include "Callsign.h"
@@ -74,7 +68,3 @@ protected:
std::atomic keep_running;
std::future m_Future;
};
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cgatekeeper_h */
diff --git a/src/IP.cpp b/src/IP.cpp
index 48a3b6f..44c58df 100644
--- a/src/IP.cpp
+++ b/src/IP.cpp
@@ -1,26 +1,25 @@
-/*
-* Copyright (C) 2020 by Thomas 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 2 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
+
+// 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 .
#include
#include
#include
#include
-#include "cip.h"
+#include "IP.h"
CIp::CIp() : is_set(false)
{
diff --git a/src/IP.h b/src/IP.h
index 5f7976b..bedc054 100644
--- a/src/IP.h
+++ b/src/IP.h
@@ -1,22 +1,21 @@
#pragma once
-/*
- * Copyright (C) 2020 by Thomas 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 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
+
+// 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 .
#include
#include
diff --git a/src/Main.cpp b/src/Main.cpp
index feea1ca..f8ade4e 100644
--- a/src/Main.cpp
+++ b/src/Main.cpp
@@ -1,26 +1,20 @@
-//
-// main.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 31/10/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
#include "Reflector.h"
diff --git a/src/Main.h b/src/Main.h
index 8d122e1..9551d49 100644
--- a/src/Main.h
+++ b/src/Main.h
@@ -1,30 +1,22 @@
-//
-// Main.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 31/10/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
-// Copyright © 2020 Thomas A. Eary, N7TAE
-//
-// ----------------------------------------------------------------------------
-// This file is part of xlxd.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef main_h
-#define main_h
+#pragma once
#include
#include
@@ -209,26 +201,18 @@
#define PIDFILE_PATH "/var/run/xlxd.pid"
#endif
-////////////////////////////////////////////////////////////////////////////////////////
-// typedefs
-
-typedef unsigned char uint8;
-typedef unsigned short uint16;
-typedef unsigned int uint32;
-typedef unsigned int uint;
-
////////////////////////////////////////////////////////////////////////////////////////
// macros
#define MIN(a,b) ((a)<(b))?(a):(b)
#define MAX(a,b) ((a)>(b))?(a):(b)
-#define MAKEWORD(low, high) ((uint16)(((uint8)(low)) | (((uint16)((uint8)(high))) << 8)))
-#define MAKEDWORD(low, high) ((uint32)(((uint16)(low)) | (((uint32)((uint16)(high))) << 16)))
-#define LOBYTE(w) ((uint8)(uint16)(w & 0x00FF))
-#define HIBYTE(w) ((uint8)((((uint16)(w)) >> 8) & 0xFF))
-#define LOWORD(dw) ((uint16)(uint32)(dw & 0x0000FFFF))
-#define HIWORD(dw) ((uint16)((((uint32)(dw)) >> 16) & 0xFFFF))
+#define MAKEWORD(low, high) ((uint16_t)(((uint8_t)(low)) | (((uint16_t)((uint8_t)(high))) << 8)))
+#define MAKEDWORD(low, high) ((uint32_t)(((uint16_t)(low)) | (((uint32_t)((uint16_t)(high))) << 16)))
+#define LOBYTE(w) ((uint8_t)(uint16_t)(w & 0x00FF))
+#define HIBYTE(w) ((uint8_t)((((uint16_t)(w)) >> 8) & 0xFF))
+#define LOWORD(dw) ((uint16_t)(uint32_t)(dw & 0x0000FFFF))
+#define HIWORD(dw) ((uint16_t)((((uint32_t)(dw)) >> 16) & 0xFFFF))
////////////////////////////////////////////////////////////////////////////////////////
// global objects
@@ -259,7 +243,3 @@ extern CYsfNodeDirFile g_YsfNodeDir;
class CTranscoder;
extern CTranscoder g_Transcoder;
#endif
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* main_h */
diff --git a/src/Notification.cpp b/src/Notification.cpp
index f01e325..aedb696 100644
--- a/src/Notification.cpp
+++ b/src/Notification.cpp
@@ -1,32 +1,23 @@
-//
-// cnotification.cpp
-// xlxd
-//
-// Created by Jean-Luc on 05/12/2015.
// Copyright © 2015 Jean-Luc. All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
-#include "cnotification.h"
-
-////////////////////////////////////////////////////////////////////////////////////////
-// constructor
+#include "Notification.h"
CNotification::CNotification()
{
diff --git a/src/Notification.h b/src/Notification.h
index f5db212..53b6296 100644
--- a/src/Notification.h
+++ b/src/Notification.h
@@ -1,30 +1,22 @@
-//
-// cnotification.h
-// xlxd
-//
-// Created by Jean-Luc on 05/12/2015.
// Copyright © 2015 Jean-Luc. All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-
-#ifndef cnotification_h
-#define cnotification_h
+#pragma once
#include "Callsign.h"
@@ -59,6 +51,3 @@ protected:
CCallsign m_Callsign;
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cnotification_h */
diff --git a/src/NotificationQueue.h b/src/NotificationQueue.h
new file mode 100644
index 0000000..ae5e644
--- /dev/null
+++ b/src/NotificationQueue.h
@@ -0,0 +1,55 @@
+// Copyright © 2015 Jean-Luc. All rights reserved.
+
+// 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 .
+
+#pragma once
+
+#include
+#include
+
+#include "Notification.h"
+
+
+////////////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////////////
+// class
+
+class CNotificationQueue
+{
+public:
+ // constructor
+ CNotificationQueue() {}
+
+ // destructor
+ ~CNotificationQueue() {}
+
+ // lock
+ void Lock() { m_Mutex.lock(); }
+ void Unlock() { m_Mutex.unlock(); }
+
+ // pass thru
+ CNotification front() { return queue.front(); }
+ void pop() { queue.pop(); }
+ void push(CNotification note) { queue.push(note); }
+ bool empty() const { return queue.empty(); }
+
+protected:
+ // data
+ std::mutex m_Mutex;
+ std::queue queue;
+};
diff --git a/src/Packet.cpp b/src/Packet.cpp
index 2adf718..7dd42f4 100644
--- a/src/Packet.cpp
+++ b/src/Packet.cpp
@@ -1,35 +1,24 @@
-//
-// cpacket.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 04/11/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
#include "Packet.h"
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-// constructor
-
CPacket::CPacket()
{
m_uiStreamId = 0;
@@ -45,7 +34,7 @@ CPacket::CPacket()
// dstar contrsuctor
-CPacket::CPacket(uint16 sid, uint8 dstarpid)
+CPacket::CPacket(uint16_t sid, uint8_t dstarpid)
{
m_uiStreamId = sid;
m_uiDstarPacketId = dstarpid;
@@ -60,7 +49,7 @@ CPacket::CPacket(uint16 sid, uint8 dstarpid)
// dmr constructor
-CPacket::CPacket(uint16 sid, uint8 dmrpid, uint8 dmrspid)
+CPacket::CPacket(uint16_t sid, uint8_t dmrpid, uint8_t dmrspid)
{
m_uiStreamId = sid;
m_uiDmrPacketId = dmrpid;
@@ -75,7 +64,7 @@ CPacket::CPacket(uint16 sid, uint8 dmrpid, uint8 dmrspid)
// ysf constructor
-CPacket::CPacket(uint16 sid, uint8 ysfpid, uint8 ysfsubpid, uint8 ysffrid)
+CPacket::CPacket(uint16_t sid, uint8_t ysfpid, uint8_t ysfsubpid, uint8_t ysffrid)
{
m_uiStreamId = sid;
m_uiYsfPacketId = ysfpid;
@@ -90,7 +79,7 @@ CPacket::CPacket(uint16 sid, uint8 ysfpid, uint8 ysfsubpid, uint8 ysffrid)
// xlx constructor
-CPacket::CPacket(uint16 sid, uint8 dstarpid, uint8 dmrpid, uint8 dmrsubpid, uint8 ysfpid, uint8 ysfsubpid, uint8 ysffrid)
+CPacket::CPacket(uint16_t sid, uint8_t dstarpid, uint8_t dmrpid, uint8_t dmrsubpid, uint8_t ysfpid, uint8_t ysfsubpid, uint8_t ysffrid)
{
m_uiStreamId = sid;
m_uiDstarPacketId = dstarpid;
@@ -106,7 +95,7 @@ CPacket::CPacket(uint16 sid, uint8 dstarpid, uint8 dmrpid, uint8 dmrsubpid, uint
////////////////////////////////////////////////////////////////////////////////////////
// pid conversion
-void CPacket::UpdatePids(uint32 pid)
+void CPacket::UpdatePids(uint32_t pid)
{
// called while phusing this packet in a stream queue
// so now packet sequence number is known and undefined pids can be updated
diff --git a/src/Packet.h b/src/Packet.h
index 8a68277..078c3c0 100644
--- a/src/Packet.h
+++ b/src/Packet.h
@@ -1,29 +1,22 @@
-//
-// Packet.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 01/11/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cpacket_h
-#define cpacket_h
+#pragma once
////////////////////////////////////////////////////////////////////////////////////////
@@ -40,10 +33,10 @@ class CPacket
public:
// constructor
CPacket();
- CPacket(uint16 sid, uint8 dstarpid);
- CPacket(uint16 sid, uint8 dmrpid, uint8 dmrsubpid);
- CPacket(uint16 sid, uint8 ysfpid, uint8 ysfsubpid, uint8 ysfsubpidmax);
- CPacket(uint16 sid, uint8 dstarpid, uint8 dmrpid, uint8 dmrsubpid, uint8 ysfpid, uint8 ysfsubpid, uint8 ysfsubpidmax);
+ CPacket(uint16_t sid, uint8_t dstarpid);
+ CPacket(uint16_t sid, uint8_t dmrpid, uint8_t dmrsubpid);
+ CPacket(uint16_t sid, uint8_t ysfpid, uint8_t ysfsubpid, uint8_t ysfsubpidmax);
+ CPacket(uint16_t sid, uint8_t dstarpid, uint8_t dmrpid, uint8_t dmrsubpid, uint8_t ysfpid, uint8_t ysfsubpid, uint8_t ysfsubpidmax);
// destructor
virtual ~CPacket() {}
@@ -59,37 +52,32 @@ public:
// get
virtual bool IsValid(void) const { return true; }
- uint16 GetStreamId(void) const { return m_uiStreamId; }
- uint8 GetPacketId(void) const { return m_uiDstarPacketId; }
- uint8 GetDstarPacketId(void) const { return m_uiDstarPacketId; }
- uint8 GetDmrPacketId(void) const { return m_uiDmrPacketId; }
- uint8 GetDmrPacketSubid(void) const { return m_uiDmrPacketSubid; }
- uint8 GetYsfPacketId(void) const { return m_uiYsfPacketId; }
- uint8 GetYsfPacketSubId(void) const { return m_uiYsfPacketSubId; }
- uint8 GetYsfPacketFrameId(void) const { return m_uiYsfPacketFrameId; }
- uint8 GetModuleId(void) const { return m_uiModuleId; }
+ uint16_t GetStreamId(void) const { return m_uiStreamId; }
+ uint8_t GetPacketId(void) const { return m_uiDstarPacketId; }
+ uint8_t GetDstarPacketId(void) const { return m_uiDstarPacketId; }
+ uint8_t GetDmrPacketId(void) const { return m_uiDmrPacketId; }
+ uint8_t GetDmrPacketSubid(void) const { return m_uiDmrPacketSubid; }
+ uint8_t GetYsfPacketId(void) const { return m_uiYsfPacketId; }
+ uint8_t GetYsfPacketSubId(void) const { return m_uiYsfPacketSubId; }
+ uint8_t GetYsfPacketFrameId(void) const { return m_uiYsfPacketFrameId; }
+ uint8_t GetModuleId(void) const { return m_uiModuleId; }
bool IsLocalOrigin(void) const { return (m_uiOriginId == ORIGIN_LOCAL); }
// set
- void UpdatePids(uint32);
- void SetModuleId(uint8 uiId) { m_uiModuleId = uiId; }
+ void UpdatePids(uint32_t);
+ void SetModuleId(uint8_t uiId) { m_uiModuleId = uiId; }
void SetLocalOrigin(void) { m_uiOriginId = ORIGIN_LOCAL; }
void SetRemotePeerOrigin(void) { m_uiOriginId = ORIGIN_PEER; }
protected:
// data
- uint16 m_uiStreamId;
- uint8 m_uiDstarPacketId;
- uint8 m_uiDmrPacketId;
- uint8 m_uiDmrPacketSubid;
- uint8 m_uiYsfPacketId;
- uint8 m_uiYsfPacketSubId;
- uint8 m_uiYsfPacketFrameId;
- uint8 m_uiModuleId;
- uint8 m_uiOriginId;
+ uint16_t m_uiStreamId;
+ uint8_t m_uiDstarPacketId;
+ uint8_t m_uiDmrPacketId;
+ uint8_t m_uiDmrPacketSubid;
+ uint8_t m_uiYsfPacketId;
+ uint8_t m_uiYsfPacketSubId;
+ uint8_t m_uiYsfPacketFrameId;
+ uint8_t m_uiModuleId;
+ uint8_t m_uiOriginId;
};
-
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cpacket_h */
diff --git a/src/PacketQueue.h b/src/PacketQueue.h
index 912b92d..625b62d 100644
--- a/src/PacketQueue.h
+++ b/src/PacketQueue.h
@@ -1,30 +1,22 @@
-//
-// PacketQueue.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 02/11/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
-// Copyright © 2020 Thomas A. Early, N7TAE
-//
-// ----------------------------------------------------------------------------
-// This file is part of xlxd.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cpacketqueue_h
-#define cpacketqueue_h
+#pragma once
#include "Packet.h"
#include "Client.h"
@@ -55,13 +47,10 @@ public:
protected:
// status
bool m_bOpen;
- uint16 m_uiStreamId;
+ uint16_t m_uiStreamId;
std::mutex m_Mutex;
// owner
CClient *m_Client;
std::queue> queue;
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cpacketqueue_h */
diff --git a/src/PacketStream.cpp b/src/PacketStream.cpp
index a39b0d2..067bb57 100644
--- a/src/PacketStream.cpp
+++ b/src/PacketStream.cpp
@@ -1,26 +1,20 @@
-//
-// cpacketstream.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 06/11/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
#include "PacketStream.h"
@@ -55,7 +49,7 @@ bool CPacketStream::OpenPacketStream(const CDvHeaderPacket &DvHeader, std::share
m_uiPacketCntr = 0;
m_DvHeader = DvHeader;
m_OwnerClient = client;
- m_LastPacketTime.Now();
+ m_LastPacketTime.start();
#ifdef TRANSCODER_IP
if (std::string::npos != std::string(TRANSCODED_MODULES).find(DvHeader.GetRpt2Module()))
m_CodecStream = g_Transcoder.GetCodecStream(this, client->GetCodec());
@@ -85,7 +79,7 @@ void CPacketStream::ClosePacketStream(void)
void CPacketStream::Push(std::unique_ptr Packet)
{
// update stream dependent packet data
- m_LastPacketTime.Now();
+ m_LastPacketTime.start();
Packet->UpdatePids(m_uiPacketCntr++);
// transcoder avaliable ?
#ifdef TRANSCODER_IP
diff --git a/src/PacketStream.h b/src/PacketStream.h
index eaa3ad1..3765c66 100644
--- a/src/PacketStream.h
+++ b/src/PacketStream.h
@@ -1,29 +1,22 @@
-//
-// PacketStream.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 06/11/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cpacketstream_h
-#define cpacketstream_h
+#pragma once
#include "PacketQueue.h"
#include "Timer.h"
@@ -50,29 +43,26 @@ public:
// push & pop
void Push(std::unique_ptr packet);
- void Tickle(void) { m_LastPacketTime.Now(); }
+ void Tickle(void) { m_LastPacketTime.start(); }
bool IsEmpty(void) const;
// get
std::shared_ptr GetOwnerClient(void) { return m_OwnerClient; }
const CIp *GetOwnerIp(void);
- bool IsExpired(void) const { return (m_LastPacketTime.DurationSinceNow() > STREAM_TIMEOUT); }
+ bool IsExpired(void) const { return (m_LastPacketTime.time() > STREAM_TIMEOUT); }
bool IsOpen(void) const { return m_bOpen; }
- uint16 GetStreamId(void) const { return m_uiStreamId; }
+ uint16_t GetStreamId(void) const { return m_uiStreamId; }
const CCallsign &GetUserCallsign(void) const { return m_DvHeader.GetMyCallsign(); }
protected:
// data
bool m_bOpen;
- uint16 m_uiStreamId;
- uint32 m_uiPacketCntr;
- CTimePoint m_LastPacketTime;
+ uint16_t m_uiStreamId;
+ uint32_t m_uiPacketCntr;
+ CTimer m_LastPacketTime;
CDvHeaderPacket m_DvHeader;
std::shared_ptr m_OwnerClient;
#ifdef TRANSCODER_IP
std::shared_ptr m_CodecStream;
#endif
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cpacketstream_h */
diff --git a/src/Peer.cpp b/src/Peer.cpp
index a54006f..17632a4 100644
--- a/src/Peer.cpp
+++ b/src/Peer.cpp
@@ -1,27 +1,20 @@
-//
-// cpeer.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 10/12/2016.
// Copyright © 2016 Jean-Luc Deltombe (LX3JL). All rights reserved.
-// Copyright © 2020 Thomas A. Early, N7TAE
-//
-// ----------------------------------------------------------------------------
-// This file is part of xlxd.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
#include
@@ -47,7 +40,7 @@ CPeer::CPeer(const CCallsign &callsign, const CIp &ip, const char *modules, cons
::memset(m_ReflectorModules, 0, sizeof(m_ReflectorModules));
::strncpy(m_ReflectorModules, modules, sizeof(m_ReflectorModules)-1);
m_Version = version;
- m_LastKeepaliveTime.Now();
+ m_LastKeepaliveTime.start();
m_ConnectTime = std::time(nullptr);
m_LastHeardTime = std::time(nullptr);
}
@@ -103,7 +96,7 @@ bool CPeer::IsAMaster(void) const
void CPeer::Alive(void)
{
- m_LastKeepaliveTime.Now();
+ m_LastKeepaliveTime.start();
for ( auto it=begin(); it!=end(); it++ )
{
(*it)->Alive();
diff --git a/src/Peer.h b/src/Peer.h
index d70bc94..a2ac046 100644
--- a/src/Peer.h
+++ b/src/Peer.h
@@ -1,30 +1,22 @@
-//
-// Peer.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 10/12/2016.
// Copyright © 2016 Jean-Luc Deltombe (LX3JL). All rights reserved.
-// Copyright © 2020 Thomas A. Early, N7TAE
-//
-// ----------------------------------------------------------------------------
-// This file is part of xlxd.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cpeer_h
-#define cpeer_h
+#pragma once
#include "Version.h"
#include "Timer.h"
@@ -32,12 +24,6 @@
#include "Callsign.h"
#include "Client.h"
-////////////////////////////////////////////////////////////////////////////////////////
-//
-
-////////////////////////////////////////////////////////////////////////////////////////
-// class
-
class CPeer
{
public:
@@ -93,10 +79,7 @@ protected:
std::list> m_Clients;
// status
- CTimePoint m_LastKeepaliveTime;
+ CTimer m_LastKeepaliveTime;
std::time_t m_ConnectTime;
std::time_t m_LastHeardTime;
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cpeer_h */
diff --git a/src/PeerCallsignList.cpp b/src/PeerCallsignList.cpp
index 5128d5f..432067d 100644
--- a/src/PeerCallsignList.cpp
+++ b/src/PeerCallsignList.cpp
@@ -1,35 +1,25 @@
-//
-// cxlxcallsignlist.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 31/01/2016.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include
#include "Main.h"
#include "PeerCallsignList.h"
-
-////////////////////////////////////////////////////////////////////////////////////////
-// file io
-
bool CPeerCallsignList::LoadFromFile(const char *filename)
{
bool ok = false;
diff --git a/src/PeerCallsignList.h b/src/PeerCallsignList.h
index 24bf536..7527ed0 100644
--- a/src/PeerCallsignList.h
+++ b/src/PeerCallsignList.h
@@ -1,31 +1,22 @@
-//
-// PeerCallsignList.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 31/01/2016.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
-
-
-#ifndef cpeercallsignlist_h
-#define cpeercallsignlist_h
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+#pragma once
#include "Main.h"
#include "CallsignList.h"
@@ -45,7 +36,3 @@ public:
// file io
bool LoadFromFile(const char *);
};
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cpeercallsignlist_h */
diff --git a/src/Peers.cpp b/src/Peers.cpp
index 9aa1d8b..ce53ed3 100644
--- a/src/Peers.cpp
+++ b/src/Peers.cpp
@@ -1,27 +1,20 @@
-//
-// cpeers.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 10/12/2016.
// Copyright © 2016 Jean-Luc Deltombe (LX3JL). All rights reserved.
-// Copyright © 2020 Thomas A. Early, N7TAE
-//
-// ----------------------------------------------------------------------------
-// This file is part of xlxd.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
#include "Reflector.h"
diff --git a/src/Peers.h b/src/Peers.h
index 4cbb046..944903c 100644
--- a/src/Peers.h
+++ b/src/Peers.h
@@ -1,41 +1,25 @@
-//
-// Peers.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 10/12/2016.
// Copyright © 2016 Jean-Luc Deltombe (LX3JL). All rights reserved.
-// Copyright © 2020 Thomas A. Early, N7TAE
-//
-// ----------------------------------------------------------------------------
-// This file is part of xlxd.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cpeers_h
-#define cpeers_h
+#pragma once
#include "Peer.h"
-
-////////////////////////////////////////////////////////////////////////////////////////
-// define
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-// class
-
class CPeers
{
public:
@@ -73,7 +57,3 @@ protected:
std::mutex m_Mutex;
std::list> m_Peers;
};
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cpeers_h */
diff --git a/src/ProtoAddress.cpp b/src/ProtoAddress.cpp
index 6d2e612..55235d4 100644
--- a/src/ProtoAddress.cpp
+++ b/src/ProtoAddress.cpp
@@ -1,22 +1,18 @@
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// Copyright © 2020 Thomas A. Eary, 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 file is part of xlxd.
+// 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.
//
-// 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 .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "ProtoAddress.h"
diff --git a/src/ProtoAddress.h b/src/ProtoAddress.h
index f4a1d78..7a6d437 100644
--- a/src/ProtoAddress.h
+++ b/src/ProtoAddress.h
@@ -1,24 +1,20 @@
-#pragma once
-
-//
-// Copyright © 2020 Thomas A. Eary, N7TAE
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// This file is part of xlxd.
+// 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.
//
-// 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.
+// 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.
//
-// 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 .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+
+#pragma once
#include
#include
diff --git a/src/Protocol.cpp b/src/Protocol.cpp
index 9b8e4bb..b0a3f29 100644
--- a/src/Protocol.cpp
+++ b/src/Protocol.cpp
@@ -1,27 +1,20 @@
-//
-// cprotocol.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 01/11/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
-// Copyright © 2020 Thomas A. Early, N7TAE
-//
-// ----------------------------------------------------------------------------
-// This file is part of xlxd.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
#include "DCSProtocol.h"
@@ -56,7 +49,7 @@ CProtocol::~CProtocol()
////////////////////////////////////////////////////////////////////////////////////////
// initialization
-bool CProtocol::Initialize(const char *type, int ptype, const uint16 port, const bool has_ipv4, const bool has_ipv6)
+bool CProtocol::Initialize(const char *type, int ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6)
{
// init reflector apparent callsign
m_ReflectorCallsign = g_Reflector.GetCallsign();
@@ -66,7 +59,7 @@ bool CProtocol::Initialize(const char *type, int ptype, const uint16 port, const
// update the reflector callsign
if (type)
- m_ReflectorCallsign.PatchCallsign(0, (const uint8 *)type, 3);
+ m_ReflectorCallsign.PatchCallsign(0, (const uint8_t *)type, 3);
// create our sockets
#ifdef LISTEN_IPV4
@@ -199,7 +192,7 @@ void CProtocol::OnDvLastFramePacketIn(std::unique_ptr &Frame
////////////////////////////////////////////////////////////////////////////////////////
// stream handle helpers
-CPacketStream *CProtocol::GetStream(uint16 uiStreamId, const CIp *Ip)
+CPacketStream *CProtocol::GetStream(uint16_t uiStreamId, const CIp *Ip)
{
for ( auto it=m_Streams.begin(); it!=m_Streams.end(); it++ )
{
@@ -261,14 +254,14 @@ bool CProtocol::IsSpace(char c) const
////////////////////////////////////////////////////////////////////////////////////////
// DestId to Module helper
-char CProtocol::DmrDstIdToModule(uint32 tg) const
+char CProtocol::DmrDstIdToModule(uint32_t tg) const
{
return ((char)((tg % 26)-1) + 'A');
}
-uint32 CProtocol::ModuleToDmrDestId(char m) const
+uint32_t CProtocol::ModuleToDmrDestId(char m) const
{
- return (uint32)(m - 'A')+1;
+ return (uint32_t)(m - 'A')+1;
}
////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/Protocol.h b/src/Protocol.h
index 7538d31..ef394ca 100644
--- a/src/Protocol.h
+++ b/src/Protocol.h
@@ -1,30 +1,22 @@
-//
-// DCSProtocol.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 01/11/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
-// Copyright © 2020 Thomas A. Early, N7TAE
-//
-// ----------------------------------------------------------------------------
-// This file is part of xlxd.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cprotocol_h
-#define cprotocol_h
+#pragma once
#include "UDPSocket.h"
#include "PacketStream.h"
@@ -77,7 +69,7 @@ public:
virtual ~CProtocol();
// initialization
- virtual bool Initialize(const char *type, const int ptype, const uint16 port, const bool has_ipv4, const bool has_ipv6);
+ virtual bool Initialize(const char *type, const int ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6);
virtual void Close(void);
// queue
@@ -104,7 +96,7 @@ protected:
virtual void OnDvLastFramePacketIn(std::unique_ptr &, const CIp * = nullptr);
// stream handle helpers
- CPacketStream *GetStream(uint16, const CIp * = nullptr);
+ CPacketStream *GetStream(uint16_t, const CIp * = nullptr);
void CheckStreamsTimeout(void);
// queue helper
@@ -119,8 +111,8 @@ protected:
bool IsSpace(char) const;
// dmr DstId to Module helper
- virtual char DmrDstIdToModule(uint32) const;
- virtual uint32 ModuleToDmrDestId(char) const;
+ virtual char DmrDstIdToModule(uint32_t) const;
+ virtual uint32_t ModuleToDmrDestId(char) const;
bool Receive6(CBuffer &buf, CIp &Ip, int time_ms);
bool Receive4(CBuffer &buf, CIp &Ip, int time_ms);
@@ -128,8 +120,8 @@ protected:
void Send(const CBuffer &buf, const CIp &Ip) const;
void Send(const char *buf, const CIp &Ip) const;
- void Send(const CBuffer &buf, const CIp &Ip, uint16 port) const;
- void Send(const char *buf, const CIp &Ip, uint16 port) const;
+ void Send(const CBuffer &buf, const CIp &Ip, uint16_t port) const;
+ void Send(const char *buf, const CIp &Ip, uint16_t port) const;
// socket
CUdpSocket m_Socket4;
@@ -149,8 +141,5 @@ protected:
CCallsign m_ReflectorCallsign;
// debug
- CTimePoint m_DebugTimer;
+ CTimer m_DebugTimer;
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cprotocol_h */
diff --git a/src/Protocols.cpp b/src/Protocols.cpp
index 6769be4..a284fca 100644
--- a/src/Protocols.cpp
+++ b/src/Protocols.cpp
@@ -1,36 +1,29 @@
-//
-// cprotocols.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 01/11/2015.
-// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
-// Copyright © 2020 Thomas A. Early, N7TAE
-//
-// ----------------------------------------------------------------------------
-// This file is part of xlxd.
+// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
#include "DExtraProtocol.h"
#include "DPlusProtocol.h"
-#include "cdcsprotocol.h"
+#include "DCSProtocol.h"
#ifndef NO_XLX
#include "ULXProtocol.h"
#include "DMRPlusProtocol.h"
-#include "DMMMDVMProtocol.h"
+#include "DMRMMDVMProtocol.h"
#include "YSFProtocol.h"
#endif
#ifndef NO_G3
diff --git a/src/Protocols.h b/src/Protocols.h
index 889966d..3ef32ed 100644
--- a/src/Protocols.h
+++ b/src/Protocols.h
@@ -1,40 +1,25 @@
-//
-// Protocols.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 01/11/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cprotocols_h
-#define cprotocols_h
+#pragma once
#include "DCSProtocol.h"
-
-////////////////////////////////////////////////////////////////////////////////////////
-// define
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-// class
-
class CProtocols
{
public:
@@ -56,8 +41,3 @@ protected:
std::mutex m_Mutex;
std::list> m_Protocols;
};
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-
-#endif /* cprotocols_h */
diff --git a/src/RawSocket.cpp b/src/RawSocket.cpp
index 990f5ca..a763880 100644
--- a/src/RawSocket.cpp
+++ b/src/RawSocket.cpp
@@ -1,26 +1,20 @@
-//
-// crawsocket.cpp
-// xlxd
-//
-// Created by Marius Petrescu (YO2LOJ) on 22/02/2020.
// Copyright © 2020 Marius Petrescu (YO2LOJ). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
#include
@@ -50,7 +44,7 @@ CRawSocket::~CRawSocket()
////////////////////////////////////////////////////////////////////////////////////////
// open & close
-bool CRawSocket::Open(uint16 uiProto)
+bool CRawSocket::Open(uint16_t uiProto)
{
bool open = false;
int on = 1;
diff --git a/src/RawSocket.h b/src/RawSocket.h
index f0bcbc9..2b902b0 100644
--- a/src/RawSocket.h
+++ b/src/RawSocket.h
@@ -1,33 +1,22 @@
-//
-// RawSocket.h
-// xlxd
-//
-// Created by Marius Petrescu (YO2LOJ) on 22/02/2020.
// Copyright © 2020 Marius Petrescu (YO2LOJ). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-// Description:
-// Raw socket access class with protocol specific
-
-
-#ifndef crawsocket_h
-#define crawsocket_h
+#pragma once
#include
#include
@@ -60,7 +49,7 @@ public:
~CRawSocket();
// open & close
- bool Open(uint16);
+ bool Open(uint16_t);
void Close(void);
int GetSocket(void) { return m_Socket; }
@@ -96,6 +85,3 @@ protected:
int m_Proto;
struct sockaddr_in m_SocketAddr;
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* crawsocket_h */
diff --git a/src/Reflector.cpp b/src/Reflector.cpp
index 3e28d70..3a8b8a3 100644
--- a/src/Reflector.cpp
+++ b/src/Reflector.cpp
@@ -1,37 +1,30 @@
-//
-// creflector.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 31/10/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
-// Copyright © 2020 Thomas A. Early, N7TAE
-//
-// ----------------------------------------------------------------------------
-// This file is part of xlxd.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
#include
#include "Reflector.h"
#include "GateKeeper.h"
-#include "cdmriddirfile.h"
+#include "DMRIdDirFile.h"
#include "DMRIdDirHttp.h"
#include "Transcoder.h"
#include "YSFNodeDirFile.h"
-#include "YSFNodeDirhttp.h"
+#include "YSFNodeDirHttp.h"
////////////////////////////////////////////////////////////////////////////////////////
// constructor
@@ -243,7 +236,7 @@ void CReflector::CloseStream(CPacketStream *stream)
bEmpty = stream->empty();
stream->Unlock();
if ( !bEmpty )
- CTimePoint::TaskSleepFor(10);
+ std::this_thread::sleep_for(std::chrono::milliseconds(10));
}
while (!bEmpty);
@@ -282,7 +275,7 @@ void CReflector::CloseStream(CPacketStream *stream)
void CReflector::RouterThread(CPacketStream *streamIn)
{
// get our module
- uint8 uiModuleId = GetStreamModule(streamIn);
+ uint8_t uiModuleId = GetStreamModule(streamIn);
// get on input queue
std::unique_ptr packet;
@@ -334,7 +327,7 @@ void CReflector::RouterThread(CPacketStream *streamIn)
}
else
{
- CTimePoint::TaskSleepFor(10);
+ std::this_thread::sleep_for(std::chrono::milliseconds(10));
}
}
}
@@ -366,7 +359,7 @@ void CReflector::XmlReportThread()
// and wait a bit
for (int i=0; i< XML_UPDATE_PERIOD && keep_running; i++)
- CTimePoint::TaskSleepFor(1000);
+ std::this_thread::sleep_for(std::chrono::milliseconds(1000));
}
}
@@ -391,7 +384,7 @@ void CReflector::JsonReportThread()
if ( Socket.Receive(Buffer, Ip, 50) )
{
// check verb
- if ( Buffer.Compare((uint8 *)"hello", 5) == 0 )
+ if ( Buffer.Compare((uint8_t *)"hello", 5) == 0 )
{
std::cout << "Monitor socket connected with " << Ip << std::endl;
@@ -405,7 +398,7 @@ void CReflector::JsonReportThread()
SendJsonNodesObject(Socket, Ip);
SendJsonStationsObject(Socket, Ip);
}
- else if ( Buffer.Compare((uint8 *)"bye", 3) == 0 )
+ else if ( Buffer.Compare((uint8_t *)"bye", 3) == 0 )
{
std::cout << "Monitor socket disconnected" << std::endl;
@@ -451,7 +444,7 @@ void CReflector::JsonReportThread()
case NOTIFICATION_NONE:
default:
// nothing to do, just sleep a bit
- CTimePoint::TaskSleepFor(250);
+ std::this_thread::sleep_for(std::chrono::milliseconds(250);
break;
}
}
@@ -623,7 +616,7 @@ void CReflector::SendJsonReflectorObject(CUdpSocket &Socket, CIp &Ip)
char mod[8] = "\"A\"";
// get reflector callsign
- m_Callsign.GetCallsign((uint8 *)cs);
+ m_Callsign.GetCallsign((uint8_t *)cs);
cs[CALLSIGN_LEN] = 0;
// build string
diff --git a/src/Reflector.h b/src/Reflector.h
index 55a6292..3ca23e7 100644
--- a/src/Reflector.h
+++ b/src/Reflector.h
@@ -1,30 +1,22 @@
-//
-// Reflector.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 31/10/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
-// Copyright © 2020 Thomas A. Early, N7TAE
-//
-// ----------------------------------------------------------------------------
-// This file is part of xlxd.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef creflector_h
-#define creflector_h
+#pragma once
#include "ProtoAddress.h"
#include "Users.h"
@@ -155,6 +147,3 @@ public:
std::ofstream m_DebugFile;
#endif
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* creflector_h */
diff --git a/src/Semaphore.cpp b/src/Semaphore.cpp
index fa1f94f..6ac4984 100644
--- a/src/Semaphore.cpp
+++ b/src/Semaphore.cpp
@@ -1,26 +1,20 @@
-//
-// csemaphore.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 16/04/2017.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
#include "Semaphore.h"
@@ -57,7 +51,7 @@ void CSemaphore::Wait(void)
m_Count--;
}
-bool CSemaphore::WaitFor(uint ms)
+bool CSemaphore::WaitFor(unsigned ms)
{
std::chrono::milliseconds timespan(ms);
std::unique_lock lock(m_Mutex);
diff --git a/src/Semaphore.h b/src/Semaphore.h
index 4fa03bd..c1c47cd 100644
--- a/src/Semaphore.h
+++ b/src/Semaphore.h
@@ -1,33 +1,24 @@
-//
-// Semaphore.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 16/04/2017.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
-
-#ifndef csemaphore_h
-#define csemaphore_h
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+#pragma once
-////////////////////////////////////////////////////////////////////////////////////////
-// class
+#include "Main.h"
class CSemaphore
{
@@ -42,7 +33,7 @@ public:
void Reset(void);
void Notify(void);
void Wait(void);
- bool WaitFor(uint);
+ bool WaitFor(unsigned);
protected:
// data
@@ -51,6 +42,3 @@ protected:
size_t m_Count;
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* csemaphore_h */
diff --git a/src/Timer.h b/src/Timer.h
index 08747af..36eb4e0 100644
--- a/src/Timer.h
+++ b/src/Timer.h
@@ -1,16 +1,16 @@
-// hyvoc - a hybrid vocoder using DVSI hardware and Codec2 software
+// 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 .
diff --git a/src/Transcoder.cpp b/src/Transcoder.cpp
index b4a8b42..1f3d1b3 100644
--- a/src/Transcoder.cpp
+++ b/src/Transcoder.cpp
@@ -1,26 +1,20 @@
-//
-// ctranscoder.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 13/04/2017.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
#include "Reflector.h"
@@ -48,8 +42,8 @@ CTranscoder::CTranscoder()
{
keep_running = true;
m_bConnected = false;
- m_LastKeepaliveTime.Now();
- m_LastActivityTime.Now();
+ m_LastKeepaliveTime.start();
+ m_LastActivityTime.start();
m_bStreamOpened = false;
m_StreamidOpenStream = 0;
m_PortOpenStream = 0;
@@ -147,14 +141,14 @@ void CTranscoder::Task(void)
{
CBuffer Buffer;
CIp Ip;
- uint16 StreamId;
- uint16 Port;
+ uint16_t StreamId;
+ uint16_t Port;
// anything coming in from codec server ?
//if ( (m_Socket.Receive(&Buffer, &Ip, 20) != -1) && (Ip == m_Ip) )
if ( m_Socket.Receive(Buffer, Ip, 20) )
{
- m_LastActivityTime.Now();
+ m_LastActivityTime.start();
// crack packet
if ( IsValidStreamDescrPacket(Buffer, &StreamId, &Port) )
@@ -182,20 +176,20 @@ void CTranscoder::Task(void)
}
// keep client alive
- if ( m_LastKeepaliveTime.DurationSinceNow() > TRANSCODER_KEEPALIVE_PERIOD )
+ if ( m_LastKeepaliveTime.time() > TRANSCODER_KEEPALIVE_PERIOD )
{
//
HandleKeepalives();
// update time
- m_LastKeepaliveTime.Now();
+ m_LastKeepaliveTime.start();
}
}
////////////////////////////////////////////////////////////////////////////////////////
// manage streams
-std::shared_ptr CTranscoder::GetCodecStream(CPacketStream *PacketStream, uint8 uiCodecIn)
+std::shared_ptr CTranscoder::GetCodecStream(CPacketStream *PacketStream, uint8_t uiCodecIn)
{
CBuffer Buffer;
@@ -315,7 +309,7 @@ void CTranscoder::HandleKeepalives(void)
m_Socket.Send(keepalive, m_Ip, TRANSCODER_PORT);
// check if still with us
- if ( m_bConnected && (m_LastActivityTime.DurationSinceNow() >= TRANSCODER_KEEPALIVE_TIMEOUT) )
+ if ( m_bConnected && (m_LastActivityTime.time() >= TRANSCODER_KEEPALIVE_TIMEOUT) )
{
// no, disconnect
m_bConnected = false;
@@ -328,7 +322,7 @@ void CTranscoder::HandleKeepalives(void)
bool CTranscoder::IsValidKeepAlivePacket(const CBuffer &Buffer)
{
- uint8 tag[] = { 'A','M','B','E','D','P','O','N','G' };
+ uint8_t tag[] = { 'A','M','B','E','D','P','O','N','G' };
bool valid = false;
if ( (Buffer.size() == 9) && (Buffer.Compare(tag, sizeof(tag)) == 0) )
@@ -338,17 +332,17 @@ bool CTranscoder::IsValidKeepAlivePacket(const CBuffer &Buffer)
return valid;
}
-bool CTranscoder::IsValidStreamDescrPacket(const CBuffer &Buffer, uint16 *Id, uint16 *Port)
+bool CTranscoder::IsValidStreamDescrPacket(const CBuffer &Buffer, uint16_t *Id, uint16_t *Port)
{
- uint8 tag[] = { 'A','M','B','E','D','S','T','D' };
+ uint8_t tag[] = { 'A','M','B','E','D','S','T','D' };
bool valid = false;
if ( (Buffer.size() == 14) && (Buffer.Compare(tag, sizeof(tag)) == 0) )
{
- *Id = *(uint16 *)(&Buffer.data()[8]);
- *Port = *(uint16 *)(&Buffer.data()[10]);
- // uint8 CodecIn = Buffer.data()[12];
- // uint8 CodecOut = Buffer.data()[13];
+ *Id = *(uint16_t *)(&Buffer.data()[8]);
+ *Port = *(uint16_t *)(&Buffer.data()[10]);
+ // uint8_t CodecIn = Buffer.data()[12];
+ // uint8_t CodecOut = Buffer.data()[13];
valid = true;
}
return valid;
@@ -356,7 +350,7 @@ bool CTranscoder::IsValidStreamDescrPacket(const CBuffer &Buffer, uint16 *Id, ui
bool CTranscoder::IsValidNoStreamAvailablePacket(const CBuffer&Buffer)
{
- uint8 tag[] = { 'A','M','B','E','D','B','U','S','Y' };
+ uint8_t tag[] = { 'A','M','B','E','D','B','U','S','Y' };
return ( (Buffer.size() == 9) && (Buffer.Compare(tag, sizeof(tag)) == 0) );
}
@@ -367,26 +361,26 @@ bool CTranscoder::IsValidNoStreamAvailablePacket(const CBuffer&Buffer)
void CTranscoder::EncodeKeepAlivePacket(CBuffer *Buffer)
{
- uint8 tag[] = { 'A','M','B','E','D','P','I','N','G' };
+ uint8_t tag[] = { 'A','M','B','E','D','P','I','N','G' };
Buffer->Set(tag, sizeof(tag));
- Buffer->Append((uint8 *)(const char *)g_Reflector.GetCallsign(), CALLSIGN_LEN);
+ Buffer->Append((uint8_t *)(const char *)g_Reflector.GetCallsign(), CALLSIGN_LEN);
}
-void CTranscoder::EncodeOpenstreamPacket(CBuffer *Buffer, uint8 uiCodecIn, uint8 uiCodecOut)
+void CTranscoder::EncodeOpenstreamPacket(CBuffer *Buffer, uint8_t uiCodecIn, uint8_t uiCodecOut)
{
- uint8 tag[] = { 'A','M','B','E','D','O','S' };
+ uint8_t tag[] = { 'A','M','B','E','D','O','S' };
Buffer->Set(tag, sizeof(tag));
- Buffer->Append((uint8 *)(const char *)g_Reflector.GetCallsign(), CALLSIGN_LEN);
- Buffer->Append((uint8)uiCodecIn);
- Buffer->Append((uint8)uiCodecOut);
+ Buffer->Append((uint8_t *)(const char *)g_Reflector.GetCallsign(), CALLSIGN_LEN);
+ Buffer->Append((uint8_t)uiCodecIn);
+ Buffer->Append((uint8_t)uiCodecOut);
}
-void CTranscoder::EncodeClosestreamPacket(CBuffer *Buffer, uint16 uiStreamId)
+void CTranscoder::EncodeClosestreamPacket(CBuffer *Buffer, uint16_t uiStreamId)
{
- uint8 tag[] = { 'A','M','B','E','D','C','S' };
+ uint8_t tag[] = { 'A','M','B','E','D','C','S' };
Buffer->Set(tag, sizeof(tag));
- Buffer->Append((uint16)uiStreamId);
+ Buffer->Append((uint16_t)uiStreamId);
}
diff --git a/src/Transcoder.h b/src/Transcoder.h
index e04e087..06e7d7e 100644
--- a/src/Transcoder.h
+++ b/src/Transcoder.h
@@ -1,42 +1,27 @@
-//
-// Transcoder.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 13/04/2017.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
-// Copyright © 2020 Thomas A. Early N7TAE
-//
-// ----------------------------------------------------------------------------
-// This file is part of xlxd.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef ctranscoder_h
-#define ctranscoder_h
+#pragma once
#include "Semaphore.h"
#include "CodecStream.h"
#include "UDPSocket.h"
-////////////////////////////////////////////////////////////////////////////////////////
-// define
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-// class
-
class CPacketStream;
class CTranscoder
@@ -60,7 +45,7 @@ public:
bool IsConnected(void) const { return m_bConnected; }
// manage streams
- std::shared_ptr GetCodecStream(CPacketStream *, uint8);
+ std::shared_ptr GetCodecStream(CPacketStream *, uint8_t);
void ReleaseStream(std::shared_ptr);
// task
@@ -73,13 +58,13 @@ protected:
// packet decoding helpers
bool IsValidKeepAlivePacket(const CBuffer &);
- bool IsValidStreamDescrPacket(const CBuffer &, uint16 *, uint16 *);
+ bool IsValidStreamDescrPacket(const CBuffer &, uint16_t *, uint16_t *);
bool IsValidNoStreamAvailablePacket(const CBuffer&);
// packet encoding helpers
void EncodeKeepAlivePacket(CBuffer *);
- void EncodeOpenstreamPacket(CBuffer *, uint8, uint8);
- void EncodeClosestreamPacket(CBuffer *, uint16);
+ void EncodeOpenstreamPacket(CBuffer *, uint8_t, uint8_t);
+ void EncodeClosestreamPacket(CBuffer *, uint16_t);
protected:
// streams
@@ -89,8 +74,8 @@ protected:
// sync objects for Openstream
CSemaphore m_SemaphoreOpenStream;
bool m_bStreamOpened;
- uint16 m_StreamidOpenStream;
- uint16 m_PortOpenStream;
+ uint16_t m_StreamidOpenStream;
+ uint16_t m_PortOpenStream;
// thread
std::atomic keep_running;
@@ -102,10 +87,6 @@ protected:
bool m_bConnected;
// time
- CTimePoint m_LastKeepaliveTime;
- CTimePoint m_LastActivityTime;
+ CTimer m_LastKeepaliveTime;
+ CTimer m_LastActivityTime;
};
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* ctranscoder_h */
diff --git a/src/UDPMsgSocket.cpp b/src/UDPMsgSocket.cpp
index e821747..6db7d61 100644
--- a/src/UDPMsgSocket.cpp
+++ b/src/UDPMsgSocket.cpp
@@ -1,26 +1,20 @@
-//
-// cudpmsgsocket.cpp
-// xlxd
-//
-// Created by Marius Petrescu (YO2LOJ) on 22/02/2020.
// Copyright © 2020 Marius Petrescu (YO2LOJ). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
#include
diff --git a/src/UDPMsgSocket.h b/src/UDPMsgSocket.h
index 668d817..f92e894 100644
--- a/src/UDPMsgSocket.h
+++ b/src/UDPMsgSocket.h
@@ -1,41 +1,31 @@
-//
-// UDPMsgSocket.h
-// xlxd
-//
-// Created by Marius Petrescu (YO2LOJ) on 22/02/2020.
// Copyright © 2020 Marius Petrescu (YO2LOJ). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
// Description:
// Extension of the CUdpSocket class to allow retrieving
// the local target IP for a G3 Terminal mode config request
-#ifndef cudpmsgsocket_h
-#define cudpmsgsocket_h
+#pragma once
#include "UDPSocket.h"
#define UDP_MSG_BUFFER_LENMAX 1024
-////////////////////////////////////////////////////////////////////////////////////////
-// class
-
class CUdpMsgSocket : public CUdpSocket
{
public:
@@ -51,6 +41,3 @@ protected:
// data
struct in_addr m_LocalAddr;
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cudpmsgsocket_h */
diff --git a/src/UDPSocket.cpp b/src/UDPSocket.cpp
index 3e75450..52d1bd5 100644
--- a/src/UDPSocket.cpp
+++ b/src/UDPSocket.cpp
@@ -1,27 +1,20 @@
-//
-// cudpsocket.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 31/10/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
-// Copyright © 2020 Thomas A. Early, N7TAE
-//
-// ----------------------------------------------------------------------------
-// This file is part of xlxd.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include
#include "Main.h"
diff --git a/src/UDPSocket.h b/src/UDPSocket.h
index 6490948..2d8864d 100644
--- a/src/UDPSocket.h
+++ b/src/UDPSocket.h
@@ -1,30 +1,22 @@
-//
-// UDPSocket.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 31/10/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
-// Copyright © 2020 Thomas A. Early, N7TAE
-//
-// ----------------------------------------------------------------------------
-// This file is part of xlxd.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cudpsocket_h
-#define cudpsocket_h
+#pragma once
#include
#include
@@ -37,15 +29,8 @@
#include "IP.h"
#include "Buffer.h"
-////////////////////////////////////////////////////////////////////////////////////////
-// define
-
#define UDP_BUFFER_LENMAX 1024
-
-////////////////////////////////////////////////////////////////////////////////////////
-// class
-
class CUdpSocket
{
public:
@@ -78,6 +63,3 @@ protected:
int m_fd;
CIp m_addr;
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cudpsocket_h */
diff --git a/src/ULXClient.cpp b/src/ULXClient.cpp
index fda5cf3..976485d 100644
--- a/src/ULXClient.cpp
+++ b/src/ULXClient.cpp
@@ -1,26 +1,20 @@
-//
-// cxlxclient.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 28/01/2016.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include
#include "Main.h"
@@ -73,5 +67,5 @@ int CUlxClient::GetCodec(void) const
bool CUlxClient::IsAlive(void) const
{
- return (m_LastKeepaliveTime.DurationSinceNow() < XLX_KEEPALIVE_TIMEOUT);
+ return (m_LastKeepaliveTime.time() < XLX_KEEPALIVE_TIMEOUT);
}
diff --git a/src/ULXClient.h b/src/ULXClient.h
index ac0f6bb..fdc0b39 100644
--- a/src/ULXClient.h
+++ b/src/ULXClient.h
@@ -1,44 +1,29 @@
-//
-// ULXClient.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 28/01/2016.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
-
-#ifndef cxlxclient_h
-#define cxlxclient_h
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+#pragma once
#include "Client.h"
-////////////////////////////////////////////////////////////////////////////////////////
-// define
-
#define XLX_PROTOCOL_REVISION_0 0 // AMBE only, original connect mechanism
#define XLX_PROTOCOL_REVISION_1 1 // AMBE only, revised connect mechanism
#define XLX_PROTOCOL_REVISION_2 2 // Transcoded AMBE+AMBE2 interlink
-
-////////////////////////////////////////////////////////////////////////////////////////
-// class
-
class CUlxClient : public CClient
{
public:
@@ -67,6 +52,3 @@ protected:
// data
int m_ProtRev;
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cxlxclient_h */
diff --git a/src/ULXPeer.cpp b/src/ULXPeer.cpp
index 411efe3..d660d0f 100644
--- a/src/ULXPeer.cpp
+++ b/src/ULXPeer.cpp
@@ -1,27 +1,20 @@
-//
-// cxlxpeer.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 10/12/2016.
// Copyright © 2016 Jean-Luc Deltombe (LX3JL). All rights reserved.
-// Copyright © 2020 Thomas A. Early, N7TAE
-//
-// ----------------------------------------------------------------------------
-// This file is part of xlxd.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
#include
@@ -58,7 +51,7 @@ CUlxPeer::CUlxPeer(const CCallsign &callsign, const CIp &ip, const char *modules
bool CUlxPeer::IsAlive(void) const
{
- return (m_LastKeepaliveTime.DurationSinceNow() < XLX_KEEPALIVE_TIMEOUT);
+ return (m_LastKeepaliveTime.time() < XLX_KEEPALIVE_TIMEOUT);
}
////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/ULXPeer.h b/src/ULXPeer.h
index 6105819..773c7be 100644
--- a/src/ULXPeer.h
+++ b/src/ULXPeer.h
@@ -1,40 +1,26 @@
+/// Copyright © 2016 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ULXPeer.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 10/12/2016.
-// Copyright © 2016 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cxlxpeer_h
-#define cxlxpeer_h
+#pragma once
#include "Peer.h"
#include "ULXClient.h"
-////////////////////////////////////////////////////////////////////////////////////////
-// define
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-// class
-
class CUlxPeer : public CPeer
{
public:
@@ -53,6 +39,3 @@ public:
// revision helper
static int GetProtocolRevision(const CVersion &);
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cxlxpeer_h */
diff --git a/src/ULXProtocol.cpp b/src/ULXProtocol.cpp
index 2a1775f..655f092 100644
--- a/src/ULXProtocol.cpp
+++ b/src/ULXProtocol.cpp
@@ -1,27 +1,20 @@
-//
-// cxlxprotocol.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 28/01/2016.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
-// Copyright © 2020 Thomas A. Early, N7TAE
-//
-// ----------------------------------------------------------------------------
-// This file is part of xlxd.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
#include
@@ -35,14 +28,14 @@
////////////////////////////////////////////////////////////////////////////////////////
// operation
-bool CUlxProtocol::Initialize(const char *type, const int ptype, const uint16 port, const bool has_ipv4, const bool has_ipv6)
+bool CUlxProtocol::Initialize(const char *type, const int 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;
// update time
- m_LastKeepaliveTime.Now();
- m_LastPeersLinkTime.Now();
+ m_LastKeepaliveTime.start();
+ m_LastPeersLinkTime.start();
// done
return true;
@@ -202,23 +195,23 @@ void CUlxProtocol::Task(void)
HandleQueue();
// keep alive
- if ( m_LastKeepaliveTime.DurationSinceNow() > XLX_KEEPALIVE_PERIOD )
+ if ( m_LastKeepaliveTime.time() > XLX_KEEPALIVE_PERIOD )
{
// handle keep alives
HandleKeepalives();
// update time
- m_LastKeepaliveTime.Now();
+ m_LastKeepaliveTime.start();
}
// peer connections
- if ( m_LastPeersLinkTime.DurationSinceNow() > XLX_RECONNECT_PERIOD )
+ if ( m_LastPeersLinkTime.time() > XLX_RECONNECT_PERIOD )
{
// handle remote peers connections
HandlePeerLinks();
// update time
- m_LastPeersLinkTime.Now();
+ m_LastPeersLinkTime.start();
}
}
@@ -470,7 +463,7 @@ bool CUlxProtocol::IsValidConnectPacket(const CBuffer &Buffer, CCallsign *callsi
bool valid = false;
if ((Buffer.size() == 39) && (Buffer.data()[0] == 'L') && (Buffer.data()[38] == 0))
{
- callsign->SetCallsign((const uint8 *)&(Buffer.data()[1]), 8);
+ callsign->SetCallsign((const uint8_t *)&(Buffer.data()[1]), 8);
::strcpy(modules, (const char *)&(Buffer.data()[12]));
valid = callsign->IsValid();
*version = CVersion(Buffer.data()[9], Buffer.data()[10], Buffer.data()[11]);
@@ -487,7 +480,7 @@ bool CUlxProtocol::IsValidDisconnectPacket(const CBuffer &Buffer, CCallsign *cal
bool valid = false;
if ((Buffer.size() == 10) && (Buffer.data()[0] == 'U') && (Buffer.data()[9] == 0))
{
- callsign->SetCallsign((const uint8 *)&(Buffer.data()[1]), 8);
+ callsign->SetCallsign((const uint8_t *)&(Buffer.data()[1]), 8);
valid = callsign->IsValid();
}
return valid;
@@ -498,7 +491,7 @@ bool CUlxProtocol::IsValidAckPacket(const CBuffer &Buffer, CCallsign *callsign,
bool valid = false;
if ((Buffer.size() == 39) && (Buffer.data()[0] == 'A') && (Buffer.data()[38] == 0))
{
- callsign->SetCallsign((const uint8 *)&(Buffer.data()[1]), 8);
+ callsign->SetCallsign((const uint8_t *)&(Buffer.data()[1]), 8);
::strcpy(modules, (const char *)&(Buffer.data()[12]));
valid = callsign->IsValid();
*version = CVersion(Buffer.data()[9], Buffer.data()[10], Buffer.data()[11]);
@@ -515,7 +508,7 @@ bool CUlxProtocol::IsValidNackPacket(const CBuffer &Buffer, CCallsign *callsign)
bool valid = false;
if ((Buffer.size() == 10) && (Buffer.data()[0] == 'N') && (Buffer.data()[9] == 0))
{
- callsign->SetCallsign((const uint8 *)&(Buffer.data()[1]), 8);
+ callsign->SetCallsign((const uint8_t *)&(Buffer.data()[1]), 8);
valid = callsign->IsValid();
}
return valid;
@@ -528,12 +521,12 @@ bool CUlxProtocol::IsValidDvFramePacket(const CBuffer &Buffer, std::unique_ptr(new CDvFramePacket(
// sid
- *((uint16 *)&(Buffer.data()[12])),
+ *((uint16_t *)&(Buffer.data()[12])),
// dstar
Buffer.data()[14], &(Buffer.data()[15]), &(Buffer.data()[24]),
// dmr
@@ -553,12 +546,12 @@ bool CUlxProtocol::IsValidDvLastFramePacket(const CBuffer &Buffer, std::unique_p
return true;
// otherwise try protocol revision 2
- if ( 45==Buffer.size() && 0==Buffer.Compare((uint8 *)"DSVT", 4) && 0x20U==Buffer.data()[4] && 0x20U==Buffer.data()[8] && (Buffer.data()[14] & 0x40U) )
+ if ( 45==Buffer.size() && 0==Buffer.Compare((uint8_t *)"DSVT", 4) && 0x20U==Buffer.data()[4] && 0x20U==Buffer.data()[8] && (Buffer.data()[14] & 0x40U) )
{
// create packet
dvframe = std::unique_ptr(new CDvLastFramePacket(
// sid
- *((uint16 *)&(Buffer.data()[12])),
+ *((uint16_t *)&(Buffer.data()[12])),
// dstar
Buffer.data()[14], &(Buffer.data()[15]), &(Buffer.data()[24]),
// dmr
@@ -581,7 +574,7 @@ void CUlxProtocol::EncodeKeepAlivePacket(CBuffer *Buffer)
void CUlxProtocol::EncodeConnectPacket(CBuffer *Buffer, const char *Modules)
{
- uint8 tag[] = { 'L' };
+ uint8_t tag[] = { 'L' };
// tag
Buffer->Set(tag, sizeof(tag));
@@ -589,9 +582,9 @@ void CUlxProtocol::EncodeConnectPacket(CBuffer *Buffer, const char *Modules)
Buffer->resize(Buffer->size()+8);
g_Reflector.GetCallsign().GetCallsign(Buffer->data()+1);
// our version
- Buffer->Append((uint8)VERSION_MAJOR);
- Buffer->Append((uint8)VERSION_MINOR);
- Buffer->Append((uint8)VERSION_REVISION);
+ Buffer->Append((uint8_t)VERSION_MAJOR);
+ Buffer->Append((uint8_t)VERSION_MINOR);
+ Buffer->Append((uint8_t)VERSION_REVISION);
// the modules we share
Buffer->Append(Modules);
Buffer->resize(39);
@@ -599,19 +592,19 @@ void CUlxProtocol::EncodeConnectPacket(CBuffer *Buffer, const char *Modules)
void CUlxProtocol::EncodeDisconnectPacket(CBuffer *Buffer)
{
- uint8 tag[] = { 'U' };
+ uint8_t tag[] = { 'U' };
// tag
Buffer->Set(tag, sizeof(tag));
// our callsign
Buffer->resize(Buffer->size()+8);
g_Reflector.GetCallsign().GetCallsign(Buffer->data()+1);
- Buffer->Append((uint8)0);
+ Buffer->Append((uint8_t)0);
}
void CUlxProtocol::EncodeConnectAckPacket(CBuffer *Buffer, const char *Modules)
{
- uint8 tag[] = { 'A' };
+ uint8_t tag[] = { 'A' };
// tag
Buffer->Set(tag, sizeof(tag));
@@ -619,9 +612,9 @@ void CUlxProtocol::EncodeConnectAckPacket(CBuffer *Buffer, const char *Modules)
Buffer->resize(Buffer->size()+8);
g_Reflector.GetCallsign().GetCallsign(Buffer->data()+1);
// our version
- Buffer->Append((uint8)VERSION_MAJOR);
- Buffer->Append((uint8)VERSION_MINOR);
- Buffer->Append((uint8)VERSION_REVISION);
+ Buffer->Append((uint8_t)VERSION_MAJOR);
+ Buffer->Append((uint8_t)VERSION_MINOR);
+ Buffer->Append((uint8_t)VERSION_REVISION);
// the modules we share
Buffer->Append(Modules);
Buffer->resize(39);
@@ -629,30 +622,30 @@ void CUlxProtocol::EncodeConnectAckPacket(CBuffer *Buffer, const char *Modules)
void CUlxProtocol::EncodeConnectNackPacket(CBuffer *Buffer)
{
- uint8 tag[] = { 'N' };
+ uint8_t tag[] = { 'N' };
// tag
Buffer->Set(tag, sizeof(tag));
// our callsign
Buffer->resize(Buffer->size()+8);
g_Reflector.GetCallsign().GetCallsign(Buffer->data()+1);
- Buffer->Append((uint8)0);
+ Buffer->Append((uint8_t)0);
}
bool CUlxProtocol::EncodeDvFramePacket(const CDvFramePacket &Packet, CBuffer *Buffer) const
{
- uint8 tag[] = { 'D','S','V','T',0x20,0x00,0x00,0x00,0x20,0x00,0x01,0x02 };
+ uint8_t tag[] = { 'D','S','V','T',0x20,0x00,0x00,0x00,0x20,0x00,0x01,0x02 };
Buffer->Set(tag, sizeof(tag));
Buffer->Append(Packet.GetStreamId());
- Buffer->Append((uint8)(Packet.GetDstarPacketId() % 21));
- Buffer->Append((uint8 *)Packet.GetAmbe(), AMBE_SIZE);
- Buffer->Append((uint8 *)Packet.GetDvData(), DVDATA_SIZE);
+ Buffer->Append((uint8_t)(Packet.GetDstarPacketId() % 21));
+ Buffer->Append((uint8_t *)Packet.GetAmbe(), AMBE_SIZE);
+ Buffer->Append((uint8_t *)Packet.GetDvData(), DVDATA_SIZE);
- Buffer->Append((uint8)Packet.GetDmrPacketId());
- Buffer->Append((uint8)Packet.GetDmrPacketSubid());
- Buffer->Append((uint8 *)Packet.GetAmbePlus(), AMBEPLUS_SIZE);
- Buffer->Append((uint8 *)Packet.GetDvSync(), DVSYNC_SIZE);
+ Buffer->Append((uint8_t)Packet.GetDmrPacketId());
+ Buffer->Append((uint8_t)Packet.GetDmrPacketSubid());
+ Buffer->Append((uint8_t *)Packet.GetAmbePlus(), AMBEPLUS_SIZE);
+ Buffer->Append((uint8_t *)Packet.GetDvSync(), DVSYNC_SIZE);
return true;
@@ -660,21 +653,21 @@ bool CUlxProtocol::EncodeDvFramePacket(const CDvFramePacket &Packet, CBuffer *Bu
bool CUlxProtocol::EncodeDvLastFramePacket(const CDvLastFramePacket &Packet, CBuffer *Buffer) const
{
- uint8 tag[] = { 'D','S','V','T',0x20,0x00,0x00,0x00,0x20,0x00,0x01,0x02 };
- uint8 dstarambe[] = { 0x55,0xC8,0x7A,0x00,0x00,0x00,0x00,0x00,0x00 };
- uint8 dstardvdata[] = { 0x25,0x1A,0xC6 };
+ uint8_t tag[] = { 'D','S','V','T',0x20,0x00,0x00,0x00,0x20,0x00,0x01,0x02 };
+ uint8_t dstarambe[] = { 0x55,0xC8,0x7A,0x00,0x00,0x00,0x00,0x00,0x00 };
+ uint8_t dstardvdata[] = { 0x25,0x1A,0xC6 };
Buffer->Set(tag, sizeof(tag));
Buffer->Append(Packet.GetStreamId());
- Buffer->Append((uint8)((Packet.GetPacketId() % 21) | 0x40));
+ Buffer->Append((uint8_t)((Packet.GetPacketId() % 21) | 0x40));
Buffer->Append(dstarambe, sizeof(dstarambe));
Buffer->Append(dstardvdata, sizeof(dstardvdata));
- Buffer->Append((uint8)Packet.GetDmrPacketId());
- Buffer->Append((uint8)Packet.GetDmrPacketSubid());
- Buffer->Append((uint8 *)Packet.GetAmbePlus(), AMBEPLUS_SIZE);
- Buffer->Append((uint8 *)Packet.GetDvSync(), DVSYNC_SIZE);
+ Buffer->Append((uint8_t)Packet.GetDmrPacketId());
+ Buffer->Append((uint8_t)Packet.GetDmrPacketSubid());
+ Buffer->Append((uint8_t *)Packet.GetAmbePlus(), AMBEPLUS_SIZE);
+ Buffer->Append((uint8_t *)Packet.GetDvSync(), DVSYNC_SIZE);
return true;
}
diff --git a/src/ULXProtocol.h b/src/ULXProtocol.h
index 6df699b..0210c64 100644
--- a/src/ULXProtocol.h
+++ b/src/ULXProtocol.h
@@ -1,29 +1,22 @@
-//
-// ULXProtocol.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 28/01/2016.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cxlxprotocol_h
-#define cxlxprotocol_h
+#pragma once
#include "Version.h"
#include "Timer.h"
@@ -41,7 +34,7 @@ class CUlxProtocol : public CDextraProtocol
{
public:
// initialization
- bool Initialize(const char *type, const int ptype, const uint16 port, const bool has_ipv4, const bool has_ipv6);
+ bool Initialize(const char *type, const int ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6);
// task
void Task(void);
@@ -83,9 +76,6 @@ protected:
protected:
// time
- CTimePoint m_LastKeepaliveTime;
- CTimePoint m_LastPeersLinkTime;
+ CTimer m_LastKeepaliveTime;
+ CTimer m_LastPeersLinkTime;
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cxlxprotocol_h */
diff --git a/src/User.cpp b/src/User.cpp
index f1d7c1c..d123167 100644
--- a/src/User.cpp
+++ b/src/User.cpp
@@ -1,35 +1,25 @@
-//
-// cuser.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 13/11/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
#include
#include "User.h"
-
-////////////////////////////////////////////////////////////////////////////////////////
-// constructors
-
CUser::CUser()
{
m_LastHeardTime = std::time(nullptr);
diff --git a/src/User.h b/src/User.h
index 2d432e6..e154005 100644
--- a/src/User.h
+++ b/src/User.h
@@ -1,35 +1,26 @@
-//
-// User.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 13/11/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cuser_h
-#define cuser_h
+#pragma once
#include "Callsign.h"
#include "Buffer.h"
-////////////////////////////////////////////////////////////////////////////////////////
-
class CUser
{
public:
@@ -60,6 +51,3 @@ protected:
CCallsign m_Xlx;
std::time_t m_LastHeardTime;
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cuser_h */
diff --git a/src/Users.cpp b/src/Users.cpp
index 2b26b4e..2b99fc3 100644
--- a/src/Users.cpp
+++ b/src/Users.cpp
@@ -1,27 +1,20 @@
-//
-// cusers.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 13/11/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
-// Copyright © 2020 Thomas A. Early, N7TAE
-//
-// ----------------------------------------------------------------------------
-// This file is part of xlxd.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
#include "Users.h"
diff --git a/src/Users.h b/src/Users.h
index b3917b7..259f7f5 100644
--- a/src/Users.h
+++ b/src/Users.h
@@ -1,35 +1,25 @@
-//
-// Users.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 13/11/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
-// Copyright © 2020 Thomas A. Early, N7TAE
-//
-// ----------------------------------------------------------------------------
-// This file is part of xlxd.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cusers_h
-#define cusers_h
+#pragma once
#include "User.h"
-////////////////////////////////////////////////////////////////////////////////////////
-
class CUsers
{
public:
@@ -60,6 +50,3 @@ protected:
std::mutex m_Mutex;
std::list m_Users;
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cusers_h */
diff --git a/src/Version.cpp b/src/Version.cpp
index deb4ea5..7c809f2 100644
--- a/src/Version.cpp
+++ b/src/Version.cpp
@@ -1,26 +1,20 @@
-//
-// cversion.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 05/01/2018.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
#include "Version.h"
diff --git a/src/Version.h b/src/Version.h
index 2a87e74..dedea85 100644
--- a/src/Version.h
+++ b/src/Version.h
@@ -1,34 +1,22 @@
-//
-// Version.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 05/01/2018.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
-
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cversion_h
-#define cversion_h
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-// class
+#pragma once
class CVersion
{
@@ -54,7 +42,3 @@ protected:
int m_iMinor;
int m_iRevision;
};
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cversion_h */
diff --git a/src/WiresXCmd.cpp b/src/WiresXCmd.cpp
index d493655..382509c 100644
--- a/src/WiresXCmd.cpp
+++ b/src/WiresXCmd.cpp
@@ -1,26 +1,20 @@
-//
-// cwiresxcmd.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 09/10/2019.
// Copyright © 2019 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
#include "WiresXCmd.h"
@@ -32,7 +26,7 @@
CWiresxCmd::CWiresxCmd()
{
m_iCmd = WIRESX_CMD_UNKNOWN;
- m_Time.Now();
+ m_Time.start();
}
CWiresxCmd::CWiresxCmd(const CIp &Ip, const CCallsign &Callsign, int iCmd, int iArg)
@@ -41,5 +35,5 @@ CWiresxCmd::CWiresxCmd(const CIp &Ip, const CCallsign &Callsign, int iCmd, int i
m_Callsign = Callsign;
m_iCmd = iCmd;
m_iArg = iArg;
- m_Time.Now();
+ m_Time.start();
}
diff --git a/src/WiresXCmd.h b/src/WiresXCmd.h
index 7db8203..a0dbce7 100644
--- a/src/WiresXCmd.h
+++ b/src/WiresXCmd.h
@@ -1,38 +1,29 @@
-//
-// WiresXCmd.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 09/10/2019.
// Copyright © 2019 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
// ----------------------------------------------------------------------------
-#ifndef cwiresxcmd_h
-#define cwiresxcmd_h
+#pragma once
#include "Callsign.h"
#include "IP.h"
#include "Timer.h"
-////////////////////////////////////////////////////////////////////////////////////////
-// defines
-
// Wires-X commands
#define WIRESX_CMD_UNKNOWN 0
#define WIRESX_CMD_DX_REQ 1
@@ -41,9 +32,6 @@
#define WIRESX_CMD_CONN_REQ 4
#define WIRESX_CMD_DISC_REQ 5
-////////////////////////////////////////////////////////////////////////////////////////
-// class
-
class CWiresxCmd
{
public:
@@ -56,7 +44,7 @@ public:
const CIp &GetIp(void) const { return m_Ip; }
int GetCmd(void) const { return m_iCmd; }
int GetArg(void) const { return m_iArg; }
- const CTimePoint &GetTime(void) const { return m_Time; }
+ const CTimer &GetTime(void) const { return m_Time; }
protected:
// data
@@ -64,8 +52,5 @@ protected:
CCallsign m_Callsign;
int m_iCmd;
int m_iArg;
- CTimePoint m_Time;
+ CTimer m_Time;
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cwiresxcmd_h */
diff --git a/src/WiresXCmdHandler.cpp b/src/WiresXCmdHandler.cpp
index 9f88ca0..a7d9e9a 100644
--- a/src/WiresXCmdHandler.cpp
+++ b/src/WiresXCmdHandler.cpp
@@ -1,26 +1,20 @@
-//
-// cwiresxcmdhandler.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 09/10/2019.
// Copyright © 2019 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include
#include "Main.h"
@@ -29,7 +23,7 @@
#include "YSFPayload.h"
#include "YSFClient.h"
#include "YSFNodeDirFile.h"
-#include "YSFNodeDirhttp.h"
+#include "YSFNodeDirHttp.h"
#include "YSFUtils.h"
#include "Reflector.h"
#include "WiresXCmdHandler.h"
@@ -116,8 +110,8 @@ void CWiresxCmdHandler::Task(void)
{
CWiresxInfo Info;
CWiresxCmd Cmd;
- uint32 uiNodeTxFreq;
- uint32 uiNodeRxFreq;
+ uint32_t uiNodeTxFreq;
+ uint32_t uiNodeRxFreq;
char cModule;
bool bCmd;
@@ -134,7 +128,7 @@ void CWiresxCmdHandler::Task(void)
// so that the so delayed processing of the command
// introduce the delay the radio needs to switch
// from tx to rx
- if ( Cmd.GetTime().DurationSinceNow() >= WIRESX_REPLY_DELAY )
+ if ( Cmd.GetTime().time() >= WIRESX_REPLY_DELAY )
{
m_CmdQueue.pop();
bCmd = true;
@@ -221,7 +215,7 @@ void CWiresxCmdHandler::Task(void)
else
{
// if nothing to do, sleep a bit
- CTimePoint::TaskSleepFor(100);
+ std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
}
@@ -231,16 +225,16 @@ void CWiresxCmdHandler::Task(void)
bool CWiresxCmdHandler::ReplyToWiresxDxReqPacket(const CIp &Ip, const CWiresxInfo &WiresxInfo, char Module)
{
- uint8 DX_RESP[] = {0x5DU, 0x51U, 0x5FU, 0x26U};
+ uint8_t DX_RESP[] = {0x5DU, 0x51U, 0x5FU, 0x26U};
bool ok;
- uint8 data[150U];
- uint8 RoomId;
+ uint8_t data[150U];
+ uint8_t RoomId;
bool IsLinked;
// linked module
// module A == 0
IsLinked = (Module != ' ');
- RoomId = (uint8)(Module - 'A');
+ RoomId = (uint8_t)(Module - 'A');
// fill data buffer
::memset(data, 0x00U, 150U);
@@ -326,8 +320,8 @@ bool CWiresxCmdHandler::ReplyToWiresxDxReqPacket(const CIp &Ip, const CWiresxInf
bool CWiresxCmdHandler::ReplyToWiresxAllReqPacket(const CIp &Ip, const CWiresxInfo &WiresxInfo, int Start)
{
bool ok = false;
- uint8 ALL_RESP[] = {0x5DU, 0x46U, 0x5FU, 0x29U};
- uint8 data[1100U];
+ uint8_t ALL_RESP[] = {0x5DU, 0x46U, 0x5FU, 0x29U};
+ uint8_t data[1100U];
// fill data buffer
::memset(data, 0x00U, 1100U);
@@ -431,14 +425,14 @@ bool CWiresxCmdHandler::ReplyToWiresxAllReqPacket(const CIp &Ip, const CWiresxIn
bool CWiresxCmdHandler::ReplyToWiresxConnReqPacket(const CIp &Ip, const CWiresxInfo &WiresxInfo, char Module)
{
- uint8 CONN_RESP[] = {0x5DU, 0x41U, 0x5FU, 0x26U};
+ uint8_t CONN_RESP[] = {0x5DU, 0x41U, 0x5FU, 0x26U};
bool ok = false;
- uint8 data[110U];
+ uint8_t data[110U];
uint RoomId;
// linked room
// Module A == 0
- RoomId = (uint8)(Module - 'A');
+ RoomId = (uint8_t)(Module - 'A');
// prepare buffer
::memset(data, 0x00U, 110U);
@@ -494,9 +488,9 @@ bool CWiresxCmdHandler::ReplyToWiresxConnReqPacket(const CIp &Ip, const CWiresxI
bool CWiresxCmdHandler::ReplyToWiresxDiscReqPacket(const CIp &Ip, const CWiresxInfo &WiresxInfo)
{
- uint8 DISC_RESP[] = {0x5DU, 0x41U, 0x5FU, 0x26U};
+ uint8_t DISC_RESP[] = {0x5DU, 0x41U, 0x5FU, 0x26U};
bool ok = false;
- uint8 data[110U];
+ uint8_t data[110U];
// prepare buffer
::memset(data, 0x00U, 110U);
@@ -539,21 +533,21 @@ bool CWiresxCmdHandler::ReplyToWiresxDiscReqPacket(const CIp &Ip, const CWiresxI
bool CWiresxCmdHandler::EncodeAndSendWiresxPacket(const CIp &Ip, const CBuffer &DataOrg, const CWiresxInfo &WiresxInfo)
{
- uint8 DEFAULT_FICH[] = {0x20U, 0x00U, 0x01U, 0x00U};
- uint8 NET_HEADER[] = "YSFD ALL ";
+ uint8_t DEFAULT_FICH[] = {0x20U, 0x00U, 0x01U, 0x00U};
+ uint8_t NET_HEADER[] = "YSFD ALL ";
CYSFFICH fich;
CYSFPayload payload;
- uint8 buffer[200U];
+ uint8_t buffer[200U];
CBuffer Data(DataOrg);
// seq no
- uint8 seqNo = 0U;
+ uint8_t seqNo = 0U;
// calculate bt and adjust length
uint length = (uint)Data.size();
- uint8 bt = 0;
+ uint8_t bt = 0;
if (length > 260U)
{
bt = 1U;
@@ -573,11 +567,11 @@ bool CWiresxCmdHandler::EncodeAndSendWiresxPacket(const CIp &Ip, const CBuffer &
}
if ( length > (uint)Data.size() )
{
- Data.Append((uint8)0x20U, (int)(length - (uint)Data.size()));
+ Data.Append((uint8_t)0x20U, (int)(length - (uint)Data.size()));
}
// ft
- uint8 ft = WiresxCalcFt(length, 0U);
+ uint8_t ft = WiresxCalcFt(length, 0U);
// Write the header
{
@@ -606,9 +600,9 @@ bool CWiresxCmdHandler::EncodeAndSendWiresxPacket(const CIp &Ip, const CBuffer &
// write the payload
fich.setFI(YSF_FI_COMMUNICATIONS);
uint offset = 0;
- for ( uint8 bn = 0; bn <= bt; bn++ )
+ for ( uint8_t bn = 0; bn <= bt; bn++ )
{
- for ( uint8 fn = 0; fn <= ft; fn++ )
+ for ( uint8_t fn = 0; fn <= ft; fn++ )
{
// fich
fich.setFT(ft);
@@ -637,7 +631,7 @@ bool CWiresxCmdHandler::EncodeAndSendWiresxPacket(const CIp &Ip, const CBuffer &
}
else
{
- uint8 temp[20U];
+ uint8_t temp[20U];
temp[0U] = 0x00U;
::memcpy(temp + 1U, Data.data() + offset, 19U);
payload.writeDataFRModeData2(temp, buffer + 35U);
@@ -654,7 +648,7 @@ bool CWiresxCmdHandler::EncodeAndSendWiresxPacket(const CIp &Ip, const CBuffer &
// and post it
SendPacket(Ip, buffer);
// and some delay before next packet
- CTimePoint::TaskSleepFor(100);
+ std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
}
@@ -679,7 +673,7 @@ bool CWiresxCmdHandler::EncodeAndSendWiresxPacket(const CIp &Ip, const CBuffer &
}
-uint8 CWiresxCmdHandler::WiresxCalcFt(uint length, uint offset) const
+uint8_t CWiresxCmdHandler::WiresxCalcFt(uint length, uint offset) const
{
length -= offset;
if (length > 220U) return 7U;
@@ -692,7 +686,7 @@ uint8 CWiresxCmdHandler::WiresxCalcFt(uint length, uint offset) const
}
-void CWiresxCmdHandler::SendPacket(const CIp &Ip, uint8 *Buffer)
+void CWiresxCmdHandler::SendPacket(const CIp &Ip, uint8_t *Buffer)
{
//CBuffer packet(Buffer, 155);
//DebugTestDecodePacket(packet);
@@ -712,8 +706,8 @@ void CWiresxCmdHandler::SendPacket(const CIp &Ip, uint8 *Buffer)
#ifdef DEBUG_DUMPFILE
bool CWiresxCmdHandler::DebugTestDecodePacket(const CBuffer &Buffer)
{
- uint8 tag[] = { 'Y','S','F','D' };
- static uint8 command[4098];
+ uint8_t tag[] = { 'Y','S','F','D' };
+ static uint8_t command[4098];
static int len;
CYSFFICH Fich;
CYSFPayload payload;
diff --git a/src/WiresXCmdHandler.h b/src/WiresXCmdHandler.h
index 6096670..797394f 100644
--- a/src/WiresXCmdHandler.h
+++ b/src/WiresXCmdHandler.h
@@ -1,33 +1,26 @@
-//
-// WiresXCmdHandler.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 09/10/2019.
// Copyright © 2019 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cwiresxcmdhandler_h
-#define cwiresxcmdhandler_h
+#pragma once
-#include "WiresXCmdInc.h"
-#include "WiresxCmdQueue.h"
-#include "WiresxPacketQueue.h"
+#include "WiresXInfo.h"
+#include "WiresXCmdQueue.h"
+#include "WiresXPacketQueue.h"
////////////////////////////////////////////////////////////////////////////////////////
@@ -70,8 +63,8 @@ protected:
// packet encoding helpers
bool EncodeAndSendWiresxPacket(const CIp &, const CBuffer &, const CWiresxInfo &);
- uint8 WiresxCalcFt(uint, uint) const;
- void SendPacket(const CIp &, uint8 *);
+ uint8_t WiresxCalcFt(uint, uint) const;
+ void SendPacket(const CIp &, uint8_t *);
// debug
bool DebugTestDecodePacket(const CBuffer &);
@@ -89,6 +82,3 @@ protected:
std::atomic keep_running;
std::future m_Future;
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cwiresxcmdhandler_h */
diff --git a/src/WiresXCmdQueue.h b/src/WiresXCmdQueue.h
index a3285d4..50cca68 100644
--- a/src/WiresXCmdQueue.h
+++ b/src/WiresXCmdQueue.h
@@ -1,39 +1,28 @@
-//
-// WiresxCmdQueue.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 09/10/2019.
// Copyright © 2019 Jean-Luc Deltombe (LX3JL). All rights reserved.
-// Copyright © 2020 Thomas A. Early, N7TAE
-//
-// ----------------------------------------------------------------------------
-// This file is part of xlxd.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cwiresxcmdqueue_h
-#define cwiresxcmdqueue_h
+#pragma once
+#include
+#include
#include "WiresXCmd.h"
-////////////////////////////////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////////////////////////////////
-// class
-
class CWiresxCmdQueue
{
public:
@@ -58,6 +47,3 @@ protected:
std::mutex m_Mutex;
std::queue queue;
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cwiresxcmdqueue_h */
diff --git a/src/WiresXInfo.cpp b/src/WiresXInfo.cpp
index a005dac..16d2463 100644
--- a/src/WiresXInfo.cpp
+++ b/src/WiresXInfo.cpp
@@ -1,31 +1,25 @@
-//
-// cwiresxinfo.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 29/09/2019.
// Copyright © 2019 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include
#include "Main.h"
#include "Callsign.h"
-#include "WiresXCmdInc.h"
+#include "WiresXInfo.h"
////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/WiresXInfo.h b/src/WiresXInfo.h
index 27243bb..43b8643 100644
--- a/src/WiresXInfo.h
+++ b/src/WiresXInfo.h
@@ -1,29 +1,22 @@
-//
-// WiresXCmdInc.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 29/09/2019.
// Copyright © 2019 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cwiresxinfo_h
-#define cwiresxinfo_h
+#pragma once
#include "YSFDefines.h"
#include "Callsign.h"
@@ -38,15 +31,15 @@ public:
virtual ~CWiresxInfo() {}
// get
- const uint8 *GetCallsign(void) const { return m_callsign; }
- const uint8 *GetNode(void) const { return m_node; }
- const uint8 *GetName(void) const { return m_name; }
- const uint8 *GetId(void) const { return m_id; }
+ const uint8_t *GetCallsign(void) const { return m_callsign; }
+ const uint8_t *GetNode(void) const { return m_node; }
+ const uint8_t *GetName(void) const { return m_name; }
+ const uint8_t *GetId(void) const { return m_id; }
uint GetTxFrequency(void) const { return m_txFrequency; }
uint GetRxFrequency(void) const { return m_rxFrequency; }
- const uint8 *GetCsd1(void) const { return m_csd1; }
- const uint8 *GetCsd2(void) const { return m_csd2; }
- const uint8 *GetCsd3(void) const { return m_csd3; }
+ const uint8_t *GetCsd1(void) const { return m_csd1; }
+ const uint8_t *GetCsd2(void) const { return m_csd2; }
+ const uint8_t *GetCsd3(void) const { return m_csd3; }
// set
void SetCallsign(const CCallsign &);
@@ -60,17 +53,14 @@ public:
protected:
// data
- uint8 m_callsign[YSF_CALLSIGN_LENGTH];
- uint8 m_node[YSF_CALLSIGN_LENGTH];
- uint8 m_name[14];
- uint8 m_id[6];
+ uint8_t m_callsign[YSF_CALLSIGN_LENGTH];
+ uint8_t m_node[YSF_CALLSIGN_LENGTH];
+ uint8_t m_name[14];
+ uint8_t m_id[6];
uint m_txFrequency;
uint m_rxFrequency;
- uint8 m_csd1[20];
- uint8 m_csd2[20];
- uint8 m_csd3[20];
+ uint8_t m_csd1[20];
+ uint8_t m_csd2[20];
+ uint8_t m_csd3[20];
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cwiresxinfo_h */
diff --git a/src/WiresXPacket.h b/src/WiresXPacket.h
index 4176adf..f018396 100644
--- a/src/WiresXPacket.h
+++ b/src/WiresXPacket.h
@@ -1,29 +1,22 @@
-//
-// WiresxPacket.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 09/10/2019.
// Copyright © 2019 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cwiresxpacket_h
-#define cwiresxpacket_h
+#pragma once
#include "Buffer.h"
#include "IP.h"
@@ -50,6 +43,3 @@ protected:
CBuffer m_Buffer;
CIp m_Ip;
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cwiresxpacket_h */
diff --git a/src/WiresXPacketQueue.h b/src/WiresXPacketQueue.h
index 8d610b3..ae456ec 100644
--- a/src/WiresXPacketQueue.h
+++ b/src/WiresXPacketQueue.h
@@ -1,37 +1,24 @@
-//
-// WiresxPacketQueue.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 09/10/2019.
// Copyright © 2019 Jean-Luc Deltombe (LX3JL). All rights reserved.
-// Copyright © 2020 Thomas A. Early, N7TAE
-//
-// ----------------------------------------------------------------------------
-// This file is part of xlxd.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cwiresxpacketqueue_h
-#define cwiresxpacketqueue_h
+#pragma once
-#include "WiresxPacket.h"
-
-////////////////////////////////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////////////////////////////////
-// class
+#include "WiresXPacket.h"
class CWiresxPacketQueue
{
@@ -57,6 +44,3 @@ protected:
std::mutex m_Mutex;
std::queue queue;
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cwiresxpacketqueue_h */
diff --git a/src/YSFClient.cpp b/src/YSFClient.cpp
index f9103ac..b5eb79c 100644
--- a/src/YSFClient.cpp
+++ b/src/YSFClient.cpp
@@ -1,26 +1,20 @@
-//
-// cysfclient.cpp
-// xlxd
-//// Created by Jean-Luc on 20/05/2018.
-// Created by Jean-Luc Deltombe (LX3JL) on 20/05/2018.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
#include "YSFClient.h"
@@ -48,5 +42,5 @@ CYsfClient::CYsfClient(const CYsfClient &client)
bool CYsfClient::IsAlive(void) const
{
- return (m_LastKeepaliveTime.DurationSinceNow() < YSF_KEEPALIVE_TIMEOUT);
+ return (m_LastKeepaliveTime.time() < YSF_KEEPALIVE_TIMEOUT);
}
diff --git a/src/YSFClient.h b/src/YSFClient.h
index d867d03..adb64f2 100644
--- a/src/YSFClient.h
+++ b/src/YSFClient.h
@@ -1,39 +1,24 @@
-//
-// YSFClient.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 20/05/2018.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cysfclient_h
-#define cysfclient_h
+#pragma once
#include "Client.h"
-
-////////////////////////////////////////////////////////////////////////////////////////
-// define
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-// class
-
class CYsfClient : public CClient
{
public:
@@ -54,6 +39,3 @@ public:
// status
bool IsAlive(void) const;
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cysfclient_h */
diff --git a/src/YSFConvolution.cpp b/src/YSFConvolution.cpp
index 1614faf..0c32003 100644
--- a/src/YSFConvolution.cpp
+++ b/src/YSFConvolution.cpp
@@ -1,21 +1,20 @@
-/*
- * Copyright (C) 2009-2016 by Jonathan Naylor G4KLX
- * Copyright (C) 2030 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 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
+// Copyright (C) 2009-2016 by Jonathan Naylor G4KLX
+
+// 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 .
#include "YSFConvolution.h"
diff --git a/src/YSFConvolution.h b/src/YSFConvolution.h
index 5781b95..ec42454 100644
--- a/src/YSFConvolution.h
+++ b/src/YSFConvolution.h
@@ -16,8 +16,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#if !defined(YSFConvolution_H)
-#define YSFConvolution_H
+#pragma once
#include "YSFConvolution.h"
@@ -35,12 +34,10 @@ public:
void encode(const unsigned char* in, unsigned char* out, unsigned int nBits) const;
private:
- uint16_t m_metrics1[16];
- uint16_t m_metrics2[16];
- uint16_t* m_oldMetrics;
- uint16_t* m_newMetrics;
- uint64_t m_decisions[180];
- uint64_t* m_dp;
+ uint16_t m_metrics1[16];
+ uint16_t m_metrics2[16];
+ uint16_t *m_oldMetrics;
+ uint16_t *m_newMetrics;
+ uint64_t m_decisions[180];
+ uint64_t *m_dp;
};
-
-#endif
diff --git a/src/YSFDefines.h b/src/YSFDefines.h
index 3734984..0670a08 100644
--- a/src/YSFDefines.h
+++ b/src/YSFDefines.h
@@ -16,8 +16,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#if !defined(YSFDefines_H)
-#define YSFDefines_H
+#pragma once
const unsigned int YSF_FRAME_LENGTH_BYTES = 120U;
@@ -45,5 +44,3 @@ const unsigned char YSF_CM_INDIVIDUAL = 0x03U;
const unsigned char YSF_MR_NOT_BUSY = 0x01U;
const unsigned char YSF_MR_BUSY = 0x02U;
-
-#endif
diff --git a/src/YSFFich.h b/src/YSFFich.h
index 52d2d01..ab138d1 100644
--- a/src/YSFFich.h
+++ b/src/YSFFich.h
@@ -17,8 +17,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#if !defined(YSFFICH_H)
-#define YSFFICH_H
+#pragma once
class CYSFFICH
{
@@ -61,5 +60,3 @@ public:
private:
unsigned char m_fich[6];
};
-
-#endif
diff --git a/src/YSFNode.cpp b/src/YSFNode.cpp
index 1a21109..917838c 100644
--- a/src/YSFNode.cpp
+++ b/src/YSFNode.cpp
@@ -1,30 +1,24 @@
-//
-// cysfnode.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 08/10/2019.
// Copyright © 2019 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include
#include "Main.h"
-#include "cysfnode.h"
+#include "YSFNode.h"
////////////////////////////////////////////////////////////////////////////////////////
@@ -36,7 +30,7 @@ CYsfNode::CYsfNode()
m_uiRxFreq = 0;
}
-CYsfNode::CYsfNode(uint32 txfreq, uint32 rxfreq)
+CYsfNode::CYsfNode(uint32_t txfreq, uint32_t rxfreq)
{
m_uiTxFreq = txfreq;
m_uiRxFreq = rxfreq;
diff --git a/src/YSFNode.h b/src/YSFNode.h
index 4fbb750..76758d7 100644
--- a/src/YSFNode.h
+++ b/src/YSFNode.h
@@ -1,56 +1,39 @@
-//
-// cysfnode.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 08/10/2019.
// Copyright © 2019 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cysfnode_h
-#define cysfnode_h
+#pragma once
#include "Main.h"
-////////////////////////////////////////////////////////////////////////////////////////
-// define
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-// class
-
class CYsfNode
{
public:
// constructor
CYsfNode();
- CYsfNode(uint32, uint32);
+ CYsfNode(uint32_t, uint32_t);
// get
- uint32 GetTxFrequency(void) const { return m_uiTxFreq; }
- uint32 GetRxFrequency(void) const { return m_uiRxFreq; }
+ uint32_t GetTxFrequency(void) const { return m_uiTxFreq; }
+ uint32_t GetRxFrequency(void) const { return m_uiRxFreq; }
bool IsValid(void) const;
protected:
// data
- uint32 m_uiTxFreq;
- uint32 m_uiRxFreq;
+ uint32_t m_uiTxFreq;
+ uint32_t m_uiRxFreq;
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cysfnode_h */
diff --git a/src/YSFNodeDir.cpp b/src/YSFNodeDir.cpp
index c91e5cd..b2d4a58 100644
--- a/src/YSFNodeDir.cpp
+++ b/src/YSFNodeDir.cpp
@@ -1,26 +1,20 @@
-//
-// cysfnodedir.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 08/10/2019.
// Copyright © 2019 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include
#include
@@ -80,7 +74,7 @@ void CYsfNodeDir::Thread()
// Wait YSFNODEDB_REFRESH_RATE minutes
for (int i=0; keep_running && (i < 30*YSFNODEDB_REFRESH_RATE); i++)
{
- CTimePoint::TaskSleepFor(2000);
+ std::this_thread::sleep_for(std::chrono::milliseconds(2000));
#if YSF_DB_SUPPORT==true
if (keep_running && (0 == i % 450))
{
@@ -116,7 +110,7 @@ bool CYsfNodeDir::Reload(void)
////////////////////////////////////////////////////////////////////////////////////////
// find
-bool CYsfNodeDir::FindFrequencies(const CCallsign &callsign, uint32 *txfreq, uint32 *rxfreq)
+bool CYsfNodeDir::FindFrequencies(const CCallsign &callsign, uint32_t *txfreq, uint32_t *rxfreq)
{
auto found = find(callsign);
if ( found != end() )
diff --git a/src/YSFNodeDir.h b/src/YSFNodeDir.h
index ebc9fc3..f51e00a 100644
--- a/src/YSFNodeDir.h
+++ b/src/YSFNodeDir.h
@@ -1,29 +1,22 @@
-//
-// YSFNodeDir.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 08/10/2019.
// Copyright © 2019 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cysfnodedir_h
-#define cysfnodedir_h
+#pragma once
#include
#include
@@ -31,7 +24,7 @@
#include
#include "Buffer.h"
#include "Callsign.h"
-#include "cysfnode.h"
+#include "YSFNode.h"
////////////////////////////////////////////////////////////////////////////////////////
// compare function for std::map::find
@@ -68,7 +61,7 @@ public:
virtual bool RefreshContent(const CBuffer &) { return false; }
// find
- bool FindFrequencies(const CCallsign &, uint32 *, uint32 *);
+ bool FindFrequencies(const CCallsign &, uint32_t *, uint32_t *);
// pass-thru
void clear() { m_map.clear(); }
@@ -99,7 +92,3 @@ protected:
std::future m_Future;
CsNodeMap m_map;
};
-
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cysfnodedir_h */
diff --git a/src/YSFNodeDirFile.cpp b/src/YSFNodeDirFile.cpp
index 4253b9f..0dbdd44 100644
--- a/src/YSFNodeDirFile.cpp
+++ b/src/YSFNodeDirFile.cpp
@@ -1,26 +1,20 @@
-//
-// cysfnodedirfile.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 08/10/2019.
// Copyright © 2019 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include
#include
diff --git a/src/YSFNodeDirFile.h b/src/YSFNodeDirFile.h
index dd0e9f6..01d20d2 100644
--- a/src/YSFNodeDirFile.h
+++ b/src/YSFNodeDirFile.h
@@ -1,34 +1,25 @@
-//
-// YSFNodeDirFile.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 08/10/2019.
// Copyright © 2019 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cysfnodedirfile_h
-#define cysfnodedirfile_h
+#pragma once
#include "YSFNodeDir.h"
-////////////////////////////////////////////////////////////////////////////////////////
-
class CYsfNodeDirFile : public CYsfNodeDir
{
public:
@@ -54,6 +45,3 @@ protected:
// data
time_t m_LastModTime;
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cysfnodedirfile_h */
diff --git a/src/YSFNodeDirHttp.cpp b/src/YSFNodeDirHttp.cpp
index e2abe71..e0e3841 100644
--- a/src/YSFNodeDirHttp.cpp
+++ b/src/YSFNodeDirHttp.cpp
@@ -1,31 +1,25 @@
-//
-// cysfnodedirhttp.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 08/10/2019.
// Copyright © 2019 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include
#include "Main.h"
#include "Reflector.h"
-#include "YSFNodeDirhttp.h"
+#include "YSFNodeDirHttp.h"
#if (YSFNODEDB_USE_RLX_SERVER == 1)
CYsfNodeDirHttp g_YsfNodeDir;
@@ -151,7 +145,7 @@ bool CYsfNodeDirHttp::HttpGet(const char *hostname, const char *filename, int po
len = read(sock_id, buf, 1440);
if ( len > 0 )
{
- buffer->Append((uint8 *)buf, (int)len);
+ buffer->Append((uint8_t *)buf, (int)len);
ok = true;
}
//}
@@ -159,7 +153,7 @@ bool CYsfNodeDirHttp::HttpGet(const char *hostname, const char *filename, int po
}
while (!done);
- buffer->Append((uint8)0);
+ buffer->Append((uint8_t)0);
// and disconnect
close(sock_id);
diff --git a/src/YSFNodeDirHttp.h b/src/YSFNodeDirHttp.h
index 405a3e0..83c3956 100644
--- a/src/YSFNodeDirHttp.h
+++ b/src/YSFNodeDirHttp.h
@@ -1,35 +1,25 @@
-//
-// YSFNodeDirhttp.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 08/10/2019.
// Copyright © 2019 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
-
-#ifndef cysfnodedirhttp_h
-#define cysfnodedirhttp_h
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+#pragma once
#include "YSFNodeDir.h"
-////////////////////////////////////////////////////////////////////////////////////////
-
class CYsfNodeDirHttp : public CYsfNodeDir
{
public:
@@ -48,6 +38,3 @@ protected:
bool NeedReload(void) { return true; }
bool HttpGet(const char *, const char *, int, CBuffer *);
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cysfnodedirhttp_h */
diff --git a/src/YSFProtocol.cpp b/src/YSFProtocol.cpp
index 6723629..2b31bdc 100644
--- a/src/YSFProtocol.cpp
+++ b/src/YSFProtocol.cpp
@@ -1,27 +1,20 @@
-//
-// cysfprotocol.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 20/05/2018.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
-// Copyright © 2020 Thomas A. Early, N7TAE
-//
-// ----------------------------------------------------------------------------
-// This file is part of xlxd.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
#include
@@ -29,7 +22,7 @@
#include "YSFPayload.h"
#include "YSFClient.h"
#include "YSFNodeDirFile.h"
-#include "YSFNodeDirhttp.h"
+#include "YSFNodeDirHttp.h"
#include "YSFUtils.h"
#include "YSFProtocol.h"
#include "Reflector.h"
@@ -45,7 +38,7 @@ CYsfProtocol::CYsfProtocol()
////////////////////////////////////////////////////////////////////////////////////////
// operation
-bool CYsfProtocol::Initialize(const char *type, const int ptype, const uint16 port, const bool has_ipv4, const bool has_ipv6)
+bool CYsfProtocol::Initialize(const char *type, const int 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))
@@ -56,7 +49,7 @@ bool CYsfProtocol::Initialize(const char *type, const int ptype, const uint16 po
return false;
// update time
- m_LastKeepaliveTime.Now();
+ m_LastKeepaliveTime.start();
return true;
}
@@ -216,13 +209,13 @@ void CYsfProtocol::Task(void)
HandleQueue();
// keep client alive
- if ( m_LastKeepaliveTime.DurationSinceNow() > YSF_KEEPALIVE_PERIOD )
+ if ( m_LastKeepaliveTime.time() > YSF_KEEPALIVE_PERIOD )
{
//
HandleKeepalives();
// update time
- m_LastKeepaliveTime.Now();
+ m_LastKeepaliveTime.start();
}
}
@@ -315,7 +308,7 @@ void CYsfProtocol::HandleQueue(void)
else
{
// update local stream cache or send triplet when needed
- uint8 sid = packet->GetYsfPacketSubId();
+ uint8_t sid = packet->GetYsfPacketSubId();
if (sid <= 4)
{
//std::cout << (int)sid;
@@ -389,7 +382,7 @@ void CYsfProtocol::HandleKeepalives(void)
bool CYsfProtocol::IsValidConnectPacket(const CBuffer &Buffer, CCallsign *callsign)
{
- uint8 tag[] = { 'Y','S','F','P' };
+ uint8_t tag[] = { 'Y','S','F','P' };
bool valid = false;
if ( (Buffer.size() == 14) && (Buffer.Compare(tag, sizeof(tag)) == 0) )
@@ -403,7 +396,7 @@ bool CYsfProtocol::IsValidConnectPacket(const CBuffer &Buffer, CCallsign *callsi
bool CYsfProtocol::IsValidDvPacket(const CBuffer &Buffer, CYSFFICH *Fich)
{
- uint8 tag[] = { 'Y','S','F','D' };
+ uint8_t tag[] = { 'Y','S','F','D' };
bool valid = false;
@@ -425,7 +418,7 @@ bool CYsfProtocol::IsValidDvHeaderPacket(const CIp &Ip, const CYSFFICH &Fich, co
if ( Fich.getFI() == YSF_FI_HEADER )
{
// get stream id
- uint32 uiStreamId = IpToStreamId(Ip);
+ uint32_t uiStreamId = IpToStreamId(Ip);
// get header data
CYSFPayload ysfPayload;
@@ -451,7 +444,7 @@ bool CYsfProtocol::IsValidDvHeaderPacket(const CIp &Ip, const CYSFFICH &Fich, co
}
// and 2 DV Frames
{
- uint8 uiAmbe[AMBE_SIZE];
+ uint8_t uiAmbe[AMBE_SIZE];
::memset(uiAmbe, 0x00, sizeof(uiAmbe));
frames[0] = std::unique_ptr(new CDvFramePacket(uiAmbe, uiStreamId, Fich.getFN(), 0, 0));
frames[1] = std::unique_ptr(new CDvFramePacket(uiAmbe, uiStreamId, Fich.getFN(), 1, 0));
@@ -471,19 +464,19 @@ bool CYsfProtocol::IsValidDvFramePacket(const CIp &Ip, const CYSFFICH &Fich, con
if ( Fich.getFI() == YSF_FI_COMMUNICATIONS )
{
// get stream id
- uint32 uiStreamId = IpToStreamId(Ip);
+ uint32_t uiStreamId = IpToStreamId(Ip);
// get DV frames
- uint8 ambe0[AMBEPLUS_SIZE];
- uint8 ambe1[AMBEPLUS_SIZE];
- uint8 ambe2[AMBEPLUS_SIZE];
- uint8 ambe3[AMBEPLUS_SIZE];
- uint8 ambe4[AMBEPLUS_SIZE];
- uint8 *ambes[5] = { ambe0, ambe1, ambe2, ambe3, ambe4 };
+ uint8_t ambe0[AMBEPLUS_SIZE];
+ uint8_t ambe1[AMBEPLUS_SIZE];
+ uint8_t ambe2[AMBEPLUS_SIZE];
+ uint8_t ambe3[AMBEPLUS_SIZE];
+ uint8_t ambe4[AMBEPLUS_SIZE];
+ uint8_t *ambes[5] = { ambe0, ambe1, ambe2, ambe3, ambe4 };
CYsfUtils::DecodeVD2Vchs((unsigned char *)&(Buffer.data()[35]), ambes);
// get DV frames
- uint8 fid = Buffer.data()[34];
+ uint8_t fid = Buffer.data()[34];
frames[0] = std::unique_ptr(new CDvFramePacket(ambe0, uiStreamId, Fich.getFN(), 0, fid));
frames[1] = std::unique_ptr(new CDvFramePacket(ambe1, uiStreamId, Fich.getFN(), 1, fid));
frames[2] = std::unique_ptr(new CDvFramePacket(ambe2, uiStreamId, Fich.getFN(), 2, fid));
@@ -503,11 +496,11 @@ bool CYsfProtocol::IsValidDvLastFramePacket(const CIp &Ip, const CYSFFICH &Fich,
if ( Fich.getFI() == YSF_FI_TERMINATOR )
{
// get stream id
- uint32 uiStreamId = IpToStreamId(Ip);
+ uint32_t uiStreamId = IpToStreamId(Ip);
// get DV frames
{
- uint8 uiAmbe[AMBE_SIZE];
+ uint8_t uiAmbe[AMBE_SIZE];
::memset(uiAmbe, 0x00, sizeof(uiAmbe));
oneframe = std::unique_ptr(new CDvFramePacket(uiAmbe, uiStreamId, Fich.getFN(), 0, 0));
lastframe = std::unique_ptr(new CDvLastFramePacket(uiAmbe, uiStreamId, Fich.getFN(), 1, 0));
@@ -525,17 +518,17 @@ bool CYsfProtocol::IsValidDvLastFramePacket(const CIp &Ip, const CYSFFICH &Fich,
void CYsfProtocol::EncodeConnectAckPacket(CBuffer *Buffer) const
{
- uint8 tag[] = { 'Y','S','F','P','R','E','F','L','E','C','T','O','R',0x20 };
+ uint8_t tag[] = { 'Y','S','F','P','R','E','F','L','E','C','T','O','R',0x20 };
Buffer->Set(tag, sizeof(tag));
}
bool CYsfProtocol::EncodeDvHeaderPacket(const CDvHeaderPacket &Header, CBuffer *Buffer) const
{
- uint8 tag[] = { 'Y','S','F','D' };
- uint8 dest[] = { 'A','L','L',' ',' ',' ',' ',' ',' ',' ' };
+ uint8_t tag[] = { 'Y','S','F','D' };
+ uint8_t dest[] = { 'A','L','L',' ',' ',' ',' ',' ',' ',' ' };
char sz[YSF_CALLSIGN_LENGTH];
- uint8 fichd[YSF_FICH_LENGTH_BYTES];
+ uint8_t fichd[YSF_FICH_LENGTH_BYTES];
// tag
Buffer->Set(tag, sizeof(tag));
@@ -543,18 +536,18 @@ bool CYsfProtocol::EncodeDvHeaderPacket(const CDvHeaderPacket &Header, CBuffer *
::memset(sz, ' ', sizeof(sz));
Header.GetRpt1Callsign().GetCallsignString(sz);
sz[::strlen(sz)] = ' ';
- Buffer->Append((uint8 *)sz, YSF_CALLSIGN_LENGTH);
+ Buffer->Append((uint8_t *)sz, YSF_CALLSIGN_LENGTH);
// my
::memset(sz, ' ', sizeof(sz));
Header.GetMyCallsign().GetCallsignString(sz);
sz[::strlen(sz)] = ' ';
- Buffer->Append((uint8 *)sz, YSF_CALLSIGN_LENGTH);
+ Buffer->Append((uint8_t *)sz, YSF_CALLSIGN_LENGTH);
// dest
Buffer->Append(dest, 10);
// net frame counter
- Buffer->Append((uint8)0x00);
+ Buffer->Append((uint8_t)0x00);
// FS
- Buffer->Append((uint8 *)YSF_SYNC_BYTES, YSF_SYNC_LENGTH_BYTES);
+ Buffer->Append((uint8_t *)YSF_SYNC_BYTES, YSF_SYNC_LENGTH_BYTES);
// FICH
CYSFFICH fich;
fich.setFI(YSF_FI_HEADER);
@@ -577,7 +570,7 @@ bool CYsfProtocol::EncodeDvHeaderPacket(const CDvHeaderPacket &Header, CBuffer *
::memcpy(csd1 + YSF_CALLSIGN_LENGTH, sz, ::strlen(sz));
::memset(csd2, ' ', YSF_CALLSIGN_LENGTH + YSF_CALLSIGN_LENGTH);
CYSFPayload payload;
- uint8 temp[120];
+ uint8_t temp[120];
payload.writeHeader(temp, csd1, csd2);
Buffer->Append(temp+30, 120-30);
@@ -587,11 +580,11 @@ bool CYsfProtocol::EncodeDvHeaderPacket(const CDvHeaderPacket &Header, CBuffer *
bool CYsfProtocol::EncodeDvPacket(const CDvHeaderPacket &Header, const CDvFramePacket *DvFrames, CBuffer *Buffer) const
{
- uint8 tag[] = { 'Y','S','F','D' };
- uint8 dest[] = { 'A','L','L',' ',' ',' ',' ',' ',' ',' ' };
- uint8 gps[] = { 0x52,0x22,0x61,0x5F,0x27,0x03,0x5E,0x20,0x20,0x20 };
+ uint8_t tag[] = { 'Y','S','F','D' };
+ uint8_t dest[] = { 'A','L','L',' ',' ',' ',' ',' ',' ',' ' };
+ uint8_t gps[] = { 0x52,0x22,0x61,0x5F,0x27,0x03,0x5E,0x20,0x20,0x20 };
char sz[YSF_CALLSIGN_LENGTH];
- uint8 fichd[YSF_FICH_LENGTH_BYTES];
+ uint8_t fichd[YSF_FICH_LENGTH_BYTES];
// tag
Buffer->Set(tag, sizeof(tag));
@@ -599,18 +592,18 @@ bool CYsfProtocol::EncodeDvPacket(const CDvHeaderPacket &Header, const CDvFrameP
::memset(sz, ' ', sizeof(sz));
Header.GetRpt1Callsign().GetCallsignString(sz);
sz[::strlen(sz)] = ' ';
- Buffer->Append((uint8 *)sz, YSF_CALLSIGN_LENGTH);
+ Buffer->Append((uint8_t *)sz, YSF_CALLSIGN_LENGTH);
// my
::memset(sz, ' ', sizeof(sz));
Header.GetMyCallsign().GetCallsignString(sz);
sz[::strlen(sz)] = ' ';
- Buffer->Append((uint8 *)sz, YSF_CALLSIGN_LENGTH);
+ Buffer->Append((uint8_t *)sz, YSF_CALLSIGN_LENGTH);
// dest
Buffer->Append(dest, 10);
// net frame counter
Buffer->Append(DvFrames[0].GetYsfPacketFrameId());
// FS
- Buffer->Append((uint8 *)YSF_SYNC_BYTES, YSF_SYNC_LENGTH_BYTES);
+ Buffer->Append((uint8_t *)YSF_SYNC_BYTES, YSF_SYNC_LENGTH_BYTES);
// FICH
CYSFFICH fich;
fich.setFI(YSF_FI_COMMUNICATIONS);
@@ -626,7 +619,7 @@ bool CYsfProtocol::EncodeDvPacket(const CDvHeaderPacket &Header, const CDvFrameP
Buffer->Append(fichd, YSF_FICH_LENGTH_BYTES);
// payload
CYSFPayload payload;
- uint8 temp[120];
+ uint8_t temp[120];
::memset(temp, 0x00, sizeof(temp));
// DV
for ( int i = 0; i < 5; i++ )
@@ -679,10 +672,10 @@ bool CYsfProtocol::EncodeDvPacket(const CDvHeaderPacket &Header, const CDvFrameP
bool CYsfProtocol::EncodeDvLastPacket(const CDvHeaderPacket &Header, CBuffer *Buffer) const
{
- uint8 tag[] = { 'Y','S','F','D' };
- uint8 dest[] = { 'A','L','L',' ',' ',' ',' ',' ',' ',' ' };
+ uint8_t tag[] = { 'Y','S','F','D' };
+ uint8_t dest[] = { 'A','L','L',' ',' ',' ',' ',' ',' ',' ' };
char sz[YSF_CALLSIGN_LENGTH];
- uint8 fichd[YSF_FICH_LENGTH_BYTES];
+ uint8_t fichd[YSF_FICH_LENGTH_BYTES];
// tag
Buffer->Set(tag, sizeof(tag));
@@ -690,18 +683,18 @@ bool CYsfProtocol::EncodeDvLastPacket(const CDvHeaderPacket &Header, CBuffer *Bu
::memset(sz, ' ', sizeof(sz));
Header.GetRpt1Callsign().GetCallsignString(sz);
sz[::strlen(sz)] = ' ';
- Buffer->Append((uint8 *)sz, YSF_CALLSIGN_LENGTH);
+ Buffer->Append((uint8_t *)sz, YSF_CALLSIGN_LENGTH);
// my
::memset(sz, ' ', sizeof(sz));
Header.GetMyCallsign().GetCallsignString(sz);
sz[::strlen(sz)] = ' ';
- Buffer->Append((uint8 *)sz, YSF_CALLSIGN_LENGTH);
+ Buffer->Append((uint8_t *)sz, YSF_CALLSIGN_LENGTH);
// dest
Buffer->Append(dest, 10);
// net frame counter
- Buffer->Append((uint8)0x00);
+ Buffer->Append((uint8_t)0x00);
// FS
- Buffer->Append((uint8 *)YSF_SYNC_BYTES, YSF_SYNC_LENGTH_BYTES);
+ Buffer->Append((uint8_t *)YSF_SYNC_BYTES, YSF_SYNC_LENGTH_BYTES);
// FICH
CYSFFICH fich;
fich.setFI(YSF_FI_TERMINATOR);
@@ -724,7 +717,7 @@ bool CYsfProtocol::EncodeDvLastPacket(const CDvHeaderPacket &Header, CBuffer *Bu
::memcpy(csd1 + YSF_CALLSIGN_LENGTH, sz, ::strlen(sz));
::memset(csd2, ' ', YSF_CALLSIGN_LENGTH + YSF_CALLSIGN_LENGTH);
CYSFPayload payload;
- uint8 temp[120];
+ uint8_t temp[120];
payload.writeHeader(temp, csd1, csd2);
Buffer->Append(temp+30, 120-30);
@@ -737,12 +730,12 @@ bool CYsfProtocol::EncodeDvLastPacket(const CDvHeaderPacket &Header, CBuffer *Bu
bool CYsfProtocol::IsValidwirexPacket(const CBuffer &Buffer, CYSFFICH *Fich, CCallsign *Callsign, int *Cmd, int *Arg)
{
- uint8 tag[] = { 'Y','S','F','D' };
- uint8 DX_REQ[] = {0x5DU, 0x71U, 0x5FU};
- uint8 CONN_REQ[] = {0x5DU, 0x23U, 0x5FU};
- uint8 DISC_REQ[] = {0x5DU, 0x2AU, 0x5FU};
- uint8 ALL_REQ[] = {0x5DU, 0x66U, 0x5FU};
- uint8 command[300];
+ uint8_t tag[] = { 'Y','S','F','D' };
+ uint8_t DX_REQ[] = {0x5DU, 0x71U, 0x5FU};
+ uint8_t CONN_REQ[] = {0x5DU, 0x23U, 0x5FU};
+ uint8_t DISC_REQ[] = {0x5DU, 0x2AU, 0x5FU};
+ uint8_t ALL_REQ[] = {0x5DU, 0x66U, 0x5FU};
+ uint8_t command[300];
CYSFPayload payload;
bool valid = false;
@@ -852,7 +845,7 @@ bool CYsfProtocol::IsValidwirexPacket(const CBuffer &Buffer, CYSFFICH *Fich, CCa
bool CYsfProtocol::IsValidServerStatusPacket(const CBuffer &Buffer) const
{
- uint8 tag[] = { 'Y','S','F','S' };
+ uint8_t tag[] = { 'Y','S','F','S' };
return ( (Buffer.size() >= 4) && (Buffer.Compare(tag, sizeof(tag)) == 0) );
}
@@ -861,9 +854,9 @@ bool CYsfProtocol::IsValidServerStatusPacket(const CBuffer &Buffer) const
bool CYsfProtocol::EncodeServerStatusPacket(CBuffer *Buffer) const
{
- uint8 tag[] = { 'Y','S','F','S' };
- uint8 description[] = { 'X','L','X',' ','r','e','f','l','e','c','t','o','r',' ' };
- uint8 callsign[16];
+ uint8_t tag[] = { 'Y','S','F','S' };
+ uint8_t description[] = { 'X','L','X',' ','r','e','f','l','e','c','t','o','r',' ' };
+ uint8_t callsign[16];
// tag
Buffer->Set(tag, sizeof(tag));
@@ -872,7 +865,7 @@ bool CYsfProtocol::EncodeServerStatusPacket(CBuffer *Buffer) const
g_Reflector.GetCallsign().GetCallsign(callsign);
char sz[16];
::sprintf(sz, "%05u", CalcHash(callsign, 16) % 100000U);
- Buffer->Append((uint8 *)sz, 5);
+ Buffer->Append((uint8_t *)sz, 5);
// name
Buffer->Append(callsign, 16);
// desscription
@@ -882,15 +875,15 @@ bool CYsfProtocol::EncodeServerStatusPacket(CBuffer *Buffer) const
int count = MIN(999, clients->GetSize());
g_Reflector.ReleaseClients();
::sprintf(sz, "%03u", count);
- Buffer->Append((uint8 *)sz, 3);
+ Buffer->Append((uint8_t *)sz, 3);
// done
return true;
}
-uint32 CYsfProtocol::CalcHash(const uint8 *buffer, int len) const
+uint32_t CYsfProtocol::CalcHash(const uint8_t *buffer, int len) const
{
- uint32 hash = 0U;
+ uint32_t hash = 0U;
for ( int i = 0; i < len; i++)
{
@@ -911,9 +904,9 @@ uint32 CYsfProtocol::CalcHash(const uint8 *buffer, int len) const
// uiStreamId helpers
-uint32 CYsfProtocol::IpToStreamId(const CIp &ip) const
+uint32_t CYsfProtocol::IpToStreamId(const CIp &ip) const
{
- return ip.GetAddr() ^ (uint32)(MAKEDWORD(ip.GetPort(), ip.GetPort()));
+ return ip.GetAddr() ^ (uint32_t)(MAKEDWORD(ip.GetPort(), ip.GetPort()));
}
////////////////////////////////////////////////////////////////////////////////////////
@@ -922,8 +915,8 @@ uint32 CYsfProtocol::IpToStreamId(const CIp &ip) const
#ifdef DEBUG_DUMPFILE
bool CYsfProtocol::DebugTestDecodePacket(const CBuffer &Buffer)
{
- uint8 tag[] = { 'Y','S','F','D' };
- static uint8 command[4098];
+ uint8_t tag[] = { 'Y','S','F','D' };
+ static uint8_t command[4098];
static int len;
CYSFFICH Fich;
CYSFPayload payload;
@@ -987,7 +980,7 @@ bool CYsfProtocol::DebugDumpHeaderPacket(const CBuffer &Buffer)
bool ok;
CYSFFICH fich;
CYSFPayload payload;
- uint8 data[200];
+ uint8_t data[200];
:: memset(data, 0, sizeof(data));
@@ -1008,7 +1001,7 @@ bool CYsfProtocol::DebugDumpDvPacket(const CBuffer &Buffer)
bool ok;
CYSFFICH fich;
CYSFPayload payload;
- uint8 data[200];
+ uint8_t data[200];
:: memset(data, 0, sizeof(data));
@@ -1028,7 +1021,7 @@ bool CYsfProtocol::DebugDumpLastDvPacket(const CBuffer &Buffer)
bool ok;
CYSFFICH fich;
CYSFPayload payload;
- uint8 data[200];
+ uint8_t data[200];
:: memset(data, 0, sizeof(data));
diff --git a/src/YSFProtocol.h b/src/YSFProtocol.h
index 03da89e..da1f353 100644
--- a/src/YSFProtocol.h
+++ b/src/YSFProtocol.h
@@ -1,31 +1,22 @@
-//
-// YSFProtocol.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 20/05/2018.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
-
-
-#ifndef cysfprotocol_h
-#define cysfprotocol_h
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+#pragma once
#include "Timer.h"
#include "DCSProtocol.h"
@@ -34,7 +25,7 @@
#include "DVLastFramePacket.h"
#include "YSFDefines.h"
#include "YSFFich.h"
-#include "WiresXCmdInc.h"
+#include "WiresXInfo.h"
#include "WiresXCmdHandler.h"
////////////////////////////////////////////////////////////////////////////////////////
@@ -64,7 +55,7 @@ public:
CDvHeaderPacket m_dvHeader;
CDvFramePacket m_dvFrames[5];
- //uint8 m_uiSeqId;
+ //uint8_t m_uiSeqId;
};
class CYsfProtocol : public CProtocol
@@ -74,7 +65,7 @@ public:
CYsfProtocol();
// initialization
- bool Initialize(const char *type, const int ptype, const uint16 port, const bool has_ipv4, const bool has_ipv6);
+ bool Initialize(const char *type, const int ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6);
void Close(void);
// task
@@ -111,13 +102,13 @@ protected:
// server status packet decoding helpers
bool IsValidServerStatusPacket(const CBuffer &) const;
- uint32 CalcHash(const uint8 *, int) const;
+ uint32_t CalcHash(const uint8_t *, int) const;
// server status packet encoding helpers
bool EncodeServerStatusPacket(CBuffer *) const;
// uiStreamId helpers
- uint32 IpToStreamId(const CIp &) const;
+ uint32_t IpToStreamId(const CIp &) const;
// debug
bool DebugTestDecodePacket(const CBuffer &);
@@ -127,7 +118,7 @@ protected:
protected:
// for keep alive
- CTimePoint m_LastKeepaliveTime;
+ CTimer m_LastKeepaliveTime;
// for queue header caches
std::array m_StreamsCache;
@@ -136,6 +127,3 @@ protected:
CWiresxCmdHandler m_WiresxCmdHandler;
unsigned char m_seqNo;
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cysfprotocol_h */
diff --git a/src/YSFUtils.cpp b/src/YSFUtils.cpp
index 814226f..11d9c54 100644
--- a/src/YSFUtils.cpp
+++ b/src/YSFUtils.cpp
@@ -1,29 +1,23 @@
-//
-// cysfutils.cpp
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 14/04/2019.
// Copyright © 2019 Jean-Luc Deltombe (LX3JL). All rights reserved.
-// Copyright (C) 2016,2017 by Jonathan Naylor G4KLX
+// Copyright (C) 2016,2017 by Jonathan Naylor G4KLX
// Copyright (C) 2018 by Andy Uribe CA6JAU
// Copyright (C) 2018 by Manuel Sanchez EA7EE
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
#include "Main.h"
#include
@@ -482,7 +476,7 @@ const unsigned char WHITENING_DATA[] = {0x93U, 0xD7U, 0x51U, 0x21U, 0x9CU, 0x2FU
////////////////////////////////////////////////////////////////////////////////////////
//
-void CYsfUtils::DecodeVD2Vchs(uint8 *data, uint8 **ambe)
+void CYsfUtils::DecodeVD2Vchs(uint8_t *data, uint8_t **ambe)
{
int frame = 0;
@@ -572,7 +566,7 @@ void CYsfUtils::DecodeVD2Vchs(uint8 *data, uint8 **ambe)
}
}
-void CYsfUtils::EncodeVD2Vch(uint8 *ambe, uint8 *data)
+void CYsfUtils::EncodeVD2Vch(uint8_t *ambe, uint8_t *data)
{
// convert from ambe2plus
unsigned int a = 0U;
diff --git a/src/YSFUtils.h b/src/YSFUtils.h
index bb714ec..dda4e3b 100644
--- a/src/YSFUtils.h
+++ b/src/YSFUtils.h
@@ -1,32 +1,25 @@
-//
-// YSFUtils.h
-// xlxd
-//
-// Created by Jean-Luc Deltombe (LX3JL) on 14/04/2019.
// Copyright © 2019 Jean-Luc Deltombe (LX3JL). All rights reserved.
// Copyright (C) 2016,2017 by Jonathan Naylor G4KLX
// Copyright (C) 2018 by Andy Uribe CA6JAU
// Copyright (C) 2018 by Manuel Sanchez EA7EE
+
+// ulxd -- The universal reflector
+// Copyright © 2021 Thomas A. Early N7TAE
//
-// ----------------------------------------------------------------------------
-// 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.
+// 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.
//
-// 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.
+// 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 Foobar. If not, see .
-// ----------------------------------------------------------------------------
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
-#ifndef cysfutils_h
-#define cysfutils_h
+#pragma once
////////////////////////////////////////////////////////////////////////////////////////
// class
@@ -35,9 +28,6 @@ class CYsfUtils
{
public:
// operation
- static void DecodeVD2Vchs(uint8 *, uint8 **);
- static void EncodeVD2Vch(uint8 *, uint8 *);
+ static void DecodeVD2Vchs(uint8_t *, uint8_t **);
+ static void EncodeVD2Vch(uint8_t *, uint8_t *);
};
-
-////////////////////////////////////////////////////////////////////////////////////////
-#endif /* cysfutils_h */