res_query.c (7c478bd9) res_query.c (6a1c6faa)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
8 *

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

15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22/*
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
8 *

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

15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22/*
23 * Copyright 1997 Sun Microsystems, Inc. All rights reserved.
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28/* All Rights Reserved */
29
30/*
31 * University Copyright- Copyright (c) 1982, 1986, 1988

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

65 * Formulate a normal query, send, and await answer.
66 * Returned answer is placed in supplied buffer "answer".
67 * Perform preliminary check of answer, returning success only
68 * if no error is indicated and the answer count is nonzero.
69 * Return the size of the response on success, -1 on error.
70 * Error number is left in h_errno.
71 * Caller must parse answer and determine whether it answers the question.
72 */
24 * Use is subject to license terms.
25 */
26
27/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28/* All Rights Reserved */
29
30/*
31 * University Copyright- Copyright (c) 1982, 1986, 1988

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

65 * Formulate a normal query, send, and await answer.
66 * Returned answer is placed in supplied buffer "answer".
67 * Perform preliminary check of answer, returning success only
68 * if no error is indicated and the answer count is nonzero.
69 * Return the size of the response on success, -1 on error.
70 * Error number is left in h_errno.
71 * Caller must parse answer and determine whether it answers the question.
72 */
73int
73res_query(name, class, type, answer, anslen)
74 char *name; /* domain name */
75 int class, type; /* class and type of query */
76 u_char *answer; /* buffer to put answer */
77 int anslen; /* size of answer buffer */
78{
79 char buf[MAXPACKET];
80 HEADER *hp;

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

141/*
142 * Formulate a normal query, send, and retrieve answer in supplied buffer.
143 * Return the size of the response on success, -1 on error.
144 * If enabled, implement search rules until answer or unrecoverable failure
145 * is detected. Error number is left in h_errno.
146 * Only useful for queries in the same name hierarchy as the local host
147 * (not, for example, for host address-to-name lookups in domain in-addr.arpa).
148 */
74res_query(name, class, type, answer, anslen)
75 char *name; /* domain name */
76 int class, type; /* class and type of query */
77 u_char *answer; /* buffer to put answer */
78 int anslen; /* size of answer buffer */
79{
80 char buf[MAXPACKET];
81 HEADER *hp;

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

142/*
143 * Formulate a normal query, send, and retrieve answer in supplied buffer.
144 * Return the size of the response on success, -1 on error.
145 * If enabled, implement search rules until answer or unrecoverable failure
146 * is detected. Error number is left in h_errno.
147 * Only useful for queries in the same name hierarchy as the local host
148 * (not, for example, for host address-to-name lookups in domain in-addr.arpa).
149 */
150int
149res_search(name, class, type, answer, anslen)
150 char *name; /* domain name */
151 int class, type; /* class and type of query */
152 u_char *answer; /* buffer to put answer */
153 int anslen; /* size of answer */
154{
155 register char *cp, **domain;
156 int n, ret, got_nodata = 0;

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

217 h_errno = NO_DATA;
218 return (-1);
219}
220
221/*
222 * Perform a call on res_query on the concatenation of name and domain,
223 * removing a trailing dot from name if domain is NULL.
224 */
151res_search(name, class, type, answer, anslen)
152 char *name; /* domain name */
153 int class, type; /* class and type of query */
154 u_char *answer; /* buffer to put answer */
155 int anslen; /* size of answer */
156{
157 register char *cp, **domain;
158 int n, ret, got_nodata = 0;

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

219 h_errno = NO_DATA;
220 return (-1);
221}
222
223/*
224 * Perform a call on res_query on the concatenation of name and domain,
225 * removing a trailing dot from name if domain is NULL.
226 */
227int
225res_querydomain(name, domain, class, type, answer, anslen)
226 char *name, *domain;
227 int class, type; /* class and type of query */
228 u_char *answer; /* buffer to put answer */
229 int anslen; /* size of answer */
230{
231 char nbuf[2*MAXDNAME+2];
232 char *longname = nbuf;

--- 67 unchanged lines hidden ---
228res_querydomain(name, domain, class, type, answer, anslen)
229 char *name, *domain;
230 int class, type; /* class and type of query */
231 u_char *answer; /* buffer to put answer */
232 int anslen; /* size of answer */
233{
234 char nbuf[2*MAXDNAME+2];
235 char *longname = nbuf;

--- 67 unchanged lines hidden ---