mirror of
https://github.com/ShaYmez/P25Clients.git
synced 2024-11-21 19:55:22 -05:00
Re-add IPv4 and IPv6 capabilities to the P25 network.
This commit is contained in:
parent
7c38895c01
commit
30879a0f04
@ -426,7 +426,6 @@
|
|||||||
# 11069 KK6RQ DMR-310551
|
# 11069 KK6RQ DMR-310551
|
||||||
11069 area52.zapto.org 41000
|
11069 area52.zapto.org 41000
|
||||||
|
|
||||||
|
|
||||||
# 17603 URFM17 Universal Reflector
|
# 17603 URFM17 Universal Reflector
|
||||||
17603 urf.m17.link 41000
|
17603 urf.m17.link 41000
|
||||||
|
|
||||||
@ -814,4 +813,3 @@
|
|||||||
# 65101 KM4HJJ repeater Pompano, Florida
|
# 65101 KM4HJJ repeater Pompano, Florida
|
||||||
65101 km4hjj-p25.dyndns-server.com 41000
|
65101 km4hjj-p25.dyndns-server.com 41000
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,7 +26,8 @@
|
|||||||
|
|
||||||
CP25Network::CP25Network(unsigned short port, const std::string& callsign, bool debug) :
|
CP25Network::CP25Network(unsigned short port, const std::string& callsign, bool debug) :
|
||||||
m_callsign(callsign),
|
m_callsign(callsign),
|
||||||
m_socket(port),
|
m_socket4(port),
|
||||||
|
m_socket6(port),
|
||||||
m_debug(debug)
|
m_debug(debug)
|
||||||
{
|
{
|
||||||
assert(port > 0U);
|
assert(port > 0U);
|
||||||
@ -42,7 +43,17 @@ bool CP25Network::open()
|
|||||||
{
|
{
|
||||||
LogInfo("Opening P25 network connection");
|
LogInfo("Opening P25 network connection");
|
||||||
|
|
||||||
return m_socket.open();
|
sockaddr_storage addr4;
|
||||||
|
addr4.ss_family = AF_INET;
|
||||||
|
|
||||||
|
bool ret = m_socket4.open(addr4);
|
||||||
|
if (!ret)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
sockaddr_storage addr6;
|
||||||
|
addr6.ss_family = AF_INET6;
|
||||||
|
|
||||||
|
return m_socket6.open(addr6);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CP25Network::write(const unsigned char* data, unsigned int length, const sockaddr_storage& addr, unsigned int addrLen)
|
bool CP25Network::write(const unsigned char* data, unsigned int length, const sockaddr_storage& addr, unsigned int addrLen)
|
||||||
@ -53,7 +64,15 @@ bool CP25Network::write(const unsigned char* data, unsigned int length, const so
|
|||||||
if (m_debug)
|
if (m_debug)
|
||||||
CUtils::dump(1U, "P25 Network Data Sent", data, length);
|
CUtils::dump(1U, "P25 Network Data Sent", data, length);
|
||||||
|
|
||||||
return m_socket.write(data, length, addr, addrLen);
|
switch (addr.ss_family) {
|
||||||
|
case AF_INET:
|
||||||
|
return m_socket4.write(data, length, addr, addrLen);
|
||||||
|
case AF_INET6:
|
||||||
|
return m_socket6.write(data, length, addr, addrLen);
|
||||||
|
default:
|
||||||
|
LogError("Unknown socket address family - %u", addr.ss_family);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CP25Network::poll(const sockaddr_storage& addr, unsigned int addrLen)
|
bool CP25Network::poll(const sockaddr_storage& addr, unsigned int addrLen)
|
||||||
@ -68,7 +87,15 @@ bool CP25Network::poll(const sockaddr_storage& addr, unsigned int addrLen)
|
|||||||
if (m_debug)
|
if (m_debug)
|
||||||
CUtils::dump(1U, "P25 Network Poll Sent", data, 11U);
|
CUtils::dump(1U, "P25 Network Poll Sent", data, 11U);
|
||||||
|
|
||||||
return m_socket.write(data, 11U, addr, addrLen);
|
switch (addr.ss_family) {
|
||||||
|
case AF_INET:
|
||||||
|
return m_socket4.write(data, 11U, addr, addrLen);
|
||||||
|
case AF_INET6:
|
||||||
|
return m_socket6.write(data, 11U, addr, addrLen);
|
||||||
|
default:
|
||||||
|
LogError("Unknown socket address family - %u", addr.ss_family);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CP25Network::unlink(const sockaddr_storage& addr, unsigned int addrLen)
|
bool CP25Network::unlink(const sockaddr_storage& addr, unsigned int addrLen)
|
||||||
@ -83,7 +110,15 @@ bool CP25Network::unlink(const sockaddr_storage& addr, unsigned int addrLen)
|
|||||||
if (m_debug)
|
if (m_debug)
|
||||||
CUtils::dump(1U, "P25 Network Unlink Sent", data, 11U);
|
CUtils::dump(1U, "P25 Network Unlink Sent", data, 11U);
|
||||||
|
|
||||||
return m_socket.write(data, 11U, addr, addrLen);
|
switch (addr.ss_family) {
|
||||||
|
case AF_INET:
|
||||||
|
return m_socket4.write(data, 11U, addr, addrLen);
|
||||||
|
case AF_INET6:
|
||||||
|
return m_socket6.write(data, 11U, addr, addrLen);
|
||||||
|
default:
|
||||||
|
LogError("Unknown socket address family - %u", addr.ss_family);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int CP25Network::read(unsigned char* data, unsigned int length, sockaddr_storage& addr, unsigned int& addrLen)
|
unsigned int CP25Network::read(unsigned char* data, unsigned int length, sockaddr_storage& addr, unsigned int& addrLen)
|
||||||
@ -91,7 +126,9 @@ unsigned int CP25Network::read(unsigned char* data, unsigned int length, sockadd
|
|||||||
assert(data != NULL);
|
assert(data != NULL);
|
||||||
assert(length > 0U);
|
assert(length > 0U);
|
||||||
|
|
||||||
int len = m_socket.read(data, length, addr, addrLen);
|
int len = m_socket4.read(data, length, addr, addrLen);
|
||||||
|
if (len <= 0)
|
||||||
|
len = m_socket6.read(data, length, addr, addrLen);
|
||||||
if (len <= 0)
|
if (len <= 0)
|
||||||
return 0U;
|
return 0U;
|
||||||
|
|
||||||
@ -103,7 +140,8 @@ unsigned int CP25Network::read(unsigned char* data, unsigned int length, sockadd
|
|||||||
|
|
||||||
void CP25Network::close()
|
void CP25Network::close()
|
||||||
{
|
{
|
||||||
m_socket.close();
|
m_socket4.close();
|
||||||
|
m_socket6.close();
|
||||||
|
|
||||||
LogInfo("Closing P25 network connection");
|
LogInfo("Closing P25 network connection");
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,8 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::string m_callsign;
|
std::string m_callsign;
|
||||||
CUDPSocket m_socket;
|
CUDPSocket m_socket4;
|
||||||
|
CUDPSocket m_socket6;
|
||||||
bool m_debug;
|
bool m_debug;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user