Low level MQTTSN packet library, part of the Eclipse Paho project: http://eclipse.org/paho
Dependents: MQTTSN sara-n200-hello-mqtt-sn MQTTSN_2
MQTTSNConnect.h
00001 /******************************************************************************* 00002 * Copyright (c) 2014 IBM Corp. 00003 * 00004 * All rights reserved. This program and the accompanying materials 00005 * are made available under the terms of the Eclipse Public License v1.0 00006 * and Eclipse Distribution License v1.0 which accompany this distribution. 00007 * 00008 * The Eclipse Public License is available at 00009 * http://www.eclipse.org/legal/epl-v10.html 00010 * and the Eclipse Distribution License is available at 00011 * http://www.eclipse.org/org/documents/edl-v10.php. 00012 * 00013 * Contributors: 00014 * Ian Craggs - initial API and implementation and/or initial documentation 00015 *******************************************************************************/ 00016 00017 #ifndef MQTTSNCONNECT_H_ 00018 #define MQTTSNCONNECT_H_ 00019 00020 typedef struct 00021 { 00022 /** The eyecatcher for this structure. must be MQSC. */ 00023 char struct_id[4]; 00024 /** The version number of this structure. Must be 0. 00025 */ 00026 int struct_version; 00027 MQTTSNString clientID; 00028 unsigned short duration; 00029 unsigned char cleansession; 00030 unsigned char willFlag; 00031 } MQTTSNPacket_connectData; 00032 00033 #define MQTTSNPacket_connectData_initializer { {'M', 'Q', 'S', 'C'}, 0, {NULL, {0, NULL}}, 10, 1, 0 } 00034 00035 int MQTTSNSerialize_connect(unsigned char* buf, int buflen, MQTTSNPacket_connectData* options); 00036 int MQTTSNDeserialize_connect(MQTTSNPacket_connectData* data, unsigned char* buf, int len); 00037 00038 int MQTTSNSerialize_connack(unsigned char* buf, int buflen, int connack_rc); 00039 int MQTTSNDeserialize_connack(int* connack_rc, unsigned char* buf, int buflen); 00040 00041 int MQTTSNSerialize_disconnect(unsigned char* buf, int buflen, int duration); 00042 int MQTTSNDeserialize_disconnect(int* duration, unsigned char* buf, int buflen); 00043 00044 int MQTTSNSerialize_pingreq(unsigned char* buf, int buflen, MQTTSNString clientid); 00045 int MQTTSNDeserialize_pingreq(MQTTSNString* clientID, unsigned char* buf, int len); 00046 00047 int MQTTSNSerialize_pingresp(unsigned char* buf, int buflen); 00048 int MQTTSNDeserialize_pingresp(unsigned char* buf, int buflen); 00049 00050 int MQTTSNSerialize_willmsg(unsigned char* buf, int buflen, MQTTSNString willMsg); 00051 int MQTTSNDeserialize_willmsg(MQTTSNString* willMsg, unsigned char* buf, int buflen); 00052 00053 int MQTTSNSerialize_willmsgreq(unsigned char* buf, int buflen); 00054 int MQTTSNDeserialize_willmsgreq(unsigned char* buf, int buflen); 00055 00056 int MQTTSNSerialize_willmsgupd(unsigned char* buf, int buflen, MQTTSNString willMsg); 00057 int MQTTSNDeserialize_willmsgupd(MQTTSNString* willMsg, unsigned char* buf, int buflen); 00058 00059 int MQTTSNSerialize_willmsgresp(unsigned char* buf, int buflen, int resp_rc); 00060 int MQTTSNDeserialize_willmsgresp(int* resp_rc, unsigned char* buf, int buflen); 00061 00062 int MQTTSNSerialize_willtopic(unsigned char* buf, int buflen, int willQoS, unsigned char willRetain, MQTTSNString willTopic); 00063 int MQTTSNDeserialize_willtopic(int* willQoS, unsigned char* willRetain, MQTTSNString* willTopic, unsigned char* buf, int buflen); 00064 00065 int MQTTSNSerialize_willtopicreq(unsigned char* buf, int buflen); 00066 int MQTTSNDeserialize_willtopicreq(unsigned char* buf, int buflen); 00067 00068 int MQTTSNSerialize_willtopicupd(unsigned char* buf, int buflen, int willQoS, unsigned char willRetain, MQTTSNString willTopic); 00069 int MQTTSNDeserialize_willtopicupd(int *willQoS, unsigned char *willRetain, MQTTSNString* willTopic, unsigned char* buf, int buflen); 00070 00071 int MQTTSNSerialize_willtopicresp(unsigned char* buf, int buflen, int resp_rc); 00072 int MQTTSNDeserialize_willtopicresp(int* resp_rc, unsigned char* buf, int buflen); 00073 00074 #endif /* MQTTSNCONNECT_H_ */ 00075
Generated on Tue Jul 12 2022 20:35:37 by 1.7.2