xref: /freebsd/include/rpcsvc/nislib.h (revision f5463265955b829775bbb32e1fd0bc11dafc36ce)
1 /*
2  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
3  * unrestricted use provided that this legend is included on all tape
4  * media and as a part of the software program in whole or part.  Users
5  * may copy or modify Sun RPC without charge, but are not authorized
6  * to license or distribute it to anyone else except as part of a product or
7  * program developed by the user.
8  *
9  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
10  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
11  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
12  *
13  * Sun RPC is provided with no support and without any obligation on the
14  * part of Sun Microsystems, Inc. to assist in its use, correction,
15  * modification or enhancement.
16  *
17  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
18  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
19  * OR ANY PART THEREOF.
20  *
21  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
22  * or profits or other special, indirect and consequential damages, even if
23  * Sun has been advised of the possibility of such damages.
24  *
25  * Sun Microsystems, Inc.
26  * 2550 Garcia Avenue
27  * Mountain View, California  94043
28  */
29 
30 /*
31  * Copyright (c) 1991, Sun Microsystems Inc.
32  */
33 
34 /*
35  * This file contains the interfaces that are visible in the SunOS 5.x
36  * implementation of NIS Plus.
37  */
38 
39 #ifndef	_RPCSVC_NISLIB_H
40 #define	_RPCSVC_NISLIB_H
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 struct signature {
47 	int signature_len;
48 	char *signature_val;
49 };
50 
51 extern void nis_freeresult(nis_result *);
52 extern nis_result * nis_lookup(nis_name, u_long);
53 extern nis_result * nis_list(nis_name, u_long,
54 	int (*)(nis_name, nis_object *, void *), void *);
55 extern nis_result * nis_add(nis_name, nis_object *);
56 extern nis_result * nis_remove(nis_name, nis_object *);
57 extern nis_result * nis_modify(nis_name, nis_object *);
58 
59 extern nis_result * nis_add_entry(nis_name, nis_object *, u_long);
60 extern nis_result * nis_remove_entry(nis_name, nis_object *, u_long);
61 extern nis_result * nis_modify_entry(nis_name, nis_object *, u_long);
62 extern nis_result * nis_first_entry(nis_name);
63 extern nis_result * nis_next_entry(nis_name, netobj *);
64 
65 extern nis_error nis_mkdir(nis_name, nis_server *);
66 extern nis_error nis_rmdir(nis_name, nis_server *);
67 extern name_pos nis_dir_cmp(nis_name, nis_name);
68 
69 extern nis_name * nis_getnames(nis_name);
70 extern void nis_freenames(nis_name *);
71 extern nis_name nis_domain_of(nis_name);
72 extern nis_name nis_leaf_of(nis_name);
73 extern nis_name nis_leaf_of_r(const nis_name, char *, size_t);
74 extern nis_name nis_name_of(nis_name);
75 extern nis_name nis_local_group(void);
76 extern nis_name nis_local_directory(void);
77 extern nis_name nis_local_principal(void);
78 extern nis_name nis_local_host(void);
79 
80 extern void nis_destroy_object(nis_object *);
81 extern nis_object * nis_clone_object(nis_object *, nis_object *);
82 extern void nis_print_object(nis_object *);
83 
84 extern char * nis_sperrno(nis_error);
85 extern void nis_perror(nis_error, char *);
86 extern char * nis_sperror(nis_error, char *);
87 extern void nis_lerror(nis_error, char *);
88 
89 extern void nis_print_group_entry(nis_name);
90 extern bool_t nis_ismember(nis_name, nis_name);
91 extern nis_error nis_creategroup(nis_name, u_long);
92 extern nis_error nis_destroygroup(nis_name);
93 extern nis_error nis_addmember(nis_name, nis_name);
94 extern nis_error nis_removemember(nis_name, nis_name);
95 extern nis_error nis_verifygroup(nis_name);
96 
97 extern void nis_freeservlist(nis_server **);
98 extern nis_server ** nis_getservlist(nis_name);
99 extern nis_error nis_stats(nis_server *, nis_tag *, int, nis_tag **);
100 extern nis_error nis_servstate(nis_server *, nis_tag *, int, nis_tag **);
101 extern void nis_freetags(nis_tag *, int);
102 
103 extern nis_result * nis_checkpoint(nis_name);
104 extern void nis_ping(nis_name, u_long, nis_object *);
105 
106 /*
107  * XXX: PLEASE NOTE THAT THE FOLLOWING FUNCTIONS ARE INTERNAL
108  * TO NIS+ AND SHOULD NOT BE USED BY ANY APPLICATION PROGRAM.
109  * THEIR SEMANTICS AND/OR SIGNATURE CAN CHANGE WITHOUT NOTICE.
110  * SO, PLEASE DO NOT USE THEM.  YOU ARE WARNED!!!!
111  */
112 
113 extern char ** __break_name(nis_name, int *);
114 extern int __name_distance(char **, char **);
115 extern nis_result * nis_make_error(nis_error, u_long, u_long, u_long, u_long);
116 extern nis_attr * __cvt2attr(int *, char **);
117 extern void nis_free_request(ib_request *);
118 extern nis_error nis_get_request(nis_name, nis_object *, netobj*, ib_request*);
119 extern nis_object * nis_read_obj(char *);
120 extern int nis_write_obj(char *, nis_object *);
121 extern int nis_in_table(nis_name, NIS_HASH_TABLE *, int *);
122 extern int nis_insert_item(NIS_HASH_ITEM *, NIS_HASH_TABLE *);
123 extern NIS_HASH_ITEM * nis_find_item(nis_name, NIS_HASH_TABLE *);
124 extern NIS_HASH_ITEM * nis_remove_item(nis_name, NIS_HASH_TABLE *);
125 extern void nis_insert_name(nis_name, NIS_HASH_TABLE *);
126 extern void nis_remove_name(nis_name, NIS_HASH_TABLE *);
127 extern CLIENT * nis_make_rpchandle(nis_server *, int, u_long, u_long, u_long,
128 								int, int);
129 extern void * nis_get_static_storage(struct nis_sdata *, u_long, u_long);
130 extern char * nis_data(char *);
131 extern void nis_print_rights(u_long);
132 extern void nis_print_directory(directory_obj *);
133 extern void nis_print_group(group_obj *);
134 extern void nis_print_table(table_obj *);
135 extern void nis_print_link(link_obj *);
136 extern void nis_print_entry(entry_obj *);
137 extern nis_object * nis_get_object(char *, char *, char *, u_long, u_long,
138 								    zotypes);
139 extern nis_server * __nis_init_callback(CLIENT *,
140     int (*)(nis_name, nis_object *, void *), void *);
141 extern int nis_getdtblsize(void);
142 extern int __nis_run_callback(netobj *, u_long, struct timeval *, CLIENT *);
143 
144 extern log_result *nis_dumplog(nis_server *, nis_name, u_long);
145 extern log_result *nis_dump(nis_server *, nis_name,
146     int (*)(nis_name, nis_object *, void *));
147 
148 extern bool_t __do_ismember(nis_name, nis_name,
149     nis_result *(*)(nis_name, u_long));
150 extern nis_name __nis_map_group(nis_name);
151 extern nis_name __nis_map_group_r(nis_name, char*, size_t);
152 
153 extern nis_error __nis_CacheBind(char *, directory_obj *);
154 extern nis_error __nis_CacheSearch(char *, directory_obj *);
155 extern bool_t __nis_CacheRemoveEntry(directory_obj *);
156 extern void __nis_CacheRestart(void);
157 extern void __nis_CachePrint(void);
158 extern void __nis_CacheDumpStatistics(void);
159 extern bool_t writeColdStartFile(directory_obj *);
160 
161 extern CLIENT * __get_ti_clnt(char *, CLIENT *, char **, pid_t *);
162 extern int __strcmp_case_insens(char *, char *);
163 extern int __strncmp_case_insens(char *, char *);
164 
165 extern fd_result * nis_finddirectory(directory_obj *, nis_name);
166 extern int __start_clock(int);
167 extern u_long __stop_clock(int);
168 
169 /*
170  * This particular function is part of the FreeBSD NIS+ implementation
171  * only. Ideally it should be somewhere else, but it is used by both
172  * rpc.nisd and nis_cachemgr, and there aren't that many headers common
173  * to both programs.
174  */
175 
176 extern struct signature *__nis_calculate_encrypted_cksum(unsigned char *, unsigned int, char *, int);
177 
178 #define	NUL '\0'
179 
180 #ifdef	__cplusplus
181 }
182 #endif
183 
184 #endif	/* _RPCSVC_NISLIB_H */
185