nres.h revision 7f159024d938d3699c5fadbaf3c1e06639e95c04
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Taken from 4.1.3 ypserv resolver code. */
#ifndef _NRES_H
#define _NRES_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <netdb.h>
#include "rpc_as.h"
#ifdef __cplusplus
extern "C" {
#endif
#if PACKETSZ > 1024
#else
#define MAXPACKET 1024
#endif
#define REVERSE_PTR 1
#define REVERSE_A 2
struct nres {
int af_type; /* AF_INET or AF_INET6 */
int qtype; /* query type: T_A, T_AAAA, T_PTR */
int h_errno;
int reverse; /* used for gethostbyaddr */
int search_index; /* 0 up as we chase path */
int using_tcp; /* 0 ->udp in use */
int udp_socket;
int tcp_socket;
int got_nodata; /* no_data rather than name_not_found */
int question_len;
int answer_len;
int current_ns;
int retries;
int ttl; /* ttl value from response */
int tried_asis; /* Tried name look up as-is */
};
extern struct netconfig *udp_nconf4;
extern struct netconfig *udp_nconf6;
extern int nres_search(struct nres *);
extern int nres_chkreply(struct nres *);
extern struct nres *nres_gethostbyname(char *,
struct cache_ent *);
extern struct nres *nres_gethostbyaddr(char *, int, int,
struct cache_ent *);
#ifdef __cplusplus
}
#endif
#endif /* _NRES_H */