File: null_10.c

package info (click to toggle)
bind9 1%3A9.20.4-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 43,596 kB
  • sloc: ansic: 312,979; sh: 56,456; python: 12,893; perl: 4,770; makefile: 2,245
file content (182 lines) | stat: -rw-r--r-- 3,617 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
/*
 * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
 *
 * SPDX-License-Identifier: MPL-2.0
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, you can obtain one at https://mozilla.org/MPL/2.0/.
 *
 * See the COPYRIGHT file distributed with this work for additional
 * information regarding copyright ownership.
 */

#ifndef RDATA_GENERIC_NULL_10_C
#define RDATA_GENERIC_NULL_10_C

#define RRTYPE_NULL_ATTRIBUTES (0)

static isc_result_t
fromtext_null(ARGS_FROMTEXT) {
	REQUIRE(type == dns_rdatatype_null);

	UNUSED(rdclass);
	UNUSED(type);
	UNUSED(lexer);
	UNUSED(origin);
	UNUSED(options);
	UNUSED(target);
	UNUSED(callbacks);

	return DNS_R_SYNTAX;
}

static isc_result_t
totext_null(ARGS_TOTEXT) {
	REQUIRE(rdata->type == dns_rdatatype_null);

	return unknown_totext(rdata, tctx, target);
}

static isc_result_t
fromwire_null(ARGS_FROMWIRE) {
	isc_region_t sr;

	REQUIRE(type == dns_rdatatype_null);

	UNUSED(type);
	UNUSED(rdclass);
	UNUSED(dctx);

	isc_buffer_activeregion(source, &sr);
	isc_buffer_forward(source, sr.length);
	return mem_tobuffer(target, sr.base, sr.length);
}

static isc_result_t
towire_null(ARGS_TOWIRE) {
	REQUIRE(rdata->type == dns_rdatatype_null);

	UNUSED(cctx);

	return mem_tobuffer(target, rdata->data, rdata->length);
}

static int
compare_null(ARGS_COMPARE) {
	isc_region_t r1;
	isc_region_t r2;

	REQUIRE(rdata1->type == rdata2->type);
	REQUIRE(rdata1->rdclass == rdata2->rdclass);
	REQUIRE(rdata1->type == dns_rdatatype_null);

	dns_rdata_toregion(rdata1, &r1);
	dns_rdata_toregion(rdata2, &r2);
	return isc_region_compare(&r1, &r2);
}

static isc_result_t
fromstruct_null(ARGS_FROMSTRUCT) {
	dns_rdata_null_t *null = source;

	REQUIRE(type == dns_rdatatype_null);
	REQUIRE(null != NULL);
	REQUIRE(null->common.rdtype == type);
	REQUIRE(null->common.rdclass == rdclass);
	REQUIRE(null->data != NULL || null->length == 0);

	UNUSED(type);
	UNUSED(rdclass);

	return mem_tobuffer(target, null->data, null->length);
}

static isc_result_t
tostruct_null(ARGS_TOSTRUCT) {
	dns_rdata_null_t *null = target;
	isc_region_t r;

	REQUIRE(rdata->type == dns_rdatatype_null);
	REQUIRE(null != NULL);

	null->common.rdclass = rdata->rdclass;
	null->common.rdtype = rdata->type;
	ISC_LINK_INIT(&null->common, link);

	dns_rdata_toregion(rdata, &r);
	null->length = r.length;
	null->data = mem_maybedup(mctx, r.base, r.length);
	null->mctx = mctx;
	return ISC_R_SUCCESS;
}

static void
freestruct_null(ARGS_FREESTRUCT) {
	dns_rdata_null_t *null = source;

	REQUIRE(null != NULL);
	REQUIRE(null->common.rdtype == dns_rdatatype_null);

	if (null->mctx == NULL) {
		return;
	}

	if (null->data != NULL) {
		isc_mem_free(null->mctx, null->data);
	}
	null->mctx = NULL;
}

static isc_result_t
additionaldata_null(ARGS_ADDLDATA) {
	REQUIRE(rdata->type == dns_rdatatype_null);

	UNUSED(rdata);
	UNUSED(owner);
	UNUSED(add);
	UNUSED(arg);

	return ISC_R_SUCCESS;
}

static isc_result_t
digest_null(ARGS_DIGEST) {
	isc_region_t r;

	REQUIRE(rdata->type == dns_rdatatype_null);

	dns_rdata_toregion(rdata, &r);

	return (digest)(arg, &r);
}

static bool
checkowner_null(ARGS_CHECKOWNER) {
	REQUIRE(type == dns_rdatatype_null);

	UNUSED(name);
	UNUSED(type);
	UNUSED(rdclass);
	UNUSED(wildcard);

	return true;
}

static bool
checknames_null(ARGS_CHECKNAMES) {
	REQUIRE(rdata->type == dns_rdatatype_null);

	UNUSED(rdata);
	UNUSED(owner);
	UNUSED(bad);

	return true;
}

static int
casecompare_null(ARGS_COMPARE) {
	return compare_null(rdata1, rdata2);
}

#endif /* RDATA_GENERIC_NULL_10_C */