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