11 #ifndef PCAP_SERVICE_H
12 #define PCAP_SERVICE_H
18 #include <sys/types.h>
22 char *ltype,
struct pcap_pkthdr *header,
74 int run_pcap(
char *interface,
bool immediate,
bool promiscuous,
int timeout,
96 struct pcap_pkthdr *header, uint8_t *packet);
int get_pcap_stats(const struct pcap_context *ctx, struct pcap_stat *ps)
Return pcap capture statistics.
Definition: pcap_service.c:229
int dump_file_pcap(struct pcap_context *ctx, char *file_path, struct pcap_pkthdr *header, uint8_t *packet)
Saves a packet packet into file.
Definition: pcap_service.c:217
int inject_pcap(struct pcap_context *ctx, uint8_t *packet, size_t size)
Injects a packets.
Definition: pcap_service.c:238
int run_pcap(char *interface, bool immediate, bool promiscuous, int timeout, char *filter, bool nonblock, capture_callback_fn pcap_fn, void *fn_ctx, struct pcap_context **pctx)
Executes the libpcap service.
Definition: pcap_service.c:105
int get_pcap_datalink(struct pcap_context *ctx)
Get the pcap config datalink value.
Definition: pcap_service.c:96
void free_pcap_list(UT_array *ctx_list)
Frees a pcap list.
Definition: pcap_service.c:249
void close_pcap(struct pcap_context *ctx)
Closes the pcap service.
Definition: pcap_service.c:72
void capture_pcap_stop(struct pcap_context *ctx)
Stops the blocking pcap loop.
Definition: pcap_service.c:90
UT_array * create_pcap_list(void)
Creates a pcap list.
Definition: pcap_service.c:263
int capture_pcap_packet(struct pcap_context *ctx)
Captures a pcap packet.
Definition: pcap_service.c:68
int capture_pcap_start(struct pcap_context *ctx)
Starts the blocking pcap loop.
Definition: pcap_service.c:81
void(* capture_callback_fn)(const void *ctx, const void *pcap_ctx, char *ltype, struct pcap_pkthdr *header, uint8_t *packet)
Definition: pcap_service.h:21
Pcap context structure definition.
Definition: pcap_service.h:29
int pcap_fd
Definition: pcap_service.h:30
pcap_t * pd
Definition: pcap_service.h:31
char ifname[IF_NAMESIZE]
Definition: pcap_service.h:32
void * fn_ctx
Definition: pcap_service.h:34
capture_callback_fn pcap_fn
Definition: pcap_service.h:33