16 #include <stdatomic.h>
21 #define MSG_PAYLOAD_BASE_SIZE 32
29 #define msg_is_before(a, b) ((a)->dest_t < (b)->dest_t || ((a)->dest_t == (b)->dest_t && msg_is_before_extended(a, b)))
36 #define msg_preamble_size() (offsetof(struct lp_msg, dest))
43 #define msg_remote_data(msg) (&(msg)->dest)
50 #define msg_remote_size(msg) (offsetof(struct lp_msg, pl) - msg_preamble_size() + (msg)->pl_size)
56 #define msg_remote_anti_size() (offsetof(struct lp_msg, m_seq) - msg_preamble_size() + sizeof(uint32_t))
90 enum msg_flag { MSG_FLAG_ANTI = 1, MSG_FLAG_PROCESSED = 2 };
105 if ((a->raw_flags & MSG_FLAG_ANTI) != (b->raw_flags & MSG_FLAG_ANTI))
106 return (a->raw_flags & MSG_FLAG_ANTI) > (b->raw_flags & MSG_FLAG_ANTI);
108 if (a->m_type != b->m_type)
109 return a->m_type > b->m_type;
111 if (a->pl_size != b->pl_size)
112 return a->pl_size < b->pl_size;
114 return memcmp(a->pl, b->pl, a->pl_size) > 0;
double simtime_t
Simulation time data type.
Definition: ROOT-Sim.h:27
uint64_t lp_id_t
Logical Process ID data type.
Definition: ROOT-Sim.h:33
Core ROOT-Sim functionalities.
static bool msg_is_before_extended(const struct lp_msg *restrict a, const struct lp_msg *restrict b)
Compute a deterministic order for messages with same timestamp.
Definition: msg.h:103
#define MSG_PAYLOAD_BASE_SIZE
The minimum size of the payload to which message allocations are snapped to.
Definition: msg.h:21
A model simulation message.
Definition: msg.h:59
uint32_t raw_flags
The message unique id, used for inter-node anti messages.
Definition: msg.h:70
uint32_t m_type
The message type, a user controlled field.
Definition: msg.h:81
unsigned char pl[MSG_PAYLOAD_BASE_SIZE]
The initial part of the payload.
Definition: msg.h:85
unsigned char extra_pl[]
The continuation of the payload.
Definition: msg.h:87
struct lp_msg * next
The next element in the message list (used in the message queue)
Definition: msg.h:61
_Atomic uint32_t flags
The flags to handle local anti messages.
Definition: msg.h:68
lp_id_t send
The sender of the message.
Definition: msg.h:74
simtime_t send_t
The send time of the message.
Definition: msg.h:76
simtime_t dest_t
The intended destination logical time of this message.
Definition: msg.h:65
lp_id_t dest
The id of the recipient LP.
Definition: msg.h:63
uint32_t m_seq
The message sequence number.
Definition: msg.h:79
uint32_t pl_size
The message payload size.
Definition: msg.h:83