mirror of
https://github.com/eclipse/paho.mqtt-sn.embedded-c.git
synced 2025-12-13 07:26:52 +01:00
@@ -274,4 +274,20 @@ exit:
|
||||
return rc;
|
||||
}
|
||||
|
||||
int MQTTSNPacket_read_nb(unsigned char* buf, int buflen)
|
||||
{
|
||||
int rc = MQTTSNPACKET_READ_ERROR;
|
||||
int len = buflen; /* the length of the whole packet including length field */
|
||||
int lenlen = 0;
|
||||
int datalen = 0;
|
||||
|
||||
/* 2. read the length. This is variable in itself */
|
||||
lenlen = MQTTSNPacket_decode(buf, len, &datalen);
|
||||
if (datalen != len)
|
||||
goto exit; /* there was an error */
|
||||
|
||||
rc = buf[lenlen]; /* return the packet type */
|
||||
exit:
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -143,6 +143,8 @@ void writeCString(unsigned char** pptr, char* string);
|
||||
void writeMQTTSNString(unsigned char** pptr, MQTTSNString mqttstring);
|
||||
|
||||
int MQTTSNPacket_read(unsigned char* buf, int buflen, int (*getfn)(unsigned char*, int));
|
||||
int MQTTSNPacket_read_nb(unsigned char* buf, int buflen);
|
||||
|
||||
|
||||
#ifdef __cplusplus /* If this is a C++ compiler, use C linkage */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user