Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions sys/net/include/sixlowpan/icmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,14 @@ void icmpv6_send_echo_request(ipv6_addr_t *destaddr, uint16_t id,
void icmpv6_send_echo_reply(ipv6_addr_t *destaddr, uint16_t id,
uint16_t seq, char *data, size_t data_len);

/**
* @brief Register a handler for ICMPv6 echo replys.
*
* @param[in] handle_reply Function to handle a ICMPv6 echo reply.
*/
void icmpv6_register_echo_reply_handler(void (*handle_reply)(ipv6_hdr_t *ipv6_buf,
icmpv6_echo_reply_hdr_t *echo_buf));

/**
* @brief Send ICMPv6 router solicitation.
*
Expand Down
9 changes: 9 additions & 0 deletions sys/net/network_layer/sixlowpan/icmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ uint8_t icmpv6_opt_hdr_len = 0;
uint8_t recvd_cids_len = 0;
ndp_prefix_list_t *recvd_prefixes[OPT_PI_LIST_LEN];
uint8_t recvd_pref_len = 0;
void (*handle_echo_reply)(ipv6_hdr_t *ipv6_buf, icmpv6_echo_reply_hdr_t *echo_buf) = 0;

void def_rtr_lst_add(ipv6_addr_t *ipaddr, uint32_t rtr_ltime);
void def_rtr_lst_rem(ndp_default_router_list_t *entry);
Expand Down Expand Up @@ -417,6 +418,14 @@ void recv_echo_repl(void)
}

#endif

if (handle_echo_reply != NULL) {
handle_echo_reply(ipv6_buf, echo_buf);
}
}

void icmpv6_register_echo_reply_handler(void (*handle_reply)(ipv6_hdr_t *ipv6_buf, icmpv6_echo_reply_hdr_t *echo_buf)) {
handle_echo_reply = handle_reply;
}

void recv_rtr_sol(void)
Expand Down