Skip to content

Commit

Permalink
cmake,udp: improve QOS_FLOWID and PQOS_FLOWID detection
Browse files Browse the repository at this point in the history
  • Loading branch information
sreimers committed Nov 6, 2023
1 parent a4c0656 commit ee4e042
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
14 changes: 14 additions & 0 deletions cmake/re-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,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" HAS_QOS_FLOWID BUILTIN_TYPES_ONLY)
check_type_size("PQOS_FLOWID" HAS_PQOS_FLOWID BUILTIN_TYPES_ONLY)
unset(CMAKE_EXTRA_INCLUDE_FILES)

if(HAS_QOS_FLOWID)
list(APPEND RE_DEFINITIONS HAS_QOS_FLOWID)
endif()

if(HAS_PQOS_FLOWID)
list(APPEND RE_DEFINITIONS HAS_PQOS_FLOWID)
endif()
endif()

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

#ifndef HAS_PQOS_FLOWID
typedef UINT32 *PQOS_FLOWID;
#endif

#ifndef QOS_NON_ADAPTIVE_FLOW
#define QOS_NON_ADAPTIVE_FLOW 0x00000002
#endif
#endif /*!_MSC_VER*/

#include <qos2.h>
#endif /*WIN32*/

Expand Down

0 comments on commit ee4e042

Please sign in to comment.