4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 1990 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
31 * Portions of this source code were derived from Berkeley 4.3 BSD
32 * under license from the Regents of the University of California.
35 #ident "%Z%%M% %I% %E% SMI"
37 #include <rpc/types.h>
38 #include "netconfig.h"
41 extern bool_t
xdr_netconfig();
43 #define BINDING "/var/yp/binding"
50 * This structure is used only in the ypxfr protocol and has
51 * nothing to do with ypbind.
55 struct dom_binding
*dom_pnext
;
57 struct ypbind_binding
*dom_binding
;
61 /* Following structure is used only by ypbind */
64 struct domain
*dom_pnext
;
67 unsigned short dom_vers
; /* only YPVERS */
68 unsigned long dom_error
;
70 struct ypbind_binding
*dom_binding
;
71 int dom_report_success
; /* Controls msg to /dev/console*/
72 int dom_broadcaster_pid
;
73 int bindfile
; /* File with binding info in it */
75 FILE *broadcaster_pipe
; /* to get answer from locater */
76 XDR broadcaster_xdr
; /* xdr for pipe */
77 struct timeval lastping
; /* info to avoid a ping storm */
78 FILE *cache_fp
; /* file pointer opened on cache_file */
79 char *cache_file
; /* cached version of server info */
82 enum ypbind_resptype
{
86 typedef enum ypbind_resptype ypbind_resptype
;
87 bool_t
xdr_ypbind_resptype();
88 #define YPBIND_ERR_ERR 1 /* Internal error */
89 #define YPBIND_ERR_NOSERV 2 /* No bound server for passed domain */
90 #define YPBIND_ERR_RESC 3 /* System resource allocation failure */
91 #define YPBIND_ERR_NODOMAIN 4 /* Domain doesn't exist */
93 /* Following struct is used only by ypwhich and yppoll */
95 struct ypbind_domain
{
96 char *ypbind_domainname
;
99 typedef struct ypbind_domain ypbind_domain
;
100 bool_t
xdr_ypbind_domain();
103 * This structure is used to store information about the server
104 * Returned by ypbind to the libnsl/yp clients to contact ypserv.
105 * Also used by ypxfr.
108 struct ypbind_binding
{
109 struct netconfig
*ypbind_nconf
;
110 struct netbuf
*ypbind_svcaddr
;
111 char *ypbind_servername
;
115 typedef struct ypbind_binding ypbind_binding
;
116 bool_t
xdr_ypbind_binding();
119 ypbind_resptype ypbind_status
;
122 struct ypbind_binding
*ypbind_bindinfo
;
125 typedef struct ypbind_resp ypbind_resp
;
126 bool_t
xdr_ypbind_resp();
128 struct ypbind_setdom
{
129 char *ypsetdom_domain
;
130 struct ypbind_binding
*ypsetdom_bindinfo
;
132 typedef struct ypbind_setdom ypbind_setdom
;
133 bool_t
xdr_ypbind_setdom();
135 #define YPBINDPROG ((u_long)100007)
136 #define YPBINDVERS ((u_long)3)
137 #define YPBINDPROC_NULL ((u_long)0)
138 extern void *ypbindproc_null_3();
139 #define YPBINDPROC_DOMAIN ((u_long)1)
140 extern ypbind_resp
*ypbindproc_domain_3();
141 #define YPBINDPROC_SETDOM ((u_long)2)
142 extern void *ypbindproc_setdom_3();
146 * XXX - compiled and edited from yp.x
147 * These structures are added here to
148 * support binary compatibility with static
149 * apps that use the old ypbind protocol.
150 * These structures are lifted from
151 * 4.x source lib/libc/yp/yp_prot.h
152 * and rename with a suffix _2 to avoid
153 * conflicts with similar structs for
154 * native ypbind protocol, as above.
157 typedef char *domainname_2
;
159 struct ypbind_binding_2
{
160 struct in_addr ypbind_binding_addr
; /* In network order */
161 unsigned short int ypbind_binding_port
; /* In network order */
163 typedef struct ypbind_binding_2 ypbind_binding_2
;
165 struct ypbind_resp_2
{
166 ypbind_resptype ypbind_status
;
168 unsigned long ypbind_error
;
169 ypbind_binding_2 ypbind_bindinfo
;
172 typedef struct ypbind_resp_2 ypbind_resp_2
;
174 struct ypbind_setdom_2
{
175 char ypsetdom_domain
[YPMAXDOMAIN
+ 1];
176 ypbind_binding_2 ypsetdom_binding
;
177 unsigned short ypsetdom_vers
;
179 typedef struct ypbind_setdom_2 ypbind_setdom_2
;
182 * ypbind V2 and ypbind V1 differ only in the "set domain"
183 * procedure, which we don't support.
185 #define YPBINDVERS_2 ((unsigned long)(2))
186 #define YPBINDVERS_1 ((unsigned long)(1))
187 extern ypbind_resp_2
* ypbindproc_domain_2();
188 extern int ypbindprog_2_freeresult();
190 /* the xdr functions */
191 extern bool_t
xdr_ypbind_binding_2();
192 extern bool_t
xdr_ypbind_resp_2();