Lines Matching refs:topic
274 lws_mqtt_validate_topic(const char *topic, size_t topiclen, uint8_t awsiot)
277 const char *sub = topic;
284 if (topic[0] == '$') {
291 if (topic[0] == '$')
297 /* topic == "+foo" || "a/+foo" ? */
301 /* topic == "foo+" or "foo+/a" ? */
307 /* topic == "foo#" ? */
311 /* topic == "#foo" ? */
330 lws_mqtt_create_sub(struct _lws_mqtt_related *mqtt, const char *topic)
333 size_t topiclen = strlen(topic);
336 flag = lws_mqtt_validate_topic(topic, topiclen, mqtt->client.aws_iot);
344 lwsl_err("%s: Invalid topic format \"%s\"\n",
345 __func__, topic);
369 memcpy(mysub->topic, topic, strlen(topic) + 1);
470 "topic \"%s\" not supported\n",
508 /* SUB topic == PUB topic ? */
511 if (!strcmp((const char*)s->topic, ptopic))
515 s->topic, ptopic) == LMMTR_TOPIC_MATCH)
841 lwsl_notice("%s: topic too short\n", __func__);
855 /* Invalid topic len */
857 lwsl_notice("%s: zero topic len\n", __func__);
861 lwsl_debug("%s: PUBLISH topic len %d\n",
873 pub->topic = (char *)lws_zalloc((size_t)pub->topic_len + 1,
874 "rx publish topic");
875 if (!pub->topic)
877 lws_strncpy(pub->topic, (const char *)buf,
904 lws_free_set_NULL(pub->topic);
1582 * remove the topic from nwsi
1638 * registered for the related topic
1650 pub->topic))
1657 lws_free_set_NULL(pub->topic);
1693 lws_free_set_NULL(pub->topic);
1966 assert(pub->topic);
2034 lws_strncpy((char *)p, pub->topic, (size_t)pub->topic_len+1);
2146 * The stream wants to subscribe to one or more topic, but
2159 lwsl_info("%s: Subscribing to topic[%d] = \"%s\"\n",
2160 __func__, (int)n, sub->topic[n].name);
2162 mysub = lws_mqtt_find_sub(nwsi->mqtt, sub->topic[n].name);
2170 * Attach the topic we're subscribing to, to wsi->mqtt
2172 if (!lws_mqtt_create_sub(wsi->mqtt, sub->topic[n].name)) {
2213 rem_len += (2 + (uint32_t)strlen(sub->topic[n].name) + (uint32_t)1);
2249 (int)n, sub->topic[n].name);
2254 __func__, (int)n, sub->topic[n].name);
2259 * Attach the topic we're subscribing to, to nwsi->mqtt
2263 if (!lws_mqtt_create_sub(nwsi->mqtt, sub->topic[n].name))
2267 lws_ser_wu16be(p, (uint16_t)strlen(sub->topic[n].name));
2273 lws_strncpy((char *)p, sub->topic[n].name,
2274 strlen(sub->topic[n].name) + 1);
2276 (int)strlen(sub->topic[n].name)))
2281 *p = (uint8_t)sub->topic[n].qos;
2327 unsub->topic[n].name);
2383 rem_len += (2 + (uint32_t)strlen(unsub->topic[n].name));
2419 (int)n, unsub->topic[n].name);
2429 lws_ser_wu16be(p, (uint16_t)strlen(unsub->topic[n].name));
2435 lws_strncpy((char *)p, unsub->topic[n].name,
2436 strlen(unsub->topic[n].name) + 1);
2438 (int)strlen(unsub->topic[n].name)))