forked from espressif/esp-idf
Icmp: get tos parameter in icmp reply
This commit is contained in:
@@ -49,6 +49,7 @@ typedef struct {
|
|||||||
uint32_t elapsed_time_ms;
|
uint32_t elapsed_time_ms;
|
||||||
uint32_t total_time_ms;
|
uint32_t total_time_ms;
|
||||||
uint8_t ttl;
|
uint8_t ttl;
|
||||||
|
uint8_t tos;
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
void (*on_ping_success)(esp_ping_handle_t hdl, void *args);
|
void (*on_ping_success)(esp_ping_handle_t hdl, void *args);
|
||||||
void (*on_ping_timeout)(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)) {
|
if ((iecho->id == ep->packet_hdr->id) && (iecho->seqno == ep->packet_hdr->seqno)) {
|
||||||
ep->received++;
|
ep->received++;
|
||||||
ep->ttl = iphdr->_ttl;
|
ep->ttl = iphdr->_ttl;
|
||||||
|
ep->tos = iphdr->_tos;
|
||||||
ep->recv_len = lwip_ntohs(IPH_LEN(iphdr)) - data_head; // The data portion of ICMP
|
ep->recv_len = lwip_ntohs(IPH_LEN(iphdr)) - data_head; // The data portion of ICMP
|
||||||
return len;
|
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;
|
from = &ep->packet_hdr->seqno;
|
||||||
copy_size = sizeof(ep->packet_hdr->seqno);
|
copy_size = sizeof(ep->packet_hdr->seqno);
|
||||||
break;
|
break;
|
||||||
|
case ESP_PING_PROF_TOS:
|
||||||
|
from = &ep->tos;
|
||||||
|
copy_size = sizeof(ep->tos);
|
||||||
|
break;
|
||||||
case ESP_PING_PROF_TTL:
|
case ESP_PING_PROF_TTL:
|
||||||
from = &ep->ttl;
|
from = &ep->ttl;
|
||||||
copy_size = sizeof(ep->ttl);
|
copy_size = sizeof(ep->ttl);
|
||||||
|
@@ -93,6 +93,7 @@ typedef struct {
|
|||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
ESP_PING_PROF_SEQNO, /*!< Sequence number of a ping procedure */
|
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_TTL, /*!< Time to live of a ping procedure */
|
||||||
ESP_PING_PROF_REQUEST, /*!< Number of request packets sent out */
|
ESP_PING_PROF_REQUEST, /*!< Number of request packets sent out */
|
||||||
ESP_PING_PROF_REPLY, /*!< Number of reply packets received */
|
ESP_PING_PROF_REPLY, /*!< Number of reply packets received */
|
||||||
|
Reference in New Issue
Block a user