xref: /dragonfly/include/rpcsvc/nislib.h (revision c8860c9a)
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, MERCHANTABILITY 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  * $FreeBSD: src/include/rpcsvc/nislib.h,v 1.4 2002/03/23 17:24:55 imp Exp $
30  */
31 
32 /*
33  * Copyright (c) 1991, Sun Microsystems Inc.
34  */
35 
36 /*
37  * This file contains the interfaces that are visible in the SunOS 5.x
38  * implementation of NIS Plus.
39  */
40 
41 #ifndef	_RPCSVC_NISLIB_H
42 #define	_RPCSVC_NISLIB_H
43 
44 /* From: #pragma ident	"@(#)nislib.h	1.16	94/05/03 SMI" */
45 
46 #include <sys/cdefs.h>
47 
48 #define	NUL '\0'
49 
50 struct signature {
51 	int signature_len;
52 	char *signature_val;
53 };
54 
55 __BEGIN_DECLS
56 
57 void		 nis_freeresult(nis_result *);
58 nis_result 	*nis_lookup(nis_name, u_long);
59 nis_result	*nis_list(nis_name, u_long,
60 			  int (*)(nis_name, nis_object *, void *), void *);
61 nis_result 	*nis_add(nis_name, nis_object *);
62 nis_result 	*nis_remove(nis_name, nis_object *);
63 nis_result 	*nis_modify(nis_name, nis_object *);
64 
65 nis_result 	*nis_add_entry(nis_name, nis_object *, u_long);
66 nis_result 	*nis_remove_entry(nis_name, nis_object *, u_long);
67 nis_result 	*nis_modify_entry(nis_name, nis_object *, u_long);
68 nis_result 	*nis_first_entry(nis_name);
69 nis_result 	*nis_next_entry(nis_name, netobj *);
70 
71 nis_error	 nis_mkdir(nis_name, nis_server *);
72 nis_error	 nis_rmdir(nis_name, nis_server *);
73 name_pos	 nis_dir_cmp(nis_name, nis_name);
74 
75 nis_name	*nis_getnames(nis_name);
76 void		 nis_freenames(nis_name *);
77 nis_name	 nis_domain_of(nis_name);
78 nis_name	 nis_leaf_of(nis_name);
79 nis_name	 nis_leaf_of_r(const nis_name, char *, size_t);
80 nis_name	 nis_name_of(nis_name);
81 nis_name	 nis_local_group(void);
82 nis_name	 nis_local_directory(void);
83 nis_name	 nis_local_principal(void);
84 nis_name	 nis_local_host(void);
85 
86 void		 nis_destroy_object(nis_object *);
87 nis_object	*nis_clone_object(nis_object *, nis_object *);
88 void		 nis_print_object(nis_object *);
89 
90 char		*nis_sperrno(nis_error);
91 void		 nis_perror(nis_error, char *);
92 char		*nis_sperror(nis_error, char *);
93 void		 nis_lerror(nis_error, char *);
94 
95 void		 nis_print_group_entry(nis_name);
96 bool_t		 nis_ismember(nis_name, nis_name);
97 nis_error	 nis_creategroup(nis_name, u_long);
98 nis_error	 nis_destroygroup(nis_name);
99 nis_error	 nis_addmember(nis_name, nis_name);
100 nis_error	 nis_removemember(nis_name, nis_name);
101 nis_error	 nis_verifygroup(nis_name);
102 
103 void		 nis_freeservlist(nis_server **);
104 nis_server *	*nis_getservlist(nis_name);
105 nis_error	 nis_stats(nis_server *, nis_tag *, int, nis_tag **);
106 nis_error	 nis_servstate(nis_server *, nis_tag *, int, nis_tag **);
107 void		 nis_freetags(nis_tag *, int);
108 
109 nis_result	 *nis_checkpoint(nis_name);
110 void		 nis_ping(nis_name, u_long, nis_object *);
111 
112 /*
113  * XXX: PLEASE NOTE THAT THE FOLLOWING FUNCTIONS ARE INTERNAL
114  * TO NIS+ AND SHOULD NOT BE USED BY ANY APPLICATION PROGRAM.
115  * THEIR SEMANTICS AND/OR SIGNATURE CAN CHANGE WITHOUT NOTICE.
116  * SO, PLEASE DO NOT USE THEM.  YOU ARE WARNED!!!!
117  */
118 
119 char		**__break_name(nis_name, int *);
120 int		 __name_distance(char **, char **);
121 nis_result	*nis_make_error(nis_error, u_long, u_long, u_long, u_long);
122 nis_attr 	*__cvt2attr(int *, char **);
123 void 		nis_free_request(ib_request *);
124 nis_error	 nis_get_request(nis_name, nis_object *, netobj*, ib_request*);
125 nis_object	*nis_read_obj(char *);
126 int		 nis_write_obj(char *, nis_object *);
127 int		 nis_in_table(nis_name, NIS_HASH_TABLE *, int *);
128 int		 nis_insert_item(NIS_HASH_ITEM *, NIS_HASH_TABLE *);
129 NIS_HASH_ITEM	*nis_find_item(nis_name, NIS_HASH_TABLE *);
130 NIS_HASH_ITEM	*nis_remove_item(nis_name, NIS_HASH_TABLE *);
131 void		 nis_insert_name(nis_name, NIS_HASH_TABLE *);
132 void		 nis_remove_name(nis_name, NIS_HASH_TABLE *);
133 CLIENT		 *nis_make_rpchandle(nis_server *, int, u_long, u_long, u_long,
134 				     int, int);
135 void		*nis_get_static_storage(struct nis_sdata *, u_long, u_long);
136 char		*nis_data(char *);
137 void		 nis_print_rights(u_long);
138 void		 nis_print_directory(directory_obj *);
139 void		 nis_print_group(group_obj *);
140 void		 nis_print_table(table_obj *);
141 void		 nis_print_link(link_obj *);
142 void		 nis_print_entry(entry_obj *);
143 nis_object	*nis_get_object(char *, char *, char *, u_long, u_long,
144 				zotypes);
145 nis_server	*__nis_init_callback(CLIENT *,
146 			int (*)(nis_name, nis_object *, void *), void *);
147 int		 nis_getdtblsize(void);
148 int		 __nis_run_callback(netobj *, u_long, struct timeval *, CLIENT *);
149 
150 log_result	*nis_dumplog(nis_server *, nis_name, u_long);
151 log_result	*nis_dump(nis_server *, nis_name,
152 			  int (*)(nis_name, nis_object *, void *));
153 
154 bool_t		 __do_ismember(nis_name, nis_name,
155 			       nis_result *(*)(nis_name, u_long));
156 nis_name	 __nis_map_group(nis_name);
157 nis_name	 __nis_map_group_r(nis_name, char*, size_t);
158 
159 nis_error	 __nis_CacheBind(char *, directory_obj *);
160 nis_error	 __nis_CacheSearch(char *, directory_obj *);
161 bool_t		 __nis_CacheRemoveEntry(directory_obj *);
162 void		 __nis_CacheRestart(void);
163 void		 __nis_CachePrint(void);
164 void		 __nis_CacheDumpStatistics(void);
165 bool_t		 writeColdStartFile(directory_obj *);
166 
167 CLIENT		*__get_ti_clnt(char *, CLIENT *, char **, pid_t *);
168 int		 __strcmp_case_insens(char *, char *);
169 int		 __strncmp_case_insens(char *, char *);
170 
171 fd_result	*nis_finddirectory(directory_obj *, nis_name);
172 int		 __start_clock(int);
173 u_long		 __stop_clock(int);
174 
175 /*
176  * This particular function is part of the FreeBSD NIS+ implementation
177  * only. Ideally it should be somewhere else, but it is used by both
178  * rpc.nisd and nis_cachemgr, and there aren't that many headers common
179  * to both programs.
180  */
181 
182 struct signature *__nis_calculate_encrypted_cksum(unsigned char *,
183 						  unsigned int, char *, int);
184 
185 __END_DECLS
186 
187 #endif	/* _RPCSVC_NISLIB_H */
188