yp_extern.h revision 20818
112891Swpaul/*
212891Swpaul * Copyright (c) 1995
312891Swpaul *	Bill Paul <wpaul@ctr.columbia.edu>.  All rights reserved.
412891Swpaul *
512891Swpaul * Redistribution and use in source and binary forms, with or without
612891Swpaul * modification, are permitted provided that the following conditions
712891Swpaul * are met:
812891Swpaul * 1. Redistributions of source code must retain the above copyright
912891Swpaul *    notice, this list of conditions and the following disclaimer.
1012891Swpaul * 2. Redistributions in binary form must reproduce the above copyright
1112891Swpaul *    notice, this list of conditions and the following disclaimer in the
1212891Swpaul *    documentation and/or other materials provided with the distribution.
1312891Swpaul * 3. All advertising materials mentioning features or use of this software
1412891Swpaul *    must display the following acknowledgement:
1512891Swpaul *	This product includes software developed by Bill Paul.
1612891Swpaul * 4. Neither the name of the author nor the names of any co-contributors
1712891Swpaul *    may be used to endorse or promote products derived from this software
1812891Swpaul *    without specific prior written permission.
1912891Swpaul *
2012891Swpaul * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
2112891Swpaul * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2212891Swpaul * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2312891Swpaul * ARE DISCLAIMED.  IN NO EVENT SHALL Bill Paul OR CONTRIBUTORS BE LIABLE
2412891Swpaul * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2512891Swpaul * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2612891Swpaul * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2712891Swpaul * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2812891Swpaul * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2912891Swpaul * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3012891Swpaul * SUCH DAMAGE.
3112891Swpaul *
3220818Swpaul *	$Id: yp_extern.h,v 1.3 1996/12/22 15:53:55 wpaul Exp $
3312891Swpaul */
3412891Swpaul#include <stdio.h>
3512891Swpaul#include <string.h>
3612891Swpaul#include <unistd.h>
3712891Swpaul#include <sys/cdefs.h>
3812891Swpaul#include <sys/types.h>
3912891Swpaul#include <limits.h>
4012891Swpaul#include <db.h>
4112891Swpaul#include <rpc/rpc.h>
4220818Swpaul#include <rpcsvc/yp.h>
4312891Swpaul
4412891Swpaul#ifndef _PATH_YP
4512891Swpaul#define _PATH_YP "/var/yp/"
4612891Swpaul#endif
4712891Swpaul
4812891Swpaul#ifndef _PATH_LIBEXEC
4912891Swpaul#define _PATH_LIBEXEC "/usr/libexec/"
5012891Swpaul#endif
5112891Swpaul
5212891Swpaul#ifndef MAX_CHILDREN
5312891Swpaul#define MAX_CHILDREN 20
5412891Swpaul#endif
5512891Swpaul
5619161Swpaul#define YP_SECURE 0x1
5719161Swpaul#define YP_INTERDOMAIN 0x2
5819161Swpaul
5912891Swpaul/*
6012891Swpaul * External functions and variables.
6112891Swpaul */
6212891Swpaul
6312891Swpaulextern int	debug;
6412997Swpaulextern int	ypdb_debug;
6512891Swpaulextern int	do_dns;
6612891Swpaulextern int	children;
6720818Swpaulextern int	resfd;
6812891Swpaulextern char 	*progname;
6912891Swpaulextern char	*yp_dir;
7020818Swpaulextern enum ypstat	yp_errno;
7112891Swpaulextern void	yp_error __P((const char *, ...));
7220818Swpaul#ifdef DB_CACHE
7320818Swpaulextern int	yp_get_record __P(( DB *, const DBT *, DBT *, int));
7420818Swpaul#else
7512891Swpaulextern int	yp_get_record __P(( const char *, const char *, const DBT *, DBT *, int));
7620818Swpaul#endif
7715426Swpaulextern int	yp_first_record __P((const DB *, DBT *, DBT *, int));
7815426Swpaulextern int	yp_next_record __P((const DB *, DBT *, DBT *, int, int));
7912891Swpaulextern char	*yp_dnsname __P(( char * ));
8012891Swpaulextern char	*yp_dnsaddr __P(( const char * ));
8119161Swpaul#ifdef DB_CACHE
8219161Swpaulextern int	yp_access __P((const char *, const char *, const struct svc_req * ));
8319161Swpaul#else
8412891Swpaulextern int	yp_access __P((const char *, const struct svc_req * ));
8519161Swpaul#endif
8612891Swpaulextern int	yp_validdomain __P((const char * ));
8712891Swpaulextern DB	*yp_open_db __P(( const char *, const char *));
8815426Swpaulextern DB	*yp_open_db_cache __P(( const char *, const char *, const char *, int ));
8915426Swpaulextern void	yp_flush_all __P(( void ));
9015426Swpaulextern void	yp_init_dbs __P(( void ));
9119161Swpaulextern int	yp_testflag __P(( char *, char *, int ));
9214240Swpaulextern void	load_securenets __P(( void ));
9320818Swpaul
9420818Swpaul#ifdef DB_CACHE
9520818Swpaulextern ypstat	yp_select_map __P(( char *, char *, keydat *, int ));
9620818Swpaulextern ypstat	yp_getbykey __P(( keydat *, valdat * ));
9720818Swpaulextern ypstat	yp_firstbykey __P(( keydat *, valdat * ));
9820818Swpaulextern ypstat	yp_nextbykey __P(( keydat *, valdat * ));
9920818Swpaul#endif
10020818Swpaul
10120818Swpaulextern unsigned long	svcudp_set_xid __P(( SVCXPRT *, unsigned long ));
10220818Swpaulextern unsigned long	svcudp_get_xid __P(( SVCXPRT * ));
10320818Swpaul
10420818Swpaul#ifndef RESOLVER_TIMEOUT
10520818Swpaul#define RESOLVER_TIMEOUT 3600
10620818Swpaul#endif
10720818Swpaul
10820818Swpaulextern int	yp_init_resolver __P(( void ));
10920818Swpaulextern int	yp_dnsq_pending __P(( void ));
11020818Swpaulextern void	yp_run_dnsq __P(( void ));
11120818Swpaulextern void	yp_prune_dnsq __P(( void ));
11220818Swpaulextern ypstat	yp_async_lookup_name __P(( SVCXPRT *, char * ));
11320818Swpaulextern ypstat	yp_async_lookup_addr __P(( SVCXPRT *, char * ));
114