1 /*******************************************************************************
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 
23 const char* MQTTPacket_getName(unsigned short packetid);
24 int MQTTStringFormat_connect(char* strbuf, int strbuflen, MQTTPacket_connectData* data);
25 int MQTTStringFormat_connack(char* strbuf, int strbuflen, unsigned char connack_rc, unsigned char sessionPresent);
26 int 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);
28 int MQTTStringFormat_ack(char* strbuf, int strbuflen, unsigned char packettype, unsigned char dup, unsigned short packetid);
29 int MQTTStringFormat_subscribe(char* strbuf, int strbuflen, unsigned char dup, unsigned short packetid, int count,
30 		MQTTString topicFilters[], int requestedQoSs[]);
31 int MQTTStringFormat_suback(char* strbuf, int strbuflen, unsigned short packetid, int count, int* grantedQoSs);
32 int MQTTStringFormat_unsubscribe(char* strbuf, int strbuflen, unsigned char dup, unsigned short packetid,
33 		int count, MQTTString topicFilters[]);
34 char* MQTTFormat_toClientString(char* strbuf, int strbuflen, unsigned char* buf, int buflen);
35 char* MQTTFormat_toServerString(char* strbuf, int strbuflen, unsigned char* buf, int buflen);
36 
37 #endif
38