Change boolean types to char size

This commit is contained in:
Ian Craggs
2014-08-01 11:44:58 +01:00
parent 1dbcf046e0
commit 996b79872e
16 changed files with 45 additions and 45 deletions

View File

@@ -16,8 +16,6 @@
#include "MQTTSNPacket.h" #include "MQTTSNPacket.h"
#include <sys/types.h>
#if !defined(SOCKET_ERROR) #if !defined(SOCKET_ERROR)
/** error in socket operation */ /** error in socket operation */
#define SOCKET_ERROR -1 #define SOCKET_ERROR -1
@@ -108,7 +106,7 @@ int mysock = 0;
char *host = "127.0.0.1"; char *host = "127.0.0.1";
int port = 1884; int port = 1884;
int getdata(unsigned char* buf, size_t count) int getdata(unsigned char* buf, int count)
{ {
int rc = recvfrom(mysock, buf, count, 0, NULL, NULL); int rc = recvfrom(mysock, buf, count, 0, NULL, NULL);
printf("received %d bytes count %d\n", rc, (int)count); printf("received %d bytes count %d\n", rc, (int)count);
@@ -125,9 +123,10 @@ int main(int argc, char** argv)
unsigned char* payload = (unsigned char*)"mypayload"; unsigned char* payload = (unsigned char*)"mypayload";
int payloadlen = strlen((char*)payload); int payloadlen = strlen((char*)payload);
int len = 0; int len = 0;
int dup = 0; unsigned char dup = 0;
int qos = 1; int qos = 1;
int retained = 0, packetid = 1; unsigned char retained = 0;
short packetid = 1;
char *topicname = "a long topic name"; char *topicname = "a long topic name";
MQTTSNPacket_connectData options = MQTTSNPacket_connectData_initializer; MQTTSNPacket_connectData options = MQTTSNPacket_connectData_initializer;
unsigned short topicid; unsigned short topicid;
@@ -168,7 +167,7 @@ int main(int argc, char** argv)
/* subscribe */ /* subscribe */
printf("Subscribing\n"); printf("Subscribing\n");
topic.type = MQTTSN_TOPIC_TYPE_NORMAL; topic.type = MQTTSN_TOPIC_TYPE_NORMAL;
topic.data.long_.name = "substopic"; topic.data.long_.name = topicname;
topic.data.long_.len = strlen(topic.data.long_.name); topic.data.long_.len = strlen(topic.data.long_.name);
len = MQTTSNSerialize_subscribe(buf, buflen, 0, 2, /*msgid*/ 1, &topic); len = MQTTSNSerialize_subscribe(buf, buflen, 0, 2, /*msgid*/ 1, &topic);
rc = sendPacketBuffer(mysock, host, port, buf, len); rc = sendPacketBuffer(mysock, host, port, buf, len);
@@ -217,8 +216,9 @@ int main(int argc, char** argv)
if (MQTTSNPacket_read(buf, buflen, getdata) == MQTTSN_PUBLISH) if (MQTTSNPacket_read(buf, buflen, getdata) == MQTTSN_PUBLISH)
{ {
unsigned short packet_id; unsigned short packet_id;
int dup, qos, retained, payloadlen; int qos, payloadlen;
unsigned char* payload; unsigned char* payload;
unsigned char dup, retained;
MQTTSN_topicid pubtopic; MQTTSN_topicid pubtopic;
if (MQTTSNDeserialize_publish(&dup, &qos, &retained, &packet_id, &pubtopic, if (MQTTSNDeserialize_publish(&dup, &qos, &retained, &packet_id, &pubtopic,

View File

@@ -141,10 +141,11 @@ int main(int argc, char** argv)
topic.type = MQTTSN_TOPIC_TYPE_NORMAL; topic.type = MQTTSN_TOPIC_TYPE_NORMAL;
topic.data.long_.name = topicname; topic.data.long_.name = topicname;
topic.data.long_.len = strlen(topicname); topic.data.long_.len = strlen(topicname);
len = MQTTSNSerialize_publish(buf, buflen - len, dup, qos, retained, packetid, len = MQTTSNSerialize_publish(buf, buflen, dup, qos, retained, packetid,
topic, payload, payloadlen); topic, payload, payloadlen);
rc = sendPacketBuffer(mysock, host, port, buf, len); rc = sendPacketBuffer(mysock, host, port, buf, len);
printf("rc %d from send packet for publish length %d\n", rc, len);
rc = shutdown(mysock, SHUT_WR); rc = shutdown(mysock, SHUT_WR);
rc = close(mysock); rc = close(mysock);

View File

@@ -108,7 +108,7 @@ int mysock = 0;
char *host = "127.0.0.1"; char *host = "127.0.0.1";
int port = 1884; int port = 1884;
int getdata(unsigned char* buf, size_t count) int getdata(unsigned char* buf, int count)
{ {
int rc = recvfrom(mysock, buf, count, 0, NULL, NULL); int rc = recvfrom(mysock, buf, count, 0, NULL, NULL);
//printf("received %d bytes count %d\n", rc, (int)count); //printf("received %d bytes count %d\n", rc, (int)count);
@@ -128,7 +128,6 @@ int main(int argc, char** argv)
int dup = 0; int dup = 0;
int qos = 1; int qos = 1;
int retained = 0, packetid = 1; int retained = 0, packetid = 1;
char *topicname = "a long topic name";
MQTTSNPacket_connectData options = MQTTSNPacket_connectData_initializer; MQTTSNPacket_connectData options = MQTTSNPacket_connectData_initializer;
if (argc > 1) if (argc > 1)

View File

@@ -25,9 +25,9 @@ typedef struct
*/ */
int struct_version; int struct_version;
MQTTSNString clientID; MQTTSNString clientID;
int duration; unsigned short duration;
int cleansession; unsigned char cleansession;
int willFlag; unsigned char willFlag;
} MQTTSNPacket_connectData; } MQTTSNPacket_connectData;
#define MQTTSNPacket_connectData_initializer { {'M', 'Q', 'S', 'C'}, 0, {NULL, {0, NULL}}, 10, 1, 0 } #define MQTTSNPacket_connectData_initializer { {'M', 'Q', 'S', 'C'}, 0, {NULL, {0, NULL}}, 10, 1, 0 }
@@ -59,14 +59,14 @@ int MQTTSNDeserialize_willmsgupd(MQTTSNString* willMsg, unsigned char* buf, int
int MQTTSNSerialize_willmsgresp(unsigned char* buf, int buflen, int resp_rc); int MQTTSNSerialize_willmsgresp(unsigned char* buf, int buflen, int resp_rc);
int MQTTSNDeserialize_willmsgresp(int* resp_rc, unsigned char* buf, int buflen); int MQTTSNDeserialize_willmsgresp(int* resp_rc, unsigned char* buf, int buflen);
int MQTTSNSerialize_willtopic(unsigned char* buf, int buflen, int willQoS, int willRetain, MQTTSNString willTopic); int MQTTSNSerialize_willtopic(unsigned char* buf, int buflen, int willQoS, unsigned char willRetain, MQTTSNString willTopic);
int MQTTSNDeserialize_willtopic(int *willQoS, int *willRetain, MQTTSNString* willTopic, unsigned char* buf, int buflen); int MQTTSNDeserialize_willtopic(int* willQoS, unsigned char* willRetain, MQTTSNString* willTopic, unsigned char* buf, int buflen);
int MQTTSNSerialize_willtopicreq(unsigned char* buf, int buflen); int MQTTSNSerialize_willtopicreq(unsigned char* buf, int buflen);
int MQTTSNDeserialize_willtopicreq(unsigned char* buf, int buflen); int MQTTSNDeserialize_willtopicreq(unsigned char* buf, int buflen);
int MQTTSNSerialize_willtopicupd(unsigned char* buf, int buflen, int willQoS, int willRetain, MQTTSNString willTopic); int MQTTSNSerialize_willtopicupd(unsigned char* buf, int buflen, int willQoS, unsigned char willRetain, MQTTSNString willTopic);
int MQTTSNDeserialize_willtopicupd(int *willQoS, int *willRetain, MQTTSNString* willTopic, unsigned char* buf, int buflen); int MQTTSNDeserialize_willtopicupd(int *willQoS, unsigned char *willRetain, MQTTSNString* willTopic, unsigned char* buf, int buflen);
int MQTTSNSerialize_willtopicresp(unsigned char* buf, int buflen, int resp_rc); int MQTTSNSerialize_willtopicresp(unsigned char* buf, int buflen, int resp_rc);
int MQTTSNDeserialize_willtopicresp(int* resp_rc, unsigned char* buf, int buflen); int MQTTSNDeserialize_willtopicresp(int* resp_rc, unsigned char* buf, int buflen);

View File

@@ -222,7 +222,7 @@ exit:
* @param willTopic the topic of the will message * @param willTopic the topic of the will message
* @return serialized length, or error if 0 * @return serialized length, or error if 0
*/ */
int MQTTSNSerialize_willtopic1(unsigned char* buf, int buflen, int willQoS, int willRetain, MQTTSNString willTopic, int MQTTSNSerialize_willtopic1(unsigned char* buf, int buflen, int willQoS, unsigned char willRetain, MQTTSNString willTopic,
enum MQTTSN_msgTypes packet_type) enum MQTTSN_msgTypes packet_type)
{ {
unsigned char *ptr = buf; unsigned char *ptr = buf;
@@ -263,7 +263,7 @@ exit:
* @param willTopic the topic of the will message * @param willTopic the topic of the will message
* @return serialized length, or error if 0 * @return serialized length, or error if 0
*/ */
int MQTTSNSerialize_willtopicupd(unsigned char* buf, int buflen, int willQoS, int willRetain, MQTTSNString willTopic) int MQTTSNSerialize_willtopicupd(unsigned char* buf, int buflen, int willQoS, unsigned char willRetain, MQTTSNString willTopic)
{ {
return MQTTSNSerialize_willtopic1(buf, buflen, willQoS, willRetain, willTopic, MQTTSN_WILLTOPICUPD); return MQTTSNSerialize_willtopic1(buf, buflen, willQoS, willRetain, willTopic, MQTTSN_WILLTOPICUPD);
} }
@@ -278,7 +278,7 @@ int MQTTSNSerialize_willtopicupd(unsigned char* buf, int buflen, int willQoS, in
* @param willTopic the topic of the will message * @param willTopic the topic of the will message
* @return serialized length, or error if 0 * @return serialized length, or error if 0
*/ */
int MQTTSNSerialize_willtopic(unsigned char* buf, int buflen, int willQoS, int willRetain, MQTTSNString willTopic) int MQTTSNSerialize_willtopic(unsigned char* buf, int buflen, int willQoS, unsigned char willRetain, MQTTSNString willTopic)
{ {
return MQTTSNSerialize_willtopic1(buf, buflen, willQoS, willRetain, willTopic, MQTTSN_WILLTOPIC); return MQTTSNSerialize_willtopic1(buf, buflen, willQoS, willRetain, willTopic, MQTTSN_WILLTOPIC);
} }

View File

@@ -255,7 +255,7 @@ exit:
* @param len the length in bytes of the data in the supplied buffer * @param len the length in bytes of the data in the supplied buffer
* @return error code. 1 is success, 0 is failure * @return error code. 1 is success, 0 is failure
*/ */
int MQTTSNDeserialize_willtopic1(int *willQoS, int *willRetain, MQTTSNString* willTopic, unsigned char* buf, int len, int MQTTSNDeserialize_willtopic1(int *willQoS, unsigned char *willRetain, MQTTSNString* willTopic, unsigned char* buf, int len,
enum MQTTSN_msgTypes packet_type) enum MQTTSN_msgTypes packet_type)
{ {
MQTTSNFlags flags; MQTTSNFlags flags;
@@ -294,7 +294,7 @@ exit:
* @param len the length in bytes of the data in the supplied buffer * @param len the length in bytes of the data in the supplied buffer
* @return error code. 1 is success, 0 is failure * @return error code. 1 is success, 0 is failure
*/ */
int MQTTSNDeserialize_willtopic(int *willQoS, int *willRetain, MQTTSNString* willTopic, unsigned char* buf, int len) int MQTTSNDeserialize_willtopic(int *willQoS, unsigned char *willRetain, MQTTSNString* willTopic, unsigned char* buf, int len)
{ {
return MQTTSNDeserialize_willtopic1(willQoS, willRetain, willTopic, buf, len, MQTTSN_WILLTOPIC); return MQTTSNDeserialize_willtopic1(willQoS, willRetain, willTopic, buf, len, MQTTSN_WILLTOPIC);
} }
@@ -306,7 +306,7 @@ int MQTTSNDeserialize_willtopic(int *willQoS, int *willRetain, MQTTSNString* wil
* @param len the length in bytes of the data in the supplied buffer * @param len the length in bytes of the data in the supplied buffer
* @return error code. 1 is success, 0 is failure * @return error code. 1 is success, 0 is failure
*/ */
int MQTTSNDeserialize_willtopicupd(int *willQoS, int *willRetain, MQTTSNString* willTopic, unsigned char* buf, int len) int MQTTSNDeserialize_willtopicupd(int *willQoS, unsigned char *willRetain, MQTTSNString* willTopic, unsigned char* buf, int len)
{ {
return MQTTSNDeserialize_willtopic1(willQoS, willRetain, willTopic, buf, len, MQTTSN_WILLTOPICUPD); return MQTTSNDeserialize_willtopic1(willQoS, willRetain, willTopic, buf, len, MQTTSN_WILLTOPICUPD);
} }

View File

@@ -33,7 +33,7 @@
* @param buflen the length in bytes of the data in the supplied buffer * @param buflen the length in bytes of the data in the supplied buffer
* @return error code. 1 is success * @return error code. 1 is success
*/ */
int MQTTSNDeserialize_publish(int* dup, int* qos, int* retained, unsigned short* packetid, MQTTSN_topicid* topic, int MQTTSNDeserialize_publish(unsigned char* dup, int* qos, unsigned char* retained, unsigned short* packetid, MQTTSN_topicid* topic,
unsigned char** payload, int* payloadlen, unsigned char* buf, int buflen) unsigned char** payload, int* payloadlen, unsigned char* buf, int buflen)
{ {
MQTTSNFlags flags; MQTTSNFlags flags;

View File

@@ -83,7 +83,7 @@ int MQTTSNPacket_encode(unsigned char* buf, int length)
* @param value the decoded length returned * @param value the decoded length returned
* @return the number of bytes read from the socket * @return the number of bytes read from the socket
*/ */
int MQTTSNPacket_decode(unsigned char* buf, size_t buflen, int* value) int MQTTSNPacket_decode(unsigned char* buf, int buflen, int* value)
{ {
int len = MQTTSNPACKET_READ_ERROR; int len = MQTTSNPACKET_READ_ERROR;
#define MAX_NO_OF_LENGTH_BYTES 3 #define MAX_NO_OF_LENGTH_BYTES 3
@@ -246,7 +246,7 @@ int MQTTSNstrlen(MQTTSNString MQTTSNString)
* @param getfn pointer to a function which will read any number of bytes from the needed source * @param getfn pointer to a function which will read any number of bytes from the needed source
* @return integer MQTT packet type, or MQTTSNPACKET_READ_ERROR on error * @return integer MQTT packet type, or MQTTSNPACKET_READ_ERROR on error
*/ */
int MQTTSNPacket_read(unsigned char* buf, int buflen, int (*getfn)(unsigned char*, size_t)) int MQTTSNPacket_read(unsigned char* buf, int buflen, int (*getfn)(unsigned char*, int))
{ {
int rc = MQTTSNPACKET_READ_ERROR; int rc = MQTTSNPACKET_READ_ERROR;
const int MQTTSN_MIN_PACKET_LENGTH = 3; const int MQTTSN_MIN_PACKET_LENGTH = 3;

View File

@@ -126,13 +126,11 @@ int MQTTSNstrlen(MQTTSNString mqttsnstring);
#include "MQTTSNUnsubscribe.h" #include "MQTTSNUnsubscribe.h"
#include "MQTTSNSearch.h" #include "MQTTSNSearch.h"
#include <stdio.h>
char* MQTTSNPacket_name(int ptype); char* MQTTSNPacket_name(int ptype);
int MQTTSNPacket_len(int length); int MQTTSNPacket_len(int length);
int MQTTSNPacket_encode(unsigned char* buf, int length); int MQTTSNPacket_encode(unsigned char* buf, int length);
int MQTTSNPacket_decode(unsigned char* buf, size_t buflen, int* value); int MQTTSNPacket_decode(unsigned char* buf, int buflen, int* value);
int readInt(unsigned char** pptr); int readInt(unsigned char** pptr);
char readChar(unsigned char** pptr); char readChar(unsigned char** pptr);
@@ -142,7 +140,7 @@ int readMQTTSNString(MQTTSNString* mqttstring, unsigned char** pptr, unsigned ch
void writeCString(unsigned char** pptr, char* string); void writeCString(unsigned char** pptr, char* string);
void writeMQTTSNString(unsigned char** pptr, MQTTSNString mqttstring); void writeMQTTSNString(unsigned char** pptr, MQTTSNString mqttstring);
int MQTTSNPacket_read(unsigned char* buf, int buflen, int (*getfn)(unsigned char*, size_t)); int MQTTSNPacket_read(unsigned char* buf, int buflen, int (*getfn)(unsigned char*, int));
#ifdef __cplusplus /* If this is a C++ compiler, use C linkage */ #ifdef __cplusplus /* If this is a C++ compiler, use C linkage */
} }

View File

@@ -17,9 +17,9 @@
#if !defined(MQTTSNPUBLISH_H_) #if !defined(MQTTSNPUBLISH_H_)
#define MQTTSNPUBLISH_H_ #define MQTTSNPUBLISH_H_
int MQTTSNSerialize_publish(unsigned char* buf, int buflen, int dup, int qos, int retained, unsigned short packetid, int MQTTSNSerialize_publish(unsigned char* buf, int buflen, unsigned char dup, int qos, unsigned char retained, unsigned short packetid,
MQTTSN_topicid topic, unsigned char* payload, int payloadlen); MQTTSN_topicid topic, unsigned char* payload, int payloadlen);
int MQTTSNDeserialize_publish(int* dup, int* qos, int* retained, unsigned short* packetid, int MQTTSNDeserialize_publish(unsigned char* dup, int* qos, unsigned char* retained, unsigned short* packetid,
MQTTSN_topicid* topic, unsigned char** payload, int* payloadlen, unsigned char* buf, int len); MQTTSN_topicid* topic, unsigned char** payload, int* payloadlen, unsigned char* buf, int len);
int MQTTSNSerialize_puback(unsigned char* buf, int buflen, unsigned short topicid, unsigned short packetid, int MQTTSNSerialize_puback(unsigned char* buf, int buflen, unsigned short topicid, unsigned short packetid,

View File

@@ -51,7 +51,7 @@ int MQTTSNSerialize_publishLength(int payloadlen, MQTTSN_topicid topic, int qos)
* @param payloadlen integer - the length of the MQTT payload * @param payloadlen integer - the length of the MQTT payload
* @return the length of the serialized data. <= 0 indicates error * @return the length of the serialized data. <= 0 indicates error
*/ */
int MQTTSNSerialize_publish(unsigned char* buf, int buflen, int dup, int qos, int retained, unsigned short packetid, int MQTTSNSerialize_publish(unsigned char* buf, int buflen, unsigned char dup, int qos, unsigned char retained, unsigned short packetid,
MQTTSN_topicid topic, unsigned char* payload, int payloadlen) MQTTSN_topicid topic, unsigned char* payload, int payloadlen)
{ {
unsigned char *ptr = buf; unsigned char *ptr = buf;

View File

@@ -17,9 +17,9 @@
#if !defined(MQTTSNSUBSCRIBE_H_) #if !defined(MQTTSNSUBSCRIBE_H_)
#define MQTTSNSUBSCRIBE_H_ #define MQTTSNSUBSCRIBE_H_
int MQTTSNSerialize_subscribe(unsigned char* buf, int buflen, int dup, int qos, unsigned short packetid, int MQTTSNSerialize_subscribe(unsigned char* buf, int buflen, unsigned char dup, int qos, unsigned short packetid,
MQTTSN_topicid* topicFilter); MQTTSN_topicid* topicFilter);
int MQTTSNDeserialize_subscribe(int* dup, int* qos, unsigned short* packetid, int MQTTSNDeserialize_subscribe(unsigned char* dup, int* qos, unsigned short* packetid,
MQTTSN_topicid* topicFilter, unsigned char* buf, int buflen); MQTTSN_topicid* topicFilter, unsigned char* buf, int buflen);
int MQTTSNSerialize_suback(unsigned char* buf, int buflen, int qos, unsigned short topicid, unsigned short packetid, int MQTTSNSerialize_suback(unsigned char* buf, int buflen, int qos, unsigned short topicid, unsigned short packetid,

View File

@@ -48,7 +48,8 @@ int MQTTSNSerialize_subscribeLength(MQTTSN_topicid* topicFilter)
* @param topic MQTTSN_topicid - the MQTT-SN topic in the subscribe * @param topic MQTTSN_topicid - the MQTT-SN topic in the subscribe
* @return the length of the serialized data. <= 0 indicates error * @return the length of the serialized data. <= 0 indicates error
*/ */
int MQTTSNSerialize_subscribe(unsigned char* buf, int buflen, int dup, int qos, unsigned short packetid, MQTTSN_topicid* topicFilter) int MQTTSNSerialize_subscribe(unsigned char* buf, int buflen, unsigned char dup, int qos, unsigned short packetid,
MQTTSN_topicid* topicFilter)
{ {
unsigned char *ptr = buf; unsigned char *ptr = buf;
MQTTSNFlags flags; MQTTSNFlags flags;

View File

@@ -29,7 +29,7 @@
* @param buflen the length in bytes of the data in the supplied buffer * @param buflen the length in bytes of the data in the supplied buffer
* @return error code. 1 is success * @return error code. 1 is success
*/ */
int MQTTSNDeserialize_subscribe(int* dup, int* qos, unsigned short* packetid, int MQTTSNDeserialize_subscribe(unsigned char* dup, int* qos, unsigned short* packetid,
MQTTSN_topicid* topicFilter, unsigned char* buf, int buflen) MQTTSN_topicid* topicFilter, unsigned char* buf, int buflen)
{ {
MQTTSNFlags flags; MQTTSNFlags flags;

View File

@@ -412,17 +412,17 @@ int test2(struct Options options)
unsigned char buf[100]; unsigned char buf[100];
int buflen = sizeof(buf); int buflen = sizeof(buf);
int dup = 0; unsigned char dup = 0;
int qos = 2; int qos = 2;
int retained = 0; unsigned char retained = 0;
unsigned short msgid = 23; unsigned short msgid = 23;
MQTTSN_topicid topic; MQTTSN_topicid topic;
unsigned char *payload = (unsigned char*)"kkhkhkjkj jkjjk jk jk "; unsigned char *payload = (unsigned char*)"kkhkhkjkj jkjjk jk jk ";
int payloadlen = strlen((char*)payload); int payloadlen = strlen((char*)payload);
int dup2 = 1; unsigned char dup2 = 1;
int qos2 = 1; int qos2 = 1;
int retained2 = 1; unsigned char retained2 = 1;
unsigned short msgid2 = 3243; unsigned short msgid2 = 3243;
MQTTSN_topicid topic2; MQTTSN_topicid topic2;
unsigned char *payload2 = NULL; unsigned char *payload2 = NULL;
@@ -511,7 +511,8 @@ int test3(struct Options options)
assert("good rc from deserialize willmsgreq", rc == 1, "rc was %d\n", rc); assert("good rc from deserialize willmsgreq", rc == 1, "rc was %d\n", rc);
memset(buf, '\0', sizeof(buf)); memset(buf, '\0', sizeof(buf));
int willQoS = 1, willRetain = 1, willQoS1 = 0, willRetain1 = 0; int willQoS = 1, willQoS1 = 0;
unsigned char willRetain = 1, willRetain1 = 0;
MQTTSNString willTopic = MQTTSNString_initializer, willTopic1 = MQTTSNString_initializer; MQTTSNString willTopic = MQTTSNString_initializer, willTopic1 = MQTTSNString_initializer;
willTopic.cstring = "a will topic"; willTopic.cstring = "a will topic";
rc = MQTTSNSerialize_willtopic(buf, buflen, willQoS, willRetain, willTopic); rc = MQTTSNSerialize_willtopic(buf, buflen, willQoS, willRetain, willTopic);
@@ -591,12 +592,12 @@ int test4(struct Options options)
unsigned char buf[100]; unsigned char buf[100];
size_t buflen = sizeof(buf); size_t buflen = sizeof(buf);
int dup = 0; unsigned char dup = 0;
unsigned short packetid = 23; unsigned short packetid = 23;
MQTTSN_topicid topicFilter; MQTTSN_topicid topicFilter;
int req_qos = 2; int req_qos = 2;
int dup2 = 1; unsigned char dup2 = 1;
unsigned short packetid2 = 2223; unsigned short packetid2 = 2223;
MQTTSN_topicid topicFilter2; MQTTSN_topicid topicFilter2;
int req_qos2 = 0; int req_qos2 = 0;

View File

@@ -289,7 +289,7 @@ int sendPacketBuffer(int asocket, char* host, int port, unsigned char* buf, int
int mysock = 0; int mysock = 0;
int getdata(unsigned char* buf, size_t count) int getdata(unsigned char* buf, int count)
{ {
int rc = recvfrom(mysock, buf, count, 0, NULL, NULL); int rc = recvfrom(mysock, buf, count, 0, NULL, NULL);
//printf("received %d bytes count %d\n", rc, (int)count); //printf("received %d bytes count %d\n", rc, (int)count);