* "do not respond", even if duplicates come in.
*
* @param[in] instance the context for this function.
+ * @param[out] packet_ctx the packet_ctx struct containing request specific data.
* @param[in] packet the packet to NAK
* @param[in] packet_len length of the packet to NAK
* @param[in] reply the NAK reply
* @param[in] reply_len length of the buffer where the reply should be placed.
* @return length of the data in the reply buffer.
*/
-typedef size_t (*fr_io_nak_t)(void const *instance, uint8_t *const packet, size_t packet_len,
+typedef size_t (*fr_io_nak_t)(void const *instance, void *packet_ctx, uint8_t *const packet, size_t packet_len,
uint8_t *reply, size_t reply_len);
/** Read from a socket.
* Encode a NAK
*/
if (listen->app_io->nak) {
- size = listen->app_io->nak(listen->app_io_instance, cd->m.data,
+ size = listen->app_io->nak(listen->app_io_instance, cd->packet_ctx, cd->m.data,
cd->m.data_size, reply->m.data, reply->m.rb_size);
} else {
size = 1; /* rely on them to figure it the heck out */
return 20;
}
-static size_t test_nak(void const *instance, uint8_t *const packet, size_t packet_len, UNUSED uint8_t *reply, UNUSED size_t reply_len)
+static size_t test_nak(void const *instance, UNUSED void *packet_ctx, uint8_t *const packet, size_t packet_len, UNUSED uint8_t *reply, UNUSED size_t reply_len)
{
MPRINT1("\t\tNAK !!! request %d - data %p %p size %zd\n", packet[1], instance, packet, packet_len);
return 20;
}
-static size_t test_nak(void const *ctx, uint8_t *const packet, size_t packet_len, UNUSED uint8_t *reply, UNUSED size_t reply_len)
+static size_t test_nak(void const *ctx, UNUSED void *packet_ctx, uint8_t *const packet, size_t packet_len, UNUSED uint8_t *reply, UNUSED size_t reply_len)
{
MPRINT1("\t\tNAK !!! request %d - data %p %p size %zd\n", packet[1], ctx, packet, packet_len);
return data_len;
}
-static size_t test_nak(void const *packet_ctx, uint8_t *const packet, size_t packet_len, uint8_t *reply, UNUSED size_t reply_len)
+static size_t test_nak(UNUSED void const *instance, UNUSED void *packet_ctx, uint8_t *const packet, size_t packet_len, uint8_t *reply, UNUSED size_t reply_len)
{
uint32_t number;