master.c revision d22b4de3f1c3151979e2a064cb271007c710c5a7
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley * Copyright (C) 1999, 2000 Internet Software Consortium.
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley * Permission to use, copy, modify, and distribute this software for any
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley * purpose with or without fee is hereby granted, provided that the above
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley * copyright notice and this permission notice appear in all copies.
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
110d1702731f42dd620879c1d765ebe91f3920ceMichael Graff/* $Id: master.c,v 1.64 2000/09/05 03:35:17 marka Exp $ */
ca67883a666bdf314d3da958d5195e7215b1f797Bob Halley * Grow the number of dns_rdatalist_t (RDLSZ) and dns_rdata_t (RDSZ) structures
b12f0228b32775ee688ed21ddbf3a116c1adfb43Michael Graff * by these sizes when we need to.
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley * RDLSZ reflects the number of different types with the same name expected.
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley * RDSZ reflects the number of rdata expected at a give name that can fit into
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley * Target buffer size and minimum target size.
078d49b63324f01d98301ee21671abee0c41fcdeBob Halley * MINTSIZ must be big enough to hold the largest rdata record.
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley * TSIZ >= MINTSIZ
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley * max message size - header - root - type - class - ttl - rdlen
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley * Size for tokens in the presentation format,
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley * The largest tokens are the base64 blocks in KEY and CERT records,
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley * Largest key allowed is about 1372 bytes but
e496615043400500492fa7b891c515c8e7cb7d08Bob Halley * there is no fixed upper bound on CERT records.
e496615043400500492fa7b891c515c8e7cb7d08Bob Halley * 2K is too small for some X.509s, 8K is overkill.
5619558151f1aa4249b3ead979e76876e29278b6Bob Halleytypedef ISC_LIST(dns_rdatalist_t) rdatalist_head_t;
2cd0c38115b1efb043ed3104c0d08e51ceade0d7Bob Halley * Master file loading state that persists across $INCLUDEs.
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley dns_fixedname_t fixed[NBUFS]; /* working buffers */
bf345589ce0b0b64533d4566e4992a0e63aac6f5Bob Halley unsigned int in_use[NBUFS]; /* covert to bitmap? */
bf345589ce0b0b64533d4566e4992a0e63aac6f5Bob Halley /* Which fixed buffers we are using? */
bf345589ce0b0b64533d4566e4992a0e63aac6f5Bob Halley * 0 => all. */
bf345589ce0b0b64533d4566e4992a0e63aac6f5Bob Halley /* Rate limit goo. */
bf345589ce0b0b64533d4566e4992a0e63aac6f5Bob Halley /* locked by lock */
bf345589ce0b0b64533d4566e4992a0e63aac6f5Bob Halley#define DNS_LCTX_VALID(ctx) ISC_MAGIC_VALID(ctx, DNS_LCTX_MAGIC)
bf345589ce0b0b64533d4566e4992a0e63aac6f5Bob Halley#define DNS_LMGR_VALID(ctx) ISC_MAGIC_VALID(ctx, DNS_LMGR_MAGIC)
bf345589ce0b0b64533d4566e4992a0e63aac6f5Bob Halleypushfile(const char *master_file, dns_name_t *origin, dns_loadctx_t **ctxp);
bf345589ce0b0b64533d4566e4992a0e63aac6f5Bob Halleycommit(dns_rdatacallbacks_t *, isc_lex_t *, rdatalist_head_t *, dns_name_t *,
5619558151f1aa4249b3ead979e76876e29278b6Bob Halleygrow_rdatalist(int, dns_rdatalist_t *, int, rdatalist_head_t *,
5619558151f1aa4249b3ead979e76876e29278b6Bob Halleygrow_rdata(int, dns_rdata_t *, int, rdatalist_head_t *, rdatalist_head_t *,
5619558151f1aa4249b3ead979e76876e29278b6Bob Halleyon_list(dns_rdatalist_t *this, dns_rdata_t *rdata);
5619558151f1aa4249b3ead979e76876e29278b6Bob Halleyload_quantum(isc_task_t *task, isc_event_t *event);
5619558151f1aa4249b3ead979e76876e29278b6Bob Halleyloadmgr_start(isc_task_t *task, isc_event_t *event);
5619558151f1aa4249b3ead979e76876e29278b6Bob Halleyloadmgr_iattach(dns_loadmgr_t *source, dns_loadmgr_t **target);
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley result = gettoken(lexer, options, token, eol, callbacks); \
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley switch (result) { \
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley result = commit(callbacks, ctx->lex, ¤t_list, \
54f959d12b5a1f9315fbf6a776c6d349316e9686Bob Halley result = commit(callbacks, ctx->lex, &glue_list, \
bf345589ce0b0b64533d4566e4992a0e63aac6f5Bob Halley isc_buffer_init(&target, target_mem, target_size); \
76883e8cee593f45c65b0936e5d6e8f778d6e3efMichael Graff "%s:%lu: file does not end with newline", \
52637f592f705ca93fadc218e403fd55e8ce4aeaMark Andrews#define CTX_COPYVAR(ctx, new, var) (new)->var = (ctx)->var
c1e7aff941dbf40090fec49300e728ad017d4f0cMark Andrewsgettoken(isc_lex_t *lex, unsigned int options, isc_token_t *token,
c1e7aff941dbf40090fec49300e728ad017d4f0cMark Andrews isc_boolean_t eol, dns_rdatacallbacks_t *callbacks)
69be7837c920fac5c71a73e8fad586f9a2711e96Michael Graff options |= ISC_LEXOPT_EOL | ISC_LEXOPT_EOF | ISC_LEXOPT_DNSMULTILINE |
69be7837c920fac5c71a73e8fad586f9a2711e96Michael Graff result = isc_lex_gettoken(lex, options, token);
76883e8cee593f45c65b0936e5d6e8f778d6e3efMichael Graff "isc_lex_gettoken() failed: %s",
bf345589ce0b0b64533d4566e4992a0e63aac6f5Bob Halley /*NOTREACHED*/
69be7837c920fac5c71a73e8fad586f9a2711e96Michael Graff "dns_master_load: %s:%lu: unexpected end of %s",
69be7837c920fac5c71a73e8fad586f9a2711e96Michael Graffdns_loadctx_attach(dns_loadctx_t *source, dns_loadctx_t **target) {
69be7837c920fac5c71a73e8fad586f9a2711e96Michael Graff INSIST(source->references != 0); /* Overflow? */
if (need_destroy)
static isc_result_t
isc_region_t r;
return (ISC_R_NOMEMORY);
return (ISC_R_UNEXPECTED);
goto cleanup_ctx;
for (i = 0; i < NBUFS; i++) {
return (ISC_R_SUCCESS);
return (result);
static isc_result_t
int rdlcount = 0;
int rdlcount_save = 0;
int rdatalist_size = 0;
int rdcount = 0;
int rdcount_save = 0;
int rdata_size = 0;
int new_in_use;
unsigned int loop_cnt = 0;
goto error_cleanup;
if (read_till_eol)
if (read_till_eol)
result =
goto cleanup;
if (ttl_offset != 0) {
goto cleanup;
goto error_cleanup;
ctxp);
goto cleanup;
goto error_cleanup;
goto cleanup;
goto cleanup;
goto error_cleanup;
if (finish_origin) {
if (finish_include) {
goto cleanup;
goto cleanup;
if (current_has_delegation &&
goto cleanup;
rdcount = 0;
rdlcount = 0;
= ISC_FALSE;
goto cleanup;
type = 0;
rdclass = 0;
if (initialws) {
goto cleanup;
== ISC_R_SUCCESS)
== ISC_R_SUCCESS) {
goto cleanup;
goto cleanup;
if (rdclass == 0 &&
== ISC_R_SUCCESS)
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
goto error_cleanup;
goto cleanup;
covers = 0;
mctx);
goto error_cleanup;
rdcount++;
goto cleanup;
goto cleanup;
if (!done) {
goto cleanup;
return (result);
static isc_result_t
isc_region_t r;
int new_in_use;
&new);
return (result);
goto cleanup;
return (ISC_R_SUCCESS);
return (result);
return (result);
goto cleanup;
return (result);
goto cleanup;
goto cleanup;
if (queue)
if (!queue) {
return (result);
return (result);
goto done;
done:
return (result);
goto cleanup;
return (result);
return (result);
goto cleanup;
goto cleanup;
return (result);
goto cleanup;
goto cleanup;
return (result);
return (result);
return (result);
goto cleanup;
return (result);
return (result);
goto cleanup;
return (result);
return (result);
static dns_rdatalist_t *
int rdlcount = 0;
return (NULL);
rdlcount++;
rdlcount++;
return (new);
static dns_rdata_t *
int rdcount = 0;
return (NULL);
rdcount++;
rdcount++;
return (new);
static isc_result_t
return (ISC_R_SUCCESS);
if (!ignore) {
&dataset));
return (result);
return (ISC_R_SUCCESS);
static isc_boolean_t
return (ISC_FALSE);
return (ISC_TRUE);
return (ISC_FALSE);
static isc_boolean_t
return (ISC_TRUE);
return (ISC_FALSE);
static isc_result_t
return (ISC_R_NOMEMORY);
return (ISC_R_SUCCESS);
return (ISC_R_NOMEMORY);
return (result);
return (ISC_R_SUCCESS);
if (destroy)
if (destroy)