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 |
|
---|
4 | #ifndef MQTT_MESSAGE_H
|
---|
5 | #define MQTT_MESSAGE_H
|
---|
6 |
|
---|
7 | #include "azure_umqtt_c/mqttconst.h"
|
---|
8 | #include "umock_c/umock_c_prod.h"
|
---|
9 |
|
---|
10 | #ifdef __cplusplus
|
---|
11 | #include <cstdint>
|
---|
12 | #include <cstddef>
|
---|
13 | extern "C" {
|
---|
14 | #else
|
---|
15 | #include <stdint.h>
|
---|
16 | #include <stdbool.h>
|
---|
17 | #include <stddef.h>
|
---|
18 | #endif // __cplusplus
|
---|
19 |
|
---|
20 | typedef struct MQTT_MESSAGE_TAG* MQTT_MESSAGE_HANDLE;
|
---|
21 |
|
---|
22 | MOCKABLE_FUNCTION(, MQTT_MESSAGE_HANDLE, mqttmessage_create_in_place, uint16_t, packetId, const char*, topicName, QOS_VALUE, qosValue, const uint8_t*, appMsg, size_t, appMsgLength);
|
---|
23 | MOCKABLE_FUNCTION(, MQTT_MESSAGE_HANDLE, mqttmessage_create, uint16_t, packetId, const char*, topicName, QOS_VALUE, qosValue, const uint8_t*, appMsg, size_t, appMsgLength);
|
---|
24 | MOCKABLE_FUNCTION(,void, mqttmessage_destroy, MQTT_MESSAGE_HANDLE, handle);
|
---|
25 | MOCKABLE_FUNCTION(,MQTT_MESSAGE_HANDLE, mqttmessage_clone, MQTT_MESSAGE_HANDLE, handle);
|
---|
26 |
|
---|
27 | MOCKABLE_FUNCTION(, uint16_t, mqttmessage_getPacketId, MQTT_MESSAGE_HANDLE, handle);
|
---|
28 | MOCKABLE_FUNCTION(, const char*, mqttmessage_getTopicName, MQTT_MESSAGE_HANDLE, handle);
|
---|
29 |
|
---|
30 | /*
|
---|
31 | * @brief Gets the individual names of the MQTT topic levels, in the original order.
|
---|
32 | * @param handle Handle to the MQTT message.
|
---|
33 | * @param levels Pointer the variable where to store the level names.
|
---|
34 | * @param count Number of levels in the topic name.
|
---|
35 | * @return return Zero if no failures occur, or non-zero otherwise.
|
---|
36 | */
|
---|
37 | MOCKABLE_FUNCTION(, int, mqttmessage_getTopicLevels, MQTT_MESSAGE_HANDLE, handle, char***, levels, size_t*, count);
|
---|
38 |
|
---|
39 | MOCKABLE_FUNCTION(, QOS_VALUE, mqttmessage_getQosType, MQTT_MESSAGE_HANDLE, handle);
|
---|
40 | MOCKABLE_FUNCTION(, bool, mqttmessage_getIsDuplicateMsg, MQTT_MESSAGE_HANDLE, handle);
|
---|
41 | MOCKABLE_FUNCTION(, bool, mqttmessage_getIsRetained, MQTT_MESSAGE_HANDLE, handle);
|
---|
42 | MOCKABLE_FUNCTION(, int, mqttmessage_setIsDuplicateMsg, MQTT_MESSAGE_HANDLE, handle, bool, duplicateMsg);
|
---|
43 | MOCKABLE_FUNCTION(, int, mqttmessage_setIsRetained, MQTT_MESSAGE_HANDLE, handle, bool, retainMsg);
|
---|
44 | MOCKABLE_FUNCTION(, const APP_PAYLOAD*, mqttmessage_getApplicationMsg, MQTT_MESSAGE_HANDLE, handle);
|
---|
45 |
|
---|
46 | #ifdef __cplusplus
|
---|
47 | }
|
---|
48 | #endif // __cplusplus
|
---|
49 |
|
---|
50 | #endif // MQTT_MESSAGE_H
|
---|