good_expiry_and_qinfo(struct module_qstate* qstate, struct sldns_buffer* buf)
{
	uint64_t expiry;
	/* the expiry time is the last bytes of the buffer */
	if(sldns_buffer_limit(buf) < sizeof(expiry))
		return 0;
	sldns_buffer_read_at(buf, sldns_buffer_limit(buf)-sizeof(expiry),
		&expiry, sizeof(expiry));
	expiry = be64toh(expiry);

	/* Check if we are allowed to return expired entries:
	 * - serve_expired needs to be set
	 * - if SERVE_EXPIRED_TTL is set make sure that the record is not older
	 *   than that. */
	if((time_t)expiry < *qstate->env->now &&
		(!qstate->env->cfg->serve_expired ||
			(SERVE_EXPIRED_TTL &&
			*qstate->env->now - (time_t)expiry > SERVE_EXPIRED_TTL)))
		return 0;

	return 1;
}
good_expiry_and_qinfo(struct module_qstate* qstate, struct sldns_buffer* buf)
{
	uint64_t expiry;
	 
	if(sldns_buffer_limit(buf) < sizeof(expiry))
		return 0;
	sldns_buffer_read_at(buf, sldns_buffer_limit(buf)-sizeof(expiry),
		&expiry, sizeof(expiry));
	expiry = be64toh(expiry);

	 
	if((time_t)expiry < *qstate->env->now &&
		(!qstate->env->cfg->serve_expired ||
			(SERVE_EXPIRED_TTL &&
			*qstate->env->now - (time_t)expiry > SERVE_EXPIRED_TTL)))
		return 0;

	return 1;
}