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