Ramon Fried | 3eaac63 | 2019-07-18 21:43:30 +0300 | [diff] [blame] | 1 | /* 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 Schuchardt | 185f812 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 13 | * Return: 0 on success, -ERROR on error |
Ramon Fried | 3eaac63 | 2019-07-18 21:43:30 +0300 | [diff] [blame] | 14 | */ |
| 15 | int 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 Schuchardt | 185f812 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 22 | * Return: 0 on success, -ERROR on error |
Ramon Fried | 3eaac63 | 2019-07-18 21:43:30 +0300 | [diff] [blame] | 23 | */ |
| 24 | int pcap_start_stop(bool start); |
| 25 | |
| 26 | /** |
| 27 | * pcap_clear() - clear pcap capture buffer and statistics |
| 28 | * |
Heinrich Schuchardt | 185f812 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 29 | * Return: 0 on success, -ERROR on error |
Ramon Fried | 3eaac63 | 2019-07-18 21:43:30 +0300 | [diff] [blame] | 30 | */ |
| 31 | int pcap_clear(void); |
| 32 | |
| 33 | /** |
| 34 | * pcap_print_status() - print status of pcap capture |
| 35 | * |
Heinrich Schuchardt | 185f812 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 36 | * Return: 0 on success, -ERROR on error |
Ramon Fried | 3eaac63 | 2019-07-18 21:43:30 +0300 | [diff] [blame] | 37 | */ |
| 38 | int pcap_print_status(void); |
| 39 | |
| 40 | /** |
| 41 | * pcap_active() - check if pcap is enabled |
| 42 | * |
Heinrich Schuchardt | 185f812 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 43 | * Return: TRUE if active, FALSE if not. |
Ramon Fried | 3eaac63 | 2019-07-18 21:43:30 +0300 | [diff] [blame] | 44 | */ |
| 45 | bool 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 Schuchardt | 185f812 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 53 | * Return: 0 on success, -ERROR on error |
Ramon Fried | 3eaac63 | 2019-07-18 21:43:30 +0300 | [diff] [blame] | 54 | */ |
| 55 | int pcap_post(const void *packet, size_t len, bool outgoing); |