Lines Matching refs:pub
548 lws_mqtt_publish_param_t *pub = NULL; in _lws_mqtt_rx_parser() local
578 pub = (lws_mqtt_publish_param_t *)wsi->mqtt->rx_cpkt_param; in _lws_mqtt_rx_parser()
580 pub->topic_len = par->n; in _lws_mqtt_rx_parser()
583 pub->topic = (char *)lws_zalloc((size_t)pub->topic_len + 1, in _lws_mqtt_rx_parser()
585 if (!pub->topic) in _lws_mqtt_rx_parser()
587 lws_strncpy(pub->topic, (const char *)buf, in _lws_mqtt_rx_parser()
588 (size_t)pub->topic_len + 1); in _lws_mqtt_rx_parser()
589 buf += pub->topic_len; in _lws_mqtt_rx_parser()
590 len -= pub->topic_len; in _lws_mqtt_rx_parser()
593 pub->qos = (lws_mqtt_qos_levels_t) in _lws_mqtt_rx_parser()
596 pub->payload_pos = 0; in _lws_mqtt_rx_parser()
598 pub->payload_len = par->cpkt_remlen - in _lws_mqtt_rx_parser()
599 (2 + pub->topic_len + ((pub->qos) ? 2 : 0)); in _lws_mqtt_rx_parser()
601 switch (pub->qos) { in _lws_mqtt_rx_parser()
604 if (pub->payload_len == 0) in _lws_mqtt_rx_parser()
614 lws_free_set_NULL(pub->topic); in _lws_mqtt_rx_parser()
622 lws_mqtt_publish_param_t *pub = in _lws_mqtt_rx_parser() local
637 pub->payload_pos = 0; in _lws_mqtt_rx_parser()
638 pub->payload_len = par->cpkt_remlen - in _lws_mqtt_rx_parser()
639 (2 + pub->topic_len + ((pub->qos) ? 2 : 0)); in _lws_mqtt_rx_parser()
640 if (pub->payload_len == 0) in _lws_mqtt_rx_parser()
647 lws_mqtt_publish_param_t *pub = in _lws_mqtt_rx_parser() local
649 if (pub == NULL) { in _lws_mqtt_rx_parser()
655 pub->payload = buf; in _lws_mqtt_rx_parser()
1255 lws_mqtt_publish_param_t *pub = in _lws_mqtt_rx_parser() local
1260 if (pub == NULL) { in _lws_mqtt_rx_parser()
1272 chunk = pub->payload_len - pub->payload_pos; in _lws_mqtt_rx_parser()
1279 pub->topic)) in _lws_mqtt_rx_parser()
1283 (void *)pub, in _lws_mqtt_rx_parser()
1289 pub->payload_pos += (uint32_t)chunk; in _lws_mqtt_rx_parser()
1294 __func__, (int)pub->payload_pos, in _lws_mqtt_rx_parser()
1295 (int)pub->payload_len, (int)len); in _lws_mqtt_rx_parser()
1297 if (pub->payload_pos != pub->payload_len) { in _lws_mqtt_rx_parser()
1308 if (pub->qos) { in _lws_mqtt_rx_parser()
1314 lws_free_set_NULL(pub->topic); in _lws_mqtt_rx_parser()
1596 lws_mqtt_client_send_publish(struct lws *wsi, lws_mqtt_publish_param_t *pub, in lws_mqtt_client_send_publish() argument
1605 assert(pub->topic); in lws_mqtt_client_send_publish()
1637 0, pub->qos, 0)) { in lws_mqtt_client_send_publish()
1646 vh_len = 2 + pub->topic_len + ((pub->qos) ? 2 : 0); in lws_mqtt_client_send_publish()
1647 rem_len = vh_len + pub->payload_len; in lws_mqtt_client_send_publish()
1660 lws_ser_wu16be(p, pub->topic_len); in lws_mqtt_client_send_publish()
1669 (pub->topic_len + ((pub->qos) ? 2 : 0) + len), in lws_mqtt_client_send_publish()
1673 lws_strncpy((char *)p, pub->topic, (size_t)pub->topic_len+1); in lws_mqtt_client_send_publish()
1674 if (lws_mqtt_str_advance(&mqtt_vh_payload, pub->topic_len)) { in lws_mqtt_client_send_publish()
1680 if (pub->qos != QOS0) { in lws_mqtt_client_send_publish()
1682 wsi->mqtt->ack_pkt_id = pub->packet_id = ++nwsi->mqtt->pkt_id; in lws_mqtt_client_send_publish()
1685 lws_ser_wu16be(p, pub->packet_id); in lws_mqtt_client_send_publish()
1695 if (pub->payload_len && len) { in lws_mqtt_client_send_publish()
1725 if (pub->qos != QOS0) in lws_mqtt_client_send_publish()
1730 if (pub->qos == QOS0) { in lws_mqtt_client_send_publish()