Coverage Report

Created: 2025-07-18 07:03

/src/bind9/lib/dns/rdata/generic/null_10.c
Line
Count
Source (jump to first uncovered line)
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_NULL_10_C
15
#define RDATA_GENERIC_NULL_10_C
16
17
23.7k
#define RRTYPE_NULL_ATTRIBUTES (0)
18
19
static isc_result_t
20
6
fromtext_null(ARGS_FROMTEXT) {
21
6
  REQUIRE(type == dns_rdatatype_null);
22
23
6
  UNUSED(rdclass);
24
6
  UNUSED(type);
25
6
  UNUSED(lexer);
26
6
  UNUSED(origin);
27
6
  UNUSED(options);
28
6
  UNUSED(target);
29
6
  UNUSED(callbacks);
30
31
6
  return DNS_R_SYNTAX;
32
6
}
33
34
static isc_result_t
35
7.33k
totext_null(ARGS_TOTEXT) {
36
7.33k
  REQUIRE(rdata->type == dns_rdatatype_null);
37
38
7.33k
  return unknown_totext(rdata, tctx, target);
39
7.33k
}
40
41
static isc_result_t
42
8.73k
fromwire_null(ARGS_FROMWIRE) {
43
8.73k
  isc_region_t sr;
44
45
8.73k
  REQUIRE(type == dns_rdatatype_null);
46
47
8.73k
  UNUSED(type);
48
8.73k
  UNUSED(rdclass);
49
8.73k
  UNUSED(dctx);
50
51
8.73k
  isc_buffer_activeregion(source, &sr);
52
8.73k
  isc_buffer_forward(source, sr.length);
53
8.73k
  return mem_tobuffer(target, sr.base, sr.length);
54
8.73k
}
55
56
static isc_result_t
57
3.78k
towire_null(ARGS_TOWIRE) {
58
3.78k
  REQUIRE(rdata->type == dns_rdatatype_null);
59
60
3.78k
  UNUSED(cctx);
61
62
3.78k
  return mem_tobuffer(target, rdata->data, rdata->length);
63
3.78k
}
64
65
static int
66
643
compare_null(ARGS_COMPARE) {
67
643
  isc_region_t r1;
68
643
  isc_region_t r2;
69
70
643
  REQUIRE(rdata1->type == rdata2->type);
71
643
  REQUIRE(rdata1->rdclass == rdata2->rdclass);
72
643
  REQUIRE(rdata1->type == dns_rdatatype_null);
73
74
643
  dns_rdata_toregion(rdata1, &r1);
75
643
  dns_rdata_toregion(rdata2, &r2);
76
643
  return isc_region_compare(&r1, &r2);
77
643
}
78
79
static isc_result_t
80
0
fromstruct_null(ARGS_FROMSTRUCT) {
81
0
  dns_rdata_null_t *null = source;
82
83
0
  REQUIRE(type == dns_rdatatype_null);
84
0
  REQUIRE(null != NULL);
85
0
  REQUIRE(null->common.rdtype == type);
86
0
  REQUIRE(null->common.rdclass == rdclass);
87
0
  REQUIRE(null->data != NULL || null->length == 0);
88
89
0
  UNUSED(type);
90
0
  UNUSED(rdclass);
91
92
0
  return mem_tobuffer(target, null->data, null->length);
93
0
}
94
95
static isc_result_t
96
0
tostruct_null(ARGS_TOSTRUCT) {
97
0
  dns_rdata_null_t *null = target;
98
0
  isc_region_t r;
99
100
0
  REQUIRE(rdata->type == dns_rdatatype_null);
101
0
  REQUIRE(null != NULL);
102
103
0
  null->common.rdclass = rdata->rdclass;
104
0
  null->common.rdtype = rdata->type;
105
106
0
  dns_rdata_toregion(rdata, &r);
107
0
  null->length = r.length;
108
0
  null->data = mem_maybedup(mctx, r.base, r.length);
109
0
  null->mctx = mctx;
110
0
  return ISC_R_SUCCESS;
111
0
}
112
113
static void
114
0
freestruct_null(ARGS_FREESTRUCT) {
115
0
  dns_rdata_null_t *null = source;
116
117
0
  REQUIRE(null != NULL);
118
0
  REQUIRE(null->common.rdtype == dns_rdatatype_null);
119
120
0
  if (null->mctx == NULL) {
121
0
    return;
122
0
  }
123
124
0
  if (null->data != NULL) {
125
0
    isc_mem_free(null->mctx, null->data);
126
0
  }
127
0
  null->mctx = NULL;
128
0
}
129
130
static isc_result_t
131
0
additionaldata_null(ARGS_ADDLDATA) {
132
0
  REQUIRE(rdata->type == dns_rdatatype_null);
133
134
0
  UNUSED(rdata);
135
0
  UNUSED(owner);
136
0
  UNUSED(add);
137
0
  UNUSED(arg);
138
139
0
  return ISC_R_SUCCESS;
140
0
}
141
142
static isc_result_t
143
0
digest_null(ARGS_DIGEST) {
144
0
  isc_region_t r;
145
146
0
  REQUIRE(rdata->type == dns_rdatatype_null);
147
148
0
  dns_rdata_toregion(rdata, &r);
149
150
0
  return (digest)(arg, &r);
151
0
}
152
153
static bool
154
0
checkowner_null(ARGS_CHECKOWNER) {
155
0
  REQUIRE(type == dns_rdatatype_null);
156
157
0
  UNUSED(name);
158
0
  UNUSED(type);
159
0
  UNUSED(rdclass);
160
0
  UNUSED(wildcard);
161
162
0
  return true;
163
0
}
164
165
static bool
166
0
checknames_null(ARGS_CHECKNAMES) {
167
0
  REQUIRE(rdata->type == dns_rdatatype_null);
168
169
0
  UNUSED(rdata);
170
0
  UNUSED(owner);
171
0
  UNUSED(bad);
172
173
0
  return true;
174
0
}
175
176
static int
177
0
casecompare_null(ARGS_COMPARE) {
178
0
  return compare_null(rdata1, rdata2);
179
0
}
180
181
#endif /* RDATA_GENERIC_NULL_10_C */