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:
@@ -14,8 +14,7 @@ INCLUDE_DIRECTORIES(
|
||||
${PCAP_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
ADD_LIBRARY(
|
||||
tins ${LIBTINS_TYPE}
|
||||
set(SOURCES
|
||||
arp.cpp
|
||||
bootp.cpp
|
||||
handshake_capturer.cpp
|
||||
@@ -43,19 +42,14 @@ ADD_LIBRARY(
|
||||
loopback.cpp
|
||||
mpls.cpp
|
||||
network_interface.cpp
|
||||
offline_packet_filter.cpp
|
||||
packet_sender.cpp
|
||||
packet_writer.cpp
|
||||
ppi.cpp
|
||||
pdu.cpp
|
||||
pktap.cpp
|
||||
radiotap.cpp
|
||||
address_range.cpp
|
||||
rawpdu.cpp
|
||||
rsn_information.cpp
|
||||
sll.cpp
|
||||
snap.cpp
|
||||
sniffer.cpp
|
||||
tcp.cpp
|
||||
tcp_ip/ack_tracker.cpp
|
||||
tcp_ip/flow.cpp
|
||||
@@ -63,7 +57,6 @@ ADD_LIBRARY(
|
||||
tcp_ip/stream.cpp
|
||||
tcp_ip/stream_follower.cpp
|
||||
tcp_ip/stream_identifier.cpp
|
||||
tcp_stream.cpp
|
||||
timestamp.cpp
|
||||
udp.cpp
|
||||
utils.cpp
|
||||
@@ -77,9 +70,28 @@ ADD_LIBRARY(
|
||||
dot11/dot11_control.cpp
|
||||
)
|
||||
|
||||
SET(PCAP_DEPENDENT_SOURCES
|
||||
sniffer.cpp
|
||||
packet_writer.cpp
|
||||
pktap.cpp
|
||||
tcp_stream.cpp
|
||||
offline_packet_filter.cpp
|
||||
ppi.cpp
|
||||
)
|
||||
|
||||
IF(LIBTINS_ENABLE_PCAP)
|
||||
message(STATUS "SETTING TO ${PCAP_DEPENDENT_SOURCES}")
|
||||
SET(SOURCES ${SOURCES} ${PCAP_DEPENDENT_SOURCES})
|
||||
ENDIF()
|
||||
|
||||
ADD_LIBRARY(
|
||||
tins ${LIBTINS_TYPE}
|
||||
${SOURCES}
|
||||
)
|
||||
|
||||
TARGET_LINK_LIBRARIES(tins ${PCAP_LIBRARY} ${OPENSSL_LIBRARIES} ${LIBTINS_OS_LIBS})
|
||||
|
||||
SET_TARGET_PROPERTIES(tins PROPERTIES OUTPUT_NAME tins )
|
||||
SET_TARGET_PROPERTIES(tins PROPERTIES OUTPUT_NAME tins)
|
||||
SET_TARGET_PROPERTIES(tins PROPERTIES VERSION ${LIBTINS_VERSION} SOVERSION ${LIBTINS_VERSION} )
|
||||
|
||||
# Install instructions for this target
|
||||
|
||||
@@ -28,7 +28,9 @@
|
||||
*/
|
||||
|
||||
#include "internals.h"
|
||||
#include <pcap.h>
|
||||
#ifdef TINS_HAVE_PCAP
|
||||
#include <pcap.h>
|
||||
#endif // TINS_HAVE_PCAP
|
||||
#include "ip.h"
|
||||
#include "ethernetII.h"
|
||||
#include "ieee802_3.h"
|
||||
@@ -179,6 +181,7 @@ Tins::PDU* pdu_from_flag(Constants::IP::e flag,
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef TINS_HAVE_PCAP
|
||||
PDU* pdu_from_dlt_flag(int flag,
|
||||
const uint8_t* buffer,
|
||||
uint32_t size,
|
||||
@@ -208,6 +211,7 @@ PDU* pdu_from_dlt_flag(int flag,
|
||||
return rawpdu_on_no_match ? new RawPDU(buffer, size) : 0;
|
||||
};
|
||||
}
|
||||
#endif // TINS_HAVE_PCAP
|
||||
|
||||
Tins::PDU* pdu_from_flag(PDU::PDUType type, const uint8_t* buffer, uint32_t size) {
|
||||
switch(type) {
|
||||
|
||||
Reference in New Issue
Block a user