Merge from vendor branch GDB:
[dragonfly.git] / contrib / bind-9.3 / lib / dns / rdata / generic / proforma.c
1 /*
2  * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
3  * Copyright (C) 1998-2002  Internet Software Consortium.
4  *
5  * Permission to use, copy, modify, and distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15  * PERFORMANCE OF THIS SOFTWARE.
16  */
17
18 /* $Id: proforma.c,v 1.30.12.4 2004/03/08 09:04:41 marka Exp $ */
19
20 #ifndef RDATA_GENERIC_#_#_C
21 #define RDATA_GENERIC_#_#_C
22
23 #define RRTYPE_#_ATTRIBUTES (0)
24
25 static inline isc_result_t
26 fromtext_#(ARGS_FROMTEXT) {
27         isc_token_t token;
28
29         REQUIRE(type == #);
30         REQUIRE(rdclass == #);
31
32         RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
33                                       ISC_FALSE));
34
35         return (ISC_R_NOTIMPLEMENTED);
36 }
37
38 static inline isc_result_t
39 totext_#(ARGS_TOTEXT) {
40
41         REQUIRE(rdata->type == #);
42         REQUIRE(rdata->rdclass == #);
43         REQUIRE(rdata->length != 0);    /* XXX */
44
45         return (ISC_R_NOTIMPLEMENTED);
46 }
47
48 static inline isc_result_t
49 fromwire_#(ARGS_FROMWIRE) {
50
51         REQUIRE(type == #);
52         REQUIRE(rdclass == #);
53
54         /* NONE or GLOBAL14 */
55         dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE);
56
57         return (ISC_R_NOTIMPLEMENTED);
58 }
59
60 static inline isc_result_t
61 towire_#(ARGS_TOWIRE) {
62
63         REQUIRE(rdata->type == #);
64         REQUIRE(rdata->rdclass == #);
65         REQUIRE(rdata->length != 0);    /* XXX */
66
67         /* NONE or GLOBAL14 */
68         dns_compress_setmethods(cctx, DNS_COMPRESS_NONE);
69
70         return (ISC_R_NOTIMPLEMENTED);
71 }
72
73 static inline int
74 compare_#(ARGS_COMPARE) {
75         isc_region_t r1;
76         isc_region_t r2;
77
78         REQUIRE(rdata1->type == rdata2->type);
79         REQUIRE(rdata1->rdclass == rdata2->rdclass);
80         REQUIRE(rdata1->type == #);
81         REQUIRE(rdata1->rdclass == #);
82         REQUIRE(rdata1->length != 0);   /* XXX */
83         REQUIRE(rdata2->length != 0);   /* XXX */
84
85         dns_rdata_toregion(rdata1, &r1);
86         dns_rdata_toregion(rdata2, &r2);
87         return (isc_region_compare(&r1, &r2));
88 }
89
90 static inline isc_result_t
91 fromstruct_#(ARGS_FROMSTRUCT) {
92         dns_rdata_#_t *# = source;
93
94         REQUIRE(type == #);
95         REQUIRE(rdclass == #);
96         REQUIRE(source != NULL);
97         REQUIRE(#->common.rdtype == type);
98         REQUIRE(#->common.rdclass == rdclass);
99
100         return (ISC_R_NOTIMPLEMENTED);
101 }
102
103 static inline isc_result_t
104 tostruct_#(ARGS_TOSTRUCT) {
105
106         REQUIRE(rdata->type == #);
107         REQUIRE(rdata->rdclass == #);
108         REQUIRE(rdata->length != 0);    /* XXX */
109
110         return (ISC_R_NOTIMPLEMENTED);
111 }
112
113 static inline void
114 freestruct_#(ARGS_FREESTRUCT) {
115         dns_rdata_#_t *# = source;
116
117         REQUIRE(source != NULL);
118         REQUIRE(#->common.rdtype == #);
119         REQUIRE(#->common.rdclass == #);
120
121 }
122
123 static inline isc_result_t
124 additionaldata_#(ARGS_ADDLDATA) {
125         REQUIRE(rdata->type == #);
126         REQUIRE(rdata->rdclass == #);
127
128         (void)add;
129         (void)arg;
130
131         return (ISC_R_SUCCESS);
132 }
133
134 static inline isc_result_t
135 digest_#(ARGS_DIGEST) {
136         isc_region_t r;
137
138         REQUIRE(rdata->type == #);
139         REQUIRE(rdata->rdclass == #);
140
141         dns_rdata_toregion(rdata, &r);
142
143         return ((digest)(arg, &r));
144 }
145
146 static inline isc_boolean_t
147 checkowner_#(ARGS_CHECKOWNER) {
148
149         REQUIRE(type == #);
150         REQUIRE(rdclass == #);
151
152         UNUSED(name);
153         UNUSED(type);
154         UNUSED(rdclass);
155         UNUSED(wildcard);
156
157         return (ISC_TRUE);
158 }
159
160 static inline isc_boolean_t
161 checknames_#(ARGS_CHECKNAMES) {
162
163         REQUIRE(rdata->type == #);
164         REQUIRE(rdata->rdclass == #);
165
166         UNUSED(rdata);
167         UNUSED(owner);
168         UNUSED(bad);
169
170         return (ISC_TRUE);
171 }
172
173 #endif  /* RDATA_GENERIC_#_#_C */