AWS IoT Device SDK C: MQTT
MQTT 3.1.1 client library
Return to main page ↑
iot_mqtt_lightweight.h
Go to the documentation of this file.
1 /*
2  * IoT MQTT V2.1.0
3  * Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy of
6  * this software and associated documentation files (the "Software"), to deal in
7  * the Software without restriction, including without limitation the rights to
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9  * the Software, and to permit persons to whom the Software is furnished to do so,
10  * subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in all
13  * copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  */
22 
30 #ifndef _IOT_MQTT_LIGHTWEIGHT_H_
31 #define _IOT_MQTT_LIGHTWEIGHT_H_
32 
33 /* The config header is always included first. */
34 #include "iot_config.h"
35 
36 /* MQTT types include. */
37 #include "types/iot_mqtt_types.h"
38 
39 /*------------------------- MQTT library functions --------------------------*/
40 
109 /* @[declare_mqtt_getconnectpacketsize] */
111  size_t * pRemainingLength,
112  size_t * pPacketSize );
113 /* @[declare_mqtt_getconnectpacketsize] */
114 
159 /* @[declare_mqtt_serializeconnect] */
161  size_t remainingLength,
162  uint8_t * pBuffer,
163  size_t bufferSize );
164 /* @[declare_mqtt_serializeconnect] */
165 
206 /* @[declare_mqtt_getsubscriptionpacketsize] */
208  const IotMqttSubscription_t * pSubscriptionList,
209  size_t subscriptionCount,
210  size_t * pRemainingLength,
211  size_t * pPacketSize );
212 /* @[declare_mqtt_getsubscriptionpacketsize] */
213 
271 /* @[declare_mqtt_serializesubscribe] */
273  size_t subscriptionCount,
274  size_t remainingLength,
275  uint16_t * pPacketIdentifier,
276  uint8_t * pBuffer,
277  size_t bufferSize );
278 /* @[declare_mqtt_serializesubscribe] */
279 
334 /* @[declare_mqtt_serializeunsubscribe] */
336  size_t subscriptionCount,
337  size_t remainingLength,
338  uint16_t * pPacketIdentifier,
339  uint8_t * pBuffer,
340  size_t bufferSize );
341 /* @[declare_mqtt_serializeunsubscribe] */
342 
380 /* @[declare_mqtt_getpublishpacketsize] */
382  size_t * pRemainingLength,
383  size_t * pPacketSize );
384 /* @[declare_mqtt_getpublishpacketsize] */
385 
445 /* @[declare_mqtt_serializepublish] */
447  size_t remainingLength,
448  uint16_t * pPacketIdentifier,
449  uint8_t ** pPacketIdentifierHigh,
450  uint8_t * pBuffer,
451  size_t bufferSize );
452 /* @[declare_mqtt_serializepublish] */
453 
489 /* @[declare_mqtt_serializedisconnect] */
491  size_t bufferSize );
492 /* @[declare_mqtt_serializedisconnect] */
493 
527 /* @[declare_mqtt_serializepingreq] */
528 IotMqttError_t IotMqtt_SerializePingreq( uint8_t * pBuffer,
529  size_t bufferSize );
530 /* @[declare_mqtt_serializepingreq] */
531 
588 /* @[declare_mqtt_getincomingmqttpackettypeandlength] */
590  IotMqttGetNextByte_t getNextByte,
591  IotNetworkConnection_t pNetworkConnection );
592 /* @[declare_mqtt_getincomingmqttpackettypeandlength] */
593 
647 /* @[declare_mqtt_deserializepublish] */
649 /* @[declare_mqtt_deserializepublish] */
650 
696 /* @[declare_mqtt_deserializeresponse] */
698 /* @[declare_mqtt_deserializeresponse] */
699 
700 
701 
702 #endif /* ifndef IOT_MQTT_SERIALIZE_H_ */
IotMqttError_t
Return codes of MQTT functions.
Definition: iot_mqtt_types.h:106
IotMqttError_t IotMqtt_DeserializePublish(IotMqttPacketInfo_t *pMqttPacket)
Deserialize incoming publish packet.
Definition: iot_mqtt_lightweight_api.c:1027
IotMqttError_t IotMqtt_GetSubscriptionPacketSize(IotMqttOperationType_t type, const IotMqttSubscription_t *pSubscriptionList, size_t subscriptionCount, size_t *pRemainingLength, size_t *pPacketSize)
Calculate the size and "Remaining length" of a SUBSCRIBE or UNSUBSCRIBE packet generated from the giv...
Definition: iot_mqtt_lightweight_api.c:732
MQTT library types.
IotMqttError_t IotMqtt_SerializePingreq(uint8_t *pBuffer, size_t bufferSize)
Generate a PINGREQ packet.
Definition: iot_mqtt_lightweight_api.c:999
IotMqttError_t IotMqtt_GetIncomingMQTTPacketTypeAndLength(IotMqttPacketInfo_t *pIncomingPacket, IotMqttGetNextByte_t getNextByte, IotNetworkConnection_t pNetworkConnection)
Extract MQTT packet type and length from incoming packet.
Definition: iot_mqtt_lightweight_api.c:815
MQTT packet details.
Definition: iot_mqtt_types.h:713
_IotNetworkConnection_t IotNetworkConnection_t
IotMqttError_t IotMqtt_GetPublishPacketSize(const IotMqttPublishInfo_t *pPublishInfo, size_t *pRemainingLength, size_t *pPacketSize)
Calculate the size and "Remaining length" of a PUBLISH packet generated from the given parameters...
Definition: iot_mqtt_lightweight_api.c:854
IotMqttError_t IotMqtt_SerializeUnsubscribe(const IotMqttSubscription_t *pSubscriptionList, size_t subscriptionCount, size_t remainingLength, uint16_t *pPacketIdentifier, uint8_t *pBuffer, size_t bufferSize)
Generate a UNSUBSCRIBE packet from the given parameters.
Definition: iot_mqtt_lightweight_api.c:930
IotMqttError_t(* IotMqttGetNextByte_t)(IotNetworkConnection_t pNetworkContext, uint8_t *pNextByte)
Function pointer to read the next available byte on a network connection.
Definition: iot_mqtt_types.h:845
Information on a PUBLISH message.
Definition: iot_mqtt_types.h:395
MQTT subscription.
Definition: iot_mqtt_types.h:553
MQTT connection details.
Definition: iot_mqtt_types.h:589
IotMqttError_t IotMqtt_SerializeConnect(const IotMqttConnectInfo_t *pConnectInfo, size_t remainingLength, uint8_t *pBuffer, size_t bufferSize)
Generate a CONNECT packet from the given parameters.
Definition: iot_mqtt_lightweight_api.c:691
IotMqttError_t IotMqtt_SerializePublish(const IotMqttPublishInfo_t *pPublishInfo, size_t remainingLength, uint16_t *pPacketIdentifier, uint8_t **pPacketIdentifierHigh, uint8_t *pBuffer, size_t bufferSize)
Generate a PUBLISH packet from the given parameters.
Definition: iot_mqtt_lightweight_api.c:889
IotMqttError_t IotMqtt_SerializeSubscribe(const IotMqttSubscription_t *pSubscriptionList, size_t subscriptionCount, size_t remainingLength, uint16_t *pPacketIdentifier, uint8_t *pBuffer, size_t bufferSize)
Generate a SUBSCRIBE packet from the given parameters.
Definition: iot_mqtt_lightweight_api.c:775
IotMqttError_t IotMqtt_SerializeDisconnect(uint8_t *pBuffer, size_t bufferSize)
Generate a DISCONNECT packet.
Definition: iot_mqtt_lightweight_api.c:970
IotMqttOperationType_t
Types of MQTT operations.
Definition: iot_mqtt_types.h:280
IotMqttError_t IotMqtt_DeserializeResponse(IotMqttPacketInfo_t *pMqttPacket)
Deserialize incoming ack packets.
Definition: iot_mqtt_lightweight_api.c:1063
IotMqttError_t IotMqtt_GetConnectPacketSize(const IotMqttConnectInfo_t *pConnectInfo, size_t *pRemainingLength, size_t *pPacketSize)
Calculate the size and "Remaining length" of a CONNECT packet generated from the given parameters...
Definition: iot_mqtt_lightweight_api.c:656