#include "msu_message.h"
#include "logging.h"
#include "communication.h"
#include "local_msu.h"
#include "uthash.h"
#include "runtime_dfg.h"
#include "profiler.h"
#include <stdlib.h>
Go to the source code of this file.
Functions | |
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... | |
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 | 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... | |
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 | enqueue_msu_msg (struct msg_queue *q, struct msu_msg *data) |
Enqueues a message for immediate delivery. 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... | |
struct msu_msg * | dequeue_msu_msg (struct msg_queue *q) |
Dequeues an MSU message from the provided message queue. More... | |
int | read_msu_msg_hdr (int fd, struct msu_msg_hdr *hdr) |
void | destroy_msu_msg_and_contents (struct msu_msg *msg) |
Frees both the message and message data. 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... | |
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... | |
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... | |
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.
int read_msu_msg_hdr | ( | int | fd, |
struct msu_msg_hdr * | hdr | ||
) |
Definition at line 147 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.