mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Icmp: get tos parameter in icmp reply
This commit is contained in:
parent
b569f4069a
commit
45ad770c37
@ -49,6 +49,7 @@ typedef struct {
|
||||
uint32_t elapsed_time_ms;
|
||||
uint32_t total_time_ms;
|
||||
uint8_t ttl;
|
||||
uint8_t tos;
|
||||
uint32_t flags;
|
||||
void (*on_ping_success)(esp_ping_handle_t hdl, void *args);
|
||||
void (*on_ping_timeout)(esp_ping_handle_t hdl, void *args);
|
||||
@ -113,6 +114,7 @@ static int esp_ping_receive(esp_ping_t *ep)
|
||||
if ((iecho->id == ep->packet_hdr->id) && (iecho->seqno == ep->packet_hdr->seqno)) {
|
||||
ep->received++;
|
||||
ep->ttl = iphdr->_ttl;
|
||||
ep->tos = iphdr->_tos;
|
||||
ep->recv_len = lwip_ntohs(IPH_LEN(iphdr)) - data_head; // The data portion of ICMP
|
||||
return len;
|
||||
}
|
||||
@ -356,6 +358,10 @@ esp_err_t esp_ping_get_profile(esp_ping_handle_t hdl, esp_ping_profile_t profile
|
||||
from = &ep->packet_hdr->seqno;
|
||||
copy_size = sizeof(ep->packet_hdr->seqno);
|
||||
break;
|
||||
case ESP_PING_PROF_TOS:
|
||||
from = &ep->tos;
|
||||
copy_size = sizeof(ep->tos);
|
||||
break;
|
||||
case ESP_PING_PROF_TTL:
|
||||
from = &ep->ttl;
|
||||
copy_size = sizeof(ep->ttl);
|
||||
|
@ -93,6 +93,7 @@ typedef struct {
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_PING_PROF_SEQNO, /*!< Sequence number of a ping procedure */
|
||||
ESP_PING_PROF_TOS, /*!< Type of service of a ping procedure */
|
||||
ESP_PING_PROF_TTL, /*!< Time to live of a ping procedure */
|
||||
ESP_PING_PROF_REQUEST, /*!< Number of request packets sent out */
|
||||
ESP_PING_PROF_REPLY, /*!< Number of reply packets received */
|
||||
|
Loading…
Reference in New Issue
Block a user