Lines Matching defs:buf
43 lws_mqtt_vbi_encode(uint32_t value, void *buf)
45 uint8_t *p = (uint8_t *)buf, b;
61 return lws_ptr_diff(p, (uint8_t *)buf);
134 * You can leave buf NULL, if so it will be allocated on the heap once the
137 * Or you can ensure no allocation and use an external buffer by setting buf
138 * and lim. But buf must be in the ep context somehow, since it may have to
141 * Or you can set buf to an externally allocated buffer, in which case you may
146 lws_mqtt_str_init(lws_mqtt_str_t *s, uint8_t *buf, uint16_t lim, char nf)
150 s->buf = buf;
166 s->buf = (uint8_t *)&s[1];
175 lws_mqtt_str_create_init(uint8_t *buf, uint16_t len, uint16_t lim)
187 memcpy(s->buf, buf, len);
197 lws_mqtt_str_create_cstr_dup(const char *buf, uint16_t lim)
199 size_t len = strlen(buf);
204 return lws_mqtt_str_create_init((uint8_t *)buf, (uint16_t)len, lim);
213 return &s->buf[s->pos];
239 /* buf may be independently allocated or allocated along with the
243 if (s->buf != (uint8_t *)&s[1])
244 lws_free_set_NULL(s->buf);
282 if (!s->buf) {
283 s->buf = lws_malloc(s->len, __func__);
284 if (!s->buf)
299 memcpy(s->buf + s->pos, *in, span);
306 return s->buf && s->pos == s->len ? LMSPR_COMPLETED : LMSPR_NEED_MORE;
316 if (!!bd1->buf != !!bd2->buf)
319 if (!bd1->buf && !bd2->buf)
322 return memcmp(bd1->buf, bd2->buf, bd1->len);