mirror of
https://github.com/mfontanini/libtins
synced 2026-01-23 02:35:57 +01:00
Remove useless includes
This commit is contained in:
@@ -917,54 +917,8 @@ private:
|
||||
uint32_t options_size_;
|
||||
ipaddress_type link_addr_, peer_addr_;
|
||||
options_type options_;
|
||||
};
|
||||
};
|
||||
|
||||
namespace Internals {
|
||||
|
||||
template<typename InputIterator>
|
||||
void class_option_data2option(InputIterator start,
|
||||
InputIterator end,
|
||||
std::vector<uint8_t>& buffer,
|
||||
size_t start_index = 0) {
|
||||
size_t index = start_index;
|
||||
uint16_t uint16_t_buffer;
|
||||
while (start != end) {
|
||||
buffer.resize(buffer.size() + sizeof(uint16_t) + start->size());
|
||||
uint16_t_buffer = Endian::host_to_be(static_cast<uint16_t>(start->size()));
|
||||
std::memcpy(&buffer[index], &uint16_t_buffer, sizeof(uint16_t));
|
||||
index += sizeof(uint16_t);
|
||||
std::copy(start->begin(), start->end(), buffer.begin() + index);
|
||||
index += start->size();
|
||||
|
||||
start++;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename OutputType>
|
||||
OutputType option2class_option_data(const uint8_t* ptr, uint32_t total_sz) {
|
||||
typedef typename OutputType::value_type value_type;
|
||||
OutputType output;
|
||||
size_t index = 0;
|
||||
while (index + 2 < total_sz) {
|
||||
uint16_t size;
|
||||
std::memcpy(&size, ptr + index, sizeof(uint16_t));
|
||||
size = Endian::be_to_host(size);
|
||||
index += sizeof(uint16_t);
|
||||
if (index + size > total_sz) {
|
||||
throw option_not_found();
|
||||
}
|
||||
output.push_back(
|
||||
value_type(ptr + index, ptr + index + size)
|
||||
);
|
||||
index += size;
|
||||
}
|
||||
if (index != total_sz) {
|
||||
throw malformed_option();
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
} // Internals
|
||||
} // Tins
|
||||
|
||||
#endif // TINS_DHCPV6_H
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#ifndef TINS_SNAP_H
|
||||
#define TINS_SNAP_H
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
#include "pdu.h"
|
||||
#include "macros.h"
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdexcept>
|
||||
#include <cstring>
|
||||
#include "bootp.h"
|
||||
#include "exceptions.h"
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdexcept>
|
||||
#include <cstring>
|
||||
#include "endianness.h"
|
||||
#include "dhcp.h"
|
||||
|
||||
@@ -42,6 +42,55 @@ using Tins::Memory::OutputMemoryStream;
|
||||
|
||||
namespace Tins {
|
||||
|
||||
namespace Internals {
|
||||
|
||||
template<typename InputIterator>
|
||||
void class_option_data2option(InputIterator start,
|
||||
InputIterator end,
|
||||
vector<uint8_t>& buffer,
|
||||
size_t start_index = 0) {
|
||||
size_t index = start_index;
|
||||
uint16_t uint16_t_buffer;
|
||||
while (start != end) {
|
||||
buffer.resize(buffer.size() + sizeof(uint16_t) + start->size());
|
||||
uint16_t_buffer = Endian::host_to_be(static_cast<uint16_t>(start->size()));
|
||||
memcpy(&buffer[index], &uint16_t_buffer, sizeof(uint16_t));
|
||||
index += sizeof(uint16_t);
|
||||
if (!start->empty()) {
|
||||
memcpy(&*buffer.begin() + index, &*start->begin(), start->size());
|
||||
}
|
||||
index += start->size();
|
||||
|
||||
start++;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename OutputType>
|
||||
OutputType option2class_option_data(const uint8_t* ptr, uint32_t total_sz) {
|
||||
typedef typename OutputType::value_type value_type;
|
||||
OutputType output;
|
||||
size_t index = 0;
|
||||
while (index + 2 < total_sz) {
|
||||
uint16_t size;
|
||||
memcpy(&size, ptr + index, sizeof(uint16_t));
|
||||
size = Endian::be_to_host(size);
|
||||
index += sizeof(uint16_t);
|
||||
if (index + size > total_sz) {
|
||||
throw option_not_found();
|
||||
}
|
||||
output.push_back(
|
||||
value_type(ptr + index, ptr + index + size)
|
||||
);
|
||||
index += size;
|
||||
}
|
||||
if (index != total_sz) {
|
||||
throw malformed_option();
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
} // Internals
|
||||
|
||||
PDU::metadata DHCPv6::extract_metadata(const uint8_t* /*buffer*/, uint32_t total_sz) {
|
||||
if (TINS_UNLIKELY(total_sz < 2)) {
|
||||
throw malformed_packet();
|
||||
|
||||
@@ -28,9 +28,6 @@
|
||||
*/
|
||||
|
||||
#include <utility>
|
||||
#include <stdexcept>
|
||||
#include <sstream>
|
||||
#include <memory>
|
||||
#include <cstdio>
|
||||
#include "dns.h"
|
||||
#include "ip_address.h"
|
||||
@@ -40,7 +37,6 @@
|
||||
#include "memory_helpers.h"
|
||||
|
||||
using std::string;
|
||||
using std::copy;
|
||||
using std::memcpy;
|
||||
using std::list;
|
||||
using std::make_pair;
|
||||
@@ -372,7 +368,7 @@ uint32_t DNS::compose_name(const uint8_t* ptr, char* out_ptr) const {
|
||||
if (current_out_ptr != out_ptr) {
|
||||
*current_out_ptr++ = '.';
|
||||
}
|
||||
copy(ptr, ptr + size, current_out_ptr);
|
||||
memcpy(current_out_ptr, ptr, size);
|
||||
current_out_ptr += size;
|
||||
ptr += size;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdexcept>
|
||||
#include <cstring>
|
||||
#include "dot1q.h"
|
||||
#include "exceptions.h"
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
*/
|
||||
|
||||
#include <cstring>
|
||||
#include <stdexcept>
|
||||
#include "macros.h"
|
||||
#ifndef _WIN32
|
||||
#if defined(BSD) || defined(__FreeBSD_kernel__)
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
*/
|
||||
|
||||
#include <cstring>
|
||||
#include <stdexcept>
|
||||
#include "eapol.h"
|
||||
#include "exceptions.h"
|
||||
#include "rawpdu.h"
|
||||
|
||||
@@ -29,9 +29,9 @@
|
||||
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <stdexcept>
|
||||
#include <algorithm>
|
||||
#include "hw_address.h"
|
||||
#include "exceptions.h"
|
||||
|
||||
using std::string;
|
||||
using std::ostream;
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdexcept>
|
||||
#include <cstring>
|
||||
#ifndef _WIN32
|
||||
#include <netinet/in.h>
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdexcept>
|
||||
#include <cstring>
|
||||
#ifndef _WIN32
|
||||
#include <netdb.h>
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
// std::hash
|
||||
#include <memory>
|
||||
#endif // TINS_IS_CXX11
|
||||
#include <stdexcept>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
#include "ip_address.h"
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdexcept>
|
||||
#include <cstring>
|
||||
#include "llc.h"
|
||||
#include "stp.h"
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
#else
|
||||
#include <ws2tcpip.h>
|
||||
#endif
|
||||
#include <stdexcept>
|
||||
#include <cstring>
|
||||
#include "loopback.h"
|
||||
#include "packet_sender.h"
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string.h>
|
||||
#include "offline_packet_filter.h"
|
||||
#include "pdu.h"
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#ifndef _WIN32
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <stdexcept>
|
||||
#include <string.h>
|
||||
#include "packet_writer.h"
|
||||
#include "packet.h"
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdexcept>
|
||||
#include <cstring>
|
||||
#include "exceptions.h"
|
||||
#include "pktap.h"
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
|
||||
#include <cstring>
|
||||
#include <stdexcept>
|
||||
#include "macros.h"
|
||||
#ifndef _WIN32
|
||||
#if defined(BSD) || defined(__FreeBSD_kernel__)
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#ifdef TINS_HAVE_DOT11
|
||||
|
||||
#include <cstring>
|
||||
#include <stdexcept>
|
||||
#include "exceptions.h"
|
||||
#include "pdu.h"
|
||||
#include "pdu_option.h"
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdexcept>
|
||||
#include <cstring>
|
||||
#include "sll.h"
|
||||
#include "exceptions.h"
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
*/
|
||||
|
||||
#include <cstring>
|
||||
#include <stdexcept>
|
||||
#ifndef _WIN32
|
||||
#include <sys/types.h>
|
||||
#include <net/ethernet.h>
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdexcept>
|
||||
#include <cstring>
|
||||
#include "udp.h"
|
||||
#include "constants.h"
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
#include <iphlpapi.h>
|
||||
#undef interface
|
||||
#endif
|
||||
#include <stdexcept>
|
||||
#include "exceptions.h"
|
||||
#include "ip_address.h"
|
||||
#include "ipv6_address.h"
|
||||
#include "hw_address.h"
|
||||
|
||||
@@ -55,7 +55,6 @@
|
||||
#endif
|
||||
#include <set>
|
||||
#include <fstream>
|
||||
#include <stdexcept>
|
||||
#include "network_interface.h"
|
||||
#include "exceptions.h"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user