mirror of
https://github.com/mfontanini/libtins
synced 2026-01-22 18:25:57 +01:00
Prefix HAVE_ config.h macros with TINS_
This commit is contained in:
@@ -66,7 +66,7 @@ INCLUDE(ExternalProject)
|
||||
INCLUDE(CheckCXXFeatures)
|
||||
|
||||
IF(HAS_GCC_BUILTIN_SWAP)
|
||||
SET(HAVE_GCC_BUILTIN_SWAP ON)
|
||||
SET(TINS_HAVE_GCC_BUILTIN_SWAP ON)
|
||||
ENDIF()
|
||||
|
||||
# C++11 support
|
||||
@@ -76,7 +76,7 @@ IF(LIBTINS_ENABLE_CXX11)
|
||||
# at least on VC2013
|
||||
IF(HAS_CXX11_RVALUE_REFERENCES AND HAS_CXX11_FUNCTIONAL AND HAS_CXX11_CHRONO AND
|
||||
((HAS_CXX11_DECLVAL AND HAS_CXX11_DECLTYPE) OR MSVC))
|
||||
SET(HAVE_CXX11 ON)
|
||||
SET(TINS_HAVE_CXX11 ON)
|
||||
MESSAGE(STATUS "Enabling C++11 features")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX11_COMPILER_FLAGS}")
|
||||
ELSE()
|
||||
@@ -95,11 +95,11 @@ ENDIF(LIBTINS_ENABLE_CXX11)
|
||||
OPTION(LIBTINS_ENABLE_DOT11 "Compile libtins with IEEE 802.11 support" ON)
|
||||
OPTION(LIBTINS_ENABLE_WPA2 "Compile libtins with WPA2 decryption features (requires OpenSSL)" ON)
|
||||
IF(LIBTINS_ENABLE_DOT11)
|
||||
SET(HAVE_DOT11 ON)
|
||||
SET(TINS_HAVE_DOT11 ON)
|
||||
MESSAGE(STATUS "Enabling IEEE 802.11 support.")
|
||||
IF(LIBTINS_ENABLE_WPA2)
|
||||
FIND_PACKAGE(OpenSSL REQUIRED)
|
||||
SET(HAVE_WPA2_DECRYPTION ON)
|
||||
SET(TINS_HAVE_WPA2_DECRYPTION ON)
|
||||
MESSAGE(STATUS "Enabling WPA2 decryption support.")
|
||||
ELSE(LIBTINS_ENABLE_WPA2)
|
||||
MESSAGE(STATUS "Disabling WPA2 decryption support.")
|
||||
@@ -107,18 +107,18 @@ IF(LIBTINS_ENABLE_DOT11)
|
||||
ENDIF(LIBTINS_ENABLE_DOT11)
|
||||
|
||||
OPTION(LIBTINS_ENABLE_ACK_TRACKER "Enable TCP ACK tracking support" ON)
|
||||
IF(LIBTINS_ENABLE_ACK_TRACKER AND HAVE_CXX11)
|
||||
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)
|
||||
SET(HAVE_ACK_TRACKER ON)
|
||||
SET(TINS_HAVE_ACK_TRACKER ON)
|
||||
ELSE()
|
||||
MESSAGE(WARNING "Disabling ACK tracking support as boost.icl was not found")
|
||||
SET(HAVE_ACK_TRACKER OFF)
|
||||
SET(TINS_HAVE_ACK_TRACKER OFF)
|
||||
ENDIF()
|
||||
ELSE()
|
||||
SET(HAVE_ACK_TRACKER OFF)
|
||||
SET(TINS_HAVE_ACK_TRACKER OFF)
|
||||
MESSAGE(STATUS "Disabling ACK tracking support")
|
||||
ENDIF()
|
||||
|
||||
@@ -132,7 +132,7 @@ ENDIF(WIN32)
|
||||
OPTION(LIBTINS_USE_PCAP_SENDPACKET "Use pcap_sendpacket to send l2 packets"
|
||||
${USE_PCAP_SENDPACKET_DEFAULT})
|
||||
IF(LIBTINS_USE_PCAP_SENDPACKET)
|
||||
SET(HAVE_PACKET_SENDER_PCAP_SENDPACKET ON)
|
||||
SET(TINS_HAVE_PACKET_SENDER_PCAP_SENDPACKET ON)
|
||||
MESSAGE(STATUS "Using pcap_sendpacket to send l2 packets.")
|
||||
ENDIF(LIBTINS_USE_PCAP_SENDPACKET)
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ IF(libtins_FOUND)
|
||||
)
|
||||
LINK_LIBRARIES(${LIBTINS_LIBRARIES})
|
||||
|
||||
IF(HAVE_CXX11)
|
||||
IF(TINS_HAVE_CXX11)
|
||||
SET(LIBTINS_CXX11_EXAMPLES
|
||||
arpmonitor
|
||||
dns_queries
|
||||
@@ -28,9 +28,9 @@ IF(libtins_FOUND)
|
||||
ELSE()
|
||||
MESSAGE(WARNING "Disabling HTTP requests example since boost.regex was not found")
|
||||
ENDIF()
|
||||
ELSE(HAVE_CXX11)
|
||||
ELSE(TINS_HAVE_CXX11)
|
||||
MESSAGE(WARNING "Disabling some examples since C++11 support is disabled.")
|
||||
ENDIF(HAVE_CXX11)
|
||||
ENDIF(TINS_HAVE_CXX11)
|
||||
|
||||
ADD_CUSTOM_TARGET(
|
||||
examples DEPENDS
|
||||
@@ -43,7 +43,7 @@ IF(libtins_FOUND)
|
||||
|
||||
ADD_EXECUTABLE(arpspoofing EXCLUDE_FROM_ALL arpspoofing.cpp)
|
||||
ADD_EXECUTABLE(route_table EXCLUDE_FROM_ALL route_table.cpp)
|
||||
IF(HAVE_CXX11)
|
||||
IF(TINS_HAVE_CXX11)
|
||||
ADD_EXECUTABLE(arpmonitor EXCLUDE_FROM_ALL arpmonitor.cpp)
|
||||
ADD_EXECUTABLE(dns_queries EXCLUDE_FROM_ALL dns_queries.cpp)
|
||||
ADD_EXECUTABLE(dns_spoof EXCLUDE_FROM_ALL dns_spoof.cpp)
|
||||
@@ -56,17 +56,17 @@ IF(libtins_FOUND)
|
||||
ADD_EXECUTABLE(http_requests EXCLUDE_FROM_ALL http_requests.cpp)
|
||||
TARGET_LINK_LIBRARIES(http_requests ${Boost_LIBRARIES})
|
||||
ENDIF()
|
||||
ENDIF(HAVE_CXX11)
|
||||
ENDIF(TINS_HAVE_CXX11)
|
||||
|
||||
ADD_EXECUTABLE(beacon_display EXCLUDE_FROM_ALL beacon_display.cpp)
|
||||
|
||||
if(THREADS_FOUND)
|
||||
IF(HAVE_CXX11)
|
||||
IF(TINS_HAVE_CXX11)
|
||||
ADD_EXECUTABLE(traceroute EXCLUDE_FROM_ALL traceroute.cpp)
|
||||
ADD_EXECUTABLE(dns_stats EXCLUDE_FROM_ALL dns_stats.cpp)
|
||||
TARGET_LINK_LIBRARIES(traceroute ${CMAKE_THREAD_LIBS_INIT})
|
||||
TARGET_LINK_LIBRARIES(dns_stats ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF(HAVE_CXX11)
|
||||
ENDIF(TINS_HAVE_CXX11)
|
||||
IF(WIN32)
|
||||
MESSAGE(WARNING "Disabling portscan example since it doesn't compile on Windows.")
|
||||
ELSE()
|
||||
|
||||
@@ -2,21 +2,21 @@
|
||||
#define TINS_CONFIG_H
|
||||
|
||||
/* Define if the compiler supports basic C++11 syntax */
|
||||
#cmakedefine HAVE_CXX11
|
||||
#cmakedefine TINS_HAVE_CXX11
|
||||
|
||||
/* Have IEEE 802.11 support */
|
||||
#cmakedefine HAVE_DOT11
|
||||
#cmakedefine TINS_HAVE_DOT11
|
||||
|
||||
/* Have WPA2 decryption library */
|
||||
#cmakedefine HAVE_WPA2_DECRYPTION
|
||||
#cmakedefine TINS_HAVE_WPA2_DECRYPTION
|
||||
|
||||
/* Use pcap_sendpacket to send l2 packets */
|
||||
#cmakedefine HAVE_PACKET_SENDER_PCAP_SENDPACKET
|
||||
#cmakedefine TINS_HAVE_PACKET_SENDER_PCAP_SENDPACKET
|
||||
|
||||
/* Have TCP ACK tracking */
|
||||
#cmakedefine HAVE_ACK_TRACKER
|
||||
#cmakedefine TINS_HAVE_ACK_TRACKER
|
||||
|
||||
/* Have GCC builtin swap */
|
||||
#cmakedefine HAVE_GCC_BUILTIN_SWAP
|
||||
#cmakedefine TINS_HAVE_GCC_BUILTIN_SWAP
|
||||
|
||||
#endif // TINS_CONFIG_H
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#if !defined(TINS_CRYPTO_H) && defined(HAVE_DOT11)
|
||||
#if !defined(TINS_CRYPTO_H) && defined(TINS_HAVE_DOT11)
|
||||
#define TINS_CRYPTO_H
|
||||
|
||||
#include <map>
|
||||
@@ -52,7 +52,7 @@ namespace Crypto {
|
||||
|
||||
struct RC4Key;
|
||||
|
||||
#ifdef HAVE_WPA2_DECRYPTION
|
||||
#ifdef TINS_HAVE_WPA2_DECRYPTION
|
||||
namespace WPA2 {
|
||||
|
||||
/**
|
||||
@@ -165,7 +165,7 @@ private:
|
||||
};
|
||||
|
||||
} // WPA2
|
||||
#endif // HAVE_WPA2_DECRYPTION
|
||||
#endif // TINS_HAVE_WPA2_DECRYPTION
|
||||
|
||||
/**
|
||||
* \brief RC4 Key abstraction.
|
||||
@@ -240,7 +240,7 @@ private:
|
||||
std::vector<uint8_t> key_buffer_;
|
||||
};
|
||||
|
||||
#ifdef HAVE_WPA2_DECRYPTION
|
||||
#ifdef TINS_HAVE_WPA2_DECRYPTION
|
||||
/**
|
||||
* \brief Decrypts WPA2-encrypted traffic.
|
||||
*
|
||||
@@ -382,7 +382,7 @@ private:
|
||||
bssids_map aps_;
|
||||
keys_map keys_;
|
||||
};
|
||||
#endif // HAVE_WPA2_DECRYPTION
|
||||
#endif // TINS_HAVE_WPA2_DECRYPTION
|
||||
|
||||
/**
|
||||
* \brief Pluggable decrypter object which can be used to decrypt
|
||||
@@ -459,7 +459,7 @@ void rc4(ForwardIterator start, ForwardIterator end, RC4Key& key, OutputIterator
|
||||
template<typename Functor>
|
||||
DecrypterProxy<Functor, WEPDecrypter> make_wep_decrypter_proxy(const Functor& functor);
|
||||
|
||||
#ifdef HAVE_WPA2_DECRYPTION
|
||||
#ifdef TINS_HAVE_WPA2_DECRYPTION
|
||||
/**
|
||||
* \brief Wrapper function to create a DecrypterProxy using a
|
||||
* WPA2Decrypter as the Decrypter template parameter.
|
||||
@@ -471,7 +471,7 @@ template<typename Functor>
|
||||
DecrypterProxy<Functor, WPA2Decrypter> make_wpa2_decrypter_proxy(const Functor& functor) {
|
||||
return DecrypterProxy<Functor, WPA2Decrypter>(functor);
|
||||
}
|
||||
#endif // HAVE_WPA2_DECRYPTION
|
||||
#endif // TINS_HAVE_WPA2_DECRYPTION
|
||||
|
||||
// Implementation section
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
#define TINS_CXXSTD_GCC_FIX 0
|
||||
#endif // __GXX_EXPERIMENTAL_CXX0X__
|
||||
|
||||
#if !defined(TINS_IS_CXX11) && defined(HAVE_CXX11)
|
||||
#if !defined(TINS_IS_CXX11) && defined(TINS_HAVE_CXX11)
|
||||
#define TINS_IS_CXX11 (__cplusplus > 199711L || TINS_CXXSTD_GCC_FIX == 1 || _MSC_VER >= 1800)
|
||||
#elif !defined(TINS_IS_CXX11)
|
||||
#define TINS_IS_CXX11 0
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#if !defined(TINS_DOT_11) && defined(HAVE_DOT11)
|
||||
#if !defined(TINS_DOT_11) && defined(TINS_HAVE_DOT11)
|
||||
#define TINS_DOT_11
|
||||
|
||||
#include "dot11/dot11_base.h"
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
#include "../config.h"
|
||||
|
||||
#if !defined(TINS_DOT11_DOT11_ASSOC_H) && defined(HAVE_DOT11)
|
||||
#if !defined(TINS_DOT11_DOT11_ASSOC_H) && defined(TINS_HAVE_DOT11)
|
||||
#define TINS_DOT11_DOT11_ASSOC_H
|
||||
|
||||
#include "../dot11/dot11_mgmt.h"
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
#include "../config.h"
|
||||
|
||||
#if !defined(TINS_DOT11_DOT11_AUTH_H) && defined(HAVE_DOT11)
|
||||
#if !defined(TINS_DOT11_DOT11_AUTH_H) && defined(TINS_HAVE_DOT11)
|
||||
#define TINS_DOT11_DOT11_AUTH_H
|
||||
|
||||
#include "../dot11/dot11_mgmt.h"
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
#include "../config.h"
|
||||
|
||||
#if !defined(TINS_DOT11_DOT11_H) && defined(HAVE_DOT11)
|
||||
#if !defined(TINS_DOT11_DOT11_H) && defined(TINS_HAVE_DOT11)
|
||||
#define TINS_DOT11_DOT11_H
|
||||
|
||||
#include <list>
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
#include "../config.h"
|
||||
|
||||
#if !defined(TINS_DOT11_DOT11_BEACON_H) && defined(HAVE_DOT11)
|
||||
#if !defined(TINS_DOT11_DOT11_BEACON_H) && defined(TINS_HAVE_DOT11)
|
||||
#define TINS_DOT11_DOT11_BEACON_H
|
||||
|
||||
#include "../dot11/dot11_mgmt.h"
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
#include "../config.h"
|
||||
|
||||
#if !defined(TINS_DOT11_DOT11_CONTROL_H) && defined(HAVE_DOT11)
|
||||
#if !defined(TINS_DOT11_DOT11_CONTROL_H) && defined(TINS_HAVE_DOT11)
|
||||
|
||||
#define TINS_DOT11_DOT11_CONTROL_H
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
#include "../config.h"
|
||||
|
||||
#if !defined(TINS_DOT11_DOT11_DATA_H) && defined(HAVE_DOT11)
|
||||
#if !defined(TINS_DOT11_DOT11_DATA_H) && defined(TINS_HAVE_DOT11)
|
||||
#define TINS_DOT11_DOT11_DATA_H
|
||||
|
||||
#include "../dot11/dot11_base.h"
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
#include "../config.h"
|
||||
|
||||
#if !defined(TINS_DOT11_DOT11_MGMT_H) && defined(HAVE_DOT11)
|
||||
#if !defined(TINS_DOT11_DOT11_MGMT_H) && defined(TINS_HAVE_DOT11)
|
||||
|
||||
#define TINS_DOT11_DOT11_MGMT_H
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
#include "../config.h"
|
||||
|
||||
#if !defined(TINS_DOT11_DOT11_PROBE_H) && defined(HAVE_DOT11)
|
||||
#if !defined(TINS_DOT11_DOT11_PROBE_H) && defined(TINS_HAVE_DOT11)
|
||||
|
||||
#define TINS_DOT11_DOT11_PROBE_H
|
||||
|
||||
|
||||
@@ -145,12 +145,12 @@ public:
|
||||
*/
|
||||
uint32_t header_size() const;
|
||||
|
||||
#if !defined(_WIN32) || defined(HAVE_PACKET_SENDER_PCAP_SENDPACKET)
|
||||
#if !defined(_WIN32) || defined(TINS_HAVE_PACKET_SENDER_PCAP_SENDPACKET)
|
||||
/**
|
||||
* \sa PDU::send()
|
||||
*/
|
||||
void send(PacketSender& sender, const NetworkInterface& iface);
|
||||
#endif // !_WIN32 || HAVE_PACKET_SENDER_PCAP_SENDPACKET
|
||||
#endif // !_WIN32 || TINS_HAVE_PACKET_SENDER_PCAP_SENDPACKET
|
||||
|
||||
/**
|
||||
* \brief Check whether ptr points to a valid response for this PDU.
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
#define TINS_BYTE_SWAP_16(data) _byteswap_ushort(data)
|
||||
#define TINS_BYTE_SWAP_32(data) _byteswap_ulong(data)
|
||||
#define TINS_BYTE_SWAP_64(data) _byteswap_uint64(data)
|
||||
#elif defined(HAVE_GCC_BUILTIN_SWAP)
|
||||
#elif defined(TINS_HAVE_GCC_BUILTIN_SWAP)
|
||||
#define TINS_BYTE_SWAP_16(data) __builtin_bswap16(data)
|
||||
#define TINS_BYTE_SWAP_32(data) __builtin_bswap32(data)
|
||||
#define TINS_BYTE_SWAP_64(data) __builtin_bswap64(data)
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#if !defined(TINS_HANDSHAKE_CAPTURER_H) && defined(HAVE_DOT11)
|
||||
#if !defined(TINS_HANDSHAKE_CAPTURER_H) && defined(TINS_HAVE_DOT11)
|
||||
#define TINS_HANDSHAKE_CAPTURER_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -37,9 +37,9 @@
|
||||
#include <stdint.h>
|
||||
#include <map>
|
||||
#include "config.h"
|
||||
#ifdef HAVE_PACKET_SENDER_PCAP_SENDPACKET
|
||||
#ifdef TINS_HAVE_PACKET_SENDER_PCAP_SENDPACKET
|
||||
#include <pcap.h>
|
||||
#endif // HAVE_PACKET_SENDER_PCAP_SENDPACKET
|
||||
#endif // TINS_HAVE_PACKET_SENDER_PCAP_SENDPACKET
|
||||
#include "network_interface.h"
|
||||
#include "macros.h"
|
||||
#include "cxxstd.h"
|
||||
@@ -184,14 +184,14 @@ public:
|
||||
*/
|
||||
~PacketSender();
|
||||
|
||||
#if !defined(_WIN32) || defined(HAVE_PACKET_SENDER_PCAP_SENDPACKET)
|
||||
#if !defined(_WIN32) || defined(TINS_HAVE_PACKET_SENDER_PCAP_SENDPACKET)
|
||||
/**
|
||||
* \brief Opens a layer 2 socket.
|
||||
*
|
||||
* If this operation fails, then a socket_open_error will be thrown.
|
||||
*/
|
||||
void open_l2_socket(const NetworkInterface& iface = NetworkInterface());
|
||||
#endif // !_WIN32 || defined(HAVE_PACKET_SENDER_PCAP_SENDPACKET)
|
||||
#endif // !_WIN32 || defined(TINS_HAVE_PACKET_SENDER_PCAP_SENDPACKET)
|
||||
|
||||
/**
|
||||
* \brief Opens a layer 3 socket, using the corresponding protocol
|
||||
@@ -324,7 +324,7 @@ public:
|
||||
|
||||
#endif // _WIN32
|
||||
|
||||
#if !defined(_WIN32) || defined(HAVE_PACKET_SENDER_PCAP_SENDPACKET)
|
||||
#if !defined(_WIN32) || defined(TINS_HAVE_PACKET_SENDER_PCAP_SENDPACKET)
|
||||
/**
|
||||
* \brief Sends a level 2 PDU.
|
||||
*
|
||||
@@ -342,7 +342,7 @@ public:
|
||||
*/
|
||||
void send_l2(PDU& pdu, struct sockaddr* link_addr, uint32_t len_addr,
|
||||
const NetworkInterface& iface = NetworkInterface());
|
||||
#endif // !_WIN32 || HAVE_PACKET_SENDER_PCAP_SENDPACKET
|
||||
#endif // !_WIN32 || TINS_HAVE_PACKET_SENDER_PCAP_SENDPACKET
|
||||
|
||||
/**
|
||||
* \brief Receives a layer 3 PDU response to a previously sent PDU.
|
||||
@@ -393,9 +393,9 @@ private:
|
||||
void send(PDU& pdu, const NetworkInterface& iface) {
|
||||
static_cast<T&>(pdu).send(*this, iface);
|
||||
}
|
||||
#ifdef HAVE_PACKET_SENDER_PCAP_SENDPACKET
|
||||
#ifdef TINS_HAVE_PACKET_SENDER_PCAP_SENDPACKET
|
||||
pcap_t* make_pcap_handle(const NetworkInterface& iface) const;
|
||||
#endif // HAVE_PACKET_SENDER_PCAP_SENDPACKET
|
||||
#endif // TINS_HAVE_PACKET_SENDER_PCAP_SENDPACKET
|
||||
|
||||
PDU* recv_match_loop(const std::vector<int>& sockets,
|
||||
PDU& pdu,
|
||||
@@ -418,10 +418,10 @@ private:
|
||||
#if defined(BSD) || defined(__FreeBSD_kernel__)
|
||||
int buffer_size_;
|
||||
#endif // BSD
|
||||
#ifdef HAVE_PACKET_SENDER_PCAP_SENDPACKET
|
||||
#ifdef TINS_HAVE_PACKET_SENDER_PCAP_SENDPACKET
|
||||
typedef std::map<NetworkInterface, pcap_t*> PcapHandleMap;
|
||||
PcapHandleMap pcap_handles_;
|
||||
#endif // HAVE_PACKET_SENDER_PCAP_SENDPACKET
|
||||
#endif // TINS_HAVE_PACKET_SENDER_PCAP_SENDPACKET
|
||||
};
|
||||
|
||||
} // Tins
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#if !defined(TINS_RADIOTAP_H) && defined(HAVE_DOT11)
|
||||
#if !defined(TINS_RADIOTAP_H) && defined(TINS_HAVE_DOT11)
|
||||
#define TINS_RADIOTAP_H
|
||||
|
||||
#include "macros.h"
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#if !defined(TINS_RSN_INFORMATION) && defined(HAVE_DOT11)
|
||||
#if !defined(TINS_RSN_INFORMATION) && defined(TINS_HAVE_DOT11)
|
||||
#define TINS_RSN_INFORMATION
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
#include "../config.h"
|
||||
|
||||
#ifdef HAVE_ACK_TRACKER
|
||||
#ifdef TINS_HAVE_ACK_TRACKER
|
||||
|
||||
#include <vector>
|
||||
#include <boost/icl/interval_set.hpp>
|
||||
@@ -149,7 +149,7 @@ private:
|
||||
} // TCPIP
|
||||
} // Tins
|
||||
|
||||
#endif // HAVE_ACK_TRACKER
|
||||
#endif // TINS_HAVE_ACK_TRACKER
|
||||
|
||||
#endif // TINS_TCP_IP_ACK_TRACKER_H
|
||||
|
||||
|
||||
@@ -283,7 +283,7 @@ public:
|
||||
*/
|
||||
bool ack_tracking_enabled() const;
|
||||
|
||||
#ifdef HAVE_ACK_TRACKER
|
||||
#ifdef TINS_HAVE_ACK_TRACKER
|
||||
/**
|
||||
* Retrieves the ACK tracker for this Flow (const)
|
||||
*/
|
||||
@@ -293,7 +293,7 @@ public:
|
||||
* Retrieves the ACK tracker for this Flow
|
||||
*/
|
||||
AckTracker& ack_tracker();
|
||||
#endif // HAVE_ACK_TRACKER
|
||||
#endif // TINS_HAVE_ACK_TRACKER
|
||||
private:
|
||||
// Compress all flags into just one struct using bitfields
|
||||
struct flags {
|
||||
@@ -323,9 +323,9 @@ private:
|
||||
State state_;
|
||||
int mss_;
|
||||
flags flags_;
|
||||
#ifdef HAVE_ACK_TRACKER
|
||||
#ifdef TINS_HAVE_ACK_TRACKER
|
||||
AckTracker ack_tracker_;
|
||||
#endif // HAVE_ACK_TRACKER
|
||||
#endif // TINS_HAVE_ACK_TRACKER
|
||||
};
|
||||
|
||||
} // TCPIP
|
||||
|
||||
@@ -29,13 +29,13 @@
|
||||
|
||||
#include "crypto.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
|
||||
#ifdef HAVE_WPA2_DECRYPTION
|
||||
#ifdef TINS_HAVE_WPA2_DECRYPTION
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/hmac.h>
|
||||
#include <openssl/aes.h>
|
||||
#endif // HAVE_WPA2_DECRYPTION
|
||||
#endif // TINS_HAVE_WPA2_DECRYPTION
|
||||
#include "dot11/dot11_data.h"
|
||||
#include "dot11/dot11_beacon.h"
|
||||
#include "exceptions.h"
|
||||
@@ -130,7 +130,7 @@ PDU* WEPDecrypter::decrypt(RawPDU& raw, const string& password) {
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_WPA2_DECRYPTION
|
||||
#ifdef TINS_HAVE_WPA2_DECRYPTION
|
||||
// WPA2Decrypter
|
||||
|
||||
using WPA2::SessionKeys;
|
||||
@@ -629,9 +629,9 @@ bool WPA2Decrypter::decrypt(PDU& pdu) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif // HAVE_WPA2_DECRYPTION
|
||||
#endif // TINS_HAVE_WPA2_DECRYPTION
|
||||
|
||||
} // namespace Crypto
|
||||
} // namespace Tins
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
#endif // TINS_HAVE_DOT11
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
*/
|
||||
|
||||
#include "dot11/dot11_assoc.h"
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
|
||||
#include <cstring>
|
||||
#include "memory_helpers.h"
|
||||
@@ -192,4 +192,4 @@ void Dot11ReAssocResponse::write_fixed_parameters(OutputMemoryStream& stream) {
|
||||
|
||||
} // Tins
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
#endif // TINS_HAVE_DOT11
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
*/
|
||||
|
||||
#include "dot11/dot11_auth.h"
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
|
||||
#include <cstring>
|
||||
#include "memory_helpers.h"
|
||||
@@ -104,4 +104,4 @@ void Dot11Deauthentication::write_fixed_parameters(OutputMemoryStream& stream) {
|
||||
|
||||
} // Tins
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
#endif // TINS_HAVE_DOT11
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
#include "dot11/dot11_base.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
|
||||
#include <cstring>
|
||||
#include <stdexcept>
|
||||
@@ -288,4 +288,4 @@ Dot11* Dot11::from_bytes(const uint8_t* buffer, uint32_t total_sz) {
|
||||
|
||||
} // Tins
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
#endif // TINS_HAVE_DOT11
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
*/
|
||||
|
||||
#include "dot11/dot11_beacon.h"
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
|
||||
#include <cstring>
|
||||
#include "memory_helpers.h"
|
||||
@@ -72,4 +72,4 @@ void Dot11Beacon::write_fixed_parameters(OutputMemoryStream& stream) {
|
||||
|
||||
} // Tins
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
#endif // TINS_HAVE_DOT11
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
*/
|
||||
|
||||
#include "dot11/dot11_control.h"
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
|
||||
#include <algorithm>
|
||||
#include "memory_helpers.h"
|
||||
@@ -251,4 +251,4 @@ uint32_t Dot11BlockAck::header_size() const {
|
||||
|
||||
} // Tins
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
#endif // TINS_HAVE_DOT11
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
*/
|
||||
|
||||
#include "dot11/dot11_data.h"
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
|
||||
#include <cstring>
|
||||
#include "rawpdu.h"
|
||||
@@ -161,4 +161,4 @@ void Dot11QoSData::write_fixed_parameters(OutputMemoryStream& stream) {
|
||||
|
||||
} // Tins
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
#endif // TINS_HAVE_DOT11
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
*/
|
||||
|
||||
#include "dot11/dot11_mgmt.h"
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
|
||||
#include <cstring>
|
||||
#include "rsn_information.h"
|
||||
@@ -641,4 +641,4 @@ Dot11ManagementFrame::tim_type Dot11ManagementFrame::tim_type::from_option(const
|
||||
|
||||
} // Tins
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
#endif // TINS_HAVE_DOT11
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
#include "dot11/dot11_probe.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
|
||||
#include <cstring>
|
||||
#include "memory_helpers.h"
|
||||
@@ -88,4 +88,4 @@ void Dot11ProbeResponse::write_fixed_parameters(OutputMemoryStream& stream) {
|
||||
|
||||
} // namespace Tins
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
#endif // TINS_HAVE_DOT11
|
||||
|
||||
@@ -86,13 +86,13 @@ uint32_t Dot3::header_size() const {
|
||||
return sizeof(header_);
|
||||
}
|
||||
|
||||
#if !defined(_WIN32) || defined(HAVE_PACKET_SENDER_PCAP_SENDPACKET)
|
||||
#if !defined(_WIN32) || defined(TINS_HAVE_PACKET_SENDER_PCAP_SENDPACKET)
|
||||
void Dot3::send(PacketSender& sender, const NetworkInterface& iface) {
|
||||
if (!iface) {
|
||||
throw invalid_interface();
|
||||
}
|
||||
|
||||
#if defined(BSD) || defined(__FreeBSD_kernel__) || defined(HAVE_PACKET_SENDER_PCAP_SENDPACKET)
|
||||
#if defined(BSD) || defined(__FreeBSD_kernel__) || defined(TINS_HAVE_PACKET_SENDER_PCAP_SENDPACKET)
|
||||
sender.send_l2(*this, 0, 0, iface);
|
||||
#else
|
||||
struct sockaddr_ll addr;
|
||||
@@ -108,7 +108,7 @@ void Dot3::send(PacketSender& sender, const NetworkInterface& iface) {
|
||||
sender.send_l2(*this, (struct sockaddr*)&addr, (uint32_t)sizeof(addr));
|
||||
#endif
|
||||
}
|
||||
#endif // !_WIN32 || HAVE_PACKET_SENDER_PCAP_SENDPACKET
|
||||
#endif // !_WIN32 || TINS_HAVE_PACKET_SENDER_PCAP_SENDPACKET
|
||||
|
||||
bool Dot3::matches_response(const uint8_t* ptr, uint32_t total_sz) const {
|
||||
if (total_sz < sizeof(header_)) {
|
||||
|
||||
@@ -112,7 +112,7 @@ void EthernetII::send(PacketSender& sender, const NetworkInterface& iface) {
|
||||
if (!iface) {
|
||||
throw invalid_interface();
|
||||
}
|
||||
#if defined(HAVE_PACKET_SENDER_PCAP_SENDPACKET) || defined(BSD) || defined(__FreeBSD_kernel__)
|
||||
#if defined(TINS_HAVE_PACKET_SENDER_PCAP_SENDPACKET) || defined(BSD) || defined(__FreeBSD_kernel__)
|
||||
// Sending using pcap_sendpacket/BSD bpf packet mode is the same here
|
||||
sender.send_l2(*this, 0, 0, iface);
|
||||
#elif defined(_WIN32)
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
#include "handshake_capturer.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
|
||||
#include "dot11/dot11_data.h"
|
||||
|
||||
@@ -106,4 +106,4 @@ bool RSNHandshakeCapturer::do_insert(const handshake_map::key_type& key,
|
||||
|
||||
} // namespace Tins;
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
#endif // TINS_HAVE_DOT11
|
||||
|
||||
@@ -164,16 +164,16 @@ PDU* pdu_from_dlt_flag(int flag,
|
||||
case DLT_EN10MB:
|
||||
return new EthernetII(buffer, size);
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
case DLT_IEEE802_11_RADIO:
|
||||
return new RadioTap(buffer, size);
|
||||
case DLT_IEEE802_11:
|
||||
return Dot11::from_bytes(buffer, size);
|
||||
#else // HAVE_DOT11
|
||||
#else // TINS_HAVE_DOT11
|
||||
case DLT_IEEE802_11_RADIO:
|
||||
case DLT_IEEE802_11:
|
||||
throw protocol_disabled();
|
||||
#endif // HAVE_DOT11
|
||||
#endif // TINS_HAVE_DOT11
|
||||
|
||||
case DLT_NULL:
|
||||
return new Loopback(buffer, size);
|
||||
@@ -200,7 +200,7 @@ Tins::PDU* pdu_from_flag(PDU::PDUType type, const uint8_t* buffer, uint32_t size
|
||||
return new Tins::IEEE802_3(buffer, size);
|
||||
case Tins::PDU::PPPOE:
|
||||
return new Tins::PPPoE(buffer, size);
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
case Tins::PDU::RADIOTAP:
|
||||
return new Tins::RadioTap(buffer, size);
|
||||
case Tins::PDU::DOT11:
|
||||
@@ -226,7 +226,7 @@ Tins::PDU* pdu_from_flag(PDU::PDUType type, const uint8_t* buffer, uint32_t size
|
||||
case Tins::PDU::DOT11_RTS:
|
||||
case Tins::PDU::DOT11_QOS_DATA:
|
||||
return Tins::Dot11::from_bytes(buffer, size);
|
||||
#endif // HAVE_DOT11
|
||||
#endif // TINS_HAVE_DOT11
|
||||
default:
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -129,12 +129,12 @@ PacketSender::~PacketSender() {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PACKET_SENDER_PCAP_SENDPACKET
|
||||
#ifdef TINS_HAVE_PACKET_SENDER_PCAP_SENDPACKET
|
||||
for (PcapHandleMap::iterator it = pcap_handles_.begin(); it != pcap_handles_.end(); ++it) {
|
||||
pcap_close(it->second);
|
||||
}
|
||||
pcap_handles_.clear();
|
||||
#endif // HAVE_PACKET_SENDER_PCAP_SENDPACKET
|
||||
#endif // TINS_HAVE_PACKET_SENDER_PCAP_SENDPACKET
|
||||
}
|
||||
|
||||
void PacketSender::default_interface(const NetworkInterface& iface) {
|
||||
@@ -145,7 +145,7 @@ const NetworkInterface& PacketSender::default_interface() const {
|
||||
return default_iface_;
|
||||
}
|
||||
|
||||
#if !defined(_WIN32) || defined(HAVE_PACKET_SENDER_PCAP_SENDPACKET)
|
||||
#if !defined(_WIN32) || defined(TINS_HAVE_PACKET_SENDER_PCAP_SENDPACKET)
|
||||
|
||||
#ifndef _WIN32
|
||||
bool PacketSender::ether_socket_initialized(const NetworkInterface& iface) const {
|
||||
@@ -168,7 +168,7 @@ int PacketSender::get_ether_socket(const NetworkInterface& iface) {
|
||||
}
|
||||
#endif // _WIN32
|
||||
|
||||
#ifdef HAVE_PACKET_SENDER_PCAP_SENDPACKET
|
||||
#ifdef TINS_HAVE_PACKET_SENDER_PCAP_SENDPACKET
|
||||
|
||||
pcap_t* PacketSender::make_pcap_handle(const NetworkInterface& iface) const {
|
||||
// This is an ugly fix to make interface names look like what
|
||||
@@ -193,10 +193,10 @@ pcap_t* PacketSender::make_pcap_handle(const NetworkInterface& iface) const {
|
||||
return handle;
|
||||
}
|
||||
|
||||
#endif // HAVE_PACKET_SENDER_PCAP_SENDPACKET
|
||||
#endif // TINS_HAVE_PACKET_SENDER_PCAP_SENDPACKET
|
||||
|
||||
void PacketSender::open_l2_socket(const NetworkInterface& iface) {
|
||||
#ifdef HAVE_PACKET_SENDER_PCAP_SENDPACKET
|
||||
#ifdef TINS_HAVE_PACKET_SENDER_PCAP_SENDPACKET
|
||||
if (pcap_handles_.count(iface) == 0) {
|
||||
pcap_handles_.insert(make_pair(iface, make_pcap_handle(iface)));
|
||||
}
|
||||
@@ -239,7 +239,7 @@ void PacketSender::open_l2_socket(const NetworkInterface& iface) {
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif // !_WIN32 || HAVE_PACKET_SENDER_PCAP_SENDPACKET
|
||||
#endif // !_WIN32 || TINS_HAVE_PACKET_SENDER_PCAP_SENDPACKET
|
||||
|
||||
void PacketSender::open_l3_socket(SocketType type) {
|
||||
int socktype = find_type(type);
|
||||
@@ -309,14 +309,14 @@ void PacketSender::send(PDU& pdu, const NetworkInterface& iface) {
|
||||
if (pdu.matches_flag(PDU::ETHERNET_II)) {
|
||||
send<Tins::EthernetII>(pdu, iface);
|
||||
}
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
else if (pdu.matches_flag(PDU::DOT11)) {
|
||||
send<Tins::Dot11>(pdu, iface);
|
||||
}
|
||||
else if (pdu.matches_flag(PDU::RADIOTAP)) {
|
||||
send<Tins::RadioTap>(pdu, iface);
|
||||
}
|
||||
#endif // HAVE_DOT11
|
||||
#endif // TINS_HAVE_DOT11
|
||||
else if (pdu.matches_flag(PDU::IEEE802_3)) {
|
||||
send<Tins::IEEE802_3>(pdu, iface);
|
||||
}
|
||||
@@ -339,14 +339,14 @@ PDU* PacketSender::send_recv(PDU& pdu, const NetworkInterface& iface) {
|
||||
return pdu.recv_response(*this, iface);
|
||||
}
|
||||
|
||||
#if !defined(_WIN32) || defined(HAVE_PACKET_SENDER_PCAP_SENDPACKET)
|
||||
#if !defined(_WIN32) || defined(TINS_HAVE_PACKET_SENDER_PCAP_SENDPACKET)
|
||||
void PacketSender::send_l2(PDU& pdu,
|
||||
struct sockaddr* link_addr,
|
||||
uint32_t len_addr,
|
||||
const NetworkInterface& iface) {
|
||||
PDU::serialization_type buffer = pdu.serialize();
|
||||
|
||||
#ifdef HAVE_PACKET_SENDER_PCAP_SENDPACKET
|
||||
#ifdef TINS_HAVE_PACKET_SENDER_PCAP_SENDPACKET
|
||||
open_l2_socket(iface);
|
||||
pcap_t* handle = pcap_handles_[iface];
|
||||
const int buf_size = static_cast<int>(buffer.size());
|
||||
@@ -354,7 +354,7 @@ void PacketSender::send_l2(PDU& pdu,
|
||||
throw runtime_error("Failed to send packet: " +
|
||||
string(pcap_geterr(handle)));
|
||||
}
|
||||
#else // HAVE_PACKET_SENDER_PCAP_SENDPACKET
|
||||
#else // TINS_HAVE_PACKET_SENDER_PCAP_SENDPACKET
|
||||
int sock = get_ether_socket(iface);
|
||||
if (!buffer.empty()) {
|
||||
#if defined(BSD) || defined(__FreeBSD_kernel__)
|
||||
@@ -365,10 +365,10 @@ void PacketSender::send_l2(PDU& pdu,
|
||||
throw socket_write_error(make_error_string());
|
||||
}
|
||||
}
|
||||
#endif // HAVE_PACKET_SENDER_PCAP_SENDPACKET
|
||||
#endif // TINS_HAVE_PACKET_SENDER_PCAP_SENDPACKET
|
||||
}
|
||||
|
||||
#endif // !_WIN32 || HAVE_PACKET_SENDER_PCAP_SENDPACKET
|
||||
#endif // !_WIN32 || TINS_HAVE_PACKET_SENDER_PCAP_SENDPACKET
|
||||
|
||||
#ifndef _WIN32
|
||||
PDU* PacketSender::recv_l2(PDU& pdu,
|
||||
|
||||
@@ -59,7 +59,7 @@ PPI::PPI(const uint8_t* buffer, uint32_t total_sz) {
|
||||
if (stream) {
|
||||
switch (dlt()) {
|
||||
case DLT_IEEE802_11:
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
parse_80211(stream.pointer(), stream.size());
|
||||
#else
|
||||
throw protocol_disabled();
|
||||
@@ -74,7 +74,7 @@ PPI::PPI(const uint8_t* buffer, uint32_t total_sz) {
|
||||
}
|
||||
break;
|
||||
case DLT_IEEE802_11_RADIO:
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
inner_pdu(new RadioTap(stream.pointer(), stream.size()));
|
||||
#else
|
||||
throw protocol_disabled();
|
||||
@@ -99,7 +99,7 @@ void PPI::write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU *) {
|
||||
}
|
||||
|
||||
void PPI::parse_80211(const uint8_t* buffer, uint32_t total_sz) {
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
if (data_.size() >= 13) {
|
||||
// Is FCS-at-end on?
|
||||
if ((data_[12] & 1) == 1) {
|
||||
@@ -111,7 +111,7 @@ void PPI::parse_80211(const uint8_t* buffer, uint32_t total_sz) {
|
||||
}
|
||||
}
|
||||
inner_pdu(Dot11::from_bytes(buffer, total_sz));
|
||||
#endif // HAVE_DOT11
|
||||
#endif // TINS_HAVE_DOT11
|
||||
}
|
||||
|
||||
} // Tins
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
#include "radiotap.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
|
||||
#include <cstring>
|
||||
#include <stdexcept>
|
||||
@@ -576,4 +576,4 @@ void RadioTap::write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU
|
||||
|
||||
} // Tins
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
#endif // TINS_HAVE_DOT11
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
*/
|
||||
|
||||
#include "rsn_information.h"
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
|
||||
#include <cstring>
|
||||
#include <stdexcept>
|
||||
@@ -137,4 +137,4 @@ RSNInformation RSNInformation::from_option(const PDUOption<uint8_t, Dot11>& opt)
|
||||
|
||||
} // Tins
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
#endif // TINS_HAVE_DOT11
|
||||
|
||||
@@ -120,7 +120,7 @@ void sniff_loop_eth_handler(u_char* user, const struct pcap_pkthdr* h, const u_c
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
void sniff_loop_dot11_handler(u_char* user, const struct pcap_pkthdr* h, const u_char* bytes) {
|
||||
sniff_data* data = (sniff_data*)user;
|
||||
data->packet_processed = true;
|
||||
@@ -145,14 +145,14 @@ PtrPacket BaseSniffer::next_packet() {
|
||||
handler = sniff_loop_eth_handler;
|
||||
}
|
||||
else if (iface_type == DLT_IEEE802_11_RADIO) {
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
handler = &sniff_loop_handler<RadioTap>;
|
||||
#else
|
||||
throw protocol_disabled();
|
||||
#endif
|
||||
}
|
||||
else if (iface_type == DLT_IEEE802_11) {
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
handler = sniff_loop_dot11_handler;
|
||||
#else
|
||||
throw protocol_disabled();
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
#include "tcp_ip/ack_tracker.h"
|
||||
|
||||
#ifdef HAVE_ACK_TRACKER
|
||||
#ifdef TINS_HAVE_ACK_TRACKER
|
||||
|
||||
#include <limits>
|
||||
#include "tcp.h"
|
||||
@@ -171,4 +171,4 @@ bool AckTracker::is_segment_acked(uint32_t sequence_number, uint32_t length) con
|
||||
} // TCPIP
|
||||
} // Tins
|
||||
|
||||
#endif // HAVE_ACK_TRACKER
|
||||
#endif // TINS_HAVE_ACK_TRACKER
|
||||
|
||||
@@ -97,11 +97,11 @@ void Flow::process_packet(PDU& pdu) {
|
||||
// Update the internal state first
|
||||
if (tcp) {
|
||||
update_state(*tcp);
|
||||
#ifdef HAVE_ACK_TRACKER
|
||||
#ifdef TINS_HAVE_ACK_TRACKER
|
||||
if (flags_.ack_tracking) {
|
||||
ack_tracker_.process_packet(*tcp);
|
||||
}
|
||||
#endif // HAVE_ACK_TRACKER
|
||||
#endif // TINS_HAVE_ACK_TRACKER
|
||||
}
|
||||
if (flags_.ignore_data_packets) {
|
||||
return;
|
||||
@@ -213,17 +213,17 @@ void Flow::update_state(const TCP& tcp) {
|
||||
state_ = RST_SENT;
|
||||
}
|
||||
else if (state_ == SYN_SENT && (tcp.flags() & TCP::ACK) != 0) {
|
||||
#ifdef HAVE_ACK_TRACKER
|
||||
#ifdef TINS_HAVE_ACK_TRACKER
|
||||
ack_tracker_ = AckTracker(tcp.ack_seq());
|
||||
#endif // HAVE_ACK_TRACKER
|
||||
#endif // TINS_HAVE_ACK_TRACKER
|
||||
state_ = ESTABLISHED;
|
||||
seq_number_++;
|
||||
}
|
||||
else if (state_ == UNKNOWN && (tcp.flags() & TCP::SYN) != 0) {
|
||||
// This is the server's state, sending it's first SYN|ACK
|
||||
#ifdef HAVE_ACK_TRACKER
|
||||
#ifdef TINS_HAVE_ACK_TRACKER
|
||||
ack_tracker_ = AckTracker(tcp.ack_seq());
|
||||
#endif // HAVE_ACK_TRACKER
|
||||
#endif // TINS_HAVE_ACK_TRACKER
|
||||
state_ = SYN_SENT;
|
||||
seq_number_ = tcp.seq();
|
||||
const TCP::option* mss_option = tcp.search_option(TCP::MSS);
|
||||
@@ -318,7 +318,7 @@ bool Flow::sack_permitted() const {
|
||||
}
|
||||
|
||||
void Flow::enable_ack_tracking() {
|
||||
#ifdef HAVE_ACK_TRACKER
|
||||
#ifdef TINS_HAVE_ACK_TRACKER
|
||||
flags_.ack_tracking = 1;
|
||||
#else
|
||||
throw feature_disabled();
|
||||
@@ -329,7 +329,7 @@ bool Flow::ack_tracking_enabled() const {
|
||||
return flags_.ack_tracking;
|
||||
}
|
||||
|
||||
#ifdef HAVE_ACK_TRACKER
|
||||
#ifdef TINS_HAVE_ACK_TRACKER
|
||||
const AckTracker& Flow::ack_tracker() const {
|
||||
return ack_tracker_;
|
||||
}
|
||||
@@ -338,7 +338,7 @@ AckTracker& Flow::ack_tracker() {
|
||||
return ack_tracker_;
|
||||
}
|
||||
|
||||
#endif // HAVE_ACK_TRACKER
|
||||
#endif // TINS_HAVE_ACK_TRACKER
|
||||
|
||||
} // TCPIP
|
||||
} // Tins
|
||||
|
||||
@@ -129,7 +129,7 @@ void StreamFollower::process_packet(PDU& packet, const timestamp_type& ts) {
|
||||
bool terminate_stream = total_chunks > max_buffered_chunks_ ||
|
||||
total_buffered_bytes > max_buffered_bytes_;
|
||||
TerminationReason reason = BUFFERED_DATA;
|
||||
#ifdef HAVE_ACK_TRACKER
|
||||
#ifdef TINS_HAVE_ACK_TRACKER
|
||||
if (!terminate_stream) {
|
||||
uint32_t count = 0;
|
||||
count += stream.client_flow().ack_tracker().acked_intervals().iterative_size();
|
||||
@@ -137,7 +137,7 @@ void StreamFollower::process_packet(PDU& packet, const timestamp_type& ts) {
|
||||
terminate_stream = count > DEFAULT_MAX_SACKED_INTERVALS;
|
||||
reason = SACKED_SEGMENTS;
|
||||
}
|
||||
#endif // HAVE_ACK_TRACKER
|
||||
#endif // TINS_HAVE_ACK_TRACKER
|
||||
if (stream.is_finished() || terminate_stream) {
|
||||
// If we're terminating the stream, execute the termination callback
|
||||
if (terminate_stream && on_stream_termination_) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "dot11/dot11_control.h"
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "tests/dot11.h"
|
||||
@@ -101,4 +101,4 @@ TEST_F(Dot11AckTest, Serialize) {
|
||||
EXPECT_TRUE(std::equal(buffer.begin(), buffer.end(), expected_packet));
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
#endif // TINS_HAVE_DOT11
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "dot11/dot11_assoc.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "tests/dot11_mgmt.h"
|
||||
@@ -90,4 +90,4 @@ TEST_F(Dot11AssocRequestTest, Serialize) {
|
||||
EXPECT_TRUE(std::equal(buffer.begin(), buffer.end(), expected_packet));
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
#endif // TINS_HAVE_DOT11
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "dot11/dot11_assoc.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "tests/dot11_mgmt.h"
|
||||
@@ -98,4 +98,4 @@ TEST_F(Dot11AssocResponseTest, Serialize) {
|
||||
EXPECT_TRUE(std::equal(buffer.begin(), buffer.end(), expected_packet));
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
#endif // TINS_HAVE_DOT11
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "dot11/dot11_auth.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "tests/dot11_mgmt.h"
|
||||
@@ -106,4 +106,4 @@ TEST_F(Dot11AuthenticationTest, Serialize) {
|
||||
EXPECT_TRUE(std::equal(buffer.begin(), buffer.end(), expected_packet));
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
#endif // TINS_HAVE_DOT11
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "dot11/dot11_beacon.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "rsn_information.h"
|
||||
@@ -479,4 +479,4 @@ TEST_F(Dot11BeaconTest, RemoveOption) {
|
||||
EXPECT_EQ(old_buffer, new_buffer);
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
#endif // TINS_HAVE_DOT11
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "dot11/dot11_control.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "tests/dot11.h"
|
||||
@@ -94,4 +94,4 @@ TEST_F(Dot11BlockAckRequestTest, Serialize) {
|
||||
EXPECT_TRUE(std::equal(buffer.begin(), buffer.end(), expected_packet));
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
#endif // TINS_HAVE_DOT11
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "tests/dot11_control.h"
|
||||
@@ -78,4 +78,4 @@ TEST_F(Dot11CFEndTest, Serialize) {
|
||||
EXPECT_TRUE(std::equal(buffer.begin(), buffer.end(), expected_packet));
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
#endif // TINS_HAVE_DOT11
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "tests/dot11_control.h"
|
||||
@@ -78,4 +78,4 @@ TEST_F(Dot11EndCFAckTest, Serialize) {
|
||||
EXPECT_TRUE(std::equal(buffer.begin(), buffer.end(), expected_packet));
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
#endif // TINS_HAVE_DOT11
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "tests/dot11_data.h"
|
||||
@@ -168,4 +168,4 @@ TEST_F(Dot11DataTest, Source_Dest_BSSID_Address3) {
|
||||
EXPECT_EQ(data.bssid_addr(), "00:18:f8:f5:c2:c6");
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
#endif // TINS_HAVE_DOT11
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "dot11/dot11_auth.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "tests/dot11_mgmt.h"
|
||||
@@ -88,4 +88,4 @@ TEST_F(Dot11DeauthenticationTest, Serialize) {
|
||||
EXPECT_TRUE(std::equal(buffer.begin(), buffer.end(), expected_packet));
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
#endif // TINS_HAVE_DOT11
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "dot11/dot11_assoc.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "tests/dot11_mgmt.h"
|
||||
@@ -89,4 +89,4 @@ TEST_F(Dot11DisassocTest, Serialize) {
|
||||
EXPECT_TRUE(std::equal(buffer.begin(), buffer.end(), expected_packet));
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
#endif // TINS_HAVE_DOT11
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "tests/dot11.h"
|
||||
@@ -165,4 +165,4 @@ TEST_F(Dot11Test, Serialize) {
|
||||
EXPECT_TRUE(std::equal(buffer.begin(), buffer.end(), expected_packet));
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
#endif // TINS_HAVE_DOT11
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "dot11/dot11_probe.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "tests/dot11_mgmt.h"
|
||||
@@ -72,4 +72,4 @@ TEST_F(Dot11ProbeRequestTest, FromBytes) {
|
||||
test_equals_expected(*inner);
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
#endif // TINS_HAVE_DOT11
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "dot11/dot11_probe.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "tests/dot11_mgmt.h"
|
||||
@@ -97,4 +97,4 @@ TEST_F(Dot11ProbeResponseTest, Serialize) {
|
||||
EXPECT_TRUE(std::equal(buffer.begin(), buffer.end(), expected_packet));
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
#endif // TINS_HAVE_DOT11
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "tests/dot11_control.h"
|
||||
@@ -78,4 +78,4 @@ TEST_F(Dot11PSPollTest, Serialize) {
|
||||
EXPECT_TRUE(std::equal(buffer.begin(), buffer.end(), expected_packet));
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
#endif // TINS_HAVE_DOT11
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "dot11/dot11_assoc.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "tests/dot11_mgmt.h"
|
||||
@@ -97,4 +97,4 @@ TEST_F(Dot11ReAssocRequestTest, Serialize) {
|
||||
EXPECT_TRUE(std::equal(buffer.begin(), buffer.end(), expected_packet));
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
#endif // TINS_HAVE_DOT11
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "dot11/dot11_assoc.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "tests/dot11_mgmt.h"
|
||||
@@ -86,4 +86,4 @@ TEST_F(Dot11ReAssocResponseTest, Serialize) {
|
||||
EXPECT_TRUE(std::equal(buffer.begin(), buffer.end(), expected_packet));
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
#endif // TINS_HAVE_DOT11
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "tests/dot11_control.h"
|
||||
@@ -78,4 +78,4 @@ TEST_F(Dot11RTSTest, Serialize) {
|
||||
EXPECT_TRUE(std::equal(buffer.begin(), buffer.end(), expected_packet));
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
#endif // TINS_HAVE_DOT11
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "dot11/dot11_data.h"
|
||||
#include "dot11/dot11_beacon.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <vector>
|
||||
@@ -53,4 +53,4 @@ TEST_F(PPITest, ConstructorFromBufferUsingEncapsulatedDot11WithOptions) {
|
||||
EXPECT_TRUE(dot11->search_option(static_cast<Dot11::OptionTypes>(61)) != NULL);
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
#endif // TINS_HAVE_DOT11
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "radiotap.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <cstring>
|
||||
@@ -400,4 +400,4 @@ TEST_F(RadioTapTest, SerializationWorksFine) {
|
||||
);
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
#endif // TINS_HAVE_DOT11
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
#include "packet.h"
|
||||
#include "utils.h"
|
||||
#include "config.h"
|
||||
#ifdef HAVE_ACK_TRACKER
|
||||
#ifdef TINS_HAVE_ACK_TRACKER
|
||||
#include "tcp_ip/ack_tracker.h"
|
||||
#endif // HAVE_ACK_TRACKER
|
||||
#endif // TINS_HAVE_ACK_TRACKER
|
||||
|
||||
using namespace std;
|
||||
using namespace std::chrono;
|
||||
@@ -513,7 +513,7 @@ TEST_F(FlowTest, StreamFollower_FollowStream) {
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_ACK_TRACKER
|
||||
#ifdef TINS_HAVE_ACK_TRACKER
|
||||
|
||||
using namespace boost;
|
||||
using namespace boost::icl;
|
||||
@@ -707,7 +707,7 @@ TEST_F(FlowTest, AckNumbersAreCorrect) {
|
||||
EXPECT_EQ(9898U, stream.server_flow().ack_tracker().ack_number());
|
||||
}
|
||||
|
||||
#endif // HAVE_ACK_TRACKER
|
||||
#endif // TINS_HAVE_ACK_TRACKER
|
||||
|
||||
#else
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <cstring>
|
||||
@@ -46,4 +46,4 @@ TEST_F(WEPDecryptTest, Decrypt1) {
|
||||
EXPECT_FALSE(decrypter.decrypt(dot11));
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
#endif // TINS_HAVE_DOT11
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "config.h"
|
||||
|
||||
#if defined(HAVE_DOT11) && defined(HAVE_WPA2_DECRYPTION)
|
||||
#if defined(TINS_HAVE_DOT11) && defined(TINS_HAVE_WPA2_DECRYPTION)
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <cstring>
|
||||
@@ -283,4 +283,4 @@ TEST_F(WPA2DecryptTest, DecryptCCMPAndTKIPWithoutUsingBeacon) {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // defined(HAVE_DOT11) && defined(HAVE_WPA2_DECRYPTION)
|
||||
#endif // defined(TINS_HAVE_DOT11) && defined(TINS_HAVE_WPA2_DECRYPTION)
|
||||
|
||||
Reference in New Issue
Block a user