Coverage Report

Created: 2025-12-12 06:31

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/bind9/lib/dns/rdata/generic/brid_68.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
#ifndef RDATA_GENERIC_BRID_68_C
15
#define RDATA_GENERIC_BRID_68_C
16
17
#include <dst/dst.h>
18
19
11.2k
#define RRTYPE_BRID_ATTRIBUTES (0)
20
21
static isc_result_t
22
1.17k
fromtext_brid(ARGS_FROMTEXT) {
23
1.17k
  REQUIRE(type == dns_rdatatype_brid);
24
25
1.17k
  UNUSED(type);
26
1.17k
  UNUSED(rdclass);
27
1.17k
  UNUSED(origin);
28
1.17k
  UNUSED(options);
29
1.17k
  UNUSED(callbacks);
30
31
1.17k
  return isc_base64_tobuffer(lexer, target, -1);
32
1.17k
}
33
34
static isc_result_t
35
266
totext_brid(ARGS_TOTEXT) {
36
266
  isc_region_t sr;
37
38
266
  REQUIRE(rdata->type == dns_rdatatype_brid);
39
266
  REQUIRE(rdata->length > 0);
40
41
266
  dns_rdata_toregion(rdata, &sr);
42
43
  /* data */
44
266
  if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0) {
45
20
    RETERR(str_totext(" (", target));
46
20
  }
47
48
266
  RETERR(str_totext(tctx->linebreak, target));
49
50
266
  if (tctx->width == 0) { /* No splitting */
51
0
    RETERR(isc_base64_totext(&sr, 60, "", target));
52
266
  } else {
53
266
    RETERR(isc_base64_totext(&sr, tctx->width - 2, tctx->linebreak,
54
266
           target));
55
266
  }
56
57
266
  if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0) {
58
20
    RETERR(str_totext(" )", target));
59
20
  }
60
61
266
  return ISC_R_SUCCESS;
62
266
}
63
64
static isc_result_t
65
2.35k
fromwire_brid(ARGS_FROMWIRE) {
66
2.35k
  isc_region_t sr;
67
68
2.35k
  REQUIRE(type == dns_rdatatype_brid);
69
70
2.35k
  UNUSED(type);
71
2.35k
  UNUSED(rdclass);
72
2.35k
  UNUSED(dctx);
73
74
2.35k
  isc_buffer_activeregion(source, &sr);
75
2.35k
  if (sr.length == 0) {
76
7
    return ISC_R_UNEXPECTEDEND;
77
7
  }
78
79
2.35k
  RETERR(mem_tobuffer(target, sr.base, sr.length));
80
1.91k
  isc_buffer_forward(source, sr.length);
81
1.91k
  return ISC_R_SUCCESS;
82
2.35k
}
83
84
static isc_result_t
85
135
towire_brid(ARGS_TOWIRE) {
86
135
  REQUIRE(rdata->type == dns_rdatatype_brid);
87
135
  REQUIRE(rdata->length >= 3);
88
89
135
  UNUSED(cctx);
90
91
135
  return mem_tobuffer(target, rdata->data, rdata->length);
92
135
}
93
94
static int
95
25.6k
compare_brid(ARGS_COMPARE) {
96
25.6k
  isc_region_t r1;
97
25.6k
  isc_region_t r2;
98
99
25.6k
  REQUIRE(rdata1->type == rdata2->type);
100
25.6k
  REQUIRE(rdata1->rdclass == rdata2->rdclass);
101
25.6k
  REQUIRE(rdata1->type == dns_rdatatype_brid);
102
25.6k
  REQUIRE(rdata1->length > 0);
103
25.6k
  REQUIRE(rdata2->length > 0);
104
105
25.6k
  dns_rdata_toregion(rdata1, &r1);
106
25.6k
  dns_rdata_toregion(rdata2, &r2);
107
25.6k
  return isc_region_compare(&r1, &r2);
108
25.6k
}
109
110
static isc_result_t
111
0
fromstruct_brid(ARGS_FROMSTRUCT) {
112
0
  dns_rdata_brid_t *brid = source;
113
114
0
  REQUIRE(type == dns_rdatatype_brid);
115
0
  REQUIRE(brid != NULL);
116
0
  REQUIRE(brid->common.rdtype == type);
117
0
  REQUIRE(brid->common.rdclass == rdclass);
118
119
0
  UNUSED(type);
120
0
  UNUSED(rdclass);
121
122
  /* Data */
123
0
  return mem_tobuffer(target, brid->data, brid->datalen);
124
0
}
125
126
static isc_result_t
127
0
tostruct_brid(ARGS_TOSTRUCT) {
128
0
  dns_rdata_brid_t *brid = target;
129
0
  isc_region_t sr;
130
131
0
  REQUIRE(rdata->type == dns_rdatatype_brid);
132
0
  REQUIRE(brid != NULL);
133
0
  REQUIRE(rdata->length > 0);
134
135
0
  DNS_RDATACOMMON_INIT(brid, rdata->type, rdata->rdclass);
136
137
0
  dns_rdata_toregion(rdata, &sr);
138
139
  /* Data */
140
0
  brid->datalen = sr.length;
141
0
  brid->data = mem_maybedup(mctx, sr.base, brid->datalen);
142
0
  brid->mctx = mctx;
143
0
  return ISC_R_SUCCESS;
144
0
}
145
146
static void
147
0
freestruct_brid(ARGS_FREESTRUCT) {
148
0
  dns_rdata_brid_t *brid = (dns_rdata_brid_t *)source;
149
150
0
  REQUIRE(brid != NULL);
151
0
  REQUIRE(brid->common.rdtype == dns_rdatatype_brid);
152
153
0
  if (brid->mctx == NULL) {
154
0
    return;
155
0
  }
156
157
0
  if (brid->data != NULL) {
158
0
    isc_mem_free(brid->mctx, brid->data);
159
0
  }
160
0
  brid->mctx = NULL;
161
0
}
162
163
static isc_result_t
164
0
additionaldata_brid(ARGS_ADDLDATA) {
165
0
  REQUIRE(rdata->type == dns_rdatatype_brid);
166
167
0
  UNUSED(rdata);
168
0
  UNUSED(owner);
169
0
  UNUSED(add);
170
0
  UNUSED(arg);
171
172
0
  return ISC_R_SUCCESS;
173
0
}
174
175
static isc_result_t
176
0
digest_brid(ARGS_DIGEST) {
177
0
  isc_region_t r;
178
179
0
  REQUIRE(rdata->type == dns_rdatatype_brid);
180
181
0
  dns_rdata_toregion(rdata, &r);
182
183
0
  return (digest)(arg, &r);
184
0
}
185
186
static bool
187
0
checkowner_brid(ARGS_CHECKOWNER) {
188
0
  REQUIRE(type == dns_rdatatype_brid);
189
190
0
  UNUSED(name);
191
0
  UNUSED(type);
192
0
  UNUSED(rdclass);
193
0
  UNUSED(wildcard);
194
195
0
  return true;
196
0
}
197
198
static bool
199
0
checknames_brid(ARGS_CHECKNAMES) {
200
0
  REQUIRE(rdata->type == dns_rdatatype_brid);
201
202
0
  UNUSED(rdata);
203
0
  UNUSED(owner);
204
0
  UNUSED(bad);
205
206
0
  return true;
207
0
}
208
209
static int
210
0
casecompare_brid(ARGS_COMPARE) {
211
0
  return compare_brid(rdata1, rdata2);
212
0
}
213
#endif /* RDATA_GENERIC_BRID_68_C */