mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-21 23:45:49 +08:00
Merge branch 'mqtt' into mqtt_plus
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2009-2014,2016,2019,2020,2021,2023 by Jonathan Naylor G4KLX
|
* Copyright (C) 2009-2014,2016,2019,2020,2021,2023,2024 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
|
||||||
@@ -166,7 +166,7 @@ bool CDStarNetwork::writePoll(const char* text)
|
|||||||
buffer[2] = 'R';
|
buffer[2] = 'R';
|
||||||
buffer[3] = 'P';
|
buffer[3] = 'P';
|
||||||
|
|
||||||
buffer[4] = 0x0A; // Poll with text
|
buffer[4] = 0x0AU; // Poll with text
|
||||||
|
|
||||||
unsigned int length = ::strlen(text);
|
unsigned int length = ::strlen(text);
|
||||||
|
|
||||||
@@ -228,6 +228,7 @@ void CDStarNetwork::clock(unsigned int ms)
|
|||||||
|
|
||||||
case 0x01U: // NETWORK_TEMPTEXT;
|
case 0x01U: // NETWORK_TEMPTEXT;
|
||||||
case 0x04U: // NETWORK_STATUS1..5
|
case 0x04U: // NETWORK_STATUS1..5
|
||||||
|
case 0x0AU: // POLL
|
||||||
case 0x24U: // NETWORK_DD_DATA
|
case 0x24U: // NETWORK_DD_DATA
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2020,2021,2023 by Jonathan Naylor G4KLX
|
* Copyright (C) 2020,2021,2023,2024 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
|
||||||
@@ -29,7 +29,6 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
const unsigned int MMDVM_SAMPLERATE = 8000U;
|
const unsigned int MMDVM_SAMPLERATE = 8000U;
|
||||||
|
|
||||||
@@ -47,9 +46,11 @@ m_debug(debug),
|
|||||||
m_enabled(false),
|
m_enabled(false),
|
||||||
m_buffer(2000U, "FM Network"),
|
m_buffer(2000U, "FM Network"),
|
||||||
m_seqNo(0U),
|
m_seqNo(0U),
|
||||||
|
#if defined(HAS_SRC)
|
||||||
m_resampler(NULL),
|
m_resampler(NULL),
|
||||||
|
#endif
|
||||||
m_error(0),
|
m_error(0),
|
||||||
m_fd(-1)
|
m_fp(NULL)
|
||||||
{
|
{
|
||||||
assert(!callsign.empty());
|
assert(!callsign.empty());
|
||||||
assert(gatewayPort > 0U);
|
assert(gatewayPort > 0U);
|
||||||
@@ -69,12 +70,16 @@ m_fd(-1)
|
|||||||
else
|
else
|
||||||
m_protocol = FMNP_USRP;
|
m_protocol = FMNP_USRP;
|
||||||
|
|
||||||
|
#if defined(HAS_SRC)
|
||||||
m_resampler = ::src_new(SRC_SINC_FASTEST, 1, &m_error);
|
m_resampler = ::src_new(SRC_SINC_FASTEST, 1, &m_error);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
CFMNetwork::~CFMNetwork()
|
CFMNetwork::~CFMNetwork()
|
||||||
{
|
{
|
||||||
|
#if defined(HAS_SRC)
|
||||||
::src_delete(m_resampler);
|
::src_delete(m_resampler);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CFMNetwork::open()
|
bool CFMNetwork::open()
|
||||||
@@ -86,14 +91,25 @@ bool CFMNetwork::open()
|
|||||||
|
|
||||||
LogMessage("Opening FM network connection");
|
LogMessage("Opening FM network connection");
|
||||||
|
|
||||||
if (!m_squelchFile.empty()) {
|
if (m_protocol == FMNP_RAW) {
|
||||||
m_fd = ::open(m_squelchFile.c_str(), O_WRONLY | O_SYNC);
|
if (!m_squelchFile.empty()) {
|
||||||
if (m_fd == -1) {
|
m_fp = ::fopen(m_squelchFile.c_str(), "wb");
|
||||||
LogError("Cannot open the squelch file: %s, errno=%d", m_squelchFile.c_str(), errno);
|
if (m_fp == NULL) {
|
||||||
return false;
|
#if !defined(_WIN32) && !defined(_WIN64)
|
||||||
|
LogError("Cannot open the squelch file: %s, errno=%d", m_squelchFile.c_str(), errno);
|
||||||
|
#else
|
||||||
|
LogError("Cannot open the squelch file: %s, errno=%lu", m_squelchFile.c_str(), ::GetLastError());
|
||||||
|
#endif
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((m_protocol == FMNP_RAW) && (m_sampleRate != MMDVM_SAMPLERATE)) {
|
||||||
|
LogError("The resampler needed for non-native sample rates has not been included");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return m_socket.open(m_addr);
|
return m_socket.open(m_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,6 +215,7 @@ bool CFMNetwork::writeRawData(const float* in, unsigned int nIn)
|
|||||||
|
|
||||||
unsigned int length = 0U;
|
unsigned int length = 0U;
|
||||||
|
|
||||||
|
#if defined(HAS_SRC)
|
||||||
if (m_sampleRate != MMDVM_SAMPLERATE) {
|
if (m_sampleRate != MMDVM_SAMPLERATE) {
|
||||||
unsigned int nOut = (nIn * m_sampleRate) / MMDVM_SAMPLERATE;
|
unsigned int nOut = (nIn * m_sampleRate) / MMDVM_SAMPLERATE;
|
||||||
|
|
||||||
@@ -225,13 +242,16 @@ bool CFMNetwork::writeRawData(const float* in, unsigned int nIn)
|
|||||||
buffer[length++] = (val >> 8) & 0xFFU;
|
buffer[length++] = (val >> 8) & 0xFFU;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
#endif
|
||||||
for (unsigned int i = 0U; i < nIn; i++) {
|
for (unsigned int i = 0U; i < nIn; i++) {
|
||||||
short val = short(in[i] * 32767.0F + 0.5F); // Changing audio format from float to S16LE
|
short val = short(in[i] * 32767.0F + 0.5F); // Changing audio format from float to S16LE
|
||||||
|
|
||||||
buffer[length++] = (val >> 0) & 0xFFU;
|
buffer[length++] = (val >> 0) & 0xFFU;
|
||||||
buffer[length++] = (val >> 8) & 0xFFU;
|
buffer[length++] = (val >> 8) & 0xFFU;
|
||||||
}
|
}
|
||||||
|
#if defined(HAS_SRC)
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (m_debug)
|
if (m_debug)
|
||||||
CUtils::dump(1U, "FM Network Data Sent", buffer, length);
|
CUtils::dump(1U, "FM Network Data Sent", buffer, length);
|
||||||
@@ -317,12 +337,18 @@ bool CFMNetwork::writeRawEnd()
|
|||||||
{
|
{
|
||||||
m_seqNo = 0U;
|
m_seqNo = 0U;
|
||||||
|
|
||||||
if (m_fd != -1) {
|
if (m_fp != NULL) {
|
||||||
size_t n = ::write(m_fd, "Z", 1);
|
size_t n = ::fwrite("Z", 1, 1, m_fp);
|
||||||
if (n != 1) {
|
if (n != 1) {
|
||||||
|
#if !defined(_WIN32) && !defined(_WIN64)
|
||||||
LogError("Cannot write to the squelch file: %s, errno=%d", m_squelchFile.c_str(), errno);
|
LogError("Cannot write to the squelch file: %s, errno=%d", m_squelchFile.c_str(), errno);
|
||||||
|
#else
|
||||||
|
LogError("Cannot write to the squelch file: %s, errno=%lu", m_squelchFile.c_str(), ::GetLastError());
|
||||||
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
::fflush(m_fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -387,6 +413,7 @@ unsigned int CFMNetwork::readData(float* out, unsigned int nOut)
|
|||||||
if (bytes == 0U)
|
if (bytes == 0U)
|
||||||
return 0U;
|
return 0U;
|
||||||
|
|
||||||
|
#if defined(HAS_SRC)
|
||||||
if ((m_protocol == FMNP_RAW) && (m_sampleRate != MMDVM_SAMPLERATE)) {
|
if ((m_protocol == FMNP_RAW) && (m_sampleRate != MMDVM_SAMPLERATE)) {
|
||||||
unsigned int nIn = (nOut * m_sampleRate) / MMDVM_SAMPLERATE;
|
unsigned int nIn = (nOut * m_sampleRate) / MMDVM_SAMPLERATE;
|
||||||
|
|
||||||
@@ -419,6 +446,7 @@ unsigned int CFMNetwork::readData(float* out, unsigned int nOut)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
#endif
|
||||||
if (bytes < nOut)
|
if (bytes < nOut)
|
||||||
nOut = bytes;
|
nOut = bytes;
|
||||||
|
|
||||||
@@ -429,7 +457,9 @@ unsigned int CFMNetwork::readData(float* out, unsigned int nOut)
|
|||||||
short val = ((buffer[i * 2U + 0U] & 0xFFU) << 0) + ((buffer[i * 2U + 1U] & 0xFFU) << 8);
|
short val = ((buffer[i * 2U + 0U] & 0xFFU) << 0) + ((buffer[i * 2U + 1U] & 0xFFU) << 8);
|
||||||
out[i] = float(val) / 65536.0F;
|
out[i] = float(val) / 65536.0F;
|
||||||
}
|
}
|
||||||
|
#if defined(HAS_SRC)
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return nOut;
|
return nOut;
|
||||||
}
|
}
|
||||||
@@ -443,9 +473,9 @@ void CFMNetwork::close()
|
|||||||
{
|
{
|
||||||
m_socket.close();
|
m_socket.close();
|
||||||
|
|
||||||
if (m_fd != -1) {
|
if (m_fp != NULL) {
|
||||||
::close(m_fd);
|
::fclose(m_fp);
|
||||||
m_fd = -1;
|
m_fp = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
LogMessage("Closing FM network connection");
|
LogMessage("Closing FM network connection");
|
||||||
@@ -560,12 +590,18 @@ bool CFMNetwork::writeUSRPStart()
|
|||||||
|
|
||||||
bool CFMNetwork::writeRawStart()
|
bool CFMNetwork::writeRawStart()
|
||||||
{
|
{
|
||||||
if (m_fd != -1) {
|
if (m_fp != NULL) {
|
||||||
size_t n = ::write(m_fd, "O", 1);
|
size_t n = ::fwrite("O", 1, 1, m_fp);
|
||||||
if (n != 1) {
|
if (n != 1) {
|
||||||
|
#if !defined(_WIN32) && !defined(_WIN64)
|
||||||
LogError("Cannot write to the squelch file: %s, errno=%d", m_squelchFile.c_str(), errno);
|
LogError("Cannot write to the squelch file: %s, errno=%d", m_squelchFile.c_str(), errno);
|
||||||
|
#else
|
||||||
|
LogError("Cannot write to the squelch file: %s, errno=%lu", m_squelchFile.c_str(), ::GetLastError());
|
||||||
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
::fflush(m_fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
10
FMNetwork.h
10
FMNetwork.h
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2020,2021,2023 by Jonathan Naylor G4KLX
|
* Copyright (C) 2020,2021,2023,2024 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
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef FMNetwork_H
|
#if !defined(FMNetwork_H)
|
||||||
#define FMNetwork_H
|
#define FMNetwork_H
|
||||||
|
|
||||||
#include "RingBuffer.h"
|
#include "RingBuffer.h"
|
||||||
@@ -25,7 +25,9 @@
|
|||||||
|
|
||||||
#if defined(USE_FM)
|
#if defined(USE_FM)
|
||||||
|
|
||||||
|
#if defined(HAS_SRC)
|
||||||
#include <samplerate.h>
|
#include <samplerate.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -68,9 +70,11 @@ private:
|
|||||||
bool m_enabled;
|
bool m_enabled;
|
||||||
CRingBuffer<unsigned char> m_buffer;
|
CRingBuffer<unsigned char> m_buffer;
|
||||||
unsigned int m_seqNo;
|
unsigned int m_seqNo;
|
||||||
|
#if defined(HAS_SRC)
|
||||||
SRC_STATE* m_resampler;
|
SRC_STATE* m_resampler;
|
||||||
|
#endif
|
||||||
int m_error;
|
int m_error;
|
||||||
int m_fd;
|
FILE* m_fp;
|
||||||
|
|
||||||
bool writeUSRPStart();
|
bool writeUSRPStart();
|
||||||
bool writeRawStart();
|
bool writeRawStart();
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ static CMMDVMHost* host = NULL;
|
|||||||
const char* HEADER1 = "This software is for use on amateur radio networks only,";
|
const char* HEADER1 = "This software is for use on amateur radio networks only,";
|
||||||
const char* HEADER2 = "it is to be used for educational purposes only. Its use on";
|
const char* HEADER2 = "it is to be used for educational purposes only. Its use on";
|
||||||
const char* HEADER3 = "commercial networks is strictly prohibited.";
|
const char* HEADER3 = "commercial networks is strictly prohibited.";
|
||||||
const char* HEADER4 = "Copyright(C) 2015-2023 by Jonathan Naylor, G4KLX and others";
|
const char* HEADER4 = "Copyright(C) 2015-2024 by Jonathan Naylor, G4KLX and others";
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -93,6 +93,7 @@
|
|||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
@@ -107,6 +108,7 @@
|
|||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
</Link>
|
</Link>
|
||||||
<PreBuildEvent>
|
<PreBuildEvent>
|
||||||
<Command>"$(ProjectDir)prebuild.cmd" $(ProjectDir)</Command>
|
<Command>"$(ProjectDir)prebuild.cmd" $(ProjectDir)</Command>
|
||||||
@@ -131,6 +133,7 @@
|
|||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
@@ -149,6 +152,7 @@
|
|||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
2
Makefile
2
Makefile
@@ -1,5 +1,7 @@
|
|||||||
# This makefile is for all platforms.
|
# This makefile is for all platforms.
|
||||||
|
|
||||||
|
# If you have the resampler library installed, add -DHAS_SRC to the CFLAGS line, and -lsamplerate to the LIBS line.
|
||||||
|
|
||||||
CC = cc
|
CC = cc
|
||||||
CXX = c++
|
CXX = c++
|
||||||
CFLAGS = -g -O3 -Wall -std=c++0x -pthread -I/usr/local/include
|
CFLAGS = -g -O3 -Wall -std=c++0x -pthread -I/usr/local/include
|
||||||
|
|||||||
@@ -295,7 +295,6 @@ bool CUARTController::setRaw()
|
|||||||
termios.c_cc[VTIME] = 10;
|
termios.c_cc[VTIME] = 10;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(B38400) || (B38400 != 38400)
|
|
||||||
switch (m_speed) {
|
switch (m_speed) {
|
||||||
#if defined(B1200)
|
#if defined(B1200)
|
||||||
case 1200U:
|
case 1200U:
|
||||||
@@ -368,10 +367,6 @@ bool CUARTController::setRaw()
|
|||||||
::close(m_fd);
|
::close(m_fd);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
::cfsetospeed(&termios, m_speed);
|
|
||||||
::cfsetispeed(&termios, m_speed);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (::tcsetattr(m_fd, TCSANOW, &termios) < 0) {
|
if (::tcsetattr(m_fd, TCSANOW, &termios) < 0) {
|
||||||
LogError("Cannot set the attributes for %s", m_device.c_str());
|
LogError("Cannot set the attributes for %s", m_device.c_str());
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef UDPSocket_H
|
#if !defined(UDPSocket_H)
|
||||||
#define UDPSocket_H
|
#define UDPSocket_H
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -33,6 +33,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#else
|
#else
|
||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
|
#include <Winsock2.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
enum IPMATCHTYPE {
|
enum IPMATCHTYPE {
|
||||||
@@ -69,10 +70,11 @@ private:
|
|||||||
unsigned short m_localPort;
|
unsigned short m_localPort;
|
||||||
#if defined(_WIN32) || defined(_WIN64)
|
#if defined(_WIN32) || defined(_WIN64)
|
||||||
SOCKET m_fd;
|
SOCKET m_fd;
|
||||||
|
int m_af;
|
||||||
#else
|
#else
|
||||||
int m_fd;
|
int m_fd;
|
||||||
#endif
|
|
||||||
sa_family_t m_af;
|
sa_family_t m_af;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user