40#ifndef HKDS_MESSAGE_QUEUE_H
41#define HKDS_MESSAGE_QUEUE_H
61#define HKDS_MESSAGE_QUEUE_TAG_SIZE 16
67#define HKDS_QUEUE_ALIGNMENT 64
73#define HKDS_QUEUE_MAX_DEPTH 64
HKDS configuration definitions.
#define HKDS_MESSAGE_SIZE
The encrypted message size in bytes.
Definition hkds_config.h:302
#define HKDS_PARALLEL_DEPTH
The AVX512 depth multiplier.
Definition hkds_config.h:245
#define HKDS_CACHX8_DEPTH
The AVX512 depth multiplier for cache operations.
Definition hkds_config.h:254
HKDS_EXPORT_API size_t hkds_message_queue_count(const hkds_message_queue_state *ctx)
Returns the number of items in the queue.
Definition hkds_queue.c:169
HKDS_EXPORT_API void hkds_message_queue_pop(hkds_message_queue_state *ctx, uint8_t *output, size_t outlen)
Removes an item from the queue and copies it to the output array.
Definition hkds_queue.c:79
HKDS_EXPORT_API void hkds_message_queue_initialize(hkds_message_queue_state *ctx, size_t depth, size_t width, uint8_t *tag)
Initializes the queue state context.
Definition hkds_queue.c:50
HKDS_EXPORT_API bool hkds_message_queue_full(const hkds_message_queue_state *ctx)
Checks if the queue is full.
Definition hkds_queue.c:137
HKDS_EXPORT_API void hkds_message_queue_push(hkds_message_queue_state *ctx, const uint8_t *inpput, size_t inplen)
Adds an item to the queue.
Definition hkds_queue.c:115
HKDS_EXPORT_API size_t hkds_message_queue_extract_block_x8(hkds_message_queue_state *ctx, uint8_t output[HKDS_CACHX8_DEPTH][HKDS_MESSAGE_SIZE])
Exports a block of 8 messages to a 2-dimensional message queue.
Definition hkds_queue.c:187
HKDS_EXPORT_API bool hkds_message_queue_empty(const hkds_message_queue_state *ctx)
Checks if the queue is empty.
Definition hkds_queue.c:153
HKDS_EXPORT_API size_t hkds_message_queue_extract_block_x64(hkds_message_queue_state *ctx, uint8_t output[HKDS_PARALLEL_DEPTH][HKDS_CACHX8_DEPTH][HKDS_MESSAGE_SIZE])
Exports 8 slots (8 blocks of messages) to a 3-dimensional message queue.
Definition hkds_queue.c:204
HKDS_EXPORT_API void hkds_message_queue_destroy(hkds_message_queue_state *ctx)
Resets the queue context state.
Definition hkds_queue.c:4
#define HKDS_QUEUE_MAX_DEPTH
The maximum queue depth.
Definition hkds_queue.h:73
HKDS_EXPORT_API size_t hkds_message_queue_extract_stream(hkds_message_queue_state *ctx, uint8_t *stream, size_t items)
Serializes a set of messages from the queue to a linear array.
Definition hkds_queue.c:228
HKDS_EXPORT_API void hkds_message_queue_flush(hkds_message_queue_state *ctx, uint8_t *output)
Flushes the contents of the queue to a byte array.
Definition hkds_queue.c:28
Contains the HKDS message queue context state.
Definition hkds_queue.h:104
uint8_t * tag
Definition hkds_queue.h:105
hkds_queue_state state
Definition hkds_queue.h:106
Contains the queue context state.
Definition hkds_queue.h:87
size_t width
Definition hkds_queue.h:93
size_t count
Definition hkds_queue.h:90
size_t position
Definition hkds_queue.h:92
size_t depth
Definition hkds_queue.h:91
uint8_t ** queue
Definition hkds_queue.h:88
uint64_t tags[HKDS_QUEUE_MAX_DEPTH]
Definition hkds_queue.h:89