Coverage Report

Created: 2026-08-13 07:07

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/bind9/lib/dns/rdata/generic/cds_59.c
Line
Count
Source
1
/*
2
 * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
3
 *
4
 * SPDX-License-Identifier: MPL-2.0
5
 *
6
 * This Source Code Form is subject to the terms of the Mozilla Public
7
 * License, v. 2.0. If a copy of the MPL was not distributed with this
8
 * file, you can obtain one at https://mozilla.org/MPL/2.0/.
9
 *
10
 * See the COPYRIGHT file distributed with this work for additional
11
 * information regarding copyright ownership.
12
 */
13
14
/* draft-ietf-dnsop-delegation-trust-maintainance-14 */
15
16
#ifndef RDATA_GENERIC_CDS_59_C
17
#define RDATA_GENERIC_CDS_59_C
18
19
13.1k
#define RRTYPE_CDS_ATTRIBUTES 0
20
21
#include <dns/ds.h>
22
23
static isc_result_t
24
594
fromtext_cds(ARGS_FROMTEXT) {
25
594
  REQUIRE(type == dns_rdatatype_cds);
26
27
594
  return generic_fromtext_ds(CALL_FROMTEXT);
28
594
}
29
30
static isc_result_t
31
1.88k
totext_cds(ARGS_TOTEXT) {
32
1.88k
  REQUIRE(rdata != NULL);
33
1.88k
  REQUIRE(rdata->type == dns_rdatatype_cds);
34
35
1.88k
  return generic_totext_ds(CALL_TOTEXT);
36
1.88k
}
37
38
static isc_result_t
39
2.65k
fromwire_cds(ARGS_FROMWIRE) {
40
2.65k
  REQUIRE(type == dns_rdatatype_cds);
41
42
2.65k
  return generic_fromwire_ds(CALL_FROMWIRE);
43
2.65k
}
44
45
static isc_result_t
46
949
towire_cds(ARGS_TOWIRE) {
47
949
  isc_region_t sr;
48
49
949
  REQUIRE(rdata->type == dns_rdatatype_cds);
50
949
  REQUIRE(rdata->length != 0);
51
52
949
  UNUSED(cctx);
53
54
949
  dns_rdata_toregion(rdata, &sr);
55
949
  return mem_tobuffer(target, sr.base, sr.length);
56
949
}
57
58
static int
59
2.00k
compare_cds(ARGS_COMPARE) {
60
2.00k
  isc_region_t r1;
61
2.00k
  isc_region_t r2;
62
63
2.00k
  REQUIRE(rdata1->type == rdata2->type);
64
2.00k
  REQUIRE(rdata1->rdclass == rdata2->rdclass);
65
2.00k
  REQUIRE(rdata1->type == dns_rdatatype_cds);
66
2.00k
  REQUIRE(rdata1->length != 0);
67
2.00k
  REQUIRE(rdata2->length != 0);
68
69
2.00k
  dns_rdata_toregion(rdata1, &r1);
70
2.00k
  dns_rdata_toregion(rdata2, &r2);
71
2.00k
  return isc_region_compare(&r1, &r2);
72
2.00k
}
73
74
static isc_result_t
75
0
fromstruct_cds(ARGS_FROMSTRUCT) {
76
0
  REQUIRE(type == dns_rdatatype_cds);
77
78
0
  return generic_fromstruct_ds(CALL_FROMSTRUCT);
79
0
}
80
81
static isc_result_t
82
0
tostruct_cds(ARGS_TOSTRUCT) {
83
0
  dns_rdata_cds_t *cds = target;
84
85
0
  REQUIRE(rdata->type == dns_rdatatype_cds);
86
0
  REQUIRE(cds != NULL);
87
0
  REQUIRE(rdata->length != 0);
88
89
  /*
90
   * Checked by generic_tostruct_ds().
91
   */
92
0
  DNS_RDATACOMMON_INIT(cds, rdata->type, rdata->rdclass);
93
94
0
  return generic_tostruct_ds(CALL_TOSTRUCT);
95
0
}
96
97
static void
98
0
freestruct_cds(ARGS_FREESTRUCT) {
99
0
  dns_rdata_cds_t *cds = source;
100
101
0
  REQUIRE(cds != NULL);
102
0
  REQUIRE(cds->common.rdtype == dns_rdatatype_cds);
103
104
0
  if (cds->mctx == NULL) {
105
0
    return;
106
0
  }
107
108
0
  if (cds->digest != NULL) {
109
0
    isc_mem_free(cds->mctx, cds->digest);
110
0
  }
111
0
  cds->mctx = NULL;
112
0
}
113
114
static isc_result_t
115
0
additionaldata_cds(ARGS_ADDLDATA) {
116
0
  REQUIRE(rdata->type == dns_rdatatype_cds);
117
118
0
  UNUSED(rdata);
119
0
  UNUSED(owner);
120
0
  UNUSED(add);
121
0
  UNUSED(arg);
122
123
0
  return ISC_R_SUCCESS;
124
0
}
125
126
static isc_result_t
127
0
digest_cds(ARGS_DIGEST) {
128
0
  isc_region_t r;
129
130
0
  REQUIRE(rdata->type == dns_rdatatype_cds);
131
132
0
  dns_rdata_toregion(rdata, &r);
133
134
0
  return (digest)(arg, &r);
135
0
}
136
137
static bool
138
0
checkowner_cds(ARGS_CHECKOWNER) {
139
0
  REQUIRE(type == dns_rdatatype_cds);
140
141
0
  UNUSED(name);
142
0
  UNUSED(type);
143
0
  UNUSED(rdclass);
144
0
  UNUSED(wildcard);
145
146
0
  return true;
147
0
}
148
149
static bool
150
0
checknames_cds(ARGS_CHECKNAMES) {
151
0
  REQUIRE(rdata->type == dns_rdatatype_cds);
152
153
0
  UNUSED(rdata);
154
0
  UNUSED(owner);
155
0
  UNUSED(bad);
156
157
0
  return true;
158
0
}
159
160
static int
161
0
casecompare_cds(ARGS_COMPARE) {
162
0
  return compare_cds(rdata1, rdata2);
163
0
}
164
165
#endif /* RDATA_GENERIC_CDS_59_C */