in iothub_client/src/iothubtransport_mqtt_common.c [1477:1604]
static int addSystemPropertyToMessage(IOTHUB_MESSAGE_HANDLE iotHubMessage, IOTHUB_SYSTEM_PROPERTY_TYPE propertyType, const char* propValue)
{
int result;
switch (propertyType)
{
case IOTHUB_SYSTEM_PROPERTY_TYPE_CREATION_TIME:
{
if (IoTHubMessage_SetMessageCreationTimeUtcSystemProperty(iotHubMessage, propValue) != IOTHUB_MESSAGE_OK)
{
LogError("Failed to set IOTHUB_MESSAGE_HANDLE 'CreationTimeUtc' property.");
result = MU_FAILURE;
}
else
{
result = 0;
}
}
break;
case IOTHUB_SYSTEM_PROPERTY_TYPE_CORRELATION_ID:
{
if (IoTHubMessage_SetCorrelationId(iotHubMessage, propValue) != IOTHUB_MESSAGE_OK)
{
LogError("Failed to set IOTHUB_MESSAGE_HANDLE 'correlationId' property.");
result = MU_FAILURE;
}
else
{
result = 0;
}
}
break;
case IOTHUB_SYSTEM_PROPERTY_TYPE_CONNECTION_DEVICE_ID:
{
if (IoTHubMessage_SetConnectionDeviceId(iotHubMessage, propValue) != IOTHUB_MESSAGE_OK)
{
LogError("Failed to set IOTHUB_MESSAGE_HANDLE 'connectionDeviceId' property.");
result = MU_FAILURE;
}
else
{
result = 0;
}
}
break;
case IOTHUB_SYSTEM_PROPERTY_TYPE_CONNECTION_MODULE_ID:
{
if (IoTHubMessage_SetConnectionModuleId(iotHubMessage, propValue) != IOTHUB_MESSAGE_OK)
{
LogError("Failed to set IOTHUB_MESSAGE_HANDLE 'connectionModelId' property.");
result = MU_FAILURE;
}
else
{
result = 0;
}
}
break;
case IOTHUB_SYSTEM_PROPERTY_TYPE_MESSAGE_ID:
{
if (IoTHubMessage_SetMessageId(iotHubMessage, propValue) != IOTHUB_MESSAGE_OK)
{
LogError("Failed to set IOTHUB_MESSAGE_HANDLE 'messageId' property.");
result = MU_FAILURE;
}
else
{
result = 0;
}
}
break;
case IOTHUB_SYSTEM_PROPERTY_TYPE_MESSAGE_USER_ID:
{
if (IoTHubMessage_SetMessageUserIdSystemProperty(iotHubMessage, propValue) != IOTHUB_MESSAGE_OK)
{
LogError("Failed to set IOTHUB_MESSAGE_HANDLE 'messageUserId' property.");
result = MU_FAILURE;
}
else
{
result = 0;
}
}
break;
case IOTHUB_SYSTEM_PROPERTY_TYPE_CONTENT_TYPE:
{
if (IoTHubMessage_SetContentTypeSystemProperty(iotHubMessage, propValue) != IOTHUB_MESSAGE_OK)
{
LogError("Failed to set IOTHUB_MESSAGE_HANDLE 'contentType' property.");
result = MU_FAILURE;
}
else
{
result = 0;
}
}
break;
case IOTHUB_SYSTEM_PROPERTY_TYPE_CONTENT_ENCODING:
{
if (IoTHubMessage_SetContentEncodingSystemProperty(iotHubMessage, propValue) != IOTHUB_MESSAGE_OK)
{
LogError("Failed to set IOTHUB_MESSAGE_HANDLE 'contentEncoding' property.");
result = MU_FAILURE;
}
else
{
result = 0;
}
}
break;
default:
{
// This is an internal error in code as we should never have an unmapped property at this stage.
LogError("Unknown property type = %d to add to message", propertyType);
result = MU_FAILURE;
}
}
return result;
}