Microsoft compatibility measure.
const size_t len_wire,
const struct timespec *mtime,
const void *wire_q,
- const size_t len_wire_q)
+ const size_t len_wire_q,
+ const struct timespec *mtime_q)
{
if (m == NULL) {
return KNOT_EINVAL;
m->query_message.len = len_wire_q;
m->query_message.data = (uint8_t *)wire_q;
m->has_query_message = 1;
+ // Message.query_time_sec, Message.query_time_nsec
+ if (mtime_q != NULL) {
+ m->query_time_sec = mtime_q->tv_sec;
+ m->query_time_nsec = mtime_q->tv_nsec;
+ m->has_query_time_sec = 1;
+ m->has_query_time_nsec = 1;
+ }
}
}
const size_t len_wire,
const struct timespec *mtime,
const void *wire_q,
- const size_t len_wire_q);
+ const size_t len_wire_q,
+ const struct timespec *mtime_q);
knot_mm_t *mm; /*!< Memory context. */
knotd_qdata_params_t *params; /*!< Low-level processing parameters. */
+ struct timespec query_time; /*!< Time when the query was received. */
struct knotd_qdata_extra *extra; /*!< Private items (process_query.h). */
} knotd_qdata_t;
(const struct sockaddr *)knotd_qdata_local_addr(qdata),
qdata->params->proto, pkt->wire, pkt->size, &tv,
(ctx->with_queries && qdata->query != NULL) ? qdata->query->wire : NULL,
- qdata->query->size);
+ qdata->query->size, &qdata->query_time);
if (ret != KNOT_EOK) {
return state;
}
#include "contrib/macros.h"
#include "contrib/mempattern.h"
+#ifndef CLOCK_REALTIME_COARSE
+#define CLOCK_REALTIME_COARSE CLOCK_REALTIME
+#endif
+
/*! \brief Accessor to query-specific data. */
#define QUERY_DATA(ctx) ((knotd_qdata_t *)(ctx)->data)
/* Initialize persistent data. */
query_data_init(ctx, params, extra);
+ clock_gettime(CLOCK_REALTIME_COARSE, &QUERY_DATA(ctx)->query_time);
/* Await packet. */
return KNOT_STATE_CONSUME;
ret = dt_message_fill(&msg, msg_type, net->local_info->ai_addr,
net->srv->ai_addr, protocol,
- wire, wire_len, mtime, NULL, 0);
+ wire, wire_len, mtime, NULL, 0, NULL);
if (ret != KNOT_EOK) {
return ret;
}