null_10.c 3.4 KB
Newer Older
1
/*
Bob Halley's avatar
Bob Halley committed
2
 * Copyright (C) 1998, 1999, 2000  Internet Software Consortium.
Michael Graff's avatar
Michael Graff committed
3
 * 
4
5
6
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
Michael Graff's avatar
Michael Graff committed
7
 * 
8
9
10
11
12
13
14
15
16
17
 * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
 * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
 * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
 * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
 * SOFTWARE.
 */

18
 /* $Id: null_10.c,v 1.17 2000/03/16 21:49:41 bwelling Exp $ */
Mark Andrews's avatar
Mark Andrews committed
19

20
21
#ifndef RDATA_GENERIC_NULL_10_C
#define RDATA_GENERIC_NULL_10_C
Mark Andrews's avatar
Mark Andrews committed
22

23
static inline isc_result_t
24
fromtext_null(dns_rdataclass_t rdclass, dns_rdatatype_t type,
25
	      isc_lex_t *lexer, dns_name_t *origin,
Mark Andrews's avatar
Mark Andrews committed
26
27
	      isc_boolean_t downcase, isc_buffer_t *target)
{
Mark Andrews's avatar
Mark Andrews committed
28
	REQUIRE(type == 10);
Mark Andrews's avatar
Mark Andrews committed
29

30
31
32
33
34
35
	UNUSED(rdclass);
	UNUSED(type);
	UNUSED(lexer);
	UNUSED(origin);
	UNUSED(downcase);
	UNUSED(target);
36

37
	return (DNS_R_SYNTAX);
38
39
}

40
static inline isc_result_t
41
42
43
totext_null(dns_rdata_t *rdata, dns_rdata_textctx_t *tctx, 
	    isc_buffer_t *target) 
{
Mark Andrews's avatar
Mark Andrews committed
44
	REQUIRE(rdata->type == 10);
Mark Andrews's avatar
Mark Andrews committed
45

46
47
	UNUSED(tctx);
	UNUSED(target);
48

49
	return (DNS_R_SYNTAX);
50
51
}

52
static inline isc_result_t
53
fromwire_null(dns_rdataclass_t rdclass, dns_rdatatype_t type,
54
	      isc_buffer_t *source, dns_decompress_t *dctx,
Mark Andrews's avatar
Mark Andrews committed
55
56
	      isc_boolean_t downcase, isc_buffer_t *target)
{
57
	isc_region_t sr;
58

Mark Andrews's avatar
Mark Andrews committed
59
	REQUIRE(type == 10);
Mark Andrews's avatar
Mark Andrews committed
60

61
62
63
	UNUSED(rdclass);
	UNUSED(dctx);
	UNUSED(downcase);
64

65
66
67
	isc_buffer_active(source, &sr);
	isc_buffer_forward(source, sr.length);
	return (mem_tobuffer(target, sr.base, sr.length));
68
69
}

70
static inline isc_result_t
71
towire_null(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) {
Mark Andrews's avatar
Mark Andrews committed
72
	REQUIRE(rdata->type == 10);
Mark Andrews's avatar
Mark Andrews committed
73

74
	UNUSED(cctx);
75

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

79
static inline int
80
compare_null(dns_rdata_t *rdata1, dns_rdata_t *rdata2) {
81
82
	isc_region_t r1;
	isc_region_t r2;
83

Mark Andrews's avatar
Mark Andrews committed
84
	REQUIRE(rdata1->type == rdata1->type);
85
	REQUIRE(rdata1->rdclass == rdata2->rdclass);
Mark Andrews's avatar
Mark Andrews committed
86
	REQUIRE(rdata1->type == 10);
87

88
89
90
	dns_rdata_toregion(rdata1, &r1);
	dns_rdata_toregion(rdata2, &r2);
	return (compare_region(&r1, &r2));
91
92
}

93
static inline isc_result_t
94
fromstruct_null(dns_rdataclass_t rdclass, dns_rdatatype_t type, void *source,
Mark Andrews's avatar
Mark Andrews committed
95
96
	        isc_buffer_t *target)
{
Mark Andrews's avatar
Mark Andrews committed
97

Mark Andrews's avatar
Mark Andrews committed
98
	REQUIRE(type == 10);
Mark Andrews's avatar
Mark Andrews committed
99

100
101
102
	UNUSED(rdclass);
	UNUSED(source);
	UNUSED(target);
103
104
105
106

	return (DNS_R_NOTIMPLEMENTED);
}

107
static inline isc_result_t
108
tostruct_null(dns_rdata_t *rdata, void *target, isc_mem_t *mctx) {
Mark Andrews's avatar
Mark Andrews committed
109
	REQUIRE(rdata->type == 10);
110

111
112
	UNUSED(target);
	UNUSED(mctx);
113

114
	return (DNS_R_NOTIMPLEMENTED);
115
116
}

117
static inline void
118
119
freestruct_null(void *source) {
	REQUIRE(source != NULL);
120
	REQUIRE(ISC_FALSE);
121
}
122

123
static inline isc_result_t
124
125
126
127
128
additionaldata_null(dns_rdata_t *rdata, dns_additionaldatafunc_t add,
		    void *arg)
{
	REQUIRE(rdata->type == 10);

129
130
	UNUSED(add);
	UNUSED(arg);
131
132
133
134

	return (DNS_R_SUCCESS);
}

135
static inline isc_result_t
Bob Halley's avatar
Bob Halley committed
136
digest_null(dns_rdata_t *rdata, dns_digestfunc_t digest, void *arg) {
137
	isc_region_t r;
Bob Halley's avatar
Bob Halley committed
138
139
140

	REQUIRE(rdata->type == 10);

141
	dns_rdata_toregion(rdata, &r);
Bob Halley's avatar
Bob Halley committed
142

143
	return ((digest)(arg, &r));
Bob Halley's avatar
Bob Halley committed
144
145
}

146
#endif	/* RDATA_GENERIC_NULL_10_C */