OpenVAS Scanner  6.0.0~git
Macros | Functions | Variables
bpf_share.c File Reference
#include <gvm/base/logging.h>
#include <pcap.h>

Macros

#define NUM_CLIENTS   128
 
#define G_LOG_DOMAIN   "lib misc"
 GLib logging domain. More...
 

Functions

void print_pcap_error (pcap_t *p, char *prefix)
 
int bpf_open_live (char *iface, char *filter)
 
u_char * bpf_next_tv (int bpf, int *caplen, struct timeval *tv)
 
u_char * bpf_next (int bpf, int *caplen)
 
int bpf_datalink (int bpf)
 
void bpf_close (int bpf)
 

Variables

static pcap_t * pcaps [NUM_CLIENTS]
 

Macro Definition Documentation

◆ G_LOG_DOMAIN

#define G_LOG_DOMAIN   "lib misc"

GLib logging domain.

◆ NUM_CLIENTS

#define NUM_CLIENTS   128
Todo:
There once was a BPF sharing feature with the same API as the methods below, but trying to share BPF among the daemon processes. What remains is a thin abstraction of the pcap API. Eventually it needs to be analysed whether this makes sense or can further be simplified.

Function Documentation

◆ bpf_close()

void bpf_close ( int  bpf)

◆ bpf_datalink()

int bpf_datalink ( int  bpf)

◆ bpf_next()

u_char* bpf_next ( int  bpf,
int *  caplen 
)

◆ bpf_next_tv()

u_char* bpf_next_tv ( int  bpf,
int *  caplen,
struct timeval tv 
)

◆ bpf_open_live()

int bpf_open_live ( char *  iface,
char *  filter 
)
Returns
-1 in case of error, index of the opened pcap_t in pcaps otherwise.

◆ print_pcap_error()

void print_pcap_error ( pcap_t *  p,
char *  prefix 
)

Variable Documentation

◆ pcaps

pcap_t* pcaps[NUM_CLIENTS]
static

Shared pcap_t's.