Lines Matching defs:towire
228 dns_towire_state_t towire;
323 #define TOWIRE_CHECK(note, towire, func) { func; if ((towire)->error != 0 && failnote == NULL) failnote = (note); }
1159 dns_towire_state_t *towire = &query->towire;
1164 uint8_t *revert = query->towire.p; // Remember where we were in case there's no room.
1221 TOWIRE_CHECK("concatenate_name_to_wire", towire,
1222 dns_concatenate_name_to_wire(towire, NULL, question->name, question->served_domain->domain));
1226 TOWIRE_CHECK("compress_name_to_wire", towire, dns_concatenate_name_to_wire(towire, NULL, NULL, question->name));
1230 TOWIRE_CHECK("rrtype", towire, dns_u16_to_wire(towire, rrtype));
1231 TOWIRE_CHECK("rrclass", towire, dns_u16_to_wire(towire, rrclass));
1232 TOWIRE_CHECK("ttl", towire, dns_ttl_to_wire(towire, ttl));
1254 TOWIRE_CHECK("rdlength begin", towire, dns_rdlength_begin(towire));
1258 TOWIRE_CHECK("rdlength begin", towire, dns_rdlength_begin(towire));
1259 TOWIRE_CHECK("answer.data.srv.priority", towire, dns_u16_to_wire(towire, answer.data.srv.priority));
1260 TOWIRE_CHECK("answer.data.srv.weight", towire, dns_u16_to_wire(towire, answer.data.srv.weight));
1261 TOWIRE_CHECK("answer.data.srv.port", towire, dns_u16_to_wire(towire, answer.data.srv.port));
1276 TOWIRE_CHECK("concatenate_name_to_wire 2", towire,
1277 dns_concatenate_name_to_wire(towire, name, NULL, question->served_domain->domain));
1281 TOWIRE_CHECK("concatenate_name_to_wire 2", towire,
1282 dns_concatenate_name_to_wire(towire, name, NULL, NULL));
1287 dns_rdlength_end(towire);
1291 TOWIRE_CHECK("rdlen", towire, dns_u16_to_wire(towire, rdlen));
1292 TOWIRE_CHECK("rdata", towire, dns_rdata_raw_data_to_wire(towire, rdata, rdlen));
1295 if (towire->truncated || failnote) {
1297 query->towire.p = revert;
1453 dns_towire_state_t towire;
1456 memset(&towire, 0, sizeof towire);
1457 towire.message = &wire;
1458 towire.p = wire.data;
1459 towire.lim = towire.p + sizeof wire.data;
1473 dns_rdata_raw_data_to_wire(&towire, rdata_ptr, addr_len);
1476 dnssd_hardwired_add(sdt, name, name[0] == '\0' ? sdt->domain : sdt->domain_ld, towire.p - wire.data, wire.data,
1481 towire.p - wire.data, wire.data, addr_type);
1518 memset(&towire, 0, sizeof towire); \
1519 towire.message = &wire; \
1520 towire.p = wire.data; \
1521 towire.lim = towire.p + sizeof wire.data
1568 dns_towire_state_t towire;
1572 memset(&towire, 0, sizeof towire); \
1573 towire.message = &wire; \
1574 towire.p = wire.data; \
1575 towire.lim = towire.p + sizeof wire.data
1589 dns_full_name_to_wire(NULL, &towire, if_domain->domain);
1592 dnssd_hardwired_add(sdt, name, sdt->domain_ld, towire.p - wire.data, wire.data, dns_rrtype_ptr);
1595 succeeded = dnssd_hardwired_remove_record(sdt, name, sdt->domain_ld, towire.p - wire.data, wire.data,
1770 dns_towire_state_t towire;
1777 memset(&towire, 0, sizeof towire); \
1778 towire.message = &wire; \
1779 towire.p = wire.data; \
1780 towire.lim = towire.p + sizeof wire.data
1795 dnssd_hardwired_add(sdt, "_dns-llq._udp", sdt->domain_ld, towire.p - wire.data, wire.data, dns_rrtype_srv);
1796 dnssd_hardwired_add(sdt, "_dns-llq-tls._tcp", sdt->domain_ld, towire.p - wire.data, wire.data, dns_rrtype_srv);
1799 dnssd_hardwired_add(sdt, "_dns-update._udp", sdt->domain_ld, towire.p - wire.data, wire.data, dns_rrtype_srv);
1800 dnssd_hardwired_add(sdt, "_dns-update-tls._tcp", sdt->domain_ld, towire.p - wire.data, wire.data,
1805 dnssd_hardwired_add(sdt, "_dns-push-tls._tcp", sdt->domain_ld, towire.p - wire.data, wire.data, dns_rrtype_srv);
1844 dns_rdata_raw_data_to_wire(&towire, &addr.sin.sin_addr, sizeof addr.sin.sin_addr);
1845 dnssd_hardwired_add(sdt, local_name, local_domain, towire.p - wire.data, wire.data,
1850 dns_rdata_raw_data_to_wire(&towire, &addr.sin6.sin6_addr, sizeof addr.sin6.sin6_addr);
1851 dnssd_hardwired_add(sdt, local_name, local_domain, towire.p - wire.data, wire.data,
1867 dns_full_name_to_wire(NULL, &towire, local_host_name_dot_local);
1871 dns_name_to_wire(NULL, &towire, uuid_name);
1872 dns_full_name_to_wire(NULL, &towire, sdt->domain);
1874 dns_name_to_wire(NULL, &towire, "ns");
1875 dns_full_name_to_wire(NULL, &towire, sdt->domain);
1877 dnssd_hardwired_add(sdt, "", sdt->domain, towire.p - wire.data, wire.data, dns_rrtype_ns);
1880 dns_name_to_wire(NULL, &towire, "postmaster");
1881 dns_full_name_to_wire(NULL, &towire, sdt->domain);
1882 dns_u32_to_wire(&towire, 0); // serial
1883 dns_ttl_to_wire(&towire, 7200); // refresh
1884 dns_ttl_to_wire(&towire, 3600); // retry
1885 dns_ttl_to_wire(&towire, 86400); // expire
1886 dns_ttl_to_wire(&towire, 120); // minimum
1887 dnssd_hardwired_add(sdt, "", sdt->domain, towire.p - wire.data, wire.data, dns_rrtype_soa);
1933 dns_rdata_raw_data_to_wire(&towire, &if_addr->sin.sin_addr, sizeof(if_addr->sin.sin_addr));
1936 dns_rdata_raw_data_to_wire(&towire, &if_addr->sin6.sin6_addr, sizeof(if_addr->sin6.sin6_addr));
1944 dnssd_hardwired_add(my_name_served_domain, "", my_name_served_domain->domain, towire.p - wire.data,
1949 towire.p - wire.data, wire.data, rr_type);
1953 towire.p - wire.data, wire.data, rr_type);
1958 towire.p - wire.data, wire.data, rr_type);
1979 dns_rdata_raw_data_to_wire(&towire, &addr.sin.sin_addr, sizeof addr.sin.sin_addr);
1980 dnssd_hardwired_add(sdt, "", sdt->domain, towire.p - wire.data, wire.data, dns_rrtype_a);
1982 dns_rdata_raw_data_to_wire(&towire, &addr.sin6.sin6_addr, sizeof addr.sin6.sin6_addr);
1983 dnssd_hardwired_add(sdt, "", sdt->domain, towire.p - wire.data, wire.data, dns_rrtype_aaaa);
2042 dns_towire_state_t towire;
2045 memset(&towire, 0, sizeof towire); \
2046 towire.message = &wire; \
2047 towire.p = wire.data; \
2048 towire.lim = towire.p + sizeof wire.data
2052 dnssd_hardwired_add(served_domain, "_dns-llq._udp", served_domain->domain_ld, towire.p - wire.data, wire.data, dns_rrtype_srv);
2053 dnssd_hardwired_add(served_domain, "_dns-llq-tls._tcp", served_domain->domain_ld, towire.p - wire.data, wire.data, dns_rrtype_srv);
2056 dnssd_hardwired_add(served_domain, "_dns-update._udp", served_domain->domain_ld, towire.p - wire.data, wire.data, dns_rrtype_srv);
2057 dnssd_hardwired_add(served_domain, "_dns-update-tls._tcp", served_domain->domain_ld, towire.p - wire.data, wire.data, dns_rrtype_srv);
2060 dnssd_hardwired_add(served_domain, "_dns-query-tls._udp", served_domain->domain_ld, towire.p - wire.data, wire.data, dns_rrtype_srv);
2065 towire.p - wire.data, wire.data, dns_rrtype_ptr);
2067 towire.p - wire.data, wire.data, dns_rrtype_ptr);
2069 towire.p - wire.data, wire.data, dns_rrtype_ptr);
2077 dns_towire_state_t towire;
2080 memset(&towire, 0, sizeof towire); \
2081 towire.message = &wire; \
2082 towire.p = wire.data; \
2083 towire.lim = towire.p + sizeof wire.data
2103 dns_full_name_to_wire(NULL, &towire, local_host_name_dot_local);
2107 dns_name_to_wire(NULL, &towire, uuid_name);
2108 dns_full_name_to_wire(NULL, &towire, served_domain->domain);
2110 dns_name_to_wire(NULL, &towire, "ns");
2111 dns_full_name_to_wire(NULL, &towire, served_domain->domain);
2113 dnssd_hardwired_add(served_domain, "", served_domain->domain, towire.p - wire.data, wire.data, dns_rrtype_ns);
2116 dns_name_to_wire(NULL, &towire, "postmaster");
2117 dns_full_name_to_wire(NULL, &towire, served_domain->domain);
2118 dns_u32_to_wire(&towire, 0); // serial
2119 dns_ttl_to_wire(&towire, 7200); // refresh
2120 dns_ttl_to_wire(&towire, 3600); // retry
2121 dns_ttl_to_wire(&towire, 86400); // expire
2122 dns_ttl_to_wire(&towire, 120); // minimum
2123 dnssd_hardwired_add(served_domain, "", served_domain->domain, towire.p - wire.data, wire.data, dns_rrtype_soa);
2151 dns_towire_state_t towire;
2153 memset(&towire, 0, sizeof towire); \
2154 towire.message = &wire; \
2155 towire.p = wire.data; \
2156 towire.lim = towire.p + sizeof wire.data
2159 dns_u16_to_wire(&towire, 0); // priority
2160 dns_u16_to_wire(&towire, 0); // weight
2161 dns_u16_to_wire(&towire, 853); // port
2169 dns_full_name_to_wire(NULL, &towire, local_host_name_dot_local);
2174 dns_name_to_wire(NULL, &towire, uuid_name);
2175 dns_full_name_to_wire(NULL, &towire, served_domain->domain);
2178 dns_name_to_wire(NULL, &towire, "ns");
2179 dns_full_name_to_wire(NULL, &towire, served_domain->domain);
2182 dnssd_hardwired_add(served_domain, "_dns-push-tls._tcp", served_domain->domain_ld, towire.p - wire.data, wire.data,
2200 size_t len = query->towire.p - &query->response->data[0];
2201 query->towire.p = &nr->data[0] + len;
2202 query->towire.lim = &nr->data[0] + query->data_size;
2203 query->towire.p_rdlength = NULL;
2204 query->towire.p_opt = NULL;
2205 query->towire.message = nr;
2300 (unsigned)(source->towire.p - source->response->data) + DNS_HEADER_SIZE, false),
2364 dns_message_rrs_to_wire(&first_query->towire, first_query->response_msg);
2365 if (first_query->towire.truncated) {
2368 first_query->towire.error = false;
2369 first_query->towire.truncated = false;
2388 dns_towire_state_t *towire = &query->towire;
2390 uint8_t *revert = towire->p;
2391 uint16_t tc = towire->truncated ? dns_flags_tc : 0;
2404 !towire->truncated && (question->type != dns_rrtype_soa || question->name[0] != '\0'))
2408 TOWIRE_CHECK("&query->enclosing_domain_pointer 1", towire,
2409 dns_pointer_to_wire(NULL, towire, &query->enclosing_domain_pointer));
2410 TOWIRE_CHECK("dns_rrtype_soa", towire,
2411 dns_u16_to_wire(towire, dns_rrtype_soa));
2412 TOWIRE_CHECK("dns_qclass_in", towire,
2413 dns_u16_to_wire(towire, dns_qclass_in));
2414 TOWIRE_CHECK("ttl", towire, dns_ttl_to_wire(towire, 3600));
2415 TOWIRE_CHECK("rdlength_begin ", towire, dns_rdlength_begin(towire));
2419 TOWIRE_CHECK(my_name, towire, dns_full_name_to_wire(NULL, towire, my_name));
2422 TOWIRE_CHECK("uuid_name", towire, dns_name_to_wire(NULL, towire, uuid_name));
2423 TOWIRE_CHECK("&query->enclosing_domain_pointer 2", towire,
2424 dns_pointer_to_wire(NULL, towire, &query->enclosing_domain_pointer));
2426 TOWIRE_CHECK("\"ns\"", towire, dns_name_to_wire(NULL, towire, "ns"));
2427 TOWIRE_CHECK("&query->enclosing_domain_pointer 2", towire,
2428 dns_pointer_to_wire(NULL, towire, &query->enclosing_domain_pointer));
2430 TOWIRE_CHECK("\"postmaster\"", towire,
2431 dns_name_to_wire(NULL, towire, "postmaster"));
2432 TOWIRE_CHECK("&query->enclosing_domain_pointer 3", towire,
2433 dns_pointer_to_wire(NULL, towire, &query->enclosing_domain_pointer));
2434 TOWIRE_CHECK("serial", towire,dns_u32_to_wire(towire, 0)); // serial
2435 TOWIRE_CHECK("refresh", towire, dns_ttl_to_wire(towire
2436 TOWIRE_CHECK("retry", towire, dns_ttl_to_wire(towire, 3600)); // retry
2437 TOWIRE_CHECK("expire", towire, dns_ttl_to_wire(towire, 86400)); // expire
2438 TOWIRE_CHECK("minimum", towire, dns_ttl_to_wire(towire, 120)); // minimum
2439 dns_rdlength_end(towire);
2440 if (towire->truncated) {
2441 query->towire.p = revert;
2444 query->towire.error = 0;
2445 towire->truncated = false;
2472 ntohs(query->message->wire.id), query->towire.p, &query->towire.message->data[0],
2473 query->towire.p - &query->towire.message->data[0], dns_rcode_get(query->response), context_description);
2479 if (!towire->error && rcode == dns_rcode_noerror) {
2533 towire = &send_query->towire;
2534 revert = towire->p;
2547 // If we got a failure from dp_dns_queries_finished(), skip adding the opt RR and checking for a towire error.
2553 TOWIRE_CHECK("Root label", towire, dns_u8_to_wire(towire, 0)); // Root label
2554 TOWIRE_CHECK("dns_rrtype_opt", towire, dns_u16_to_wire(towire, dns_rrtype_opt));
2555 TOWIRE_CHECK("UDP Payload size", towire, dns_u16_to_wire(towire, 4096)); // UDP Payload size
2556 TOWIRE_CHECK("extended-rcode", towire, dns_u8_to_wire(towire, 0)); // extended-rcode
2557 TOWIRE_CHECK("EDNS version 0", towire, dns_u8_to_wire(towire, 0)); // EDNS version 0
2558 TOWIRE_CHECK("No extended flags", towire, dns_u16_to_wire(towire, 0)); // No extended flags
2559 TOWIRE_CHECK("No payload", towire, dns_u16_to_wire(towire, 0)); // No payload
2560 if (towire->truncated) {
2561 send_query->towire.p = revert;
2564 send_query->towire.error = false;
2565 send_query->towire.truncated = false;
2578 if (towire->error) {
2593 iov.iov_len = (send_query->towire.p - (uint8_t *)send_query->response);
2606 query->towire.p = &query->response->data[0]; // We start storing RR data here.
2607 query->towire.lim = &query->response->data[0] + query->data_size; // This is the limit to how much we can store.
2608 query->towire.message = query->response;
2609 query->towire.p_rdlength = NULL;
2610 query->towire.p_opt = NULL;
2628 TOWIRE_CHECK("kDSOType_DNSPushUpdate", &query->towire,
2629 dns_u16_to_wire(&query->towire, kDSOType_DNSPushUpdate));
2630 if (query->towire.p + 2 > query->towire.lim) {
2635 query->p_dso_length = query->towire.p;
2636 query->towire.p += 2;
2660 int16_t dso_length = query->towire.p - query->p_dso_length - 2;
2661 iov.iov_len = (query->towire.p - (uint8_t *)query->response);
2665 query->towire.p = query->p_dso_length;
2666 dns_u16_to_wire(&query->towire, dso_length);
2781 if (!query->towire.truncated) {
2816 uint8_t *revert = query->towire.p;
2820 if (query->towire.truncated) {
2821 query->towire.p = revert;
2824 query->towire.truncated = false;
2825 query->towire.error = false;
2866 uint8_t *revert = query->towire.p;
2869 if (query->towire.truncated) {
2870 query->towire.p = revert;
2873 query->towire.truncated = false;
2874 query->towire.error = false;
2885 if (!(flags & kDNSServiceFlagsMoreComing) || query->towire.truncated) {
3398 uint8_t *revert = query->towire.p;
3453 if (query->towire.truncated) {
3454 query->towire.truncated = false;
3455 query->towire.p = revert;
3456 query->towire.error = 0;
3746 dns_towire_state_t towire;
3756 memset(&towire, 0, sizeof(towire));
3757 towire.p = &dsobuf[DNS_HEADER_SIZE];
3758 towire.lim = towire.p + (sizeof(dsobuf) - DNS_HEADER_SIZE);
3759 towire.message = (dns_wire_t *)dsobuf;
3760 towire.p_rdlength = NULL;
3761 towire.p_opt = NULL;
3766 dns_u16_to_wire(&towire, kDSOType_Keepalive);
3767 dns_rdlength_begin(&towire);
3768 dns_u32_to_wire(&towire, keepalive_event->inactivity_timeout); // Idle timeout (we are never idle)
3769 dns_u32_to_wire(&towire, keepalive_event->keepalive_interval); // Keepalive timeout
3770 dns_rdlength_end(&towire);
3771 if (towire.error) {
3772 ERROR("ran out of message space at " PUB_S_SRP ", :%d", __FILE__, towire.line);
3776 iov.iov_len = towire.p - dsobuf;
3885 TOWIRE_CHECK("name", &query->towire, dns_name_to_wire(NULL, &query->towire, query->question->name));
3886 TOWIRE_CHECK("enclosing_domain", &query->towire,
3888 &query->towire, query->question->served_domain->domain));
3890 TOWIRE_CHECK("full name", &query->towire, dns_full_name_to_wire(NULL, &query->towire, query->question->name));
3892 TOWIRE_CHECK("TYPE", &query->towire, dns_u16_to_wire(&query->towire, question->type)); // TYPE
3893 TOWIRE_CHECK("CLASS", &query->towire, dns_u16_to_wire(&query->towire, question->qclass)); // CLASS
3900 query->towire.message->id = message->wire.id;
5274 dns_towire_state_t towire;
5275 towire_init(&wire, &towire);
5276 dns_full_name_to_wire(NULL, &towire, local_host_name_dot_local);
5279 towire.p - wire.data, wire.data, 0);
5486 dns_towire_state_t towire;
5503 towire_init(&wire, &towire);
5504 dns_full_name_to_wire(NULL, &towire, domain_to_advertise);
5508 kDNSServiceType_PTR, kDNSServiceClass_IN, towire.p - wire.data, wire.data, 0,
5518 towire_init(&wire, &towire);
5519 dns_full_name_to_wire(NULL, &towire, local_host_name_dot_local);
5524 kDNSServiceClass_IN, towire.p - wire.data, wire.data, 0,