|
|
|
@ -4,6 +4,7 @@
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Created by Jean-Luc Deltombe (LX3JL) on 01/11/2015.
|
|
|
|
// Created by Jean-Luc Deltombe (LX3JL) on 01/11/2015.
|
|
|
|
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
|
|
|
|
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
|
|
|
|
|
|
|
|
// Copyright © 2020 Thomas A. Early, N7TAE
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// This file is part of xlxd.
|
|
|
|
// This file is part of xlxd.
|
|
|
|
@ -19,7 +20,7 @@
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
// along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef cprotocol_h
|
|
|
|
#ifndef cprotocol_h
|
|
|
|
@ -71,44 +72,44 @@ class CProtocol
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
// constructor
|
|
|
|
// constructor
|
|
|
|
CProtocol();
|
|
|
|
CProtocol();
|
|
|
|
|
|
|
|
|
|
|
|
// destructor
|
|
|
|
// destructor
|
|
|
|
virtual ~CProtocol();
|
|
|
|
virtual ~CProtocol();
|
|
|
|
|
|
|
|
|
|
|
|
// initialization
|
|
|
|
// initialization
|
|
|
|
virtual bool Init(void);
|
|
|
|
virtual bool Init(void);
|
|
|
|
virtual void Close(void);
|
|
|
|
virtual void Close(void);
|
|
|
|
|
|
|
|
|
|
|
|
// queue
|
|
|
|
// queue
|
|
|
|
CPacketQueue *GetQueue(void) { m_Queue.Lock(); return &m_Queue; }
|
|
|
|
CPacketQueue *GetQueue(void) { m_Queue.Lock(); return &m_Queue; }
|
|
|
|
void ReleaseQueue(void) { m_Queue.Unlock(); }
|
|
|
|
void ReleaseQueue(void) { m_Queue.Unlock(); }
|
|
|
|
|
|
|
|
|
|
|
|
// get
|
|
|
|
// get
|
|
|
|
const CCallsign &GetReflectorCallsign(void)const { return m_ReflectorCallsign; }
|
|
|
|
const CCallsign &GetReflectorCallsign(void)const { return m_ReflectorCallsign; }
|
|
|
|
|
|
|
|
|
|
|
|
// task
|
|
|
|
// task
|
|
|
|
static void Thread(CProtocol *);
|
|
|
|
static void Thread(CProtocol *);
|
|
|
|
virtual void Task(void) {};
|
|
|
|
virtual void Task(void) {}
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
protected:
|
|
|
|
// packet encoding helpers
|
|
|
|
// packet encoding helpers
|
|
|
|
virtual bool EncodeDvPacket(const CPacket &, CBuffer *) const;
|
|
|
|
virtual bool EncodeDvPacket(const CPacket &, CBuffer *) const;
|
|
|
|
virtual bool EncodeDvHeaderPacket(const CDvHeaderPacket &, CBuffer *) const { return false; }
|
|
|
|
virtual bool EncodeDvHeaderPacket(const CDvHeaderPacket &, CBuffer *) const { return false; }
|
|
|
|
virtual bool EncodeDvFramePacket(const CDvFramePacket &, CBuffer *) const { return false; }
|
|
|
|
virtual bool EncodeDvFramePacket(const CDvFramePacket &, CBuffer *) const { return false; }
|
|
|
|
virtual bool EncodeDvLastFramePacket(const CDvLastFramePacket &, CBuffer *) const { return false; }
|
|
|
|
virtual bool EncodeDvLastFramePacket(const CDvLastFramePacket &, CBuffer *) const { return false; }
|
|
|
|
|
|
|
|
|
|
|
|
// stream helpers
|
|
|
|
// stream helpers
|
|
|
|
virtual bool OnDvHeaderPacketIn(CDvHeaderPacket *, const CIp &) { return false; }
|
|
|
|
virtual bool OnDvHeaderPacketIn(CDvHeaderPacket *, const CIp &) { return false; }
|
|
|
|
virtual void OnDvFramePacketIn(CDvFramePacket *, const CIp * = NULL);
|
|
|
|
virtual void OnDvFramePacketIn(CDvFramePacket *, const CIp * = NULL);
|
|
|
|
virtual void OnDvLastFramePacketIn(CDvLastFramePacket *, const CIp * = NULL);
|
|
|
|
virtual void OnDvLastFramePacketIn(CDvLastFramePacket *, const CIp * = NULL);
|
|
|
|
|
|
|
|
|
|
|
|
// stream handle helpers
|
|
|
|
// stream handle helpers
|
|
|
|
CPacketStream *GetStream(uint16, const CIp * = NULL);
|
|
|
|
CPacketStream *GetStream(uint16, const CIp * = NULL);
|
|
|
|
void CheckStreamsTimeout(void);
|
|
|
|
void CheckStreamsTimeout(void);
|
|
|
|
|
|
|
|
|
|
|
|
// queue helper
|
|
|
|
// queue helper
|
|
|
|
virtual void HandleQueue(void);
|
|
|
|
virtual void HandleQueue(void);
|
|
|
|
|
|
|
|
|
|
|
|
// keepalive helpers
|
|
|
|
// keepalive helpers
|
|
|
|
virtual void HandleKeepalives(void) {}
|
|
|
|
virtual void HandleKeepalives(void) {}
|
|
|
|
|
|
|
|
|
|
|
|
@ -116,7 +117,7 @@ protected:
|
|
|
|
bool IsNumber(char) const;
|
|
|
|
bool IsNumber(char) const;
|
|
|
|
bool IsLetter(char) const;
|
|
|
|
bool IsLetter(char) const;
|
|
|
|
bool IsSpace(char) const;
|
|
|
|
bool IsSpace(char) const;
|
|
|
|
|
|
|
|
|
|
|
|
// dmr DstId to Module helper
|
|
|
|
// dmr DstId to Module helper
|
|
|
|
virtual char DmrDstIdToModule(uint32) const;
|
|
|
|
virtual char DmrDstIdToModule(uint32) const;
|
|
|
|
virtual uint32 ModuleToDmrDestId(char) const;
|
|
|
|
virtual uint32 ModuleToDmrDestId(char) const;
|
|
|
|
@ -124,20 +125,20 @@ protected:
|
|
|
|
protected:
|
|
|
|
protected:
|
|
|
|
// socket
|
|
|
|
// socket
|
|
|
|
CUdpSocket m_Socket;
|
|
|
|
CUdpSocket m_Socket;
|
|
|
|
|
|
|
|
|
|
|
|
// streams
|
|
|
|
// streams
|
|
|
|
std::vector<CPacketStream *> m_Streams;
|
|
|
|
std::list<CPacketStream *> m_Streams;
|
|
|
|
|
|
|
|
|
|
|
|
// queue
|
|
|
|
// queue
|
|
|
|
CPacketQueue m_Queue;
|
|
|
|
CPacketQueue m_Queue;
|
|
|
|
|
|
|
|
|
|
|
|
// thread
|
|
|
|
// thread
|
|
|
|
bool m_bStopThread;
|
|
|
|
bool m_bStopThread;
|
|
|
|
std::thread *m_pThread;
|
|
|
|
std::thread *m_pThread;
|
|
|
|
|
|
|
|
|
|
|
|
// identity
|
|
|
|
// identity
|
|
|
|
CCallsign m_ReflectorCallsign;
|
|
|
|
CCallsign m_ReflectorCallsign;
|
|
|
|
|
|
|
|
|
|
|
|
// debug
|
|
|
|
// debug
|
|
|
|
CTimePoint m_DebugTimer;
|
|
|
|
CTimePoint m_DebugTimer;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|