|
3D-ICE 3.0.0
|
#include "types.h"Go to the source code of this file.
Data Structures | |
| struct | NetworkMessage_t |
| Structure used to store messages to be sent over network. More... | |
Macros | |
| #define | MESSAGE_LENGTH 256 |
Typedefs | |
| typedef struct NetworkMessage_t | NetworkMessage_t |
Functions | |
| void | network_message_init (NetworkMessage_t *message) |
| void | network_message_destroy (NetworkMessage_t *message) |
| void | increase_message_memory (NetworkMessage_t *message, Quantity_t new_size) |
| void | build_message_head (NetworkMessage_t *message, MessageType_t type) |
| void | insert_message_word (NetworkMessage_t *message, void *word) |
| Error_t | extract_message_word (NetworkMessage_t *message, void *word, Quantity_t index) |
| #define MESSAGE_LENGTH 256 |
The initial number of words that a message can store (header included)
Definition at line 58 of file network_message.h.
| typedef struct NetworkMessage_t NetworkMessage_t |
Definition of the type NetworkMessage_t
Definition at line 96 of file network_message.h.
| void build_message_head | ( | NetworkMessage_t * | message, |
| MessageType_t | type | ||
| ) |
Builds the head of a message (sets its type)
The function sets the content of the first two words of the message (i.e. the length snd the type)
| message | the address of the message to build |
| type | the type of the request |
Definition at line 93 of file network_message.c.
| Error_t extract_message_word | ( | NetworkMessage_t * | message, |
| void * | word, | ||
| Quantity_t | index | ||
| ) |
Extracts the index-th word from the content of a message
The function will not change the status/content of the message. If index indicates a position out of the message payload the result is undetermined.
| message | the address of the message to access |
| word | (out) the address of the word to extrcact |
| index | the index of the word (starting from the beginning of the content) |
TDICE_SUCCESS if the operation succeeded TDICE_FAILURE if there index specifies a word out of the message Definition at line 121 of file network_message.c.
| void increase_message_memory | ( | NetworkMessage_t * | message, |
| Quantity_t | new_size | ||
| ) |
Changes the amount of memory available to store the message
| message | the address of the message |
| new_size | the new size (number of words) |
Definition at line 76 of file network_message.c.
| void insert_message_word | ( | NetworkMessage_t * | message, |
| void * | word | ||
| ) |
Inserts a single word to the content of a message
The value pointed by word will be insert at the end of the message (as a suffix) and the length of the message is incresed conseguently
| message | the address of the message to build |
| word | (in) the address of the word to add |
Definition at line 102 of file network_message.c.
| void network_message_destroy | ( | NetworkMessage_t * | message | ) |
Destroys the content of the fields of the structure message
The function releases any dynamic memory used by the structure and resets its state calling network_message_init .
| message | the address of the structure to destroy |
Definition at line 61 of file network_message.c.
| void network_message_init | ( | NetworkMessage_t * | message | ) |
Inits the fields of the message structure with default values
The function reserves memory to store MESSAGE_LENGTH words
| message | the address of the structure to initalize |
Definition at line 46 of file network_message.c.