Lines Matching defs:packet
239 unsigned char packet[]={
245 packet[3] = config.error_connack;
247 rc = swrite(fd, (char *)packet, sizeof(packet));
250 loghex(packet, rc);
251 logprotocol(FROM_SERVER, "CONNACK", 2, dump, packet, sizeof(packet));
253 if(rc == sizeof(packet)) {
262 unsigned char packet[]={
268 packet[2] = (unsigned char)(packetid >> 8);
269 packet[3] = (unsigned char)(packetid & 0xff);
271 rc = swrite(fd, (char *)packet, sizeof(packet));
272 if(rc == sizeof(packet)) {
274 loghex(packet, rc);
275 logprotocol(FROM_SERVER, "SUBACK", 3, dump, packet, rc);
285 unsigned char packet[]={
290 packet[2] = (unsigned char)(packetid >> 8);
291 packet[3] = (unsigned char)(packetid & 0xff);
293 rc = swrite(fd, (char *)packet, sizeof(packet));
294 if(rc == sizeof(packet)) {
296 loghex(packet, rc);
297 logprotocol(FROM_SERVER, dump, packet, rc);
308 unsigned char packet[]={
311 ssize_t rc = swrite(fd, (char *)packet, sizeof(packet));
312 if(rc == sizeof(packet)) {
314 loghex(packet, rc);
315 logprotocol(FROM_SERVER, "DISCONNECT", 0, dump, packet, rc);
361 logmsg("too large packet!");
397 unsigned char *packet;
417 /* one packet type byte (possibly two more for packetid) */
419 packet = malloc(packetlen);
420 if(!packet)
423 packet[0] = MQTT_MSG_PUBLISH; /* TODO: set QoS? */
424 memcpy(&packet[1], rembuffer, encodedlen);
429 packet[1 + encodedlen] = (unsigned char)(topiclen >> 8);
430 packet[2 + encodedlen] = (unsigned char)(topiclen & 0xff);
431 memcpy(&packet[3 + encodedlen], topic, topiclen);
434 memcpy(&packet[payloadindex], payload, payloadlen);
440 rc = swrite(fd, (char *)packet, sendamount);
443 loghex(packet, rc);
444 logprotocol(FROM_SERVER, "PUBLISH", remaininglength, dump, packet, rc);
611 /* The first packet sent from the Server to the Client MUST be a
632 /* two bytes packet id */