9 #ifndef IOTHUB_MESSAGE_H
10 #define IOTHUB_MESSAGE_H
12 #include "azure_macro_utils/macro_utils.h"
13 #include "azure_c_shared_utility/map.h"
14 #include "umock_c/umock_c_prod.h"
27 typedef enum { IOTHUB_MESSAGE_OK, IOTHUB_MESSAGE_INVALID_ARG, IOTHUB_MESSAGE_INVALID_TYPE, IOTHUB_MESSAGE_ERROR, IOTHUB_MESSAGE_BECAUSE_DESTROY }
IOTHUB_MESSAGE_RESULT;
35 typedef struct IOTHUB_MESSAGE_DIAGNOSTIC_PROPERTY_DATA_TAG
38 char* diagnosticCreationTimeUtc;
41 static const char DIAG_CREATION_TIME_UTC_PROPERTY_NAME[] =
"diag_creation_time_utc";
IOTHUB_MESSAGE_RESULT IoTHubMessage_SetMessageCreationTimeUtcSystemProperty(IOTHUB_MESSAGE_HANDLE iotHubMessageHandle, const char *messageCreationTimeUtc)
Sets the message creation time in UTC.
IOTHUB_MESSAGE_RESULT IoTHubMessage_SetAsSecurityMessage(IOTHUB_MESSAGE_HANDLE iotHubMessageHandle)
Marks a IoT Hub message as a security message. CAUTION: security messages are special messages not ea...
bool IoTHubMessage_IsSecurityMessage(IOTHUB_MESSAGE_HANDLE iotHubMessageHandle)
returns if this message is a IoT Hub security message or not
const char * IoTHubMessage_GetConnectionDeviceId(IOTHUB_MESSAGE_HANDLE iotHubMessageHandle)
Gets the connection device ID from the IOTHUB_MESSAGE_HANDLE. No new memory is allocated,...
IOTHUB_MESSAGE_RESULT IoTHubMessage_SetMessageUserIdSystemProperty(IOTHUB_MESSAGE_HANDLE iotHubMessageHandle, const char *userId)
Sets the message user id. CAUTION: SDK user should not call it directly, it is for internal use only.
const char * IoTHubMessage_GetMessageUserIdSystemProperty(IOTHUB_MESSAGE_HANDLE iotHubMessageHandle)
Gets the message user id from the IOTHUB_MESSAGE_HANDLE. No new memory is allocated,...
MAP_HANDLE IoTHubMessage_Properties(IOTHUB_MESSAGE_HANDLE iotHubMessageHandle)
Gets a handle to the message's properties map. Note that when sending messages via the HTTP transport...
IOTHUB_MESSAGE_RESULT IoTHubMessage_SetComponentName(IOTHUB_MESSAGE_HANDLE iotHubMessageHandle, const char *componentName)
Sets component name of the message.
IOTHUB_MESSAGE_RESULT IoTHubMessage_SetMessageId(IOTHUB_MESSAGE_HANDLE iotHubMessageHandle, const char *messageId)
Sets the messageId for the IOTHUB_MESSAGE_HANDLE.
const char * IoTHubMessage_GetInputName(IOTHUB_MESSAGE_HANDLE iotHubMessageHandle)
Gets the input name from the IOTHUB_MESSAGE_HANDLE. No new memory is allocated, the caller is not res...
void IoTHubMessage_Destroy(IOTHUB_MESSAGE_HANDLE iotHubMessageHandle)
Frees all resources associated with the given message handle.
const char * IoTHubMessage_GetComponentName(IOTHUB_MESSAGE_HANDLE iotHubMessageHandle)
Gets the component name from the IOTHUB_MESSAGE_HANDLE. No new memory is allocated,...
IOTHUB_MESSAGE_HANDLE IoTHubMessage_CreateFromString(const char *source)
Creates a new IoT hub message from a null terminated string. The type of the message will be set to I...
struct IOTHUB_MESSAGE_HANDLE_DATA_TAG * IOTHUB_MESSAGE_HANDLE
Handle representing an IoT Hub message.
Definition: iothub_message.h:32
IOTHUB_MESSAGE_RESULT
Enumeration specifying the status of calls to various APIs in this module.
Definition: iothub_message.h:27
IOTHUB_MESSAGE_RESULT IoTHubMessage_SetConnectionDeviceId(IOTHUB_MESSAGE_HANDLE iotHubMessageHandle, const char *connectionDeviceId)
Sets connection device Id. CAUTION: SDK user should not call it directly, it is for internal use only...
IOTHUB_MESSAGE_RESULT IoTHubMessage_SetDiagnosticPropertyData(IOTHUB_MESSAGE_HANDLE iotHubMessageHandle, const IOTHUB_MESSAGE_DIAGNOSTIC_PROPERTY_DATA *diagnosticData)
Sets the DiagnosticData for the IOTHUB_MESSAGE_HANDLE. CAUTION: SDK user should not call it directly,...
IOTHUB_MESSAGE_RESULT IoTHubMessage_SetInputName(IOTHUB_MESSAGE_HANDLE iotHubMessageHandle, const char *inputName)
Sets input for named queues. CAUTION: SDK user should not call it directly, it is for internal use on...
IOTHUB_MESSAGE_RESULT IoTHubMessage_SetOutputName(IOTHUB_MESSAGE_HANDLE iotHubMessageHandle, const char *outputName)
Sets output for named queues. CAUTION: SDK user should not call it directly, it is for internal use o...
const char * IoTHubMessage_GetOutputName(IOTHUB_MESSAGE_HANDLE iotHubMessageHandle)
Gets the output name from the IOTHUB_MESSAGE_HANDLE. No new memory is allocated, the caller is not re...
const char * IoTHubMessage_GetCorrelationId(IOTHUB_MESSAGE_HANDLE iotHubMessageHandle)
Gets the CorrelationId from the IOTHUB_MESSAGE_HANDLE. No new memory is allocated,...
const char * IoTHubMessage_GetString(IOTHUB_MESSAGE_HANDLE iotHubMessageHandle)
Returns the null terminated string stored in the message. If the content type of the message is not I...
const char * IoTHubMessage_GetContentTypeSystemProperty(IOTHUB_MESSAGE_HANDLE iotHubMessageHandle)
Returns the content-type of the message payload, if defined. No new memory is allocated,...
const char * IoTHubMessage_GetContentEncodingSystemProperty(IOTHUB_MESSAGE_HANDLE iotHubMessageHandle)
Returns the content-encoding of the message payload, if defined. No new memory is allocated,...
const char * IoTHubMessage_GetProperty(IOTHUB_MESSAGE_HANDLE iotHubMessageHandle, const char *key)
Gets a IoT Hub message's properties item. No new memory is allocated, the caller is not responsible f...
IOTHUB_MESSAGE_HANDLE IoTHubMessage_Clone(IOTHUB_MESSAGE_HANDLE iotHubMessageHandle)
Creates a new IoT hub message with the content identical to that of the iotHubMessageHandle parameter...
IOTHUB_MESSAGE_RESULT IoTHubMessage_SetContentEncodingSystemProperty(IOTHUB_MESSAGE_HANDLE iotHubMessageHandle, const char *contentEncoding)
Sets the content-encoding of the message payload, as per supported values on RFC 2616.
IOTHUB_MESSAGE_RESULT IoTHubMessage_SetConnectionModuleId(IOTHUB_MESSAGE_HANDLE iotHubMessageHandle, const char *connectionModuleId)
Sets connection module ID. CAUTION: SDK user should not call it directly, it is for internal use only...
const char * IoTHubMessage_GetMessageCreationTimeUtcSystemProperty(IOTHUB_MESSAGE_HANDLE iotHubMessageHandle)
Gets the message creation time in UTC from the IOTHUB_MESSAGE_HANDLE. No new memory is allocated,...
IOTHUB_MESSAGE_HANDLE IoTHubMessage_CreateFromByteArray(const unsigned char *byteArray, size_t size)
Creates a new IoT hub message from a byte array. The type of the message will be set to IOTHUBMESSAGE...
IOTHUB_MESSAGE_RESULT IoTHubMessage_SetProperty(IOTHUB_MESSAGE_HANDLE iotHubMessageHandle, const char *key, const char *value)
Sets a property on a IoT Hub message.
const char * IoTHubMessage_GetConnectionModuleId(IOTHUB_MESSAGE_HANDLE iotHubMessageHandle)
Gets the module name from the IOTHUB_MESSAGE_HANDLE. No new memory is allocated, the caller is not re...
const char * IoTHubMessage_GetMessageId(IOTHUB_MESSAGE_HANDLE iotHubMessageHandle)
Gets the messageId from the IOTHUB_MESSAGE_HANDLE. No new memory is allocated, the caller is not resp...
IOTHUBMESSAGE_CONTENT_TYPE IoTHubMessage_GetContentType(IOTHUB_MESSAGE_HANDLE iotHubMessageHandle)
Returns the content type of the message given by parameter iotHubMessageHandle.
IOTHUBMESSAGE_CONTENT_TYPE
Enumeration specifying the content type of a given message.
Definition: iothub_message.h:30
IOTHUB_MESSAGE_RESULT IoTHubMessage_SetContentTypeSystemProperty(IOTHUB_MESSAGE_HANDLE iotHubMessageHandle, const char *contentType)
Sets the content-type of the message payload, as per supported values on RFC 2046.
const IOTHUB_MESSAGE_DIAGNOSTIC_PROPERTY_DATA * IoTHubMessage_GetDiagnosticPropertyData(IOTHUB_MESSAGE_HANDLE iotHubMessageHandle)
Gets the DiagnosticData from the IOTHUB_MESSAGE_HANDLE. CAUTION: SDK user should not call it directly...
IOTHUB_MESSAGE_RESULT IoTHubMessage_GetByteArray(IOTHUB_MESSAGE_HANDLE iotHubMessageHandle, const unsigned char **buffer, size_t *size)
Fetches a pointer and size for the data associated with the IoT hub message handle....
IOTHUB_MESSAGE_RESULT IoTHubMessage_SetCorrelationId(IOTHUB_MESSAGE_HANDLE iotHubMessageHandle, const char *correlationId)
Sets the CorrelationId for the IOTHUB_MESSAGE_HANDLE.
diagnostic related data
Definition: iothub_message.h:36