Merging upstream version 2.3.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
678fe22a2c
commit
248a2fcec1
101 changed files with 2349 additions and 847 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Author Jerry Lundström <jerry@dns-oarc.net>
|
||||
* Copyright (c) 2016-2017, OARC, Inc.
|
||||
* Copyright (c) 2016-2025 OARC, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -105,9 +105,9 @@ extern "C" {
|
|||
|
||||
/* clang-format off */
|
||||
|
||||
#define PCAP_THREAD_VERSION_STR "4.0.0"
|
||||
#define PCAP_THREAD_VERSION_STR "4.1.0"
|
||||
#define PCAP_THREAD_VERSION_MAJOR 4
|
||||
#define PCAP_THREAD_VERSION_MINOR 0
|
||||
#define PCAP_THREAD_VERSION_MINOR 1
|
||||
#define PCAP_THREAD_VERSION_PATCH 0
|
||||
|
||||
#define PCAP_THREAD_DEFAULT_TIMEOUT 1000
|
||||
|
@ -155,6 +155,15 @@ struct pcap_thread_linux_sll {
|
|||
uint8_t link_layer_address[8];
|
||||
uint16_t ether_type;
|
||||
};
|
||||
struct pcap_thread_linux_sll2 {
|
||||
uint16_t protocol_type;
|
||||
uint16_t reserved;
|
||||
uint32_t interface_index;
|
||||
uint16_t arphrd_type;
|
||||
uint8_t packet_type;
|
||||
uint8_t link_layer_address_length;
|
||||
uint8_t link_layer_address[8];
|
||||
};
|
||||
struct pcap_thread_null_hdr {
|
||||
uint32_t family;
|
||||
};
|
||||
|
@ -205,7 +214,8 @@ enum pcap_thread_packet_state {
|
|||
PCAP_THREAD_PACKET_FRAGMENTED_ICMPHDR,
|
||||
PCAP_THREAD_PACKET_FRAGMENTED_ICMPV6HDR,
|
||||
PCAP_THREAD_PACKET_FRAGMENTED_UDPHDR,
|
||||
PCAP_THREAD_PACKET_FRAGMENTED_TCPHDR
|
||||
PCAP_THREAD_PACKET_FRAGMENTED_TCPHDR,
|
||||
PCAP_THREAD_PACKET_INVALID_LINUX_SLL2
|
||||
};
|
||||
|
||||
typedef struct pcap_thread_packet pcap_thread_packet_t;
|
||||
|
@ -213,6 +223,7 @@ struct pcap_thread_packet {
|
|||
unsigned short have_prevpkt : 1;
|
||||
unsigned short have_pkthdr : 1;
|
||||
unsigned short have_linux_sll : 1;
|
||||
unsigned short have_linux_sll2 : 1;
|
||||
unsigned short have_ethhdr : 1;
|
||||
unsigned short have_nullhdr : 1;
|
||||
unsigned short have_loophdr : 1;
|
||||
|
@ -236,6 +247,7 @@ struct pcap_thread_packet {
|
|||
pcap_thread_packet_t* prevpkt;
|
||||
struct pcap_pkthdr pkthdr;
|
||||
struct pcap_thread_linux_sll linux_sll;
|
||||
struct pcap_thread_linux_sll2 linux_sll2;
|
||||
struct ether_header ethhdr;
|
||||
struct pcap_thread_null_hdr nullhdr;
|
||||
struct pcap_thread_loop_hdr loophdr;
|
||||
|
@ -410,7 +422,7 @@ struct pcap_thread_layer_callback_frag {
|
|||
0, "", 0, 0, \
|
||||
{ 0, 0 }, { 0, 0 }, \
|
||||
PCAP_THREAD_DEFAULT_ACTIVATE_MODE, \
|
||||
0, 0, 0, 0, 0, 0, 0, 0, PCAP_THREAD_LAYER_CALLBACK_FRAG_T_INIT, 0, PCAP_THREAD_LAYER_CALLBACK_FRAG_T_INIT, 0, 0, 0, 0, \
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, PCAP_THREAD_LAYER_CALLBACK_FRAG_T_INIT, 0, PCAP_THREAD_LAYER_CALLBACK_FRAG_T_INIT, 0, 0, 0, 0, \
|
||||
0 \
|
||||
}
|
||||
/* clang-format on */
|
||||
|
@ -475,6 +487,7 @@ struct pcap_thread {
|
|||
pcap_thread_activate_mode_t activate_mode;
|
||||
|
||||
pcap_thread_layer_callback_t callback_linux_sll;
|
||||
pcap_thread_layer_callback_t callback_linux_sll2;
|
||||
pcap_thread_layer_callback_t callback_ether;
|
||||
pcap_thread_layer_callback_t callback_null;
|
||||
pcap_thread_layer_callback_t callback_loop;
|
||||
|
@ -509,6 +522,7 @@ struct pcap_thread {
|
|||
PCAP_THREAD_PCAPLIST_T_INIT_THREAD \
|
||||
{ 0, 0 }, \
|
||||
0, \
|
||||
0, { 0, 0 } \
|
||||
}
|
||||
/* clang-format on */
|
||||
|
||||
|
@ -535,6 +549,9 @@ struct pcap_thread_pcaplist {
|
|||
struct bpf_program bpf;
|
||||
|
||||
pcap_thread_callback_t layer_callback;
|
||||
|
||||
int timedrun;
|
||||
struct timespec end;
|
||||
};
|
||||
|
||||
const char* pcap_thread_version_str(void);
|
||||
|
@ -544,62 +561,63 @@ int pcap_thread_version_minor(void);
|
|||
int pcap_thread_version_patch(void);
|
||||
|
||||
pcap_thread_t* pcap_thread_create(void);
|
||||
void pcap_thread_free(pcap_thread_t* pcap_thread);
|
||||
void pcap_thread_free(pcap_thread_t* pcap_thread);
|
||||
|
||||
int pcap_thread_use_threads(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_use_threads(pcap_thread_t* pcap_thread, const int use_threads);
|
||||
int pcap_thread_use_layers(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_use_layers(pcap_thread_t* pcap_thread, const int use_layers);
|
||||
pcap_thread_queue_mode_t pcap_thread_queue_mode(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_queue_mode(pcap_thread_t* pcap_thread, const pcap_thread_queue_mode_t queue_mode);
|
||||
struct timeval pcap_thread_queue_wait(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_queue_wait(pcap_thread_t* pcap_thread, const struct timeval queue_wait);
|
||||
pcap_thread_queue_mode_t pcap_thread_callback_queue_mode(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_callback_queue_mode(pcap_thread_t* pcap_thread, const pcap_thread_queue_mode_t callback_queue_mode);
|
||||
struct timeval pcap_thread_callback_queue_wait(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_callback_queue_wait(pcap_thread_t* pcap_thread, const struct timeval callback_queue_wait);
|
||||
int pcap_thread_snapshot(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_snaplen(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_snaplen(pcap_thread_t* pcap_thread, const int snaplen);
|
||||
int pcap_thread_promiscuous(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_promiscuous(pcap_thread_t* pcap_thread, const int promiscuous);
|
||||
int pcap_thread_monitor(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_monitor(pcap_thread_t* pcap_thread, const int monitor);
|
||||
int pcap_thread_timeout(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_timeout(pcap_thread_t* pcap_thread, const int timeout);
|
||||
int pcap_thread_buffer_size(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_buffer_size(pcap_thread_t* pcap_thread, const int buffer_size);
|
||||
int pcap_thread_timestamp_type(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_timestamp_type(pcap_thread_t* pcap_thread, const int timestamp_type);
|
||||
int pcap_thread_timestamp_precision(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_timestamp_precision(pcap_thread_t* pcap_thread, const int timestamp_precision);
|
||||
int pcap_thread_immediate_mode(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_immediate_mode(pcap_thread_t* pcap_thread, const int immediate_mode);
|
||||
pcap_direction_t pcap_thread_direction(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_direction(pcap_thread_t* pcap_thread, const pcap_direction_t direction);
|
||||
const char* pcap_thread_filter(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_filter(pcap_thread_t* pcap_thread, const char* filter, const size_t filter_len);
|
||||
int pcap_thread_clear_filter(pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_filter_errno(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_filter_optimize(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_filter_optimize(pcap_thread_t* pcap_thread, const int filter_optimize);
|
||||
bpf_u_int32 pcap_thread_filter_netmask(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_filter_netmask(pcap_thread_t* pcap_thread, const bpf_u_int32 filter_netmask);
|
||||
struct timeval pcap_thread_timedrun(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_timedrun(pcap_thread_t* pcap_thread, const struct timeval timedrun);
|
||||
struct timeval pcap_thread_timedrun_to(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_timedrun_to(pcap_thread_t* pcap_thread, const struct timeval timedrun_to);
|
||||
int pcap_thread_use_threads(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_use_threads(pcap_thread_t* pcap_thread, const int use_threads);
|
||||
int pcap_thread_use_layers(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_use_layers(pcap_thread_t* pcap_thread, const int use_layers);
|
||||
pcap_thread_queue_mode_t pcap_thread_queue_mode(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_queue_mode(pcap_thread_t* pcap_thread, const pcap_thread_queue_mode_t queue_mode);
|
||||
struct timeval pcap_thread_queue_wait(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_queue_wait(pcap_thread_t* pcap_thread, const struct timeval queue_wait);
|
||||
pcap_thread_queue_mode_t pcap_thread_callback_queue_mode(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_callback_queue_mode(pcap_thread_t* pcap_thread, const pcap_thread_queue_mode_t callback_queue_mode);
|
||||
struct timeval pcap_thread_callback_queue_wait(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_callback_queue_wait(pcap_thread_t* pcap_thread, const struct timeval callback_queue_wait);
|
||||
int pcap_thread_snapshot(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_snaplen(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_snaplen(pcap_thread_t* pcap_thread, const int snaplen);
|
||||
int pcap_thread_promiscuous(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_promiscuous(pcap_thread_t* pcap_thread, const int promiscuous);
|
||||
int pcap_thread_monitor(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_monitor(pcap_thread_t* pcap_thread, const int monitor);
|
||||
int pcap_thread_timeout(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_timeout(pcap_thread_t* pcap_thread, const int timeout);
|
||||
int pcap_thread_buffer_size(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_buffer_size(pcap_thread_t* pcap_thread, const int buffer_size);
|
||||
int pcap_thread_timestamp_type(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_timestamp_type(pcap_thread_t* pcap_thread, const int timestamp_type);
|
||||
int pcap_thread_timestamp_precision(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_timestamp_precision(pcap_thread_t* pcap_thread, const int timestamp_precision);
|
||||
int pcap_thread_immediate_mode(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_immediate_mode(pcap_thread_t* pcap_thread, const int immediate_mode);
|
||||
pcap_direction_t pcap_thread_direction(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_direction(pcap_thread_t* pcap_thread, const pcap_direction_t direction);
|
||||
const char* pcap_thread_filter(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_filter(pcap_thread_t* pcap_thread, const char* filter, const size_t filter_len);
|
||||
int pcap_thread_clear_filter(pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_filter_errno(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_filter_optimize(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_filter_optimize(pcap_thread_t* pcap_thread, const int filter_optimize);
|
||||
bpf_u_int32 pcap_thread_filter_netmask(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_filter_netmask(pcap_thread_t* pcap_thread, const bpf_u_int32 filter_netmask);
|
||||
struct timeval pcap_thread_timedrun(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_timedrun(pcap_thread_t* pcap_thread, const struct timeval timedrun);
|
||||
struct timeval pcap_thread_timedrun_to(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_timedrun_to(pcap_thread_t* pcap_thread, const struct timeval timedrun_to);
|
||||
pcap_thread_activate_mode_t pcap_thread_activate_mode(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_activate_mode(pcap_thread_t* pcap_thread, const pcap_thread_activate_mode_t activate_mode);
|
||||
int pcap_thread_was_stopped(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_activate_mode(pcap_thread_t* pcap_thread, const pcap_thread_activate_mode_t activate_mode);
|
||||
int pcap_thread_was_stopped(const pcap_thread_t* pcap_thread);
|
||||
|
||||
size_t pcap_thread_queue_size(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_set_queue_size(pcap_thread_t* pcap_thread, const size_t queue_size);
|
||||
int pcap_thread_set_queue_size(pcap_thread_t* pcap_thread, const size_t queue_size);
|
||||
|
||||
int pcap_thread_set_callback(pcap_thread_t* pcap_thread, pcap_thread_callback_t callback);
|
||||
int pcap_thread_set_dropback(pcap_thread_t* pcap_thread, pcap_thread_callback_t dropback);
|
||||
|
||||
int pcap_thread_set_callback_linux_sll(pcap_thread_t* pcap_thread, pcap_thread_layer_callback_t callback_linux_sll);
|
||||
int pcap_thread_set_callback_linux_sll2(pcap_thread_t* pcap_thread, pcap_thread_layer_callback_t callback_linux_sll2);
|
||||
int pcap_thread_set_callback_ether(pcap_thread_t* pcap_thread, pcap_thread_layer_callback_t callback_ether);
|
||||
int pcap_thread_set_callback_null(pcap_thread_t* pcap_thread, pcap_thread_layer_callback_t callback_null);
|
||||
int pcap_thread_set_callback_loop(pcap_thread_t* pcap_thread, pcap_thread_layer_callback_t callback_loop);
|
||||
|
@ -629,7 +647,7 @@ int pcap_thread_stop(pcap_thread_t* pcap_thread);
|
|||
|
||||
int pcap_thread_stats(pcap_thread_t* pcap_thread, pcap_thread_stats_callback_t callback, u_char* user);
|
||||
|
||||
int pcap_thread_status(const pcap_thread_t* pcap_thread);
|
||||
int pcap_thread_status(const pcap_thread_t* pcap_thread);
|
||||
const char* pcap_thread_errbuf(const pcap_thread_t* pcap_thread);
|
||||
const char* pcap_thread_strerr(int error);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue