From 19ae1f366ba5e9963ed7c0de05fb5ba31b13fac9 Mon Sep 17 00:00:00 2001 From: Matias Fontanini Date: Sun, 30 Apr 2017 17:34:02 -0700 Subject: [PATCH] Remove useless includes --- include/tins/packet.h | 5 +++-- include/tins/tcp_ip/flow.h | 3 --- include/tins/tcp_stream.h | 1 - src/arp.cpp | 4 +--- src/dhcp.cpp | 5 ++--- src/dns.cpp | 1 - src/dot11/dot11_base.cpp | 9 +++------ src/eapol.cpp | 1 - src/ethernetII.cpp | 4 ---- src/hw_address.cpp | 29 +++++++++++++++++++++++++++++ src/ip_reassembler.cpp | 1 - src/ipv6.cpp | 1 - src/packet_sender.cpp | 1 - src/pdu.cpp | 1 - src/snap.cpp | 3 --- src/sniffer.cpp | 2 -- src/stp.cpp | 5 +---- src/tcp_ip/flow.cpp | 4 ---- src/tcp_ip/stream.cpp | 6 ------ src/tcp_ip/stream_follower.cpp | 7 ------- src/tcp_ip/stream_identifier.cpp | 8 ++++---- 21 files changed, 43 insertions(+), 58 deletions(-) diff --git a/include/tins/packet.h b/include/tins/packet.h index b96a2f1..01fc862 100644 --- a/include/tins/packet.h +++ b/include/tins/packet.h @@ -30,7 +30,6 @@ #ifndef TINS_PACKET_H #define TINS_PACKET_H -#include #include "cxxstd.h" #include "pdu.h" #include "timestamp.h" @@ -234,7 +233,9 @@ public: */ Packet& operator=(Packet &&rhs) TINS_NOEXCEPT { if (this != &rhs) { - std::swap(pdu_, rhs.pdu_); + PDU* tmp = std::move(pdu_); + pdu_ = std::move(rhs.pdu_); + rhs.pdu_ = std::move(tmp); ts_ = rhs.timestamp(); } return* this; diff --git a/include/tins/tcp_ip/flow.h b/include/tins/tcp_ip/flow.h index d157e13..9d250c3 100644 --- a/include/tins/tcp_ip/flow.h +++ b/include/tins/tcp_ip/flow.h @@ -34,12 +34,9 @@ #ifdef TINS_HAVE_TCPIP -#include #include -#include #include #include -#include "../hw_address.h" #include "../macros.h" #include "ack_tracker.h" #include "data_tracker.h" diff --git a/include/tins/tcp_stream.h b/include/tins/tcp_stream.h index eb0a838..eff9fcc 100644 --- a/include/tins/tcp_stream.h +++ b/include/tins/tcp_stream.h @@ -32,7 +32,6 @@ #include #include -#include #include #include #include diff --git a/src/arp.cpp b/src/arp.cpp index 80d11d8..f415d47 100644 --- a/src/arp.cpp +++ b/src/arp.cpp @@ -30,11 +30,9 @@ #include #include #include "arp.h" -#include "ip.h" #include "ethernetII.h" #include "rawpdu.h" #include "constants.h" -#include "network_interface.h" #include "exceptions.h" #include "memory_helpers.h" @@ -58,7 +56,7 @@ ARP::ARP(ipaddress_type target_ip, hw_addr_format((uint16_t)Constants::ARP::ETHER); prot_addr_format((uint16_t)Constants::Ethernet::IP); hw_addr_length(Tins::EthernetII::address_type::address_size); - prot_addr_length(Tins::IP::address_type::address_size); + prot_addr_length(4 /* IP address size */); sender_ip_addr(sender_ip); target_ip_addr(target_ip); sender_hw_addr(sender_hw); diff --git a/src/dhcp.cpp b/src/dhcp.cpp index 051e303..0ab03ef 100644 --- a/src/dhcp.cpp +++ b/src/dhcp.cpp @@ -32,7 +32,6 @@ #include #include "endianness.h" #include "dhcp.h" -#include "ethernetII.h" #include "exceptions.h" #include "memory_helpers.h" @@ -58,8 +57,8 @@ PDU::metadata DHCP::extract_metadata(const uint8_t* /*buffer*/, uint32_t total_s DHCP::DHCP() : size_(sizeof(uint32_t)) { opcode(BOOTREQUEST); - htype(1); //ethernet - hlen(EthernetII::address_type::address_size); + htype(1); // ethernet + hlen(6); // MAC address length } DHCP::DHCP(const uint8_t* buffer, uint32_t total_sz) diff --git a/src/dns.cpp b/src/dns.cpp index 1ccea4c..2ddc72c 100644 --- a/src/dns.cpp +++ b/src/dns.cpp @@ -36,7 +36,6 @@ #include "ip_address.h" #include "ipv6_address.h" #include "exceptions.h" -#include "rawpdu.h" #include "endianness.h" #include "memory_helpers.h" diff --git a/src/dot11/dot11_base.cpp b/src/dot11/dot11_base.cpp index 0417064..af359de 100644 --- a/src/dot11/dot11_base.cpp +++ b/src/dot11/dot11_base.cpp @@ -32,9 +32,7 @@ #ifdef TINS_HAVE_DOT11 #include -#include #include -#include #include "macros.h" #include "exceptions.h" @@ -49,12 +47,11 @@ #include #endif #include "dot11.h" -#include "rawpdu.h" -#include "rsn_information.h" #include "packet_sender.h" -#include "snap.h" #include "memory_helpers.h" +using std::list; + using Tins::Memory::InputMemoryStream; using Tins::Memory::OutputMemoryStream; @@ -218,7 +215,7 @@ void Dot11::write_serialization(uint8_t* buffer, uint32_t total_sz) { stream.write(header_); write_ext_header(stream); write_fixed_parameters(stream); - for (std::list