1331722Seadler/* 213007Swpaul * Copyright (c) 1995 313007Swpaul * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. 413007Swpaul * 513007Swpaul * Redistribution and use in source and binary forms, with or without 613007Swpaul * modification, are permitted provided that the following conditions 713007Swpaul * are met: 813007Swpaul * 1. Redistributions of source code must retain the above copyright 913007Swpaul * notice, this list of conditions and the following disclaimer. 1013007Swpaul * 2. Redistributions in binary form must reproduce the above copyright 1113007Swpaul * notice, this list of conditions and the following disclaimer in the 1213007Swpaul * documentation and/or other materials provided with the distribution. 1313007Swpaul * 3. All advertising materials mentioning features or use of this software 1413007Swpaul * must display the following acknowledgement: 1513007Swpaul * This product includes software developed by Bill Paul. 1613007Swpaul * 4. Neither the name of the author nor the names of any co-contributors 1713007Swpaul * may be used to endorse or promote products derived from this software 1813007Swpaul * without specific prior written permission. 1913007Swpaul * 2013007Swpaul * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND 2113007Swpaul * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2213007Swpaul * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2313007Swpaul * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR CONTRIBUTORS BE LIABLE 2413007Swpaul * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2513007Swpaul * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2613007Swpaul * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2713007Swpaul * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2813007Swpaul * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2913007Swpaul * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3013007Swpaul * SUCH DAMAGE. 3113007Swpaul * 3250476Speter * $FreeBSD$ 3313007Swpaul */ 3413007Swpaul#include <sys/types.h> 3513007Swpaul#include <limits.h> 3616132Swpaul#include <paths.h> 3713007Swpaul#include <db.h> 3820862Swpaul#include <rpcsvc/yp.h> 3913007Swpaul 4016132Swpaulextern HASHINFO openinfo; 4116132Swpaulextern BTREEINFO openinfo_b; 4216132Swpaul 4313007Swpaul#ifndef _PATH_YP 4413007Swpaul#define _PATH_YP "/var/yp/" 4513007Swpaul#endif 4613007Swpaul 4713007Swpaulextern char *yp_dir; 4813007Swpaulextern int debug; 49228599Sdimextern enum ypstat yp_errno; 5090297Sdesextern void yp_error(const char *, ...); 5190297Sdesextern int _yp_check(char **); 5293979Sdesextern const char *ypxfrerr_string(ypxfrstat); 5390297Sdesextern DB *yp_open_db_rw(const char *, const char *, const int); 5490297Sdesextern void yp_init_dbs(void); 5590297Sdesextern int yp_put_record(DB *, DBT *, DBT *, int); 5690297Sdesextern int yp_get_record(const char *, const char *, const DBT *, DBT *, int); 5790298Sdesextern int ypxfr_get_map(char *, char *, char *, int (*)(int, char *, int, char *, int, char*)); 5890297Sdesextern char *ypxfr_get_master(char *, char *, char *, const int); 5990297Sdesextern unsigned long ypxfr_get_order(char *, char *, char *, const int); 6090297Sdesextern int ypxfr_match(char *, char *, char *, char *, unsigned long); 6190297Sdesextern char *ypxfxerr_string(ypxfrstat); 6290297Sdesextern int ypxfrd_get_map(char *, char *, char *, char *); 63