Lines Matching defs:towire
130 #define name_to_wire(towire, name) name_to_wire_(towire, name, __LINE__)
132 name_to_wire_(dns_towire_state_t *towire, dns_name_t *name, int line)
135 dns_concatenate_name_to_wire_(towire, name, NULL, NULL, line);
139 rdata_to_wire(dns_towire_state_t *towire, dns_rr_t *rr)
141 dns_rdlength_begin(towire);
146 name_to_wire(towire, rr->data.ptr.name);
150 dns_u16_to_wire(towire, rr->data.srv.priority);
151 dns_u16_to_wire(towire, rr->data.srv.weight);
152 dns_u16_to_wire(towire, rr->data.srv.port);
153 name_to_wire(towire, rr->data.srv.name);
157 dns_rdata_raw_data_to_wire(towire, rr->data.txt.data, rr->data.txt.len);
161 dns_u16_to_wire(towire, rr->data.key.flags);
162 dns_u8_to_wire(towire, rr->data.key.protocol);
163 dns_u8_to_wire(towire, rr->data.key.algorithm);
164 dns_rdata_raw_data_to_wire(towire, rr->data.key.key, rr->data.key.len);
168 dns_rdata_raw_data_to_wire(towire, &rr->data.a, sizeof rr->data.a);
172 dns_rdata_raw_data_to_wire(towire, &rr->data.aaaa, sizeof rr->data.aaaa);
176 dns_rdlength_end(towire);
187 add_prerequisite(dns_wire_t *msg, dns_towire_state_t *towire, prereq_type_t ptype, dns_name_t *name, dns_rr_t *rr)
192 towire->truncated = true;
194 name_to_wire(towire, name);
197 dns_u16_to_wire(towire, rr->type);
198 dns_u16_to_wire(towire, rr->qclass);
199 dns_ttl_to_wire(towire, 0);
200 rdata_to_wire(towire, rr);
203 dns_u16_to_wire(towire, dns_rrtype_any); // TYPE
204 dns_u16_to_wire(towire, dns_qclass_none); // CLASS
205 dns_ttl_to_wire(towire, 0); // TTL
206 dns_u16_to_wire(towire, 0); // RDLEN
220 add_delete(dns_wire_t *msg, dns_towire_state_t *towire, delete_type_t dtype, dns_name_t *name)
222 name_to_wire(towire, name);
225 dns_u16_to_wire(towire, dns_rrtype_any); // TYPE
226 dns_u16_to_wire(towire, dns_qclass_any); // CLASS
227 dns_ttl_to_wire(towire, 0); // TTL
228 dns_u16_to_wire(towire, 0); // RDLEN
237 add_rr(dns_wire_t *msg, dns_towire_state_t *towire, dns_name_t *name, dns_rr_t *rr)
240 name_to_wire(towire, name);
241 dns_u16_to_wire(towire, rr->type); // TYPE
242 dns_u16_to_wire(towire, rr->qclass); // CLASS
243 dns_ttl_to_wire(towire, rr->ttl); // TTL
244 rdata_to_wire(towire, rr); // RDLEN
322 dns_towire_state_t towire;
329 memset(&towire, 0, sizeof towire);
330 towire.p = &msg->data[0]; // We start storing RR data here.
331 towire.lim = &msg->data[0] + update->update_max; // This is the limit to how much we can store.
332 towire.message = msg;
342 name_to_wire(&towire, update->zone_name);
343 dns_u16_to_wire(&towire, dns_rrtype_soa);
344 dns_u16_to_wire(&towire, dns_qclass_in);
356 add_prerequisite(msg, &towire, update_rrset_equals, instance->name, update->host->key);
358 add_prerequisite(msg, &towire, update_rrset_equals, update->host->name, update->host->key);
361 add_delete(msg, &towire, delete_name, instance->name);
363 add_delete(msg, &towire, delete_name, update->host->name);
368 add_rr(msg, &towire, instance->name, update->host->key);
369 add_rr(msg, &towire, instance->name, instance->srv);
370 add_rr(msg, &towire, instance->name, instance->txt);
374 add_rr(msg, &towire, service->rr->name, service->rr);
377 add_rr(msg, &towire, update->host->name, update->host->key);
379 add_rr(msg, &towire, update->host->name, &host_addr->rr);
386 add_prerequisite(msg, &towire, update_name_not_in_use, instance->name, (dns_rr_t *)NULL);
388 add_prerequisite(msg, &towire, update_name_not_in_use, update->host->name, (dns_rr_t *)NULL);
393 add_prerequisite(msg, &towire, update_name_not_in_use, update->instance->name, (dns_rr_t *)NULL);
399 add_prerequisite(msg, &towire, update_rrset_equals, update->instance->name, update->host->key);
400 add_delete(msg, &towire, delete_name, update->instance->name);
402 add_rr(msg, &towire, update->instance->name, update->host->key);
403 add_rr(msg, &towire, update->instance->name, update->instance->srv);
404 add_rr(msg, &towire, update->instance->name, update->instance->txt);
408 add_prerequisite(msg, &towire, update_name_not_in_use, update->host->name, (dns_rr_t *)NULL);
412 add_prerequisite(msg, &towire, update_rrset_equals, update->host->name, update->host->key);
413 add_delete(msg, &towire, delete_name, update->host->name);
418 add_rr(msg, &towire, service->rr->name, service->rr);
422 add_rr(msg, &towire, update->host->name, update->host->key);
424 add_rr(msg, &towire, update->host->name, &host_addr->rr);
436 add_delete(msg, &towire, delete_name, instance->name);
440 if (towire.error != 0) {
441 ERROR("construct_update: error %s while generating update at line %d", strerror(towire.error), towire.line);
444 update->update_length = towire.p - (uint8_t *)msg;
484 dns_towire_state_t towire;
493 memset(&towire, 0, sizeof towire);
494 towire.p = (uint8_t *)msg + update->update_length; // We start storing RR data here.
495 towire.lim = &msg->data[0] + update->update_max; // This is the limit to how much we can store.
496 towire.message = msg;
497 towire.p_rdlength = NULL;
498 towire.p_opt = NULL;
505 name_to_wire(&towire, key->name);
506 iov[0].iov_len = towire.p - (uint8_t *)iov[0].iov_base;
507 dns_u16_to_wire(&towire, dns_rrtype_tsig); // RRTYPE
508 iov[1].iov_base = towire.p;
509 dns_u16_to_wire(&towire, dns_qclass_any); // CLASS
510 dns_ttl_to_wire(&towire, 0); // TTL
511 iov[1].iov_len = towire.p - (uint8_t *)iov[1].iov_base;
513 dns_rdlength_begin(&towire); // RDLEN
514 iov[2].iov_base = towire.p;
515 dns_full_name_to_wire(NULL, &towire, "hmac-sha256."); // Algorithm Name
517 dns_u48_to_wire(&towire, tv.tv_sec); // Time since epoch
518 dns_u16_to_wire(&towire, 300); // Fudge interval
521 iov[2].iov_len = towire.p - (uint8_t *)iov[2].iov_base;
522 dns_u16_to_wire(&towire, SRP_SHA256_DIGEST_SIZE); // MAC Size
523 p_mac = towire.p; // MAC
524 if (!towire.error) {
525 if (towire.p + SRP_SHA256_DIGEST_SIZE >= towire.lim) {
526 towire.error = ENOBUFS;
527 towire.truncated = true;
528 towire.line = __LINE__;
530 towire.p += SRP_SHA256_DIGEST_SIZE;
536 dns_rdata_raw_data_to_wire(&towire, &msg->id, sizeof msg->id);
537 iov[3].iov_base = towire.p;
538 dns_u16_to_wire(&towire, 0); // TSIG Error (always 0 on send).
539 dns_u16_to_wire(&towire, 0); // Other Len (MBZ?)
540 iov[3].iov_len = towire.p - (uint8_t *)iov[3].iov_base;
541 dns_rdlength_end(&towire);
546 update->update_length = towire.p - (const uint8_t *)msg;
549 if (towire.error != 0) {
551 strerror(towire.error), towire.line);