mirror of
https://github.com/mfontanini/libtins
synced 2026-01-23 02:35:57 +01:00
Only enable TCP stream's custom data if boost.any is found
This commit is contained in:
@@ -144,10 +144,12 @@ ELSE()
|
||||
MESSAGE(STATUS "Disabling TCPIP classes")
|
||||
ENDIF()
|
||||
|
||||
# Search for libboost
|
||||
FIND_PACKAGE(Boost)
|
||||
|
||||
# Optionally enable the ACK tracker (on by default)
|
||||
OPTION(LIBTINS_ENABLE_ACK_TRACKER "Enable TCP ACK tracking support" ON)
|
||||
IF(LIBTINS_ENABLE_ACK_TRACKER AND TINS_HAVE_CXX11)
|
||||
FIND_PACKAGE(Boost)
|
||||
IF (Boost_FOUND)
|
||||
MESSAGE(STATUS "Enabling TCP ACK tracking support.")
|
||||
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
|
||||
@@ -161,6 +163,22 @@ ELSE()
|
||||
MESSAGE(STATUS "Disabling ACK tracking support")
|
||||
ENDIF()
|
||||
|
||||
# Optionally enable the TCP stream custom data (on by default)
|
||||
OPTION(LIBTINS_ENABLE_TCP_STREAM_CUSTOM_DATA "Enable TCP stream custom data support" ON)
|
||||
IF(LIBTINS_ENABLE_TCP_STREAM_CUSTOM_DATA AND TINS_HAVE_CXX11)
|
||||
IF (Boost_FOUND)
|
||||
MESSAGE(STATUS "Enabling TCP stream custom data support.")
|
||||
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
|
||||
SET(TINS_HAVE_TCP_STREAM_CUSTOM_DATA ON)
|
||||
ELSE()
|
||||
MESSAGE(WARNING "Disabling TCP stream custom data support as boost.any was not found")
|
||||
SET(TINS_HAVE_TCP_STREAM_CUSTOM_DATA OFF)
|
||||
ENDIF()
|
||||
ELSE()
|
||||
SET(TINS_HAVE_TCP_STREAM_CUSTOM_DATA OFF)
|
||||
MESSAGE(STATUS "Disabling TCP stream custom data support")
|
||||
ENDIF()
|
||||
|
||||
OPTION(LIBTINS_ENABLE_WPA2_CALLBACKS "Enable WPA2 callback interface" ON)
|
||||
IF(LIBTINS_ENABLE_WPA2_CALLBACKS AND TINS_HAVE_WPA2_DECRYPTION AND TINS_HAVE_CXX11)
|
||||
SET(STATUS "Enabling WPA2 callback interface")
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
/* Have TCP ACK tracking */
|
||||
#cmakedefine TINS_HAVE_ACK_TRACKER
|
||||
|
||||
/* Have TCP stream custom data */
|
||||
#cmakedefine TINS_HAVE_TCP_STREAM_CUSTOM_DATA
|
||||
|
||||
/* Have GCC builtin swap */
|
||||
#cmakedefine TINS_HAVE_GCC_BUILTIN_SWAP
|
||||
|
||||
|
||||
@@ -40,10 +40,13 @@
|
||||
#include <functional>
|
||||
#include <chrono>
|
||||
#include <stdint.h>
|
||||
#include <boost/any.hpp>
|
||||
#include "../macros.h"
|
||||
#include "../hw_address.h"
|
||||
#include "flow.h"
|
||||
#include "config.h"
|
||||
#ifdef TINS_HAVE_TCP_STREAM_CUSTOM_DATA
|
||||
#include <boost/any.hpp>
|
||||
#endif
|
||||
|
||||
namespace Tins {
|
||||
|
||||
@@ -363,6 +366,7 @@ public:
|
||||
*/
|
||||
bool ack_tracking_enabled() const;
|
||||
|
||||
#ifdef TINS_HAVE_TCP_STREAM_CUSTOM_DATA
|
||||
/**
|
||||
* \brief Create or retrieve an application-specific payload for this stream.
|
||||
*
|
||||
@@ -381,6 +385,7 @@ public:
|
||||
};
|
||||
return boost::any_cast<T&>(user_data_);
|
||||
}
|
||||
#endif // TINS_HAVE_TCP_STREAM_CUSTOM_DATA
|
||||
|
||||
private:
|
||||
static Flow extract_client_flow(const PDU& packet);
|
||||
@@ -409,7 +414,9 @@ private:
|
||||
bool auto_cleanup_client_;
|
||||
bool auto_cleanup_server_;
|
||||
|
||||
#ifdef TINS_HAVE_TCP_STREAM_CUSTOM_DATA
|
||||
boost::any user_data_;
|
||||
#endif // TINS_HAVE_TCP_STREAM_CUSTOM_DATA
|
||||
};
|
||||
|
||||
} // TCPIP
|
||||
|
||||
Reference in New Issue
Block a user