Deleted Added
full compact
compress.c (165071) compress.c (170222)
1/*
1/*
2 * Copyright (C) 2004, 2006 Internet Systems Consortium, Inc. ("ISC")
2 * Copyright (C) 2004-2006 Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 1999-2001 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
3 * Copyright (C) 1999-2001 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: compress.c,v 1.50.206.4 2006/03/02 00:37:20 marka Exp $ */
18/* $Id: compress.c,v 1.52.18.5 2006/03/02 00:37:21 marka Exp $ */
19
19
20/*! \file */
21
20#define DNS_NAME_USEINLINE 1
21
22#include <config.h>
23
24#include <isc/mem.h>
25#include <isc/string.h>
26#include <isc/util.h>
27

--- 49 unchanged lines hidden (view full) ---

77 cctx->allowed = 0;
78 cctx->edns = -1;
79}
80
81void
82dns_compress_setmethods(dns_compress_t *cctx, unsigned int allowed) {
83 REQUIRE(VALID_CCTX(cctx));
84
22#define DNS_NAME_USEINLINE 1
23
24#include <config.h>
25
26#include <isc/mem.h>
27#include <isc/string.h>
28#include <isc/util.h>
29

--- 49 unchanged lines hidden (view full) ---

79 cctx->allowed = 0;
80 cctx->edns = -1;
81}
82
83void
84dns_compress_setmethods(dns_compress_t *cctx, unsigned int allowed) {
85 REQUIRE(VALID_CCTX(cctx));
86
85 cctx->allowed = allowed;
87 cctx->allowed &= ~DNS_COMPRESS_ALL;
88 cctx->allowed |= (allowed & DNS_COMPRESS_ALL);
86}
87
88unsigned int
89dns_compress_getmethods(dns_compress_t *cctx) {
90 REQUIRE(VALID_CCTX(cctx));
89}
90
91unsigned int
92dns_compress_getmethods(dns_compress_t *cctx) {
93 REQUIRE(VALID_CCTX(cctx));
91 return (cctx->allowed);
94 return (cctx->allowed & DNS_COMPRESS_ALL);
92}
93
95}
96
97void
98dns_compress_setsensitive(dns_compress_t *cctx, isc_boolean_t sensitive) {
99 REQUIRE(VALID_CCTX(cctx));
100
101 if (sensitive)
102 cctx->allowed |= DNS_COMPRESS_CASESENSITIVE;
103 else
104 cctx->allowed &= ~DNS_COMPRESS_CASESENSITIVE;
105}
106
107isc_boolean_t
108dns_compress_getsensitive(dns_compress_t *cctx) {
109 REQUIRE(VALID_CCTX(cctx));
110
111 return (ISC_TF((cctx->allowed & DNS_COMPRESS_CASESENSITIVE) != 0));
112}
113
94int
95dns_compress_getedns(dns_compress_t *cctx) {
96 REQUIRE(VALID_CCTX(cctx));
97 return (cctx->edns);
98}
99
100#define NODENAME(node, name) \
101do { \

--- 31 unchanged lines hidden (view full) ---

133
134 for (n = 0; n < labels - 1; n++) {
135 dns_name_getlabelsequence(name, n, labels - n, &tname);
136 hash = dns_name_hash(&tname, ISC_FALSE) %
137 DNS_COMPRESS_TABLESIZE;
138 for (node = cctx->table[hash]; node != NULL; node = node->next)
139 {
140 NODENAME(node, &nname);
114int
115dns_compress_getedns(dns_compress_t *cctx) {
116 REQUIRE(VALID_CCTX(cctx));
117 return (cctx->edns);
118}
119
120#define NODENAME(node, name) \
121do { \

--- 31 unchanged lines hidden (view full) ---

153
154 for (n = 0; n < labels - 1; n++) {
155 dns_name_getlabelsequence(name, n, labels - n, &tname);
156 hash = dns_name_hash(&tname, ISC_FALSE) %
157 DNS_COMPRESS_TABLESIZE;
158 for (node = cctx->table[hash]; node != NULL; node = node->next)
159 {
160 NODENAME(node, &nname);
141 if (dns_name_equal(&nname, &tname))
142 break;
161 if ((cctx->allowed & DNS_COMPRESS_CASESENSITIVE) != 0) {
162 if (dns_name_caseequal(&nname, &tname))
163 break;
164 } else {
165 if (dns_name_equal(&nname, &tname))
166 break;
167 }
143 }
144 if (node != NULL)
145 break;
146 }
147
148 /*
149 * If node == NULL, we found no match at all.
150 */

--- 166 unchanged lines hidden ---
168 }
169 if (node != NULL)
170 break;
171 }
172
173 /*
174 * If node == NULL, we found no match at all.
175 */

--- 166 unchanged lines hidden ---