#pragma once #ifdef __cplusplus extern "C" { #endif #include "stellar/mq.h" #include "uthash/utarray.h" #include enum mq_property { STELLAR_MQ_DEATH_LETTER = 0, STELLAR_MQ_PRIORITY_LOW = 1, STELLAR_MQ_PRIORITY_MEDIUM, STELLAR_MQ_PRIORITY_HIGH, STELLAR_MQ_MAX }; struct mq_message { struct mq_runtime *rt; struct { int topic_id; enum mq_property priority; } header; void *body; struct mq_message *next, *prev; } __attribute__((aligned(sizeof(void *)))); typedef struct mq_subscriber { int topic_subscriber_idx; int plugin_idx; on_msg_cb_func *msg_cb; void *msg_cb_arg; struct mq_subscriber *next, *prev; }stellar_mq_subscriber __attribute__((aligned(sizeof(void*)))); struct mq_topic { char *topic_name; int topic_id; int subscriber_cnt; int is_destroyed; on_msg_dispatch_cb_func *dispatch_cb; void *dispatch_cb_arg; mq_msg_free_cb_func *free_cb; void *free_cb_arg; struct mq_subscriber *subscribers; }__attribute__((aligned(sizeof(void*)))); struct mq_schema { UT_array *topic_array; int mq_topic_num; int mq_topic_subscriber_num; }; struct mq_runtime { struct mq_schema *schema; struct mq_message *priority_mq[STELLAR_MQ_MAX];// message list bool publish_enabled; }; int mq_runtime_publish_message_with_priority(struct mq_runtime *rt, int topic_id, void *data, enum mq_property priority); #ifdef __cplusplus } #endif