1/*	$OpenBSD: ypclnt.h,v 1.10 2016/05/30 02:53:29 guenther Exp $	*/
2/*	$NetBSD: ypclnt.h,v 1.7 1995/07/14 21:11:10 christos Exp $	*/
3
4/*
5 * Copyright (c) 1992, 1993 Theo de Raadt <deraadt@openbsd.org>
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 *    notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 *    notice, this list of conditions and the following disclaimer in the
15 *    documentation and/or other materials provided with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
18 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#ifndef _RPCSVC_YPCLNT_H_
31#define _RPCSVC_YPCLNT_H_
32
33#define YPERR_BADARGS	1		/* args to function are bad */
34#define YPERR_RPC	2		/* RPC failure */
35#define YPERR_DOMAIN	3		/* can't bind to a server for domain */
36#define YPERR_MAP	4		/* no such map in server's domain */
37#define YPERR_KEY	5		/* no such key in map */
38#define YPERR_YPERR	6		/* some internal YP server or client error */
39#define YPERR_RESRC	7		/* local resource allocation failure */
40#define YPERR_NOMORE	8		/* no more records in map database */
41#define YPERR_PMAP	9		/* can't communicate with portmapper */
42#define YPERR_YPBIND	10		/* can't communicate with ypbind */
43#define YPERR_YPSERV	11		/* can't communicate with ypserv */
44#define YPERR_NODOM	12		/* local domain name not set */
45#define YPERR_BADDB	13		/* YP data base is bad */
46#define YPERR_VERS	14		/* YP version mismatch */
47#define YPERR_ACCESS	15		/* access violation */
48#define YPERR_BUSY	16		/* database is busy */
49
50/*
51 * Types of update operations
52 */
53#define YPOP_CHANGE	1		/* change, do not add */
54#define YPOP_INSERT	2		/* add, do not change */
55#define YPOP_DELETE	3		/* delete this entry */
56#define YPOP_STORE	4		/* add, or change */
57
58struct ypall_callback {
59	/* return non-0 to stop getting called */
60	int (*foreach)(unsigned long, char *, int, char *, int, void *);
61	char *data;		/* opaque pointer for use of callback fn */
62};
63
64__BEGIN_DECLS
65int	yp_bind(const char *);
66void	yp_unbind(const char *);
67int	yp_get_default_domain(char **);
68int	yp_match(const char *, const char *, const char *, int , char **,
69	    int *);
70int	yp_first(const char *, const char *, char **, int *, char **, int *);
71int	yp_next(const char *, const char *, const char *, int, char **, int *,
72	    char **, int *);
73int	yp_master(const char *, const char *, char **);
74int	yp_order(const char *, const char *, int *);
75int	yp_all(const char *, const char *, struct ypall_callback *);
76char *	yperr_string(int);
77int	ypprot_err(unsigned int);
78struct ypmaplist;
79int	yp_maplist(const char *, struct ypmaplist **);
80__END_DECLS
81
82#endif /* _RPCSVC_YPCLNT_H_ */
83