Move the host lookup for the DMR Direct Network.
This commit is contained in:
parent
5111d16b99
commit
125f21735b
|
@ -31,6 +31,8 @@ const unsigned int HOMEBREW_DATA_PACKET_LENGTH = 55U;
|
||||||
|
|
||||||
|
|
||||||
CDMRDirectNetwork::CDMRDirectNetwork(const std::string& address, unsigned int port, unsigned int local, unsigned int id, const std::string& password, bool duplex, const char* version, bool slot1, bool slot2, HW_TYPE hwType, bool debug) :
|
CDMRDirectNetwork::CDMRDirectNetwork(const std::string& address, unsigned int port, unsigned int local, unsigned int id, const std::string& password, bool duplex, const char* version, bool slot1, bool slot2, HW_TYPE hwType, bool debug) :
|
||||||
|
m_address(address),
|
||||||
|
m_port(port),
|
||||||
m_addr(),
|
m_addr(),
|
||||||
m_addrLen(0U),
|
m_addrLen(0U),
|
||||||
m_id(NULL),
|
m_id(NULL),
|
||||||
|
@ -70,9 +72,6 @@ m_beacon(false)
|
||||||
assert(id > 1000U);
|
assert(id > 1000U);
|
||||||
assert(!password.empty());
|
assert(!password.empty());
|
||||||
|
|
||||||
if (CUDPSocket::lookup(address, port, m_addr, m_addrLen) != 0)
|
|
||||||
m_addrLen = 0U;
|
|
||||||
|
|
||||||
m_buffer = new unsigned char[BUFFER_LENGTH];
|
m_buffer = new unsigned char[BUFFER_LENGTH];
|
||||||
m_salt = new unsigned char[sizeof(uint32_t)];
|
m_salt = new unsigned char[sizeof(uint32_t)];
|
||||||
m_id = new uint8_t[4U];
|
m_id = new uint8_t[4U];
|
||||||
|
@ -122,7 +121,7 @@ void CDMRDirectNetwork::setConfig(const std::string& callsign, unsigned int rxFr
|
||||||
|
|
||||||
bool CDMRDirectNetwork::open()
|
bool CDMRDirectNetwork::open()
|
||||||
{
|
{
|
||||||
if (m_addrLen == 0U) {
|
if (CUDPSocket::lookup(m_address, m_port, m_addr, m_addrLen) != 0) {
|
||||||
LogError("DMR, Could not lookup the address of the DMR Network");
|
LogError("DMR, Could not lookup the address of the DMR Network");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2015,2016,2017,2018,2020 by Jonathan Naylor G4KLX
|
* Copyright (C) 2015,2016,2017,2018,2020,2021 by Jonathan Naylor G4KLX
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -58,6 +58,8 @@ public:
|
||||||
virtual void close();
|
virtual void close();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
std::string m_address;
|
||||||
|
unsigned int m_port;
|
||||||
sockaddr_storage m_addr;
|
sockaddr_storage m_addr;
|
||||||
unsigned int m_addrLen;
|
unsigned int m_addrLen;
|
||||||
uint8_t* m_id;
|
uint8_t* m_id;
|
||||||
|
|
Loading…
Reference in a new issue