11832Swollman/* 21832Swollman * Copyright (c) 1992/3 Theo de Raadt <deraadt@fsa.ca> 31832Swollman * All rights reserved. 41832Swollman * 51832Swollman * Redistribution and use in source and binary forms, with or without 61832Swollman * modification, are permitted provided that the following conditions 71832Swollman * are met: 81832Swollman * 1. Redistributions of source code must retain the above copyright 91832Swollman * notice, this list of conditions and the following disclaimer. 101832Swollman * 2. Redistributions in binary form must reproduce the above copyright 111832Swollman * notice, this list of conditions and the following disclaimer in the 121832Swollman * documentation and/or other materials provided with the distribution. 131832Swollman * 3. The name of the author may not be used to endorse or promote 141832Swollman * products derived from this software without specific prior written 151832Swollman * permission. 161832Swollman * 171832Swollman * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 181832Swollman * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 191832Swollman * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 201832Swollman * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 211832Swollman * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 221832Swollman * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 231832Swollman * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 241832Swollman * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 251832Swollman * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 261832Swollman * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 271832Swollman * SUCH DAMAGE. 281832Swollman * 2950473Speter * $FreeBSD$ 301832Swollman */ 311832Swollman 3221060Speter#ifndef _RPCSVC_YPCLNT_H_ 3321060Speter#define _RPCSVC_YPCLNT_H_ 341832Swollman 3532552Sbde#include <sys/cdefs.h> 3632552Sbde 371832Swollman#define YPERR_BADARGS 1 /* args to function are bad */ 381832Swollman#define YPERR_RPC 2 /* RPC failure */ 391832Swollman#define YPERR_DOMAIN 3 /* can't bind to a server for domain */ 401832Swollman#define YPERR_MAP 4 /* no such map in server's domain */ 411832Swollman#define YPERR_KEY 5 /* no such key in map */ 421832Swollman#define YPERR_YPERR 6 /* some internal YP server or client error */ 431832Swollman#define YPERR_RESRC 7 /* local resource allocation failure */ 441832Swollman#define YPERR_NOMORE 8 /* no more records in map database */ 451832Swollman#define YPERR_PMAP 9 /* can't communicate with portmapper */ 461832Swollman#define YPERR_YPBIND 10 /* can't communicate with ypbind */ 471832Swollman#define YPERR_YPSERV 11 /* can't communicate with ypserv */ 481832Swollman#define YPERR_NODOM 12 /* local domain name not set */ 491832Swollman#define YPERR_BADDB 13 /* YP data base is bad */ 501832Swollman#define YPERR_VERS 14 /* YP version mismatch */ 511832Swollman#define YPERR_ACCESS 15 /* access violation */ 521832Swollman#define YPERR_BUSY 16 /* database is busy */ 531832Swollman 541832Swollman/* 551832Swollman * Types of update operations 561832Swollman */ 571832Swollman#define YPOP_CHANGE 1 /* change, do not add */ 581832Swollman#define YPOP_INSERT 2 /* add, do not change */ 591832Swollman#define YPOP_DELETE 3 /* delete this entry */ 601832Swollman#define YPOP_STORE 4 /* add, or change */ 618858Srgrimes 621832Swollmanstruct ypall_callback { 6321060Speter /* return non-0 to stop getting called */ 6490297Sdes int (*foreach)(unsigned long, char *, int, char *, int, void *); 651832Swollman char *data; /* opaque pointer for use of callback fn */ 661832Swollman}; 671832Swollman 6832552Sbdestruct dom_binding; 69121577Speterstruct ypmaplist; 70121577Speterstruct ypall_callback; 7132552Sbde 7221060Speter__BEGIN_DECLS 7390297Sdesint yp_bind(char *dom); 7490297Sdesint _yp_dobind(char *dom, struct dom_binding **ypdb); 7590297Sdesvoid yp_unbind(char *dom); 7690297Sdesint yp_get_default_domain(char **domp); 7793032Simpint yp_match(char *indomain, char *inmap, const char *inkey, int inkeylen, 7893032Simp char **outval, int *outvallen); 7993032Simpint yp_first(char *indomain, char *inmap, char **outkey, int *outkeylen, 8093032Simp char **outval, int *outvallen); 8193032Simpint yp_next(char *indomain, char *inmap, char *inkey, int inkeylen, 8293032Simp char **outkey, int *outkeylen, char **outval, int *outvallen); 83121549Speterint yp_maplist(char *indomain, struct ypmaplist **outmaplist); 8490297Sdesint yp_master(char *indomain, char *inmap, char **outname); 8590297Sdesint yp_order(char *indomain, char *inmap, int *outorder); 8693032Simpint yp_all(char *indomain, char *inmap, struct ypall_callback *incallback); 8795658Sdesconst char *yperr_string(int incode); 8895658Sdesconst char *ypbinderr_string(int incode); 8990297Sdesint ypprot_err(unsigned int incode); 9021060Speter__END_DECLS 911832Swollman 9221060Speter#endif /* _RPCSVC_YPCLNT_H_ */ 931832Swollman 94