⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 master.c

📁 bind 9.3结合mysql数据库
💻 C
📖 第 1 页 / 共 5 页
字号:
				callbacks, NULL, NULL, NULL, NULL, &lctx);	if (result != ISC_R_SUCCESS)		return (result);	result = isc_lex_openfile(lctx->lex, master_file);	if (result != ISC_R_SUCCESS)		goto cleanup;	result = load(lctx);	INSIST(result != DNS_R_CONTINUE); cleanup:	if (lctx != NULL)		dns_loadctx_detach(&lctx);	return (result);}isc_result_tdns_master_loadfileinc(const char *master_file, dns_name_t *top,		       dns_name_t *origin, dns_rdataclass_t zclass,		       unsigned int options, dns_rdatacallbacks_t *callbacks,		       isc_task_t *task, dns_loaddonefunc_t done,		       void *done_arg, dns_loadctx_t **lctxp, isc_mem_t *mctx){	dns_loadctx_t *lctx = NULL;	isc_result_t result;		REQUIRE(task != NULL);	REQUIRE(done != NULL);	result = loadctx_create(mctx, options, top, zclass, origin,				callbacks, task, done, done_arg, NULL, &lctx);	if (result != ISC_R_SUCCESS)		return (result);	result = isc_lex_openfile(lctx->lex, master_file);	if (result != ISC_R_SUCCESS)		goto cleanup;	result = task_send(lctx);	if (result == ISC_R_SUCCESS) {		dns_loadctx_attach(lctx, lctxp);		return (DNS_R_CONTINUE);	} cleanup:	if (lctx != NULL)		dns_loadctx_detach(&lctx);	return (result);}isc_result_tdns_master_loadstream(FILE *stream, dns_name_t *top, dns_name_t *origin,		      dns_rdataclass_t zclass, unsigned int options,		      dns_rdatacallbacks_t *callbacks, isc_mem_t *mctx){	isc_result_t result;	dns_loadctx_t *lctx = NULL;	REQUIRE(stream != NULL);	result = loadctx_create(mctx, options, top, zclass, origin,				callbacks, NULL, NULL, NULL, NULL, &lctx);	if (result != ISC_R_SUCCESS)		goto cleanup;	result = isc_lex_openstream(lctx->lex, stream);	if (result != ISC_R_SUCCESS)		goto cleanup;	result = load(lctx);	INSIST(result != DNS_R_CONTINUE); cleanup:	if (lctx != NULL)		dns_loadctx_detach(&lctx);	return (result);}isc_result_tdns_master_loadstreaminc(FILE *stream, dns_name_t *top, dns_name_t *origin,			 dns_rdataclass_t zclass, unsigned int options,			 dns_rdatacallbacks_t *callbacks, isc_task_t *task,			 dns_loaddonefunc_t done, void *done_arg,			 dns_loadctx_t **lctxp, isc_mem_t *mctx){	isc_result_t result;	dns_loadctx_t *lctx = NULL;	REQUIRE(stream != NULL);	REQUIRE(task != NULL);	REQUIRE(done != NULL);	result = loadctx_create(mctx, options, top, zclass, origin,				callbacks, task, done, done_arg, NULL, &lctx);	if (result != ISC_R_SUCCESS)		goto cleanup;	result = isc_lex_openstream(lctx->lex, stream);	if (result != ISC_R_SUCCESS)		goto cleanup;	result = task_send(lctx);	if (result == ISC_R_SUCCESS) {		dns_loadctx_attach(lctx, lctxp);		return (DNS_R_CONTINUE);	} cleanup:	if (lctx != NULL)		dns_loadctx_detach(&lctx);	return (result);}isc_result_tdns_master_loadbuffer(isc_buffer_t *buffer, dns_name_t *top,		      dns_name_t *origin, dns_rdataclass_t zclass,		      unsigned int options,		      dns_rdatacallbacks_t *callbacks, isc_mem_t *mctx){	isc_result_t result;	dns_loadctx_t *lctx = NULL;	REQUIRE(buffer != NULL);	result = loadctx_create(mctx, options, top, zclass, origin,				callbacks, NULL, NULL, NULL, NULL, &lctx);	if (result != ISC_R_SUCCESS)		return (result);	result = isc_lex_openbuffer(lctx->lex, buffer);	if (result != ISC_R_SUCCESS)		goto cleanup;	result = load(lctx);	INSIST(result != DNS_R_CONTINUE); cleanup:	if (lctx != NULL)		dns_loadctx_detach(&lctx);	return (result);}isc_result_tdns_master_loadbufferinc(isc_buffer_t *buffer, dns_name_t *top,			 dns_name_t *origin, dns_rdataclass_t zclass,			 unsigned int options,			 dns_rdatacallbacks_t *callbacks, isc_task_t *task,			 dns_loaddonefunc_t done, void *done_arg,			 dns_loadctx_t **lctxp, isc_mem_t *mctx){	isc_result_t result;	dns_loadctx_t *lctx = NULL;	REQUIRE(buffer != NULL);	REQUIRE(task != NULL);	REQUIRE(done != NULL);	result = loadctx_create(mctx, options, top, zclass, origin,				callbacks, task, done, done_arg, NULL, &lctx);	if (result != ISC_R_SUCCESS)		return (result);	result = isc_lex_openbuffer(lctx->lex, buffer);	if (result != ISC_R_SUCCESS)		goto cleanup;	result = task_send(lctx);	if (result == ISC_R_SUCCESS) {		dns_loadctx_attach(lctx, lctxp);		return (DNS_R_CONTINUE);	} cleanup:	if (lctx != NULL)		dns_loadctx_detach(&lctx);	return (result);}isc_result_tdns_master_loadlexer(isc_lex_t *lex, dns_name_t *top,		     dns_name_t *origin, dns_rdataclass_t zclass,		     unsigned int options,		     dns_rdatacallbacks_t *callbacks, isc_mem_t *mctx){	isc_result_t result;	dns_loadctx_t *lctx = NULL;	REQUIRE(lex != NULL);	result = loadctx_create(mctx, options, top, zclass, origin,				callbacks, NULL, NULL, NULL, lex, &lctx);	if (result != ISC_R_SUCCESS)		return (result);	result = load(lctx);	INSIST(result != DNS_R_CONTINUE);	dns_loadctx_detach(&lctx);	return (result);}isc_result_tdns_master_loadlexerinc(isc_lex_t *lex, dns_name_t *top,			dns_name_t *origin, dns_rdataclass_t zclass,			unsigned int options,			dns_rdatacallbacks_t *callbacks, isc_task_t *task,			dns_loaddonefunc_t done, void *done_arg,			dns_loadctx_t **lctxp, isc_mem_t *mctx){	isc_result_t result;	dns_loadctx_t *lctx = NULL;	REQUIRE(lex != NULL);	REQUIRE(task != NULL);	REQUIRE(done != NULL);	result = loadctx_create(mctx, options, top, zclass, origin,				callbacks, task, done, done_arg, lex, &lctx);	if (result != ISC_R_SUCCESS)		return (result);	result = task_send(lctx);	if (result == ISC_R_SUCCESS) {		dns_loadctx_attach(lctx, lctxp);		return (DNS_R_CONTINUE);	}	dns_loadctx_detach(&lctx);	return (result);}/* * Grow the slab of dns_rdatalist_t structures. * Re-link glue and current list. */static dns_rdatalist_t *grow_rdatalist(int new_len, dns_rdatalist_t *old, int old_len,	       rdatalist_head_t *current, rdatalist_head_t *glue,	       isc_mem_t *mctx){	dns_rdatalist_t *new;	int rdlcount = 0;	ISC_LIST(dns_rdatalist_t) save;	dns_rdatalist_t *this;	new = isc_mem_get(mctx, new_len * sizeof(*new));	if (new == NULL)		return (NULL);	ISC_LIST_INIT(save);	this = ISC_LIST_HEAD(*current);	while ((this = ISC_LIST_HEAD(*current)) != NULL) {		ISC_LIST_UNLINK(*current, this, link);		ISC_LIST_APPEND(save, this, link);	}	while ((this = ISC_LIST_HEAD(save)) != NULL) {		ISC_LIST_UNLINK(save, this, link);		new[rdlcount] = *this;		ISC_LIST_APPEND(*current, &new[rdlcount], link);		rdlcount++;	}	ISC_LIST_INIT(save);	this = ISC_LIST_HEAD(*glue);	while ((this = ISC_LIST_HEAD(*glue)) != NULL) {		ISC_LIST_UNLINK(*glue, this, link);		ISC_LIST_APPEND(save, this, link);	}	while ((this = ISC_LIST_HEAD(save)) != NULL) {		ISC_LIST_UNLINK(save, this, link);		new[rdlcount] = *this;		ISC_LIST_APPEND(*glue, &new[rdlcount], link);		rdlcount++;	}	INSIST(rdlcount == old_len);	if (old != NULL)		isc_mem_put(mctx, old, old_len * sizeof(*old));	return (new);}/* * Grow the slab of rdata structs. * Re-link the current and glue chains. */static dns_rdata_t *grow_rdata(int new_len, dns_rdata_t *old, int old_len,	   rdatalist_head_t *current, rdatalist_head_t *glue,	   isc_mem_t *mctx){	dns_rdata_t *new;	int rdcount = 0;	ISC_LIST(dns_rdata_t) save;	dns_rdatalist_t *this;	dns_rdata_t *rdata;	new = isc_mem_get(mctx, new_len * sizeof(*new));	if (new == NULL)		return (NULL);	memset(new, 0, new_len * sizeof(*new));	/*	 * Copy current relinking.	 */	this = ISC_LIST_HEAD(*current);	while (this != NULL) {		ISC_LIST_INIT(save);		while ((rdata = ISC_LIST_HEAD(this->rdata)) != NULL) {			ISC_LIST_UNLINK(this->rdata, rdata, link);			ISC_LIST_APPEND(save, rdata, link);		}		while ((rdata = ISC_LIST_HEAD(save)) != NULL) {			ISC_LIST_UNLINK(save, rdata, link);			new[rdcount] = *rdata;			ISC_LIST_APPEND(this->rdata, &new[rdcount], link);			rdcount++;		}		this = ISC_LIST_NEXT(this, link);	}	/*	 * Copy glue relinking.	 */	this = ISC_LIST_HEAD(*glue);	while (this != NULL) {		ISC_LIST_INIT(save);		while ((rdata = ISC_LIST_HEAD(this->rdata)) != NULL) {			ISC_LIST_UNLINK(this->rdata, rdata, link);			ISC_LIST_APPEND(save, rdata, link);		}		while ((rdata = ISC_LIST_HEAD(save)) != NULL) {			ISC_LIST_UNLINK(save, rdata, link);			new[rdcount] = *rdata;			ISC_LIST_APPEND(this->rdata, &new[rdcount], link);			rdcount++;		}		this = ISC_LIST_NEXT(this, link);	}	INSIST(rdcount == old_len);	if (old != NULL)		isc_mem_put(mctx, old, old_len * sizeof(*old));	return (new);}/* * Convert each element from a rdatalist_t to rdataset then call commit. * Unlink each element as we go. */static isc_result_tcommit(dns_rdatacallbacks_t *callbacks, dns_loadctx_t *lctx,       rdatalist_head_t *head, dns_name_t *owner,       const char *source, unsigned int line){	dns_rdatalist_t *this;	dns_rdataset_t dataset;	isc_result_t result;	char namebuf[DNS_NAME_FORMATSIZE];	void    (*error)(struct dns_rdatacallbacks *, const char *, ...);	this = ISC_LIST_HEAD(*head);	error = callbacks->error;	if (this == NULL)		return (ISC_R_SUCCESS);	do {		dns_rdataset_init(&dataset);		RUNTIME_CHECK(dns_rdatalist_tordataset(this, &dataset)			      == ISC_R_SUCCESS);		dataset.trust = dns_trust_ultimate;		result = ((*callbacks->add)(callbacks->add_private, owner,					    &dataset));		if (result == ISC_R_NOMEMORY) {			(*error)(callbacks, "dns_master_load: %s",				 dns_result_totext(result));		} else if (result != ISC_R_SUCCESS) {			dns_name_format(owner, namebuf,					sizeof(namebuf));			(*error)(callbacks, "%s: %s:%lu: %s: %s",				 "dns_master_load", source, line,				 namebuf, dns_result_totext(result));		}		if (MANYERRS(lctx, result))			SETRESULT(lctx, result);		else if (result != ISC_R_SUCCESS)			return (result);		ISC_LIST_UNLINK(*head, this, link);		this = ISC_LIST_HEAD(*head);	} while (this != NULL);	return (ISC_R_SUCCESS);}/* * Returns ISC_TRUE if one of the NS rdata's contains 'owner'. */static isc_boolean_tis_glue(rdatalist_head_t *head, dns_name_t *owner) {	dns_rdatalist_t *this;	dns_rdata_t *rdata;	isc_region_t region;	dns_name_t name;	/*	 * Find NS rrset.	 */	this = ISC_LIST_HEAD(*head);	while (this != NULL) {		if (this->type == dns_rdatatype_ns)			break;		this = ISC_LIST_NEXT(this, link);	}	if (this == NULL)		return (ISC_FALSE);	rdata = ISC_LIST_HEAD(this->rdata);	while (rdata != NULL) {		dns_name_init(&name, NULL);		dns_rdata_toregion(rdata, &region);		dns_name_fromregion(&name, &region);		if (dns_name_compare(&name, owner) == 0)			return (ISC_TRUE);		rdata = ISC_LIST_NEXT(rdata, link);	}	return (ISC_FALSE);}static voidload_quantum(isc_task_t *task, isc_event_t *event) {	isc_result_t result;	dns_loadctx_t *lctx;	REQUIRE(event != NULL);	lctx = event->ev_arg;	REQUIRE(DNS_LCTX_VALID(lctx));	if (lctx->canceled)		result = ISC_R_CANCELED;	else		result = load(lctx);	if (result == DNS_R_CONTINUE) {		event->ev_arg = lctx;		isc_task_send(task, &event);	} else {		(lctx->done)(lctx->done_arg, result);		isc_event_free(&event);		dns_loadctx_detach(&lctx);	}}static isc_result_ttask_send(dns_loadctx_t *lctx) {	isc_event_t *event;	event = isc_event_allocate(lctx->mctx, NULL,				   DNS_EVENT_MASTERQUANTUM,				   load_quantum, lctx, sizeof(*event));	if (event == NULL)		return (ISC_R_NOMEMORY);	isc_task_send(lctx->task, &event);	return (ISC_R_SUCCESS);}voiddns_loadctx_cancel(dns_loadctx_t *lctx) {	REQUIRE(DNS_LCTX_VALID(lctx));	LOCK(&lctx->lock);	lctx->canceled = ISC_TRUE;	UNLOCK(&lctx->lock);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -