~andreserl/ubuntu/lucid/bind9/bind9-apport-533601

« back to all changes in this revision

Viewing changes to lib/dns/rdata/in_1/dhcid_49.c

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones, LaMont Jones, Internet Software Consortium, Inc, localization folks
  • Date: 2008-08-02 14:20:20 UTC
  • mfrom: (1.2.1 upstream) (6.1.24 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080802142020-l1hon9jy8lbbjxmg
[LaMont Jones]

* default to using resolvconf if it is installed
* fix sonames and dependencies.  Closes: #149259, #492418
* Do not build-depend libcap2-dev on non-linux.  Closes: #493392
* drop unused query-loc manpage.  Closes: #492564
* lwresd: Deliver /etc/bind directory.  Closes: #490027
* fix query-source comment in default install

[Internet Software Consortium, Inc]

* 9.5.0-P2.  Closes: #492949

[localization folks]

* l10n: Spanish debconf translation.  Closes: #492425 (Ignacio Mondino)
* l10n: Swedish debconf templates.  Closes: #491369 (Martin Ågren)
* l10n: Japanese debconf translations.  Closes: #492048 (Hideki Yamane
  (Debian-JP))
* l10n: Finnish translation.  Closes: #490630 (Esko Arajärvi)
* l10n: Italian debconf translations.  Closes: #492587 (Alessandro Vietta)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2006, 2007  Internet Systems Consortium, Inc. ("ISC")
 
3
 *
 
4
 * Permission to use, copy, modify, and/or distribute this software for any
 
5
 * purpose with or without fee is hereby granted, provided that the above
 
6
 * copyright notice and this permission notice appear in all copies.
 
7
 *
 
8
 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
 
9
 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 
10
 * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
 
11
 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
 
12
 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
 
13
 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 
14
 * PERFORMANCE OF THIS SOFTWARE.
 
15
 */
 
16
 
 
17
/* $Id: dhcid_49.c,v 1.5 2007/06/19 23:47:17 tbox Exp $ */
 
18
 
 
19
/* RFC 4701 */
 
20
 
 
21
#ifndef RDATA_IN_1_DHCID_49_C
 
22
#define RDATA_IN_1_DHCID_49_C 1
 
23
 
 
24
#define RRTYPE_DHCID_ATTRIBUTES 0
 
25
 
 
26
static inline isc_result_t
 
27
fromtext_in_dhcid(ARGS_FROMTEXT) {
 
28
 
 
29
        REQUIRE(type == 49);
 
30
        REQUIRE(rdclass == 1);
 
31
 
 
32
        UNUSED(type);
 
33
        UNUSED(rdclass);
 
34
        UNUSED(origin);
 
35
        UNUSED(options);
 
36
        UNUSED(callbacks);
 
37
 
 
38
        return (isc_base64_tobuffer(lexer, target, -1));
 
39
}
 
40
 
 
41
static inline isc_result_t
 
42
totext_in_dhcid(ARGS_TOTEXT) {
 
43
        isc_region_t sr;
 
44
        char buf[sizeof(" ; 64000 255 64000")];
 
45
        size_t n;
 
46
 
 
47
        REQUIRE(rdata->type == 49);
 
48
        REQUIRE(rdata->rdclass == 1);
 
49
        REQUIRE(rdata->length != 0);
 
50
 
 
51
        dns_rdata_toregion(rdata, &sr);
 
52
 
 
53
        if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0)
 
54
                RETERR(str_totext("( " /*)*/, target)); 
 
55
        RETERR(isc_base64_totext(&sr, tctx->width - 2, tctx->linebreak,
 
56
                                 target));
 
57
        if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0) {
 
58
                RETERR(str_totext(/* ( */ " )", target));
 
59
                if (rdata->length > 2) {
 
60
                        n = snprintf(buf, sizeof(buf), " ; %u %u %u",
 
61
                                     sr.base[0] * 256 + sr.base[1],
 
62
                                     sr.base[2], rdata->length - 3);
 
63
                        INSIST(n < sizeof(buf));
 
64
                        RETERR(str_totext(buf, target));
 
65
                }
 
66
        }
 
67
        return (ISC_R_SUCCESS);
 
68
}
 
69
 
 
70
static inline isc_result_t
 
71
fromwire_in_dhcid(ARGS_FROMWIRE) {
 
72
        isc_region_t sr;
 
73
 
 
74
        REQUIRE(type == 49);
 
75
        REQUIRE(rdclass == 1);
 
76
 
 
77
        UNUSED(type);
 
78
        UNUSED(rdclass);
 
79
        UNUSED(dctx);
 
80
        UNUSED(options);
 
81
 
 
82
        isc_buffer_activeregion(source, &sr);
 
83
        if (sr.length == 0)
 
84
                return (ISC_R_UNEXPECTEDEND);
 
85
 
 
86
        isc_buffer_forward(source, sr.length);
 
87
        return (mem_tobuffer(target, sr.base, sr.length));
 
88
}
 
89
 
 
90
static inline isc_result_t
 
91
towire_in_dhcid(ARGS_TOWIRE) {
 
92
        isc_region_t sr;
 
93
 
 
94
        REQUIRE(rdata->type == 49);
 
95
        REQUIRE(rdata->rdclass == 1);
 
96
        REQUIRE(rdata->length != 0);
 
97
 
 
98
        UNUSED(cctx);
 
99
 
 
100
        dns_rdata_toregion(rdata, &sr);
 
101
        return (mem_tobuffer(target, sr.base, sr.length));
 
102
}
 
103
 
 
104
static inline int
 
105
compare_in_dhcid(ARGS_COMPARE) {
 
106
        isc_region_t r1;
 
107
        isc_region_t r2;
 
108
 
 
109
        REQUIRE(rdata1->type == rdata2->type);
 
110
        REQUIRE(rdata1->rdclass == rdata2->rdclass);
 
111
        REQUIRE(rdata1->type == 49);
 
112
        REQUIRE(rdata1->rdclass == 1);
 
113
        REQUIRE(rdata1->length != 0);
 
114
        REQUIRE(rdata2->length != 0);
 
115
 
 
116
        dns_rdata_toregion(rdata1, &r1);
 
117
        dns_rdata_toregion(rdata2, &r2);
 
118
        return (isc_region_compare(&r1, &r2));
 
119
}
 
120
 
 
121
static inline isc_result_t
 
122
fromstruct_in_dhcid(ARGS_FROMSTRUCT) {
 
123
        dns_rdata_in_dhcid_t *dhcid = source;
 
124
 
 
125
        REQUIRE(type == 49);
 
126
        REQUIRE(rdclass == 1);
 
127
        REQUIRE(source != NULL);
 
128
        REQUIRE(dhcid->common.rdtype == type);
 
129
        REQUIRE(dhcid->common.rdclass == rdclass);
 
130
        REQUIRE(dhcid->length != 0);
 
131
 
 
132
        UNUSED(type);
 
133
        UNUSED(rdclass);
 
134
 
 
135
        return (mem_tobuffer(target, dhcid->dhcid, dhcid->length));
 
136
}
 
137
 
 
138
static inline isc_result_t
 
139
tostruct_in_dhcid(ARGS_TOSTRUCT) {
 
140
        dns_rdata_in_dhcid_t *dhcid = target;
 
141
        isc_region_t region;
 
142
 
 
143
        REQUIRE(rdata->type == 49);
 
144
        REQUIRE(rdata->rdclass == 1);
 
145
        REQUIRE(target != NULL);
 
146
        REQUIRE(rdata->length != 0);
 
147
 
 
148
        dhcid->common.rdclass = rdata->rdclass;
 
149
        dhcid->common.rdtype = rdata->type;
 
150
        ISC_LINK_INIT(&dhcid->common, link);
 
151
 
 
152
        dns_rdata_toregion(rdata, &region);
 
153
 
 
154
        dhcid->dhcid = mem_maybedup(mctx, region.base, region.length);
 
155
        if (dhcid->dhcid == NULL)
 
156
                return (ISC_R_NOMEMORY);
 
157
 
 
158
        dhcid->mctx = mctx;
 
159
        return (ISC_R_SUCCESS);
 
160
}
 
161
 
 
162
static inline void
 
163
freestruct_in_dhcid(ARGS_FREESTRUCT) {
 
164
        dns_rdata_in_dhcid_t *dhcid = source;
 
165
 
 
166
        REQUIRE(dhcid != NULL);
 
167
        REQUIRE(dhcid->common.rdtype == 49);
 
168
        REQUIRE(dhcid->common.rdclass == 1);
 
169
 
 
170
        if (dhcid->mctx == NULL)
 
171
                return;
 
172
 
 
173
        if (dhcid->dhcid != NULL)
 
174
                isc_mem_free(dhcid->mctx, dhcid->dhcid);
 
175
        dhcid->mctx = NULL;
 
176
}
 
177
 
 
178
static inline isc_result_t
 
179
additionaldata_in_dhcid(ARGS_ADDLDATA) {
 
180
        REQUIRE(rdata->type == 49);
 
181
        REQUIRE(rdata->rdclass == 1);
 
182
 
 
183
        UNUSED(rdata);
 
184
        UNUSED(add);
 
185
        UNUSED(arg);
 
186
 
 
187
        return (ISC_R_SUCCESS);
 
188
}
 
189
 
 
190
static inline isc_result_t
 
191
digest_in_dhcid(ARGS_DIGEST) {
 
192
        isc_region_t r;
 
193
 
 
194
        REQUIRE(rdata->type == 49);
 
195
        REQUIRE(rdata->rdclass == 1);
 
196
 
 
197
        dns_rdata_toregion(rdata, &r);
 
198
 
 
199
        return ((digest)(arg, &r));
 
200
}
 
201
 
 
202
static inline isc_boolean_t
 
203
checkowner_in_dhcid(ARGS_CHECKOWNER) {
 
204
 
 
205
        REQUIRE(type == 49);
 
206
        REQUIRE(rdclass == 1);
 
207
 
 
208
        UNUSED(name);
 
209
        UNUSED(type);
 
210
        UNUSED(rdclass);
 
211
        UNUSED(wildcard);
 
212
 
 
213
        return (ISC_TRUE);
 
214
}
 
215
 
 
216
static inline isc_boolean_t
 
217
checknames_in_dhcid(ARGS_CHECKNAMES) {
 
218
 
 
219
        REQUIRE(rdata->type == 49);
 
220
        REQUIRE(rdata->rdclass == 1);
 
221
 
 
222
        UNUSED(rdata);
 
223
        UNUSED(owner);
 
224
        UNUSED(bad);
 
225
 
 
226
        return (ISC_TRUE);
 
227
}
 
228
 
 
229
#endif  /* RDATA_IN_1_DHCID_49_C */