blob: 6184bf53a8a6008a8ac2b1388ff60e1a960285ed [file] [log] [blame]
Ramon Fried3eaac632019-07-18 21:43:30 +03001/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright 2019
4 * Ramon Fried <rfried.dev@gmail.com>
5 */
6
7/**
8 * pcap_init() - Initialize PCAP memory buffer
9 *
10 * @paddr physicaly memory address to store buffer
11 * @size maximum size of capture file in memory
12 *
Heinrich Schuchardt185f8122022-01-19 18:05:50 +010013 * Return: 0 on success, -ERROR on error
Ramon Fried3eaac632019-07-18 21:43:30 +030014 */
15int pcap_init(phys_addr_t paddr, unsigned long size);
16
17/**
18 * pcap_start_stop() - start / stop pcap capture
19 *
20 * @start if true, start capture if false stop capture
21 *
Heinrich Schuchardt185f8122022-01-19 18:05:50 +010022 * Return: 0 on success, -ERROR on error
Ramon Fried3eaac632019-07-18 21:43:30 +030023 */
24int pcap_start_stop(bool start);
25
26/**
27 * pcap_clear() - clear pcap capture buffer and statistics
28 *
Heinrich Schuchardt185f8122022-01-19 18:05:50 +010029 * Return: 0 on success, -ERROR on error
Ramon Fried3eaac632019-07-18 21:43:30 +030030 */
31int pcap_clear(void);
32
33/**
34 * pcap_print_status() - print status of pcap capture
35 *
Heinrich Schuchardt185f8122022-01-19 18:05:50 +010036 * Return: 0 on success, -ERROR on error
Ramon Fried3eaac632019-07-18 21:43:30 +030037 */
38int pcap_print_status(void);
39
40/**
41 * pcap_active() - check if pcap is enabled
42 *
Heinrich Schuchardt185f8122022-01-19 18:05:50 +010043 * Return: TRUE if active, FALSE if not.
Ramon Fried3eaac632019-07-18 21:43:30 +030044 */
45bool pcap_active(void);
46
47/**
48 * pcap_post() - Post a packet to PCAP file
49 *
50 * @packet: packet to post
51 * @len: packet length in bytes
52 * @outgoing packet direction (outgoing/incoming)
Heinrich Schuchardt185f8122022-01-19 18:05:50 +010053 * Return: 0 on success, -ERROR on error
Ramon Fried3eaac632019-07-18 21:43:30 +030054 */
55int pcap_post(const void *packet, size_t len, bool outgoing);