cmd_pcap.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* cmd_pcap example — declarations of command registration functions.
  2. This example code is in the Public Domain (or CC0 licensed, at your option.)
  3. Unless required by applicable law or agreed to in writing, this
  4. software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
  5. CONDITIONS OF ANY KIND, either express or implied.
  6. */
  7. #pragma once
  8. #include "pcap.h"
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. /**
  13. * @brief Capture a pcap package with parameters
  14. *
  15. * @param payload pointer of the captured data
  16. * @param length length of captured data
  17. * @param seconds second of capture time
  18. * @param microseconds microsecond of capture time
  19. * @return esp_err_t
  20. * - ESP_OK on success
  21. * - ESP_FAIL on error
  22. */
  23. esp_err_t packet_capture(void *payload, uint32_t length, uint32_t seconds, uint32_t microseconds);
  24. /**
  25. * @brief Tell the pcap component to start sniff and write
  26. *
  27. * @param link_type link type of the captured package
  28. * @return esp_err_t
  29. * - ESP_OK on success
  30. * - ESP_FAIL on error
  31. */
  32. esp_err_t sniff_packet_start(pcap_link_type_t link_type);
  33. /**
  34. * @brief Tell the pcap component to stop sniff
  35. *
  36. * @return esp_err_t
  37. * - ESP_OK on success
  38. * - ESP_FAIL on error
  39. */
  40. esp_err_t sniff_packet_stop(void);
  41. /**
  42. * @brief Register pcap command
  43. *
  44. */
  45. void register_pcap_cmd(void);
  46. #ifdef __cplusplus
  47. }
  48. #endif