Messages passed to MSUs. More...
Go to the source code of this file.
Classes | |
| struct | composite_key |
| The composite key is used to store a key of arbitrary length (up to 192 bytes). More... | |
| struct | msu_msg_key |
| Used to uniquely identify the source of a message, used in state storage as well as routing. More... | |
| struct | msu_provinance_item |
| Item in the chain of history kept track of in each MSU. More... | |
| struct | msg_provinance |
| Keeps track of which MSUs have seen a given message header. More... | |
| struct | msu_msg_hdr |
| Header for messages passed to MSUs. More... | |
| struct | msu_msg |
| A message that is to be delivered to an instance of an MSU. More... | |
Macros | |
| #define | MAX_PATH_LEN 8 |
| The maximum path length recorded for a messages path through MSUs. More... | |
Functions | |
| unsigned int | msu_msg_sender_type (struct msg_provinance *prov) |
| struct msu_provinance_item * | get_provinance_item (struct msg_provinance *p, struct msu_type *type) |
| 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. More... | |
| 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. More... | |
| 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. More... | |
| 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. More... | |
| void | destroy_msu_msg_and_contents (struct msu_msg *msg) |
| Frees both the message and message data. More... | |
| 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. More... | |
| 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. More... | |
| int | enqueue_msu_msg (struct msg_queue *q, struct msu_msg *data) |
| Enqueues a message for immediate delivery. More... | |
| struct msu_msg * | dequeue_msu_msg (struct msg_queue *q) |
| Dequeues an MSU message from the provided message queue. More... | |
| 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. More... | |
| 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. More... | |
Messages passed to MSUs.
Definition in file msu_message.h.
| #define MAX_PATH_LEN 8 |
The maximum path length recorded for a messages path through MSUs.
Definition at line 66 of file msu_message.h.
| 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.
| prov | Existing provinance structure |
| sender | The sending MSU, to be added to the provinance |
Definition at line 74 of file msu_message.c.
| 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.
Definition at line 161 of file msu_message.c.
Dequeues an MSU message from the provided message queue.
Definition at line 124 of file msu_message.c.
| void destroy_msu_msg_and_contents | ( | struct msu_msg * | msg | ) |
Frees both the message and message data.
Definition at line 156 of file msu_message.c.
Enqueues a message for immediate delivery.
| q | The queue into which the message is to be placed |
| data | The message to be delivered |
Definition at line 101 of file msu_message.c.
| struct msu_provinance_item* get_provinance_item | ( | struct msg_provinance * | p, |
| struct msu_type * | type | ||
| ) |
Definition at line 45 of file msu_message.c.
| 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.
Note: key can be a local variable. Its value is copied.
| hdr | The header to reset |
| key | The key to set a copy of in the header |
Definition at line 35 of file msu_message.c.
| unsigned int msu_msg_sender_type | ( | struct msg_provinance * | prov | ) |
Definition at line 41 of file msu_message.c.
Reads an MSU message of the given size from the provided file descriptor.
Utilizes the msu_type::deserialize function of the provided MSU if applicable, otherwise just reads the provided payload.
| msu | The msu from which to take the deserialization function |
| fd | The file descriptor from which to read the message |
| size | The size of the message available in the file descriptor |
Definition at line 171 of file msu_message.c.
Schedules an MSU message to be delivered after interval time has passed.
| q | The queue into which the message is to be placed |
| data | The message to be delivered |
| interval | The amount of time which must elapse before the message is to be delivered |
Definition at line 106 of file msu_message.c.
| 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.
Definition at line 62 of file msu_message.c.
Converts an MSU message into a serializes stream of bytes.
| msg | The message to be serialized |
| dst_type | The MSU type to which the message is to be delivered. Serialization utilizes msu_type::serialize if non-NULL. |
| size_out | An output argument, set to the size of the newly serialized message |
msg Definition at line 216 of file msu_message.c.
| 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.
Definition at line 54 of file msu_message.c.
1.8.6