xref: /titanic_44/usr/src/head/rpcsvc/nislib.h (revision 734b6a94890be549309b21156f8ed6d4561cac51)
1 /*
2  * CDDL HEADER START
3  *
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
7  * with the License.
8  *
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.
13  *
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]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 1991-2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*
28  * nislib.h
29  *
30  * This file contains the interfaces that are visible in the SunOS 5.x
31  * implementation of NIS Plus. When using C++ the defined __cplusplus and
32  * __STDC__ should both be true.
33  */
34 
35 #ifndef	_RPCSVC_NISLIB_H
36 #define	_RPCSVC_NISLIB_H
37 
38 #pragma ident	"%Z%%M%	%I%	%E% SMI"
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 #ifdef __STDC__
45 extern void nis_freeresult(nis_result *);
46 extern nis_result *nis_lookup(nis_name, uint_t);
47 extern nis_result *nis_list(nis_name, uint_t,
48 	int (*)(nis_name, nis_object *, void *), void *);
49 extern nis_result *nis_add(nis_name, nis_object *);
50 extern nis_result *nis_remove(nis_name, nis_object *);
51 extern nis_result *nis_modify(nis_name, nis_object *);
52 
53 extern nis_result *nis_add_entry(nis_name, nis_object *, uint_t);
54 extern nis_result *nis_remove_entry(nis_name, nis_object *, uint_t);
55 extern nis_result *nis_modify_entry(nis_name, nis_object *, uint_t);
56 extern nis_result *nis_first_entry(nis_name);
57 extern nis_result *nis_next_entry(nis_name, netobj *);
58 
59 extern nis_error nis_mkdir(nis_name, nis_server *);
60 extern nis_error nis_rmdir(nis_name, nis_server *);
61 extern name_pos nis_dir_cmp(nis_name, nis_name);
62 
63 extern nis_name *nis_getnames(nis_name);
64 extern void nis_freenames(nis_name *);
65 extern nis_name nis_domain_of(nis_name);
66 extern nis_name nis_leaf_of(nis_name);
67 extern nis_name nis_leaf_of_r(const nis_name, char *, size_t);
68 extern nis_name nis_name_of(nis_name);
69 extern nis_name nis_local_group(void);
70 extern nis_name nis_local_directory(void);
71 extern nis_name nis_local_principal(void);
72 extern nis_name nis_local_host(void);
73 
74 extern void nis_destroy_object(nis_object *);
75 extern nis_object *nis_clone_object(nis_object *, nis_object *);
76 extern void nis_print_object(nis_object *o);
77 
78 extern char *nis_sperrno(nis_error);
79 extern void nis_perror(nis_error, char *);
80 extern char *nis_sperror(nis_error, char *);
81 extern char *nis_sperror_r(nis_error, char *, char *, int len);
82 extern void nis_lerror(nis_error, char *);
83 
84 extern void nis_print_group_entry(nis_name);
85 extern bool_t nis_ismember(nis_name, nis_name);
86 extern nis_error nis_creategroup(nis_name, uint_t);
87 extern nis_error nis_destroygroup(nis_name);
88 extern nis_error nis_addmember(nis_name, nis_name);
89 extern nis_error nis_removemember(nis_name, nis_name);
90 extern nis_error nis_verifygroup(nis_name);
91 
92 extern void nis_freeservlist(nis_server **);
93 extern nis_server **nis_getservlist(nis_name);
94 extern nis_error nis_stats(nis_server *, nis_tag *, int, nis_tag **);
95 extern nis_error nis_servstate(nis_server *, nis_tag *, int, nis_tag **);
96 extern void nis_freetags(nis_tag *, int);
97 
98 extern nis_result *nis_checkpoint(nis_name);
99 extern void nis_ping(nis_name, uint32_t, nis_object *);
100 
101 /*
102  * XXX: PLEASE NOTE THAT THE FOLLOWING FUNCTIONS ARE INTERNAL
103  * TO NIS+ AND SHOULD NOT BE USED BY ANY APPLICATION PROGRAM.
104  * THEIR SEMANTICS AND/OR SIGNATURE CAN CHANGE WITHOUT NOTICE.
105  * SO, PLEASE DO NOT USE THEM.  YOU ARE WARNED!!!!
106  */
107 
108 extern char **__break_name(nis_name, int *);
109 extern int __name_distance(char **, char **);
110 extern nis_result *nis_make_error(nis_error, uint32_t, uint32_t, uint32_t,
111     uint32_t);
112 extern nis_attr *__cvt2attr(int *, char **);
113 extern void nis_free_request(ib_request *);
114 extern nis_error nis_get_request(nis_name, nis_object *, netobj*, ib_request*);
115 extern nis_object *nis_read_obj(char *);
116 extern int nis_write_obj(char *, nis_object *);
117 extern int nis_in_table(nis_name, NIS_HASH_TABLE *, int *);
118 extern int nis_insert_item(NIS_HASH_ITEM *, NIS_HASH_TABLE *);
119 extern NIS_HASH_ITEM *nis_find_item(nis_name, NIS_HASH_TABLE *);
120 extern NIS_HASH_ITEM *nis_remove_item(nis_name, NIS_HASH_TABLE *);
121 extern void nis_insert_name(nis_name, NIS_HASH_TABLE *);
122 extern void nis_remove_name(nis_name, NIS_HASH_TABLE *);
123 extern CLIENT *nis_make_rpchandle(nis_server *, int, rpcprog_t, rpcvers_t,
124     uint_t, int, int);
125 extern void *nis_get_static_storage(struct nis_sdata *, uint_t, uint_t);
126 extern char *nis_data(char *);
127 extern char *nis_old_data(char *);
128 extern void nis_print_rights(uint_t);
129 extern void nis_print_directory(directory_obj *);
130 extern void nis_print_group(group_obj *);
131 extern void nis_print_table(table_obj *);
132 extern void nis_print_link(link_obj *);
133 extern void nis_print_entry(entry_obj *);
134 extern nis_server *__nis_init_callback(CLIENT *,
135     int (*)(nis_name, nis_object *, void *), void *);
136 extern int __nis_run_callback(netobj *, rpcproc_t, struct timeval *, CLIENT *);
137 
138 extern log_result *nis_dumplog(nis_server *, nis_name, uint32_t);
139 extern log_result *nis_dump(nis_server *, nis_name,
140     int (*)(nis_name, nis_object *, void *));
141 extern nis_name __nis_rpc_domain(void);
142 
143 extern bool_t __do_ismember(nis_name, nis_object *,
144     nis_result *(*)(nis_name, uint_t));
145 extern nis_name __nis_map_group(nis_name);
146 extern nis_name __nis_map_group_r(const nis_name, char *, size_t);
147 
148 void __nis_CacheStart(void);
149 nis_error __nis_CacheBind(char *dname, directory_obj *dobj);
150 bool_t __nis_CacheRemoveEntry(directory_obj *dobj);
151 nis_error __nis_CacheSearch(char *dname, directory_obj *dobj);
152 void __nis_CacheRestart(void);
153 void __nis_CachePrint(void);
154 void __nis_CachePrintDir(char *);
155 bool_t __nis_CacheAddEntry(fd_result *, directory_obj *);
156 void __nis_CacheRefreshEntry(char *);
157 nis_error __nis_CacheBindDir(char *dname,
158 		nis_bound_directory **binding, int flags);
159 nis_error __nis_CacheBindMaster(char *dname, nis_bound_directory **binding);
160 nis_error __nis_CacheBindServer(nis_server *srv, int nsrv,
161 		nis_bound_directory **binding);
162 int __nis_CacheRefreshBinding(nis_bound_directory *binding);
163 int __nis_CacheRefreshAddress(nis_bound_endpoint *bep);
164 int __nis_CacheRefreshCallback(nis_bound_endpoint *bep);
165 nis_error __nis_CacheLocalInit(uint32_t *exp_time);
166 uint32_t __nis_CacheLocalLoadPref(void);
167 nis_error __nis_CacheMgrInit(void);
168 void __nis_CacheMgrCleanup(void);
169 void __nis_CacheMgrReadColdstart(void);
170 nis_error __nis_CacheMgrBindReplica(char *dname);
171 nis_error __nis_CacheMgrBindMaster(char *dname);
172 nis_error __nis_CacheMgrBindServer(nis_server *srv, int nsrv);
173 int __nis_CacheMgrRefreshBinding(nis_bound_directory *binding);
174 int __nis_CacheMgrRefreshAddress(nis_bound_endpoint *bep);
175 int __nis_CacheMgrRefreshCallback(nis_bound_endpoint *bep);
176 int __nis_CacheMgrUpdateUaddr(char *uaddr);
177 void __nis_CacheMgrMarkUp(void);
178 uint32_t __nis_CacheMgrTimers(void);
179 uint32_t __nis_CacheMgrRefreshCache(void);
180 uint32_t __nis_serverRefreshCache(void);
181 
182 extern CLIENT *__get_ti_clnt(char *, CLIENT *, char **, pid_t *, dev_t *);
183 extern int __strcmp_case_insens(char *, char *);
184 extern int __strncmp_case_insens(char *, char *);
185 
186 extern fd_result *nis_finddirectory(directory_obj *, nis_name);
187 extern int __start_clock(int);
188 extern uint32_t __stop_clock(int);
189 
190 fd_result *__nis_finddirectory(nis_bound_directory **, char *dname);
191 int __dir_prefix(char **, char **);
192 void __free_break_name(char **, int);
193 void __broken_name_print(char **, int);
194 void __free_fdresult(fd_result *res);
195 nis_error __nis_ping_servers(nis_bound_directory *, int, int);
196 struct netconfig *__nis_get_netconfig(endpoint *ep);
197 int __dir_same(char **, char **);
198 void nis_free_binding(nis_bound_directory *);
199 char *__nis_xdr_dup(xdrproc_t, char *, char *);
200 
201 CLIENT *__nis_clnt_create(int, struct netconfig *, char *, struct netbuf *,
202 			int, int, int, int, int);
203 
204 #else
205 
206 /* Non-prototype definitions (old fashioned C) */
207 
208 extern void nis_freeresult();
209 extern nis_result *nis_lookup();
210 extern nis_result *nis_list();
211 extern nis_result *nis_add();
212 extern nis_result *nis_remove();
213 extern nis_result *nis_modify();
214 
215 extern nis_result *nis_add_entry();
216 extern nis_result *nis_remove_entry();
217 extern nis_result *nis_modify_entry();
218 extern nis_result *nis_first_entry();
219 extern nis_result *nis_next_entry();
220 
221 extern nis_error nis_mkdir();
222 extern nis_error nis_rmdir();
223 extern name_pos nis_dir_cmp();
224 
225 extern nis_name *nis_getnames();
226 extern void nis_freenames();
227 extern nis_name nis_domain_of();
228 extern nis_name nis_leaf_of();
229 extern nis_name nis_leaf_of_r();
230 extern nis_name nis_name_of();
231 extern nis_name nis_local_group();
232 extern nis_name nis_local_directory();
233 extern nis_name nis_local_principal();
234 extern nis_name nis_local_host();
235 
236 extern void nis_destroy_object();
237 extern nis_object *nis_clone_object();
238 extern void nis_print_object();
239 
240 extern char *nis_sperrno();
241 extern void nis_perror();
242 extern char *nis_sperror();
243 extern char *nis_sperror_r();
244 extern void nis_lerror();
245 
246 extern void nis_print_group_entry();
247 extern bool_t nis_ismember();
248 extern nis_error nis_creategroup();
249 extern nis_error nis_destroygroup();
250 extern nis_error nis_addmember();
251 extern nis_error nis_removemember();
252 extern nis_error nis_verifygroup();
253 
254 extern void nis_freeservlist();
255 extern nis_server **nis_getservlist();
256 extern nis_error nis_stats();
257 extern nis_error nis_servstate();
258 extern void nis_freetags();
259 
260 extern nis_result *nis_checkpoint();
261 extern void nis_ping();
262 
263 /*
264  * XXX: PLEASE NOTE THAT THE FOLLOWING FUNCTIONS ARE INTERNAL
265  * TO NIS+ AND SHOULD NOT BE USED BY ANY APPLICATION PROGRAM.
266  * THEIR SEMANTICS AND/OR SIGNATURE CAN CHANGE WITHOUT NOTICE.
267  * SO, PLEASE DO NOT USE THEM.  YOU ARE WARNED!!!!
268  */
269 extern char **__break_name();
270 extern int __name_distance();
271 extern nis_result *nis_make_error();
272 extern nis_attr *__cvt2attr();
273 extern void nis_free_request();
274 extern nis_error nis_get_request();
275 extern nis_object *nis_read_obj();
276 extern int nis_write_obj();
277 extern int nis_in_table();
278 extern int nis_insert_item();
279 extern NIS_HASH_ITEM *nis_find_item();
280 extern NIS_HASH_ITEM *nis_remove_item();
281 extern void nis_insert_name();
282 extern void nis_remove_name();
283 extern CLIENT *nis_make_rpchandle();
284 extern void *nis_get_static_storage();
285 extern char *nis_data();
286 extern char *nis_old_data();
287 
288 extern void nis_print_rights();
289 extern void nis_print_directory();
290 extern void nis_print_group();
291 extern void nis_print_table();
292 extern void nis_print_link();
293 extern void nis_print_entry();
294 
295 extern nis_server *__nis_init_callback();
296 extern int __nis_run_callback();
297 
298 extern log_result *nis_dump();
299 extern log_result *nis_dumplog();
300 extern nis_name __nis_rpc_domain();
301 
302 extern bool_t __do_ismember();
303 extern nis_name __nis_map_group();
304 extern nis_name __nis_map_group_r();
305 
306 void __nis_CacheStart();
307 nis_error __nis_CacheBind();
308 bool_t __nis_CacheRemoveEntry();
309 nis_error __nis_CacheSearch();
310 void __nis_CacheRestart();
311 void __nis_CachePrint();
312 void __nis_CachePrintDir();
313 bool_t __nis_CacheAddEntry();
314 void __nis_CacheRefreshEntry();
315 nis_error __nis_CacheBindDir();
316 nis_error __nis_CacheBindMaster();
317 nis_error __nis_CacheBindServer();
318 int __nis_CacheRefreshBinding();
319 int __nis_CacheRefreshAddress();
320 int __nis_CacheRefreshCallback();
321 nis_error __nis_CacheLocalInit();
322 uint32_t __nis_CacheLocalLoadPref();
323 nis_error __nis_CacheMgrInit();
324 void __nis_CacheMgrCleanup();
325 void __nis_CacheMgrReadColdstart();
326 nis_error __nis_CacheMgrBindReplica();
327 nis_error __nis_CacheMgrBindMaster();
328 nis_error __nis_CacheMgrBindServer();
329 int __nis_CacheMgrRefreshBinding();
330 int __nis_CacheMgrRefreshAddress();
331 int __nis_CacheMgrRefreshCallback();
332 int __nis_CacheMgrUpdateUaddr();
333 void __nis_CacheMgrMarkUp();
334 uint32_t __nis_CacheMgrTimers();
335 uint32_t __nis_CacheMgrRefreshCache();
336 uint32_t __nis_serverRefreshCache();
337 
338 extern CLIENT *__get_ti_clnt();
339 extern int __strcmp_case_insens();
340 extern int __strncmp_case_insens();
341 
342 extern fd_result *nis_finddirectory();
343 extern int __start_clock();
344 extern uint32_t __stop_clock();
345 
346 fd_result *__nis_finddirectory();
347 int __dir_prefix();
348 void __free_break_name();
349 void __broken_name_print();
350 void __free_fdresult();
351 nis_error __nis_ping_servers();
352 struct netconfig *__nis_get_netconfig();
353 int __dir_same();
354 void nis_free_binding();
355 char *__nis_xdr_dup();
356 
357 CLIENT *__nis_clnt_create();
358 
359 #endif
360 
361 #ifdef	__cplusplus
362 }
363 #endif
364 
365 #endif	/* _RPCSVC_NISLIB_H */
366