Lines Matching refs:offset

308 	uint16_t offset = buf_offset;  in add_a_record()  local
321 if (offset > buf_size || total_size >= buf_size - offset) { in add_a_record()
323 total_size, (int)buf_size - (int)offset); in add_a_record()
331 memcpy(&buf[offset], &inst_offs, sizeof(inst_offs)); in add_a_record()
332 offset += sizeof(inst_offs); in add_a_record()
334 rr = (struct dns_rr *)&buf[offset]; in add_a_record()
339 offset += sizeof(*rr); in add_a_record()
341 rdata = (struct dns_a_rdata *)&buf[offset]; in add_a_record()
343 offset += sizeof(*rdata); in add_a_record()
345 __ASSERT_NO_MSG(total_size == offset - buf_offset); in add_a_record()
347 return offset - buf_offset; in add_a_record()
363 uint16_t offset = buf_offset; in add_ptr_record() local
398 if (offset > buf_size || name_size >= buf_size - offset) { in add_ptr_record()
400 name_size, (int)buf_size - (int)offset); in add_ptr_record()
404 svc_offs = offset; in add_ptr_record()
411 inst_offs = offset + sp_size + sizeof(*rr); in add_ptr_record()
418 dom_offs = offset + sp_size - 1 - in add_ptr_record()
430 buf[offset++] = strlen(labels[i]); in add_ptr_record()
431 memcpy(&buf[offset], labels[i], label_size); in add_ptr_record()
432 offset += label_size; in add_ptr_record()
435 buf[offset++] = '\0'; in add_ptr_record()
439 __ASSERT_NO_MSG(svc_offs + sp_size == offset); in add_ptr_record()
441 rr = (struct dns_rr *)&buf[offset]; in add_ptr_record()
449 offset += sizeof(*rr); in add_ptr_record()
451 __ASSERT_NO_MSG(inst_offs == offset); in add_ptr_record()
455 buf[offset++] = label_size; in add_ptr_record()
456 memcpy(&buf[offset], inst->instance, label_size); in add_ptr_record()
457 offset += label_size; in add_ptr_record()
461 memcpy(&buf[offset], &svc_offs, sizeof(svc_offs)); in add_ptr_record()
462 offset += sizeof(svc_offs); in add_ptr_record()
464 __ASSERT_NO_MSG(name_size == offset - buf_offset); in add_ptr_record()
466 return offset - buf_offset; in add_ptr_record()
476 uint16_t offset = buf_offset; in add_txt_record() local
489 if (offset > buf_size || total_size >= buf_size - offset) { in add_txt_record()
491 total_size, (int)buf_size - (int)offset); in add_txt_record()
499 memcpy(&buf[offset], &inst_offs, sizeof(inst_offs)); in add_txt_record()
500 offset += sizeof(inst_offs); in add_txt_record()
502 rr = (struct dns_rr *)&buf[offset]; in add_txt_record()
507 offset += sizeof(*rr); in add_txt_record()
509 memcpy(&buf[offset], inst->text, dns_sd_txt_size(inst)); in add_txt_record()
510 offset += dns_sd_txt_size(inst); in add_txt_record()
512 __ASSERT_NO_MSG(total_size == offset - buf_offset); in add_txt_record()
514 return offset - buf_offset; in add_txt_record()
525 uint16_t offset = buf_offset; in add_aaaa_record() local
538 if (offset > buf_size || total_size >= buf_size - offset) { in add_aaaa_record()
540 total_size, (int)buf_size - (int)offset); in add_aaaa_record()
548 memcpy(&buf[offset], &inst_offs, sizeof(inst_offs)); in add_aaaa_record()
549 offset += sizeof(inst_offs); in add_aaaa_record()
551 rr = (struct dns_rr *)&buf[offset]; in add_aaaa_record()
556 offset += sizeof(*rr); in add_aaaa_record()
558 rdata = (struct dns_aaaa_rdata *)&buf[offset]; in add_aaaa_record()
560 offset += sizeof(*rdata); in add_aaaa_record()
562 __ASSERT_NO_MSG(total_size == offset - buf_offset); in add_aaaa_record()
564 return offset - buf_offset; in add_aaaa_record()
577 uint16_t offset = buf_offset; in add_srv_record() local
602 if (offset > buf_size || total_size >= buf_size - offset) { in add_srv_record()
604 total_size, (int)buf_size - (int)offset); in add_srv_record()
612 memcpy(&buf[offset], &inst_offs, sizeof(inst_offs)); in add_srv_record()
613 offset += sizeof(inst_offs); in add_srv_record()
615 rr = (struct dns_rr *)&buf[offset]; in add_srv_record()
623 offset += sizeof(*rr); in add_srv_record()
625 rdata = (struct dns_srv_rdata *)&buf[offset]; in add_srv_record()
629 offset += sizeof(*rdata); in add_srv_record()
631 *host_offset = offset; in add_srv_record()
634 buf[offset++] = label_size; in add_srv_record()
635 memcpy(&buf[offset], inst->instance, label_size); in add_srv_record()
636 offset += label_size; in add_srv_record()
640 memcpy(&buf[offset], &domain_offset, sizeof(domain_offset)); in add_srv_record()
641 offset += sizeof(domain_offset); in add_srv_record()
643 __ASSERT_NO_MSG(total_size == offset - buf_offset); in add_srv_record()
645 return offset - buf_offset; in add_srv_record()
739 uint16_t offset = sizeof(struct dns_header); in dns_sd_handle_ptr_query() local
772 r = add_ptr_record(inst, DNS_SD_PTR_TTL, buf, offset, buf_size - offset, &service_offset, in dns_sd_handle_ptr_query()
779 offset += r; in dns_sd_handle_ptr_query()
782 r = add_txt_record(inst, DNS_SD_TXT_TTL, instance_offset, buf, offset, buf_size - offset); in dns_sd_handle_ptr_query()
788 offset += r; in dns_sd_handle_ptr_query()
790 r = add_srv_record(inst, DNS_SD_SRV_TTL, instance_offset, domain_offset, buf, offset, in dns_sd_handle_ptr_query()
791 buf_size - offset, &host_offset); in dns_sd_handle_ptr_query()
797 offset += r; in dns_sd_handle_ptr_query()
800 r = add_aaaa_record(inst, DNS_SD_AAAA_TTL, host_offset, addr6->s6_addr, buf, offset, in dns_sd_handle_ptr_query()
801 buf_size - offset); /* LCOV_EXCL_LINE */ in dns_sd_handle_ptr_query()
807 offset += r; in dns_sd_handle_ptr_query()
812 r = add_a_record(inst, DNS_SD_A_TTL, host_offset, tmp, buf, offset, in dns_sd_handle_ptr_query()
813 buf_size - offset); in dns_sd_handle_ptr_query()
819 offset += r; in dns_sd_handle_ptr_query()
827 return offset; in dns_sd_handle_ptr_query()
840 uint16_t offset = sizeof(struct dns_header); in dns_sd_handle_service_type_enum() local
881 if (offset > buf_size || name_size >= buf_size - offset) { in dns_sd_handle_service_type_enum()
883 (int)buf_size - (int)offset); in dns_sd_handle_service_type_enum()
888 memcpy(&buf[offset], query, sizeof(query)); in dns_sd_handle_service_type_enum()
889 offset += sizeof(query); in dns_sd_handle_service_type_enum()
891 rr = (struct dns_rr *)&buf[offset]; in dns_sd_handle_service_type_enum()
899 offset += sizeof(*rr); in dns_sd_handle_service_type_enum()
901 buf[offset++] = service_size; in dns_sd_handle_service_type_enum()
902 memcpy(&buf[offset], inst->service, service_size); in dns_sd_handle_service_type_enum()
903 offset += service_size; in dns_sd_handle_service_type_enum()
904 buf[offset++] = DNS_SD_PROTO_SIZE; in dns_sd_handle_service_type_enum()
905 memcpy(&buf[offset], inst->proto, DNS_SD_PROTO_SIZE); in dns_sd_handle_service_type_enum()
906 offset += DNS_SD_PROTO_SIZE; in dns_sd_handle_service_type_enum()
908 memcpy(&buf[offset], &domain_offset, sizeof(domain_offset)); in dns_sd_handle_service_type_enum()
909 offset += sizeof(domain_offset); in dns_sd_handle_service_type_enum()
915 return offset; in dns_sd_handle_service_type_enum()
995 size_t offset; in dns_sd_query_extract() local
1028 offset = DNS_MSG_HEADER_SIZE; in dns_sd_query_extract()
1036 ++offset; in dns_sd_query_extract()
1064 offset += qsize; in dns_sd_query_extract()
1139 return offset; in dns_sd_query_extract()