Commit 3a499177 authored by James Brister's avatar James Brister
Browse files

Support new optional class on a view declaration.

parent ce3be21d
......@@ -16,7 +16,7 @@
* SOFTWARE.
*/
/* $Id: confparser.y,v 1.58 2000/04/06 09:43:12 brister Exp $ */
/* $Id: confparser.y,v 1.59 2000/04/06 10:35:25 brister Exp $ */
#include <config.h>
......@@ -337,6 +337,7 @@ static isc_boolean_t int_too_big(isc_uint32_t base, isc_uint32_t mult);
%type <rdatatype> rdatatype
%type <rdatatypelist> rdatatype_list
%type <rrclass> class_name
%type <rrclass> wild_class_name
%type <rrclass> optional_class
%type <severity> check_names_opt;
%type <ssu> grant_stmt
......@@ -1206,7 +1207,7 @@ ordering_class: /* nothing */
{
$$ = dns_rdataclass_any;
}
| L_CLASS class_name
| L_CLASS wild_class_name
{
$$ = $2;
}
......@@ -2712,7 +2713,7 @@ secret: L_SECRET any_string L_EOS
*/
view_stmt: L_VIEW any_string L_LBRACE
view_stmt: L_VIEW any_string optional_class L_LBRACE
{
dns_c_view_t *view;
......@@ -2726,7 +2727,7 @@ view_stmt: L_VIEW any_string L_LBRACE
}
}
tmpres = dns_c_view_new(currcfg->mem, $2, &view);
tmpres = dns_c_view_new(currcfg->mem, $2, $3, &view);
if (tmpres != ISC_R_SUCCESS) {
parser_error(ISC_FALSE,
"failed to create view %s", $2);
......@@ -3573,6 +3574,24 @@ optional_zone_options_list: /* Empty */
;
class_name: any_string
{
isc_textregion_t reg;
dns_rdataclass_t cl;
reg.base = $1;
reg.length = strlen($1);
tmpres = dns_rdataclass_fromtext(&cl, &reg);
if (tmpres != ISC_R_SUCCESS) {
parser_error(ISC_TRUE, "unknown class.");
YYABORT;
}
isc_mem_free(memctx, $1);
$$ = cl;
}
wild_class_name: any_string
{
isc_textregion_t reg;
dns_rdataclass_t cl;
......
......@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: confview.c,v 1.18 2000/04/06 09:46:53 brister Exp $ */
/* $Id: confview.c,v 1.19 2000/04/06 10:35:26 brister Exp $ */
#include <config.h>
......@@ -436,7 +436,8 @@ dns_c_viewtable_checkviews(dns_c_viewtable_t *viewtable)
/* ***************************************************************** */
isc_result_t
dns_c_view_new(isc_mem_t *mem, const char *name, dns_c_view_t **newview)
dns_c_view_new(isc_mem_t *mem, const char *name, dns_rdataclass_t viewclass,
dns_c_view_t **newview)
{
dns_c_view_t *view;
......@@ -451,6 +452,7 @@ dns_c_view_new(isc_mem_t *mem, const char *name, dns_c_view_t **newview)
view->magic = DNS_C_VIEW_MAGIC;
view->mem = mem;
view->viewclass = viewclass;
view->name = isc_mem_strdup(mem, name);
if (view->name == NULL) {
......@@ -526,7 +528,14 @@ dns_c_view_print(FILE *fp, int indent, dns_c_view_t *view)
REQUIRE(DNS_C_VIEW_VALID(view));
dns_c_printtabs(fp, indent);
fprintf(fp, "view \"%s\" {\n", view->name);
fprintf(fp, "view \"%s\"", view->name);
if (view->viewclass != dns_rdataclass_in) {
fputc(' ', fp);
dns_c_dataclass_tostream(fp, view->viewclass);
}
fprintf(fp, " {\n");
#define PRINT_IPANDPORT(FIELD, NAME) \
if (view->FIELD != NULL) { \
......@@ -789,6 +798,18 @@ dns_c_view_getname(dns_c_view_t *view, const char **retval)
}
isc_result_t
dns_c_view_getviewclass(dns_c_view_t *view, dns_rdataclass_t *retval)
{
REQUIRE(DNS_C_VIEW_VALID(view));
REQUIRE(retval != NULL);
*retval = view->viewclass;
return (ISC_R_SUCCESS);
}
/*
**
......
......@@ -104,6 +104,8 @@ struct dns_c_view
char *name;
dns_rdataclass_t viewclass;
dns_c_zonelist_t *zonelist;
dns_c_forw_t *forward;
......@@ -186,8 +188,10 @@ isc_result_t dns_c_viewtable_checkviews(dns_c_viewtable_t *viewtable);
isc_result_t dns_c_view_new(isc_mem_t *mem,
const char *name, dns_c_view_t **newview);
isc_result_t dns_c_view_new(isc_mem_t *mem, const char *name,
dns_rdataclass_t viewclass,
dns_c_view_t **newview);
isc_result_t dns_c_view_delete(dns_c_view_t **viewptr);
void dns_c_view_print(FILE *fp, int indent, dns_c_view_t *view);
......@@ -200,6 +204,9 @@ isc_result_t dns_c_view_getzonelist(dns_c_view_t *view,
isc_result_t dns_c_view_unsetzonelist(dns_c_view_t *view);
isc_result_t dns_c_view_getviewclass(dns_c_view_t *view,
dns_rdataclass_t *retval);
isc_result_t dns_c_view_getforward(dns_c_view_t *view,
dns_c_forw_t *retval);
isc_result_t dns_c_view_setforward(dns_c_view_t *view,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment