Lines Matching refs:packet
235 unsigned char packet[]={ in connack() local
241 packet[3] = config.error_connack; in connack()
243 rc = swrite(fd, (char *)packet, sizeof(packet)); in connack()
246 loghex(packet, rc); in connack()
247 logprotocol(FROM_SERVER, "CONNACK", 2, dump, packet, sizeof(packet)); in connack()
249 if(rc == sizeof(packet)) { in connack()
258 unsigned char packet[]={ in suback() local
264 packet[2] = (unsigned char)(packetid >> 8); in suback()
265 packet[3] = (unsigned char)(packetid & 0xff); in suback()
267 rc = swrite(fd, (char *)packet, sizeof(packet)); in suback()
268 if(rc == sizeof(packet)) { in suback()
270 loghex(packet, rc); in suback()
271 logprotocol(FROM_SERVER, "SUBACK", 3, dump, packet, rc); in suback()
281 unsigned char packet[]={ in puback() local
286 packet[2] = (unsigned char)(packetid >> 8); in puback()
287 packet[3] = (unsigned char)(packetid & 0xff); in puback()
289 rc = swrite(fd, (char *)packet, sizeof(packet)); in puback()
290 if(rc == sizeof(packet)) { in puback()
292 loghex(packet, rc); in puback()
293 logprotocol(FROM_SERVER, dump, packet, rc); in puback()
304 unsigned char packet[]={ in disconnect() local
307 ssize_t rc = swrite(fd, (char *)packet, sizeof(packet)); in disconnect()
308 if(rc == sizeof(packet)) { in disconnect()
310 loghex(packet, rc); in disconnect()
311 logprotocol(FROM_SERVER, "DISCONNECT", 0, dump, packet, rc); in disconnect()
393 unsigned char *packet; in publish() local
415 packet = malloc(packetlen); in publish()
416 if(!packet) in publish()
419 packet[0] = MQTT_MSG_PUBLISH; /* TODO: set QoS? */ in publish()
420 memcpy(&packet[1], rembuffer, encodedlen); in publish()
425 packet[1 + encodedlen] = (unsigned char)(topiclen >> 8); in publish()
426 packet[2 + encodedlen] = (unsigned char)(topiclen & 0xff); in publish()
427 memcpy(&packet[3 + encodedlen], topic, topiclen); in publish()
430 memcpy(&packet[payloadindex], payload, payloadlen); in publish()
436 rc = swrite(fd, (char *)packet, sendamount); in publish()
439 loghex(packet, rc); in publish()
440 logprotocol(FROM_SERVER, "PUBLISH", remaininglength, dump, packet, rc); in publish()
442 free(packet); in publish()