Line data Source code
1 : /* SPDX-License-Identifier: LGPL-2.1+ */ 2 : 3 : #include "dns-type.h" 4 : #include "resolved-dns-dnssec.h" 5 : #include "resolved-dns-packet.h" 6 : #include "test-tables.h" 7 : 8 1 : int main(int argc, char **argv) { 9 : uint16_t i; 10 : 11 1 : test_table(dns_protocol, DNS_PROTOCOL); 12 1 : test_table(dnssec_result, DNSSEC_RESULT); 13 1 : test_table(dnssec_verdict, DNSSEC_VERDICT); 14 : 15 1 : test_table_sparse(dns_rcode, DNS_RCODE); 16 1 : test_table_sparse(dns_type, DNS_TYPE); 17 : 18 1 : log_info("/* DNS_TYPE */"); 19 32771 : for (i = 0; i < _DNS_TYPE_MAX; i++) { 20 : const char *s; 21 : 22 32770 : s = dns_type_to_string(i); 23 32770 : assert_se(s == NULL || strlen(s) < _DNS_TYPE_STRING_MAX); 24 : 25 32770 : if (s) 26 77 : log_info("%-*s %s%s%s%s%s%s%s%s%s", 27 : (int) _DNS_TYPE_STRING_MAX - 1, s, 28 : dns_type_is_pseudo(i) ? "pseudo " : "", 29 : dns_type_is_valid_query(i) ? "valid_query " : "", 30 : dns_type_is_valid_rr(i) ? "is_valid_rr " : "", 31 : dns_type_may_redirect(i) ? "may_redirect " : "", 32 : dns_type_is_dnssec(i) ? "dnssec " : "", 33 : dns_type_is_obsolete(i) ? "obsolete " : "", 34 : dns_type_may_wildcard(i) ? "wildcard " : "", 35 : dns_type_apex_only(i) ? "apex_only " : "", 36 : dns_type_needs_authentication(i) ? "needs_authentication" : ""); 37 : } 38 : 39 1 : log_info("/* DNS_CLASS */"); 40 257 : for (i = 0; i < _DNS_CLASS_MAX; i++) { 41 : const char *s; 42 : 43 256 : s = dns_class_to_string(i); 44 256 : assert_se(s == NULL || strlen(s) < _DNS_CLASS_STRING_MAX); 45 : 46 256 : if (s) 47 2 : log_info("%-*s %s%s", 48 : (int) _DNS_CLASS_STRING_MAX - 1, s, 49 : dns_class_is_pseudo(i) ? "is_pseudo " : "", 50 : dns_class_is_valid_rr(i) ? "is_valid_rr " : ""); 51 : } 52 : 53 1 : return EXIT_SUCCESS; 54 : }