1*8d67ca89SAndroid Build Coastguard Worker /* $NetBSD: res_comp.c,v 1.6 2004/05/22 23:47:09 christos Exp $ */
2*8d67ca89SAndroid Build Coastguard Worker
3*8d67ca89SAndroid Build Coastguard Worker /*
4*8d67ca89SAndroid Build Coastguard Worker * Copyright (c) 1985, 1993
5*8d67ca89SAndroid Build Coastguard Worker * The Regents of the University of California. All rights reserved.
6*8d67ca89SAndroid Build Coastguard Worker *
7*8d67ca89SAndroid Build Coastguard Worker * Redistribution and use in source and binary forms, with or without
8*8d67ca89SAndroid Build Coastguard Worker * modification, are permitted provided that the following conditions
9*8d67ca89SAndroid Build Coastguard Worker * are met:
10*8d67ca89SAndroid Build Coastguard Worker * 1. Redistributions of source code must retain the above copyright
11*8d67ca89SAndroid Build Coastguard Worker * notice, this list of conditions and the following disclaimer.
12*8d67ca89SAndroid Build Coastguard Worker * 2. Redistributions in binary form must reproduce the above copyright
13*8d67ca89SAndroid Build Coastguard Worker * notice, this list of conditions and the following disclaimer in the
14*8d67ca89SAndroid Build Coastguard Worker * documentation and/or other materials provided with the distribution.
15*8d67ca89SAndroid Build Coastguard Worker * 3. All advertising materials mentioning features or use of this software
16*8d67ca89SAndroid Build Coastguard Worker * must display the following acknowledgement:
17*8d67ca89SAndroid Build Coastguard Worker * This product includes software developed by the University of
18*8d67ca89SAndroid Build Coastguard Worker * California, Berkeley and its contributors.
19*8d67ca89SAndroid Build Coastguard Worker * 4. Neither the name of the University nor the names of its contributors
20*8d67ca89SAndroid Build Coastguard Worker * may be used to endorse or promote products derived from this software
21*8d67ca89SAndroid Build Coastguard Worker * without specific prior written permission.
22*8d67ca89SAndroid Build Coastguard Worker *
23*8d67ca89SAndroid Build Coastguard Worker * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24*8d67ca89SAndroid Build Coastguard Worker * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25*8d67ca89SAndroid Build Coastguard Worker * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26*8d67ca89SAndroid Build Coastguard Worker * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27*8d67ca89SAndroid Build Coastguard Worker * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28*8d67ca89SAndroid Build Coastguard Worker * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29*8d67ca89SAndroid Build Coastguard Worker * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30*8d67ca89SAndroid Build Coastguard Worker * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31*8d67ca89SAndroid Build Coastguard Worker * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32*8d67ca89SAndroid Build Coastguard Worker * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33*8d67ca89SAndroid Build Coastguard Worker * SUCH DAMAGE.
34*8d67ca89SAndroid Build Coastguard Worker */
35*8d67ca89SAndroid Build Coastguard Worker
36*8d67ca89SAndroid Build Coastguard Worker /*
37*8d67ca89SAndroid Build Coastguard Worker * Portions Copyright (c) 1993 by Digital Equipment Corporation.
38*8d67ca89SAndroid Build Coastguard Worker *
39*8d67ca89SAndroid Build Coastguard Worker * Permission to use, copy, modify, and distribute this software for any
40*8d67ca89SAndroid Build Coastguard Worker * purpose with or without fee is hereby granted, provided that the above
41*8d67ca89SAndroid Build Coastguard Worker * copyright notice and this permission notice appear in all copies, and that
42*8d67ca89SAndroid Build Coastguard Worker * the name of Digital Equipment Corporation not be used in advertising or
43*8d67ca89SAndroid Build Coastguard Worker * publicity pertaining to distribution of the document or software without
44*8d67ca89SAndroid Build Coastguard Worker * specific, written prior permission.
45*8d67ca89SAndroid Build Coastguard Worker *
46*8d67ca89SAndroid Build Coastguard Worker * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
47*8d67ca89SAndroid Build Coastguard Worker * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
48*8d67ca89SAndroid Build Coastguard Worker * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
49*8d67ca89SAndroid Build Coastguard Worker * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
50*8d67ca89SAndroid Build Coastguard Worker * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
51*8d67ca89SAndroid Build Coastguard Worker * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
52*8d67ca89SAndroid Build Coastguard Worker * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
53*8d67ca89SAndroid Build Coastguard Worker * SOFTWARE.
54*8d67ca89SAndroid Build Coastguard Worker */
55*8d67ca89SAndroid Build Coastguard Worker
56*8d67ca89SAndroid Build Coastguard Worker /*
57*8d67ca89SAndroid Build Coastguard Worker * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
58*8d67ca89SAndroid Build Coastguard Worker * Portions Copyright (c) 1996-1999 by Internet Software Consortium.
59*8d67ca89SAndroid Build Coastguard Worker *
60*8d67ca89SAndroid Build Coastguard Worker * Permission to use, copy, modify, and distribute this software for any
61*8d67ca89SAndroid Build Coastguard Worker * purpose with or without fee is hereby granted, provided that the above
62*8d67ca89SAndroid Build Coastguard Worker * copyright notice and this permission notice appear in all copies.
63*8d67ca89SAndroid Build Coastguard Worker *
64*8d67ca89SAndroid Build Coastguard Worker * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
65*8d67ca89SAndroid Build Coastguard Worker * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
66*8d67ca89SAndroid Build Coastguard Worker * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
67*8d67ca89SAndroid Build Coastguard Worker * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
68*8d67ca89SAndroid Build Coastguard Worker * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
69*8d67ca89SAndroid Build Coastguard Worker * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
70*8d67ca89SAndroid Build Coastguard Worker * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
71*8d67ca89SAndroid Build Coastguard Worker */
72*8d67ca89SAndroid Build Coastguard Worker #include <sys/cdefs.h>
73*8d67ca89SAndroid Build Coastguard Worker #if defined(LIBC_SCCS) && !defined(lint)
74*8d67ca89SAndroid Build Coastguard Worker #ifdef notdef
75*8d67ca89SAndroid Build Coastguard Worker static const char sccsid[] = "@(#)res_comp.c 8.1 (Berkeley) 6/4/93";
76*8d67ca89SAndroid Build Coastguard Worker static const char rcsid[] = "Id: res_comp.c,v 1.1.2.1.4.1 2004/03/09 08:33:54 marka Exp";
77*8d67ca89SAndroid Build Coastguard Worker #else
78*8d67ca89SAndroid Build Coastguard Worker __RCSID("$NetBSD: res_comp.c,v 1.6 2004/05/22 23:47:09 christos Exp $");
79*8d67ca89SAndroid Build Coastguard Worker #endif
80*8d67ca89SAndroid Build Coastguard Worker #endif /* LIBC_SCCS and not lint */
81*8d67ca89SAndroid Build Coastguard Worker
82*8d67ca89SAndroid Build Coastguard Worker #include <sys/types.h>
83*8d67ca89SAndroid Build Coastguard Worker #include <sys/param.h>
84*8d67ca89SAndroid Build Coastguard Worker #include <netinet/in.h>
85*8d67ca89SAndroid Build Coastguard Worker #include <arpa/nameser.h>
86*8d67ca89SAndroid Build Coastguard Worker #include <ctype.h>
87*8d67ca89SAndroid Build Coastguard Worker #ifdef ANDROID_CHANGES
88*8d67ca89SAndroid Build Coastguard Worker #include "resolv_private.h"
89*8d67ca89SAndroid Build Coastguard Worker #else
90*8d67ca89SAndroid Build Coastguard Worker #include <resolv.h>
91*8d67ca89SAndroid Build Coastguard Worker #endif
92*8d67ca89SAndroid Build Coastguard Worker #include <stdio.h>
93*8d67ca89SAndroid Build Coastguard Worker #include <string.h>
94*8d67ca89SAndroid Build Coastguard Worker #include <unistd.h>
95*8d67ca89SAndroid Build Coastguard Worker
96*8d67ca89SAndroid Build Coastguard Worker /*
97*8d67ca89SAndroid Build Coastguard Worker * Expand compressed domain name 'src' to full domain name.
98*8d67ca89SAndroid Build Coastguard Worker * 'msg' is a pointer to the begining of the message,
99*8d67ca89SAndroid Build Coastguard Worker * 'eom' points to the first location after the message,
100*8d67ca89SAndroid Build Coastguard Worker * 'dst' is a pointer to a buffer of size 'dstsiz' for the result.
101*8d67ca89SAndroid Build Coastguard Worker * Return size of compressed name or -1 if there was an error.
102*8d67ca89SAndroid Build Coastguard Worker */
103*8d67ca89SAndroid Build Coastguard Worker int
dn_expand(const u_char * msg,const u_char * eom,const u_char * src,char * dst,int dstsiz)104*8d67ca89SAndroid Build Coastguard Worker dn_expand(const u_char *msg, const u_char *eom, const u_char *src,
105*8d67ca89SAndroid Build Coastguard Worker char *dst, int dstsiz)
106*8d67ca89SAndroid Build Coastguard Worker {
107*8d67ca89SAndroid Build Coastguard Worker int n = ns_name_uncompress(msg, eom, src, dst, (size_t)dstsiz);
108*8d67ca89SAndroid Build Coastguard Worker
109*8d67ca89SAndroid Build Coastguard Worker if (n > 0 && dst[0] == '.')
110*8d67ca89SAndroid Build Coastguard Worker dst[0] = '\0';
111*8d67ca89SAndroid Build Coastguard Worker return (n);
112*8d67ca89SAndroid Build Coastguard Worker }
113*8d67ca89SAndroid Build Coastguard Worker
114*8d67ca89SAndroid Build Coastguard Worker /*
115*8d67ca89SAndroid Build Coastguard Worker * Pack domain name 'exp_dn' in presentation form into 'comp_dn'.
116*8d67ca89SAndroid Build Coastguard Worker * Return the size of the compressed name or -1.
117*8d67ca89SAndroid Build Coastguard Worker * 'length' is the size of the array pointed to by 'comp_dn'.
118*8d67ca89SAndroid Build Coastguard Worker */
119*8d67ca89SAndroid Build Coastguard Worker int
dn_comp(const char * src,u_char * dst,int dstsiz,u_char ** dnptrs,u_char ** lastdnptr)120*8d67ca89SAndroid Build Coastguard Worker dn_comp(const char *src, u_char *dst, int dstsiz,
121*8d67ca89SAndroid Build Coastguard Worker u_char **dnptrs, u_char **lastdnptr)
122*8d67ca89SAndroid Build Coastguard Worker {
123*8d67ca89SAndroid Build Coastguard Worker return (ns_name_compress(src, dst, (size_t)dstsiz,
124*8d67ca89SAndroid Build Coastguard Worker (const u_char **)dnptrs,
125*8d67ca89SAndroid Build Coastguard Worker (const u_char **)lastdnptr));
126*8d67ca89SAndroid Build Coastguard Worker }
127*8d67ca89SAndroid Build Coastguard Worker
128*8d67ca89SAndroid Build Coastguard Worker /*
129*8d67ca89SAndroid Build Coastguard Worker * Skip over a compressed domain name. Return the size or -1.
130*8d67ca89SAndroid Build Coastguard Worker */
131*8d67ca89SAndroid Build Coastguard Worker int
dn_skipname(const u_char * ptr,const u_char * eom)132*8d67ca89SAndroid Build Coastguard Worker dn_skipname(const u_char *ptr, const u_char *eom) {
133*8d67ca89SAndroid Build Coastguard Worker const u_char *saveptr = ptr;
134*8d67ca89SAndroid Build Coastguard Worker
135*8d67ca89SAndroid Build Coastguard Worker if (ns_name_skip(&ptr, eom) == -1)
136*8d67ca89SAndroid Build Coastguard Worker return (-1);
137*8d67ca89SAndroid Build Coastguard Worker return (ptr - saveptr);
138*8d67ca89SAndroid Build Coastguard Worker }
139*8d67ca89SAndroid Build Coastguard Worker
140*8d67ca89SAndroid Build Coastguard Worker /*
141*8d67ca89SAndroid Build Coastguard Worker * Verify that a domain name uses an acceptable character set.
142*8d67ca89SAndroid Build Coastguard Worker */
143*8d67ca89SAndroid Build Coastguard Worker
144*8d67ca89SAndroid Build Coastguard Worker /*
145*8d67ca89SAndroid Build Coastguard Worker * Note the conspicuous absence of ctype macros in these definitions. On
146*8d67ca89SAndroid Build Coastguard Worker * non-ASCII hosts, we can't depend on string literals or ctype macros to
147*8d67ca89SAndroid Build Coastguard Worker * tell us anything about network-format data. The rest of the BIND system
148*8d67ca89SAndroid Build Coastguard Worker * is not careful about this, but for some reason, we're doing it right here.
149*8d67ca89SAndroid Build Coastguard Worker */
150*8d67ca89SAndroid Build Coastguard Worker
151*8d67ca89SAndroid Build Coastguard Worker /* BIONIC: We also accept underscores in the middle of labels.
152*8d67ca89SAndroid Build Coastguard Worker * This extension is needed to make resolution on some VPN networks
153*8d67ca89SAndroid Build Coastguard Worker * work properly.
154*8d67ca89SAndroid Build Coastguard Worker */
155*8d67ca89SAndroid Build Coastguard Worker
156*8d67ca89SAndroid Build Coastguard Worker #define PERIOD 0x2e
157*8d67ca89SAndroid Build Coastguard Worker #define hyphenchar(c) ((c) == 0x2d)
158*8d67ca89SAndroid Build Coastguard Worker #define bslashchar(c) ((c) == 0x5c)
159*8d67ca89SAndroid Build Coastguard Worker #define periodchar(c) ((c) == PERIOD)
160*8d67ca89SAndroid Build Coastguard Worker #define asterchar(c) ((c) == 0x2a)
161*8d67ca89SAndroid Build Coastguard Worker #define alphachar(c) (((c) >= 0x41 && (c) <= 0x5a) \
162*8d67ca89SAndroid Build Coastguard Worker || ((c) >= 0x61 && (c) <= 0x7a))
163*8d67ca89SAndroid Build Coastguard Worker #define digitchar(c) ((c) >= 0x30 && (c) <= 0x39)
164*8d67ca89SAndroid Build Coastguard Worker #define underscorechar(c) ((c) == 0x5f)
165*8d67ca89SAndroid Build Coastguard Worker
166*8d67ca89SAndroid Build Coastguard Worker #define borderchar(c) (alphachar(c) || digitchar(c))
167*8d67ca89SAndroid Build Coastguard Worker #define middlechar(c) (borderchar(c) || hyphenchar(c) || underscorechar(c))
168*8d67ca89SAndroid Build Coastguard Worker #define domainchar(c) ((c) > 0x20 && (c) < 0x7f)
169*8d67ca89SAndroid Build Coastguard Worker
170*8d67ca89SAndroid Build Coastguard Worker int
res_hnok(const char * dn)171*8d67ca89SAndroid Build Coastguard Worker res_hnok(const char *dn) {
172*8d67ca89SAndroid Build Coastguard Worker int pch = PERIOD, ch = *dn++;
173*8d67ca89SAndroid Build Coastguard Worker
174*8d67ca89SAndroid Build Coastguard Worker while (ch != '\0') {
175*8d67ca89SAndroid Build Coastguard Worker int nch = *dn++;
176*8d67ca89SAndroid Build Coastguard Worker
177*8d67ca89SAndroid Build Coastguard Worker if (periodchar(ch)) {
178*8d67ca89SAndroid Build Coastguard Worker ;
179*8d67ca89SAndroid Build Coastguard Worker } else if (periodchar(pch)) {
180*8d67ca89SAndroid Build Coastguard Worker if (!borderchar(ch))
181*8d67ca89SAndroid Build Coastguard Worker return (0);
182*8d67ca89SAndroid Build Coastguard Worker } else if (periodchar(nch) || nch == '\0') {
183*8d67ca89SAndroid Build Coastguard Worker if (!borderchar(ch))
184*8d67ca89SAndroid Build Coastguard Worker return (0);
185*8d67ca89SAndroid Build Coastguard Worker } else {
186*8d67ca89SAndroid Build Coastguard Worker if (!middlechar(ch))
187*8d67ca89SAndroid Build Coastguard Worker return (0);
188*8d67ca89SAndroid Build Coastguard Worker }
189*8d67ca89SAndroid Build Coastguard Worker pch = ch, ch = nch;
190*8d67ca89SAndroid Build Coastguard Worker }
191*8d67ca89SAndroid Build Coastguard Worker return (1);
192*8d67ca89SAndroid Build Coastguard Worker }
193*8d67ca89SAndroid Build Coastguard Worker
194*8d67ca89SAndroid Build Coastguard Worker /*
195*8d67ca89SAndroid Build Coastguard Worker * hostname-like (A, MX, WKS) owners can have "*" as their first label
196*8d67ca89SAndroid Build Coastguard Worker * but must otherwise be as a host name.
197*8d67ca89SAndroid Build Coastguard Worker */
198*8d67ca89SAndroid Build Coastguard Worker int
res_ownok(const char * dn)199*8d67ca89SAndroid Build Coastguard Worker res_ownok(const char *dn) {
200*8d67ca89SAndroid Build Coastguard Worker if (asterchar(dn[0])) {
201*8d67ca89SAndroid Build Coastguard Worker if (periodchar(dn[1]))
202*8d67ca89SAndroid Build Coastguard Worker return (res_hnok(dn+2));
203*8d67ca89SAndroid Build Coastguard Worker if (dn[1] == '\0')
204*8d67ca89SAndroid Build Coastguard Worker return (1);
205*8d67ca89SAndroid Build Coastguard Worker }
206*8d67ca89SAndroid Build Coastguard Worker return (res_hnok(dn));
207*8d67ca89SAndroid Build Coastguard Worker }
208*8d67ca89SAndroid Build Coastguard Worker
209*8d67ca89SAndroid Build Coastguard Worker /*
210*8d67ca89SAndroid Build Coastguard Worker * SOA RNAMEs and RP RNAMEs can have any printable character in their first
211*8d67ca89SAndroid Build Coastguard Worker * label, but the rest of the name has to look like a host name.
212*8d67ca89SAndroid Build Coastguard Worker */
213*8d67ca89SAndroid Build Coastguard Worker int
res_mailok(const char * dn)214*8d67ca89SAndroid Build Coastguard Worker res_mailok(const char *dn) {
215*8d67ca89SAndroid Build Coastguard Worker int ch, escaped = 0;
216*8d67ca89SAndroid Build Coastguard Worker
217*8d67ca89SAndroid Build Coastguard Worker /* "." is a valid missing representation */
218*8d67ca89SAndroid Build Coastguard Worker if (*dn == '\0')
219*8d67ca89SAndroid Build Coastguard Worker return (1);
220*8d67ca89SAndroid Build Coastguard Worker
221*8d67ca89SAndroid Build Coastguard Worker /* otherwise <label>.<hostname> */
222*8d67ca89SAndroid Build Coastguard Worker while ((ch = *dn++) != '\0') {
223*8d67ca89SAndroid Build Coastguard Worker if (!domainchar(ch))
224*8d67ca89SAndroid Build Coastguard Worker return (0);
225*8d67ca89SAndroid Build Coastguard Worker if (!escaped && periodchar(ch))
226*8d67ca89SAndroid Build Coastguard Worker break;
227*8d67ca89SAndroid Build Coastguard Worker if (escaped)
228*8d67ca89SAndroid Build Coastguard Worker escaped = 0;
229*8d67ca89SAndroid Build Coastguard Worker else if (bslashchar(ch))
230*8d67ca89SAndroid Build Coastguard Worker escaped = 1;
231*8d67ca89SAndroid Build Coastguard Worker }
232*8d67ca89SAndroid Build Coastguard Worker if (periodchar(ch))
233*8d67ca89SAndroid Build Coastguard Worker return (res_hnok(dn));
234*8d67ca89SAndroid Build Coastguard Worker return (0);
235*8d67ca89SAndroid Build Coastguard Worker }
236*8d67ca89SAndroid Build Coastguard Worker
237*8d67ca89SAndroid Build Coastguard Worker /*
238*8d67ca89SAndroid Build Coastguard Worker * This function is quite liberal, since RFC 1034's character sets are only
239*8d67ca89SAndroid Build Coastguard Worker * recommendations.
240*8d67ca89SAndroid Build Coastguard Worker */
241*8d67ca89SAndroid Build Coastguard Worker int
res_dnok(const char * dn)242*8d67ca89SAndroid Build Coastguard Worker res_dnok(const char *dn) {
243*8d67ca89SAndroid Build Coastguard Worker int ch;
244*8d67ca89SAndroid Build Coastguard Worker
245*8d67ca89SAndroid Build Coastguard Worker while ((ch = *dn++) != '\0')
246*8d67ca89SAndroid Build Coastguard Worker if (!domainchar(ch))
247*8d67ca89SAndroid Build Coastguard Worker return (0);
248*8d67ca89SAndroid Build Coastguard Worker return (1);
249*8d67ca89SAndroid Build Coastguard Worker }
250*8d67ca89SAndroid Build Coastguard Worker
251*8d67ca89SAndroid Build Coastguard Worker #ifdef BIND_4_COMPAT
252*8d67ca89SAndroid Build Coastguard Worker /*
253*8d67ca89SAndroid Build Coastguard Worker * This module must export the following externally-visible symbols:
254*8d67ca89SAndroid Build Coastguard Worker * ___putlong
255*8d67ca89SAndroid Build Coastguard Worker * ___putshort
256*8d67ca89SAndroid Build Coastguard Worker * __getlong
257*8d67ca89SAndroid Build Coastguard Worker * __getshort
258*8d67ca89SAndroid Build Coastguard Worker * Note that one _ comes from C and the others come from us.
259*8d67ca89SAndroid Build Coastguard Worker */
__putlong(u_int32_t src,u_char * dst)260*8d67ca89SAndroid Build Coastguard Worker void __putlong(u_int32_t src, u_char *dst) { ns_put32(src, dst); }
__putshort(u_int16_t src,u_char * dst)261*8d67ca89SAndroid Build Coastguard Worker void __putshort(u_int16_t src, u_char *dst) { ns_put16(src, dst); }
262*8d67ca89SAndroid Build Coastguard Worker #ifndef __ultrix__
_getlong(const u_char * src)263*8d67ca89SAndroid Build Coastguard Worker u_int32_t _getlong(const u_char *src) { return (ns_get32(src)); }
_getshort(const u_char * src)264*8d67ca89SAndroid Build Coastguard Worker u_int16_t _getshort(const u_char *src) { return (ns_get16(src)); }
265*8d67ca89SAndroid Build Coastguard Worker #endif /*__ultrix__*/
266*8d67ca89SAndroid Build Coastguard Worker #endif /*BIND_4_COMPAT*/
267