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