66 #define MAX_PATH_LEN 8
194 struct msu_type *dst_type,
size_t *size_out);
Item in the chain of history kept track of in each MSU.
Header for messages passed to MSUs.
struct composite_key key
The full, arbitrary-length, unique key (used in state)
struct msu_msg * read_msu_msg(struct local_msu *msu, int fd, size_t size)
Reads an MSU message of the given size from the provided file descriptor.
struct msu_provinance_item * get_provinance_item(struct msg_provinance *p, struct msu_type *type)
int error_flag
0 if no error has been encountered
void destroy_msu_msg_and_contents(struct msu_msg *msg)
Frees both the message and message data.
Defines a type of MSU, including callback and accessor functions.
int schedule_msu_msg(struct msg_queue *q, struct msu_msg *data, struct timespec *interval)
Schedules an MSU message to be delivered after interval time has passed.
Container for linked list message queue.
int32_t id
A shorter, often hashed id for the key of fixed length (used in routing)
struct msu_provinance_item sender
The last MSU to see this message.
int seed_msg_key(void *seed, size_t seed_size, struct msu_msg_key *key)
Sets the key's composite-ID to the provided value, and sets the key's ID to a hash of the value...
struct msu_provinance_item origin
The first MSU to see this message.
void * serialize_msu_msg(struct msu_msg *msg, struct msu_type *dst_type, size_t *size_out)
Converts an MSU message into a serializes stream of bytes.
Keeps track of which MSUs have seen a given message header.
struct msu_msg * dequeue_msu_msg(struct msg_queue *q)
Dequeues an MSU message from the provided message queue.
int add_provinance(struct msg_provinance *prov, struct local_msu *sender)
Adds a new item to the path of MSUs taken within the mesasge provinance in the header.
size_t data_size
Payload size.
struct msg_provinance provinance
Message history.
int path_len
The current length of msg_provinance::path.
int set_msg_key(int32_t id, struct msu_msg_key *key)
Sets the key's ID and composite-ID to be equal to the provided id.
struct msu_provinance_item path[8]
A list of each MSU that has seen this message TODO: For now, one MSU of each type.
The structure that represents an MSU located on the local machine.
int init_msu_msg_hdr(struct msu_msg_hdr *hdr, struct msu_msg_key *key)
Initializes and resets a message header, storing a copy of the provided key.
Structures and functions for enqueueing and dequeuing general-purpose messages from a queue...
The composite key is used to store a key of arbitrary length (up to 192 bytes).
unsigned int msu_msg_sender_type(struct msg_provinance *prov)
struct msu_msg * create_msu_msg(struct msu_msg_hdr *hdr, size_t data_size, void *data)
Creates an MSU message with the appropriate header, data size, and data.
int enqueue_msu_msg(struct msg_queue *q, struct msu_msg *data)
Enqueues a message for immediate delivery.
#define MAX_PATH_LEN
The maximum path length recorded for a messages path through MSUs.
int group_id
Used to mark a route ID when storing state.
A message that is to be delivered to an instance of an MSU.
Used to uniquely identify the source of a message, used in state storage as well as routing...
size_t key_len
The length of the composite key.
struct msu_msg_key key
Routing/state key.