[398] | 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_CODEC_H
|
---|
| 5 | #define MQTT_CODEC_H
|
---|
| 6 |
|
---|
| 7 | #include "azure_c_shared_utility/xio.h"
|
---|
| 8 | #include "azure_c_shared_utility/buffer_.h"
|
---|
| 9 | #include "azure_c_shared_utility/umock_c_prod.h"
|
---|
| 10 | #include "azure_umqtt_c/mqttconst.h"
|
---|
| 11 | #include "azure_c_shared_utility/strings.h"
|
---|
| 12 |
|
---|
| 13 | #ifdef __cplusplus
|
---|
| 14 | #include <cstdint>
|
---|
| 15 | #include <cstddef>
|
---|
| 16 | extern "C" {
|
---|
| 17 | #else
|
---|
| 18 | #include <stdint.h>
|
---|
| 19 | #include <stdbool.h>
|
---|
| 20 | #include <stddef.h>
|
---|
| 21 | #endif // __cplusplus
|
---|
| 22 |
|
---|
| 23 | typedef struct MQTTCODEC_INSTANCE_TAG* MQTTCODEC_HANDLE;
|
---|
| 24 |
|
---|
| 25 | typedef void(*ON_PACKET_COMPLETE_CALLBACK)(void* context, CONTROL_PACKET_TYPE packet, int flags, BUFFER_HANDLE headerData);
|
---|
| 26 |
|
---|
| 27 | MOCKABLE_FUNCTION(, MQTTCODEC_HANDLE, mqtt_codec_create, ON_PACKET_COMPLETE_CALLBACK, packetComplete, void*, callbackCtx);
|
---|
| 28 | MOCKABLE_FUNCTION(, void, mqtt_codec_destroy, MQTTCODEC_HANDLE, handle);
|
---|
| 29 |
|
---|
| 30 | MOCKABLE_FUNCTION(, void, mqtt_codec_reset, MQTTCODEC_HANDLE, handle);
|
---|
| 31 | MOCKABLE_FUNCTION(, BUFFER_HANDLE, mqtt_codec_connect, const MQTT_CLIENT_OPTIONS*, mqttOptions, STRING_HANDLE, trace_log);
|
---|
| 32 | MOCKABLE_FUNCTION(, BUFFER_HANDLE, mqtt_codec_disconnect);
|
---|
| 33 | MOCKABLE_FUNCTION(, BUFFER_HANDLE, mqtt_codec_publish, QOS_VALUE, qosValue, bool, duplicateMsg, bool, serverRetain, uint16_t, packetId, const char*, topicName, const uint8_t*, msgBuffer, size_t, buffLen, STRING_HANDLE, trace_log);
|
---|
| 34 | MOCKABLE_FUNCTION(, BUFFER_HANDLE, mqtt_codec_publishAck, uint16_t, packetId);
|
---|
| 35 | MOCKABLE_FUNCTION(, BUFFER_HANDLE, mqtt_codec_publishReceived, uint16_t, packetId);
|
---|
| 36 | MOCKABLE_FUNCTION(, BUFFER_HANDLE, mqtt_codec_publishRelease, uint16_t, packetId);
|
---|
| 37 | MOCKABLE_FUNCTION(, BUFFER_HANDLE, mqtt_codec_publishComplete, uint16_t, packetId);
|
---|
| 38 | MOCKABLE_FUNCTION(, BUFFER_HANDLE, mqtt_codec_ping);
|
---|
| 39 | MOCKABLE_FUNCTION(, BUFFER_HANDLE, mqtt_codec_subscribe, uint16_t, packetId, SUBSCRIBE_PAYLOAD*, subscribeList, size_t, count, STRING_HANDLE, trace_log);
|
---|
| 40 | MOCKABLE_FUNCTION(, BUFFER_HANDLE, mqtt_codec_unsubscribe, uint16_t, packetId, const char**, unsubscribeList, size_t, count, STRING_HANDLE, trace_log);
|
---|
| 41 |
|
---|
| 42 | MOCKABLE_FUNCTION(, int, mqtt_codec_bytesReceived, MQTTCODEC_HANDLE, handle, const unsigned char*, buffer, size_t, size);
|
---|
| 43 |
|
---|
| 44 | #ifdef __cplusplus
|
---|
| 45 | }
|
---|
| 46 | #endif // __cplusplus
|
---|
| 47 |
|
---|
| 48 | #endif // MQTT_CODEC_H
|
---|