1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-27 20:24:26 +01:00

53 Commits
v2.0 ... v3.0

Author SHA1 Message Date
Matias Fontanini
5d8f3e6741 Updated README and CHANGES files. 2014-08-07 21:39:54 -03:00
Matias Fontanini
5d0ba22ac4 Fixed invalid parsing of unknown DNS records. 2014-08-07 21:22:31 -03:00
Matias Fontanini
8a44b29d92 Protocols now always set the next layer protocol flag. 2014-08-07 20:42:17 -03:00
Matias Fontanini
1b47623484 Timestamps can now be constructed from std::chrono::duration. 2014-08-07 20:12:19 -03:00
Matias Fontanini
282cd0913c Added Packet constructor. 2014-08-07 19:58:41 -03:00
Matias Fontanini
aed5ccdfca Updated configure files. 2014-08-07 19:56:29 -03:00
Matias Fontanini
8e6ddfd764 Fixed bug in EthernetII when changing its inner PDU. 2014-08-07 19:38:05 -03:00
Matias Fontanini
1c2bfd42ca Fixed invalid address passed to memcpy. 2014-08-07 19:37:06 -03:00
Matias Fontanini
b9db3ea1d3 Merge pull request #22 from mantiz/fix-armv5-alignment-issues
fix armv5 alignment issues
2014-07-31 13:47:17 -03:00
Christian Hammerl
52b0ee7ceb fix armv5 alignment issues 2014-07-31 15:49:52 +00:00
Matias Fontanini
3ef85aae38 Added BaseSniffer::set_extract_raw_pdus. 2014-07-30 23:01:03 -03:00
Matias Fontanini
3bb310dd6b Updated autotools files. 2014-07-30 22:59:14 -03:00
Matias Fontanini
a918229d4b Merge pull request #21 from jedahan/master
minimum automake version from 1.13 -> 1.11
2014-07-30 22:52:08 -03:00
Jonathan Dahan
95a9d18b6b minimum automake version from 1.13 -> 1.11 2014-07-30 11:44:24 -04:00
Matias Fontanini
7371b95ebc Merge pull request #19 from kylemcdonald/master
added Utils::to_string(PDU::PDUType). closes #12.
2014-07-29 08:57:44 -03:00
Kyle McDonald
416edc34f7 added Utils::to_string(PDU::PDUType). closes #12. 2014-07-27 00:24:16 -04:00
Matias Fontanini
2dff95700f Updated copyright notice. 2014-07-13 11:04:29 -03:00
Matias Fontanini
46b52ad26e Updated example. 2014-07-13 10:59:00 -03:00
Matias Fontanini
22e7c1d7c4 Fixed error compilations on windows. 2014-07-02 19:02:48 -03:00
Matias Fontanini
dd2ed5daa4 Added undef directive to avoid compilation error on windows. 2014-07-01 17:06:39 -03:00
Matias Fontanini
c25d4738b4 Added check for HAVE_DOT11 macro in RSNInformation header/source files. 2014-06-09 22:50:49 -03:00
Matias Fontanini
3d4f509a62 Added call to pcap_can_set_rfmon before calling pcap_set_rfmon. 2014-06-09 10:24:09 -03:00
Matias Fontanini
c9e955903e Fixed ICMPv6 checksum calculation. 2014-06-09 10:09:20 -03:00
Matias Fontanini
201ea885a1 Added method in TCP and IP that emplaces an option. 2014-06-01 12:55:36 -03:00
Matias Fontanini
356ea2a68a Added small option optimization to PDUOption. 2014-05-29 23:15:44 -03:00
Matias Fontanini
559c963d63 Fixed compilation errors on Windows. 2014-05-06 00:13:05 -03:00
Matias Fontanini
4bf5876adf Fixed compilation error in RSNInformation. 2014-05-05 08:34:16 -03:00
Matias Fontanini
b2788fad63 Simplified error string generation on Sniffer::pcap_open_live_extended. 2014-05-05 08:32:45 -03:00
Matias Fontanini
c249ff608c Merge pull request #11 from kylemcdonald/master
changed ICMP::check to ICMP::checksum
2014-05-03 18:52:29 -03:00
Kyle McDonald
bd55307b47 changed ICMP::check to ICMP::checksum for both the public getter and private setter. closes #10 2014-05-03 17:43:35 -04:00
Matias Fontanini
6b17dc78e5 Merge pull request #9 from kylemcdonald/master
Allow Sniffer to enable monitor mode on interface
2014-05-03 14:32:27 -03:00
Kyle McDonald
5fe4ab0de8 added pcap_open_live_extended() shim to sniffer.cpp and set rfmon to true in beacon capture example 2014-05-03 12:48:35 -04:00
Matias Fontanini
4ee89662f2 Fix bug on TCPStreamFollower. 2014-04-12 11:53:00 -03:00
Matias Fontanini
86e3f138f8 Added correct handling of the PDU::IPv6 flag in Internals::pdu_flag_to_ip_type. 2014-04-07 13:29:14 -03:00
Matias Fontanini
cd2b9aab98 TCPStreamFollower now doesn't clear its state each time follow_streams is called. 2014-04-07 11:29:09 -03:00
Matias Fontanini
f05840b9e9 Merge pull request #5 from lodagro/patch-1
Fix typo in test name
2014-04-03 13:38:43 -03:00
Wouter Overmeire
8c2abf9249 Fix typo in test name 2014-04-03 15:39:26 +02:00
Matias Fontanini
64d35b4903 TCPStreamFollower now handles overlapping fragments. 2014-04-02 11:10:44 -03:00
Matias Fontanini
10421fe945 Added DHCP::hostname. 2014-04-01 10:22:05 -03:00
Matias Fontanini
7c8aefccfe Merge pull request #4 from jacob-baines/patch-1
Remove Extra Qualification
2014-03-12 14:40:46 -02:00
Jacob Baines
60404296fb Remove Extra Qualification
The extra "SessionKeys::" prevents compilation on Windows.
2014-03-12 12:19:29 -04:00
Matias Fontanini
dbc3ab4c32 Updated the LICENSE file. 2014-03-05 18:23:16 -03:00
Matias Fontanini
f83521f778 Merge pull request #3 from JeanJoskin/master
PacketSender::send does not work properly
2014-02-27 11:25:54 -02:00
Jean Joskin
6fb8cbfc86 PacketSender::send matched PDU against most specific type, hence the PDU::DOT11 case would never be chosen. 2014-02-27 13:34:14 +01:00
Matias Fontanini
0acf388277 Removed 'no newline at end of file' warnings. 2014-02-10 18:21:46 -03:00
Matias F
4c4a5f6c03 Fixed bug when calling BIOCIMMEDIATE on *BSD. 2014-02-10 12:33:48 -03:00
Matias Fontanini
fbef2e765d Fixed bug on PacketSender::send_recv which didn't work under OSX and FreeBSD. 2014-02-06 15:10:23 -03:00
Matias F
ea927caa4b Added BSD notice to DNS stats example. 2014-02-03 10:57:30 -03:00
Matias F
60f9116af1 Added DNS stats example. 2014-02-03 10:55:37 -03:00
Matias Fontanini
75c6bb46dc Fixed compilation error in OSX caused by including pcap/bpf.h instead of pcap.h in src/ppi.cpp. 2014-01-25 18:45:55 -03:00
Matias Fontanini
0a2f3b477b Merge pull request #2 from itay-grudev/master
Fixed bug - not included std::string
2014-01-25 13:00:07 -08:00
Itay Grudev
e73ea43f7b Fixed bug - not included std::string
Error details:
implicit instantiation of undefined template std::basic_string
2014-01-25 22:55:59 +02:00
Matias F
17933765d3 dns_spoof example now uses DNS::Resource. 2014-01-24 09:54:03 -03:00
136 changed files with 2419 additions and 1033 deletions

63
CHANGES
View File

@@ -1,3 +1,66 @@
v3.0 - Thu Aug 7 21:39:09 ART 2014
- Timestamps can now be constructed from std::chrono::duration.
- Packets can now be constructed from a PDU pointer and take ownership
of it.
- All protocols now set the next layer protocol flag, regardless if
it was already set. This was not done in some protocols,
like EthernetII, and as a consequence if the network layer protocol
was replaced by other, the packet would be serialized incorrectly.
- Fixed invalid parsing of some unknown DNS records.
- Fixed unaligned memory accesses that were not supported under
ARMv4 and ARMv5.
- Added BaseSniffer::set_extract_raw_pdus.
- Reduced minimum automake version to 1.11.
- Added Utils::to_string(PDU::PDUType).
- Fixed error compilations on Windows.
- Fixed ICMPv6 checksum calculation.
- Added method in IP and TCP to emplace an option (C++11 only).
- Added small option optimization to PDUOption.
- Fixed error compilation on RSNInformation.
- Renamed ICMP::check to ICMP::checksum.
- Added Sniffer support to set interface to promiscuous mode.
- TCPStreamFollower now handles overlapping fragments correctly.
- Fixed bugs in TCPStreamFollower which didn't allow it to follow
stream correctly.
- TCPStreamFollower now doesn't clear its state after every call to
TCPStreamFollower::follow_streams.
- Added IPv6 flag check to pdu_flag_to_ip_type.
- Added DHCP::hostname to extract the hostname options.
- Removed extra qualifier on SessionKeys::decrypt_unicast which
produced compilation errors on some platforms.
- PacketSender::send now uses PDU::matches_flag to match specific
PDU types.
- Removed 'no newline at end of file' warnings.
- Fixed bug when calling BIOCIMMEDIATE on *BSD.
- Fixed bug on PacketSender::send_recv which didn't work under *BSD.
- Fixed bug triggered by not including the string header.
v2.0 - Thu Jan 23 11:09:38 ART 2014 v2.0 - Thu Jan 23 11:09:38 ART 2014
- DNSResourceRecord was removed. Now DNS records are added using - DNSResourceRecord was removed. Now DNS records are added using

View File

@@ -1,4 +1,4 @@
Copyright (c) 2012, Nasel Copyright (c) 2012-2014, Matias Fontanini
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without

View File

@@ -1,4 +1,4 @@
AUTOMAKE_OPTIONS=subdir-objects AUTOMAKE_OPTIONS=subdir-objects 1.11
ACLOCAL_AMFLAGS=${ACLOCAL_FLAGS} -I m4 ACLOCAL_AMFLAGS=${ACLOCAL_FLAGS} -I m4
# pkg-config stuff # pkg-config stuff

View File

@@ -1,9 +1,8 @@
# Makefile.in generated by automake 1.11.6 from Makefile.am. # Makefile.in generated by automake 1.14.1 from Makefile.am.
# @configure_input@ # @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # Copyright (C) 1994-2013 Free Software Foundation, Inc.
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation # This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
@@ -18,23 +17,51 @@
VPATH = @srcdir@ VPATH = @srcdir@
am__make_dryrun = \ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
{ \ am__make_running_with_option = \
am__dry=no; \ case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \ case $$MAKEFLAGS in \
*\\[\ \ ]*) \ *\\[\ \ ]*) \
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ bs=\\; \
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
*) \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
for am__flg in $$MAKEFLAGS; do \
case $$am__flg in \
*=*|--*) ;; \
*n*) am__dry=yes; break;; \
esac; \
done;; \
esac; \ esac; \
test $$am__dry = yes; \ fi; \
} skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@ pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@
@@ -55,12 +82,12 @@ build_triplet = @build@
host_triplet = @host@ host_triplet = @host@
target_triplet = @target@ target_triplet = @target@
subdir = . subdir = .
DIST_COMMON = README $(am__configure_deps) $(libtins_HEADERS) \ DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(libtins_dot11_HEADERS) $(srcdir)/Makefile.am \ $(top_srcdir)/configure $(am__configure_deps) \
$(srcdir)/Makefile.in $(srcdir)/libtins.pc.in \ $(top_srcdir)/include/config.h.in $(srcdir)/libtins.pc.in \
$(top_srcdir)/configure $(top_srcdir)/include/config.h.in \ depcomp $(libtins_HEADERS) $(libtins_dot11_HEADERS) AUTHORS \
AUTHORS THANKS config.guess config.sub depcomp install-sh \ README THANKS compile config.guess config.sub install-sh \
ltmain.sh missing missing ltmain.sh
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
@@ -122,22 +149,47 @@ am_libtins_la_OBJECTS = src/arp.lo src/bootp.lo \
src/dot11/dot11_assoc.lo src/dot11/dot11_auth.lo \ src/dot11/dot11_assoc.lo src/dot11/dot11_auth.lo \
src/dot11/dot11_probe.lo src/dot11/dot11_control.lo src/dot11/dot11_probe.lo src/dot11/dot11_control.lo
libtins_la_OBJECTS = $(am_libtins_la_OBJECTS) libtins_la_OBJECTS = $(am_libtins_la_OBJECTS)
libtins_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
am__v_lt_1 =
libtins_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(libtins_la_LDFLAGS) $(LDFLAGS) -o $@ $(CXXFLAGS) $(libtins_la_LDFLAGS) $(LDFLAGS) -o $@
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include
depcomp = $(SHELL) $(top_srcdir)/depcomp depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles am__depfiles_maybe = depfiles
am__mv = mv -f am__mv = mv -f
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
--mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CXXFLAGS) $(CXXFLAGS)
AM_V_CXX = $(am__v_CXX_@AM_V@)
am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
am__v_CXX_0 = @echo " CXX " $@;
am__v_CXX_1 =
CXXLD = $(CXX) CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(LDFLAGS) -o $@ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
am__v_CXXLD_0 = @echo " CXXLD " $@;
am__v_CXXLD_1 =
SOURCES = $(libtins_la_SOURCES) SOURCES = $(libtins_la_SOURCES)
DIST_SOURCES = $(libtins_la_SOURCES) DIST_SOURCES = $(libtins_la_SOURCES)
am__can_run_installinfo = \ am__can_run_installinfo = \
@@ -147,8 +199,27 @@ am__can_run_installinfo = \
esac esac
DATA = $(pkgconfig_DATA) DATA = $(pkgconfig_DATA)
HEADERS = $(libtins_HEADERS) $(libtins_dot11_HEADERS) HEADERS = $(libtins_HEADERS) $(libtins_dot11_HEADERS)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
ETAGS = etags ETAGS = etags
CTAGS = ctags CTAGS = ctags
CSCOPE = cscope
AM_RECURSIVE_TARGETS = cscope
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION) distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir) top_distdir = $(distdir)
@@ -158,14 +229,17 @@ am__remove_distdir = \
&& rm -rf "$(distdir)" \ && rm -rf "$(distdir)" \
|| { sleep 5 && rm -rf "$(distdir)"; }; \ || { sleep 5 && rm -rf "$(distdir)"; }; \
else :; fi else :; fi
am__post_remove_distdir = $(am__remove_distdir)
DIST_ARCHIVES = $(distdir).tar.gz DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best GZIP_ENV = --best
DIST_TARGETS = dist-gzip
distuninstallcheck_listfiles = find . -type f -print distuninstallcheck_listfiles = find . -type f -print
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
distcleancheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@ ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@ AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@ AR = @AR@
AUTOCONF = @AUTOCONF@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@ AUTOHEADER = @AUTOHEADER@
@@ -290,7 +364,7 @@ target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@ top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = subdir-objects AUTOMAKE_OPTIONS = subdir-objects 1.11
ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} -I m4 ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} -I m4
# pkg-config stuff # pkg-config stuff
@@ -456,8 +530,8 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
$(am__aclocal_m4_deps): $(am__aclocal_m4_deps):
include/config.h: include/stamp-h1 include/config.h: include/stamp-h1
@if test ! -f $@; then rm -f include/stamp-h1; else :; fi @test -f $@ || rm -f include/stamp-h1
@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) include/stamp-h1; else :; fi @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) include/stamp-h1
include/stamp-h1: $(top_srcdir)/include/config.h.in $(top_builddir)/config.status include/stamp-h1: $(top_srcdir)/include/config.h.in $(top_builddir)/config.status
@rm -f include/stamp-h1 @rm -f include/stamp-h1
@@ -471,6 +545,7 @@ distclean-hdr:
-rm -f include/config.h include/stamp-h1 -rm -f include/config.h include/stamp-h1
libtins.pc: $(top_builddir)/config.status $(srcdir)/libtins.pc.in libtins.pc: $(top_builddir)/config.status $(srcdir)/libtins.pc.in
cd $(top_builddir) && $(SHELL) ./config.status $@ cd $(top_builddir) && $(SHELL) ./config.status $@
install-libLTLIBRARIES: $(lib_LTLIBRARIES) install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL) @$(NORMAL_INSTALL)
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
@@ -497,12 +572,14 @@ uninstall-libLTLIBRARIES:
clean-libLTLIBRARIES: clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \ @list='$(lib_LTLIBRARIES)'; \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ locs=`for p in $$list; do echo $$p; done | \
test "$$dir" != "$$p" || dir=.; \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
echo "rm -f \"$${dir}/so_locations\""; \ sort -u`; \
rm -f "$${dir}/so_locations"; \ test -z "$$locs" || { \
done echo rm -f $${locs}; \
rm -f $${locs}; \
}
src/$(am__dirstamp): src/$(am__dirstamp):
@$(MKDIR_P) src @$(MKDIR_P) src
@: > src/$(am__dirstamp) @: > src/$(am__dirstamp)
@@ -578,107 +655,16 @@ src/dot11/dot11_probe.lo: src/dot11/$(am__dirstamp) \
src/dot11/$(DEPDIR)/$(am__dirstamp) src/dot11/$(DEPDIR)/$(am__dirstamp)
src/dot11/dot11_control.lo: src/dot11/$(am__dirstamp) \ src/dot11/dot11_control.lo: src/dot11/$(am__dirstamp) \
src/dot11/$(DEPDIR)/$(am__dirstamp) src/dot11/$(DEPDIR)/$(am__dirstamp)
libtins.la: $(libtins_la_OBJECTS) $(libtins_la_DEPENDENCIES) $(EXTRA_libtins_la_DEPENDENCIES) libtins.la: $(libtins_la_OBJECTS) $(libtins_la_DEPENDENCIES) $(EXTRA_libtins_la_DEPENDENCIES)
$(libtins_la_LINK) -rpath $(libdir) $(libtins_la_OBJECTS) $(libtins_la_LIBADD) $(LIBS) $(AM_V_CXXLD)$(libtins_la_LINK) -rpath $(libdir) $(libtins_la_OBJECTS) $(libtins_la_LIBADD) $(LIBS)
mostlyclean-compile: mostlyclean-compile:
-rm -f *.$(OBJEXT) -rm -f *.$(OBJEXT)
-rm -f src/address_range.$(OBJEXT) -rm -f src/*.$(OBJEXT)
-rm -f src/address_range.lo -rm -f src/*.lo
-rm -f src/arp.$(OBJEXT) -rm -f src/dot11/*.$(OBJEXT)
-rm -f src/arp.lo -rm -f src/dot11/*.lo
-rm -f src/bootp.$(OBJEXT)
-rm -f src/bootp.lo
-rm -f src/crypto.$(OBJEXT)
-rm -f src/crypto.lo
-rm -f src/dhcp.$(OBJEXT)
-rm -f src/dhcp.lo
-rm -f src/dhcpv6.$(OBJEXT)
-rm -f src/dhcpv6.lo
-rm -f src/dns.$(OBJEXT)
-rm -f src/dns.lo
-rm -f src/dot11/dot11_assoc.$(OBJEXT)
-rm -f src/dot11/dot11_assoc.lo
-rm -f src/dot11/dot11_auth.$(OBJEXT)
-rm -f src/dot11/dot11_auth.lo
-rm -f src/dot11/dot11_base.$(OBJEXT)
-rm -f src/dot11/dot11_base.lo
-rm -f src/dot11/dot11_beacon.$(OBJEXT)
-rm -f src/dot11/dot11_beacon.lo
-rm -f src/dot11/dot11_control.$(OBJEXT)
-rm -f src/dot11/dot11_control.lo
-rm -f src/dot11/dot11_data.$(OBJEXT)
-rm -f src/dot11/dot11_data.lo
-rm -f src/dot11/dot11_mgmt.$(OBJEXT)
-rm -f src/dot11/dot11_mgmt.lo
-rm -f src/dot11/dot11_probe.$(OBJEXT)
-rm -f src/dot11/dot11_probe.lo
-rm -f src/dot1q.$(OBJEXT)
-rm -f src/dot1q.lo
-rm -f src/dot3.$(OBJEXT)
-rm -f src/dot3.lo
-rm -f src/eapol.$(OBJEXT)
-rm -f src/eapol.lo
-rm -f src/ethernetII.$(OBJEXT)
-rm -f src/ethernetII.lo
-rm -f src/handshake_capturer.$(OBJEXT)
-rm -f src/handshake_capturer.lo
-rm -f src/icmp.$(OBJEXT)
-rm -f src/icmp.lo
-rm -f src/icmpv6.$(OBJEXT)
-rm -f src/icmpv6.lo
-rm -f src/internals.$(OBJEXT)
-rm -f src/internals.lo
-rm -f src/ip.$(OBJEXT)
-rm -f src/ip.lo
-rm -f src/ip_address.$(OBJEXT)
-rm -f src/ip_address.lo
-rm -f src/ip_reassembler.$(OBJEXT)
-rm -f src/ip_reassembler.lo
-rm -f src/ipsec.$(OBJEXT)
-rm -f src/ipsec.lo
-rm -f src/ipv6.$(OBJEXT)
-rm -f src/ipv6.lo
-rm -f src/ipv6_address.$(OBJEXT)
-rm -f src/ipv6_address.lo
-rm -f src/llc.$(OBJEXT)
-rm -f src/llc.lo
-rm -f src/loopback.$(OBJEXT)
-rm -f src/loopback.lo
-rm -f src/network_interface.$(OBJEXT)
-rm -f src/network_interface.lo
-rm -f src/packet_sender.$(OBJEXT)
-rm -f src/packet_sender.lo
-rm -f src/packet_writer.$(OBJEXT)
-rm -f src/packet_writer.lo
-rm -f src/pdu.$(OBJEXT)
-rm -f src/pdu.lo
-rm -f src/ppi.$(OBJEXT)
-rm -f src/ppi.lo
-rm -f src/pppoe.$(OBJEXT)
-rm -f src/pppoe.lo
-rm -f src/radiotap.$(OBJEXT)
-rm -f src/radiotap.lo
-rm -f src/rawpdu.$(OBJEXT)
-rm -f src/rawpdu.lo
-rm -f src/rsn_information.$(OBJEXT)
-rm -f src/rsn_information.lo
-rm -f src/sll.$(OBJEXT)
-rm -f src/sll.lo
-rm -f src/snap.$(OBJEXT)
-rm -f src/snap.lo
-rm -f src/sniffer.$(OBJEXT)
-rm -f src/sniffer.lo
-rm -f src/stp.$(OBJEXT)
-rm -f src/stp.lo
-rm -f src/tcp.$(OBJEXT)
-rm -f src/tcp.lo
-rm -f src/tcp_stream.$(OBJEXT)
-rm -f src/tcp_stream.lo
-rm -f src/udp.$(OBJEXT)
-rm -f src/udp.lo
-rm -f src/utils.$(OBJEXT)
-rm -f src/utils.lo
distclean-compile: distclean-compile:
-rm -f *.tab.c -rm -f *.tab.c
@@ -733,28 +719,28 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@src/dot11/$(DEPDIR)/dot11_probe.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/dot11/$(DEPDIR)/dot11_probe.Plo@am__quote@
.cpp.o: .cpp.o:
@am__fastdepCXX_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $<
.cpp.obj: .cpp.obj:
@am__fastdepCXX_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.cpp.lo: .cpp.lo:
@am__fastdepCXX_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
mostlyclean-libtool: mostlyclean-libtool:
-rm -f *.lo -rm -f *.lo
@@ -830,26 +816,15 @@ uninstall-libtins_dot11HEADERS:
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(libtins_dot11dir)'; $(am__uninstall_files_from_dir) dir='$(DESTDIR)$(libtins_dot11dir)'; $(am__uninstall_files_from_dir)
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) ID: $(am__tagged_files)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ $(am__define_uniq_tagged_files); mkid -fID $$unique
unique=`for i in $$list; do \ tags: tags-am
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ TAGS: tags
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(TAGS_FILES) $(LISP)
set x; \ set x; \
here=`pwd`; \ here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ $(am__define_uniq_tagged_files); \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \ shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \ test -n "$$unique" || unique=$$empty_fix; \
@@ -861,15 +836,11 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$$unique; \ $$unique; \
fi; \ fi; \
fi fi
ctags: CTAGS ctags: ctags-am
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP) CTAGS: ctags
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
unique=`for i in $$list; do \ $(am__define_uniq_tagged_files); \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \ test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique $$unique
@@ -878,9 +849,31 @@ GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \ here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \ && $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here" && gtags -i $(GTAGS_ARGS) "$$here"
cscope: cscope.files
test ! -s cscope.files \
|| $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
clean-cscope:
-rm -f cscope.files
cscope.files: clean-cscope cscopelist
cscopelist: cscopelist-am
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags: distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
distdir: $(DISTFILES) distdir: $(DISTFILES)
$(am__remove_distdir) $(am__remove_distdir)
@@ -923,40 +916,42 @@ distdir: $(DISTFILES)
|| chmod -R a+r "$(distdir)" || chmod -R a+r "$(distdir)"
dist-gzip: distdir dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir) $(am__post_remove_distdir)
dist-bzip2: distdir dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
$(am__remove_distdir) $(am__post_remove_distdir)
dist-lzip: distdir dist-lzip: distdir
tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
$(am__remove_distdir) $(am__post_remove_distdir)
dist-lzma: distdir
tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
$(am__remove_distdir)
dist-xz: distdir dist-xz: distdir
tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
$(am__remove_distdir) $(am__post_remove_distdir)
dist-tarZ: distdir dist-tarZ: distdir
@echo WARNING: "Support for shar distribution archives is" \
"deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__remove_distdir) $(am__post_remove_distdir)
dist-shar: distdir dist-shar: distdir
@echo WARNING: "Support for distribution archives compressed with" \
"legacy program 'compress' is deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__remove_distdir) $(am__post_remove_distdir)
dist-zip: distdir dist-zip: distdir
-rm -f $(distdir).zip -rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir) zip -rq $(distdir).zip $(distdir)
$(am__remove_distdir) $(am__post_remove_distdir)
dist dist-all: distdir dist dist-all:
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
$(am__remove_distdir) $(am__post_remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then # This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another # it guarantees that the distribution is self-contained by making another
@@ -967,8 +962,6 @@ distcheck: dist
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \ *.tar.bz2*) \
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lzma*) \
lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
*.tar.lz*) \ *.tar.lz*) \
lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
*.tar.xz*) \ *.tar.xz*) \
@@ -980,18 +973,19 @@ distcheck: dist
*.zip*) \ *.zip*) \
unzip $(distdir).zip ;;\ unzip $(distdir).zip ;;\
esac esac
chmod -R a-w $(distdir); chmod u+w $(distdir) chmod -R a-w $(distdir)
mkdir $(distdir)/_build chmod u+w $(distdir)
mkdir $(distdir)/_inst mkdir $(distdir)/_build $(distdir)/_inst
chmod a-w $(distdir) chmod a-w $(distdir)
test -d $(distdir)/_build || exit 0; \ test -d $(distdir)/_build || exit 0; \
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& am__cwd=`pwd` \ && am__cwd=`pwd` \
&& $(am__cd) $(distdir)/_build \ && $(am__cd) $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \ && ../configure \
$(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \
$(DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \
--srcdir=.. --prefix="$$dc_install_base" \
&& $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) check \
@@ -1014,7 +1008,7 @@ distcheck: dist
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
&& cd "$$am__cwd" \ && cd "$$am__cwd" \
|| exit 1 || exit 1
$(am__remove_distdir) $(am__post_remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \ @(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
@@ -1163,23 +1157,23 @@ uninstall-am: uninstall-libLTLIBRARIES uninstall-libtinsHEADERS \
.MAKE: install-am install-strip .MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \ .PHONY: CTAGS GTAGS TAGS all all-am am--refresh check check-am clean \
clean-generic clean-libLTLIBRARIES clean-libtool ctags dist \ clean-cscope clean-generic clean-libLTLIBRARIES clean-libtool \
dist-all dist-bzip2 dist-gzip dist-lzip dist-lzma dist-shar \ cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \
dist-tarZ dist-xz dist-zip distcheck distclean \ dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \
distclean-compile distclean-generic distclean-hdr \ distcheck distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distcleancheck distdir \ distclean-hdr distclean-libtool distclean-tags distcleancheck \
distuninstallcheck dvi dvi-am html html-am info info-am \ distdir distuninstallcheck dvi dvi-am html html-am info \
install install-am install-data install-data-am install-dvi \ info-am install install-am install-data install-data-am \
install-dvi-am install-exec install-exec-am install-html \ install-dvi install-dvi-am install-exec install-exec-am \
install-html-am install-info install-info-am \ install-html install-html-am install-info install-info-am \
install-libLTLIBRARIES install-libtinsHEADERS \ install-libLTLIBRARIES install-libtinsHEADERS \
install-libtins_dot11HEADERS install-man install-pdf \ install-libtins_dot11HEADERS install-man install-pdf \
install-pdf-am install-pkgconfigDATA install-ps install-ps-am \ install-pdf-am install-pkgconfigDATA install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \ install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \ maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
pdf pdf-am ps ps-am tags uninstall uninstall-am \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \
uninstall-libLTLIBRARIES uninstall-libtinsHEADERS \ uninstall-libLTLIBRARIES uninstall-libtinsHEADERS \
uninstall-libtins_dot11HEADERS uninstall-pkgconfigDATA uninstall-libtins_dot11HEADERS uninstall-pkgconfigDATA

2
README
View File

@@ -1,5 +1,5 @@
------------------------------------------------------------------------ ------------------------------------------------------------------------
libtins v2.0 libtins v3.0
------------------------------------------------------------------------ ------------------------------------------------------------------------

700
aclocal.m4 vendored

File diff suppressed because it is too large Load Diff

333
configure vendored
View File

@@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for libtins 2.0. # Generated by GNU Autoconf 2.69 for libtins 3.0.
# #
# Report bugs to <matias.fontanini@gmail.com>. # Report bugs to <matias.fontanini@gmail.com>.
# #
@@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package. # Identity of this package.
PACKAGE_NAME='libtins' PACKAGE_NAME='libtins'
PACKAGE_TARNAME='libtins' PACKAGE_TARNAME='libtins'
PACKAGE_VERSION='2.0' PACKAGE_VERSION='3.0'
PACKAGE_STRING='libtins 2.0' PACKAGE_STRING='libtins 3.0'
PACKAGE_BUGREPORT='matias.fontanini@gmail.com' PACKAGE_BUGREPORT='matias.fontanini@gmail.com'
PACKAGE_URL='http://libtins.sourceforge.net' PACKAGE_URL='http://libtins.sourceforge.net'
@@ -687,6 +687,10 @@ LDFLAGS
CFLAGS CFLAGS
CC CC
LIBTOOL LIBTOOL
AM_BACKSLASH
AM_DEFAULT_VERBOSITY
AM_DEFAULT_V
AM_V
am__untar am__untar
am__tar am__tar
AMTAR AMTAR
@@ -763,6 +767,7 @@ SHELL'
ac_subst_files='' ac_subst_files=''
ac_user_opts=' ac_user_opts='
enable_option_checking enable_option_checking
enable_silent_rules
enable_static enable_static
enable_shared enable_shared
with_pic with_pic
@@ -1331,7 +1336,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing. # Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh. # This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF cat <<_ACEOF
\`configure' configures libtins 2.0 to adapt to many kinds of systems. \`configure' configures libtins 3.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]... Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1402,7 +1407,7 @@ fi
if test -n "$ac_init_help"; then if test -n "$ac_init_help"; then
case $ac_init_help in case $ac_init_help in
short | recursive ) echo "Configuration of libtins 2.0:";; short | recursive ) echo "Configuration of libtins 3.0:";;
esac esac
cat <<\_ACEOF cat <<\_ACEOF
@@ -1410,15 +1415,20 @@ Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options --disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-silent-rules less verbose build output (undo: "make V=1")
--disable-silent-rules verbose build output (undo: "make V=0")
--enable-static[=PKGS] build static libraries [default=no] --enable-static[=PKGS] build static libraries [default=no]
--enable-shared[=PKGS] build shared libraries [default=yes] --enable-shared[=PKGS] build shared libraries [default=yes]
--enable-fast-install[=PKGS] --enable-fast-install[=PKGS]
optimize for fast installation [default=yes] optimize for fast installation [default=yes]
--disable-dependency-tracking speeds up one-time build --enable-dependency-tracking
--enable-dependency-tracking do not reject slow dependency extractors do not reject slow dependency extractors
--disable-dependency-tracking
speeds up one-time build
--disable-libtool-lock avoid locking (might break parallel builds) --disable-libtool-lock avoid locking (might break parallel builds)
--disable-maintainer-mode disable make rules and dependencies not useful --disable-maintainer-mode
(and sometimes confusing) to the casual installer disable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
--enable-c++11 enable C++11 features --enable-c++11 enable C++11 features
--disable-dot11 disable IEEE 802.11 support --disable-dot11 disable IEEE 802.11 support
--disable-wpa2 disable WPA2 decryption features --disable-wpa2 disable WPA2 decryption features
@@ -1516,7 +1526,7 @@ fi
test -n "$ac_init_help" && exit $ac_status test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then if $ac_init_version; then
cat <<\_ACEOF cat <<\_ACEOF
libtins configure 2.0 libtins configure 3.0
generated by GNU Autoconf 2.69 generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc. Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2006,7 +2016,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake. running configure, to aid debugging if configure makes a mistake.
It was created by libtins $as_me 2.0, which was It was created by libtins $as_me 3.0, which was
generated by GNU Autoconf 2.69. Invocation command line was generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@ $ $0 $@
@@ -2593,9 +2603,6 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
$as_echo_n "checking whether build environment is sane... " >&6; } $as_echo_n "checking whether build environment is sane... " >&6; }
# Just in case
sleep 1
echo timestamp > conftest.file
# Reject unsafe characters in $srcdir or the absolute working directory # Reject unsafe characters in $srcdir or the absolute working directory
# name. Accept space and tab only in the latter. # name. Accept space and tab only in the latter.
am_lf=' am_lf='
@@ -2606,32 +2613,40 @@ case `pwd` in
esac esac
case $srcdir in case $srcdir in
*[\\\"\#\$\&\'\`$am_lf\ \ ]*) *[\\\"\#\$\&\'\`$am_lf\ \ ]*)
as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;;
esac esac
# Do `set' in a subshell so we don't clobber the current shell's # Do 'set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a # arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks # symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing # (eg FreeBSD returns the mod time of the symlink's containing
# directory). # directory).
if ( if (
set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` am_has_slept=no
if test "$*" = "X"; then for am_try in 1 2; do
# -L didn't work. echo "timestamp, slept: $am_has_slept" > conftest.file
set X `ls -t "$srcdir/configure" conftest.file` set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
fi if test "$*" = "X"; then
rm -f conftest.file # -L didn't work.
if test "$*" != "X $srcdir/configure conftest.file" \ set X `ls -t "$srcdir/configure" conftest.file`
&& test "$*" != "X conftest.file $srcdir/configure"; then fi
if test "$*" != "X $srcdir/configure conftest.file" \
# If neither matched, then we have a broken ls. This can happen && test "$*" != "X conftest.file $srcdir/configure"; then
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
as_fn_error $? "ls -t appears to fail. Make sure there is not a broken
alias in your environment" "$LINENO" 5
fi
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
as_fn_error $? "ls -t appears to fail. Make sure there is not a broken
alias in your environment" "$LINENO" 5
fi
if test "$2" = conftest.file || test $am_try -eq 2; then
break
fi
# Just in case.
sleep 1
am_has_slept=yes
done
test "$2" = conftest.file test "$2" = conftest.file
) )
then then
@@ -2643,6 +2658,16 @@ Check your system clock" "$LINENO" 5
fi fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; } $as_echo "yes" >&6; }
# If we didn't sleep, we still need to ensure time stamps of config.status and
# generated files are strictly newer.
am_sleep_pid=
if grep 'slept: no' conftest.file >/dev/null 2>&1; then
( sleep 1 ) &
am_sleep_pid=$!
fi
rm -f conftest.file
test "$program_prefix" != NONE && test "$program_prefix" != NONE &&
program_transform_name="s&^&$program_prefix&;$program_transform_name" program_transform_name="s&^&$program_prefix&;$program_transform_name"
# Use a double $ so make ignores it. # Use a double $ so make ignores it.
@@ -2665,12 +2690,12 @@ if test x"${MISSING+set}" != xset; then
esac esac
fi fi
# Use eval to expand $SHELL # Use eval to expand $SHELL
if eval "$MISSING --run true"; then if eval "$MISSING --is-lightweight"; then
am_missing_run="$MISSING --run " am_missing_run="$MISSING "
else else
am_missing_run= am_missing_run=
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5
$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;}
fi fi
if test x"${install_sh}" != xset; then if test x"${install_sh}" != xset; then
@@ -2682,10 +2707,10 @@ if test x"${install_sh}" != xset; then
esac esac
fi fi
# Installed binaries are usually stripped using `strip' when the user # Installed binaries are usually stripped using 'strip' when the user
# run `make install-strip'. However `strip' might not be the right # run "make install-strip". However 'strip' might not be the right
# tool to use in cross-compilation environments, therefore Automake # tool to use in cross-compilation environments, therefore Automake
# will honor the `STRIP' environment variable to overrule this program. # will honor the 'STRIP' environment variable to overrule this program.
if test "$cross_compiling" != no; then if test "$cross_compiling" != no; then
if test -n "$ac_tool_prefix"; then if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
@@ -2824,12 +2849,6 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
$as_echo "$MKDIR_P" >&6; } $as_echo "$MKDIR_P" >&6; }
mkdir_p="$MKDIR_P"
case $mkdir_p in
[\\/$]* | ?:[\\/]*) ;;
*/*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
esac
for ac_prog in gawk mawk nawk awk for ac_prog in gawk mawk nawk awk
do do
# Extract the first word of "$ac_prog", so it can be a program name with args. # Extract the first word of "$ac_prog", so it can be a program name with args.
@@ -2912,6 +2931,45 @@ else
fi fi
rmdir .tst 2>/dev/null rmdir .tst 2>/dev/null
# Check whether --enable-silent-rules was given.
if test "${enable_silent_rules+set}" = set; then :
enableval=$enable_silent_rules;
fi
case $enable_silent_rules in # (((
yes) AM_DEFAULT_VERBOSITY=0;;
no) AM_DEFAULT_VERBOSITY=1;;
*) AM_DEFAULT_VERBOSITY=1;;
esac
am_make=${MAKE-make}
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5
$as_echo_n "checking whether $am_make supports nested variables... " >&6; }
if ${am_cv_make_support_nested_variables+:} false; then :
$as_echo_n "(cached) " >&6
else
if $as_echo 'TRUE=$(BAR$(V))
BAR0=false
BAR1=true
V=1
am__doit:
@$(TRUE)
.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then
am_cv_make_support_nested_variables=yes
else
am_cv_make_support_nested_variables=no
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5
$as_echo "$am_cv_make_support_nested_variables" >&6; }
if test $am_cv_make_support_nested_variables = yes; then
AM_V='$(V)'
AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
else
AM_V=$AM_DEFAULT_VERBOSITY
AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
fi
AM_BACKSLASH='\'
if test "`cd $srcdir && pwd`" != "`pwd`"; then if test "`cd $srcdir && pwd`" != "`pwd`"; then
# Use -I$(srcdir) only when $(srcdir) != ., so that make's output # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
# is not polluted with repeated "-I." # is not polluted with repeated "-I."
@@ -2934,7 +2992,7 @@ fi
# Define the identity of the package. # Define the identity of the package.
PACKAGE='libtins' PACKAGE='libtins'
VERSION='2.0' VERSION='3.0'
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
@@ -2962,18 +3020,70 @@ AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
# For better backward compatibility. To be removed once Automake 1.9.x
# dies out for good. For more background, see:
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
mkdir_p='$(MKDIR_P)'
# We need awk for the "check" target. The system "awk" is bad on # We need awk for the "check" target. The system "awk" is bad on
# some platforms. # some platforms.
# Always define AMTAR for backward compatibility. Yes, it's still used # Always define AMTAR for backward compatibility. Yes, it's still used
# in the wild :-( We should find a proper way to deprecate it ... # in the wild :-( We should find a proper way to deprecate it ...
AMTAR='$${TAR-tar}' AMTAR='$${TAR-tar}'
# We'll loop over all known methods to create a tar archive until one works.
_am_tools='gnutar pax cpio none'
am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
# POSIX will say in a future version that running "rm -f" with no argument
# is OK; and we want to be able to make that assumption in our Makefile
# recipes. So use an aggressive probe to check that the usage we want is
# actually supported "in the wild" to an acceptable degree.
# See automake bug#10828.
# To make any issue more visible, cause the running configure to be aborted
# by default if the 'rm' program in use doesn't match our expectations; the
# user can still override this though.
if rm -f && rm -fr && rm -rf; then : OK; else
cat >&2 <<'END'
Oops!
Your 'rm' program seems unable to run without file operands specified
on the command line, even when the '-f' option is present. This is contrary
to the behaviour of most rm programs out there, and not conforming with
the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
Please tell bug-automake@gnu.org about your system, including the value
of your $PATH and any error possibly output before this message. This
can help us improve future automake versions.
END
if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
echo 'Configuration will proceed anyway, since you have set the' >&2
echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
echo >&2
else
cat >&2 <<'END'
Aborting the configuration process, to ensure you take notice of the issue.
You can download and install GNU coreutils to get an 'rm' implementation
that behaves properly: <http://www.gnu.org/software/coreutils/>.
If you want to complete the configuration process using your problematic
'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
to "yes", and re-run configure.
END
as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5
fi
fi
case `pwd` in case `pwd` in
*\ * | *\ *) *\ * | *\ *)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
@@ -3087,7 +3197,7 @@ am__quote=
_am_result=none _am_result=none
# First try GNU make style include. # First try GNU make style include.
echo "include confinc" > confmf echo "include confinc" > confmf
# Ignore all kinds of additional output from `make'. # Ignore all kinds of additional output from 'make'.
case `$am_make -s -f confmf 2> /dev/null` in #( case `$am_make -s -f confmf 2> /dev/null` in #(
*the\ am__doit\ target*) *the\ am__doit\ target*)
am__include=include am__include=include
@@ -3920,6 +4030,65 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5
$as_echo_n "checking whether $CC understands -c and -o together... " >&6; }
if ${am_cv_prog_cc_c_o+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
# Make sure it works both with $CC and with simple cc.
# Following AC_PROG_CC_C_O, we do the test twice because some
# compilers refuse to overwrite an existing .o file with -o,
# though they will create one.
am_cv_prog_cc_c_o=yes
for am_i in 1 2; do
if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5
($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } \
&& test -f conftest2.$ac_objext; then
: OK
else
am_cv_prog_cc_c_o=no
break
fi
done
rm -f core conftest*
unset am_i
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5
$as_echo "$am_cv_prog_cc_c_o" >&6; }
if test "$am_cv_prog_cc_c_o" != yes; then
# Losing compiler, so override with the script.
# FIXME: It is wrong to rewrite CC.
# But if we don't then we get into trouble of one sort or another.
# A longer-term fix would be to have automake use am__CC in this case,
# and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
CC="$am_aux_dir/compile $CC"
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
depcc="$CC" am_compiler_list= depcc="$CC" am_compiler_list=
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
@@ -3931,8 +4100,8 @@ else
# We make a subdir and do the tests there. Otherwise we can end up # We make a subdir and do the tests there. Otherwise we can end up
# making bogus files that we don't know about and never remove. For # making bogus files that we don't know about and never remove. For
# instance it was reported that on HP-UX the gcc test will end up # instance it was reported that on HP-UX the gcc test will end up
# making a dummy file named `D' -- because `-MD' means `put the output # making a dummy file named 'D' -- because '-MD' means "put the output
# in D'. # in D".
rm -rf conftest.dir rm -rf conftest.dir
mkdir conftest.dir mkdir conftest.dir
# Copy depcomp to subdir because otherwise we won't find it if we're # Copy depcomp to subdir because otherwise we won't find it if we're
@@ -3967,16 +4136,16 @@ else
: > sub/conftest.c : > sub/conftest.c
for i in 1 2 3 4 5 6; do for i in 1 2 3 4 5 6; do
echo '#include "conftst'$i'.h"' >> sub/conftest.c echo '#include "conftst'$i'.h"' >> sub/conftest.c
# Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
# Solaris 8's {/usr,}/bin/sh. # Solaris 10 /bin/sh.
touch sub/conftst$i.h echo '/* dummy */' > sub/conftst$i.h
done done
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
# We check with `-c' and `-o' for the sake of the "dashmstdout" # We check with '-c' and '-o' for the sake of the "dashmstdout"
# mode. It turns out that the SunPro C++ compiler does not properly # mode. It turns out that the SunPro C++ compiler does not properly
# handle `-M -o', and we need to detect this. Also, some Intel # handle '-M -o', and we need to detect this. Also, some Intel
# versions had trouble with output in subdirs # versions had trouble with output in subdirs.
am__obj=sub/conftest.${OBJEXT-o} am__obj=sub/conftest.${OBJEXT-o}
am__minus_obj="-o $am__obj" am__minus_obj="-o $am__obj"
case $depmode in case $depmode in
@@ -3985,8 +4154,8 @@ else
test "$am__universal" = false || continue test "$am__universal" = false || continue
;; ;;
nosideeffect) nosideeffect)
# after this tag, mechanisms are not by side-effect, so they'll # After this tag, mechanisms are not by side-effect, so they'll
# only be used when explicitly requested # only be used when explicitly requested.
if test "x$enable_dependency_tracking" = xyes; then if test "x$enable_dependency_tracking" = xyes; then
continue continue
else else
@@ -3994,7 +4163,7 @@ else
fi fi
;; ;;
msvc7 | msvc7msys | msvisualcpp | msvcmsys) msvc7 | msvc7msys | msvisualcpp | msvcmsys)
# This compiler won't grok `-c -o', but also, the minuso test has # This compiler won't grok '-c -o', but also, the minuso test has
# not run yet. These depmodes are late enough in the game, and # not run yet. These depmodes are late enough in the game, and
# so weak that their functioning should not be impacted. # so weak that their functioning should not be impacted.
am__obj=conftest.${OBJEXT-o} am__obj=conftest.${OBJEXT-o}
@@ -11773,8 +11942,8 @@ else
# We make a subdir and do the tests there. Otherwise we can end up # We make a subdir and do the tests there. Otherwise we can end up
# making bogus files that we don't know about and never remove. For # making bogus files that we don't know about and never remove. For
# instance it was reported that on HP-UX the gcc test will end up # instance it was reported that on HP-UX the gcc test will end up
# making a dummy file named `D' -- because `-MD' means `put the output # making a dummy file named 'D' -- because '-MD' means "put the output
# in D'. # in D".
rm -rf conftest.dir rm -rf conftest.dir
mkdir conftest.dir mkdir conftest.dir
# Copy depcomp to subdir because otherwise we won't find it if we're # Copy depcomp to subdir because otherwise we won't find it if we're
@@ -11809,16 +11978,16 @@ else
: > sub/conftest.c : > sub/conftest.c
for i in 1 2 3 4 5 6; do for i in 1 2 3 4 5 6; do
echo '#include "conftst'$i'.h"' >> sub/conftest.c echo '#include "conftst'$i'.h"' >> sub/conftest.c
# Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
# Solaris 8's {/usr,}/bin/sh. # Solaris 10 /bin/sh.
touch sub/conftst$i.h echo '/* dummy */' > sub/conftst$i.h
done done
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
# We check with `-c' and `-o' for the sake of the "dashmstdout" # We check with '-c' and '-o' for the sake of the "dashmstdout"
# mode. It turns out that the SunPro C++ compiler does not properly # mode. It turns out that the SunPro C++ compiler does not properly
# handle `-M -o', and we need to detect this. Also, some Intel # handle '-M -o', and we need to detect this. Also, some Intel
# versions had trouble with output in subdirs # versions had trouble with output in subdirs.
am__obj=sub/conftest.${OBJEXT-o} am__obj=sub/conftest.${OBJEXT-o}
am__minus_obj="-o $am__obj" am__minus_obj="-o $am__obj"
case $depmode in case $depmode in
@@ -11827,8 +11996,8 @@ else
test "$am__universal" = false || continue test "$am__universal" = false || continue
;; ;;
nosideeffect) nosideeffect)
# after this tag, mechanisms are not by side-effect, so they'll # After this tag, mechanisms are not by side-effect, so they'll
# only be used when explicitly requested # only be used when explicitly requested.
if test "x$enable_dependency_tracking" = xyes; then if test "x$enable_dependency_tracking" = xyes; then
continue continue
else else
@@ -11836,7 +12005,7 @@ else
fi fi
;; ;;
msvc7 | msvc7msys | msvisualcpp | msvcmsys) msvc7 | msvc7msys | msvisualcpp | msvcmsys)
# This compiler won't grok `-c -o', but also, the minuso test has # This compiler won't grok '-c -o', but also, the minuso test has
# not run yet. These depmodes are late enough in the game, and # not run yet. These depmodes are late enough in the game, and
# so weak that their functioning should not be impacted. # so weak that their functioning should not be impacted.
am__obj=conftest.${OBJEXT-o} am__obj=conftest.${OBJEXT-o}
@@ -15432,7 +15601,7 @@ fi
LIBTINS_VERSION=2:0:0 LIBTINS_VERSION=3:0:0
ac_config_files="$ac_config_files Makefile libtins.pc" ac_config_files="$ac_config_files Makefile libtins.pc"
@@ -15545,6 +15714,14 @@ LIBOBJS=$ac_libobjs
LTLIBOBJS=$ac_ltlibobjs LTLIBOBJS=$ac_ltlibobjs
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5
$as_echo_n "checking that generated files are newer than configure... " >&6; }
if test -n "$am_sleep_pid"; then
# Hide warnings about reused PIDs.
wait $am_sleep_pid 2>/dev/null
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5
$as_echo "done" >&6; }
if test -n "$EXEEXT"; then if test -n "$EXEEXT"; then
am__EXEEXT_TRUE= am__EXEEXT_TRUE=
am__EXEEXT_FALSE='#' am__EXEEXT_FALSE='#'
@@ -15966,7 +16143,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their # report actual input values of CONFIG_FILES etc. instead of their
# values after options handling. # values after options handling.
ac_log=" ac_log="
This file was extended by libtins $as_me 2.0, which was This file was extended by libtins $as_me 3.0, which was
generated by GNU Autoconf 2.69. Invocation command line was generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES CONFIG_FILES = $CONFIG_FILES
@@ -16033,7 +16210,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\ ac_cs_version="\\
libtins config.status 2.0 libtins config.status 3.0
configured by $0, generated by GNU Autoconf 2.69, configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\" with options \\"\$ac_cs_config\\"
@@ -17138,7 +17315,7 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
case $ac_file$ac_mode in case $ac_file$ac_mode in
"depfiles":C) test x"$AMDEP_TRUE" != x"" || { "depfiles":C) test x"$AMDEP_TRUE" != x"" || {
# Autoconf 2.62 quotes --file arguments for eval, but not when files # Older Autoconf quotes --file arguments for eval, but not when files
# are listed without --file. Let's play safe and only enable the eval # are listed without --file. Let's play safe and only enable the eval
# if we detect the quoting. # if we detect the quoting.
case $CONFIG_FILES in case $CONFIG_FILES in
@@ -17151,7 +17328,7 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
# Strip MF so we end up with the name of the file. # Strip MF so we end up with the name of the file.
mf=`echo "$mf" | sed -e 's/:.*$//'` mf=`echo "$mf" | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile or not. # Check whether this is an Automake generated Makefile or not.
# We used to match only the files named `Makefile.in', but # We used to match only the files named 'Makefile.in', but
# some people rename them; so instead we look at the file content. # some people rename them; so instead we look at the file content.
# Grep'ing the first line is not enough: some people post-process # Grep'ing the first line is not enough: some people post-process
# each Makefile.in and add a new line on top of each file to say so. # each Makefile.in and add a new line on top of each file to say so.
@@ -17185,21 +17362,19 @@ $as_echo X"$mf" |
continue continue
fi fi
# Extract the definition of DEPDIR, am__include, and am__quote # Extract the definition of DEPDIR, am__include, and am__quote
# from the Makefile without running `make'. # from the Makefile without running 'make'.
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
test -z "$DEPDIR" && continue test -z "$DEPDIR" && continue
am__include=`sed -n 's/^am__include = //p' < "$mf"` am__include=`sed -n 's/^am__include = //p' < "$mf"`
test -z "am__include" && continue test -z "$am__include" && continue
am__quote=`sed -n 's/^am__quote = //p' < "$mf"` am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
# When using ansi2knr, U may be empty or an underscore; expand it
U=`sed -n 's/^U = //p' < "$mf"`
# Find all dependency output files, they are included files with # Find all dependency output files, they are included files with
# $(DEPDIR) in their names. We invoke sed twice because it is the # $(DEPDIR) in their names. We invoke sed twice because it is the
# simplest approach to changing $(DEPDIR) to its actual value in the # simplest approach to changing $(DEPDIR) to its actual value in the
# expansion. # expansion.
for file in `sed -n " for file in `sed -n "
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
# Make sure the directory exists. # Make sure the directory exists.
test -f "$dirpart/$file" && continue test -f "$dirpart/$file" && continue
fdir=`$as_dirname -- "$file" || fdir=`$as_dirname -- "$file" ||

View File

@@ -1,4 +1,4 @@
AC_INIT([libtins], [2.0], [matias.fontanini@gmail.com], [libtins], [http://libtins.sourceforge.net]) AC_INIT([libtins], [3.0], [matias.fontanini@gmail.com], [libtins], [http://libtins.sourceforge.net])
AC_CANONICAL_SYSTEM AC_CANONICAL_SYSTEM
AC_CONFIG_HEADER(include/config.h) AC_CONFIG_HEADER(include/config.h)
AM_INIT_AUTOMAKE([-Wall -Werror -Wno-extra-portability foreign]) AM_INIT_AUTOMAKE([-Wall -Werror -Wno-extra-portability foreign])
@@ -80,6 +80,6 @@ AC_ARG_ENABLE(
AC_SUBST(CXXFLAGS) AC_SUBST(CXXFLAGS)
AC_SUBST(LIBS) AC_SUBST(LIBS)
AC_SUBST(LIBTINS_INCLUDE_DIR) AC_SUBST(LIBTINS_INCLUDE_DIR)
AC_SUBST([LIBTINS_VERSION], [2:0:0]) AC_SUBST([LIBTINS_VERSION], [3:0:0])
AC_CONFIG_FILES([Makefile libtins.pc]) AC_CONFIG_FILES([Makefile libtins.pc])
AC_OUTPUT AC_OUTPUT

View File

@@ -1,7 +1,7 @@
CXX=@CXX@ CXX=@CXX@
CXXFLAGS=-Wall @CXXFLAGS@ CXXFLAGS=-Wall @CXXFLAGS@
LDFLAGS=-ltins LDFLAGS=-ltins
EXECUTABLES=arpspoofing arpmonitor portscan traceroute beacon_display dns_queries dns_spoof wps_detect EXECUTABLES=arpspoofing arpmonitor portscan traceroute beacon_display dns_queries dns_spoof dns_stats wps_detect
all: $(EXECUTABLES) all: $(EXECUTABLES)
@@ -21,6 +21,9 @@ dns_queries:
dns_spoof: dns_spoof:
$(CXX) dns_spoof.cpp -o dns_spoof -std=c++0x $(CXXFLAGS) $(LDFLAGS) $(CXX) dns_spoof.cpp -o dns_spoof -std=c++0x $(CXXFLAGS) $(LDFLAGS)
dns_stats:
$(CXX) dns_stats.cpp -o dns_stats -std=c++0x $(CXXFLAGS) $(LDFLAGS) -lpthread
beacon_display: beacon_display:
$(CXX) beacon_display.cpp -o beacon_display $(CXXFLAGS) $(LDFLAGS) $(CXX) beacon_display.cpp -o beacon_display $(CXXFLAGS) $(LDFLAGS)

View File

@@ -1,3 +1,32 @@
/*
* Copyright (c) 2014, Matias Fontanini
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <tins/tins.h> #include <tins/tins.h>
#include <map> #include <map>
#include <iostream> #include <iostream>
@@ -58,6 +87,10 @@ int main(int argc, char *argv[])
return 1; return 1;
} }
arp_monitor monitor; arp_monitor monitor;
Sniffer sniffer(argv[1], 2000, true, "arp"); // Sniff on the provided interface in promiscuous mode
Sniffer sniffer(argv[1], Sniffer::PROMISC);
// Only capture arp packets
sniffer.set_filter("arp");
monitor.run(sniffer); monitor.run(sniffer);
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -47,7 +47,7 @@ private:
}; };
void BeaconSniffer::run(const std::string &iface) { void BeaconSniffer::run(const std::string &iface) {
Sniffer sniffer(iface, 1500, true, "type mgt subtype beacon"); Sniffer sniffer(iface, Sniffer::PROMISC, "type mgt subtype beacon", true);
sniffer.sniff_loop(make_sniffer_handler(this, &BeaconSniffer::callback)); sniffer.sniff_loop(make_sniffer_handler(this, &BeaconSniffer::callback));
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -54,8 +54,12 @@ int main(int argc, char *argv[])
std::cout << "Usage: " << *argv << " <interface>" << std::endl; std::cout << "Usage: " << *argv << " <interface>" << std::endl;
return 1; return 1;
} }
// Sniff on the provided interface, maximum packet size 2000 // Sniff on the provided interface in promiscuos mode
// in promiscuos mode and only udp packets sent to port 53 Sniffer sniffer(argv[1], Sniffer::PROMISC);
Sniffer sniffer(argv[1], 2000, true, "udp and dst port 53");
// Only capture udp packets sent to port 53
sniffer.set_filter("udp and dst port 53");
// Start the capture
sniffer.sniff_loop(callback); sniffer.sniff_loop(callback);
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -54,10 +54,14 @@ bool callback(const PDU &pdu)
if(query.type() == DNS::A) { if(query.type() == DNS::A) {
// Here's one! Let's add an answer. // Here's one! Let's add an answer.
dns.add_answer( dns.add_answer(
query.dname(), DNS::Resource(
// 777 is just a random TTL query.dname(),
DNS::make_info(DNS::A, query.query_class(), 777), "127.0.0.1",
IPv4Address("127.0.0.1") DNS::A,
query.query_class(),
// 777 is just a random TTL
777
)
); );
} }
} }
@@ -85,10 +89,15 @@ int main(int argc, char *argv[])
std::cout << "Usage: " << *argv << " <interface>" << std::endl; std::cout << "Usage: " << *argv << " <interface>" << std::endl;
return 1; return 1;
} }
// Sniff on the provided interface, maximum packet size 2000 // Sniff on the provided interface in promiscuos mode
// in promiscuos mode and only udp packets sent to port 53 Sniffer sniffer(argv[1], Sniffer::PROMISC);
Sniffer sniffer(argv[1], 2000, true, "udp and dst port 53");
// Only capture udp packets sent to port 53
sniffer.set_filter("udp and dst port 53");
// All packets will be sent through the provided interface // All packets will be sent through the provided interface
sender.default_interface(argv[1]); sender.default_interface(argv[1]);
// Start the capture
sniffer.sniff_loop(callback); sniffer.sniff_loop(callback);
} }

189
examples/dns_stats.cpp Normal file
View File

@@ -0,0 +1,189 @@
/*
* Copyright (c) 2014, Matias Fontanini
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <iostream>
#include <mutex>
#include <chrono>
#include <map>
#include <thread>
#include <algorithm>
#include <tins/tins.h>
using namespace Tins;
// Holds the DNS response time statistics. The response time is
// represented using the Duration template parameter.
template<typename Duration>
class statistics {
public:
using duration_type = Duration;
using locker_type = std::lock_guard<std::mutex>;
struct information {
duration_type average, worst;
size_t count;
};
statistics()
: m_duration(), m_worst(duration_type::min()), m_count()
{
}
void add_response_time(const duration_type& duration)
{
locker_type _(m_lock);
m_duration += duration;
m_count++;
m_worst = std::max(m_worst, duration);
}
information get_information() const
{
locker_type _(m_lock);
if(m_count == 0)
return { };
else
return { m_duration / m_count, m_worst, m_count };
};
private:
duration_type m_duration, m_worst;
size_t m_count;
mutable std::mutex m_lock;
};
// Sniffs and tracks DNS queries. When a matching DNS response is found,
// the response time is added to a statistics object.
//
// This class performs *no cleanup* on data associated with queries that
// weren't answered.
class dns_monitor {
public:
// The response times are measured in milliseconds
using duration_type = std::chrono::milliseconds;
// The statistics type used.
using statistics_type = statistics<duration_type>;
void run(BaseSniffer& sniffer);
const statistics_type& stats() const {
return m_stats;
}
private:
using packet_info = std::tuple<IPv4Address, IPv4Address, uint16_t>;
using clock_type = std::chrono::steady_clock;
using time_point_type = std::chrono::time_point<clock_type>;
bool callback(const PDU& pdu);
static packet_info make_packet_info(const PDU& pdu, const DNS& dns);
statistics_type m_stats;
std::map<packet_info, time_point_type> m_packet_info;
};
void dns_monitor::run(BaseSniffer& sniffer)
{
sniffer.sniff_loop(
std::bind(
&dns_monitor::callback,
this,
std::placeholders::_1
)
);
}
bool dns_monitor::callback(const PDU& pdu)
{
auto now = clock_type::now();
auto dns = pdu.rfind_pdu<RawPDU>().to<DNS>();
auto info = make_packet_info(pdu, dns);
// If it's a query, add the sniff time to our map.
if(dns.type() == DNS::QUERY) {
m_packet_info.insert(
std::make_pair(info, now)
);
}
else {
// It's a response, we need to find the query in our map.
auto iter = m_packet_info.find(info);
if(iter != m_packet_info.end()) {
// We found the query, let's add the response time to the
// statistics object.
m_stats.add_response_time(
std::chrono::duration_cast<duration_type>(now - iter->second)
);
// Forget about the query.
m_packet_info.erase(iter);
}
}
return true;
}
// It is required that we can identify packets sent and received that
// hold the same DNS id as belonging to the same query.
//
// This function retrieves a tuple (addr, addr, id) that will achieve it.
auto dns_monitor::make_packet_info(const PDU& pdu, const DNS& dns) -> packet_info
{
const auto& ip = pdu.rfind_pdu<IP>();
return std::make_tuple(
// smallest address first
std::min(ip.src_addr(), ip.dst_addr()),
// largest address second
std::max(ip.src_addr(), ip.dst_addr()),
dns.id()
);
}
int main(int argc, char *argv[]) {
if(argc != 2) {
std::cout << "Usage: " << *argv << " <interface>\n";
return 1;
}
try {
Sniffer sniffer(argv[1], Sniffer::PROMISC);
sniffer.set_filter("udp and port 53");
dns_monitor monitor;
std::thread thread(
[&]() {
monitor.run(sniffer);
}
);
while(true) {
auto info = monitor.stats().get_information();
std::cout << "\rAverage " << info.average.count()
<< "ms. Worst: " << info.worst.count() << "ms. Count: "
<< info.count;
std::cout.flush();
std::this_thread::sleep_for(std::chrono::seconds(1));
}
}
catch(std::exception& ex) {
std::cout << "[-] Error: " << ex.what() << std::endl;
}
}

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -38,7 +38,9 @@
#define TINS_CXXSTD_GCC_FIX 0 #define TINS_CXXSTD_GCC_FIX 0
#endif // __GXX_EXPERIMENTAL_CXX0X__ #endif // __GXX_EXPERIMENTAL_CXX0X__
#define TINS_IS_CXX11 (__cplusplus > 199711L || TINS_CXXSTD_GCC_FIX == 1) #ifndef TINS_IS_CXX11
#define TINS_IS_CXX11 (__cplusplus > 199711L || TINS_CXXSTD_GCC_FIX == 1 || _MSC_VER >= 1800)
#endif // TINS_IS_CXX11
namespace Tins{ namespace Tins{
namespace Internals { namespace Internals {

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -309,6 +309,15 @@ namespace Tins {
* \param name The domain name. * \param name The domain name.
*/ */
void domain_name(const std::string &name); void domain_name(const std::string &name);
/**
* \brief Adds a hostname option.
*
* The new option is appended at the end of the list.
*
* \param name The hostname.
*/
void hostname(const std::string &name);
// Option getters // Option getters
@@ -423,6 +432,16 @@ namespace Tins {
* \return std::string Containing the domain name. * \return std::string Containing the domain name.
*/ */
std::string domain_name() const; std::string domain_name() const;
/**
* \brief Searchs for a hostname option.
*
* If the option is not found, an option_not_found exception
* is thrown.
*
* \return std::string Containing the hostname.
*/
std::string hostname() const;
/** /**
* \brief Getter for the options list. * \brief Getter for the options list.

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -30,6 +30,7 @@
#ifndef TINS_DHCPV6_H #ifndef TINS_DHCPV6_H
#define TINS_DHCPV6_H #define TINS_DHCPV6_H
#include <cstring>
#include <list> #include <list>
#include "pdu.h" #include "pdu.h"
#include "endianness.h" #include "endianness.h"
@@ -886,9 +887,11 @@ void class_option_data2option(InputIterator start, InputIterator end,
std::vector<uint8_t>& buffer, size_t start_index = 0) std::vector<uint8_t>& buffer, size_t start_index = 0)
{ {
size_t index = start_index; size_t index = start_index;
uint16_t uint16_t_buffer;
while(start != end) { while(start != end) {
buffer.resize(buffer.size() + sizeof(uint16_t) + start->size()); buffer.resize(buffer.size() + sizeof(uint16_t) + start->size());
*(uint16_t*)&buffer[index] = Endian::host_to_be<uint16_t>(start->size()); uint16_t_buffer = Endian::host_to_be<uint16_t>(start->size());
std::memcpy(&buffer[index], &uint16_t_buffer, sizeof(uint16_t));
index += sizeof(uint16_t); index += sizeof(uint16_t);
std::copy(start->begin(), start->end(), buffer.begin() + index); std::copy(start->begin(), start->end(), buffer.begin() + index);
index += start->size(); index += start->size();
@@ -904,9 +907,9 @@ OutputType option2class_option_data(const uint8_t *ptr, uint32_t total_sz)
OutputType output; OutputType output;
size_t index = 0; size_t index = 0;
while(index + 2 < total_sz) { while(index + 2 < total_sz) {
uint16_t size = Endian::be_to_host( uint16_t size;
*(const uint16_t*)(ptr + index) std::memcpy(&size, ptr + index, sizeof(uint16_t));
); size = Endian::be_to_host(size);
index += sizeof(uint16_t); index += sizeof(uint16_t);
if(index + size > total_sz) if(index + size > total_sz)
throw option_not_found(); throw option_not_found();

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -619,4 +619,4 @@ private:
}; };
} // namespace Tins } // namespace Tins
#endif // TINS_DOT11_DOT11_ASSOC_H #endif // TINS_DOT11_DOT11_ASSOC_H

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -257,4 +257,4 @@ private:
} // namespace Tins } // namespace Tins
#endif // TINS_DOT11_DOT11_AUTH_H #endif // TINS_DOT11_DOT11_AUTH_H

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -163,4 +163,4 @@ namespace Tins {
}; };
} // namespace Tins } // namespace Tins
#endif // TINS_DOT11_DOT11_BEACON_H #endif // TINS_DOT11_DOT11_BEACON_H

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -230,4 +230,4 @@ private:
uint32_t write_fixed_parameters(uint8_t *buffer, uint32_t total_sz); uint32_t write_fixed_parameters(uint8_t *buffer, uint32_t total_sz);
}; };
} // namespace Tins } // namespace Tins
#endif // TINS_DOT11_DOT11_PROBE_H #endif // TINS_DOT11_DOT11_PROBE_H

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -30,6 +30,7 @@
#ifndef TINS_EXCEPTIONS_H #ifndef TINS_EXCEPTIONS_H
#define TINS_EXCEPTIONS_H #define TINS_EXCEPTIONS_H
#include <string>
#include <stdexcept> #include <stdexcept>
namespace Tins { namespace Tins {

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -166,4 +166,4 @@ namespace Tins {
}; };
} }
#endif // TINS_HANDSHAKE_CAPTURER_H #endif // TINS_HANDSHAKE_CAPTURER_H

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -30,6 +30,18 @@
#ifndef TINS_ICMP_H #ifndef TINS_ICMP_H
#define TINS_ICMP_H #define TINS_ICMP_H
// Windows likes to define macros with not-so-common-names, which break
// this code
#ifdef WIN32
#ifdef TIMESTAMP_REQUEST
#undef TIMESTAMP_REQUEST
#endif // TIMESTAMP_REQUEST
#ifdef TIMESTAMP_REPLY
#undef TIMESTAMP_REPLY
#endif // TIMESTAMP_REPLY
#endif // WIN32
#include "macros.h" #include "macros.h"
#include "pdu.h" #include "pdu.h"
#include "endianness.h" #include "endianness.h"
@@ -258,7 +270,7 @@ namespace Tins {
* *
* \return Returns the checksum as an unit16_t. * \return Returns the checksum as an unit16_t.
*/ */
uint16_t check() const { return Endian::be_to_host(_icmp.check); } uint16_t checksum() const { return Endian::be_to_host(_icmp.check); }
/** /**
* \brief Getter for the echo id. * \brief Getter for the echo id.
@@ -377,7 +389,7 @@ namespace Tins {
} un; } un;
} TINS_END_PACK; } TINS_END_PACK;
void check(uint16_t new_check); void checksum(uint16_t new_check);
/** \brief Serialices this ICMP PDU. /** \brief Serialices this ICMP PDU.
* \param buffer The buffer in which the PDU will be serialized. * \param buffer The buffer in which the PDU will be serialized.

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -426,6 +426,20 @@ namespace Tins {
internal_add_option(opt); internal_add_option(opt);
_ip_options.push_back(std::move(opt)); _ip_options.push_back(std::move(opt));
} }
/**
* \brief Adds an IP option.
*
* The option is constructed from the provided parameters.
*
* \param args The arguments to be used in the option's
* constructor.
*/
template<typename... Args>
void add_option(Args&&... args) {
_ip_options.emplace_back(std::forward<Args>(args)...);
internal_add_option(_ip_options.back());
}
#endif #endif
/** /**

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -213,4 +213,4 @@ IPv4ReassemblerProxy<Functor> make_ipv4_reassembler_proxy(Functor func) {
} }
#endif // TINS_IP_REASSEMBLER_H #endif // TINS_IP_REASSEMBLER_H

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -40,11 +40,13 @@
#define TINS_END_PACK __pragma( pack(pop) ) #define TINS_END_PACK __pragma( pack(pop) )
#define TINS_PACKED(DECLARATION) __pragma( pack(push, 1) ) DECLARATION __pragma( pack(pop) ) #define TINS_PACKED(DECLARATION) __pragma( pack(push, 1) ) DECLARATION __pragma( pack(pop) )
#define TINS_DEPRECATED(func) __declspec(deprecated) func #define TINS_DEPRECATED(func) __declspec(deprecated) func
#define NOEXCEPT
#else #else
#define TINS_BEGIN_PACK #define TINS_BEGIN_PACK
#define TINS_END_PACK __attribute__((packed)) #define TINS_END_PACK __attribute__((packed))
#define TINS_PACKED(DECLARATION) DECLARATION __attribute__((packed)) #define TINS_PACKED(DECLARATION) DECLARATION __attribute__((packed))
#define TINS_DEPRECATED(func) func __attribute__ ((deprecated)) #define TINS_DEPRECATED(func) func __attribute__ ((deprecated))
#define NOEXCEPT noexcept
#endif #endif
#endif #endif

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -128,6 +128,13 @@ private:
*/ */
class Packet { class Packet {
public: public:
/**
* Tag used to specify that a Packet should own a PDU pointer.
*/
struct own_pdu {
};
/** /**
* \brief Default constructs a Packet. * \brief Default constructs a Packet.
* *
@@ -143,6 +150,17 @@ public:
*/ */
Packet(const PDU *apdu, const Timestamp &tstamp) Packet(const PDU *apdu, const Timestamp &tstamp)
: pdu_(apdu->clone()), ts(tstamp) { } : pdu_(apdu->clone()), ts(tstamp) { }
/**
* \brief Constructs a Packet from a PDU* and a Timestamp.
*
* The PDU* will be owned by the Packet. This means you
* <b>do not</b> have to explicitly delete the pointer, that
* will be done automatically by the Packet when it goes out
* of scope.
*/
Packet(PDU *apdu, const Timestamp &tstamp, own_pdu)
: pdu_(apdu), ts(tstamp) { }
/** /**
* \brief Constructs a Packet from a const PDU&. * \brief Constructs a Packet from a const PDU&.
@@ -197,14 +215,14 @@ public:
/** /**
* Move constructor. * Move constructor.
*/ */
Packet(Packet &&rhs) noexcept : pdu_(rhs.pdu()), ts(rhs.timestamp()) { Packet(Packet &&rhs) NOEXCEPT : pdu_(rhs.pdu()), ts(rhs.timestamp()) {
rhs.pdu_ = nullptr; rhs.pdu_ = nullptr;
} }
/** /**
* Move assignment operator. * Move assignment operator.
*/ */
Packet& operator=(Packet &&rhs) noexcept { Packet& operator=(Packet &&rhs) NOEXCEPT {
if(this != &rhs) { if(this != &rhs) {
std::swap(pdu_, rhs.pdu_); std::swap(pdu_, rhs.pdu_);
ts = rhs.timestamp(); ts = rhs.timestamp();

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -87,7 +87,7 @@ namespace Tins {
* \brief Move constructor. * \brief Move constructor.
* \param rhs The sender to be moved. * \param rhs The sender to be moved.
*/ */
PacketSender(PacketSender &&rhs) noexcept { PacketSender(PacketSender &&rhs) NOEXCEPT {
*this = std::move(rhs); *this = std::move(rhs);
} }
@@ -95,7 +95,7 @@ namespace Tins {
* \brief Move assignment operator. * \brief Move assignment operator.
* \param rhs The sender to be moved. * \param rhs The sender to be moved.
*/ */
PacketSender& operator=(PacketSender &&rhs) noexcept { PacketSender& operator=(PacketSender &&rhs) NOEXCEPT {
_sockets = std::move(rhs._sockets); _sockets = std::move(rhs._sockets);
rhs._sockets = std::vector<int>(SOCKETS_END, INVALID_RAW_SOCKET); rhs._sockets = std::vector<int>(SOCKETS_END, INVALID_RAW_SOCKET);
#ifndef WIN32 #ifndef WIN32
@@ -325,6 +325,10 @@ namespace Tins {
SocketTypeMap _types; SocketTypeMap _types;
uint32_t _timeout, _timeout_usec; uint32_t _timeout, _timeout_usec;
NetworkInterface default_iface; NetworkInterface default_iface;
// In BSD we need to store the buffer size, retrieved using BIOCGBLEN
#if defined(BSD) || defined(__FreeBSD_kernel__)
int buffer_size;
#endif
}; };
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -76,7 +76,7 @@ public:
* *
* \param rhs The PacketWriter to be moved. * \param rhs The PacketWriter to be moved.
*/ */
PacketWriter(PacketWriter &&rhs) noexcept { PacketWriter(PacketWriter &&rhs) NOEXCEPT {
*this = std::move(rhs); *this = std::move(rhs);
} }
@@ -88,7 +88,7 @@ public:
* *
* \param rhs The PacketWriter to be moved. * \param rhs The PacketWriter to be moved.
*/ */
PacketWriter& operator=(PacketWriter &&rhs) noexcept { PacketWriter& operator=(PacketWriter &&rhs) NOEXCEPT {
handle = 0; handle = 0;
dumper = 0; dumper = 0;
std::swap(handle, rhs.handle); std::swap(handle, rhs.handle);

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -149,7 +149,7 @@ namespace Tins {
* *
* \param rhs The PDU to be moved. * \param rhs The PDU to be moved.
*/ */
PDU(PDU &&rhs) noexcept PDU(PDU &&rhs) NOEXCEPT
: _inner_pdu(0) : _inner_pdu(0)
{ {
std::swap(_inner_pdu, rhs._inner_pdu); std::swap(_inner_pdu, rhs._inner_pdu);
@@ -160,7 +160,7 @@ namespace Tins {
* *
* \param rhs The PDU to be moved. * \param rhs The PDU to be moved.
*/ */
PDU& operator=(PDU &&rhs) noexcept { PDU& operator=(PDU &&rhs) NOEXCEPT {
std::swap(_inner_pdu, rhs._inner_pdu); std::swap(_inner_pdu, rhs._inner_pdu);
return *this; return *this;
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -32,6 +32,7 @@
#include <vector> #include <vector>
#include <iterator> #include <iterator>
#include <cstring>
#include <algorithm> #include <algorithm>
#include <string> #include <string>
#include <stdint.h> #include <stdint.h>
@@ -266,8 +267,8 @@ namespace Internals {
if(opt.data_size() != sizeof(T) + sizeof(U)) if(opt.data_size() != sizeof(T) + sizeof(U))
throw malformed_option(); throw malformed_option();
std::pair<T, U> output; std::pair<T, U> output;
output.first = *(const T*)opt.data_ptr(); std::memcpy(&output.first, opt.data_ptr(), sizeof(T));
output.second = *(const U*)(opt.data_ptr() + sizeof(T)); std::memcpy(&output.second, opt.data_ptr() + sizeof(T), sizeof(U));
if(PDUType::endianness == PDUType::BE) { if(PDUType::endianness == PDUType::BE) {
output.first = Endian::be_to_host(output.first); output.first = Endian::be_to_host(output.first);
output.second = Endian::be_to_host(output.second); output.second = Endian::be_to_host(output.second);
@@ -298,9 +299,10 @@ namespace Internals {
*/ */
template<typename OptionType, class PDUType> template<typename OptionType, class PDUType>
class PDUOption { class PDUOption {
private:
static const int small_buffer_size = 8;
public: public:
typedef std::vector<uint8_t> container_type; typedef uint8_t data_type;
typedef typename container_type::value_type data_type;
typedef OptionType option_type; typedef OptionType option_type;
/** /**
@@ -310,8 +312,79 @@ public:
* \param data The option's data(if any). * \param data The option's data(if any).
*/ */
PDUOption(option_type opt = option_type(), size_t length = 0, const data_type *data = 0) PDUOption(option_type opt = option_type(), size_t length = 0, const data_type *data = 0)
: option_(opt), size_(length), value_(data, data + (data ? length : 0)) { : option_(opt), size_(length) {
set_payload_contents(data, data + (data ? length : 0));
}
/**
* \brief Copy constructor.
* \param rhs The PDUOption to be copied.
*/
PDUOption(const PDUOption& rhs) {
real_size_ = 0;
*this = rhs;
}
#if TINS_IS_CXX11
/**
* \brief Move constructor.
* \param rhs The PDUOption to be moved.
*/
PDUOption(PDUOption&& rhs) {
real_size_ = 0;
*this = std::move(rhs);
}
/**
* \brief Move assignment operator.
* \param rhs The PDUOption to be moved.
*/
PDUOption& operator=(PDUOption&& rhs) {
option_ = rhs.option_;
size_ = rhs.size_;
if(real_size_ > small_buffer_size) {
delete[] payload_.big_buffer_ptr;
}
real_size_ = rhs.real_size_;
if(real_size_ > small_buffer_size) {
payload_.big_buffer_ptr = nullptr;
std::swap(payload_.big_buffer_ptr, rhs.payload_.big_buffer_ptr);
rhs.real_size_ = 0;
}
else {
std::copy(
rhs.data_ptr(),
rhs.data_ptr() + rhs.data_size(),
payload_.small_buffer
);
}
return *this;
}
#endif // TINS_IS_CXX11
/**
* \brief Copy assignment operator.
* \param rhs The PDUOption to be copied.
*/
PDUOption& operator=(const PDUOption& rhs) {
option_ = rhs.option_;
size_ = rhs.size_;
if(real_size_ > small_buffer_size) {
delete[] payload_.big_buffer_ptr;
}
real_size_ = rhs.real_size_;
set_payload_contents(rhs.data_ptr(), rhs.data_ptr() + rhs.data_size());
return *this;
}
/**
* \brief Destructor.
*/
~PDUOption() {
if(real_size_ > small_buffer_size) {
delete[] payload_.big_buffer_ptr;
}
} }
/** /**
@@ -324,8 +397,8 @@ public:
*/ */
template<typename ForwardIterator> template<typename ForwardIterator>
PDUOption(option_type opt, ForwardIterator start, ForwardIterator end) PDUOption(option_type opt, ForwardIterator start, ForwardIterator end)
: option_(opt), size_(std::distance(start, end)), value_(start, end) { : option_(opt), size_(std::distance(start, end)) {
set_payload_contents(start, end);
} }
/** /**
@@ -345,8 +418,8 @@ public:
*/ */
template<typename ForwardIterator> template<typename ForwardIterator>
PDUOption(option_type opt, size_t length, ForwardIterator start, ForwardIterator end) PDUOption(option_type opt, size_t length, ForwardIterator start, ForwardIterator end)
: option_(opt), size_(length), value_(start, end) { : option_(opt), size_(length) {
set_payload_contents(start, end);
} }
/** /**
@@ -375,7 +448,9 @@ public:
* \return const data_type& containing this option's value. * \return const data_type& containing this option's value.
*/ */
const data_type *data_ptr() const { const data_type *data_ptr() const {
return &*value_.begin(); return real_size_ <= small_buffer_size ?
payload_.small_buffer :
payload_.big_buffer_ptr;
} }
/** /**
@@ -384,7 +459,7 @@ public:
* This is the actual size of the data. * This is the actual size of the data.
*/ */
size_t data_size() const { size_t data_size() const {
return value_.size(); return real_size_;
} }
/** /**
@@ -415,9 +490,32 @@ public:
return Internals::converter<T>::convert(*this); return Internals::converter<T>::convert(*this);
} }
private: private:
template<typename ForwardIterator>
void set_payload_contents(ForwardIterator start, ForwardIterator end) {
real_size_ = std::distance(start, end);
if(real_size_ <= small_buffer_size) {
std::copy(
start,
end,
payload_.small_buffer
);
}
else {
payload_.big_buffer_ptr = new data_type[real_size_];
std::copy(
start,
end,
payload_.big_buffer_ptr
);
}
}
option_type option_; option_type option_;
uint16_t size_; uint16_t size_, real_size_;
container_type value_; union {
data_type small_buffer[small_buffer_size];
data_type* big_buffer_ptr;
} payload_;
}; };
} // namespace Tins } // namespace Tins
#endif // TINS_PDU_OPTION_H #endif // TINS_PDU_OPTION_H

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -27,7 +27,9 @@
* *
*/ */
#ifndef TINS_RSN_INFORMATION #include "config.h"
#if !defined(TINS_RSN_INFORMATION) && defined(HAVE_DOT11)
#define TINS_RSN_INFORMATION #define TINS_RSN_INFORMATION
#include <stdint.h> #include <stdint.h>

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -68,7 +68,7 @@ namespace Tins {
* \brief Move constructor. * \brief Move constructor.
* This constructor is available only in C++11. * This constructor is available only in C++11.
*/ */
BaseSniffer(BaseSniffer &&rhs) noexcept BaseSniffer(BaseSniffer &&rhs) NOEXCEPT
: handle(nullptr), mask() : handle(nullptr), mask()
{ {
*this = std::move(rhs); *this = std::move(rhs);
@@ -78,7 +78,7 @@ namespace Tins {
* \brief Move assignment operator. * \brief Move assignment operator.
* This operator is available only in C++11. * This operator is available only in C++11.
*/ */
BaseSniffer& operator=(BaseSniffer &&rhs) noexcept BaseSniffer& operator=(BaseSniffer &&rhs) NOEXCEPT
{ {
using std::swap; using std::swap;
swap(handle, rhs.handle); swap(handle, rhs.handle);
@@ -200,6 +200,22 @@ namespace Tins {
*/ */
void set_timeout(int ms); void set_timeout(int ms);
/**
* \brief Sets whether to extract RawPDUs or fully parsed packets.
*
* By default, packets will be parsed starting from link layer.
* However, if you're parsing a lot of traffic, then you might
* want to extract packets and push them into a queue,
* so a consumer can parse them when they're popped.
*
* This method allows doing that. If the parameter is true,
* then packets taken from this BaseSniffer will only contain
* a RawPDU which will have to entire contents of the packet.
*
* \param value Whether to extract RawPDUs or not.
*/
void set_extract_raw_pdus(bool value);
/** /**
* \brief Retrieves this sniffer's link type. * \brief Retrieves this sniffer's link type.
* *
@@ -239,6 +255,7 @@ namespace Tins {
pcap_t *handle; pcap_t *handle;
bpf_u_int32 mask; bpf_u_int32 mask;
bool extract_raw;
}; };
/** /**
@@ -254,29 +271,35 @@ namespace Tins {
/** /**
* Constructs an instance of Sniffer. * Constructs an instance of Sniffer.
*
* By default the interface won't be put into promiscuous mode, and won't
* be put into monitor mode.
*
* \param device The device which will be sniffed. * \param device The device which will be sniffed.
* \param max_packet_size The maximum packet size to be read. * \param max_packet_size The maximum packet size to be read.
* \param promisc bool indicating wether to put the interface in promiscuous mode.(optional) * \param promisc bool indicating wether to put the interface in promiscuous mode.(optional)
* \param filter A capture filter to be used on the sniffing session.(optional); * \param filter A capture filter to be used on the sniffing session.(optional);
* \param rfmon Indicates if the interface should be put in monitor mode.(optional);
*/ */
Sniffer(const std::string &device, unsigned max_packet_size, Sniffer(const std::string &device, unsigned max_packet_size,
bool promisc = false, const std::string &filter = ""); bool promisc = false, const std::string &filter = "", bool rfmon = false);
/** /**
* \brief Constructs an instance of Sniffer. * \brief Constructs an instance of Sniffer.
* *
* The maximum capture size is set to 65535. By default the interface won't * The maximum capture size is set to 65535. By default the interface won't
* be put into promiscuous mode. * be put into promiscuous mode, and won't be put into monitor mode.
* *
* \param device The device which will be sniffed. * \param device The device which will be sniffed.
* \param promisc Indicates if the interface should be put in promiscuous mode. * \param promisc Indicates if the interface should be put in promiscuous mode.
* \param filter A capture filter to be used on the sniffing session.(optional); * \param filter A capture filter to be used on the sniffing session.(optional);
* \param rfmon Indicates if the interface should be put in monitor mode.(optional);
*/ */
Sniffer(const std::string &device, promisc_type promisc = NON_PROMISC, Sniffer(const std::string &device, promisc_type promisc = NON_PROMISC,
const std::string &filter = ""); const std::string &filter = "", bool rfmon = false);
private: private:
void init_sniffer(const std::string &device, unsigned max_packet_size, void init_sniffer(const std::string &device, unsigned max_packet_size,
bool promisc = false, const std::string &filter = ""); bool promisc = false, const std::string &filter = "", bool rfmon = false);
}; };
/** /**

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -409,6 +409,20 @@ namespace Tins {
internal_add_option(opt); internal_add_option(opt);
_options.push_back(std::move(opt)); _options.push_back(std::move(opt));
} }
/**
* \brief Adds a TCP option using the provided arguments.
*
* The option is constructed from the provided parameters.
*
* \param args The arguments to be used in the option's
* constructor.
*/
template<typename... Args>
void add_option(Args&&... args) {
_options.emplace_back(std::forward<Args>(args)...);
internal_add_option(_options.back());
}
#endif #endif
/** /**

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -185,7 +185,9 @@ private:
static fragments_type clone_fragments(const fragments_type &frags); static fragments_type clone_fragments(const fragments_type &frags);
bool generic_process(uint32_t &my_seq, uint32_t &other_seq, bool generic_process(uint32_t &my_seq, uint32_t &other_seq,
payload_type &pload, fragments_type &frags, TCP *tcp, RawPDU *raw); payload_type &pload, fragments_type &frags, TCP *tcp);
void safe_insert(fragments_type &frags, uint32_t seq, RawPDU *raw);
uint32_t client_seq, server_seq; uint32_t client_seq, server_seq;
@@ -298,11 +300,6 @@ private:
EndFunctor end_fun; EndFunctor end_fun;
}; };
void clear_state() {
sessions.clear();
last_identifier = 0;
}
template<typename DataFunctor, typename EndFunctor> template<typename DataFunctor, typename EndFunctor>
bool callback(PDU &pdu, const DataFunctor &fun, const EndFunctor &end_fun); bool callback(PDU &pdu, const DataFunctor &fun, const EndFunctor &end_fun);
static void dummy_function(TCPStream&) { } static void dummy_function(TCPStream&) { }
@@ -315,7 +312,6 @@ template<typename DataFunctor, typename EndFunctor>
void TCPStreamFollower::follow_streams(BaseSniffer &sniffer, DataFunctor data_fun, EndFunctor end_fun) { void TCPStreamFollower::follow_streams(BaseSniffer &sniffer, DataFunctor data_fun, EndFunctor end_fun) {
typedef proxy_caller<DataFunctor, EndFunctor> proxy_type; typedef proxy_caller<DataFunctor, EndFunctor> proxy_type;
proxy_type proxy = { this, data_fun, end_fun }; proxy_type proxy = { this, data_fun, end_fun };
clear_state();
sniffer.sniff_loop(make_sniffer_handler(&proxy, &proxy_type::callback)); sniffer.sniff_loop(make_sniffer_handler(&proxy, &proxy_type::callback));
} }
@@ -323,7 +319,6 @@ template<typename ForwardIterator, typename DataFunctor, typename EndFunctor>
void TCPStreamFollower::follow_streams(ForwardIterator start, ForwardIterator end, void TCPStreamFollower::follow_streams(ForwardIterator start, ForwardIterator end,
DataFunctor data_fun, EndFunctor end_fun) DataFunctor data_fun, EndFunctor end_fun)
{ {
clear_state();
while(start != end) { while(start != end) {
if(!callback(Utils::dereference_until_pdu(start), data_fun, end_fun)) if(!callback(Utils::dereference_until_pdu(start), data_fun, end_fun))
return; return;

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -31,7 +31,6 @@
#define TINS_TIMESTAMP_H #define TINS_TIMESTAMP_H
#ifdef WIN32 #ifdef WIN32
#define NOMINMAX
#include <winsock2.h> #include <winsock2.h>
#else #else
#include <sys/time.h> #include <sys/time.h>
@@ -73,6 +72,22 @@ public:
* Default constructs the timestamp. * Default constructs the timestamp.
*/ */
Timestamp() : tv() {} Timestamp() : tv() {}
#if TINS_IS_CXX11
/**
* Constructs a Timestamp from a std::chrono::duration.
*/
template<typename Rep, typename Period>
Timestamp(const std::chrono::duration<Rep, Period>& ts) {
using std::chrono::duration_cast;
using std::chrono::microseconds;
using std::chrono::seconds;
tv.tv_sec = duration_cast<seconds>(ts).count();
tv.tv_usec = duration_cast<microseconds>(
ts - seconds(tv.tv_sec)).count();
}
#endif
/** /**
* Constructs a timestamp from a timeval object. * Constructs a timestamp from a timeval object.

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -33,7 +33,6 @@
#ifndef WIN32 #ifndef WIN32
#include <ifaddrs.h> #include <ifaddrs.h>
#else #else
#define NOMINMAX
#include <winsock2.h> #include <winsock2.h>
#include <iphlpapi.h> #include <iphlpapi.h>
#undef interface #undef interface
@@ -198,10 +197,17 @@ namespace Tins {
/** /**
* \brief Converts mhz units to the appropriate channel number. * \brief Converts mhz units to the appropriate channel number.
* \param channel The mhz units to be converted. * \param mhz The mhz units to be converted.
* \return The channel number. * \return The channel number.
*/ */
uint16_t mhz_to_channel(uint16_t mhz); uint16_t mhz_to_channel(uint16_t mhz);
/**
* \brief Converts a PDUType to a string.
* \param pduType The PDUType to be converted.
* \return A string representation, for example "DOT11_QOS_DATA".
*/
std::string to_string(PDU::PDUType pduType);
/** \brief Does the 16 bits sum of all 2 bytes elements between start and end. /** \brief Does the 16 bits sum of all 2 bytes elements between start and end.
* *

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -422,7 +422,7 @@ SNAP *SessionKeys::tkip_decrypt_unicast(const Dot11Data &dot11, RawPDU &raw) con
return new SNAP(&pload[0], pload.size() - 20); return new SNAP(&pload[0], pload.size() - 20);
} }
SNAP *SessionKeys::SessionKeys::decrypt_unicast(const Dot11Data &dot11, RawPDU &raw) const { SNAP *SessionKeys::decrypt_unicast(const Dot11Data &dot11, RawPDU &raw) const {
return is_ccmp ? return is_ccmp ?
ccmp_decrypt_unicast(dot11, raw) : ccmp_decrypt_unicast(dot11, raw) :
tkip_decrypt_unicast(dot11, raw); tkip_decrypt_unicast(dot11, raw);
@@ -546,4 +546,4 @@ bool WPA2Decrypter::decrypt(PDU &pdu) {
} // namespace Crypto } // namespace Crypto
} // namespace Tins } // namespace Tins
#endif // HAVE_DOT11 #endif // HAVE_DOT11

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,7 @@
#include <stdexcept> #include <stdexcept>
#include <cassert> #include <cassert>
#include <cstring>
#include "endianness.h" #include "endianness.h"
#include "dhcp.h" #include "dhcp.h"
#include "ethernetII.h" #include "ethernetII.h"
@@ -52,7 +53,9 @@ DHCP::DHCP(const uint8_t *buffer, uint32_t total_sz)
buffer += BootP::header_size() - vend().size(); buffer += BootP::header_size() - vend().size();
total_sz -= BootP::header_size() - vend().size(); total_sz -= BootP::header_size() - vend().size();
uint8_t args[2] = {0}; uint8_t args[2] = {0};
if(total_sz < sizeof(uint32_t) || *(uint32_t*)buffer != Endian::host_to_be<uint32_t>(0x63825363)) uint32_t uint32_t_buffer;
std::memcpy(&uint32_t_buffer, buffer, sizeof(uint32_t));
if(total_sz < sizeof(uint32_t) || uint32_t_buffer != Endian::host_to_be<uint32_t>(0x63825363))
throw malformed_packet(); throw malformed_packet();
buffer += sizeof(uint32_t); buffer += sizeof(uint32_t);
total_sz -= sizeof(uint32_t); total_sz -= sizeof(uint32_t);
@@ -187,6 +190,14 @@ std::string DHCP::domain_name() const {
return search_and_convert<std::string>(DOMAIN_NAME); return search_and_convert<std::string>(DOMAIN_NAME);
} }
void DHCP::hostname(const std::string &name) {
add_option(option(HOST_NAME, name.size(), (const uint8_t*)name.c_str()));
}
std::string DHCP::hostname() const {
return search_and_convert<std::string>(HOST_NAME);
}
void DHCP::rebind_time(uint32_t time) { void DHCP::rebind_time(uint32_t time) {
time = Endian::host_to_be(time); time = Endian::host_to_be(time);
add_option(option(DHCP_REBINDING_TIME, sizeof(uint32_t), (uint8_t*)&time)); add_option(option(DHCP_REBINDING_TIME, sizeof(uint32_t), (uint8_t*)&time));

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -63,10 +63,12 @@ DHCPv6::DHCPv6(const uint8_t *buffer, uint32_t total_sz)
if(total_sz < sizeof(uint16_t) * 2) if(total_sz < sizeof(uint16_t) * 2)
throw malformed_packet(); throw malformed_packet();
const uint16_t opt = Endian::be_to_host(*(const uint16_t*)buffer); uint16_t opt;
const uint16_t data_size = Endian::be_to_host( std::memcpy(&opt, buffer, sizeof(uint16_t));
*(const uint16_t*)(buffer + sizeof(uint16_t)) opt = Endian::be_to_host(opt);
); uint16_t data_size;
std::memcpy(&data_size, buffer + sizeof(uint16_t), sizeof(uint16_t));
data_size = Endian::be_to_host(data_size);
if(total_sz - sizeof(uint16_t) * 2 < data_size) if(total_sz - sizeof(uint16_t) * 2 < data_size)
throw malformed_packet(); throw malformed_packet();
buffer += sizeof(uint16_t) * 2; buffer += sizeof(uint16_t) * 2;
@@ -91,8 +93,10 @@ const DHCPv6::option *DHCPv6::search_option(OptionTypes id) const {
} }
uint8_t* DHCPv6::write_option(const option &opt, uint8_t* buffer) const { uint8_t* DHCPv6::write_option(const option &opt, uint8_t* buffer) const {
*(uint16_t*)buffer = Endian::host_to_be(opt.option()); uint16_t uint16_t_buffer = Endian::host_to_be(opt.option());
*(uint16_t*)&buffer[sizeof(uint16_t)] = Endian::host_to_be<uint16_t>(opt.length_field()); std::memcpy(buffer, &uint16_t_buffer, sizeof(uint16_t));
uint16_t_buffer = Endian::host_to_be<uint16_t>(opt.length_field());
std::memcpy(&buffer[sizeof(uint16_t)], &uint16_t_buffer, sizeof(uint16_t));
return std::copy( return std::copy(
opt.data_ptr(), opt.data_ptr(),
opt.data_ptr() + opt.data_size(), opt.data_ptr() + opt.data_size(),
@@ -289,8 +293,11 @@ void DHCPv6::option_request(const option_request_type &value) {
std::vector<uint8_t> buffer(value.size() * sizeof(uint16_t)); std::vector<uint8_t> buffer(value.size() * sizeof(uint16_t));
size_t index = 0; size_t index = 0;
for(iterator it = value.begin(); it != value.end(); ++it, index += 2) uint16_t uint16_t_buffer;
*(uint16_t*)&buffer[index] = Endian::host_to_be<uint16_t>(*it); for(iterator it = value.begin(); it != value.end(); ++it, index += 2) {
uint16_t_buffer = Endian::host_to_be<uint16_t>(*it);
std::memcpy(&buffer[index], &uint16_t_buffer, sizeof(uint16_t));
}
add_option( add_option(
option(OPTION_REQUEST, buffer.begin(), buffer.end()) option(OPTION_REQUEST, buffer.begin(), buffer.end())
); );
@@ -322,7 +329,8 @@ void DHCPv6::authentication(const authentication_type &value) {
buffer[0] = value.protocol; buffer[0] = value.protocol;
buffer[1] = value.algorithm; buffer[1] = value.algorithm;
buffer[2] = value.rdm; buffer[2] = value.rdm;
*(uint64_t*)&buffer[3] = Endian::host_to_be(value.replay_detection); uint64_t uint64_t_buffer = Endian::host_to_be(value.replay_detection);
std::memcpy(&buffer[3], &uint64_t_buffer, sizeof(uint64_t));
std::copy( std::copy(
value.auth_info.begin(), value.auth_info.begin(),
value.auth_info.end(), value.auth_info.end(),
@@ -341,7 +349,8 @@ void DHCPv6::server_unicast(const ipaddress_type &value) {
void DHCPv6::status_code(const status_code_type &value) { void DHCPv6::status_code(const status_code_type &value) {
std::vector<uint8_t> buffer(sizeof(uint16_t) + value.message.size()); std::vector<uint8_t> buffer(sizeof(uint16_t) + value.message.size());
*(uint16_t*)&buffer[0] = Endian::host_to_be(value.code); uint16_t uint16_t_buffer = Endian::host_to_be(value.code);
std::memcpy(&buffer[0], &uint16_t_buffer, sizeof(uint16_t));
std::copy( std::copy(
value.message.begin(), value.message.begin(),
value.message.end(), value.message.end(),
@@ -372,7 +381,8 @@ void DHCPv6::vendor_class(const vendor_class_type &value) {
std::vector<uint8_t> buffer( std::vector<uint8_t> buffer(
sizeof(uint32_t) sizeof(uint32_t)
); );
*(uint32_t*)&buffer[0] = Endian::host_to_be(value.enterprise_number); uint32_t enterprise_number = Endian::host_to_be(value.enterprise_number);
std::memcpy(&buffer[0], &enterprise_number, sizeof(uint32_t));
Internals::class_option_data2option( Internals::class_option_data2option(
value.vendor_class_data.begin(), value.vendor_class_data.begin(),
value.vendor_class_data.end(), value.vendor_class_data.end(),
@@ -386,7 +396,8 @@ void DHCPv6::vendor_class(const vendor_class_type &value) {
void DHCPv6::vendor_info(const vendor_info_type &value) { void DHCPv6::vendor_info(const vendor_info_type &value) {
std::vector<uint8_t> buffer(sizeof(uint32_t) + value.data.size()); std::vector<uint8_t> buffer(sizeof(uint32_t) + value.data.size());
*(uint32_t*)&buffer[0] = Endian::host_to_be(value.enterprise_number); uint32_t enterprise_number = Endian::host_to_be(value.enterprise_number);
std::memcpy(&buffer[0], &enterprise_number, sizeof(uint32_t));
std::copy( std::copy(
value.data.begin(), value.data.begin(),
value.data.end(), value.data.end(),
@@ -422,9 +433,11 @@ DHCPv6::duid_llt DHCPv6::duid_llt::from_bytes(const uint8_t *buffer, uint32_t to
if(total_sz < sizeof(uint16_t) + sizeof(uint32_t) + 1) if(total_sz < sizeof(uint16_t) + sizeof(uint32_t) + 1)
throw std::runtime_error("Not enough size for a DUID_LLT identifier"); throw std::runtime_error("Not enough size for a DUID_LLT identifier");
duid_llt output; duid_llt output;
output.hw_type = Endian::be_to_host(*(const uint16_t*)buffer); std::memcpy(&output.hw_type, buffer, sizeof(uint16_t));
output.hw_type = Endian::be_to_host(output.hw_type);
buffer += sizeof(uint16_t); buffer += sizeof(uint16_t);
output.time = Endian::be_to_host(*(const uint32_t*)buffer); std::memcpy(&output.time, buffer, sizeof(uint32_t));
output.time = Endian::be_to_host(output.time);
buffer += sizeof(uint32_t); buffer += sizeof(uint32_t);
total_sz -= sizeof(uint16_t) + sizeof(uint32_t); total_sz -= sizeof(uint16_t) + sizeof(uint32_t);
output.lladdress.assign(buffer, buffer + total_sz); output.lladdress.assign(buffer, buffer + total_sz);
@@ -433,8 +446,10 @@ DHCPv6::duid_llt DHCPv6::duid_llt::from_bytes(const uint8_t *buffer, uint32_t to
PDU::serialization_type DHCPv6::duid_llt::serialize() const { PDU::serialization_type DHCPv6::duid_llt::serialize() const {
serialization_type output(sizeof(uint16_t) + sizeof(uint32_t) + lladdress.size()); serialization_type output(sizeof(uint16_t) + sizeof(uint32_t) + lladdress.size());
*(uint16_t*)&output[0] = Endian::host_to_be(hw_type); uint16_t tmp_hw_type = Endian::host_to_be(hw_type);
*(uint32_t*)&output[sizeof(uint16_t)] = Endian::host_to_be(time); uint32_t tmp_time = Endian::host_to_be(time);
std::memcpy(&output[0], &tmp_hw_type, sizeof(uint16_t));
std::memcpy(&output[sizeof(uint16_t)], &tmp_time, sizeof(uint32_t));
std::copy( std::copy(
lladdress.begin(), lladdress.begin(),
lladdress.end(), lladdress.end(),
@@ -449,7 +464,8 @@ DHCPv6::duid_en DHCPv6::duid_en::from_bytes(const uint8_t *buffer, uint32_t tota
if(total_sz < sizeof(uint32_t) + 1) if(total_sz < sizeof(uint32_t) + 1)
throw std::runtime_error("Not enough size for a DUID_en identifier"); throw std::runtime_error("Not enough size for a DUID_en identifier");
duid_en output; duid_en output;
output.enterprise_number = Endian::be_to_host(*(const uint32_t*)buffer); std::memcpy(&output.enterprise_number, buffer, sizeof(uint32_t));
output.enterprise_number = Endian::be_to_host(output.enterprise_number);
buffer += sizeof(uint32_t); buffer += sizeof(uint32_t);
total_sz -= sizeof(uint32_t); total_sz -= sizeof(uint32_t);
output.identifier.assign(buffer, buffer + total_sz); output.identifier.assign(buffer, buffer + total_sz);
@@ -458,7 +474,8 @@ DHCPv6::duid_en DHCPv6::duid_en::from_bytes(const uint8_t *buffer, uint32_t tota
PDU::serialization_type DHCPv6::duid_en::serialize() const { PDU::serialization_type DHCPv6::duid_en::serialize() const {
serialization_type output(sizeof(uint32_t) + identifier.size()); serialization_type output(sizeof(uint32_t) + identifier.size());
*(uint32_t*)&output[0] = Endian::host_to_be(enterprise_number); uint32_t tmp_enterprise_number = Endian::host_to_be(enterprise_number);
std::memcpy(&output[0], &tmp_enterprise_number, sizeof(uint32_t));
std::copy( std::copy(
identifier.begin(), identifier.begin(),
identifier.end(), identifier.end(),
@@ -473,7 +490,8 @@ DHCPv6::duid_ll DHCPv6::duid_ll::from_bytes(const uint8_t *buffer, uint32_t tota
if(total_sz < sizeof(uint16_t) + 1) if(total_sz < sizeof(uint16_t) + 1)
throw std::runtime_error("Not enough size for a DUID_en identifier"); throw std::runtime_error("Not enough size for a DUID_en identifier");
duid_ll output; duid_ll output;
output.hw_type = Endian::be_to_host(*(const uint16_t*)buffer); std::memcpy(&output.hw_type, buffer, sizeof(uint16_t));
output.hw_type = Endian::be_to_host(output.hw_type);
buffer += sizeof(uint16_t); buffer += sizeof(uint16_t);
total_sz -= sizeof(uint16_t); total_sz -= sizeof(uint16_t);
output.lladdress.assign(buffer, buffer + total_sz); output.lladdress.assign(buffer, buffer + total_sz);
@@ -482,7 +500,8 @@ DHCPv6::duid_ll DHCPv6::duid_ll::from_bytes(const uint8_t *buffer, uint32_t tota
PDU::serialization_type DHCPv6::duid_ll::serialize() const { PDU::serialization_type DHCPv6::duid_ll::serialize() const {
serialization_type output(sizeof(uint16_t) + lladdress.size()); serialization_type output(sizeof(uint16_t) + lladdress.size());
*(uint16_t*)&output[0] = Endian::host_to_be(hw_type); uint16_t tmp_hw_type = Endian::host_to_be(hw_type);
std::memcpy(&output[0], &tmp_hw_type, sizeof(uint16_t));
std::copy( std::copy(
lladdress.begin(), lladdress.begin(),
lladdress.end(), lladdress.end(),
@@ -493,7 +512,8 @@ PDU::serialization_type DHCPv6::duid_ll::serialize() const {
void DHCPv6::client_id(const duid_type &value) { void DHCPv6::client_id(const duid_type &value) {
serialization_type buffer(sizeof(uint16_t) + value.data.size()); serialization_type buffer(sizeof(uint16_t) + value.data.size());
*(uint16_t*)&buffer[0] = Endian::host_to_be(value.id); uint16_t tmp_id = Endian::host_to_be(value.id);
std::memcpy(&buffer[0], &tmp_id, sizeof(uint16_t));
std::copy( std::copy(
value.data.begin(), value.data.begin(),
value.data.end(), value.data.end(),
@@ -506,7 +526,8 @@ void DHCPv6::client_id(const duid_type &value) {
void DHCPv6::server_id(const duid_type &value) { void DHCPv6::server_id(const duid_type &value) {
serialization_type buffer(sizeof(uint16_t) + value.data.size()); serialization_type buffer(sizeof(uint16_t) + value.data.size());
*(uint16_t*)&buffer[0] = Endian::host_to_be(value.id); uint16_t tmp_id = Endian::host_to_be(value.id);
std::memcpy(&buffer[0], &tmp_id, sizeof(uint16_t));
std::copy( std::copy(
value.data.begin(), value.data.begin(),
value.data.end(), value.data.end(),
@@ -568,9 +589,8 @@ DHCPv6::authentication_type DHCPv6::authentication_type::from_option(const optio
output.protocol = *ptr++; output.protocol = *ptr++;
output.algorithm = *ptr++; output.algorithm = *ptr++;
output.rdm = *ptr++; output.rdm = *ptr++;
output.replay_detection = Endian::be_to_host( std::memcpy(&output.replay_detection, ptr, sizeof(uint64_t));
*(const uint64_t*)ptr output.replay_detection = Endian::be_to_host(output.replay_detection);
);
ptr += sizeof(uint64_t); ptr += sizeof(uint64_t);
output.auth_info.assign(ptr, opt.data_ptr() + opt.data_size()); output.auth_info.assign(ptr, opt.data_ptr() + opt.data_size());
return output; return output;
@@ -581,7 +601,8 @@ DHCPv6::status_code_type DHCPv6::status_code_type::from_option(const option &opt
if(opt.data_size() < sizeof(uint16_t)) if(opt.data_size() < sizeof(uint16_t))
throw malformed_option(); throw malformed_option();
status_code_type output; status_code_type output;
output.code = Endian::be_to_host(*(const uint16_t*)opt.data_ptr()); std::memcpy(&output.code, opt.data_ptr(), sizeof(uint16_t));
output.code = Endian::be_to_host(output.code);
output.message.assign( output.message.assign(
opt.data_ptr() + sizeof(uint16_t), opt.data_ptr() + sizeof(uint16_t),
opt.data_ptr() + opt.data_size() opt.data_ptr() + opt.data_size()
@@ -594,9 +615,8 @@ DHCPv6::vendor_info_type DHCPv6::vendor_info_type::from_option(const option &opt
if(opt.data_size() < sizeof(uint32_t)) if(opt.data_size() < sizeof(uint32_t))
throw malformed_option(); throw malformed_option();
vendor_info_type output; vendor_info_type output;
output.enterprise_number = Endian::be_to_host( std::memcpy(&output.enterprise_number, opt.data_ptr(), sizeof(uint32_t));
*(const uint32_t*)opt.data_ptr() output.enterprise_number = Endian::be_to_host(output.enterprise_number);
);
output.data.assign( output.data.assign(
opt.data_ptr() + sizeof(uint32_t), opt.data_ptr() + sizeof(uint32_t),
opt.data_ptr() + opt.data_size() opt.data_ptr() + opt.data_size()
@@ -610,9 +630,8 @@ DHCPv6::vendor_class_type DHCPv6::vendor_class_type::from_option(const option &o
throw malformed_option(); throw malformed_option();
typedef vendor_class_type::class_data_type data_type; typedef vendor_class_type::class_data_type data_type;
vendor_class_type output; vendor_class_type output;
output.enterprise_number = Endian::be_to_host( std::memcpy(&output.enterprise_number, opt.data_ptr(), sizeof(uint32_t));
*(const uint32_t*)opt.data_ptr() output.enterprise_number = Endian::be_to_host(output.enterprise_number);
);
output.vendor_class_data = Internals::option2class_option_data<data_type>( output.vendor_class_data = Internals::option2class_option_data<data_type>(
opt.data_ptr() + sizeof(uint32_t), opt.data_ptr() + sizeof(uint32_t),
opt.data_size() - sizeof(uint32_t) opt.data_size() - sizeof(uint32_t)
@@ -625,8 +644,11 @@ DHCPv6::duid_type DHCPv6::duid_type::from_option(const option &opt)
{ {
if(opt.data_size() < sizeof(uint16_t) + 1) if(opt.data_size() < sizeof(uint16_t) + 1)
throw malformed_option(); throw malformed_option();
uint16_t uint16_t_buffer;
std::memcpy(&uint16_t_buffer, opt.data_ptr(), sizeof(uint16_t));
return duid_type( return duid_type(
Endian::be_to_host(*(const uint16_t*)opt.data_ptr()), Endian::be_to_host(uint16_t_buffer),
serialization_type( serialization_type(
opt.data_ptr() + sizeof(uint16_t), opt.data_ptr() + sizeof(uint16_t),
opt.data_ptr() + opt.data_size() opt.data_ptr() + opt.data_size()

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -97,12 +97,14 @@ const uint8_t* DNS::find_dname_end(const uint8_t *ptr) const {
const uint8_t *DNS::find_section_end(const uint8_t *ptr, const uint32_t num_records) const { const uint8_t *DNS::find_section_end(const uint8_t *ptr, const uint32_t num_records) const {
const uint8_t *end = &records_data[0] + records_data.size(); const uint8_t *end = &records_data[0] + records_data.size();
uint16_t uint16_t_buffer;
for(uint32_t i = 0; i < num_records; ++i) { for(uint32_t i = 0; i < num_records; ++i) {
ptr = find_dname_end(ptr); ptr = find_dname_end(ptr);
if(ptr + sizeof(uint16_t) * 3 + sizeof(uint32_t) > end) if(ptr + sizeof(uint16_t) * 3 + sizeof(uint32_t) > end)
throw malformed_packet(); throw malformed_packet();
ptr += sizeof(uint16_t) * 2 + sizeof(uint32_t); ptr += sizeof(uint16_t) * 2 + sizeof(uint32_t);
uint16_t data_size = Endian::be_to_host(*(uint16_t*)ptr); // Data size std::memcpy(&uint16_t_buffer, ptr, sizeof(uint16_t));
uint16_t data_size = Endian::be_to_host(uint16_t_buffer); // Data size
ptr += sizeof(uint16_t); ptr += sizeof(uint16_t);
if(ptr + data_size > end) if(ptr + data_size > end)
throw malformed_packet(); throw malformed_packet();
@@ -168,8 +170,11 @@ void DNS::add_query(const Query &query) {
string new_str = encode_domain_name(query.dname()); string new_str = encode_domain_name(query.dname());
// Type (2 bytes) + Class (2 Bytes) // Type (2 bytes) + Class (2 Bytes)
new_str.insert(new_str.end(), sizeof(uint16_t) * 2, ' '); new_str.insert(new_str.end(), sizeof(uint16_t) * 2, ' ');
*(uint16_t*)&new_str[new_str.size() - 4] = Endian::host_to_be<uint16_t>(query.type()); uint16_t uint16_t_buffer;
*(uint16_t*)&new_str[new_str.size() - 2] = Endian::host_to_be<uint16_t>(query.query_class()); uint16_t_buffer = Endian::host_to_be<uint16_t>(query.type());
std::memcpy(&new_str[new_str.size() - 4], &uint16_t_buffer, sizeof(uint16_t));
uint16_t_buffer = Endian::host_to_be<uint16_t>(query.query_class());
std::memcpy(&new_str[new_str.size() - 2], &uint16_t_buffer, sizeof(uint16_t));
uint32_t offset = new_str.size(), threshold = answers_idx; uint32_t offset = new_str.size(), threshold = answers_idx;
update_records(answers_idx, answers_count(), threshold, offset); update_records(answers_idx, answers_count(), threshold, offset);
@@ -235,15 +240,23 @@ void DNS::add_record(const Resource &resource, const sections_type &sections) {
buffer.end(), buffer.end(),
&records_data[threshold] &records_data[threshold]
); );
*(uint16_t*)ptr = Endian::host_to_be(resource.type());
uint16_t uint16_t_buffer;
uint32_t uint32_t_buffer;
uint16_t_buffer = Endian::host_to_be(resource.type());
std::memcpy(ptr, &uint16_t_buffer, sizeof(uint16_t));
ptr += sizeof(uint16_t); ptr += sizeof(uint16_t);
*(uint16_t*)ptr = Endian::host_to_be(resource.query_class()); uint16_t_buffer = Endian::host_to_be(resource.query_class());
std::memcpy(ptr, &uint16_t_buffer, sizeof(uint16_t));
ptr += sizeof(uint16_t); ptr += sizeof(uint16_t);
*(uint32_t*)ptr = Endian::host_to_be(resource.ttl()); uint32_t_buffer = Endian::host_to_be(resource.ttl());
std::memcpy(ptr, &uint32_t_buffer, sizeof(uint32_t));
ptr += sizeof(uint32_t); ptr += sizeof(uint32_t);
*(uint16_t*)ptr = Endian::host_to_be<uint16_t>( uint16_t_buffer = Endian::host_to_be<uint16_t>(
data_size + (resource.type() == MX ? 2 : 0) data_size + (resource.type() == MX ? 2 : 0)
); );
std::memcpy(ptr, &uint16_t_buffer, sizeof(uint16_t));
ptr += sizeof(uint16_t); ptr += sizeof(uint16_t);
if(resource.type() == MX) { if(resource.type() == MX) {
ptr += sizeof(uint16_t); ptr += sizeof(uint16_t);
@@ -305,7 +318,9 @@ const uint8_t* DNS::compose_name(const uint8_t *ptr, char *out_ptr) const {
if((*ptr & 0xc0)) { if((*ptr & 0xc0)) {
if(ptr + sizeof(uint16_t) > end) if(ptr + sizeof(uint16_t) > end)
throw malformed_packet(); throw malformed_packet();
uint16_t index = Endian::be_to_host(*(uint16_t*)ptr) & 0x3fff; uint16_t index;
std::memcpy(&index, ptr, sizeof(uint16_t));
index = Endian::be_to_host(index) & 0x3fff;
// Check that the offset is neither too low or too high // Check that the offset is neither too low or too high
if(index < 0x0c || &records_data[index - 0x0c] >= ptr) if(index < 0x0c || &records_data[index - 0x0c] >= ptr)
throw malformed_packet(); throw malformed_packet();
@@ -376,13 +391,17 @@ void DNS::convert_records(const uint8_t *ptr, const uint8_t *end, resources_type
// Retrieve the following fields. // Retrieve the following fields.
uint16_t type, qclass, data_size; uint16_t type, qclass, data_size;
uint32_t ttl; uint32_t ttl;
type = Endian::be_to_host(*(uint16_t*)ptr); // Type std::memcpy(&type, ptr, sizeof(uint16_t)); // Type
type = Endian::be_to_host(type);
ptr += sizeof(uint16_t); ptr += sizeof(uint16_t);
qclass = Endian::be_to_host(*(uint16_t*)ptr); // Class std::memcpy(&qclass, ptr, sizeof(uint16_t)); // Class
qclass = Endian::be_to_host(qclass);
ptr += sizeof(uint16_t); ptr += sizeof(uint16_t);
ttl = Endian::be_to_host(*(uint32_t*)ptr); // TTL std::memcpy(&ttl, ptr, sizeof(uint32_t)); // TTL
ttl = Endian::be_to_host(ttl);
ptr += sizeof(uint32_t); ptr += sizeof(uint32_t);
data_size = Endian::be_to_host(*(uint16_t*)ptr); // Data size std::memcpy(&data_size, ptr, sizeof(uint16_t)); // Data size
data_size = Endian::be_to_host(data_size);
ptr += sizeof(uint16_t); ptr += sizeof(uint16_t);
// Skip the preference field if it's MX // Skip the preference field if it's MX
if(type == MX) { if(type == MX) {
@@ -393,6 +412,7 @@ void DNS::convert_records(const uint8_t *ptr, const uint8_t *end, resources_type
} }
if(ptr + data_size > end) if(ptr + data_size > end)
throw malformed_packet(); throw malformed_packet();
switch(type) { switch(type) {
case AAAA: case AAAA:
if(data_size != 16) if(data_size != 16)
@@ -400,10 +420,14 @@ void DNS::convert_records(const uint8_t *ptr, const uint8_t *end, resources_type
addr = IPv6Address(ptr).to_string(); addr = IPv6Address(ptr).to_string();
break; break;
case A: case A:
if(data_size != 4) if(data_size == 4) {
uint32_t uint32_t_buffer;
std::memcpy(&uint32_t_buffer, ptr, sizeof(uint32_t));
inline_convert_v4(uint32_t_buffer, small_addr_buf);
used_small_buffer = true;
}
else
throw malformed_packet(); throw malformed_packet();
inline_convert_v4(*(uint32_t*)ptr, small_addr_buf);
used_small_buffer = true;
break; break;
case NS: case NS:
case CNAME: case CNAME:
@@ -414,12 +438,14 @@ void DNS::convert_records(const uint8_t *ptr, const uint8_t *end, resources_type
used_small_buffer = true; used_small_buffer = true;
break; break;
default: default:
if(data_size <= 256) { if(data_size < sizeof(small_addr_buf) - 1) {
std::copy( std::copy(
ptr, ptr,
ptr + data_size, ptr + data_size,
small_addr_buf small_addr_buf
); );
// null terminator
small_addr_buf[data_size] = 0;
used_small_buffer = true; used_small_buffer = true;
} }
else else
@@ -443,9 +469,12 @@ void DNS::convert_records(const uint8_t *ptr, const uint8_t *end, resources_type
uint8_t *DNS::update_dname(uint8_t *ptr, uint32_t threshold, uint32_t offset) { uint8_t *DNS::update_dname(uint8_t *ptr, uint32_t threshold, uint32_t offset) {
while(*ptr != 0) { while(*ptr != 0) {
if((*ptr & 0xc0)) { if((*ptr & 0xc0)) {
uint16_t index = Endian::be_to_host(*(uint16_t*)ptr) & 0x3fff; uint16_t index;
std::memcpy(&index, ptr, sizeof(uint16_t));
index = Endian::be_to_host(index) & 0x3fff;
if(index > threshold) { if(index > threshold) {
*(uint16_t*)ptr = Endian::host_to_be<uint16_t>((index + offset) | 0xc000); index = Endian::host_to_be<uint16_t>((index + offset) | 0xc000);
std::memcpy(ptr, &index, sizeof(uint16_t));
} }
ptr += sizeof(uint16_t); ptr += sizeof(uint16_t);
break; break;
@@ -463,9 +492,13 @@ void DNS::update_records(uint32_t &section_start, uint32_t num_records, uint32_t
uint8_t *ptr = &records_data[section_start]; uint8_t *ptr = &records_data[section_start];
for(uint32_t i = 0; i < num_records; ++i) { for(uint32_t i = 0; i < num_records; ++i) {
ptr = update_dname(ptr, threshold, offset); ptr = update_dname(ptr, threshold, offset);
uint16_t type = Endian::be_to_host(*(const uint16_t*)ptr); uint16_t type;
std::memcpy(&type, ptr, sizeof(uint16_t));
type = Endian::be_to_host(type);
ptr += sizeof(uint16_t) * 2 + sizeof(uint32_t); ptr += sizeof(uint16_t) * 2 + sizeof(uint32_t);
uint16_t size = Endian::be_to_host(*(uint16_t*)ptr); uint16_t size;
std::memcpy(&size, ptr, sizeof(uint16_t));
size = Endian::be_to_host(size);
ptr += sizeof(uint16_t); ptr += sizeof(uint16_t);
if(type == MX) { if(type == MX) {
ptr += sizeof(uint16_t); ptr += sizeof(uint16_t);
@@ -483,15 +516,19 @@ DNS::queries_type DNS::queries() const {
queries_type output; queries_type output;
const uint8_t *ptr = &records_data[0], *end = &records_data[answers_idx]; const uint8_t *ptr = &records_data[0], *end = &records_data[answers_idx];
char buffer[256]; char buffer[256];
uint16_t tmp_query_type;
uint16_t tmp_query_class;
while(ptr < end) { while(ptr < end) {
ptr = compose_name(ptr, buffer); ptr = compose_name(ptr, buffer);
if(ptr + sizeof(uint16_t) * 2 > end) if(ptr + sizeof(uint16_t) * 2 > end)
throw malformed_packet(); throw malformed_packet();
std::memcpy(&tmp_query_type, ptr, sizeof(uint16_t));
std::memcpy(&tmp_query_class, ptr + 2, sizeof(uint16_t));
output.push_back( output.push_back(
Query( Query(
buffer, buffer,
(QueryType)Endian::be_to_host(*(const uint16_t*)ptr), (QueryType)Endian::be_to_host(tmp_query_type),
(QueryClass)Endian::be_to_host(*(const uint16_t*)(ptr + 2)) (QueryClass)Endian::be_to_host(tmp_query_class)
) )
); );
ptr += sizeof(uint16_t) * 2; ptr += sizeof(uint16_t) * 2;

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -250,4 +250,4 @@ uint32_t Dot11ReAssocResponse::write_fixed_parameters(uint8_t *buffer, uint32_t
} }
} // namespace Tins } // namespace Tins
#endif // HAVE_DOT11 #endif // HAVE_DOT11

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -124,4 +124,4 @@ uint32_t Dot11Deauthentication::write_fixed_parameters(uint8_t *buffer, uint32_t
} }
} // namespace Tins } // namespace Tins
#endif // HAVE_DOT11 #endif // HAVE_DOT11

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -276,4 +276,4 @@ Dot11 *Dot11::from_bytes(const uint8_t *buffer, uint32_t total_sz) {
} }
} // namespace Tins } // namespace Tins
#endif // HAVE_DOT11 #endif // HAVE_DOT11

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -80,4 +80,4 @@ uint32_t Dot11Beacon::write_fixed_parameters(uint8_t *buffer, uint32_t total_sz)
} }
} // namespace Tins } // namespace Tins
#endif // HAVE_DOT11 #endif // HAVE_DOT11

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -284,4 +284,4 @@ uint32_t Dot11BlockAck::header_size() const {
} }
} // namespace Tins } // namespace Tins
#endif // HAVE_DOT11 #endif // HAVE_DOT11

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -153,7 +153,7 @@ Dot11QoSData::Dot11QoSData(const uint8_t *buffer, uint32_t total_sz)
total_sz -= sz; total_sz -= sz;
if(total_sz < sizeof(_qos_control)) if(total_sz < sizeof(_qos_control))
throw malformed_packet(); throw malformed_packet();
_qos_control = *(uint16_t*)buffer; std::memcpy(&_qos_control, buffer, sizeof(uint16_t));
total_sz -= sizeof(uint16_t); total_sz -= sizeof(uint16_t);
buffer += sizeof(uint16_t); buffer += sizeof(uint16_t);
if(total_sz) { if(total_sz) {
@@ -178,9 +178,9 @@ uint32_t Dot11QoSData::write_fixed_parameters(uint8_t *buffer, uint32_t total_sz
#ifdef TINS_DEBUG #ifdef TINS_DEBUG
assert(sz <= total_sz); assert(sz <= total_sz);
#endif #endif
*(uint16_t*)buffer = this->_qos_control; std::memcpy(buffer, &this->_qos_control, sizeof(uint16_t));
return sz; return sz;
} }
} // namespace Tins } // namespace Tins
#endif // HAVE_DOT11 #endif // HAVE_DOT11

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -120,7 +120,7 @@ void Dot11ManagementFrame::rsn_information(const RSNInformation& info) {
uint8_t *Dot11ManagementFrame::serialize_rates(const rates_type &rates) { uint8_t *Dot11ManagementFrame::serialize_rates(const rates_type &rates) {
uint8_t *buffer = new uint8_t[rates.size()], *ptr = buffer; uint8_t *buffer = new uint8_t[rates.size()], *ptr = buffer;
for(rates_type::const_iterator it = rates.begin(); it != rates.end(); ++it) { for(rates_type::const_iterator it = rates.begin(); it != rates.end(); ++it) {
uint8_t result = *it * 2; uint8_t result = static_cast<uint8_t>(*it * 2);
if(result == 2 || result == 4 || result == 11 || result == 22) if(result == 2 || result == 4 || result == 11 || result == 22)
result |= 0x80; result |= 0x80;
*(ptr++) = result; *(ptr++) = result;
@@ -496,7 +496,7 @@ Dot11ManagementFrame::fh_params_set Dot11ManagementFrame::fh_params_set::from_op
if(opt.data_size() != 5) if(opt.data_size() != 5)
throw malformed_option(); throw malformed_option();
fh_params_set output; fh_params_set output;
output.dwell_time = Endian::le_to_host(*(uint16_t*)opt.data_ptr()); std::memcpy(&output.dwell_time, opt.data_ptr(), sizeof(uint16_t));
output.hop_set = opt.data_ptr()[2]; output.hop_set = opt.data_ptr()[2];
output.hop_pattern = opt.data_ptr()[3]; output.hop_pattern = opt.data_ptr()[3];
output.hop_index = opt.data_ptr()[4]; output.hop_index = opt.data_ptr()[4];
@@ -510,8 +510,8 @@ Dot11ManagementFrame::cf_params_set Dot11ManagementFrame::cf_params_set::from_op
cf_params_set output; cf_params_set output;
output.cfp_count = *opt.data_ptr(); output.cfp_count = *opt.data_ptr();
output.cfp_period = opt.data_ptr()[1]; output.cfp_period = opt.data_ptr()[1];
output.cfp_max_duration = Endian::le_to_host(*(uint16_t*)&opt.data_ptr()[2]); std::memcpy(&output.cfp_max_duration, &opt.data_ptr()[2], sizeof(uint16_t));
output.cfp_dur_remaining = Endian::le_to_host(*(uint16_t*)&opt.data_ptr()[4]); std::memcpy(&output.cfp_dur_remaining, &opt.data_ptr()[4], sizeof(uint16_t));
return output; return output;
} }
@@ -601,9 +601,10 @@ Dot11ManagementFrame::bss_load_type Dot11ManagementFrame::bss_load_type::from_op
bss_load_type output; bss_load_type output;
const uint8_t *ptr = opt.data_ptr(); const uint8_t *ptr = opt.data_ptr();
output.station_count = Endian::le_to_host(*(uint16_t*)ptr); std::memcpy(&output.station_count, ptr, sizeof(uint16_t));
output.channel_utilization = ptr[2]; output.channel_utilization = ptr[2];
output.available_capacity = Endian::le_to_host(*(uint16_t*)(ptr + 3)); std::memcpy(&output.available_capacity, ptr + 3, sizeof(uint16_t));
output.available_capacity = Endian::le_to_host(output.available_capacity);
return output; return output;
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -99,4 +99,4 @@ uint32_t Dot11ProbeResponse::write_fixed_parameters(uint8_t *buffer, uint32_t to
} }
} // namespace Tins } // namespace Tins
#endif // HAVE_DOT11 #endif // HAVE_DOT11

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -103,7 +103,7 @@ void Dot1Q::write_serialization(uint8_t *buffer, uint32_t total_sz, const PDU *)
#ifdef TINS_DEBUG #ifdef TINS_DEBUG
assert(total_sz >= sizeof(_header) + trailer); assert(total_sz >= sizeof(_header) + trailer);
#endif #endif
if ((payload_type() == 0) && inner_pdu()) { if (inner_pdu()) {
Constants::Ethernet::e flag = Internals::pdu_flag_to_ether_type( Constants::Ethernet::e flag = Internals::pdu_flag_to_ether_type(
inner_pdu()->pdu_type() inner_pdu()->pdu_type()
); );

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -32,7 +32,7 @@
#include <cassert> #include <cassert>
#endif #endif
#include <stdexcept> #include <stdexcept>
#include <iostream> // borrame #include <algorithm>
#include "eapol.h" #include "eapol.h"
#include "rsn_information.h" #include "rsn_information.h"
#include "exceptions.h" #include "exceptions.h"

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Matias Fontanini * Copyright (c) 2014, Matias Fontanini
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -154,7 +154,7 @@ void EthernetII::write_serialization(uint8_t *buffer, uint32_t total_sz, const P
#endif #endif
/* Inner type defaults to IP */ /* Inner type defaults to IP */
if ((_eth.payload_type == 0) && inner_pdu()) { if (inner_pdu()) {
Constants::Ethernet::e flag = Internals::pdu_flag_to_ether_type( Constants::Ethernet::e flag = Internals::pdu_flag_to_ether_type(
inner_pdu()->pdu_type() inner_pdu()->pdu_type()
); );

Some files were not shown because too many files have changed in this diff Show More