mirror of
https://github.com/mfontanini/libtins
synced 2026-01-27 12:14:26 +01:00
Allow disabling pcap packet capture
This commit is contained in:
@@ -28,4 +28,7 @@
|
||||
/* Have WPA2Decrypter callbacks */
|
||||
#cmakedefine TINS_HAVE_WPA2_CALLBACKS
|
||||
|
||||
/* Have libpcap */
|
||||
#cmakedefine TINS_HAVE_PCAP
|
||||
|
||||
#endif // TINS_CONFIG_H
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "constants.h"
|
||||
#include "pdu.h"
|
||||
#include "hw_address.h"
|
||||
#include "macros.h"
|
||||
|
||||
/**
|
||||
* \cond
|
||||
@@ -124,8 +125,10 @@ PDU* pdu_from_flag(Constants::Ethernet::e flag, const uint8_t* buffer,
|
||||
uint32_t size, bool rawpdu_on_no_match = true);
|
||||
PDU* pdu_from_flag(Constants::IP::e flag, const uint8_t* buffer,
|
||||
uint32_t size, bool rawpdu_on_no_match = true);
|
||||
#ifdef TINS_HAVE_PCAP
|
||||
PDU* pdu_from_dlt_flag(int flag, const uint8_t* buffer,
|
||||
uint32_t size, bool rawpdu_on_no_match = true);
|
||||
#endif // TINS_HAVE_PCAP
|
||||
PDU* pdu_from_flag(PDU::PDUType type, const uint8_t* buffer, uint32_t size);
|
||||
|
||||
Constants::Ethernet::e pdu_flag_to_ether_type(PDU::PDUType flag);
|
||||
|
||||
@@ -32,9 +32,12 @@
|
||||
|
||||
#include <string>
|
||||
#include <stdint.h>
|
||||
#include "data_link_type.h"
|
||||
#include "macros.h"
|
||||
|
||||
#ifdef TINS_HAVE_PCAP
|
||||
|
||||
#include "data_link_type.h"
|
||||
|
||||
namespace Tins {
|
||||
|
||||
class PDU;
|
||||
@@ -154,6 +157,9 @@ private:
|
||||
mutable bpf_program filter_;
|
||||
std::string string_filter_;
|
||||
};
|
||||
|
||||
} // Tins
|
||||
|
||||
#endif // TINS_HAVE_PCAP
|
||||
|
||||
#endif // TINS_OFFLINE_PACKET_FILTER_H
|
||||
|
||||
@@ -33,11 +33,13 @@
|
||||
#include "utils.h"
|
||||
#include <string>
|
||||
#include <iterator>
|
||||
#include <pcap.h>
|
||||
#include "data_link_type.h"
|
||||
#include "macros.h"
|
||||
#include "cxxstd.h"
|
||||
|
||||
#ifdef TINS_HAVE_PCAP
|
||||
#include <pcap.h>
|
||||
#include "data_link_type.h"
|
||||
|
||||
struct timeval;
|
||||
|
||||
namespace Tins {
|
||||
@@ -220,6 +222,9 @@ private:
|
||||
pcap_t* handle_;
|
||||
pcap_dumper_t* dumper_;
|
||||
};
|
||||
}
|
||||
|
||||
} // Tins
|
||||
|
||||
#endif // TINS_HAVE_PCAP
|
||||
|
||||
#endif // TINS_PACKET_WRITER_H
|
||||
|
||||
@@ -33,6 +33,9 @@
|
||||
#include "pdu.h"
|
||||
#include "macros.h"
|
||||
|
||||
// This class is only available if pcap is enabled
|
||||
#ifdef TINS_HAVE_PCAP
|
||||
|
||||
namespace Tins {
|
||||
|
||||
/**
|
||||
@@ -111,4 +114,6 @@ private:
|
||||
|
||||
} // Tins
|
||||
|
||||
#endif // TINS_HAVE_PCAP
|
||||
|
||||
#endif // TINS_PKTAP_H
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
#include "endianness.h"
|
||||
#include "small_uint.h"
|
||||
|
||||
#ifdef TINS_HAVE_PCAP
|
||||
|
||||
namespace Tins {
|
||||
|
||||
/**
|
||||
@@ -135,6 +137,9 @@ private:
|
||||
ppi_header header_;
|
||||
byte_array data_;
|
||||
};
|
||||
}
|
||||
|
||||
} // Tins
|
||||
|
||||
#endif // TINS_HAVE_PCAP
|
||||
|
||||
#endif // TINS_PPI_H
|
||||
|
||||
@@ -31,8 +31,6 @@
|
||||
#ifndef TINS_SNIFFER_H
|
||||
#define TINS_SNIFFER_H
|
||||
|
||||
|
||||
#include <pcap.h>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
@@ -44,6 +42,10 @@
|
||||
#include "exceptions.h"
|
||||
#include "internals.h"
|
||||
|
||||
#ifdef TINS_HAVE_PCAP
|
||||
|
||||
#include <pcap.h>
|
||||
|
||||
namespace Tins {
|
||||
class SnifferIterator;
|
||||
class SnifferConfiguration;
|
||||
@@ -645,4 +647,6 @@ void Tins::BaseSniffer::sniff_loop(Functor function, uint32_t max_packets) {
|
||||
|
||||
} // Tins
|
||||
|
||||
#endif // TINS_HAVE_PCAP
|
||||
|
||||
#endif // TINS_SNIFFER_H
|
||||
|
||||
@@ -36,13 +36,16 @@
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <stdint.h>
|
||||
#include "sniffer.h"
|
||||
#include "macros.h"
|
||||
#include "tcp.h"
|
||||
#include "utils.h"
|
||||
#include "ip.h"
|
||||
#include "ip_address.h"
|
||||
|
||||
#ifdef TINS_HAVE_PCAP
|
||||
|
||||
#include "sniffer.h"
|
||||
|
||||
namespace Tins {
|
||||
class Sniffer;
|
||||
class RawPDU;
|
||||
@@ -385,4 +388,6 @@ bool TCPStreamFollower::callback(PDU& pdu,
|
||||
|
||||
} // Tins
|
||||
|
||||
#endif // TINS_HAVE_PCAP
|
||||
|
||||
#endif // TINS_TCP_STREAM_H
|
||||
|
||||
Reference in New Issue
Block a user