pcap.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright 2019
  4. * Ramon Fried <rfried.dev@gmail.com>
  5. */
  6. /**
  7. * pcap_init() - Initialize PCAP memory buffer
  8. *
  9. * @paddr physicaly memory address to store buffer
  10. * @size maximum size of capture file in memory
  11. *
  12. * @return 0 on success, -ERROR on error
  13. */
  14. int pcap_init(phys_addr_t paddr, unsigned long size);
  15. /**
  16. * pcap_start_stop() - start / stop pcap capture
  17. *
  18. * @start if true, start capture if false stop capture
  19. *
  20. * @return 0 on success, -ERROR on error
  21. */
  22. int pcap_start_stop(bool start);
  23. /**
  24. * pcap_clear() - clear pcap capture buffer and statistics
  25. *
  26. * @return 0 on success, -ERROR on error
  27. */
  28. int pcap_clear(void);
  29. /**
  30. * pcap_print_status() - print status of pcap capture
  31. *
  32. * @return 0 on success, -ERROR on error
  33. */
  34. int pcap_print_status(void);
  35. /**
  36. * pcap_active() - check if pcap is enabled
  37. *
  38. * @return TRUE if active, FALSE if not.
  39. */
  40. bool pcap_active(void);
  41. /**
  42. * pcap_post() - Post a packet to PCAP file
  43. *
  44. * @packet: packet to post
  45. * @len: packet length in bytes
  46. * @outgoing packet direction (outgoing/incoming)
  47. * @return 0 on success, -ERROR on error
  48. */
  49. int pcap_post(const void *packet, size_t len, bool outgoing);