Skip to content

Commit

Permalink
cmake,udp: improve QOS_FLOWID and PQOS_FLOWID detection (#1002)
Browse files Browse the repository at this point in the history
  • Loading branch information
sreimers authored Nov 6, 2023
1 parent a4c0656 commit fb2cbe1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
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

0 comments on commit fb2cbe1

Please sign in to comment.