Coverage Report

Created: 2023-06-07 06:23

/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
99.5k
#define RRTYPE_NULL_ATTRIBUTES (0)
18
19
static isc_result_t
20
4
fromtext_null(ARGS_FROMTEXT) {
21
4
  REQUIRE(type == dns_rdatatype_null);
22
23
4
  UNUSED(rdclass);
24
4
  UNUSED(type);
25
4
  UNUSED(lexer);
26
4
  UNUSED(origin);
27
4
  UNUSED(options);
28
4
  UNUSED(target);
29
4
  UNUSED(callbacks);
30
31
4
  return (DNS_R_SYNTAX);
32
4
}
33
34
static isc_result_t
35
7.13k
totext_null(ARGS_TOTEXT) {
36
7.13k
  REQUIRE(rdata->type == dns_rdatatype_null);
37
38
7.13k
  return (unknown_totext(rdata, tctx, target));
39
7.13k
}
40
41
static isc_result_t
42
47.2k
fromwire_null(ARGS_FROMWIRE) {
43
47.2k
  isc_region_t sr;
44
45
47.2k
  REQUIRE(type == dns_rdatatype_null);
46
47
47.2k
  UNUSED(type);
48
47.2k
  UNUSED(rdclass);
49
47.2k
  UNUSED(dctx);
50
51
47.2k
  isc_buffer_activeregion(source, &sr);
52
47.2k
  isc_buffer_forward(source, sr.length);
53
47.2k
  return (mem_tobuffer(target, sr.base, sr.length));
54
47.2k
}
55
56
static isc_result_t
57
3.82k
towire_null(ARGS_TOWIRE) {
58
3.82k
  REQUIRE(rdata->type == dns_rdatatype_null);
59
60
3.82k
  UNUSED(cctx);
61
62
3.82k
  return (mem_tobuffer(target, rdata->data, rdata->length));
63
3.82k
}
64
65
static int
66
39.5k
compare_null(ARGS_COMPARE) {
67
39.5k
  isc_region_t r1;
68
39.5k
  isc_region_t r2;
69
70
39.5k
  REQUIRE(rdata1->type == rdata2->type);
71
39.5k
  REQUIRE(rdata1->rdclass == rdata2->rdclass);
72
39.5k
  REQUIRE(rdata1->type == dns_rdatatype_null);
73
74
39.5k
  dns_rdata_toregion(rdata1, &r1);
75
39.5k
  dns_rdata_toregion(rdata2, &r2);
76
39.5k
  return (isc_region_compare(&r1, &r2));
77
39.5k
}
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
0
  ISC_LINK_INIT(&null->common, link);
106
107
0
  dns_rdata_toregion(rdata, &r);
108
0
  null->length = r.length;
109
0
  null->data = mem_maybedup(mctx, r.base, r.length);
110
0
  null->mctx = mctx;
111
0
  return (ISC_R_SUCCESS);
112
0
}
113
114
static void
115
0
freestruct_null(ARGS_FREESTRUCT) {
116
0
  dns_rdata_null_t *null = source;
117
118
0
  REQUIRE(null != NULL);
119
0
  REQUIRE(null->common.rdtype == dns_rdatatype_null);
120
121
0
  if (null->mctx == NULL) {
122
0
    return;
123
0
  }
124
125
0
  if (null->data != NULL) {
126
0
    isc_mem_free(null->mctx, null->data);
127
0
  }
128
0
  null->mctx = NULL;
129
0
}
130
131
static isc_result_t
132
0
additionaldata_null(ARGS_ADDLDATA) {
133
0
  REQUIRE(rdata->type == dns_rdatatype_null);
134
135
0
  UNUSED(rdata);
136
0
  UNUSED(owner);
137
0
  UNUSED(add);
138
0
  UNUSED(arg);
139
140
0
  return (ISC_R_SUCCESS);
141
0
}
142
143
static isc_result_t
144
0
digest_null(ARGS_DIGEST) {
145
0
  isc_region_t r;
146
147
0
  REQUIRE(rdata->type == dns_rdatatype_null);
148
149
0
  dns_rdata_toregion(rdata, &r);
150
151
0
  return ((digest)(arg, &r));
152
0
}
153
154
static bool
155
0
checkowner_null(ARGS_CHECKOWNER) {
156
0
  REQUIRE(type == dns_rdatatype_null);
157
158
0
  UNUSED(name);
159
0
  UNUSED(type);
160
0
  UNUSED(rdclass);
161
0
  UNUSED(wildcard);
162
163
0
  return (true);
164
0
}
165
166
static bool
167
0
checknames_null(ARGS_CHECKNAMES) {
168
0
  REQUIRE(rdata->type == dns_rdatatype_null);
169
170
0
  UNUSED(rdata);
171
0
  UNUSED(owner);
172
0
  UNUSED(bad);
173
174
0
  return (true);
175
0
}
176
177
static int
178
0
casecompare_null(ARGS_COMPARE) {
179
0
  return (compare_null(rdata1, rdata2));
180
0
}
181
182
#endif /* RDATA_GENERIC_NULL_10_C */