version 1.2.2.1, 2012/06/21 13:47:30
|
version 1.2.2.2, 2012/06/28 09:01:42
|
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; |
} |
} |