Basic C library for MQTT packet serialization and deserialization

Dependents:   MQTT MQTT MQTT MQTT ... more

Fork of MQTTPacket by MQTT

This library is part of the EclipseTM Paho project; specifically the embedded client.

A basic MQTT library in C for packet serialization and deserialization

Committer:
Ian Craggs
Date:
Mon Oct 30 12:47:11 2017 +0000
Revision:
25:aedcaf7984d5
Parent:
23:7a52009beba1
Merging mine and Jan's changes

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jan Jongboom 23:7a52009beba1 1 /*******************************************************************************
Jan Jongboom 23:7a52009beba1 2 * Copyright (c) 2014 IBM Corp.
Jan Jongboom 23:7a52009beba1 3 *
Jan Jongboom 23:7a52009beba1 4 * All rights reserved. This program and the accompanying materials
Jan Jongboom 23:7a52009beba1 5 * are made available under the terms of the Eclipse Public License v1.0
Jan Jongboom 23:7a52009beba1 6 * and Eclipse Distribution License v1.0 which accompany this distribution.
Jan Jongboom 23:7a52009beba1 7 *
Jan Jongboom 23:7a52009beba1 8 * The Eclipse Public License is available at
Jan Jongboom 23:7a52009beba1 9 * http://www.eclipse.org/legal/epl-v10.html
Jan Jongboom 23:7a52009beba1 10 * and the Eclipse Distribution License is available at
Jan Jongboom 23:7a52009beba1 11 * http://www.eclipse.org/org/documents/edl-v10.php.
Jan Jongboom 23:7a52009beba1 12 *
Jan Jongboom 23:7a52009beba1 13 * Contributors:
Jan Jongboom 23:7a52009beba1 14 * Ian Craggs - initial API and implementation and/or initial documentation
Jan Jongboom 23:7a52009beba1 15 *******************************************************************************/
Jan Jongboom 23:7a52009beba1 16
Jan Jongboom 23:7a52009beba1 17 #if !defined(MQTTFORMAT_H)
Jan Jongboom 23:7a52009beba1 18 #define MQTTFORMAT_H
Jan Jongboom 23:7a52009beba1 19
Jan Jongboom 23:7a52009beba1 20 #define MQTT_CLIENT
Jan Jongboom 23:7a52009beba1 21 #define MQTT_SERVER
Jan Jongboom 23:7a52009beba1 22
Jan Jongboom 23:7a52009beba1 23 #include "StackTrace.h"
Jan Jongboom 23:7a52009beba1 24 #include "MQTTPacket.h"
Jan Jongboom 23:7a52009beba1 25
Jan Jongboom 23:7a52009beba1 26 const char* MQTTPacket_getName(unsigned short packetid);
Jan Jongboom 23:7a52009beba1 27 int MQTTStringFormat_connect(char* strbuf, int strbuflen, MQTTPacket_connectData* data);
Jan Jongboom 23:7a52009beba1 28 int MQTTStringFormat_connack(char* strbuf, int strbuflen, unsigned char connack_rc, unsigned char sessionPresent);
Jan Jongboom 23:7a52009beba1 29 int MQTTStringFormat_publish(char* strbuf, int strbuflen, unsigned char dup, int qos, unsigned char retained,
Jan Jongboom 23:7a52009beba1 30 unsigned short packetid, MQTTString topicName, unsigned char* payload, int payloadlen);
Jan Jongboom 23:7a52009beba1 31 int MQTTStringFormat_ack(char* strbuf, int strbuflen, unsigned char packettype, unsigned char dup, unsigned short packetid);
Jan Jongboom 23:7a52009beba1 32 int MQTTStringFormat_subscribe(char* strbuf, int strbuflen, unsigned char dup, unsigned short packetid, int count,
Jan Jongboom 23:7a52009beba1 33 MQTTString topicFilters[], int requestedQoSs[]);
Jan Jongboom 23:7a52009beba1 34 int MQTTStringFormat_suback(char* strbuf, int strbuflen, unsigned short packetid, int count, int* grantedQoSs);
Jan Jongboom 23:7a52009beba1 35 int MQTTStringFormat_unsubscribe(char* strbuf, int strbuflen, unsigned char dup, unsigned short packetid,
Jan Jongboom 23:7a52009beba1 36 int count, MQTTString topicFilters[]);
Jan Jongboom 23:7a52009beba1 37 char* MQTTFormat_toClientString(char* strbuf, int strbuflen, unsigned char* buf, int buflen);
Jan Jongboom 23:7a52009beba1 38 char* MQTTFormat_toServerString(char* strbuf, int strbuflen, unsigned char* buf, int buflen);
Jan Jongboom 23:7a52009beba1 39
Jan Jongboom 23:7a52009beba1 40 #endif