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

Merge branch 'develop'

This commit is contained in:
Matias Fontanini
2017-01-31 21:37:41 -08:00
36 changed files with 90 additions and 72 deletions

View File

@@ -1,9 +0,0 @@
# Below is a list of people and organizations that have contributed source
# code to libtins. Names are listed using the following format:
#
# Name/Organization <email address>
Matias Fontanini <matias.fontanini@gmail.com>
Santiago Alessandri <san.lt.ss@gmail.com>
Bruno Nery <brunonery@brunonery.com>
Piotr Haber <piotr.haber@sens.us>

View File

@@ -1,4 +1,4 @@
v3.4 - Wed Mar 9 20:24:54 PST 2016
##### v3.4 - Wed Mar 9 20:24:54 PST 2016
- Check the secure bit on HandshakeCapturer to detect 2nd packet
@@ -50,7 +50,7 @@ v3.4 - Wed Mar 9 20:24:54 PST 2016
- Fix invalid endian on IP fragment offset on OSX
v3.3 - Sun Jan 31 21:06:04 PST 2016
##### v3.3 - Sun Jan 31 21:06:04 PST 2016
- Add TCP connection close example
@@ -215,7 +215,7 @@ immutable
-------------------------------------------------------------------------------
v3.2 - Fri Mar 20 22:12:23 PST 2015
##### v3.2 - Fri Mar 20 22:12:23 PST 2015
- Added include guard for config.h.
@@ -298,7 +298,7 @@ conversion on integral constant.
-------------------------------------------------------------------------------
v3.1 - Sun Aug 24 21:39:43 ART 2014
##### v3.1 - Sun Aug 24 21:39:43 ART 2014
- Fixed ICMPv6 checksum error on serialization.
@@ -308,7 +308,7 @@ v3.1 - Sun Aug 24 21:39:43 ART 2014
-------------------------------------------------------------------------------
v3.0 - Thu Aug 7 21:39:09 ART 2014
##### v3.0 - Thu Aug 7 21:39:09 ART 2014
- Timestamps can now be constructed from std::chrono::duration.
@@ -373,7 +373,7 @@ PDU types.
-------------------------------------------------------------------------------
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
DNS::Resource.
@@ -429,7 +429,7 @@ capture size.
-------------------------------------------------------------------------------
v1.2 - Mon oct 7 23:33:49 ART 2013
##### v1.2 - Mon oct 7 23:33:49 ART 2013
- Added BaseSniffer::begin and BaseSniffer::end.
@@ -525,7 +525,7 @@ that used them.
-------------------------------------------------------------------------------
v0.3 - Thu Jan 31 16:47:27 ART 2013
##### v0.3 - Thu Jan 31 16:47:27 ART 2013
- Added IPv6, ICMPv6 and DHCPv6 classes.
@@ -546,7 +546,7 @@ pseudo protocol.
-------------------------------------------------------------------------------
v0.2 - Sat Oct 20 11:26:40 2012
##### v0.2 - Sat Oct 20 11:26:40 2012
- Added support for big endian architectures.

View File

@@ -18,7 +18,7 @@ IF(MSVC)
ADD_DEFINITIONS("-D_SCL_SECURE_NO_WARNINGS=1")
ADD_DEFINITIONS("-DNOGDI=1")
ELSE()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
ENDIF()
IF(APPLE)

View File

@@ -56,6 +56,8 @@ struct smart_ptr {
typedef std::auto_ptr<T> type;
#endif
};
template<class T> void unused(const T&) { }
}
}

View File

@@ -508,8 +508,8 @@ public:
*/
static Dot11* from_bytes(const uint8_t* buffer, uint32_t total_sz);
protected:
virtual void write_ext_header(Memory::OutputMemoryStream& stream) { }
virtual void write_fixed_parameters(Memory::OutputMemoryStream& stream) { }
virtual void write_ext_header(Memory::OutputMemoryStream& stream);
virtual void write_fixed_parameters(Memory::OutputMemoryStream& stream);
void parse_tagged_parameters(Memory::InputMemoryStream& stream);
void add_tagged_option(OptionTypes opt, uint8_t len, const uint8_t* val);
protected:

View File

@@ -269,7 +269,7 @@ public:
*
* This effectively returns the address_size constant.
*/
const size_t size() const {
size_t size() const {
return address_size;
}

View File

@@ -353,7 +353,7 @@ public:
*/
template<typename T>
const T* find_pdu(PDUType type = T::pdu_flag) const {
return const_cast<PDU*>(this)->find_pdu<T>();
return const_cast<PDU*>(this)->find_pdu<T>(type);
}
/**
@@ -381,7 +381,7 @@ public:
*/
template<typename T>
const T& rfind_pdu(PDUType type = T::pdu_flag) const {
return const_cast<PDU*>(this)->rfind_pdu<T>();
return const_cast<PDU*>(this)->rfind_pdu<T>(type);
}
/**
@@ -433,9 +433,7 @@ public:
* \param ptr The pointer to the buffer.
* \param total_sz The size of the buffer.
*/
virtual bool matches_response(const uint8_t* ptr, uint32_t total_sz) const {
return false;
}
virtual bool matches_response(const uint8_t* ptr, uint32_t total_sz) const;
/**
* \brief Check whether this PDU matches the specified flag.
@@ -485,7 +483,7 @@ protected:
*
* \param parent The parent PDU.
*/
virtual void prepare_for_serialize(const PDU* parent) { }
virtual void prepare_for_serialize(const PDU* parent);
/**
* \brief Serializes this PDU and propagates this action to child PDUs.

View File

@@ -43,7 +43,7 @@ using Tins::Memory::OutputMemoryStream;
namespace Tins {
PDU::metadata ARP::extract_metadata(const uint8_t *buffer, uint32_t total_sz) {
PDU::metadata ARP::extract_metadata(const uint8_t* /*buffer*/, uint32_t total_sz) {
if (TINS_UNLIKELY(total_sz < sizeof(arp_header))) {
throw malformed_packet();
}

View File

@@ -115,7 +115,7 @@ void BootP::vend(const vend_type& newvend_) {
vend_ = newvend_;
}
void BootP::write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* parent) {
void BootP::write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* /*parent*/) {
OutputMemoryStream stream(buffer, total_sz);
stream.write(bootp_);
stream.write(vend_.begin(), vend_.end());

View File

@@ -47,7 +47,7 @@ using Tins::Memory::OutputMemoryStream;
namespace Tins {
PDU::metadata DHCP::extract_metadata(const uint8_t *buffer, uint32_t total_sz) {
PDU::metadata DHCP::extract_metadata(const uint8_t* /*buffer*/, uint32_t total_sz) {
if (TINS_UNLIKELY(total_sz < sizeof(bootp_header))) {
throw malformed_packet();
}

View File

@@ -45,7 +45,7 @@ using Tins::Memory::OutputMemoryStream;
namespace Tins {
PDU::metadata DHCPv6::extract_metadata(const uint8_t *buffer, uint32_t total_sz) {
PDU::metadata DHCPv6::extract_metadata(const uint8_t* /*buffer*/, uint32_t total_sz) {
if (TINS_UNLIKELY(total_sz < 2)) {
throw malformed_packet();
}

View File

@@ -51,8 +51,8 @@ using Tins::Memory::OutputMemoryStream;
namespace Tins {
PDU::metadata DNS::extract_metadata(const uint8_t *buffer, uint32_t total_sz) {
if (TINS_UNLIKELY(sizeof(dns_header))) {
PDU::metadata DNS::extract_metadata(const uint8_t* /*buffer*/, uint32_t total_sz) {
if (TINS_UNLIKELY(total_sz < sizeof(dns_header))) {
throw malformed_packet();
}
return metadata(total_sz, pdu_flag, PDU::UNKNOWN);
@@ -386,7 +386,7 @@ uint32_t DNS::compose_name(const uint8_t* ptr, char* out_ptr) const {
return end_ptr - start_ptr;
}
void DNS::write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* parent) {
void DNS::write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* /*parent*/) {
OutputMemoryStream stream(buffer, total_sz);
stream.write(header_);
stream.write(records_data_.begin(), records_data_.end());

View File

@@ -67,9 +67,8 @@ Dot11::Dot11(const address_type& dst_hw_addr)
addr1(dst_hw_addr);
}
Dot11::Dot11(const dot11_header* header_ptr)
Dot11::Dot11(const dot11_header* /*header_ptr*/)
: header_(), options_size_(0) {
}
Dot11::Dot11(const uint8_t* buffer, uint32_t total_sz)
@@ -78,6 +77,12 @@ Dot11::Dot11(const uint8_t* buffer, uint32_t total_sz)
stream.read(header_);
}
void Dot11::write_ext_header(Memory::OutputMemoryStream& /*stream*/) {
}
void Dot11::write_fixed_parameters(Memory::OutputMemoryStream& /*stream*/) {
}
void Dot11::parse_tagged_parameters(InputMemoryStream& stream) {
if (stream) {
while (stream.size() >= 2) {
@@ -208,7 +213,7 @@ void Dot11::send(PacketSender& sender, const NetworkInterface& iface) {
}
#endif // _WIN32
void Dot11::write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* parent) {
void Dot11::write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* /*parent*/) {
OutputMemoryStream stream(buffer, total_sz);
stream.write(header_);
write_ext_header(stream);

View File

@@ -39,7 +39,7 @@ using Tins::Memory::OutputMemoryStream;
namespace Tins {
PDU::metadata Dot1Q::extract_metadata(const uint8_t *buffer, uint32_t total_sz) {
PDU::metadata Dot1Q::extract_metadata(const uint8_t* /*buffer*/, uint32_t total_sz) {
if (TINS_UNLIKELY(total_sz < sizeof(dot1q_header))) {
throw malformed_packet();
}

View File

@@ -56,7 +56,7 @@ namespace Tins {
const Dot3::address_type Dot3::BROADCAST("ff:ff:ff:ff:ff:ff");
PDU::metadata Dot3::extract_metadata(const uint8_t *buffer, uint32_t total_sz) {
PDU::metadata Dot3::extract_metadata(const uint8_t* /*buffer*/, uint32_t total_sz) {
if (TINS_UNLIKELY(total_sz < sizeof(dot3_header))) {
throw malformed_packet();
}
@@ -134,7 +134,7 @@ bool Dot3::matches_response(const uint8_t* ptr, uint32_t total_sz) const {
return false;
}
void Dot3::write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* parent) {
void Dot3::write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* /*parent*/) {
OutputMemoryStream stream(buffer, total_sz);
header_.length = Endian::host_to_be<uint16_t>(size() - sizeof(header_));
stream.write(header_);

View File

@@ -161,7 +161,7 @@ bool EthernetII::matches_response(const uint8_t* ptr, uint32_t total_sz) const {
return false;
}
void EthernetII::write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* parent) {
void EthernetII::write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* /*parent*/) {
OutputMemoryStream stream(buffer, total_sz);
if (inner_pdu()) {
Constants::Ethernet::e flag;

View File

@@ -46,7 +46,7 @@ using Tins::Memory::OutputMemoryStream;
namespace Tins {
PDU::metadata ICMP::extract_metadata(const uint8_t *buffer, uint32_t total_sz) {
PDU::metadata ICMP::extract_metadata(const uint8_t* /*buffer*/, uint32_t total_sz) {
if (TINS_UNLIKELY(total_sz < sizeof(icmp_header))) {
throw malformed_packet();
}

View File

@@ -450,6 +450,8 @@ void IP::write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* pare
total_sz = Endian::host_to_be<uint16_t>(total_sz);
header_.frag_off = Endian::be_to_host(header_.frag_off);
}
#else
Internals::unused(parent);
#endif
tot_len(total_sz);
head_len(static_cast<uint8_t>(header_size() / sizeof(uint32_t)));

View File

@@ -70,7 +70,7 @@ PDU::metadata IPv6::extract_metadata(const uint8_t *buffer, uint32_t total_sz) {
return metadata(header_size, pdu_flag, PDU::UNKNOWN);
}
IPv6::IPv6(address_type ip_dst, address_type ip_src, PDU* child)
IPv6::IPv6(address_type ip_dst, address_type ip_src, PDU* /*child*/)
: header_(), headers_size_(0) {
version(6);
dst_addr(ip_dst);
@@ -243,7 +243,7 @@ bool IPv6::matches_response(const uint8_t* ptr, uint32_t total_sz) const {
return false;
}
void IPv6::write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* parent) {
void IPv6::write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* /*parent*/) {
OutputMemoryStream stream(buffer, total_sz);
if (inner_pdu()) {
uint8_t new_flag = Internals::pdu_flag_to_ip_type(inner_pdu()->pdu_type());

View File

@@ -196,7 +196,7 @@ void LLC::clear_information_fields() {
information_fields_.clear();
}
void LLC::write_serialization(uint8_t* buffer, uint32_t total_sz, const Tins::PDU* parent) {
void LLC::write_serialization(uint8_t* buffer, uint32_t total_sz, const Tins::PDU* /*parent*/) {
OutputMemoryStream stream(buffer, total_sz);
if (inner_pdu() && inner_pdu()->pdu_type() == PDU::STP) {
dsap(0x42);

View File

@@ -28,6 +28,7 @@
*/
#include <stdexcept>
#include <string.h>
#include "offline_packet_filter.h"
#include "pdu.h"
#include "exceptions.h"
@@ -64,7 +65,8 @@ void OfflinePacketFilter::init(const string& pcap_filter,
}
bool OfflinePacketFilter::matches_filter(const uint8_t* buffer, uint32_t total_sz) const {
pcap_pkthdr header = {};
pcap_pkthdr header;
memset(&header, 0, sizeof(header));
header.len = total_sz;
header.caplen = total_sz;
return pcap_offline_filter(&filter_, &header, buffer) != 0;

View File

@@ -156,6 +156,7 @@ bool PacketSender::ether_socket_initialized(const NetworkInterface& iface) const
#if defined(BSD) || defined(__FreeBSD_kernel__)
return ether_socket_.count(iface.id());
#else
Internals::unused(iface);
return ether_socket_ != INVALID_RAW_SOCKET;
#endif
}
@@ -234,6 +235,7 @@ void PacketSender::open_l2_socket(const NetworkInterface& iface) {
}
ether_socket_[iface.id()] = sock;
#else
Internals::unused(iface);
if (ether_socket_ == INVALID_RAW_SOCKET) {
ether_socket_ = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
@@ -284,6 +286,7 @@ void PacketSender::close_socket(SocketType type, const NetworkInterface& iface)
}
ether_socket_.erase(it);
#elif !defined(_WIN32)
Internals::unused(iface);
if (ether_socket_ == INVALID_RAW_SOCKET) {
throw invalid_socket_type();
}
@@ -294,6 +297,7 @@ void PacketSender::close_socket(SocketType type, const NetworkInterface& iface)
#endif
}
else {
Internals::unused(iface);
if (type >= SOCKETS_END || sockets_[type] == INVALID_RAW_SOCKET) {
throw invalid_socket_type();
}
@@ -354,6 +358,8 @@ void PacketSender::send_l2(PDU& pdu,
PDU::serialization_type buffer = pdu.serialize();
#ifdef TINS_HAVE_PACKET_SENDER_PCAP_SENDPACKET
Internals::unused(len_addr);
Internals::unused(link_addr);
open_l2_socket(iface);
pcap_t* handle = pcap_handles_[iface];
const int buf_size = static_cast<int>(buffer.size());

View File

@@ -31,6 +31,7 @@
#include <sys/time.h>
#endif
#include <stdexcept>
#include <string.h>
#include "packet_writer.h"
#include "packet.h"
#include "pdu.h"
@@ -71,11 +72,11 @@ void PacketWriter::write(Packet& packet) {
void PacketWriter::write(PDU& pdu, const struct timeval& tv) {
PDU::serialization_type buffer = pdu.serialize();
struct pcap_pkthdr header = {
tv,
static_cast<bpf_u_int32>(buffer.size()),
static_cast<bpf_u_int32>(buffer.size())
};
struct pcap_pkthdr header;
memset(&header, 0, sizeof(header));
header.ts = tv;
header.caplen = static_cast<bpf_u_int32>(buffer.size());
header.len = static_cast<bpf_u_int32>(buffer.size());
pcap_dump((u_char*)dumper_, &header, &buffer[0]);
}

View File

@@ -73,6 +73,9 @@ void PDU::copy_inner_pdu(const PDU& pdu) {
}
}
void PDU::prepare_for_serialize(const PDU* /*parent*/) {
}
uint32_t PDU::size() const {
uint32_t sz = header_size() + trailer_size();
const PDU* ptr(inner_pdu_);
@@ -91,6 +94,10 @@ PDU* PDU::recv_response(PacketSender &, const NetworkInterface &) {
return 0;
}
bool PDU::matches_response(const uint8_t* /*ptr*/, uint32_t /*total_sz*/) const {
return false;
}
void PDU::inner_pdu(PDU* next_pdu) {
delete inner_pdu_;
inner_pdu_ = next_pdu;

View File

@@ -65,7 +65,7 @@ uint32_t PKTAP::header_size() const {
return sizeof(header_);
}
void PKTAP::write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* parent) {
void PKTAP::write_serialization(uint8_t* /*buffer*/, uint32_t /*total_sz*/, const PDU* /*parent*/) {
throw pdu_not_serializable();
}

View File

@@ -94,7 +94,7 @@ uint32_t PPI::header_size() const {
return static_cast<uint32_t>(sizeof(header_) + data_.size());
}
void PPI::write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU *) {
void PPI::write_serialization(uint8_t* /*buffer*/, uint32_t /*total_sz*/, const PDU *) {
throw pdu_not_serializable();
}

View File

@@ -507,7 +507,7 @@ bool RadioTap::matches_response(const uint8_t* ptr, uint32_t total_sz) const {
return false;
}
void RadioTap::write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* parent) {
void RadioTap::write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* /*parent*/) {
OutputMemoryStream stream(buffer, total_sz);
uint8_t* buffer_start = buffer;
radio_.it_len = Endian::host_to_le<uint16_t>(header_size());

View File

@@ -57,7 +57,7 @@ void RawPDU::payload(const payload_type& pload) {
payload_ = pload;
}
bool RawPDU::matches_response(const uint8_t* ptr, uint32_t total_sz) const {
bool RawPDU::matches_response(const uint8_t* /*ptr*/, uint32_t /*total_sz*/) const {
return true;
}

View File

@@ -91,7 +91,7 @@ uint32_t SNAP::header_size() const {
return sizeof(snap_);
}
void SNAP::write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* parent) {
void SNAP::write_serialization(uint8_t* buffer, uint32_t total_sz, const PDU* /*parent*/) {
OutputMemoryStream stream(buffer, total_sz);
if (inner_pdu()) {
Constants::Ethernet::e flag = Internals::pdu_flag_to_ether_type(

View File

@@ -356,6 +356,8 @@ void Sniffer::set_immediate_mode(bool enabled) {
if (pcap_set_immediate_mode(get_pcap_handle(), enabled)) {
throw pcap_error(pcap_geterr(get_pcap_handle()));
}
#else
Internals::unused(enabled);
#endif // HAVE_PCAP_IMMEDIATE_MODE
}
@@ -366,6 +368,8 @@ void Sniffer::set_timestamp_precision(int value) {
if (result == PCAP_ERROR_TSTAMP_PRECISION_NOTSUP) {
throw pcap_error("Timestamp precision not supported");
}
#else
Internals::unused(value);
#endif // HAVE_PCAP_TIMESTAMP_PRECISION
}

View File

@@ -309,13 +309,13 @@ void Stream::on_server_flow_data(const Flow& /*flow*/) {
}
}
void Stream::on_client_out_of_order(const Flow& flow, uint32_t seq, const payload_type& payload) {
void Stream::on_client_out_of_order(const Flow& /*flow*/, uint32_t seq, const payload_type& payload) {
if (on_client_out_of_order_callback_) {
on_client_out_of_order_callback_(*this, seq, payload);
}
}
void Stream::on_server_out_of_order(const Flow& flow, uint32_t seq, const payload_type& payload) {
void Stream::on_server_out_of_order(const Flow& /*flow*/, uint32_t seq, const payload_type& payload) {
if (on_server_out_of_order_callback_) {
on_server_out_of_order_callback_(*this, seq, payload);
}

View File

@@ -156,7 +156,7 @@ void TCPStream::safe_insert(fragments_type& frags, uint32_t seq, RawPDU* raw) {
}
bool TCPStream::generic_process(uint32_t& my_seq,
uint32_t& other_seq,
uint32_t& /*other_seq*/,
payload_type& pload,
fragments_type& frags,
TCP* tcp) {

View File

@@ -43,7 +43,7 @@ using Tins::Memory::OutputMemoryStream;
namespace Tins {
PDU::metadata UDP::extract_metadata(const uint8_t *buffer, uint32_t total_sz) {
PDU::metadata UDP::extract_metadata(const uint8_t* /*buffer*/, uint32_t total_sz) {
if (TINS_UNLIKELY(total_sz < sizeof(udp_header))) {
throw malformed_packet();
}

View File

@@ -654,7 +654,7 @@ TEST_F(ICMPv6Test, ExtensionsParsingWithoutALengthField) {
const uint8_t ext[] = { 0, 8, 1, 1, 24, 150, 1, 1 };
ICMPv6 icmp(packet_with_extensions, sizeof(packet_with_extensions));
ICMPExtensionsStructure extensions = icmp.extensions();
ASSERT_EQ(1, extensions.extensions().size());
ASSERT_EQ(1U, extensions.extensions().size());
EXPECT_EQ(
ICMPExtension::payload_type(ext, ext + sizeof(ext)),
extensions.extensions().begin()->serialize()
@@ -673,7 +673,7 @@ TEST_F(ICMPv6Test, ExtensionsParsingWithALengthField) {
const uint8_t ext[] = { 0, 8, 1, 1, 24, 150, 1, 1 };
ICMPv6 icmp(packet_with_extensions_and_length, sizeof(packet_with_extensions_and_length));
ICMPExtensionsStructure extensions = icmp.extensions();
ASSERT_EQ(1, extensions.extensions().size());
ASSERT_EQ(1U, extensions.extensions().size());
EXPECT_EQ(
ICMPExtension::payload_type(ext, ext + sizeof(ext)),
extensions.extensions().begin()->serialize()

View File

@@ -136,7 +136,7 @@ void FlowTest::cumulative_stream_server_data_handler(Stream& stream) {
stream_server_payload_chunks.push_back(stream.server_flow().payload());
}
void FlowTest::out_of_order_handler(Flow& session, uint32_t seq, Flow::payload_type payload) {
void FlowTest::out_of_order_handler(Flow& /*session*/, uint32_t seq, Flow::payload_type payload) {
flow_out_of_order_chunks.push_back(make_pair(seq, move(payload)));
}
@@ -777,11 +777,11 @@ TEST_F(AckTrackerTest, AckingTcp_Sack2) {
tracker.process_packet(make_tcp_ack(5));
EXPECT_EQ(4U, tracker.acked_intervals().size());
EXPECT_EQ(5, tracker.ack_number());
EXPECT_EQ(5U, tracker.ack_number());
tracker.process_packet(make_tcp_ack(15));
EXPECT_EQ(0U, tracker.acked_intervals().size());
EXPECT_EQ(15, tracker.ack_number());
EXPECT_EQ(15U, tracker.ack_number());
}
TEST_F(AckTrackerTest, AckingTcp_Sack3) {
@@ -803,16 +803,16 @@ TEST_F(AckTrackerTest, AckingTcp_SackOutOfOrder1) {
AckTracker tracker(0, true);
tracker.process_packet(make_tcp_ack(10));
tracker.process_packet(make_tcp_ack(0, make_pair(9, 12)));
EXPECT_EQ(0, tracker.acked_intervals().size());
EXPECT_EQ(11, tracker.ack_number());
EXPECT_EQ(0U, tracker.acked_intervals().size());
EXPECT_EQ(11U, tracker.ack_number());
}
TEST_F(AckTrackerTest, AckingTcp_SackOutOfOrder2) {
AckTracker tracker(0, true);
tracker.process_packet(make_tcp_ack(10));
tracker.process_packet(make_tcp_ack(0, make_pair(10, 12)));
EXPECT_EQ(0, tracker.acked_intervals().size());
EXPECT_EQ(11, tracker.ack_number());
EXPECT_EQ(0U, tracker.acked_intervals().size());
EXPECT_EQ(11U, tracker.ack_number());
}
TEST_F(FlowTest, AckNumbersAreCorrect) {

View File

@@ -339,7 +339,7 @@ TEST_F(WPA2DecryptTest, HandshakeCapturedCallback) {
decrypter.decrypt(radio);
}
ASSERT_EQ(2, handshakes_.size());
ASSERT_EQ(2U, handshakes_.size());
handshake hs = handshakes_[0];
EXPECT_EQ(hs.ssid, "Coherer");
EXPECT_EQ(address_type("00:0d:93:82:36:3a"), hs.client_hw);
@@ -367,7 +367,7 @@ TEST_F(WPA2DecryptTest, AccessPointFoundCallback) {
decrypter.decrypt(radio);
}
ASSERT_EQ(2, access_points_.size());
ASSERT_EQ(2U, access_points_.size());
ap_data data = access_points_[0];
EXPECT_EQ("Coherer", data.ssid);
EXPECT_EQ(address_type("00:0c:41:82:b2:55"), data.bssid);