1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-28 12:44:25 +01:00

Remove useless includes

This commit is contained in:
Matias Fontanini
2017-05-13 10:43:29 -07:00
parent 3c2f40ec02
commit 1a83801722
25 changed files with 53 additions and 74 deletions

View File

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

View File

@@ -30,7 +30,6 @@
#ifndef TINS_SNAP_H
#define TINS_SNAP_H
#include <stdint.h>
#include "pdu.h"
#include "macros.h"