Coverage Report

Created: 2026-01-09 06:42

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/bind9/lib/dns/rdata/generic/hhit_67.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_HHIT_67_C
15
#define RDATA_GENERIC_HHIT_67_C
16
17
#include <dst/dst.h>
18
19
12.8k
#define RRTYPE_HHIT_ATTRIBUTES (0)
20
21
static isc_result_t
22
1.65k
fromtext_hhit(ARGS_FROMTEXT) {
23
1.65k
  REQUIRE(type == dns_rdatatype_hhit);
24
25
1.65k
  UNUSED(type);
26
1.65k
  UNUSED(rdclass);
27
1.65k
  UNUSED(origin);
28
1.65k
  UNUSED(options);
29
1.65k
  UNUSED(callbacks);
30
31
1.65k
  return isc_base64_tobuffer(lexer, target, -1);
32
1.65k
}
33
34
static isc_result_t
35
424
totext_hhit(ARGS_TOTEXT) {
36
424
  isc_region_t sr;
37
38
424
  REQUIRE(rdata->type == dns_rdatatype_hhit);
39
424
  REQUIRE(rdata->length > 0);
40
41
424
  dns_rdata_toregion(rdata, &sr);
42
43
  /* data */
44
424
  if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0) {
45
26
    RETERR(str_totext(" (", target));
46
26
  }
47
48
424
  RETERR(str_totext(tctx->linebreak, target));
49
50
424
  if (tctx->width == 0) { /* No splitting */
51
0
    RETERR(isc_base64_totext(&sr, 60, "", target));
52
424
  } else {
53
424
    RETERR(isc_base64_totext(&sr, tctx->width - 2, tctx->linebreak,
54
424
           target));
55
424
  }
56
57
424
  if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0) {
58
26
    RETERR(str_totext(" )", target));
59
26
  }
60
61
424
  return ISC_R_SUCCESS;
62
424
}
63
64
static isc_result_t
65
2.86k
fromwire_hhit(ARGS_FROMWIRE) {
66
2.86k
  isc_region_t sr;
67
68
2.86k
  REQUIRE(type == dns_rdatatype_hhit);
69
70
2.86k
  UNUSED(type);
71
2.86k
  UNUSED(rdclass);
72
2.86k
  UNUSED(dctx);
73
74
2.86k
  isc_buffer_activeregion(source, &sr);
75
2.86k
  if (sr.length == 0) {
76
6
    return ISC_R_UNEXPECTEDEND;
77
6
  }
78
79
2.85k
  RETERR(mem_tobuffer(target, sr.base, sr.length));
80
2.67k
  isc_buffer_forward(source, sr.length);
81
2.67k
  return ISC_R_SUCCESS;
82
2.85k
}
83
84
static isc_result_t
85
218
towire_hhit(ARGS_TOWIRE) {
86
218
  REQUIRE(rdata->type == dns_rdatatype_hhit);
87
218
  REQUIRE(rdata->length >= 3);
88
89
218
  UNUSED(cctx);
90
91
218
  return mem_tobuffer(target, rdata->data, rdata->length);
92
218
}
93
94
static int
95
196k
compare_hhit(ARGS_COMPARE) {
96
196k
  isc_region_t r1;
97
196k
  isc_region_t r2;
98
99
196k
  REQUIRE(rdata1->type == rdata2->type);
100
196k
  REQUIRE(rdata1->rdclass == rdata2->rdclass);
101
196k
  REQUIRE(rdata1->type == dns_rdatatype_hhit);
102
196k
  REQUIRE(rdata1->length > 0);
103
196k
  REQUIRE(rdata2->length > 0);
104
105
196k
  dns_rdata_toregion(rdata1, &r1);
106
196k
  dns_rdata_toregion(rdata2, &r2);
107
196k
  return isc_region_compare(&r1, &r2);
108
196k
}
109
110
static isc_result_t
111
0
fromstruct_hhit(ARGS_FROMSTRUCT) {
112
0
  dns_rdata_hhit_t *hhit = source;
113
114
0
  REQUIRE(type == dns_rdatatype_hhit);
115
0
  REQUIRE(hhit != NULL);
116
0
  REQUIRE(hhit->common.rdtype == type);
117
0
  REQUIRE(hhit->common.rdclass == rdclass);
118
119
0
  UNUSED(type);
120
0
  UNUSED(rdclass);
121
122
  /* Data */
123
0
  return mem_tobuffer(target, hhit->data, hhit->datalen);
124
0
}
125
126
static isc_result_t
127
0
tostruct_hhit(ARGS_TOSTRUCT) {
128
0
  dns_rdata_hhit_t *hhit = target;
129
0
  isc_region_t sr;
130
131
0
  REQUIRE(rdata->type == dns_rdatatype_hhit);
132
0
  REQUIRE(hhit != NULL);
133
0
  REQUIRE(rdata->length > 0);
134
135
0
  DNS_RDATACOMMON_INIT(hhit, rdata->type, rdata->rdclass);
136
137
0
  dns_rdata_toregion(rdata, &sr);
138
139
  /* Data */
140
0
  hhit->datalen = sr.length;
141
0
  hhit->data = mem_maybedup(mctx, sr.base, hhit->datalen);
142
0
  hhit->mctx = mctx;
143
0
  return ISC_R_SUCCESS;
144
0
}
145
146
static void
147
0
freestruct_hhit(ARGS_FREESTRUCT) {
148
0
  dns_rdata_hhit_t *hhit = (dns_rdata_hhit_t *)source;
149
150
0
  REQUIRE(hhit != NULL);
151
0
  REQUIRE(hhit->common.rdtype == dns_rdatatype_hhit);
152
153
0
  if (hhit->mctx == NULL) {
154
0
    return;
155
0
  }
156
157
0
  if (hhit->data != NULL) {
158
0
    isc_mem_free(hhit->mctx, hhit->data);
159
0
  }
160
0
  hhit->mctx = NULL;
161
0
}
162
163
static isc_result_t
164
0
additionaldata_hhit(ARGS_ADDLDATA) {
165
0
  REQUIRE(rdata->type == dns_rdatatype_hhit);
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_hhit(ARGS_DIGEST) {
177
0
  isc_region_t r;
178
179
0
  REQUIRE(rdata->type == dns_rdatatype_hhit);
180
181
0
  dns_rdata_toregion(rdata, &r);
182
183
0
  return (digest)(arg, &r);
184
0
}
185
186
static bool
187
0
checkowner_hhit(ARGS_CHECKOWNER) {
188
0
  REQUIRE(type == dns_rdatatype_hhit);
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_hhit(ARGS_CHECKNAMES) {
200
0
  REQUIRE(rdata->type == dns_rdatatype_hhit);
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_hhit(ARGS_COMPARE) {
211
0
  return compare_hhit(rdata1, rdata2);
212
0
}
213
#endif /* RDATA_GENERIC_HHIT_67_C */