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]
24 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
25 * Use is subject to license terms.
28 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
29 /* All Rights Reserved */
32 * Portions of this source code were derived from Berkeley 4.3 BSD
33 * under license from the Regents of the University of California.
39 #pragma ident "%Z%%M% %I% %E% SMI"
45 #include <rpc/types.h>
46 #include <netconfig.h>
51 extern bool_t
xdr_netconfig(XDR
*, struct netconfig
*);
53 #define BINDING "/var/yp/binding"
57 struct dom_binding
*dom_pnext
;
59 struct ypbind_binding
*dom_binding
;
62 int fd
; /* fd in dom_client */
63 dev_t rdev
; /* device id of fd */
64 int ref_count
; /* number of threads using this structure */
65 int need_free
; /* if true, this structure needs to be freed */
66 mutex_t server_name_lock
; /* protects server name in dom_binding */
69 /* Following structure is used only by ypbind */
72 struct domain
*dom_pnext
;
75 unsigned short dom_vers
; /* only YPVERS */
76 unsigned int dom_error
;
78 struct ypbind_binding
*dom_binding
;
79 int dom_report_success
; /* Controls msg to /dev/console */
80 int dom_broadcaster_pid
;
81 int bindfile
; /* File with binding info in it */
83 FILE *broadcaster_pipe
; /* to get answer from locater */
84 XDR broadcaster_xdr
; /* xdr for pipe */
85 struct timeval lastping
; /* info to avoid a ping storm */
88 enum ypbind_resptype
{
92 typedef enum ypbind_resptype ypbind_resptype
;
93 extern bool_t
xdr_ypbind_resptype(XDR
*, ypbind_resptype
*);
94 #define YPBIND_ERR_ERR 1 /* Internal error */
95 #define YPBIND_ERR_NOSERV 2 /* No bound server for passed domain */
96 #define YPBIND_ERR_RESC 3 /* System resource allocation failure */
97 #define YPBIND_ERR_NODOMAIN 4 /* Domain doesn't exist */
99 /* Following struct is used only by ypwhich and yppoll */
101 struct ypbind_domain
{
102 char *ypbind_domainname
;
103 rpcvers_t ypbind_vers
;
105 typedef struct ypbind_domain ypbind_domain
;
106 extern bool_t
xdr_ypbind_domain(XDR
*, ypbind_domain
*);
109 * This structure is used to store information about the server
110 * Returned by ypbind to the libnsl/yp clients to contact ypserv.
111 * Also used by ypxfr.
114 struct ypbind_binding
{
115 struct netconfig
*ypbind_nconf
;
116 struct netbuf
*ypbind_svcaddr
;
117 char *ypbind_servername
;
118 rpcvers_t ypbind_hi_vers
;
119 rpcvers_t ypbind_lo_vers
;
121 typedef struct ypbind_binding ypbind_binding
;
122 extern bool_t
xdr_ypbind_binding(XDR
*, ypbind_binding
*);
125 ypbind_resptype ypbind_status
;
128 struct ypbind_binding
*ypbind_bindinfo
;
131 typedef struct ypbind_resp ypbind_resp
;
132 extern bool_t
xdr_ypbind_resp(XDR
*, ypbind_resp
*);
134 struct ypbind_setdom
{
135 char *ypsetdom_domain
;
136 struct ypbind_binding
*ypsetdom_bindinfo
;
138 typedef struct ypbind_setdom ypbind_setdom
;
139 extern bool_t
xdr_ypbind_setdom(XDR
*, ypbind_setdom
*);
141 #define YPBINDPROG ((rpcprog_t)100007)
142 #define YPBINDVERS ((rpcvers_t)3)
143 #define YPBINDPROC_NULL ((rpcproc_t)0)
144 extern void *ypbindproc_null_3();
145 #define YPBINDPROC_DOMAIN ((rpcproc_t)1)
146 extern ypbind_resp
*ypbindproc_domain_3();
147 #define YPBINDPROC_SETDOM ((rpcproc_t)2)
148 extern void *ypbindproc_setdom_3();
150 extern struct timeval _ypserv_timeout
;
151 extern unsigned int _ypsleeptime
;
153 extern int __yp_dobind(char *, struct dom_binding
**);
154 extern int __yp_dobind_rsvdport(char *, struct dom_binding
**);
155 extern void free_dom_binding(struct dom_binding
*);
156 extern CLIENT
*__yp_clnt_create_rsvdport(const char *, rpcprog_t
,
157 rpcvers_t
, const char *, const uint_t
, const uint_t
);
158 extern void __yp_rel_binding(struct dom_binding
*);
159 extern CLIENT
*__clnt_create_loopback(rpcprog_t
, rpcvers_t
, int *);