Lines Matching refs:len
35 int len;
45 size_t len = *(*element) ++ & SDP_DSIZE_MASK;
51 if (len < SDP_DSIZE_NEXT1)
52 return 1 << len;
53 else if (len == SDP_DSIZE_NEXT1) {
59 } else if (len == SDP_DSIZE_NEXT2) {
64 len = (*(*element) ++) << 8;
65 return len | (*(*element) ++);
71 len = (*(*element) ++) << 24;
72 len |= (*(*element) ++) << 16;
73 len |= (*(*element) ++) << 8;
74 return len | (*(*element) ++);
113 const uint8_t **req, ssize_t *len)
121 datalen = sdp_datalen(req, len);
130 (*len) -= datalen;
136 uint8_t *rsp, const uint8_t *req, ssize_t len)
146 if (len < 1)
149 seqlen = sdp_datalen(&req, &len);
150 if (seqlen < 3 || len < seqlen)
152 len -= seqlen;
160 if (len < 3)
164 len -= 2;
167 if (len <= sizeof(int))
169 len -= sizeof(int);
174 if (len > 1)
178 len = 4;
183 if (count >= start && count < max && len + 4 < MAX_RSP_PARAM_SIZE) {
185 memcpy(rsp + len, &handle, 4);
186 len += 4;
199 rsp[len ++] = sizeof(int);
200 memcpy(rsp + len, &end, sizeof(int));
201 len += 4;
203 rsp[len ++] = 0;
205 return len;
209 const uint8_t **req, ssize_t *len)
215 if (*len < 3)
221 *len -= 3;
224 if (*len < 5)
231 *len -= 5;
244 uint8_t *rsp, const uint8_t *req, ssize_t len)
253 if (len < 7)
257 len -= 4;
268 len -= 2;
273 seqlen = sdp_datalen(&req, &len);
274 if (seqlen < 3 || len < seqlen)
276 len -= seqlen;
284 if (len < 1)
288 if (len <= sizeof(int))
290 len -= sizeof(int);
295 if (len > 1)
301 len = 3 - start;
305 if (len >= 0 && len + record->attribute_list[i].len < max) {
306 memcpy(lst + len, record->attribute_list[i].pair,
307 record->attribute_list[i].len);
308 end = len + record->attribute_list[i].len;
310 len += record->attribute_list[i].len;
314 lst[1] = (len + start - 3) >> 8;
315 lst[2] = (len + start - 3) & 0xff;
321 if (end < len) {
322 len = end + start;
324 memcpy(lst + end, &len, sizeof(int));
333 const uint8_t **req, ssize_t *len)
340 if (*len < 3)
346 *len -= 3;
349 if (*len < 5)
356 *len -= 5;
371 uint8_t *rsp, const uint8_t *req, ssize_t len)
385 if (len < 1)
388 seqlen = sdp_datalen(&req, &len);
389 if (seqlen < 3 || len < seqlen)
391 len -= seqlen;
399 if (len < 3)
403 len -= 2;
408 seqlen = sdp_datalen(&req, &len);
409 if (seqlen < 3 || len < seqlen)
411 len -= seqlen;
419 if (len < 1)
423 if (len <= sizeof(int))
425 len -= sizeof(int);
430 if (len > 1)
440 len = 3 - start;
444 len += 3;
445 seqlen = len;
448 if (len >= 0)
449 if (len + record->attribute_list[j].len < max) {
450 memcpy(lst + len, record->attribute_list[j].pair,
451 record->attribute_list[j].len);
452 end = len + record->attribute_list[j].len;
454 len += record->attribute_list[j].len;
456 if (seqlen == len)
457 len -= 3;
460 lst[seqlen - 2] = (len - seqlen) >> 8;
461 lst[seqlen - 1] = (len - seqlen) & 0xff;
464 if (len == 3 - start)
465 len -= 3;
468 lst[1] = (len + start - 3) >> 8;
469 lst[2] = (len + start - 3) & 0xff;
475 if (end < len) {
476 len = end + start;
478 memcpy(lst + end, &len, sizeof(int));
486 static void bt_l2cap_sdp_sdu_in(void *opaque, const uint8_t *data, int len)
495 if (len < 5) {
496 fprintf(stderr, "%s: short SDP PDU (%iB).\n", __FUNCTION__, len);
504 len -= 5;
506 if (len != plen) {
508 __FUNCTION__, plen, len);
515 rsp_len = sdp_svc_search(sdp, rsp, data, len);
520 rsp_len = sdp_attr_get(sdp, rsp, data, len);
525 rsp_len = sdp_svc_search_attr_get(sdp, rsp, data, len);
599 int len;
610 for (len = 0; element->value.str[len] |
611 element->value.str[len + 1]; len ++);
612 return len;
619 len = 2;
622 len += sdp_attr_max_size(element ++, uuids);
623 if (len > 255)
626 return len;
633 int len = 0;
636 data[len ++] = element->type;
638 data[len ++] = (element->value.uint >> 0) & 0xff;
640 data[len ++] = (element->value.uint >> 8) & 0xff;
641 data[len ++] = (element->value.uint >> 0) & 0xff;
643 data[len ++] = (element->value.uint >> 24) & 0xff;
644 data[len ++] = (element->value.uint >> 16) & 0xff;
645 data[len ++] = (element->value.uint >> 8) & 0xff;
646 data[len ++] = (element->value.uint >> 0) & 0xff;
649 return len;
655 data[len ++] = element->type;
656 data[len ++] = (element->value.uint >> 24) & 0xff;
657 data[len ++] = (element->value.uint >> 16) & 0xff;
658 data[len ++] = (element->value.uint >> 8) & 0xff;
659 data[len ++] = (element->value.uint >> 0) & 0xff;
660 memcpy(data + len, bt_base_uuid, 12);
662 return len + 12;
668 for (len = 0; element->value.str[len] |
669 element->value.str[len + 1]; len ++);
671 len = strlen(element->value.str);
672 memcpy(data + 2, element->value.str, data[1] = len);
674 return len + 2;
677 len = 2;
680 len += sdp_attr_write(data + len, element ++, uuid);
681 data[1] = len - 2;
683 return len;
700 int len = 0;
706 len += 3;
707 len += sdp_attr_max_size(&def->attributes[record->attributes ++].data,
715 data = qemu_malloc(len);
722 len = 0;
723 data[len ++] = SDP_DTYPE_UINT | SDP_DSIZE_2;
724 data[len ++] = def->attributes[record->attributes].id >> 8;
725 data[len ++] = def->attributes[record->attributes].id & 0xff;
726 len += sdp_attr_write(data + len,
735 record->attribute_list[record->attributes ++].len = len;
736 data += len;