version 1.2.2.1, 2012/06/21 13:47:30
|
version 1.4, 2013/05/30 09:18:33
|
Line 12 terms:
|
Line 12 terms:
|
All of the documentation and software included in the ELWIX and AITNET |
All of the documentation and software included in the ELWIX and AITNET |
Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org> |
Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org> |
|
|
Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 | Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 |
by Michael Pounov <misho@elwix.org>. All rights reserved. |
by Michael Pounov <misho@elwix.org>. All rights reserved. |
|
|
Redistribution and use in source and binary forms, with or without |
Redistribution and use in source and binary forms, with or without |
Line 128 mqtt_msgPUBLISH(mqtt_msg_t * __restrict buf, const cha
|
Line 128 mqtt_msgPUBLISH(mqtt_msg_t * __restrict buf, const cha
|
static int |
static int |
_mqtt_msgPUB_(mqtt_msg_t * __restrict buf, u_char cmd, u_short msgID) |
_mqtt_msgPUB_(mqtt_msg_t * __restrict buf, u_char cmd, u_short msgID) |
{ |
{ |
int siz = 0; | int siz = sizeof(struct mqtthdr); |
struct mqtthdr *hdr; |
struct mqtthdr *hdr; |
mqtt_len_t *v; |
mqtt_len_t *v; |
|
|
Line 137 _mqtt_msgPUB_(mqtt_msg_t * __restrict buf, u_char cmd,
|
Line 137 _mqtt_msgPUB_(mqtt_msg_t * __restrict buf, u_char cmd,
|
|
|
if (mqtt_msgRealloc(buf, sizeof(struct mqtthdr) + sizeof(mqtt_len_t)) == -1) |
if (mqtt_msgRealloc(buf, sizeof(struct mqtthdr) + sizeof(mqtt_len_t)) == -1) |
return -1; |
return -1; |
else { | else |
hdr = (struct mqtthdr *) (buf->msg_base + siz); | hdr = (struct mqtthdr *) buf->msg_base; |
siz += sizeof(struct mqtthdr); | |
v = (mqtt_len_t*) (buf->msg_base + siz); | |
siz += sizeof(mqtt_len_t); | |
} | |
|
|
/* fixed header */ |
/* fixed header */ |
MQTTHDR_MSGINIT(hdr); |
MQTTHDR_MSGINIT(hdr); |
Line 150 _mqtt_msgPUB_(mqtt_msg_t * __restrict buf, u_char cmd,
|
Line 146 _mqtt_msgPUB_(mqtt_msg_t * __restrict buf, u_char cmd,
|
*hdr->mqtt_len = sizeof(mqtt_len_t); |
*hdr->mqtt_len = sizeof(mqtt_len_t); |
|
|
/* MessageID */ |
/* MessageID */ |
|
v = (mqtt_len_t*) (buf->msg_base + siz); |
v->val = htons(msgID); |
v->val = htons(msgID); |
|
siz += sizeof(mqtt_len_t); |
|
|
return siz; |
return siz; |
} |
} |
Line 162 _mqtt_msgPUB_(mqtt_msg_t * __restrict buf, u_char cmd,
|
Line 160 _mqtt_msgPUB_(mqtt_msg_t * __restrict buf, u_char cmd,
|
* @msgID = MessageID |
* @msgID = MessageID |
* return: -1 error or >-1 message size for send |
* return: -1 error or >-1 message size for send |
*/ |
*/ |
inline int | int |
mqtt_msgPUBACK(mqtt_msg_t * __restrict buf, u_short msgID) |
mqtt_msgPUBACK(mqtt_msg_t * __restrict buf, u_short msgID) |
{ |
{ |
return _mqtt_msgPUB_(buf, MQTT_TYPE_PUBACK, msgID); |
return _mqtt_msgPUB_(buf, MQTT_TYPE_PUBACK, msgID); |
Line 175 mqtt_msgPUBACK(mqtt_msg_t * __restrict buf, u_short ms
|
Line 173 mqtt_msgPUBACK(mqtt_msg_t * __restrict buf, u_short ms
|
* @msgID = MessageID |
* @msgID = MessageID |
* return: -1 error or >-1 message size for send |
* return: -1 error or >-1 message size for send |
*/ |
*/ |
inline int | int |
mqtt_msgPUBREC(mqtt_msg_t * __restrict buf, u_short msgID) |
mqtt_msgPUBREC(mqtt_msg_t * __restrict buf, u_short msgID) |
{ |
{ |
return _mqtt_msgPUB_(buf, MQTT_TYPE_PUBREC, msgID); |
return _mqtt_msgPUB_(buf, MQTT_TYPE_PUBREC, msgID); |
Line 188 mqtt_msgPUBREC(mqtt_msg_t * __restrict buf, u_short ms
|
Line 186 mqtt_msgPUBREC(mqtt_msg_t * __restrict buf, u_short ms
|
* @msgID = MessageID |
* @msgID = MessageID |
* return: -1 error or >-1 message size for send |
* return: -1 error or >-1 message size for send |
*/ |
*/ |
inline int | int |
mqtt_msgPUBREL(mqtt_msg_t * __restrict buf, u_short msgID) |
mqtt_msgPUBREL(mqtt_msg_t * __restrict buf, u_short msgID) |
{ |
{ |
return _mqtt_msgPUB_(buf, MQTT_TYPE_PUBREL, msgID); |
return _mqtt_msgPUB_(buf, MQTT_TYPE_PUBREL, msgID); |
Line 201 mqtt_msgPUBREL(mqtt_msg_t * __restrict buf, u_short ms
|
Line 199 mqtt_msgPUBREL(mqtt_msg_t * __restrict buf, u_short ms
|
* @msgID = MessageID |
* @msgID = MessageID |
* return: -1 error or >-1 message size for send |
* return: -1 error or >-1 message size for send |
*/ |
*/ |
inline int | int |
mqtt_msgPUBCOMP(mqtt_msg_t * __restrict buf, u_short msgID) |
mqtt_msgPUBCOMP(mqtt_msg_t * __restrict buf, u_short msgID) |
{ |
{ |
return _mqtt_msgPUB_(buf, MQTT_TYPE_PUBCOMP, msgID); |
return _mqtt_msgPUB_(buf, MQTT_TYPE_PUBCOMP, msgID); |