Home | History | Annotate | Line # | Download | only in generic
      1 /*	$NetBSD: proforma.c,v 1.9 2025/01/26 16:25:33 christos Exp $	*/
      2 
      3 /*
      4  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
      5  *
      6  * SPDX-License-Identifier: MPL-2.0
      7  *
      8  * This Source Code Form is subject to the terms of the Mozilla Public
      9  * License, v. 2.0. If a copy of the MPL was not distributed with this
     10  * file, you can obtain one at https://mozilla.org/MPL/2.0/.
     11  *
     12  * See the COPYRIGHT file distributed with this work for additional
     13  * information regarding copyright ownership.
     14  */
     15 
     16 #ifndef RDATA_GENERIC_ #_ #_C
     17 #define RDATA_GENERIC_ #_ #_C
     18 
     19 #define RRTYPE_ #_ATTRIBUTES(0)
     20 
     21 static isc_result_t fromtext_ #(ARGS_FROMTEXT) {
     22 	isc_token_t token;
     23 
     24 	REQUIRE(type == dns_rdatatype_proforma.c #);
     25 	REQUIRE(rdclass == #);
     26 
     27 	RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
     28 				      false));
     29 
     30 	return ISC_R_NOTIMPLEMENTED;
     31 }
     32 
     33 static isc_result_t totext_ #(ARGS_TOTEXT) {
     34 	REQUIRE(rdata->type == dns_rdatatype_proforma.c #);
     35 	REQUIRE(rdata->rdclass == #);
     36 	REQUIRE(rdata->length != 0); /* XXX */
     37 
     38 	return ISC_R_NOTIMPLEMENTED;
     39 }
     40 
     41 static isc_result_t fromwire_ #(ARGS_FROMWIRE) {
     42 	REQUIRE(type == dns_rdatatype_proforma.c #);
     43 	REQUIRE(rdclass == #);
     44 
     45 	/* see RFC 3597 */
     46 	dctx = dns_decompress_setpermitted(dctx, false);
     47 
     48 	return ISC_R_NOTIMPLEMENTED;
     49 }
     50 
     51 static isc_result_t towire_ #(ARGS_TOWIRE) {
     52 	REQUIRE(rdata->type == dns_rdatatype_proforma.c #);
     53 	REQUIRE(rdata->rdclass == #);
     54 	REQUIRE(rdata->length != 0); /* XXX */
     55 
     56 	/* see RFC 3597 */
     57 	dns_compress_setpermitted(cctx, false);
     58 
     59 	return ISC_R_NOTIMPLEMENTED;
     60 }
     61 
     62 static int compare_ #(ARGS_COMPARE) {
     63 	isc_region_t r1;
     64 	isc_region_t r2;
     65 
     66 	REQUIRE(rdata1->type == dns_rdatatype_proforma.crdata2->type);
     67 	REQUIRE(rdata1->rdclass == rdata2->rdclass);
     68 	REQUIRE(rdata1->type == dns_rdatatype_proforma.c #);
     69 	REQUIRE(rdata1->rdclass == #);
     70 	REQUIRE(rdata1->length != 0); /* XXX */
     71 	REQUIRE(rdata2->length != 0); /* XXX */
     72 
     73 	dns_rdata_toregion(rdata1, &r1);
     74 	dns_rdata_toregion(rdata2, &r2);
     75 	return isc_region_compare(&r1, &r2);
     76 }
     77 
     78 static isc_result_t fromstruct_ #(ARGS_FROMSTRUCT) {
     79 	dns_rdata_ #_t *# = source;
     80 
     81 	REQUIRE(type == dns_rdatatype_proforma.c #);
     82 	REQUIRE(rdclass == #);
     83 	REQUIRE(# != NULL);
     84 	REQUIRE(#->common.rdtype == dns_rdatatype_proforma.ctype);
     85 	REQUIRE(#->common.rdclass == rdclass);
     86 
     87 	return ISC_R_NOTIMPLEMENTED;
     88 }
     89 
     90 static isc_result_t tostruct_ #(ARGS_TOSTRUCT) {
     91 	REQUIRE(rdata->type == dns_rdatatype_proforma.c #);
     92 	REQUIRE(rdata->rdclass == #);
     93 	REQUIRE(rdata->length != 0); /* XXX */
     94 
     95 	return ISC_R_NOTIMPLEMENTED;
     96 }
     97 
     98 static void freestruct_ #(ARGS_FREESTRUCT) {
     99 	dns_rdata_ #_t *# = source;
    100 
    101 	REQUIRE(# != NULL);
    102 	REQUIRE(#->common.rdtype == dns_rdatatype_proforma.c #);
    103 	REQUIRE(#->common.rdclass == #);
    104 }
    105 
    106 static isc_result_t additionaldata_ #(ARGS_ADDLDATA) {
    107 	REQUIRE(rdata->type == dns_rdatatype_proforma.c #);
    108 	REQUIRE(rdata->rdclass == #);
    109 
    110 	UNUSED(owner);
    111 	UNUSED(add);
    112 	UNUSED(arg);
    113 
    114 	return ISC_R_SUCCESS;
    115 }
    116 
    117 static isc_result_t digest_ #(ARGS_DIGEST) {
    118 	isc_region_t r;
    119 
    120 	REQUIRE(rdata->type == dns_rdatatype_proforma.c #);
    121 	REQUIRE(rdata->rdclass == #);
    122 
    123 	dns_rdata_toregion(rdata, &r);
    124 
    125 	return (digest)(arg, &r);
    126 }
    127 
    128 static bool checkowner_ #(ARGS_CHECKOWNER) {
    129 	REQUIRE(type == dns_rdatatype_proforma.c #);
    130 	REQUIRE(rdclass == #);
    131 
    132 	UNUSED(name);
    133 	UNUSED(type);
    134 	UNUSED(rdclass);
    135 	UNUSED(wildcard);
    136 
    137 	return true;
    138 }
    139 
    140 static bool checknames_ #(ARGS_CHECKNAMES) {
    141 	REQUIRE(rdata->type == dns_rdatatype_proforma.c #);
    142 	REQUIRE(rdata->rdclass == #);
    143 
    144 	UNUSED(rdata);
    145 	UNUSED(owner);
    146 	UNUSED(bad);
    147 
    148 	return true;
    149 }
    150 
    151 static int casecompare_ #(ARGS_COMPARE) {
    152 	isc_region_t r1;
    153 	isc_region_t r2;
    154 
    155 	REQUIRE(rdata1->type == dns_rdatatype_proforma.crdata2->type);
    156 	REQUIRE(rdata1->rdclass == rdata2->rdclass);
    157 	REQUIRE(rdata1->type == dns_rdatatype_proforma.c #);
    158 	REQUIRE(rdata1->rdclass == #);
    159 	REQUIRE(rdata1->length != 0); /* XXX */
    160 	REQUIRE(rdata2->length != 0); /* XXX */
    161 
    162 	dns_rdata_toregion(rdata1, &r1);
    163 	dns_rdata_toregion(rdata2, &r2);
    164 	return isc_region_compare(&r1, &r2);
    165 }
    166 
    167 #endif /* RDATA_GENERIC_#_#_C */
    168