Microsoft Azure IoT Gateway SDK  1.0.8
The Microsoft Azure IoT Gateway SDK contains the infrastructure and modules to create IoT gateway solutions.
message.h
Go to the documentation of this file.
1 // Copyright (c) Microsoft. All rights reserved.
2 // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 
26 #ifndef MESSAGE_H
27 #define MESSAGE_H
28 
29 #include "azure_c_shared_utility/macro_utils.h"
30 #include "azure_c_shared_utility/map.h"
31 #include "azure_c_shared_utility/constmap.h"
32 #include "azure_c_shared_utility/constbuffer.h"
33 #include "gateway_export.h"
34 
35 #ifdef __cplusplus
36  #include <cstdint>
37  #include <cstddef>
38  extern "C" {
39 #else
40  #include <stdint.h>
41  #include <stddef.h>
42 #endif
43 
44 #define GATEWAY_MESSAGE_VERSION_1 0x01
45 #define GATEWAY_MESSAGE_VERSION_CURRENT GATEWAY_MESSAGE_VERSION_1
46 
48 typedef struct MESSAGE_HANDLE_DATA_TAG* MESSAGE_HANDLE;
49 
53 typedef struct MESSAGE_CONFIG_TAG
54 {
60  size_t size;
61 
66  const unsigned char* source;
67 
72  MAP_HANDLE sourceProperties;
74 
77 {
81  CONSTBUFFER_HANDLE sourceContent;
82 
87  MAP_HANDLE sourceProperties;
89 
90 #include "azure_c_shared_utility/umock_c_prod.h"
91 
106 MOCKABLE_FUNCTION(, GATEWAY_EXPORT MESSAGE_HANDLE, Message_Create, const MESSAGE_CONFIG *, cfg);
107 
120 MOCKABLE_FUNCTION(, GATEWAY_EXPORT MESSAGE_HANDLE, Message_CreateFromByteArray, const unsigned char *, source, int32_t, size);
121 
137 MOCKABLE_FUNCTION(, GATEWAY_EXPORT int32_t, Message_ToByteArray, MESSAGE_HANDLE, messageHandle, unsigned char *, buf, int32_t, size);
138 
154 MOCKABLE_FUNCTION(, GATEWAY_EXPORT MESSAGE_HANDLE, Message_CreateFromBuffer, const MESSAGE_BUFFER_CONFIG *, cfg);
155 
166 MOCKABLE_FUNCTION(, GATEWAY_EXPORT MESSAGE_HANDLE, Message_Clone, MESSAGE_HANDLE, message);
167 
180 MOCKABLE_FUNCTION(, GATEWAY_EXPORT CONSTMAP_HANDLE, Message_GetProperties, MESSAGE_HANDLE, message);
181 
192 MOCKABLE_FUNCTION(, GATEWAY_EXPORT const CONSTBUFFER *, Message_GetContent, MESSAGE_HANDLE, message);
193 
205 MOCKABLE_FUNCTION(, GATEWAY_EXPORT CONSTBUFFER_HANDLE, Message_GetContentHandle, MESSAGE_HANDLE, message);
206 
211 MOCKABLE_FUNCTION(, GATEWAY_EXPORT void, Message_Destroy, MESSAGE_HANDLE, message);
212 
213 #ifdef __cplusplus
214  }
215 #else
216 #endif
217 
218 #endif /*MESSAGE_H*/
struct MESSAGE_BUFFER_CONFIG_TAG MESSAGE_BUFFER_CONFIG
Struct defining the Message buffer configuration.
Struct defining the Message configuration; messages are constructed using this structure.
Definition: message.h:53
CONSTBUFFER_HANDLE sourceContent
The buffer containing the data that will be the content of the message.
Definition: message.h:81
MAP_HANDLE sourceProperties
A collection of key/value pairs where both the key and value are strings representing the properties ...
Definition: message.h:72
MAP_HANDLE sourceProperties
A collection of key/value pairs where both the key and value are strings representing the properties ...
Definition: message.h:87
MOCKABLE_FUNCTION(, GATEWAY_EXPORT MESSAGE_HANDLE, Message_Create, const MESSAGE_CONFIG *, cfg)
Creates a new reference counted message from a MESSAGE_CONFIG structure with the reference count init...
Struct defining the Message buffer configuration.
Definition: message.h:76
size_t size
Specifies the size of the buffer pointed at by source. This can be zero when the message has only pro...
Definition: message.h:60
struct MESSAGE_CONFIG_TAG MESSAGE_CONFIG
Struct defining the Message configuration; messages are constructed using this structure.
const unsigned char * source
Pointer to the buffer containing the data that will be the content of this message. This can be NULL when size is zero.
Definition: message.h:66
struct MESSAGE_HANDLE_DATA_TAG * MESSAGE_HANDLE
Struct representing a particular message.
Definition: message.h:48