Start the IAX state machine.

This commit is contained in:
Jonathan Naylor
2024-02-02 15:23:36 +00:00
parent 7508e42547
commit d3725e1f10
2 changed files with 258 additions and 20 deletions

View File

@@ -23,10 +23,18 @@
#include "RingBuffer.h"
#include "UDPSocket.h"
#include "StopWatch.h"
#include "Timer.h"
#include <cstdint>
#include <string>
enum IAX_STATUS {
IAXS_DISCONNECTED,
IAXS_CONNECTING,
IAXS_AUTHORISING,
IAXS_CONNECTED
};
class CFMIAXNetwork : public IFMNetwork {
public:
CFMIAXNetwork(const std::string& callsign, const std::string& username, const std::string& password, const std::string& node, const std::string& localAddress, unsigned short localPort, const std::string& gatewayAddress, unsigned short gatewayPort, bool debug);
@@ -61,6 +69,9 @@ private:
bool m_debug;
bool m_enabled;
CRingBuffer<unsigned char> m_buffer;
IAX_STATUS m_status;
CTimer m_retryTimer;
CTimer m_pingTimer;
CStopWatch m_timestamp;
unsigned short m_sCallNo;
unsigned short m_dCallNo;
@@ -73,13 +84,16 @@ private:
unsigned int m_rxDropped;
unsigned int m_rxOOO;
bool writeCall();
bool writeAuth();
bool writeNew();
bool writeAuthRep();
bool writeKey(bool key);
bool writePing();
bool writePong(unsigned int ts);
bool writeAck(unsigned short sCallNo, unsigned short dCallNo, unsigned int ts, unsigned char oSeqNo, unsigned char iSeqNo);
bool writeDisconnect();
bool writeAck(unsigned int ts);
bool writeLagRp();
bool writeHangup();
bool compareFrame(const unsigned char* buffer, unsigned char type1, unsigned char type2) const;
};
#endif