Lines Matching defs:pctx
36 #define TOKEN_STRING(pctx) (pctx->token.value.as_textregion.base)
50 cfg_obj_destroy(pctx, &(obj)); \
58 parse_keyvalue(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret);
61 parse_optional_keyvalue(cfg_parser_t *pctx, const cfg_type_t *type,
65 parse_updatepolicy(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret);
67 print_updatepolicy(cfg_printer_t *pctx, const cfg_obj_t *obj);
70 doc_updatepolicy(cfg_printer_t *pctx, const cfg_type_t *type);
73 print_keyvalue(cfg_printer_t *pctx, const cfg_obj_t *obj);
76 doc_keyvalue(cfg_printer_t *pctx, const cfg_type_t *type);
79 doc_optional_keyvalue(cfg_printer_t *pctx, const cfg_type_t *type);
82 cfg_parse_kv_tuple(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret);
85 cfg_print_kv_tuple(cfg_printer_t *pctx, const cfg_obj_t *obj);
88 cfg_doc_kv_tuple(cfg_printer_t *pctx, const cfg_type_t *type);
312 parse_matchtype(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
315 CHECK(cfg_peektoken(pctx, 0));
316 if (pctx->token.type == isc_tokentype_string &&
317 strcasecmp(TOKEN_STRING(pctx), "zonesub") == 0)
319 pctx->flags |= CFG_PCTX_SKIP;
321 return cfg_parse_enum(pctx, type, ret);
328 parse_matchname(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
332 if ((pctx->flags & CFG_PCTX_SKIP) != 0) {
333 pctx->flags &= ~CFG_PCTX_SKIP;
334 CHECK(cfg_parse_void(pctx, NULL, &obj));
336 result = cfg_parse_astring(pctx, type, &obj);
345 doc_matchname(cfg_printer_t *pctx, const cfg_type_t *type) {
346 cfg_print_cstr(pctx, "[ ");
347 cfg_doc_obj(pctx, type->of);
348 cfg_print_cstr(pctx, " ]");
401 parse_updatepolicy(cfg_parser_t *pctx, const cfg_type_t *type,
404 CHECK(cfg_gettoken(pctx, 0));
405 if (pctx->token.type == isc_tokentype_special &&
406 pctx->token.value.as_char == '{')
408 cfg_ungettoken(pctx);
409 return cfg_parse_bracketed_list(pctx, type, ret);
412 if (pctx->token.type == isc_tokentype_string &&
413 strcasecmp(TOKEN_STRING(pctx), "local") == 0)
416 CHECK(cfg_create_obj(pctx, &cfg_type_ustring, &obj));
419 isc_mem_get(pctx->mctx, obj->value.string.length + 1);
426 cfg_ungettoken(pctx);
434 print_updatepolicy(cfg_printer_t *pctx, const cfg_obj_t *obj) {
436 cfg_print_ustring(pctx, obj);
438 cfg_print_bracketed_list(pctx, obj);
443 doc_updatepolicy(cfg_printer_t *pctx, const cfg_type_t *type) {
444 cfg_print_cstr(pctx, "( local | { ");
445 cfg_doc_obj(pctx, type->of);
446 cfg_print_cstr(pctx, "; ... } )");
501 parse_maxduration(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
502 return cfg_parse_enum_or_other(pctx, type, &cfg_type_duration, ret);
506 doc_maxduration(cfg_printer_t *pctx, const cfg_type_t *type) {
507 cfg_doc_enum_or_other(pctx, type, &cfg_type_duration);
540 parse_optional_enum(cfg_parser_t *pctx, const cfg_type_t *type,
542 return cfg_parse_enum_or_other(pctx, type, &cfg_type_void, ret);
546 doc_optional_enum(cfg_printer_t *pctx, const cfg_type_t *type) {
548 cfg_print_cstr(pctx, "[ ");
549 cfg_doc_enum(pctx, type);
550 cfg_print_cstr(pctx, " ]");
593 parse_keystore(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
599 CHECK(cfg_peektoken(pctx, 0));
600 if (pctx->token.type == isc_tokentype_string &&
601 strcasecmp(TOKEN_STRING(pctx), "key-directory") == 0)
603 CHECK(cfg_parse_obj(pctx, &cfg_type_ustring, &obj));
604 } else if (pctx->token.type == isc_tokentype_string &&
605 strcasecmp(TOKEN_STRING(pctx), "key-store") == 0)
607 CHECK(cfg_parse_obj(pctx, &cfg_type_keystorage, &obj));
609 CHECK(cfg_parse_void(pctx, NULL, &obj));
618 doc_keystore(cfg_printer_t *pctx, const cfg_type_t *type) {
621 cfg_print_cstr(pctx, "[ key-directory | key-store <string> ]");
625 print_keystore(cfg_printer_t *pctx, const cfg_obj_t *obj) {
626 REQUIRE(pctx != NULL);
631 cfg_print_cstr(pctx, "key-store ");
633 cfg_print_ustring(pctx, obj);
658 print_tagrange(cfg_printer_t *pctx, const cfg_obj_t *obj) {
659 REQUIRE(pctx != NULL);
664 cfg_print_cstr(pctx, "tag-range ");
665 cfg_print_tuple(pctx, obj);
681 doc_optionaltagrange(cfg_printer_t *pctx, const cfg_type_t *type) {
684 cfg_print_cstr(pctx, "[ tag-range <integer> <integer> ]");
688 parse_optionaltagrange(cfg_parser_t *pctx, const cfg_type_t *type,
695 CHECK(cfg_peektoken(pctx, 0));
696 if (pctx->token.type == isc_tokentype_string &&
697 strcasecmp(TOKEN_STRING(pctx), "tag-range") == 0)
699 CHECK(cfg_gettoken(pctx, CFG_LEXOPT_QSTRING));
700 CHECK(cfg_parse_obj(pctx, &cfg_type_tagrange, &obj));
702 CHECK(cfg_parse_void(pctx, NULL, &obj));
877 parse_zonestat(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
878 return cfg_parse_enum_or_other(pctx, type, &cfg_type_boolean, ret);
881 doc_zonestat(cfg_printer_t *pctx, const cfg_type_t *type) {
882 cfg_doc_enum_or_other(pctx, type, &cfg_type_boolean);
973 print_none(cfg_printer_t *pctx, const cfg_obj_t *obj) {
975 cfg_print_cstr(pctx, "none");
985 parse_qstringornone(cfg_parser_t *pctx, const cfg_type_t *type,
989 CHECK(cfg_gettoken(pctx, CFG_LEXOPT_QSTRING));
990 if (pctx->token.type == isc_tokentype_string &&
991 strcasecmp(TOKEN_STRING(pctx), "none") == 0)
993 return cfg_create_obj(pctx, &cfg_type_none, ret);
995 cfg_ungettoken(pctx);
996 return cfg_parse_qstring(pctx, type, ret);
1002 doc_qstringornone(cfg_printer_t *pctx, const cfg_type_t *type) {
1004 cfg_print_cstr(pctx, "( <quoted_string> | none )");
1019 print_auto(cfg_printer_t *pctx, const cfg_obj_t *obj) {
1021 cfg_print_cstr(pctx, "auto");
1028 parse_boolorauto(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
1031 CHECK(cfg_gettoken(pctx, CFG_LEXOPT_QSTRING));
1032 if (pctx->token.type == isc_tokentype_string &&
1033 strcasecmp(TOKEN_STRING(pctx), "auto") == 0)
1035 return cfg_create_obj(pctx, &cfg_type_auto, ret);
1037 cfg_ungettoken(pctx);
1038 return cfg_parse_boolean(pctx, type, ret);
1044 print_boolorauto(cfg_printer_t *pctx, const cfg_obj_t *obj) {
1046 cfg_print_cstr(pctx, "auto");
1048 cfg_print_cstr(pctx, "yes");
1050 cfg_print_cstr(pctx, "no");
1055 doc_boolorauto(cfg_printer_t *pctx, const cfg_type_t *type) {
1057 cfg_print_cstr(pctx, "( yes | no | auto )");
1069 print_hostname(cfg_printer_t *pctx, const cfg_obj_t *obj) {
1071 cfg_print_cstr(pctx, "hostname");
1083 parse_serverid(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
1085 CHECK(cfg_gettoken(pctx, CFG_LEXOPT_QSTRING));
1086 if (pctx->token.type == isc_tokentype_string &&
1087 strcasecmp(TOKEN_STRING(pctx), "none") == 0)
1089 return cfg_create_obj(pctx, &cfg_type_none, ret);
1091 if (pctx->token.type == isc_tokentype_string &&
1092 strcasecmp(TOKEN_STRING(pctx), "hostname") == 0)
1094 result = cfg_create_obj(pctx, &cfg_type_hostname, ret);
1100 cfg_ungettoken(pctx);
1101 return cfg_parse_qstring(pctx, type, ret);
1107 doc_serverid(cfg_printer_t *pctx, const cfg_type_t *type) {
1109 cfg_print_cstr(pctx, "( <quoted_string> | none | hostname )");
1119 print_porttuple(cfg_printer_t *pctx, const cfg_obj_t *obj) {
1120 cfg_print_cstr(pctx, "range ");
1121 cfg_print_tuple(pctx, obj);
1133 parse_port(cfg_parser_t *pctx, cfg_obj_t **ret) {
1136 CHECK(cfg_parse_uint32(pctx, NULL, ret));
1138 cfg_parser_error(pctx, CFG_LOG_NEAR, "invalid port");
1139 cfg_obj_destroy(pctx, ret);
1148 parse_portrange(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
1154 CHECK(cfg_peektoken(pctx, ISC_LEXOPT_NUMBER | ISC_LEXOPT_CNUMBER));
1155 if (pctx->token.type == isc_tokentype_number) {
1156 CHECK(parse_port(pctx, ret));
1158 CHECK(cfg_gettoken(pctx, 0));
1159 if (pctx->token.type != isc_tokentype_string ||
1160 strcasecmp(TOKEN_STRING(pctx), "range") != 0)
1162 cfg_parser_error(pctx, CFG_LOG_NEAR,
1166 CHECK(cfg_create_tuple(pctx, &cfg_type_porttuple, &obj));
1167 CHECK(parse_port(pctx, &obj->value.tuple[0]));
1168 CHECK(parse_port(pctx, &obj->value.tuple[1]));
1172 cfg_parser_error(pctx, CFG_LOG_NOPREP,
1185 cfg_obj_destroy(pctx, &obj);
1635 parse_dtout(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
1640 CHECK(cfg_create_tuple(pctx, type, &obj));
1643 CHECK(cfg_parse_obj(pctx, fields[0].type, &obj->value.tuple[0]));
1644 CHECK(cfg_parse_obj(pctx, fields[1].type, &obj->value.tuple[1]));
1648 CHECK(cfg_peektoken(pctx, 0));
1649 if (pctx->token.type == isc_tokentype_string) {
1650 CHECK(cfg_gettoken(pctx, 0));
1651 if (strcasecmp(TOKEN_STRING(pctx), "size") == 0 &&
1654 CHECK(cfg_parse_obj(pctx, fields[2].type,
1656 } else if (strcasecmp(TOKEN_STRING(pctx), "versions") ==
1660 CHECK(cfg_parse_obj(pctx, fields[3].type,
1662 } else if (strcasecmp(TOKEN_STRING(pctx), "suffix") ==
1666 CHECK(cfg_parse_obj(pctx, fields[4].type,
1669 cfg_parser_error(pctx, CFG_LOG_NEAR,
1681 CHECK(cfg_parse_void(pctx, NULL, &obj->value.tuple[2]));
1684 CHECK(cfg_parse_void(pctx, NULL, &obj->value.tuple[3]));
1687 CHECK(cfg_parse_void(pctx, NULL, &obj->value.tuple[4]));
1699 print_dtout(cfg_printer_t *pctx, const cfg_obj_t *obj) {
1700 cfg_print_obj(pctx, obj->value.tuple[0]); /* mode */
1701 cfg_print_obj(pctx, obj->value.tuple[1]); /* file */
1703 cfg_print_cstr(pctx, " size ");
1704 cfg_print_obj(pctx, obj->value.tuple[2]);
1707 cfg_print_cstr(pctx, " versions ");
1708 cfg_print_obj(pctx, obj->value.tuple[3]);
1711 cfg_print_cstr(pctx, " suffix ");
1712 cfg_print_obj(pctx, obj->value.tuple[4]);
1717 doc_dtout(cfg_printer_t *pctx, const cfg_type_t *type) {
1719 cfg_print_cstr(pctx, "( file | unix ) <quoted_string>");
1720 cfg_print_cstr(pctx, " ");
1721 cfg_print_cstr(pctx, "[ size ( unlimited | <size> ) ]");
1722 cfg_print_cstr(pctx, " ");
1723 cfg_print_cstr(pctx, "[ versions ( unlimited | <integer> ) ]");
1724 cfg_print_cstr(pctx, " ");
1725 cfg_print_cstr(pctx, "[ suffix ( increment | timestamp ) ]");
1763 doc_rpz_policy(cfg_printer_t *pctx, const cfg_type_t *type) {
1768 cfg_print_cstr(pctx, "( ");
1770 cfg_print_cstr(pctx, *p);
1772 cfg_print_cstr(pctx, " | ");
1778 doc_rpz_cname(cfg_printer_t *pctx, const cfg_type_t *type) {
1779 cfg_doc_terminal(pctx, type);
1780 cfg_print_cstr(pctx, " )");
1788 cfg_parse_rpz_policy(cfg_parser_t *pctx, const cfg_type_t *type,
1794 CHECK(cfg_create_tuple(pctx, type, &obj));
1797 CHECK(cfg_parse_obj(pctx, fields[0].type, &obj->value.tuple[0]));
1802 CHECK(cfg_parse_void(pctx, NULL, &obj->value.tuple[1]));
1804 CHECK(cfg_parse_obj(pctx, fields[1].type,
1821 cfg_parse_kv_tuple(cfg_parser_t *pctx, const cfg_type_t *type,
1828 CHECK(cfg_create_tuple(pctx, type, &obj));
1834 CHECK(cfg_parse_obj(pctx, fields[0].type, &obj->value.tuple[0]));
1837 CHECK(cfg_peektoken(pctx, CFG_LEXOPT_QSTRING));
1838 if (pctx->token.type != isc_tokentype_string) {
1844 cfg_parser_error(pctx, 0, "unexpected '%s'",
1845 TOKEN_STRING(pctx));
1850 strcasecmp(f->name, TOKEN_STRING(pctx)) == 0)
1856 CHECK(cfg_gettoken(pctx, 0));
1857 CHECK(cfg_parse_obj(pctx, f->type, &obj->value.tuple[fn]));
1862 CHECK(cfg_parse_void(pctx, NULL,
1876 cfg_print_kv_tuple(cfg_printer_t *pctx, const cfg_obj_t *obj) {
1888 cfg_print_cstr(pctx, " ");
1889 cfg_print_cstr(pctx, f->name);
1890 cfg_print_cstr(pctx, " ");
1892 cfg_print_obj(pctx, fieldobj);
1897 cfg_doc_kv_tuple(cfg_printer_t *pctx, const cfg_type_t *type) {
1906 cfg_print_cstr(pctx, " [ ");
1907 cfg_print_cstr(pctx, f->name);
1909 cfg_print_cstr(pctx, " ");
1912 cfg_doc_obj(pctx, f->type);
1914 cfg_print_cstr(pctx, " ]");
2061 parse_optional_uint32(cfg_parser_t *pctx, const cfg_type_t *type,
2066 CHECK(cfg_peektoken(pctx, ISC_LEXOPT_NUMBER | ISC_LEXOPT_CNUMBER));
2067 if (pctx->token.type == isc_tokentype_number) {
2068 CHECK(cfg_parse_obj(pctx, &cfg_type_uint32, ret));
2070 CHECK(cfg_parse_obj(pctx, &cfg_type_void, ret));
2077 doc_optional_uint32(cfg_printer_t *pctx, const cfg_type_t *type) {
2079 cfg_print_cstr(pctx, "[ <integer> ]");
2120 parse_staleanswerclienttimeout(cfg_parser_t *pctx, const cfg_type_t *type,
2122 return cfg_parse_enum_or_other(pctx, type, &cfg_type_uint32, ret);
2126 doc_staleanswerclienttimeout(cfg_printer_t *pctx, const cfg_type_t *type) {
2127 cfg_doc_enum_or_other(pctx, type, &cfg_type_uint32);
2326 parse_checkds_type(cfg_parser_t *pctx, const cfg_type_t *type,
2328 return cfg_parse_enum_or_other(pctx, type, &cfg_type_boolean, ret);
2331 doc_checkds_type(cfg_printer_t *pctx, const cfg_type_t *type) {
2332 cfg_doc_enum_or_other(pctx, type, &cfg_type_boolean);
2762 parse_printtime(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
2763 return cfg_parse_enum_or_other(pctx, type, &cfg_type_boolean, ret);
2766 doc_printtime(cfg_printer_t *pctx, const cfg_type_t *type) {
2767 cfg_doc_enum_or_other(pctx, type, &cfg_type_boolean);
2880 parse_sizeval(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
2887 CHECK(cfg_gettoken(pctx, 0));
2888 if (pctx->token.type != isc_tokentype_string) {
2892 CHECK(parse_unitstring(TOKEN_STRING(pctx), &val));
2894 CHECK(cfg_create_obj(pctx, &cfg_type_uint64, &obj));
2900 cfg_parser_error(pctx, CFG_LOG_NEAR,
2906 parse_sizeval_percent(cfg_parser_t *pctx, const cfg_type_t *type,
2916 CHECK(cfg_gettoken(pctx, 0));
2917 if (pctx->token.type != isc_tokentype_string) {
2922 percent = strtoull(TOKEN_STRING(pctx), &endp, 10);
2925 CHECK(cfg_create_obj(pctx, &cfg_type_percentage, &obj));
2930 CHECK(parse_unitstring(TOKEN_STRING(pctx), &val));
2931 CHECK(cfg_create_obj(pctx, &cfg_type_uint64, &obj));
2938 cfg_parser_error(pctx, CFG_LOG_NEAR,
2944 doc_sizeval_percent(cfg_printer_t *pctx, const cfg_type_t *type) {
2947 cfg_print_cstr(pctx, "( ");
2948 cfg_doc_terminal(pctx, &cfg_type_size);
2949 cfg_print_cstr(pctx, " | ");
2950 cfg_doc_terminal(pctx, &cfg_type_percentage);
2951 cfg_print_cstr(pctx, " )");
2966 parse_size(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
2967 return cfg_parse_enum_or_other(pctx, type, &cfg_type_sizeval, ret);
2971 doc_size(cfg_printer_t *pctx, const cfg_type_t *type) {
2972 cfg_doc_enum_or_other(pctx, type, &cfg_type_sizeval);
3003 parse_size_or_percent(cfg_parser_t *pctx, const cfg_type_t *type,
3005 return cfg_parse_enum_or_other(pctx, type, &cfg_type_sizeval_percent,
3010 doc_parse_size_or_percent(cfg_printer_t *pctx, const cfg_type_t *type) {
3012 cfg_print_cstr(pctx, "( default | unlimited | ");
3013 cfg_doc_terminal(pctx, &cfg_type_sizeval);
3014 cfg_print_cstr(pctx, " | ");
3015 cfg_doc_terminal(pctx, &cfg_type_percentage);
3016 cfg_print_cstr(pctx, " )");
3030 parse_ixfrratio(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
3031 return cfg_parse_enum_or_other(pctx, type, &cfg_type_percentage, ret);
3035 doc_ixfrratio(cfg_printer_t *pctx, const cfg_type_t *type) {
3037 cfg_print_cstr(pctx, "( unlimited | ");
3038 cfg_doc_terminal(pctx, &cfg_type_percentage);
3039 cfg_print_cstr(pctx, " )");
3051 parse_maybe_optional_keyvalue(cfg_parser_t *pctx, const cfg_type_t *type,
3057 CHECK(cfg_peektoken(pctx, 0));
3058 if (pctx->token.type == isc_tokentype_string &&
3059 strcasecmp(TOKEN_STRING(pctx), kw->name) == 0)
3061 CHECK(cfg_gettoken(pctx, 0));
3062 CHECK(kw->type->parse(pctx, kw->type, &obj));
3066 CHECK(cfg_parse_void(pctx, NULL, &obj));
3068 cfg_parser_error(pctx, CFG_LOG_NEAR, "expected '%s'",
3080 parse_keyvalue(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
3081 return parse_maybe_optional_keyvalue(pctx, type, false, ret);
3085 parse_optional_keyvalue(cfg_parser_t *pctx, const cfg_type_t *type,
3087 return parse_maybe_optional_keyvalue(pctx, type, true, ret);
3091 print_keyvalue(cfg_printer_t *pctx, const cfg_obj_t *obj) {
3093 cfg_print_cstr(pctx, kw->name);
3094 cfg_print_cstr(pctx, " ");
3095 kw->type->print(pctx, obj);
3099 doc_keyvalue(cfg_printer_t *pctx, const cfg_type_t *type) {
3101 cfg_print_cstr(pctx, kw->name);
3102 cfg_print_cstr(pctx, " ");
3103 cfg_doc_obj(pctx, kw->type);
3107 doc_optional_keyvalue(cfg_printer_t *pctx, const cfg_type_t *type) {
3109 cfg_print_cstr(pctx, "[ ");
3110 cfg_print_cstr(pctx, kw->name);
3111 cfg_print_cstr(pctx, " ");
3112 cfg_doc_obj(pctx, kw->type);
3113 cfg_print_cstr(pctx, " ]");
3119 parse_dialup_type(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
3120 return cfg_parse_enum_or_other(pctx, type, &cfg_type_boolean, ret);
3123 doc_dialup_type(cfg_printer_t *pctx, const cfg_type_t *type) {
3124 cfg_doc_enum_or_other(pctx, type, &cfg_type_boolean);
3133 parse_notify_type(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
3134 return cfg_parse_enum_or_other(pctx, type, &cfg_type_boolean, ret);
3137 doc_notify_type(cfg_printer_t *pctx, const cfg_type_t *type) {
3138 cfg_doc_enum_or_other(pctx, type, &cfg_type_boolean);
3147 parse_minimal(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
3148 return cfg_parse_enum_or_other(pctx, type, &cfg_type_boolean, ret);
3151 doc_minimal(cfg_printer_t *pctx, const cfg_type_t *type) {
3152 cfg_doc_enum_or_other(pctx, type, &cfg_type_boolean);
3162 parse_ixfrdiff_type(cfg_parser_t *pctx, const cfg_type_t *type,
3164 return cfg_parse_enum_or_other(pctx, type, &cfg_type_boolean, ret);
3167 doc_ixfrdiff_type(cfg_printer_t *pctx, const cfg_type_t *type) {
3168 cfg_doc_enum_or_other(pctx, type, &cfg_type_boolean);
3283 doc_optional_bracketed_list(cfg_printer_t *pctx, const cfg_type_t *type) {
3285 cfg_print_cstr(pctx, "[ ");
3286 cfg_print_cstr(pctx, kw->name);
3287 cfg_print_cstr(pctx, " ");
3288 cfg_doc_obj(pctx, kw->type);
3289 cfg_print_cstr(pctx, " ]");
3326 parse_optional_class(cfg_parser_t *pctx, const cfg_type_t *type,
3330 CHECK(cfg_peektoken(pctx, 0));
3331 if (pctx->token.type == isc_tokentype_string) {
3332 CHECK(cfg_parse_obj(pctx, &cfg_type_ustring, ret));
3334 CHECK(cfg_parse_obj(pctx, &cfg_type_void, ret));
3341 doc_optional_class(cfg_printer_t *pctx, const cfg_type_t *type) {
3343 cfg_print_cstr(pctx, "[ <class> ]");
3354 parse_querysource(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
3373 CHECK(cfg_peektoken(pctx, 0));
3374 if (pctx->token.type == isc_tokentype_string) {
3375 if (strcasecmp(TOKEN_STRING(pctx), "address") == 0) {
3377 CHECK(cfg_gettoken(pctx, 0));
3378 CHECK(cfg_parse_rawaddr(pctx, *flagp,
3381 } else if (strcasecmp(TOKEN_STRING(pctx), "port") == 0)
3384 if ((pctx->flags & CFG_PCTX_NODEPRECATED) == 0)
3387 pctx, 0,
3390 CHECK(cfg_gettoken(pctx, 0));
3391 CHECK(cfg_parse_rawport(pctx, CFG_ADDR_WILDOK,
3394 } else if (strcasecmp(TOKEN_STRING(pctx), "tls") == 0) {
3400 return cfg_parse_sockaddr(pctx, type, ret);
3402 cfg_parser_error(pctx, CFG_LOG_NEAR,
3414 cfg_parser_error(pctx, 0, "expected one address and/or port");
3419 cfg_parser_error(pctx, 0, "unexpected tls");
3423 CHECK(cfg_create_obj(pctx, &cfg_type_querysource, &obj));
3429 cfg_parser_error(pctx, CFG_LOG_NEAR, "invalid query source");
3435 print_querysource(cfg_printer_t *pctx, const cfg_obj_t *obj) {
3438 cfg_print_cstr(pctx, "address ");
3439 cfg_print_rawaddr(pctx, &na);
3440 cfg_print_cstr(pctx, " port ");
3441 cfg_print_rawuint(pctx, isc_sockaddr_getport(&obj->value.sockaddr));
3445 doc_querysource(cfg_printer_t *pctx, const cfg_type_t *type) {
3448 cfg_print_cstr(pctx, "[ address ] ( ");
3450 cfg_print_cstr(pctx, "<ipv4_address>");
3452 cfg_print_cstr(pctx, "<ipv6_address>");
3456 cfg_print_cstr(pctx, " | * )");
3493 parse_server_key_kludge(cfg_parser_t *pctx, const cfg_type_t *type,
3500 CHECK(cfg_peektoken(pctx, 0));
3501 if (pctx->token.type == isc_tokentype_special &&
3502 pctx->token.value.as_char == '{')
3504 CHECK(cfg_gettoken(pctx, 0));
3508 CHECK(cfg_parse_obj(pctx, &cfg_type_astring, ret));
3512 CHECK(cfg_peektoken(pctx, 0));
3513 if (pctx->token.type == isc_tokentype_special &&
3514 pctx->token.value.as_char == ';')
3516 CHECK(cfg_gettoken(pctx, 0));
3519 CHECK(cfg_parse_special(pctx, '}'));
3534 parse_optional_facility(cfg_parser_t *pctx, const cfg_type_t *type,
3539 CHECK(cfg_peektoken(pctx, CFG_LEXOPT_QSTRING));
3540 if (pctx->token.type == isc_tokentype_string ||
3541 pctx->token.type == isc_tokentype_qstring)
3543 CHECK(cfg_parse_obj(pctx, &cfg_type_astring, ret));
3545 CHECK(cfg_parse_obj(pctx, &cfg_type_void, ret));
3552 doc_optional_facility(cfg_printer_t *pctx, const cfg_type_t *type) {
3554 cfg_print_cstr(pctx, "[ <syslog_facility> ]");
3575 parse_logseverity(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
3579 CHECK(cfg_peektoken(pctx, 0));
3580 if (pctx->token.type == isc_tokentype_string &&
3581 strcasecmp(TOKEN_STRING(pctx), "debug") == 0)
3583 CHECK(cfg_gettoken(pctx, 0)); /* read "debug" */
3584 CHECK(cfg_peektoken(pctx, ISC_LEXOPT_NUMBER));
3585 if (pctx->token.type == isc_tokentype_number) {
3586 CHECK(cfg_parse_uint32(pctx, NULL, ret));
3593 CHECK(cfg_create_obj(pctx, &cfg_type_uint32, ret));
3598 CHECK(cfg_parse_obj(pctx, &cfg_type_loglevel, ret));
3615 parse_logversions(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
3616 return cfg_parse_enum_or_other(pctx, type, &cfg_type_uint32, ret);
3620 doc_logversions(cfg_printer_t *pctx, const cfg_type_t *type) {
3621 cfg_doc_enum_or_other(pctx, type, &cfg_type_uint32);
3643 parse_logfile(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
3648 CHECK(cfg_create_tuple(pctx, type, &obj));
3651 CHECK(cfg_parse_obj(pctx, fields[0].type, &obj->value.tuple[0]));
3655 CHECK(cfg_peektoken(pctx, 0));
3656 if (pctx->token.type == isc_tokentype_string) {
3657 CHECK(cfg_gettoken(pctx, 0));
3658 if (strcasecmp(TOKEN_STRING(pctx), "versions") == 0 &&
3661 CHECK(cfg_parse_obj(pctx, fields[1].type,
3663 } else if (strcasecmp(TOKEN_STRING(pctx), "size") ==
3667 CHECK(cfg_parse_obj(pctx, fields[2].type,
3669 } else if (strcasecmp(TOKEN_STRING(pctx), "suffix") ==
3673 CHECK(cfg_parse_obj(pctx, fields[3].type,
3685 CHECK(cfg_parse_void(pctx, NULL, &obj->value.tuple[1]));
3688 CHECK(cfg_parse_void(pctx, NULL, &obj->value.tuple[2]));
3691 CHECK(cfg_parse_void(pctx, NULL, &obj->value.tuple[3]));
3703 print_logfile(cfg_printer_t *pctx, const cfg_obj_t *obj) {
3704 cfg_print_obj(pctx, obj->value.tuple[0]); /* file */
3706 cfg_print_cstr(pctx, " versions ");
3707 cfg_print_obj(pctx, obj->value.tuple[1]);
3710 cfg_print_cstr(pctx, " size ");
3711 cfg_print_obj(pctx, obj->value.tuple[2]);
3714 cfg_print_cstr(pctx, " suffix ");
3715 cfg_print_obj(pctx, obj->value.tuple[3]);
3720 doc_logfile(cfg_printer_t *pctx, const cfg_type_t *type) {
3722 cfg_print_cstr(pctx, "<quoted_string>");
3723 cfg_print_cstr(pctx, " ");
3724 cfg_print_cstr(pctx, "[ versions ( unlimited | <integer> ) ]");
3725 cfg_print_cstr(pctx, " ");
3726 cfg_print_cstr(pctx, "[ size <size> ]");
3727 cfg_print_cstr(pctx, " ");
3728 cfg_print_cstr(pctx, "[ suffix ( increment | timestamp ) ]");
3842 doc_sockaddrnameport(cfg_printer_t *pctx, const cfg_type_t *type) {
3844 cfg_print_cstr(pctx, "( ");
3845 cfg_print_cstr(pctx, "<quoted_string>");
3846 cfg_print_cstr(pctx, " ");
3847 cfg_print_cstr(pctx, "[ port <integer> ]");
3848 cfg_print_cstr(pctx, " | ");
3849 cfg_print_cstr(pctx, "<ipv4_address>");
3850 cfg_print_cstr(pctx, " ");
3851 cfg_print_cstr(pctx, "[ port <integer> ]");
3852 cfg_print_cstr(pctx, " | ");
3853 cfg_print_cstr(pctx, "<ipv6_address>");
3854 cfg_print_cstr(pctx, " ");
3855 cfg_print_cstr(pctx, "[ port <integer> ]");
3856 cfg_print_cstr(pctx, " )");
3860 parse_sockaddrnameport(cfg_parser_t *pctx, const cfg_type_t *type,
3865 CHECK(cfg_peektoken(pctx, CFG_LEXOPT_QSTRING));
3866 if (pctx->token.type == isc_tokentype_string ||
3867 pctx->token.type == isc_tokentype_qstring)
3869 if (cfg_lookingat_netaddr(pctx, CFG_ADDR_V4OK | CFG_ADDR_V6OK))
3871 CHECK(cfg_parse_sockaddr(pctx, &cfg_type_sockaddr,
3874 CHECK(cfg_parse_tuple(pctx, &cfg_type_nameport, ret));
3877 cfg_parser_error(pctx, CFG_LOG_NEAR,
3922 doc_remoteselement(cfg_printer_t *pctx, const cfg_type_t *type) {
3924 cfg_print_cstr(pctx, "( ");
3925 cfg_print_cstr(pctx, "<remote-servers>");
3926 cfg_print_cstr(pctx, " | ");
3927 cfg_print_cstr(pctx, "<ipv4_address>");
3928 cfg_print_cstr(pctx, " ");
3929 cfg_print_cstr(pctx, "[ port <integer> ]");
3930 cfg_print_cstr(pctx, " | ");
3931 cfg_print_cstr(pctx, "<ipv6_address>");
3932 cfg_print_cstr(pctx, " ");
3933 cfg_print_cstr(pctx, "[ port <integer> ]");
3934 cfg_print_cstr(pctx, " )");
3938 parse_remoteselement(cfg_parser_t *pctx, const cfg_type_t *type,
3944 CHECK(cfg_peektoken(pctx, CFG_LEXOPT_QSTRING));
3945 if (pctx->token.type == isc_tokentype_string ||
3946 pctx->token.type == isc_tokentype_qstring)
3948 if (cfg_lookingat_netaddr(pctx, CFG_ADDR_V4OK | CFG_ADDR_V6OK))
3950 CHECK(cfg_parse_sockaddr(pctx, &cfg_type_sockaddr,
3953 CHECK(cfg_parse_astring(pctx, &cfg_type_astring, ret));
3956 cfg_parser_error(pctx, CFG_LOG_NEAR,
4014 cfg_printer_t pctx;
4018 pctx.f = f;
4019 pctx.closure = closure;
4020 pctx.indent = 0;
4021 pctx.flags = flags;
4028 cfg_print_cstr(&pctx, "zone <string> [ <class> ] {\n");
4029 pctx.indent++;
4033 cfg_print_indent(&pctx);
4034 cfg_print_cstr(&pctx, "type primary;\n");
4037 cfg_print_indent(&pctx);
4038 cfg_print_cstr(&pctx, "type secondary;\n");
4041 cfg_print_indent(&pctx);
4042 cfg_print_cstr(&pctx, "type mirror;\n");
4045 cfg_print_indent(&pctx);
4046 cfg_print_cstr(&pctx, "type stub;\n");
4049 cfg_print_indent(&pctx);
4050 cfg_print_cstr(&pctx, "type hint;\n");
4053 cfg_print_indent(&pctx);
4054 cfg_print_cstr(&pctx, "type forward;\n");
4057 cfg_print_indent(&pctx);
4058 cfg_print_cstr(&pctx, "type static-stub;\n");
4061 cfg_print_indent(&pctx);
4062 cfg_print_cstr(&pctx, "type redirect;\n");
4072 if (((pctx.flags & CFG_PRINTER_ACTIVEONLY) != 0) &&
4089 cfg_print_indent(&pctx);
4090 cfg_print_cstr(&pctx, clause->name);
4091 cfg_print_cstr(&pctx, " ");
4092 cfg_doc_obj(&pctx, clause->type);
4093 cfg_print_cstr(&pctx, ";");
4094 cfg_print_clauseflags(&pctx, clause->flags);
4095 cfg_print_cstr(&pctx, "\n");
4098 pctx.indent--;
4099 cfg_print_cstr(&pctx, "};\n");