Alchemy
1.0
A framework to robustly process network messages and structured data
|
Carbon generates c-linkable interfaces for constructs generated by Alchemy. More...
#include <Alchemy.h>
Go to the source code of this file.
Functions | |
Hg_msg_t * | Hg_clone (const Hg_msg_t *p_src) |
Creates a complete clone of an existing Hg message object. The caller must call Hg_destroy when they are done with the returned object to return the messages allocated memory. More... | |
Hg_msg_t * | Hg_create (Hg_type_t msg_type) |
Creates a new Hg message object of the specified type. The caller must call Hg_destroy when they are done with the returned object to return the messages allocated memory. More... | |
size_t | Hg_data_size (const Hg_msg_t *p_msg) |
Returns the number of bytes that are required to serialize this object. More... | |
void | Hg_destroy (Hg_msg_t *p_msg) |
The specified message is destroyed. ALL memory is reclaimed, including dynamically allocated space. More... | |
int | Hg_local_endianess () |
Reports the type of endianess of the local system. More... | |
size_t | Hg_pack (const Hg_msg_t *p_msg, void *p_buffer, size_t len) |
Serializes the specified message into a buffer. More... | |
size_t | Hg_resize_dynamic (Hg_msg_t *p_msg, void *p_field, size_t len) |
Resize the buffer for a dynamically allocated field in an existing message. More... | |
size_t | Hg_size (const Hg_msg_t *p_msg) |
Returns the size of the specified message. More... | |
int | Hg_to_big_end (Hg_msg_t *p_msg) |
Converts this object, in-place, to big-endian byte-order. The message will always be converted as requested. More... | |
int | Hg_to_host (Hg_msg_t *p_msg) |
Converts this object, in-place, to host byte-order. No actions will be performed if the local platform is big-endian. More... | |
int | Hg_to_little_end (Hg_msg_t *p_msg) |
Converts this object, in-place, to little-endian byte-order. The message will always be converted as requested. More... | |
int | Hg_to_network (Hg_msg_t *p_msg) |
Converts this object, in-place, to network byte-order. No actions will be performed if the local platform is big-endian. More... | |
Hg_type_t | Hg_type (const Hg_msg_t *p_msg) |
Returns the type of the specified message. More... | |
size_t | Hg_unpack (Hg_msg_t *p_msg, const void *p_buffer, size_t len) |
Deserializes the specified message from a buffer. More... | |
Carbon generates c-linkable interfaces for constructs generated by Alchemy.
The MIT License(MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and / or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Definition in file Carbon.h.
Hg_msg_t* Hg_clone | ( | const Hg_msg_t * | p_src | ) |
Creates a complete clone of an existing Hg message object. The caller must call Hg_destroy when they are done with the returned object to return the messages allocated memory.
p_src[in] | A valid message object that should be cloned. All of the data inside of the message, including dynamically allocated space will be initialized to match the source message. |
Definition at line 50 of file carbonate.cpp.
Hg_msg_t* Hg_create | ( | Hg_type_t | msg_type | ) |
Creates a new Hg message object of the specified type. The caller must call Hg_destroy when they are done with the returned object to return the messages allocated memory.
msg_type[in] |
Definition at line 30 of file carbonate.cpp.
size_t Hg_data_size | ( | const Hg_msg_t * | p_msg | ) |
Returns the number of bytes that are required to serialize this object.
p_msg[in] | The message to query. |
Definition at line 112 of file carbonate.cpp.
void Hg_destroy | ( | Hg_msg_t * | p_msg | ) |
The specified message is destroyed. ALL memory is reclaimed, including dynamically allocated space.
p_msg[in] | The previously allocated message to be destroyed. This message should not be used after it is passed to this function. |
Definition at line 62 of file carbonate.cpp.
int Hg_local_endianess | ( | ) |
Reports the type of endianess of the local system.
Definition at line 21 of file carbonate.cpp.
size_t Hg_pack | ( | const Hg_msg_t * | p_msg, |
void * | p_buffer, | ||
size_t | len | ||
) |
Serializes the specified message into a buffer.
p_msg[in] | The message to serialize. |
p_buffer[out] | The buffer that will be written into. |
len[in] | The length of the output buffer. |
Definition at line 173 of file carbonate.cpp.
size_t Hg_resize_dynamic | ( | Hg_msg_t * | p_msg, |
void * | p_field, | ||
size_t | len | ||
) |
Resize the buffer for a dynamically allocated field in an existing message.
p_msg[inout] | |
p_field[inout] | |
len[in] |
Definition at line 80 of file carbonate.cpp.
size_t Hg_size | ( | const Hg_msg_t * | p_msg | ) |
Returns the size of the specified message.
p_msg[in] | The message to query. |
Definition at line 102 of file carbonate.cpp.
int Hg_to_big_end | ( | Hg_msg_t * | p_msg | ) |
Converts this object, in-place, to big-endian byte-order. The message will always be converted as requested.
p_msg[in] | The message to convert. |
Definition at line 151 of file carbonate.cpp.
int Hg_to_host | ( | Hg_msg_t * | p_msg | ) |
Converts this object, in-place, to host byte-order. No actions will be performed if the local platform is big-endian.
p_msg[in] | The message to convert. |
Definition at line 140 of file carbonate.cpp.
int Hg_to_little_end | ( | Hg_msg_t * | p_msg | ) |
Converts this object, in-place, to little-endian byte-order. The message will always be converted as requested.
p_msg[in] | The message to convert. |
Definition at line 162 of file carbonate.cpp.
int Hg_to_network | ( | Hg_msg_t * | p_msg | ) |
Converts this object, in-place, to network byte-order. No actions will be performed if the local platform is big-endian.
p_msg[in] | The message to convert. |
Definition at line 127 of file carbonate.cpp.
Hg_type_t Hg_type | ( | const Hg_msg_t * | p_msg | ) |
Returns the type of the specified message.
p_msg[in] | The message to query. |
Definition at line 92 of file carbonate.cpp.
size_t Hg_unpack | ( | Hg_msg_t * | p_msg, |
const void * | p_buffer, | ||
size_t | len | ||
) |
Deserializes the specified message from a buffer.
p_msg[in] | The message to populate from the serialized buffer. |
p_buffer[out] | The buffer that will be read from. |
len[in] | The length of the input buffer. |
Definition at line 186 of file carbonate.cpp.