1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-23 10:45:57 +01:00

12 Commits
v3.0 ... v3.1

Author SHA1 Message Date
Matias Fontanini
e7e66808a4 Updated files for release. 2014-08-24 21:40:22 -03:00
Matias Fontanini
2beebd6df3 Fix invalid lib name. 2014-08-24 20:07:30 -03:00
Matias Fontanini
0e967b4d30 Removed unnecessary check for CXX11_COMPILER_FLAGS. 2014-08-24 18:44:53 -03:00
Matias Fontanini
f5b0603799 CMake compilation now works on Windows. 2014-08-24 18:06:58 -03:00
Matias Fontanini
443974335a Added examples to CMake build system. 2014-08-23 23:12:19 -03:00
Matias Fontanini
2c2df752d0 Added tests to CMake build system. 2014-08-23 18:50:00 -03:00
Matias Fontanini
3a02bd0a3f Fix build system issues. 2014-08-23 13:05:51 -03:00
Santiago Alessandri
d0d4379b1b Added missing files. 2014-08-22 11:28:09 -07:00
Santiago Alessandri
fb7dbed58a First approach towards moving to CMake 2014-08-22 11:03:16 -07:00
Matias Fontanini
d2f0cd0686 Fixed issue #29: Added empty name check on DNS::encode_domain_name. 2014-08-20 22:44:03 -03:00
Matias Fontanini
2d6fcfb74a Fix ICMPv6 serialization (patch by einarjon). 2014-08-18 09:11:03 -03:00
Matias Fontanini
424e31bdd6 Updated configure files. 2014-08-09 14:42:11 -03:00
44 changed files with 1110 additions and 122 deletions

View File

@@ -1,3 +1,11 @@
v3.1 - Sun Aug 24 21:39:43 ART 2014
- Fixed ICMPv6 checksum error on serialization.
- Fixed empty domain name encoding on DNS.
- Changed the build system to CMake.
v3.0 - Thu Aug 7 21:39:09 ART 2014
- Timestamps can now be constructed from std::chrono::duration.

134
CMakeLists.txt Normal file
View File

@@ -0,0 +1,134 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.1)
PROJECT(libtins)
# Compile in release mode by default
IF(NOT CMAKE_BUILD_TYPE)
MESSAGE(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.")
SET(CMAKE_BUILD_TYPE RelWithDebInfo)
ELSE(NOT CMAKE_BUILD_TYPE)
MESSAGE(STATUS "Using specified '${CMAKE_BUILD_TYPE}' build type.")
ENDIF(NOT CMAKE_BUILD_TYPE)
# Default compilation settings
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
# Build output checks
OPTION(LIBTINS_BUILD_SHARED "Build libtins as a shared library." ON)
IF(LIBTINS_BUILD_SHARED)
MESSAGE(
STATUS
"Build will generate a shared library. "
"Use LIBTINS_BUILD_SHARED=0 to perform a static build"
)
SET(LIBTINS_TYPE SHARED)
ELSE(LIBTINS_BUILD_SHARED)
MESSAGE(STATUS "Build will generate a static library.")
SET(LIBTINS_TYPE STATIC)
ENDIF(LIBTINS_BUILD_SHARED)
# The version number.
SET(LIBTINS_VERSION_MAJOR 3)
SET(LIBTINS_VERSION_MINOR 1)
SET(LIBTINS_CPP_VERSION "${LIBTINS_VERSION_MAJOR}.${LIBTINS_VERSION_MINOR}")
# Required Packages
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
# Look for libpcap
FIND_PACKAGE(PCAP REQUIRED)
# Set some Windows specific flags
IF(WIN32)
# We need to link against these libs
SET(LIBTINS_OS_LIBS Ws2_32.lib Iphlpapi.lib)
# Add the NOMINMAX macro to avoid Windows' min and max macros.
# While compiling on windows, for some reason, WIN32 is not defined,
# maybe we could fix this later, but it's OK for now.
ADD_DEFINITIONS(-DNOMINMAX -DWIN32)
ENDIF(WIN32)
# Compilation options
OPTION(LIBTINS_ENABLE_CXX11 "Compile libtins with c++11 features" OFF)
IF(LIBTINS_ENABLE_CXX11)
SET(HAVE_CXX11 ON)
INCLUDE(CheckCXX11Features)
IF(HAS_CXX11_NULLPTR AND HAS_CXX11_RVALUE_REFERENCES)
MESSAGE(STATUS "Enabling C++11 features")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX11_COMPILER_FLAGS}")
ELSE(HAS_CXX11_NULLPTR AND HAS_CXX11_RVALUE_REFERENCES)
MESSAGE(FATAL_ERROR "C++11 features requested but the compiler does not support them.")
ENDIF(HAS_CXX11_NULLPTR AND HAS_CXX11_RVALUE_REFERENCES)
ELSE(LIBTINS_ENABLE_CXX11)
MESSAGE(
WARNING
"Disabling C++11 features. Use LIBTINS_ENABLE_CXX11=1 to enable them. "
"Unless you are using an old compiler, you should enable this option, "
"as it increases the library's performance")
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)
MESSAGE(STATUS "Enabling IEEE 802.11 support.")
IF(LIBTINS_ENABLE_WPA2)
FIND_PACKAGE(OpenSSL REQUIRED)
SET(HAVE_WPA2_DECRYPTION ON)
MESSAGE(STATUS "Enabling WPA2 decryption support.")
ELSE(LIBTINS_ENABLE_WPA2)
MESSAGE(STATUS "Disabling WPA2 decryption support.")
ENDIF(LIBTINS_ENABLE_WPA2)
ENDIF(LIBTINS_ENABLE_DOT11)
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
# Congiguration file
CONFIGURE_FILE(
"${PROJECT_SOURCE_DIR}/include/config.h.in"
"${PROJECT_SOURCE_DIR}/include/config.h"
)
ENABLE_TESTING()
ADD_SUBDIRECTORY(include)
ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(tests)
ADD_SUBDIRECTORY(examples)
# Add all targets to the build-tree export set
EXPORT(
TARGETS tins
FILE "${PROJECT_BINARY_DIR}/libtinsTargets.cmake"
)
# Export the package for use from the build-tree
# (this registers the build-tree with a global CMake-registry)
EXPORT(PACKAGE libtins)
# Create the libtinsConfig.cmake and libtinsConfigVersion.cmake files
# for the build tree
SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include")
CONFIGURE_FILE(
libtinsConfig.cmake.in
"${PROJECT_BINARY_DIR}/libtinsConfig.cmake" @ONLY
)
CONFIGURE_FILE(
libtinsConfigVersion.cmake.in
"${PROJECT_BINARY_DIR}/libtinsConfigVersion.cmake" @ONLY
)
# Install the libtinsConfig.cmake and libtinsConfigVersion.cmake
INSTALL(
FILES
"${PROJECT_BINARY_DIR}/libtinsConfig.cmake"
"${PROJECT_BINARY_DIR}/libtinsConfigVersion.cmake"
DESTINATION CMake
COMPONENT dev
)
# Install the export set for use with the install-tree
INSTALL(
EXPORT libtinsTargets
DESTINATION CMake
COMPONENT dev
)

View File

@@ -23,41 +23,49 @@ if some features of the library are disabled.
In order to compile, execute:
```Shell
./configure
# Create the build directory
mkdir build
cd build
# Configure the project. Add any relevant configuration flags
cmake ../
# Compile!
make
```
Note that by default, only the shared object is compiled. If you would
like to generate a static library file as well, run:
like to generate a static library file, run:
```Shell
./configure --enable-static
cmake ../ -DLIBTINS_BUILD_SHARED=0
```
The generated static/shared library files will be located in the .libs
directory.
The generated static/shared library files will be located in the
_build/lib_ directory.
libtins is noticeable faster if you enable C++11 support. Therefore, if
your compiler supports this standard, then you should enable it. In
order to do so, use the --enable-c++11 switch:
libtins is noticeable faster if you enable _C++11_ support. Therefore,
if your compiler supports this standard, then you should enable it.
In order to do so, use the _LIBTINS_ENABLE_CXX11_ switch:
```Shell
./configure --enable-c++11
cmake ../ -DLIBTINS_ENABLE_CXX11=1
```
If you want to disable WPA2 decryption support, which will remove
openssl as a dependency for compilation, use the --disable-wpa2 switch:
If you want to disable _WPA2_ decryption support, which will remove
openssl as a dependency for compilation, use the
_LIBTINS_ENABLE_WPA2_ switch:
```Shell
./configure --disable-wpa2
cmake ../ -DLIBTINS_ENABLE_WPA2=0
```
If you want to disable IEEE 802.11 support(this will also disable
RadioTap and WPA2 decryption), which will reduce the size of the
resulting library in around 20%, use the --disable-dot11 switch:
resulting library in around 20%, use the _LIBTINS_ENABLE_DOT11_ switch:
```Shell
./configure --disable-dot11
cmake ../ -DLIBTINS_ENABLE_DOT11=0
```
## Installing ##
@@ -69,7 +77,7 @@ shared object, execute as root:
make install
```
This will install the shared object typically in /usr/local/lib. Note
This will install the shared object typically in _/usr/local/lib_. Note
that you might have to update ldconfig's cache before using it, so
in order to invalidate it, you should run(as root):

2
aclocal.m4 vendored
View File

@@ -32,7 +32,7 @@ To do so, use the procedure documented by the package, typically 'autoreconf'.])
# generated from the m4 files accompanying Automake X.Y.
# (This private macro should not be called outside this file.)
AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.11'
[am__api_version='1.14'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
m4_if([$1], [1.14.1], [],

View File

@@ -0,0 +1,142 @@
# - Check which parts of the C++11 standard the compiler supports
#
# When found it will set the following variables
#
# CXX11_COMPILER_FLAGS - the compiler flags needed to get C++11 features
#
# HAS_CXX11_AUTO - auto keyword
# HAS_CXX11_AUTO_RET_TYPE - function declaration with deduced return types
# HAS_CXX11_CLASS_OVERRIDE - override and final keywords for classes and methods
# HAS_CXX11_CONSTEXPR - constexpr keyword
# HAS_CXX11_CSTDINT_H - cstdint header
# HAS_CXX11_DECLTYPE - decltype keyword
# HAS_CXX11_FUNC - __func__ preprocessor constant
# HAS_CXX11_INITIALIZER_LIST - initializer list
# HAS_CXX11_LAMBDA - lambdas
# HAS_CXX11_LIB_REGEX - regex library
# HAS_CXX11_LONG_LONG - long long signed & unsigned types
# HAS_CXX11_NULLPTR - nullptr
# HAS_CXX11_RVALUE_REFERENCES - rvalue references
# HAS_CXX11_SIZEOF_MEMBER - sizeof() non-static members
# HAS_CXX11_STATIC_ASSERT - static_assert()
# HAS_CXX11_VARIADIC_TEMPLATES - variadic templates
#=============================================================================
# Copyright 2011,2012 Rolf Eike Beer <eike@sf-mail.de>
# Copyright 2012 Andreas Weis
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
#
# Each feature may have up to 3 checks, every one of them in it's own file
# FEATURE.cpp - example that must build and return 0 when run
# FEATURE_fail.cpp - example that must build, but may not return 0 when run
# FEATURE_fail_compile.cpp - example that must fail compilation
#
# The first one is mandatory, the latter 2 are optional and do not depend on
# each other (i.e. only one may be present).
#
if (NOT CMAKE_CXX_COMPILER_LOADED)
message(FATAL_ERROR "CheckCXX11Features modules only works if language CXX is enabled")
endif ()
cmake_minimum_required(VERSION 2.8.3)
#
### Check for needed compiler flags
#
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag("-std=c++11" _HAS_CXX11_FLAG)
if (NOT _HAS_CXX11_FLAG)
check_cxx_compiler_flag("-std=c++0x" _HAS_CXX0X_FLAG)
endif ()
if (_HAS_CXX11_FLAG)
set(CXX11_COMPILER_FLAGS "-std=c++11")
elseif (_HAS_CXX0X_FLAG)
set(CXX11_COMPILER_FLAGS "-std=c++0x")
endif ()
function(cxx11_check_feature FEATURE_NAME RESULT_VAR)
if (NOT DEFINED ${RESULT_VAR})
set(_bindir "${CMAKE_CURRENT_BINARY_DIR}/cxx11_${FEATURE_NAME}")
set(_SRCFILE_BASE ${CMAKE_CURRENT_LIST_DIR}/CheckCXX11Features/cxx11-test-${FEATURE_NAME})
set(_LOG_NAME "\"${FEATURE_NAME}\"")
message(STATUS "Checking C++11 support for ${_LOG_NAME}")
set(_SRCFILE "${_SRCFILE_BASE}.cpp")
set(_SRCFILE_FAIL "${_SRCFILE_BASE}_fail.cpp")
set(_SRCFILE_FAIL_COMPILE "${_SRCFILE_BASE}_fail_compile.cpp")
if (CROSS_COMPILING)
try_compile(${RESULT_VAR} "${_bindir}" "${_SRCFILE}"
COMPILE_DEFINITIONS "${CXX11_COMPILER_FLAGS}")
if (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL})
try_compile(${RESULT_VAR} "${_bindir}_fail" "${_SRCFILE_FAIL}"
COMPILE_DEFINITIONS "${CXX11_COMPILER_FLAGS}")
endif (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL})
else (CROSS_COMPILING)
try_run(_RUN_RESULT_VAR _COMPILE_RESULT_VAR
"${_bindir}" "${_SRCFILE}"
COMPILE_DEFINITIONS "${CXX11_COMPILER_FLAGS}")
if (_COMPILE_RESULT_VAR AND NOT _RUN_RESULT_VAR)
set(${RESULT_VAR} TRUE)
else (_COMPILE_RESULT_VAR AND NOT _RUN_RESULT_VAR)
set(${RESULT_VAR} FALSE)
endif (_COMPILE_RESULT_VAR AND NOT _RUN_RESULT_VAR)
if (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL})
try_run(_RUN_RESULT_VAR _COMPILE_RESULT_VAR
"${_bindir}_fail" "${_SRCFILE_FAIL}"
COMPILE_DEFINITIONS "${CXX11_COMPILER_FLAGS}")
if (_COMPILE_RESULT_VAR AND _RUN_RESULT_VAR)
set(${RESULT_VAR} TRUE)
else (_COMPILE_RESULT_VAR AND _RUN_RESULT_VAR)
set(${RESULT_VAR} FALSE)
endif (_COMPILE_RESULT_VAR AND _RUN_RESULT_VAR)
endif (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL})
endif (CROSS_COMPILING)
if (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL_COMPILE})
try_compile(_TMP_RESULT "${_bindir}_fail_compile" "${_SRCFILE_FAIL_COMPILE}"
COMPILE_DEFINITIONS "${CXX11_COMPILER_FLAGS}")
if (_TMP_RESULT)
set(${RESULT_VAR} FALSE)
else (_TMP_RESULT)
set(${RESULT_VAR} TRUE)
endif (_TMP_RESULT)
endif (${RESULT_VAR} AND EXISTS ${_SRCFILE_FAIL_COMPILE})
if (${RESULT_VAR})
message(STATUS "Checking C++11 support for ${_LOG_NAME}: works")
else (${RESULT_VAR})
message(STATUS "Checking C++11 support for ${_LOG_NAME}: not supported")
endif (${RESULT_VAR})
set(${RESULT_VAR} ${${RESULT_VAR}} CACHE INTERNAL "C++11 support for ${_LOG_NAME}")
endif (NOT DEFINED ${RESULT_VAR})
endfunction(cxx11_check_feature)
cxx11_check_feature("__func__" HAS_CXX11_FUNC)
cxx11_check_feature("auto" HAS_CXX11_AUTO)
cxx11_check_feature("auto_ret_type" HAS_CXX11_AUTO_RET_TYPE)
cxx11_check_feature("class_override_final" HAS_CXX11_CLASS_OVERRIDE)
cxx11_check_feature("constexpr" HAS_CXX11_CONSTEXPR)
cxx11_check_feature("cstdint" HAS_CXX11_CSTDINT_H)
cxx11_check_feature("decltype" HAS_CXX11_DECLTYPE)
cxx11_check_feature("initializer_list" HAS_CXX11_INITIALIZER_LIST)
cxx11_check_feature("lambda" HAS_CXX11_LAMBDA)
cxx11_check_feature("long_long" HAS_CXX11_LONG_LONG)
cxx11_check_feature("nullptr" HAS_CXX11_NULLPTR)
cxx11_check_feature("regex" HAS_CXX11_LIB_REGEX)
cxx11_check_feature("rvalue-references" HAS_CXX11_RVALUE_REFERENCES)
cxx11_check_feature("sizeof_member" HAS_CXX11_SIZEOF_MEMBER)
cxx11_check_feature("static_assert" HAS_CXX11_STATIC_ASSERT)
cxx11_check_feature("variadic_templates" HAS_CXX11_VARIADIC_TEMPLATES)

View File

@@ -0,0 +1,8 @@
int main(void)
{
if (!__func__)
return 1;
if (!(*__func__))
return 1;
return 0;
}

View File

@@ -0,0 +1,12 @@
int main()
{
auto i = 5;
auto f = 3.14159f;
auto d = 3.14159;
bool ret = (
(sizeof(f) < sizeof(d)) &&
(sizeof(i) == sizeof(int))
);
return ret ? 0 : 1;
}

View File

@@ -0,0 +1,7 @@
int main(void)
{
// must fail because there is no initializer
auto i;
return 0;
}

View File

@@ -0,0 +1,8 @@
auto foo(int i) -> int {
return i - 1;
}
int main()
{
return foo(1);
}

View File

@@ -0,0 +1,21 @@
class base {
public:
virtual int foo(int a)
{ return 4 + a; }
int bar(int a) final
{ return a - 2; }
};
class sub final : public base {
public:
virtual int foo(int a) override
{ return 8 + 2 * a; };
};
int main(void)
{
base b;
sub s;
return (b.foo(2) * 2 == s.foo(2)) ? 0 : 1;
}

View File

@@ -0,0 +1,25 @@
class base {
public:
virtual int foo(int a)
{ return 4 + a; }
virtual int bar(int a) final
{ return a - 2; }
};
class sub final : public base {
public:
virtual int foo(int a) override
{ return 8 + 2 * a; };
virtual int bar(int a)
{ return a; }
};
class impossible : public sub { };
int main(void)
{
base b;
sub s;
return 1;
}

View File

@@ -0,0 +1,19 @@
constexpr int square(int x)
{
return x*x;
}
constexpr int the_answer()
{
return 42;
}
int main()
{
int test_arr[square(3)];
bool ret = (
(square(the_answer()) == 1764) &&
(sizeof(test_arr)/sizeof(test_arr[0]) == 9)
);
return ret ? 0 : 1;
}

View File

@@ -0,0 +1,11 @@
#include <cstdint>
int main()
{
bool test =
(sizeof(int8_t) == 1) &&
(sizeof(int16_t) == 2) &&
(sizeof(int32_t) == 4) &&
(sizeof(int64_t) == 8);
return test ? 0 : 1;
}

View File

@@ -0,0 +1,10 @@
bool check_size(int i)
{
return sizeof(int) == sizeof(decltype(i));
}
int main()
{
bool ret = check_size(42);
return ret ? 0 : 1;
}

View File

@@ -0,0 +1,27 @@
#include <vector>
class seq {
public:
seq(std::initializer_list<int> list);
int length() const;
private:
std::vector<int> m_v;
};
seq::seq(std::initializer_list<int> list)
: m_v(list)
{
}
int seq::length() const
{
return m_v.size();
}
int main(void)
{
seq a = {18, 20, 2, 0, 4, 7};
return (a.length() == 6) ? 0 : 1;
}

View File

@@ -0,0 +1,5 @@
int main()
{
int ret = 0;
return ([&ret]() -> int { return ret; })();
}

View File

@@ -0,0 +1,7 @@
int main(void)
{
long long l;
unsigned long long ul;
return ((sizeof(l) >= 8) && (sizeof(ul) >= 8)) ? 0 : 1;
}

View File

@@ -0,0 +1,6 @@
int main(void)
{
void *v = nullptr;
return v ? 1 : 0;
}

View File

@@ -0,0 +1,6 @@
int main(void)
{
int i = nullptr;
return 1;
}

View File

@@ -0,0 +1,26 @@
#include <algorithm>
#include <regex>
int parse_line(std::string const& line)
{
std::string tmp;
if(std::regex_search(line, std::regex("(\\s)+(-)?(\\d)+//(-)?(\\d)+(\\s)+"))) {
tmp = std::regex_replace(line, std::regex("(-)?(\\d)+//(-)?(\\d)+"), std::string("V"));
} else if(std::regex_search(line, std::regex("(\\s)+(-)?(\\d)+/(-)?(\\d)+(\\s)+"))) {
tmp = std::regex_replace(line, std::regex("(-)?(\\d)+/(-)?(\\d)+"), std::string("V"));
} else if(std::regex_search(line, std::regex("(\\s)+(-)?(\\d)+/(-)?(\\d)+/(-)?(\\d)+(\\s)+"))) {
tmp = std::regex_replace(line, std::regex("(-)?(\\d)+/(-)?(\\d)+/(-)?(\\d)+"), std::string("V"));
} else {
tmp = std::regex_replace(line, std::regex("(-)?(\\d)+"), std::string("V"));
}
return static_cast<int>(std::count(tmp.begin(), tmp.end(), 'V'));
}
int main()
{
bool test = (parse_line("f 7/7/7 -3/3/-3 2/-2/2") == 3) &&
(parse_line("f 7//7 3//-3 -2//2") == 3) &&
(parse_line("f 7/7 3/-3 -2/2") == 3) &&
(parse_line("f 7 3 -2") == 3);
return test ? 0 : 1;
}

View File

@@ -0,0 +1,57 @@
#include <cassert>
class rvmove {
public:
void *ptr;
char *array;
rvmove()
: ptr(0),
array(new char[10])
{
ptr = this;
}
rvmove(rvmove &&other)
: ptr(other.ptr),
array(other.array)
{
other.array = 0;
other.ptr = 0;
}
~rvmove()
{
assert(((ptr != 0) && (array != 0)) || ((ptr == 0) && (array == 0)));
delete[] array;
}
rvmove &operator=(rvmove &&other)
{
delete[] array;
ptr = other.ptr;
array = other.array;
other.array = 0;
other.ptr = 0;
return *this;
}
static rvmove create()
{
return rvmove();
}
private:
rvmove(const rvmove &);
rvmove &operator=(const rvmove &);
};
int main()
{
rvmove mine;
if (mine.ptr != &mine)
return 1;
mine = rvmove::create();
if (mine.ptr == &mine)
return 1;
return 0;
}

View File

@@ -0,0 +1,14 @@
struct foo {
char bar;
int baz;
};
int main(void)
{
bool ret = (
(sizeof(foo::bar) == 1) &&
(sizeof(foo::baz) >= sizeof(foo::bar)) &&
(sizeof(foo) >= sizeof(foo::bar) + sizeof(foo::baz))
);
return ret ? 0 : 1;
}

View File

@@ -0,0 +1,9 @@
struct foo {
int baz;
double bar;
};
int main(void)
{
return (sizeof(foo::bar) == 4) ? 0 : 1;
}

View File

@@ -0,0 +1,5 @@
int main(void)
{
static_assert(0 < 1, "your ordering of integers is screwed");
return 0;
}

View File

@@ -0,0 +1,5 @@
int main(void)
{
static_assert(1 < 0, "your ordering of integers is screwed");
return 0;
}

View File

@@ -0,0 +1,23 @@
int Accumulate()
{
return 0;
}
template<typename T, typename... Ts>
int Accumulate(T v, Ts... vs)
{
return v + Accumulate(vs...);
}
template<int... Is>
int CountElements()
{
return sizeof...(Is);
}
int main()
{
int acc = Accumulate(1, 2, 3, 4, -5);
int count = CountElements<1,2,3,4,5>();
return ((acc == 5) && (count == 5)) ? 0 : 1;
}

View File

@@ -0,0 +1,74 @@
# - Try to find libpcap include dirs and libraries
#
# Usage of this module as follows:
#
# find_package(PCAP)
#
# Variables used by this module, they can change the default behaviour and need
# to be set before calling find_package:
#
# PCAP_ROOT_DIR Set this variable to the root installation of
# libpcap if the module has problems finding the
# proper installation path.
#
# Variables defined by this module:
#
# PCAP_FOUND System has libpcap, include and library dirs found
# PCAP_INCLUDE_DIR The libpcap include directories.
# PCAP_LIBRARY The libpcap library (possibly includes a thread
# library e.g. required by pf_ring's libpcap)
# HAVE_PF_RING If a found version of libpcap supports PF_RING
find_path(PCAP_ROOT_DIR
NAMES include/pcap.h
)
find_path(PCAP_INCLUDE_DIR
NAMES pcap.h
HINTS ${PCAP_ROOT_DIR}/include
)
find_library(PCAP_LIBRARY
NAMES pcap wpcap
HINTS ${PCAP_ROOT_DIR}/lib
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PCAP DEFAULT_MSG
PCAP_LIBRARY
PCAP_INCLUDE_DIR
)
include(CheckCXXSourceCompiles)
set(CMAKE_REQUIRED_LIBRARIES ${PCAP_LIBRARY})
check_cxx_source_compiles("int main() { return 0; }" PCAP_LINKS_SOLO)
set(CMAKE_REQUIRED_LIBRARIES)
# check if linking against libpcap also needs to link against a thread library
if (NOT PCAP_LINKS_SOLO)
find_package(Threads)
if (THREADS_FOUND)
set(CMAKE_REQUIRED_LIBRARIES ${PCAP_LIBRARY} ${CMAKE_THREAD_LIBS_INIT})
check_cxx_source_compiles("int main() { return 0; }" PCAP_NEEDS_THREADS)
set(CMAKE_REQUIRED_LIBRARIES)
endif (THREADS_FOUND)
if (THREADS_FOUND AND PCAP_NEEDS_THREADS)
set(_tmp ${PCAP_LIBRARY} ${CMAKE_THREAD_LIBS_INIT})
list(REMOVE_DUPLICATES _tmp)
set(PCAP_LIBRARY ${_tmp}
CACHE STRING "Libraries needed to link against libpcap" FORCE)
else (THREADS_FOUND AND PCAP_NEEDS_THREADS)
message(FATAL_ERROR "Couldn't determine how to link against libpcap")
endif (THREADS_FOUND AND PCAP_NEEDS_THREADS)
endif (NOT PCAP_LINKS_SOLO)
include(CheckFunctionExists)
set(CMAKE_REQUIRED_LIBRARIES ${PCAP_LIBRARY})
check_function_exists(pcap_get_pfring_id HAVE_PF_RING)
set(CMAKE_REQUIRED_LIBRARIES)
mark_as_advanced(
PCAP_ROOT_DIR
PCAP_INCLUDE_DIR
PCAP_LIBRARY
)

1
compile Symbolic link
View File

@@ -0,0 +1 @@
/usr/share/automake-1.14/compile

8
configure vendored
View File

@@ -1426,8 +1426,8 @@ Optional Features:
--disable-dependency-tracking
speeds up one-time build
--disable-libtool-lock avoid locking (might break parallel builds)
--disable-maintainer-mode
disable make rules and dependencies not useful (and
--enable-maintainer-mode
enable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
--enable-c++11 enable C++11 features
--disable-dot11 disable IEEE 802.11 support
@@ -2506,7 +2506,7 @@ test -n "$target_alias" &&
ac_config_headers="$ac_config_headers include/config.h"
am__api_version='1.11'
am__api_version='1.14'
# Find a good install program. We prefer a C program (faster),
# so one script is as good as another. But avoid the broken or
@@ -11657,7 +11657,7 @@ $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles
if test "${enable_maintainer_mode+set}" = set; then :
enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval
else
USE_MAINTAINER_MODE=yes
USE_MAINTAINER_MODE=no
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5

View File

@@ -4,7 +4,7 @@ AC_CONFIG_HEADER(include/config.h)
AM_INIT_AUTOMAKE([-Wall -Werror -Wno-extra-portability foreign])
LT_INIT([disable-static])
AC_CONFIG_MACRO_DIR([m4])
AM_MAINTAINER_MODE([enable])
AM_MAINTAINER_MODE([disable])
AC_PROG_CXX
AC_LANG(C++)

56
examples/CMakeLists.txt Normal file
View File

@@ -0,0 +1,56 @@
FIND_PACKAGE(libtins QUIET)
FIND_PACKAGE(Threads QUIET)
IF(libtins_FOUND)
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/examples)
INCLUDE_DIRECTORIES(${LIBTINS_INCLUDE_DIRS})
LINK_LIBRARIES(${LIBTINS_LIBRARIES})
IF(HAVE_CXX11)
SET(LIBTINS_CXX11_EXAMPLES
arpmonitor
dns_queries
dns_spoof
dns_stats
wps_detect
)
ELSE(HAVE_CXX11)
MESSAGE(WARNING "Disabling some examples since C++11 support is disabled.")
ENDIF(HAVE_CXX11)
ADD_CUSTOM_TARGET(
examples DEPENDS
arpspoofing
${LIBTINS_CXX11_EXAMPLES}
beacon_display
portscan
traceroute
)
ADD_EXECUTABLE(arpspoofing EXCLUDE_FROM_ALL arpspoofing.cpp)
IF(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)
ADD_EXECUTABLE(dns_stats EXCLUDE_FROM_ALL dns_stats.cpp)
ADD_EXECUTABLE(wps_detect EXCLUDE_FROM_ALL wps_detect.cpp)
ENDIF(HAVE_CXX11)
ADD_EXECUTABLE(beacon_display EXCLUDE_FROM_ALL beacon_display.cpp)
if(THREADS_FOUND)
ADD_EXECUTABLE(portscan EXCLUDE_FROM_ALL portscan.cpp)
ADD_EXECUTABLE(traceroute EXCLUDE_FROM_ALL traceroute.cpp)
TARGET_LINK_LIBRARIES(portscan ${CMAKE_THREAD_LIBS_INIT})
TARGET_LINK_LIBRARIES(traceroute ${CMAKE_THREAD_LIBS_INIT})
ELSE(THREADS_FOUND)
MESSAGE(WARNING "Disabling portscan and traceroute examples since pthreads library was not found.")
ENDIF(THREADS_FOUND)
ELSE(libtins_FOUND)
MESSAGE(
WARNING
"Disabling examples since libtins is not installed. "
"Run cmake again once it is installed in order to compile them."
)
ENDIF(libtins_FOUND)

7
include/CMakeLists.txt Normal file
View File

@@ -0,0 +1,7 @@
FILE(GLOB INCLUDE_FILES "*.h")
INSTALL(
FILES ${INCLUDE_FILES}
DESTINATION include/tins
COMPONENT Headers
)
ADD_SUBDIRECTORY(dot11)

View File

@@ -1,89 +1,9 @@
/* include/config.h.in. Generated from configure.ac by autoheader. */
/* define if the compiler supports basic C++11 syntax */
#undef HAVE_CXX11
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define if the compiler supports basic C++11 syntax */
#cmakedefine HAVE_CXX11
/* Have IEEE 802.11 support */
#undef HAVE_DOT11
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the `crypto' library (-lcrypto). */
#undef HAVE_LIBCRYPTO
/* Define to 1 if you have the `pcap' library (-lpcap). */
#undef HAVE_LIBPCAP
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <openssl/aes.h> header file. */
#undef HAVE_OPENSSL_AES_H
/* Define to 1 if you have the <openssl/evp.h> header file. */
#undef HAVE_OPENSSL_EVP_H
/* Define to 1 if you have the <openssl/hmac.h> header file. */
#undef HAVE_OPENSSL_HMAC_H
/* Define to 1 if you have the <pcap.h> header file. */
#undef HAVE_PCAP_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
#cmakedefine HAVE_DOT11
/* Have WPA2 decryption library */
#undef HAVE_WPA2_DECRYPTION
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#undef LT_OBJDIR
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Version number of package */
#undef VERSION
#cmakedefine HAVE_WPA2_DECRYPTION

View File

@@ -0,0 +1,6 @@
FILE(GLOB INCLUDE_FILES "*.h")
INSTALL(
FILES ${INCLUDE_FILES}
DESTINATION include/tins/dot11
COMPONENT Headers
)

View File

@@ -286,7 +286,7 @@ public:
* \return true if pdu() == nullptr, false otherwise.
*/
operator bool() const {
return bool(pdu_);
return pdu_ ? true : false;
}
/**

16
libtinsConfig.cmake.in Normal file
View File

@@ -0,0 +1,16 @@
# - Config file for the libtins package
# It defines the following variables
# LIBTINS_INCLUDE_DIRS - include directories for libtins
# LIBTINS_LIBRARIES - libraries to link against
# Compute paths
get_filename_component(LIBTINS_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
set(LIBTINS_INCLUDE_DIRS "@CONF_INCLUDE_DIRS@")
# Our library dependencies (contains definitions for IMPORTED targets)
if(NOT TARGET libtins AND NOT LIBTINS_BINARY_DIR)
include("${LIBTINS_CMAKE_DIR}/libtinsTargets.cmake")
endif()
# These are IMPORTED targets created by libtinsTargets.cmake
set(LIBTINS_LIBRARIES tins)

View File

@@ -0,0 +1,11 @@
set(PACKAGE_VERSION "@LIBTINS_VERSION@")
# Check whether the requested PACKAGE_FIND_VERSION is compatible
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()

73
src/CMakeLists.txt Normal file
View File

@@ -0,0 +1,73 @@
SET(LIBTINS_INCLUDE_DIR ../include)
INCLUDE_DIRECTORIES(
${LIBTINS_INCLUDE_DIR}
${OPENSSL_INCLUDE_DIR}
${PCAP_INCLUDE_DIR}
)
ADD_LIBRARY(
tins ${LIBTINS_TYPE}
arp.cpp
bootp.cpp
handshake_capturer.cpp
stp.cpp
pppoe.cpp
crypto.cpp
dhcp.cpp
dhcpv6.cpp
dns.cpp
dot3.cpp
dot1q.cpp
eapol.cpp
ethernetII.cpp
icmp.cpp
icmpv6.cpp
internals.cpp
ip_reassembler.cpp
ip.cpp
ip_address.cpp
ipv6.cpp
ipv6_address.cpp
ipsec.cpp
llc.cpp
loopback.cpp
network_interface.cpp
packet_sender.cpp
packet_writer.cpp
ppi.cpp
pdu.cpp
radiotap.cpp
address_range.cpp
rawpdu.cpp
rsn_information.cpp
sll.cpp
snap.cpp
sniffer.cpp
tcp.cpp
tcp_stream.cpp
udp.cpp
utils.cpp
dot11/dot11_base.cpp
dot11/dot11_data.cpp
dot11/dot11_mgmt.cpp
dot11/dot11_beacon.cpp
dot11/dot11_assoc.cpp
dot11/dot11_auth.cpp
dot11/dot11_probe.cpp
dot11/dot11_control.cpp
)
TARGET_LINK_LIBRARIES(tins ${PCAP_LIBRARY} ${OPENSSL_LIBRARIES} ${LIBTINS_OS_LIBS})
SET_TARGET_PROPERTIES(tins PROPERTIES OUTPUT_NAME tins )
SET_TARGET_PROPERTIES(tins PROPERTIES VERSION ${LIBTINS_CPP_VERSION} SOVERSION ${LIBTINS_CPP_VERSION} )
# Install instructions for this target
INSTALL(
TARGETS tins
EXPORT libtinsTargets
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
COMPONENT dev
)

View File

@@ -368,8 +368,6 @@ void DHCPv6::rapid_commit() {
}
void DHCPv6::user_class(const user_class_type &value) {
typedef user_class_type::data_type::const_iterator iterator;
std::vector<uint8_t> buffer;
Internals::class_option_data2option(value.data.begin(), value.data.end(), buffer);
add_option(

View File

@@ -295,13 +295,15 @@ void DNS::add_additional(const Resource &resource){
std::string DNS::encode_domain_name(const std::string &dn) {
std::string output;
size_t last_index(0), index;
while((index = dn.find('.', last_index+1)) != string::npos) {
output.push_back(index - last_index);
output.append(dn.begin() + last_index, dn.begin() + index);
last_index = index + 1; //skip dot
if(!dn.empty()) {
while((index = dn.find('.', last_index+1)) != string::npos) {
output.push_back(index - last_index);
output.append(dn.begin() + last_index, dn.begin() + index);
last_index = index + 1; //skip dot
}
output.push_back(dn.size() - last_index);
output.append(dn.begin() + last_index, dn.end());
}
output.push_back(dn.size() - last_index);
output.append(dn.begin() + last_index, dn.end());
output.push_back('\0');
return output;
}

View File

@@ -196,6 +196,7 @@ void ICMPv6::write_serialization(uint8_t *buffer, uint32_t total_sz, const PDU *
#ifdef TINS_DEBUG
assert(total_sz >= header_size());
#endif
uint32_t full_sz = total_sz;
uint8_t *buffer_start = buffer;
_header.cksum = 0;
std::memcpy(buffer, &_header, sizeof(_header));
@@ -231,7 +232,7 @@ void ICMPv6::write_serialization(uint8_t *buffer, uint32_t total_sz, const PDU *
ipv6->dst_addr(),
size(),
Constants::IP::PROTO_ICMPV6
) + Utils::do_checksum(buffer_start, buffer);
) + Utils::do_checksum(buffer_start, buffer_start + full_sz);
while (checksum >> 16)
checksum = (checksum & 0xffff) + (checksum >> 16);
this->checksum(~checksum);
@@ -241,8 +242,16 @@ void ICMPv6::write_serialization(uint8_t *buffer, uint32_t total_sz, const PDU *
// can i haz more?
bool ICMPv6::has_options() const {
return type() == NEIGHBOUR_SOLICIT ||
type() == ROUTER_ADVERT;
switch (type()) {
case NEIGHBOUR_SOLICIT:
case NEIGHBOUR_ADVERT:
case ROUTER_SOLICIT:
case ROUTER_ADVERT:
case REDIRECT:
return true;
default:
return false;
}
}
void ICMPv6::add_option(const option &option) {

View File

@@ -28,6 +28,7 @@
*/
#include <algorithm>
#include <sstream>
#include "sniffer.h"
#include "dot11/dot11_base.h"
#include "ethernetII.h"
@@ -196,14 +197,17 @@ void BaseSniffer::set_timeout(int ms) {
// ****************************** Sniffer ******************************
pcap_t *
pcap_open_live_extended(const char *source, int snaplen, int promisc, int to_ms, int rfmon, char *errbuf)
pcap_open_live_extended(const char *source, int snaplen, int promisc, int to_ms, int rfmon, std::string& error)
{
pcap_t *p;
char errbuf[PCAP_ERRBUF_SIZE];
int status;
p = pcap_create(source, errbuf);
if (p == NULL)
if (p == NULL) {
error = errbuf;
return (NULL);
}
status = pcap_set_snaplen(p, snaplen);
if (status < 0)
goto fail;
@@ -213,18 +217,24 @@ pcap_open_live_extended(const char *source, int snaplen, int promisc, int to_ms,
status = pcap_set_timeout(p, to_ms);
if (status < 0)
goto fail;
#ifndef WIN32
if(pcap_can_set_rfmon(p) == 1) {
status = pcap_set_rfmon(p, rfmon);
if (status < 0)
goto fail;
}
#endif // WIN32
status = pcap_activate(p);
if (status < 0)
goto fail;
return (p);
fail:
snprintf(errbuf, PCAP_ERRBUF_SIZE, "%s: %s", source, pcap_geterr(p));
std::ostringstream oss;
oss << source << ": " << pcap_geterr(p);
error = oss.str();
pcap_close(p);
return (NULL);
}
@@ -250,9 +260,17 @@ void Sniffer::init_sniffer(const std::string &device, unsigned max_packet_size,
ip = 0;
if_mask = 0;
}
pcap_t *phandle = pcap_open_live_extended(device.c_str(), max_packet_size, promisc, 1000, rfmon, error);
std::string string_error;
pcap_t *phandle = pcap_open_live_extended(
device.c_str(),
max_packet_size,
promisc,
1000,
rfmon,
string_error
);
if(!phandle)
throw runtime_error(error);
throw runtime_error(string_error);
init(phandle, filter, if_mask);
}

6
tests/CMakeLists.txt Normal file
View File

@@ -0,0 +1,6 @@
FIND_PACKAGE(GTest)
IF(GTEST_FOUND)
ADD_SUBDIRECTORY(src)
ELSE(GTEST_FOUND)
MESSAGE(WARNING "Google test not found. Disabling tests.")
ENDIF(GTEST_FOUND)

188
tests/src/CMakeLists.txt Normal file
View File

@@ -0,0 +1,188 @@
# Use libtins' include directories + test include directories
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/include/ ../include/)
# Find pthread library
FIND_PACKAGE(Threads REQUIRED)
# Link against GoogleTest, libtins and pthread.
# Pthread is required by GoogleTest
LINK_LIBRARIES(
${GTEST_LIBRARIES}
${GTEST_MAIN_LIBRARY}
tins
${CMAKE_THREAD_LIBS_INIT}
)
# Add tests target
ADD_CUSTOM_TARGET(
tests DEPENDS
AddressRangeTest
AllocatorsTest
ArpTest
DHCPTest
DHCPv6Test
DNSTest
Dot11AckTest
Dot11AssocRequestTest
Dot11AssocResponseTest
Dot11AuthenticationTest
Dot11BeaconTest
Dot11BlockAckRequestTest
Dot11CFEndTest
Dot11CFEndACKTest
Dot11DataTest
Dot11DeauthenticationTest
Dot11DisassocTest
Dot11Test
Dot11ProbeRequestTest
Dot11ProbeResponseTest
Dot11PSPollTest
Dot11ReassocRequestTest
Dot11ReassocResponseTest
Dot11RTSTest
Dot1QTest
EthernetTest
HWAddressTest
ICMPTest
ICMPv6Test
IPTest
IPReassemblerTest
IPAddressTest
IPSecTest
IPv6Test
IPv6AddressTest
LLCTest
MatchesResponseTest
NetworkInterfaceTest
PDUTest
PPITest
PPPoETest
RadioTapTest
RC4EAPOLTest
RSNEAPOLTest
SLLTest
SNAPTest
STPTest
TCPTest
TCPStreamTest
UDPTest
UtilsTest
WEPDecryptTest
WPA2DecryptTest
)
# Test executables
ADD_EXECUTABLE(AddressRangeTest EXCLUDE_FROM_ALL address_range.cpp)
ADD_EXECUTABLE(AllocatorsTest EXCLUDE_FROM_ALL allocators.cpp)
ADD_EXECUTABLE(ArpTest EXCLUDE_FROM_ALL arp.cpp)
ADD_EXECUTABLE(DHCPTest EXCLUDE_FROM_ALL dhcp.cpp)
ADD_EXECUTABLE(DHCPv6Test EXCLUDE_FROM_ALL dhcpv6.cpp)
ADD_EXECUTABLE(DNSTest EXCLUDE_FROM_ALL dns.cpp)
ADD_EXECUTABLE(Dot1QTest EXCLUDE_FROM_ALL dot1q.cpp)
ADD_EXECUTABLE(EthernetTest EXCLUDE_FROM_ALL ethernetII.cpp)
ADD_EXECUTABLE(HWAddressTest EXCLUDE_FROM_ALL hwaddress.cpp)
ADD_EXECUTABLE(ICMPTest EXCLUDE_FROM_ALL icmp.cpp)
ADD_EXECUTABLE(ICMPv6Test EXCLUDE_FROM_ALL icmpv6.cpp)
ADD_EXECUTABLE(IPTest EXCLUDE_FROM_ALL ip.cpp)
ADD_EXECUTABLE(IPReassemblerTest EXCLUDE_FROM_ALL ip_reassembler.cpp)
ADD_EXECUTABLE(IPAddressTest EXCLUDE_FROM_ALL ipaddress.cpp)
ADD_EXECUTABLE(IPSecTest EXCLUDE_FROM_ALL ipsec.cpp)
ADD_EXECUTABLE(IPv6Test EXCLUDE_FROM_ALL ipv6.cpp)
ADD_EXECUTABLE(IPv6AddressTest EXCLUDE_FROM_ALL ipv6address.cpp)
ADD_EXECUTABLE(LLCTest EXCLUDE_FROM_ALL llc.cpp)
ADD_EXECUTABLE(MatchesResponseTest EXCLUDE_FROM_ALL matches_response.cpp)
ADD_EXECUTABLE(NetworkInterfaceTest EXCLUDE_FROM_ALL network_interface.cpp)
ADD_EXECUTABLE(PDUTest EXCLUDE_FROM_ALL pdu.cpp)
ADD_EXECUTABLE(PPITest EXCLUDE_FROM_ALL ppi.cpp)
ADD_EXECUTABLE(PPPoETest EXCLUDE_FROM_ALL pppoe.cpp)
ADD_EXECUTABLE(RadioTapTest EXCLUDE_FROM_ALL radiotap.cpp)
ADD_EXECUTABLE(RC4EAPOLTest EXCLUDE_FROM_ALL rc4eapol.cpp)
ADD_EXECUTABLE(RSNEAPOLTest EXCLUDE_FROM_ALL rsn_eapol.cpp)
ADD_EXECUTABLE(SLLTest EXCLUDE_FROM_ALL sll.cpp)
ADD_EXECUTABLE(SNAPTest EXCLUDE_FROM_ALL snap.cpp)
ADD_EXECUTABLE(STPTest EXCLUDE_FROM_ALL stp.cpp)
ADD_EXECUTABLE(TCPTest EXCLUDE_FROM_ALL tcp.cpp)
ADD_EXECUTABLE(TCPStreamTest EXCLUDE_FROM_ALL tcp_stream.cpp)
ADD_EXECUTABLE(UDPTest EXCLUDE_FROM_ALL udp.cpp)
ADD_EXECUTABLE(UtilsTest EXCLUDE_FROM_ALL utils.cpp)
ADD_EXECUTABLE(WEPDecryptTest EXCLUDE_FROM_ALL wep_decrypt.cpp)
ADD_EXECUTABLE(WPA2DecryptTest EXCLUDE_FROM_ALL wpa2_decrypt.cpp)
# Dot11 tests executables
ADD_EXECUTABLE(Dot11AckTest EXCLUDE_FROM_ALL dot11/ack.cpp)
ADD_EXECUTABLE(Dot11AssocRequestTest EXCLUDE_FROM_ALL dot11/assoc_request.cpp)
ADD_EXECUTABLE(Dot11AssocResponseTest EXCLUDE_FROM_ALL dot11/assoc_response.cpp)
ADD_EXECUTABLE(Dot11AuthenticationTest EXCLUDE_FROM_ALL dot11/authentication.cpp)
ADD_EXECUTABLE(Dot11BeaconTest EXCLUDE_FROM_ALL dot11/beacon.cpp)
ADD_EXECUTABLE(Dot11BlockAckRequestTest EXCLUDE_FROM_ALL dot11/block_ack_request.cpp)
ADD_EXECUTABLE(Dot11CFEndTest EXCLUDE_FROM_ALL dot11/cfend.cpp)
ADD_EXECUTABLE(Dot11CFEndACKTest EXCLUDE_FROM_ALL dot11/cfendack.cpp)
ADD_EXECUTABLE(Dot11DataTest EXCLUDE_FROM_ALL dot11/data.cpp)
ADD_EXECUTABLE(Dot11DeauthenticationTest EXCLUDE_FROM_ALL dot11/deauthentication.cpp)
ADD_EXECUTABLE(Dot11DisassocTest EXCLUDE_FROM_ALL dot11/disassoc.cpp)
ADD_EXECUTABLE(Dot11Test EXCLUDE_FROM_ALL dot11/dot11.cpp)
ADD_EXECUTABLE(Dot11ProbeRequestTest EXCLUDE_FROM_ALL dot11/probe_request.cpp)
ADD_EXECUTABLE(Dot11ProbeResponseTest EXCLUDE_FROM_ALL dot11/probe_response.cpp)
ADD_EXECUTABLE(Dot11PSPollTest EXCLUDE_FROM_ALL dot11/pspoll.cpp)
ADD_EXECUTABLE(Dot11ReassocRequestTest EXCLUDE_FROM_ALL dot11/reassoc_request.cpp)
ADD_EXECUTABLE(Dot11ReassocResponseTest EXCLUDE_FROM_ALL dot11/reassoc_response.cpp)
ADD_EXECUTABLE(Dot11RTSTest EXCLUDE_FROM_ALL dot11/rts.cpp)
# Tests
ADD_TEST(AddressRange AddressRangeTest)
ADD_TEST(Allocators AllocatorsTest)
ADD_TEST(Arp ArpTest)
ADD_TEST(DHCP DHCPTest)
ADD_TEST(DHCPv6 DHCPv6Test)
ADD_TEST(DNS DNSTest)
ADD_TEST(Dot11Ack Dot11AckTest)
ADD_TEST(Dot11AssocRequest Dot11AssocRequestTest)
ADD_TEST(Dot11AssocResponse Dot11AssocResponseTest)
ADD_TEST(Dot11Authentication Dot11AuthenticationTest)
ADD_TEST(Dot11Beacon Dot11BeaconTest)
ADD_TEST(Dot11BlockAckRequest Dot11BlockAckRequestTest)
ADD_TEST(Dot11CFEnd Dot11CFEndTest)
ADD_TEST(Dot11CFEndACK Dot11CFEndACKTest)
ADD_TEST(Dot11Data Dot11DataTest)
ADD_TEST(Dot11Deauthentication Dot11DeauthenticationTest)
ADD_TEST(Dot11Disassoc Dot11DisassocTest)
ADD_TEST(Dot11 Dot11Test)
ADD_TEST(Dot11ProbeRequest Dot11ProbeRequestTest)
ADD_TEST(Dot11ProbeResponse Dot11ProbeResponseTest)
ADD_TEST(Dot11PSPoll Dot11PSPollTest)
ADD_TEST(Dot11ReassocRequest Dot11ReassocRequestTest)
ADD_TEST(Dot11ReassocResponse Dot11ReassocResponseTest)
ADD_TEST(Dot11RTS Dot11RTSTest)
ADD_TEST(Dot1Q Dot1QTest)
ADD_TEST(Ethernet EthernetTest)
ADD_TEST(HWAddress HWAddressTest)
ADD_TEST(ICMP ICMPTest)
ADD_TEST(ICMPv6 ICMPv6Test)
ADD_TEST(IP IPTest)
ADD_TEST(IPReassembler IPReassemblerTest)
ADD_TEST(IPAddress IPAddressTest)
ADD_TEST(IPSec IPSecTest)
ADD_TEST(IPv6 IPv6Test)
ADD_TEST(IPv6Address IPv6AddressTest)
ADD_TEST(LLC LLCTest)
ADD_TEST(MatchesResponse MatchesResponseTest)
ADD_TEST(NetworkInterface NetworkInterfaceTest)
ADD_TEST(PDU PDUTest)
ADD_TEST(PPI PPITest)
ADD_TEST(PPPoE PPPoETest)
ADD_TEST(RadioTap RadioTapTest)
ADD_TEST(RC4EAPOL RC4EAPOLTest)
ADD_TEST(RSNEAPOL RSNEAPOLTest)
ADD_TEST(SLL SLLTest)
ADD_TEST(SNAP SNAPTest)
ADD_TEST(STP STPTest)
ADD_TEST(TCP TCPTest)
ADD_TEST(TCPStream TCPStreamTest)
ADD_TEST(UDP UDPTest)
ADD_TEST(Utils UtilsTest)
ADD_TEST(WEPDecrypt WEPDecryptTest)
ADD_TEST(WPA2Decrypt WPA2DecryptTest)