null_10.c 3.5 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.21 2000/04/27 00:02:33 tale Exp $ */
19
20

/* Reviewed: Thu Mar 16 13:57:50 PST 2000 by explorer */
Mark Andrews's avatar
Mark Andrews committed
21

22
23
#ifndef RDATA_GENERIC_NULL_10_C
#define RDATA_GENERIC_NULL_10_C
Mark Andrews's avatar
Mark Andrews committed
24

25
26
#define RRTYPE_NULL_ATTRIBUTES (0)

27
static inline isc_result_t
28
fromtext_null(dns_rdataclass_t rdclass, dns_rdatatype_t type,
29
	      isc_lex_t *lexer, dns_name_t *origin,
Mark Andrews's avatar
Mark Andrews committed
30
31
	      isc_boolean_t downcase, isc_buffer_t *target)
{
32
33
34
35
36
37
	UNUSED(rdclass);
	UNUSED(type);
	UNUSED(lexer);
	UNUSED(origin);
	UNUSED(downcase);
	UNUSED(target);
38

39
40
	REQUIRE(type == 10);

41
	return (DNS_R_SYNTAX);
42
43
}

44
static inline isc_result_t
45
46
47
totext_null(dns_rdata_t *rdata, dns_rdata_textctx_t *tctx, 
	    isc_buffer_t *target) 
{
48
49
	UNUSED(tctx);
	UNUSED(target);
50

51
52
	REQUIRE(rdata->type == 10);

53
	return (DNS_R_SYNTAX);
54
55
}

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

63
64
65
	UNUSED(rdclass);
	UNUSED(dctx);
	UNUSED(downcase);
66

67
68
	REQUIRE(type == 10);

69
	isc_buffer_activeregion(source, &sr);
70
71
	isc_buffer_forward(source, sr.length);
	return (mem_tobuffer(target, sr.base, sr.length));
72
73
}

74
static inline isc_result_t
75
76
towire_null(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target)
{
77
	UNUSED(cctx);
78

79
80
	REQUIRE(rdata->type == 10);

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

84
static inline int
85
86
compare_null(dns_rdata_t *rdata1, dns_rdata_t *rdata2)
{
87
88
	isc_region_t r1;
	isc_region_t r2;
89

Mark Andrews's avatar
Mark Andrews committed
90
	REQUIRE(rdata1->type == rdata1->type);
91
	REQUIRE(rdata1->rdclass == rdata2->rdclass);
Mark Andrews's avatar
Mark Andrews committed
92
	REQUIRE(rdata1->type == 10);
93

94
95
96
	dns_rdata_toregion(rdata1, &r1);
	dns_rdata_toregion(rdata2, &r2);
	return (compare_region(&r1, &r2));
97
98
}

99
static inline isc_result_t
100
fromstruct_null(dns_rdataclass_t rdclass, dns_rdatatype_t type, void *source,
Mark Andrews's avatar
Mark Andrews committed
101
102
	        isc_buffer_t *target)
{
103
104
105
	UNUSED(rdclass);
	UNUSED(source);
	UNUSED(target);
106

107
108
	REQUIRE(type == 10);

109
	return (ISC_R_NOTIMPLEMENTED);
110
111
}

112
static inline isc_result_t
113
114
tostruct_null(dns_rdata_t *rdata, void *target, isc_mem_t *mctx)
{
115
116
	UNUSED(target);
	UNUSED(mctx);
117

118
119
	REQUIRE(rdata->type == 10);

120
	return (ISC_R_NOTIMPLEMENTED);
121
122
}

123
static inline void
124
125
freestruct_null(void *source)
{
126
	REQUIRE(source != NULL);
127
	REQUIRE(ISC_FALSE);
128
}
129

130
static inline isc_result_t
131
132
133
additionaldata_null(dns_rdata_t *rdata, dns_additionaldatafunc_t add,
		    void *arg)
{
134
135
	UNUSED(add);
	UNUSED(arg);
136

137
138
	REQUIRE(rdata->type == 10);

139
	return (ISC_R_SUCCESS);
140
141
}

142
static inline isc_result_t
143
144
digest_null(dns_rdata_t *rdata, dns_digestfunc_t digest, void *arg)
{
145
	isc_region_t r;
Bob Halley's avatar
Bob Halley committed
146
147
148

	REQUIRE(rdata->type == 10);

149
	dns_rdata_toregion(rdata, &r);
Bob Halley's avatar
Bob Halley committed
150

151
	return ((digest)(arg, &r));
Bob Halley's avatar
Bob Halley committed
152
153
}

154
#endif	/* RDATA_GENERIC_NULL_10_C */