qrtplib: Windows build

This commit is contained in:
f4exb 2018-03-05 16:40:53 +01:00
parent e86e2f25a2
commit 3c4d40ac73
5 changed files with 194 additions and 142 deletions

View File

@ -10,6 +10,8 @@ TEMPLATE = lib
TARGET = httpserver
INCLUDEPATH += $$PWD
INCLUDEPATH += ../sdrbase
QMAKE_CXXFLAGS += -std=c++11
CONFIG(Release):build_subdir = release

View File

@ -1,100 +1,100 @@
project(qrtplib)
set (qrtplib_HEADERS
rtcpapppacket.h
rtcpbyepacket.h
rtcpcompoundpacket.h
rtcpcompoundpacketbuilder.h
rtcppacket.h
rtcppacketbuilder.h
rtcprrpacket.h
rtcpscheduler.h
rtcpsdesinfo.h
rtcpsdespacket.h
rtcpsrpacket.h
rtcpunknownpacket.h
rtpaddress.h
rtpcollisionlist.h
rtpconfig.h
rtpdefines.h
rtpendian.h
rtperrors.h
rtphashtable.h
rtpinternalsourcedata.h
# rtpipv4address.h
# rtpipv4destination.h
rtpkeyhashtable.h
rtplibraryversion.h
rtppacket.h
rtppacketbuilder.h
rtprandom.h
rtprandomrand48.h
rtprandomrands.h
rtprandomurandom.h
rtprawpacket.h
rtpsession.h
rtpsessionparams.h
rtpsessionsources.h
rtpsourcedata.h
rtpsources.h
rtpstructs.h
rtptimeutilities.h
rtptransmitter.h
rtptypes_win.h
rtptypes.h
rtpudpransmitter.h
# rtpudpv4transmitter.h
rtcpapppacket.h
rtcpbyepacket.h
rtcpcompoundpacket.h
rtcpcompoundpacketbuilder.h
rtcppacket.h
rtcppacketbuilder.h
rtcprrpacket.h
rtcpscheduler.h
rtcpsdesinfo.h
rtcpsdespacket.h
rtcpsrpacket.h
rtcpunknownpacket.h
rtpaddress.h
rtpcollisionlist.h
rtpconfig.h
rtpdefines.h
rtpendian.h
rtperrors.h
rtphashtable.h
rtpinternalsourcedata.h
# rtpipv4address.h
# rtpipv4destination.h
rtpkeyhashtable.h
rtplibraryversion.h
rtppacket.h
rtppacketbuilder.h
rtprandom.h
rtprandomrand48.h
rtprandomrands.h
rtprandomurandom.h
rtprawpacket.h
rtpsession.h
rtpsessionparams.h
rtpsessionsources.h
rtpsourcedata.h
rtpsources.h
rtpstructs.h
rtptimeutilities.h
rtptransmitter.h
rtptypes_win.h
rtptypes.h
rtpudptransmitter.h
# rtpudpv4transmitter.h
# rtpudpv4transmitternobind.h
# rtpexternaltransmitter.h
rtpsocketutil.h
rtpabortdescriptors.h
rtpselect.h
# rtptcpaddress.h
# rtptcptransmitter.h
)
# rtpexternaltransmitter.h
rtpsocketutil.h
rtpabortdescriptors.h
rtpselect.h
# rtptcpaddress.h
# rtptcptransmitter.h
)
set(qrtplib_SOURCES
rtcpapppacket.cpp
rtcpbyepacket.cpp
rtcpcompoundpacket.cpp
rtcpcompoundpacketbuilder.cpp
rtcppacketbuilder.cpp
rtcprrpacket.cpp
rtcpscheduler.cpp
rtcpsdesinfo.cpp
rtcpsdespacket.cpp
rtcpsrpacket.cpp
rtpaddress.cpp
rtpcollisionlist.cpp
rtperrors.cpp
rtpinternalsourcedata.cpp
# rtpipv4address.cpp
# rtpipv4destination.cpp
rtplibraryversion.cpp
rtppacket.cpp
rtppacketbuilder.cpp
rtprandom.cpp
rtprandomrand48.cpp
rtprandomrands.cpp
rtprandomurandom.cpp
rtpsession.cpp
rtpsessionparams.cpp
rtpsessionsources.cpp
rtpsourcedata.cpp
rtpsources.cpp
rtptimeutilities.cpp
rtpudptransmitter.cpp
# rtpudpv4transmitter.cpp
rtcpapppacket.cpp
rtcpbyepacket.cpp
rtcpcompoundpacket.cpp
rtcpcompoundpacketbuilder.cpp
rtcppacketbuilder.cpp
rtcprrpacket.cpp
rtcpscheduler.cpp
rtcpsdesinfo.cpp
rtcpsdespacket.cpp
rtcpsrpacket.cpp
rtpaddress.cpp
rtpcollisionlist.cpp
rtperrors.cpp
rtpinternalsourcedata.cpp
# rtpipv4address.cpp
# rtpipv4destination.cpp
rtplibraryversion.cpp
rtppacket.cpp
rtppacketbuilder.cpp
rtprandom.cpp
rtprandomrand48.cpp
rtprandomrands.cpp
rtprandomurandom.cpp
rtpsession.cpp
rtpsessionparams.cpp
rtpsessionsources.cpp
rtpsourcedata.cpp
rtpsources.cpp
rtptimeutilities.cpp
rtpudptransmitter.cpp
# rtpudpv4transmitter.cpp
# rtpudpv4transmitternobind.cpp
# rtpexternaltransmitter.cpp
rtpabortdescriptors.cpp
# rtptcpaddress.cpp
# rtptcptransmitter.cpp
)
# rtpexternaltransmitter.cpp
rtpabortdescriptors.cpp
# rtptcpaddress.cpp
# rtptcptransmitter.cpp
)
include_directories(
.
${CMAKE_SOURCE_DIR}/sdrbase
${CMAKE_SOURCE_DIR}/sdrbase
${CMAKE_CURRENT_BINARY_DIR}
)

96
qrtplib/qrtplib.pro Normal file
View File

@ -0,0 +1,96 @@
#--------------------------------------------------------
#
# Pro file for Windows builds with Qt Creator
#
#--------------------------------------------------------
QT += core network
TEMPLATE = lib
TARGET = qrtplib
INCLUDEPATH += $$PWD
INCLUDEPATH += ../sdrbase
QMAKE_CXXFLAGS += -std=c++11
CONFIG(Release):build_subdir = release
CONFIG(Debug):build_subdir = debug
# Enable very detailed debug messages when compiling the debug version
CONFIG(debug, debug|release) {
DEFINES += SUPERVERBOSE
}
HEADERS += $$PWD/rtcpapppacket.h \
$$PWD/rtcpbyepacket.h \
$$PWD/rtcpcompoundpacket.h \
$$PWD/rtcpcompoundpacketbuilder.h \
$$PWD/rtcppacket.h \
$$PWD/rtcppacketbuilder.h \
$$PWD/rtcprrpacket.h \
$$PWD/rtcpscheduler.h \
$$PWD/rtcpsdesinfo.h \
$$PWD/rtcpsdespacket.h \
$$PWD/rtcpsrpacket.h \
$$PWD/rtcpunknownpacket.h \
$$PWD/rtpaddress.h \
$$PWD/rtpcollisionlist.h \
$$PWD/rtpconfig.h \
$$PWD/rtpdefines.h \
$$PWD/rtpendian.h \
$$PWD/rtperrors.h \
$$PWD/rtphashtable.h \
$$PWD/rtpinternalsourcedata.h \
$$PWD/rtpkeyhashtable.h \
$$PWD/rtplibraryversion.h \
$$PWD/rtppacket.h \
$$PWD/rtppacketbuilder.h \
$$PWD/rtprandom.h \
$$PWD/rtprandomrand48.h \
$$PWD/rtprandomrands.h \
$$PWD/rtprandomurandom.h \
$$PWD/rtprawpacket.h \
$$PWD/rtpsession.h \
$$PWD/rtpsessionparams.h \
$$PWD/rtpsessionsources.h \
$$PWD/rtpsourcedata.h \
$$PWD/rtpsources.h \
$$PWD/rtpstructs.h \
$$PWD/rtptimeutilities.h \
$$PWD/rtptransmitter.h \
$$PWD/rtptypes_win.h \
$$PWD/rtptypes.h \
$$PWD/rtpudptransmitter.h \
$$PWD/rtpsocketutil.h \
$$PWD/rtpselect.h
SOURCES += $$PWD/rtcpapppacket.cpp \
$$PWD/rtcpbyepacket.cpp \
$$PWD/rtcpcompoundpacket.cpp \
$$PWD/rtcpcompoundpacketbuilder.cpp \
$$PWD/rtcppacketbuilder.cpp \
$$PWD/rtcprrpacket.cpp \
$$PWD/rtcpscheduler.cpp \
$$PWD/rtcpsdesinfo.cpp \
$$PWD/rtcpsdespacket.cpp \
$$PWD/rtcpsrpacket.cpp \
$$PWD/rtpaddress.cpp \
$$PWD/rtpcollisionlist.cpp \
$$PWD/rtperrors.cpp \
$$PWD/rtpinternalsourcedata.cpp \
$$PWD/rtplibraryversion.cpp \
$$PWD/rtppacket.cpp \
$$PWD/rtppacketbuilder.cpp \
$$PWD/rtprandom.cpp \
$$PWD/rtprandomrand48.cpp \
$$PWD/rtprandomrands.cpp \
$$PWD/rtprandomurandom.cpp \
$$PWD/rtpsession.cpp \
$$PWD/rtpsessionparams.cpp \
$$PWD/rtpsessionsources.cpp \
$$PWD/rtpsourcedata.cpp \
$$PWD/rtpsources.cpp \
$$PWD/rtptimeutilities.cpp \
$$PWD/rtpudptransmitter.cpp

View File

@ -48,12 +48,11 @@
#include "rtcpcompoundpacket.h"
#endif // RTP_SUPPORT_SENDAPP
#include "rtpinternalutils.h"
#ifndef WIN32
#include <unistd.h>
#include <stdlib.h>
#else
#include <winbase.h>
#endif // WIN32
#include <QHostInfo>
namespace qrtplib
@ -1145,51 +1144,6 @@ int RTPSession::ProcessPolledData()
int RTPSession::CreateCNAME(uint8_t *buffer, std::size_t *bufferlength, bool resolve __attribute__((unused)))
{
#ifndef WIN32
bool gotlogin = true;
#ifdef RTP_SUPPORT_GETLOGINR
buffer[0] = 0;
if (getlogin_r((char *) buffer, *bufferlength) != 0)
gotlogin = false;
else
{
if (buffer[0] == 0)
gotlogin = false;
}
if (!gotlogin) // try regular getlogin
{
char *loginname = getlogin();
if (loginname == 0)
gotlogin = false;
else
strncpy((char *) buffer, loginname, *bufferlength);
}
#else
char *loginname = getlogin();
if (loginname == 0)
gotlogin = false;
else
strncpy((char *)buffer,loginname,*bufferlength);
#endif // RTP_SUPPORT_GETLOGINR
if (!gotlogin)
{
char *logname = getenv("LOGNAME");
if (logname == 0)
return ERR_RTP_SESSION_CANTGETLOGINNAME;
strncpy((char *) buffer, logname, *bufferlength);
}
#else // Win32 version
#ifndef _WIN32_WCE
DWORD len = *bufferlength;
if (!GetUserName((LPTSTR)buffer,&len))
strncpy((char *)buffer,"unknown",*bufferlength);
#else
strncpy((char *)buffer,"unknown",*bufferlength);
#endif // _WIN32_WCE
#endif // WIN32
buffer[*bufferlength - 1] = 0;
std::size_t offset = strlen((const char *) buffer);
@ -1199,16 +1153,15 @@ int RTPSession::CreateCNAME(uint8_t *buffer, std::size_t *bufferlength, bool res
std::size_t buflen2 = *bufferlength - offset;
char hostname[1024];
QString hostnameStr = QHostInfo::localHostName();
int hostnameSize = hostnameStr.size();
strncpy(hostname, "localhost", 1024); // just in case gethostname fails
strncpy((char * )(buffer + offset), hostnameStr.toStdString().c_str(), buflen2);
*bufferlength = offset + hostnameSize;
gethostname(hostname, 1024);
strncpy((char * )(buffer + offset), hostname, buflen2);
*bufferlength = offset + strlen(hostname);
if (*bufferlength > RTCP_SDES_MAXITEMLENGTH)
*bufferlength = RTCP_SDES_MAXITEMLENGTH;
return 0;
}

View File

@ -11,6 +11,7 @@ CONFIG += ordered
SUBDIRS = serialdv
SUBDIRS += httpserver
SUBDIRS += logging
SUBDIRS += qrtplib
SUBDIRS += swagger
SUBDIRS += sdrbase
SUBDIRS += sdrgui