Lines Matching defs:xfr

653 	dns_rdatatype_t		qtype;		/* dns_rdatatype_{a,i}xfr */
691 sendstream(xfrout_ctx_t *xfr);
697 xfrout_fail(xfrout_ctx_t *xfr, isc_result_t result, const char *msg);
700 xfrout_maybe_destroy(xfrout_ctx_t *xfr);
714 xfrout_log(xfrout_ctx_t *xfr, int level, const char *fmt, ...)
739 xfrout_ctx_t *xfr = NULL;
1041 &xfr));
1053 &xfr));
1055 xfr->mnemonic = mnemonic;
1059 CHECK(xfr->stream->methods->first(xfr->stream));
1061 if (xfr->tsigkey != NULL)
1062 dns_name_format(&xfr->tsigkey->name, keyname, sizeof(keyname));
1068 (xfr->tsigkey != NULL) ? ": TSIG " : "", keyname);
1072 mnemonic, (xfr->tsigkey != NULL) ? ": TSIG " : "",
1077 mnemonic, (xfr->tsigkey != NULL) ? ": TSIG " : "",
1100 * Hand the context over to sendstream(). Set xfr to NULL;
1104 sendstream(xfr);
1105 xfr = NULL;
1129 if (xfr != NULL) {
1130 xfrout_fail(xfr, result, "setting up zone transfer");
1149 xfrout_ctx_t *xfr;
1155 xfr = isc_mem_get(mctx, sizeof(*xfr));
1156 if (xfr == NULL)
1158 xfr->mctx = NULL;
1159 isc_mem_attach(mctx, &xfr->mctx);
1160 xfr->client = NULL;
1161 ns_client_attach(client, &xfr->client);
1162 xfr->id = id;
1163 xfr->qname = qname;
1164 xfr->qtype = qtype;
1165 xfr->qclass = qclass;
1166 xfr->zone = NULL;
1167 xfr->db = NULL;
1168 xfr->ver = NULL;
1170 dns_zone_attach(zone, &xfr->zone);
1171 dns_db_attach(db, &xfr->db);
1172 dns_db_attachversion(db, ver, &xfr->ver);
1173 xfr->end_of_stream = ISC_FALSE;
1174 xfr->tsigkey = tsigkey;
1175 xfr->lasttsig = lasttsig;
1176 xfr->verified_tsig = verified_tsig;
1177 xfr->nmsg = 0;
1178 xfr->many_answers = many_answers;
1179 xfr->sends = 0;
1180 xfr->shuttingdown = ISC_FALSE;
1181 xfr->mnemonic = NULL;
1182 xfr->buf.base = NULL;
1183 xfr->buf.length = 0;
1184 xfr->txmem = NULL;
1185 xfr->txmemlen = 0;
1186 xfr->stream = NULL;
1187 xfr->quota = NULL;
1205 isc_buffer_init(&xfr->buf, mem, len);
1217 isc_buffer_init(&xfr->txlenbuf, mem, 2);
1218 isc_buffer_init(&xfr->txbuf, (char *) mem + 2, len - 2);
1219 xfr->txmem = mem;
1220 xfr->txmemlen = len;
1222 CHECK(dns_timer_setidle(xfr->client->timer,
1230 xfr->client->shutdown = xfrout_client_shutdown;
1231 xfr->client->shutdown_arg = xfr;
1236 xfr->quota = quota;
1237 xfr->stream = stream;
1239 *xfrp = xfr;
1243 xfrout_ctx_destroy(&xfr);
1257 sendstream(xfrout_ctx_t *xfr) {
1274 isc_buffer_clear(&xfr->buf);
1275 isc_buffer_clear(&xfr->txlenbuf);
1276 isc_buffer_clear(&xfr->txbuf);
1278 is_tcp = ISC_TF((xfr->client->attributes & NS_CLIENTATTR_TCP) != 0);
1284 msg = xfr->client->message;
1290 * in xfr->buf. We know that if the uncompressed data fits
1291 * in xfr->buf, the compressed data will surely fit in a TCP
1295 CHECK(dns_message_create(xfr->mctx,
1299 msg->id = xfr->id;
1302 if ((xfr->client->attributes & NS_CLIENTATTR_RA) != 0)
1304 CHECK(dns_message_settsigkey(msg, xfr->tsigkey));
1305 CHECK(dns_message_setquerytsig(msg, xfr->lasttsig));
1306 if (xfr->lasttsig != NULL)
1307 isc_buffer_free(&xfr->lasttsig);
1308 msg->verified_sig = xfr->verified_tsig;
1313 if ((xfr->client->attributes & NS_CLIENTATTR_WANTOPT) != 0) {
1316 CHECK(ns_client_addopt(xfr->client, msg, &opt));
1321 xfr->client->attributes &= ~NS_CLIENTATTR_WANTNSID;
1322 xfr->client->attributes &= ~NS_CLIENTATTR_HAVEEXPIRE;
1328 if (xfr->tsigkey != NULL)
1330 isc_buffer_add(&xfr->buf, msg->reserved);
1337 if (xfr->nmsg == 0) {
1345 isc_buffer_add(&xfr->buf, 12 + 4);
1352 xfr->client->message->rdclass,
1353 xfr->qtype);
1359 isc_buffer_availableregion(&xfr->buf, &r);
1360 INSIST(r.length >= xfr->qname->length);
1361 r.length = xfr->qname->length;
1362 isc_buffer_putmem(&xfr->buf, xfr->qname->ndata,
1363 xfr->qname->length);
1373 isc_buffer_add(&xfr->buf, 12);
1395 xfr->stream->methods->current(xfr->stream,
1398 isc_buffer_availableregion(&xfr->buf, &r);
1413 xfrout_log(xfr, ISC_LOG_WARNING,
1430 isc_buffer_availableregion(&xfr->buf, &r);
1433 isc_buffer_putmem(&xfr->buf, name->ndata, name->length);
1437 isc_buffer_add(&xfr->buf, 10);
1442 isc_buffer_availableregion(&xfr->buf, &r);
1444 isc_buffer_putmem(&xfr->buf, rdata->data, rdata->length);
1473 result = xfr->stream->methods->next(xfr->stream);
1475 xfr->end_of_stream = ISC_TRUE;
1480 if (! xfr->many_answers)
1487 if ((isc_buffer_usedlength(&xfr->buf) >=
1493 CHECK(dns_compress_init(&cctx, -1, xfr->mctx));
1496 CHECK(dns_message_renderbegin(msg, &cctx, &xfr->txbuf));
1503 isc_buffer_usedregion(&xfr->txbuf, &used);
1504 isc_buffer_putuint16(&xfr->txlenbuf,
1506 region.base = xfr->txlenbuf.base;
1508 xfrout_log(xfr, ISC_LOG_DEBUG(8),
1511 CHECK(isc_socket_send(xfr->client->tcpsocket, /* XXX */
1512 &region, xfr->client->task,
1514 xfr));
1515 xfr->sends++;
1517 xfrout_log(xfr, ISC_LOG_DEBUG(8), "sending IXFR UDP response");
1518 ns_client_send(xfr->client);
1519 xfr->stream->methods->pause(xfr->stream);
1520 xfrout_ctx_destroy(&xfr);
1525 CHECK(dns_message_getquerytsig(msg, xfr->mctx, &xfr->lasttsig));
1527 xfr->nmsg++;
1554 xfr->stream->methods->pause(xfr->stream);
1559 xfrout_fail(xfr, result, "sending zone data");
1564 xfrout_ctx_t *xfr = *xfrp;
1567 INSIST(xfr->sends == 0);
1569 xfr->client->shutdown = NULL;
1570 xfr->client->shutdown_arg = NULL;
1572 if (xfr->stream != NULL)
1573 xfr->stream->methods->destroy(&xfr->stream);
1574 if (xfr->buf.base != NULL)
1575 isc_mem_put(xfr->mctx, xfr->buf.base, xfr->buf.length);
1576 if (xfr->txmem != NULL)
1577 isc_mem_put(xfr->mctx, xfr->txmem, xfr->txmemlen);
1578 if (xfr->lasttsig != NULL)
1579 isc_buffer_free(&xfr->lasttsig);
1580 if (xfr->quota != NULL)
1581 isc_quota_detach(&xfr->quota);
1582 if (xfr->ver != NULL)
1583 dns_db_closeversion(xfr->db, &xfr->ver, ISC_FALSE);
1584 if (xfr->zone != NULL)
1585 dns_zone_detach(&xfr->zone);
1586 if (xfr->db != NULL)
1587 dns_db_detach(&xfr->db);
1593 ns_client_attach(xfr->client, &client);
1594 ns_client_detach(&xfr->client);
1595 isc_mem_putanddetach(&xfr->mctx, xfr, sizeof(*xfr));
1604 xfrout_ctx_t *xfr = (xfrout_ctx_t *)event->ev_arg;
1612 xfr->sends--;
1613 INSIST(xfr->sends == 0);
1615 (void)isc_timer_touch(xfr->client->timer);
1616 if (xfr->shuttingdown == ISC_TRUE) {
1617 xfrout_maybe_destroy(xfr);
1619 xfrout_fail(xfr, evresult, "send");
1620 } else if (xfr->end_of_stream == ISC_FALSE) {
1621 sendstream(xfr);
1624 inc_stats(xfr->zone, dns_nsstatscounter_xfrdone);
1625 xfrout_log(xfr, ISC_LOG_INFO, "%s ended", xfr->mnemonic);
1626 ns_client_next(xfr->client, ISC_R_SUCCESS);
1627 xfrout_ctx_destroy(&xfr);
1632 xfrout_fail(xfrout_ctx_t *xfr, isc_result_t result, const char *msg) {
1633 xfr->shuttingdown = ISC_TRUE;
1634 xfrout_log(xfr, ISC_LOG_ERROR, "%s: %s",
1636 xfrout_maybe_destroy(xfr);
1640 xfrout_maybe_destroy(xfrout_ctx_t *xfr) {
1641 INSIST(xfr->shuttingdown == ISC_TRUE);
1642 if (xfr->sends > 0) {
1647 isc_socket_cancel(xfr->client->tcpsocket, xfr->client->task,
1650 ns_client_next(xfr->client, ISC_R_CANCELED);
1651 xfrout_ctx_destroy(&xfr);
1657 xfrout_ctx_t *xfr = (xfrout_ctx_t *) arg;
1658 xfrout_fail(xfr, result, "aborted");
1703 xfrout_log(xfrout_ctx_t *xfr, int level, const char *fmt, ...) {
1706 xfrout_logv(xfr->client, xfr->qname, xfr->qclass, level, fmt, ap);