diff --git a/examples/coap-client.c b/examples/coap-client.c index c8ad16ee..b119c93e 100644 --- a/examples/coap-client.c +++ b/examples/coap-client.c @@ -358,6 +358,7 @@ event_handler(coap_session_t *session COAP_UNUSED, case COAP_EVENT_SERVER_SESSION_NEW: case COAP_EVENT_SERVER_SESSION_DEL: case COAP_EVENT_BAD_PACKET: + case COAP_EVENT_MSG_RETRANSMITTED: default: break; } diff --git a/examples/coap-server.c b/examples/coap-server.c index 60f8602f..d184247f 100644 --- a/examples/coap-server.c +++ b/examples/coap-server.c @@ -1582,6 +1582,7 @@ proxy_event_handler(coap_session_t *session, case COAP_EVENT_SERVER_SESSION_NEW: case COAP_EVENT_SERVER_SESSION_DEL: case COAP_EVENT_BAD_PACKET: + case COAP_EVENT_MSG_RETRANSMITTED: default: break; } diff --git a/include/coap3/coap_event.h b/include/coap3/coap_event.h index bda21ef5..a773f5fa 100644 --- a/include/coap3/coap_event.h +++ b/include/coap3/coap_event.h @@ -94,10 +94,12 @@ typedef enum { COAP_EVENT_SERVER_SESSION_DEL = 0x4002, /* - * Received packet formatting errors + * Message receive and transmit events */ /** Triggered when badly formatted packet received */ - COAP_EVENT_BAD_PACKET = 0x5001 + COAP_EVENT_BAD_PACKET = 0x5001, + /** Triggered when a message is retransmitted */ + COAP_EVENT_MSG_RETRANSMITTED = 0x5002 } coap_event_t; diff --git a/man/coap_handler.txt.in b/man/coap_handler.txt.in index 200842ff..a610da64 100644 --- a/man/coap_handler.txt.in +++ b/man/coap_handler.txt.in @@ -219,9 +219,10 @@ COAP_EVENT_XMIT_BLOCK_FAIL 0x3002 COAP_EVENT_SERVER_SESSION_NEW 0x4001 COAP_EVENT_SERVER_SESSION_DEL 0x4002 /** - * Unrecognizable received packet events + * Message receive and transmit events */ COAP_EVENT_BAD_PACKET 0x5001 +COAP_EVENT_MSG_RETRANSMITTED 0x5002 ---- EXAMPLES diff --git a/src/net.c b/src/net.c index a191139d..5e00cc4a 100644 --- a/src/net.c +++ b/src/net.c @@ -1439,6 +1439,8 @@ coap_retransmit(coap_context_t *context, coap_queue_t *node) { coap_tick_t now; node->retransmit_cnt++; + coap_handle_event(context, COAP_EVENT_MSG_RETRANSMITTED, node->session); + coap_ticks(&now); if (context->sendqueue == NULL) { node->t = node->timeout << node->retransmit_cnt;