2 * Copyright (C) 2004, 2005, 2007, 2009, 2014, 2015 Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 1998-2002 Internet Software Consortium.
5 * Permission to use, copy, modify, and/or 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.
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.
18 /* $Id: spf_99.c,v 1.6 2009/12/04 22:06:37 tbox Exp $ */
20 /* Reviewed: Thu Mar 16 15:40:00 PST 2000 by bwelling */
22 #ifndef RDATA_GENERIC_SPF_99_C
23 #define RDATA_GENERIC_SPF_99_C
25 #define RRTYPE_SPF_ATTRIBUTES (0)
27 static inline isc_result_t
28 fromtext_spf(ARGS_FROMTEXT) {
30 REQUIRE(type == dns_rdatatype_spf);
38 return (generic_fromtext_txt(rdclass, type, lexer, origin, options,
42 static inline isc_result_t
43 totext_spf(ARGS_TOTEXT) {
47 REQUIRE(rdata->type == dns_rdatatype_spf);
49 return (generic_totext_txt(rdata, tctx, target));
52 static inline isc_result_t
53 fromwire_spf(ARGS_FROMWIRE) {
55 REQUIRE(type == dns_rdatatype_spf);
62 return (generic_fromwire_txt(rdclass, type, source, dctx, options,
66 static inline isc_result_t
67 towire_spf(ARGS_TOWIRE) {
69 REQUIRE(rdata->type == dns_rdatatype_spf);
73 return (mem_tobuffer(target, rdata->data, rdata->length));
77 compare_spf(ARGS_COMPARE) {
81 REQUIRE(rdata1->type == rdata2->type);
82 REQUIRE(rdata1->rdclass == rdata2->rdclass);
83 REQUIRE(rdata1->type == dns_rdatatype_spf);
85 dns_rdata_toregion(rdata1, &r1);
86 dns_rdata_toregion(rdata2, &r2);
87 return (isc_region_compare(&r1, &r2));
90 static inline isc_result_t
91 fromstruct_spf(ARGS_FROMSTRUCT) {
93 REQUIRE(type == dns_rdatatype_spf);
95 return (generic_fromstruct_txt(rdclass, type, source, target));
98 static inline isc_result_t
99 tostruct_spf(ARGS_TOSTRUCT) {
100 dns_rdata_spf_t *spf = target;
102 REQUIRE(rdata->type == dns_rdatatype_spf);
103 REQUIRE(target != NULL);
105 spf->common.rdclass = rdata->rdclass;
106 spf->common.rdtype = rdata->type;
107 ISC_LINK_INIT(&spf->common, link);
109 return (generic_tostruct_txt(rdata, target, mctx));
113 freestruct_spf(ARGS_FREESTRUCT) {
114 dns_rdata_spf_t *txt = source;
116 REQUIRE(source != NULL);
117 REQUIRE(txt->common.rdtype == dns_rdatatype_spf);
119 generic_freestruct_txt(source);
122 static inline isc_result_t
123 additionaldata_spf(ARGS_ADDLDATA) {
124 REQUIRE(rdata->type == dns_rdatatype_spf);
130 return (ISC_R_SUCCESS);
133 static inline isc_result_t
134 digest_spf(ARGS_DIGEST) {
137 REQUIRE(rdata->type == dns_rdatatype_spf);
139 dns_rdata_toregion(rdata, &r);
141 return ((digest)(arg, &r));
144 static inline isc_boolean_t
145 checkowner_spf(ARGS_CHECKOWNER) {
147 REQUIRE(type == dns_rdatatype_spf);
157 static inline isc_boolean_t
158 checknames_spf(ARGS_CHECKNAMES) {
160 REQUIRE(rdata->type == dns_rdatatype_spf);
170 casecompare_spf(ARGS_COMPARE) {
171 return (compare_spf(rdata1, rdata2));
173 #endif /* RDATA_GENERIC_SPF_99_C */