Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake,udp: improve QOS_FLOWID and PQOS_FLOWID detection #1002

Merged
merged 4 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions cmake/re-config.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
include(CheckIncludeFile)
include(CheckFunctionExists)
include(CheckSymbolExists)
include(CheckTypeSize)

option(USE_MBEDTLS "Enable MbedTLS" OFF)

Expand Down Expand Up @@ -135,6 +136,20 @@ if(WIN32)
WIN32
_WIN32_WINNT=0x0600
)

unset(CMAKE_EXTRA_INCLUDE_FILES)
set(CMAKE_EXTRA_INCLUDE_FILES "winsock2.h;qos2.h")
check_type_size("QOS_FLOWID" HAVE_QOS_FLOWID BUILTIN_TYPES_ONLY)
check_type_size("PQOS_FLOWID" HAVE_PQOS_FLOWID BUILTIN_TYPES_ONLY)
unset(CMAKE_EXTRA_INCLUDE_FILES)

if(HAVE_QOS_FLOWID)
list(APPEND RE_DEFINITIONS HAVE_QOS_FLOWID)
endif()

if(HAVE_PQOS_FLOWID)
list(APPEND RE_DEFINITIONS HAVE_PQOS_FLOWID)
endif()
endif()

if(USE_OPENSSL)
Expand Down
14 changes: 10 additions & 4 deletions src/udp/udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,19 @@
#include <re_sa.h>
#include <re_udp.h>
#ifdef WIN32
#if !defined(_MSC_VER)
typedef UINT32 QOS_FLOWID, *PQOS_FLOWID;
#ifndef HAVE_QOS_FLOWID
typedef UINT32 QOS_FLOWID;
#endif

#ifndef HAVE_PQOS_FLOWID
typedef UINT32 *PQOS_FLOWID;
#endif

#include <qos2.h>

#ifndef QOS_NON_ADAPTIVE_FLOW
#define QOS_NON_ADAPTIVE_FLOW 0x00000002
#endif
#endif /*!_MSC_VER*/
#include <qos2.h>
#endif /*WIN32*/

#define DEBUG_MODULE "udp"
Expand Down
Loading