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

Remove useless includes

This commit is contained in:
Matias Fontanini
2017-04-30 17:34:02 -07:00
parent a9747a349a
commit 19ae1f366b
21 changed files with 43 additions and 58 deletions

View File

@@ -30,7 +30,6 @@
#ifndef TINS_PACKET_H
#define TINS_PACKET_H
#include <algorithm>
#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;

View File

@@ -34,12 +34,9 @@
#ifdef TINS_HAVE_TCPIP
#include <vector>
#include <array>
#include <map>
#include <functional>
#include <stdint.h>
#include "../hw_address.h"
#include "../macros.h"
#include "ack_tracker.h"
#include "data_tracker.h"

View File

@@ -32,7 +32,6 @@
#include <map>
#include <utility>
#include <iterator>
#include <vector>
#include <algorithm>
#include <stdint.h>

View File

@@ -30,11 +30,9 @@
#include <cstring>
#include <algorithm>
#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);

View File

@@ -32,7 +32,6 @@
#include <algorithm>
#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)

View File

@@ -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"

View File

@@ -32,9 +32,7 @@
#ifdef TINS_HAVE_DOT11
#include <cstring>
#include <stdexcept>
#include <algorithm>
#include <utility>
#include "macros.h"
#include "exceptions.h"
@@ -49,12 +47,11 @@
#include <netinet/in.h>
#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<option>::const_iterator it = options_.begin(); it != options_.end(); ++it) {
for (list<option>::const_iterator it = options_.begin(); it != options_.end(); ++it) {
stream.write<uint8_t>(it->option());
stream.write<uint8_t>(it->length_field());
stream.write(it->data_ptr(), it->data_size());

View File

@@ -31,7 +31,6 @@
#include <stdexcept>
#include <algorithm>
#include "eapol.h"
#include "rsn_information.h"
#include "exceptions.h"
#include "rawpdu.h"
#include "memory_helpers.h"

View File

@@ -42,11 +42,7 @@
#include "ethernetII.h"
#include "config.h"
#include "packet_sender.h"
#include "rawpdu.h"
#include "pppoe.h"
#include "ip.h"
#include "ipv6.h"
#include "arp.h"
#include "constants.h"
#include "exceptions.h"
#include "memory_helpers.h"

View File

@@ -1,3 +1,32 @@
/*
* Copyright (c) 2017, 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 <sstream>
#include <iomanip>
#include <stdexcept>

View File

@@ -28,7 +28,6 @@
*/
#include "ip.h"
#include "rawpdu.h"
#include "constants.h"
#include "ip_reassembler.h"
#include "detail/pdu_helpers.h"

View File

@@ -43,7 +43,6 @@
#include "pdu_allocator.h"
#include "memory_helpers.h"
#include "detail/pdu_helpers.h"
#include "pdu_allocator.h"
using std::copy;

View File

@@ -57,7 +57,6 @@
#include <algorithm>
#include "pdu.h"
#include "macros.h"
#include "network_interface.h"
// PDUs required by PacketSender::send(PDU&, NetworkInterface)
#include "ethernetII.h"
#include "radiotap.h"

View File

@@ -28,7 +28,6 @@
*/
#include "pdu.h"
#include "rawpdu.h"
#include "packet_sender.h"
using std::swap;

View File

@@ -35,9 +35,6 @@
#endif
#include "snap.h"
#include "constants.h"
#include "arp.h"
#include "ip.h"
#include "eapol.h"
#include "exceptions.h"
#include "memory_helpers.h"
#include "detail/pdu_helpers.h"

View File

@@ -33,8 +33,6 @@
#define TINS_PREFIX_INTERFACE(x) (x)
#endif // _WIN32
#include <algorithm>
#include <sstream>
#include "sniffer.h"
#include "dot11/dot11_base.h"
#include "ethernetII.h"

View File

@@ -28,13 +28,10 @@
*/
#include <cstring>
#include <algorithm>
#include "stp.h"
#include "exceptions.h"
#include "memory_helpers.h"
using std::copy;
using Tins::Memory::InputMemoryStream;
using Tins::Memory::OutputMemoryStream;
@@ -128,7 +125,7 @@ STP::bpdu_id_type STP::convert(const pvt_bpdu_id& id) {
STP::pvt_bpdu_id STP::convert(const bpdu_id_type& id) {
pvt_bpdu_id result;
result.priority = id.priority;
copy(id.id.begin(), id.id.end(), result.id);
id.id.copy(result.id);
#if TINS_IS_LITTLE_ENDIAN
result.ext_id = (id.ext_id >> 8) & 0xf;
result.ext_idL = id.ext_id & 0xff;

View File

@@ -32,8 +32,6 @@
#ifdef TINS_HAVE_TCPIP
#include <limits>
#include <algorithm>
#include "memory.h"
#include "ip_address.h"
#include "ipv6_address.h"
#include "tcp.h"
@@ -49,8 +47,6 @@ using std::bind;
using std::pair;
using std::runtime_error;
using std::numeric_limits;
using std::max;
using std::swap;
using Tins::Memory::OutputMemoryStream;
using Tins::Memory::InputMemoryStream;

View File

@@ -32,7 +32,6 @@
#ifdef TINS_HAVE_TCPIP
#include <limits>
#include <algorithm>
#include "memory.h"
#include "ip_address.h"
#include "ipv6_address.h"
@@ -42,18 +41,13 @@
#include "ethernetII.h"
#include "rawpdu.h"
#include "exceptions.h"
#include "memory_helpers.h"
using std::make_pair;
using std::bind;
using std::pair;
using std::runtime_error;
using std::numeric_limits;
using std::max;
using std::swap;
using Tins::Memory::OutputMemoryStream;
using Tins::Memory::InputMemoryStream;
namespace Tins {
namespace TCPIP {

View File

@@ -32,7 +32,6 @@
#ifdef TINS_HAVE_TCPIP
#include <limits>
#include <algorithm>
#include "memory.h"
#include "ip_address.h"
#include "ipv6_address.h"
@@ -42,22 +41,16 @@
#include "rawpdu.h"
#include "packet.h"
#include "exceptions.h"
#include "memory_helpers.h"
using std::make_pair;
using std::bind;
using std::pair;
using std::runtime_error;
using std::numeric_limits;
using std::max;
using std::swap;
using std::chrono::system_clock;
using std::chrono::minutes;
using std::chrono::duration_cast;
using Tins::Memory::OutputMemoryStream;
using Tins::Memory::InputMemoryStream;
namespace Tins {
namespace TCPIP {

View File

@@ -112,11 +112,11 @@ StreamIdentifier StreamIdentifier::make_identifier(const PDU& packet) {
StreamIdentifier StreamIdentifier::make_identifier(const Stream& stream) {
if (stream.is_v6()) {
return StreamIdentifier(serialize(stream.client_addr_v6()), stream.client_port(),
serialize(stream.server_addr_v6()), stream.server_port());
return StreamIdentifier(serialize(stream.client_addr_v6()), stream.client_port(),
serialize(stream.server_addr_v6()), stream.server_port());
} else {
return StreamIdentifier(serialize(stream.client_addr_v4()), stream.client_port(),
serialize(stream.server_addr_v4()), stream.server_port());
return StreamIdentifier(serialize(stream.client_addr_v4()), stream.client_port(),
serialize(stream.server_addr_v4()), stream.server_port());
}
}