Update.
[glibc.git] / nis / rpcsvc / nislib.h
blob016bedc769c1c9644a600f4c13b0f6c070540d57
1 /* Copyright (C) 1997 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If not,
17 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
20 #ifndef __RPCSVC_NISLIB_H__
21 #define __RPCSVC_NISLIB_H__
23 #include <features.h>
25 __BEGIN_DECLS
27 typedef const char *const_nis_name;
29 /* nis_names: These functions are used to locate and manipulate all NIS+
30 * objects except the NIS+ entry objects.
32 * nis_lookup (name, flags) resolves a NIS+ name and returns a copy of
33 * that object from a NIS+ server.
34 * const nis_name name: name of the object to be resolved
35 * u_long flags: logically ORing zero or more flags (FOLLOW_LINKS,
36 * HARD_LOOKUP, [NO_CACHE], MASTER_ONLY, EXPAND_NAME)
38 * nis_add (name, obj) adds objects to the NIS+ namespace.
39 * const nis_name name: fully qualified NIS+ name.
40 * const nis_object *obj: object members zo_name and zo_domain will be
41 * constructed from name.
43 * nis_remove (name, obj) removes objects from the NIS+ namespace.
44 * const nis_name name: fully qualified NIS+ name.
45 * const nis_object *obj: if not NULL, it is assumed to point to a copy
46 * of the object being removed. In this case, if
47 * the object on the server does not have the same
48 * object identifier as the object being passed,
49 * the operation will fail with the NIS_NOTSAMEOBJ
50 * error.
52 * nis_modify (name, obj) can change specific attributes of an object
53 * that already exists in the namespace.
55 extern nis_result *nis_lookup __P ((const_nis_name name, u_long flags));
56 extern nis_result *nis_add __P ((const_nis_name name, const nis_object *obj));
57 extern nis_result *nis_remove __P ((const_nis_name name,
58 const nis_object *obj));
59 extern nis_result *nis_modify __P ((const_nis_name name,
60 const nis_object *obj));
62 /* nis_tables: These functions are used to search and modify NIS+ tables.
64 * nis_list (table_name, flags, callback(table_name, obj, userdata), userdata)
65 * search a table in the NIS+ namespace.
66 * const nis_name table_name: indexed name ([xx=yy],table.dir)
67 * u_long flags: logically ORing one or more flags (FOLLOW_LINKS,
68 * [FOLLOW_PATH], HARD_LOOKUP, [ALL_RESULTS], [NO_CACHE],
69 * MASTER_ONLY, EXPAND_NAME, RETURN_RESULT)
70 * callback(): callback is an optional pointer to a function that will
71 * process the ENTRY type objects that are returned from the
72 * search. If this pointer is NULL, then all entries that match
73 * the search criteria are returned in the nis_result structure,
74 * otherwise this function will be called once for each
75 * entry returned.
76 * void *userdata: passed to callback function along with the returned
77 * entry object.
79 * nis_add_entry (table_name, obj, flags) will add the NIS+ object to the
80 * NIS+ table_name.
81 * const nis_name table_name
82 * const nis_object *obj
83 * u_long flags: 0, ADD_OVERWRITE, RETURN_RESULT
85 * nis_modify_entry (name, obj, flags) modifies an object identified by name.
86 * const nis_name name: object identifier
87 * const nis_object *obj: should point to an entry with the EN_MODIFIED
88 * flag set in each column that contains new
89 * information.
90 * u_long flags: 0, MOD_SAMEOBJ, RETURN_RESULT
92 * nis_remove_entry (table_name, obj, flags) removes a set of entries
93 * identified by table_name from the table.
94 * const nis_name table_name: indexed NIS+ name
95 * const nis_object *obj: if obj is non-null, it is presumed to point to
96 * a cached copy of the entry. When the removal is
97 * attempted, and the object that would be removed
98 * is not the same as the cached object pointed to
99 * by object then the operation will fail with an
100 * NIS_NOTSAMEOBJ error
101 * u_long flags: 0, REM_MULTIPLE
103 * nis_first_entry (table_name) fetches entries from a table one at a time.
104 * const nis_name table_name
106 * nis_next_entry (table_name, cookie) retrieves the "next" entry from a
107 * table specified by table_name.
108 * const nis_name table_name:
109 * const netobj *cookie: The value of cookie from the nis_result structure
110 * form the previous call.
112 extern nis_result *nis_list __P ((const_nis_name name, u_long flags,
113 int (*callback)(const_nis_name table_name,
114 const nis_object *obj,
115 const void *userdata),
116 const void *userdata));
117 extern nis_result *nis_add_entry __P ((const_nis_name table_name,
118 const nis_object *obj, u_long flags));
119 extern nis_result *nis_modify_entry __P ((const_nis_name name,
120 const nis_object *obj,
121 u_long flags));
122 extern nis_result *nis_remove_entry __P ((const_nis_name table_name,
123 const nis_object *obj,
124 u_long flags));
125 extern nis_result *nis_first_entry __P ((const_nis_name table_name));
126 extern nis_result *nis_next_entry __P ((const_nis_name table_name,
127 const netobj *cookie));
129 ** nis_server
131 extern nis_error nis_mkdir __P ((const_nis_name dirname,
132 const nis_server *machine));
133 extern nis_error nis_rmdir __P ((const_nis_name dirname,
134 const nis_server *machine));
135 extern nis_error nis_servstate __P ((const nis_server *machine,
136 const nis_tag *tags, int numtags,
137 nis_tag **result));
138 extern nis_error nis_stats __P ((const nis_server *machine,
139 const nis_tag *tags, int numtags,
140 nis_tag **result));
141 extern void nis_freetags __P ((nis_tag *tags, int numtags));
142 extern nis_server **nis_getservlist __P ((const_nis_name dirname));
143 extern void nis_freeservlist __P ((nis_server **machines));
146 ** nis_subr
148 extern nis_name nis_leaf_of __P ((const_nis_name name));
149 extern nis_name nis_leaf_of_r __P ((const_nis_name name, char *buffer,
150 size_t buflen));
151 extern nis_name nis_name_of __P ((const_nis_name name));
152 extern nis_name nis_name_of_r __P ((const_nis_name name, char *buffer,
153 size_t buflen));
154 extern nis_name nis_domain_of __P ((const_nis_name name));
155 extern nis_name nis_domain_of_r __P ((const_nis_name name, char *buffer,
156 size_t buflen));
157 extern nis_name *nis_getnames __P ((const_nis_name name));
158 extern void nis_freenames __P ((nis_name *namelist));
159 extern name_pos nis_dir_cmp __P ((const_nis_name n1, const_nis_name n2));
160 extern nis_object *nis_clone_object __P ((const nis_object *src,
161 nis_object *dest));
162 extern void nis_destroy_object __P ((nis_object *obj));
163 extern void nis_print_object __P ((const nis_object *obj));
166 ** nis_local_names
168 extern nis_name nis_local_group __P ((void));
169 extern nis_name nis_local_directory __P ((void));
170 extern nis_name nis_local_principal __P ((void));
171 extern nis_name nis_local_host __P ((void));
174 ** nis_error
176 extern const char *nis_sperrno __P ((const nis_error status));
177 extern void nis_perror __P ((const nis_error status, const char *label));
178 extern void nis_lerror __P ((const nis_error status, const char *label));
179 extern char *nis_sperror __P ((const nis_error status, const char *label));
180 extern char *nis_sperror_r __P ((const nis_error status, const char *label,
181 char *buffer, size_t buflen));
183 ** nis_groups
185 extern bool_t nis_ismember __P ((const_nis_name principal,
186 const_nis_name group));
187 extern nis_error nis_addmember __P ((const_nis_name member,
188 const_nis_name group));
189 extern nis_error nis_removemember __P ((const_nis_name member,
190 const_nis_name group));
191 extern nis_error nis_creategroup __P ((const_nis_name group, u_long flags));
192 extern nis_error nis_destroygroup __P ((const_nis_name group));
193 extern void nis_print_group_entry __P ((const_nis_name group));
194 extern nis_error nis_verifygroup __P ((const_nis_name group));
197 ** nis_ping
199 extern void nis_ping __P ((const_nis_name dirname, u_long utime,
200 const nis_object *dirobj));
201 extern nis_result *nis_checkpoint __P ((const_nis_name dirname));
204 ** nis_print (XXX INTERNAL FUNCTIONS, SHOULD NOT BE USED !!)
206 extern void nis_print_result __P ((const nis_result *result));
207 extern void nis_print_rights __P ((u_long rights));
208 extern void nis_print_directory __P ((const directory_obj *dirobj));
209 extern void nis_print_group __P ((const group_obj *grpobj));
210 extern void nis_print_table __P ((const table_obj *tblobj));
211 extern void nis_print_link __P ((const link_obj *lnkobj));
212 extern void nis_print_entry __P ((const entry_obj *enobj));
215 ** nis_file (XXX INTERNAL FUNCTIONS, SHOULD NOT BE USED !!)
217 extern directory_obj *readColdStartFile __P ((void));
218 extern bool_t writeColdStartFile __P ((const directory_obj *dirobj));
219 extern nis_object *nis_read_obj __P ((const char *obj));
220 extern bool_t nis_write_obj __P ((const char *file, const nis_object *obj));
223 ** nis_clone - (XXX INTERNAL FUNCTIONS, SHOULD NOT BE USED !!)
225 extern directory_obj *nis_clone_directory __P ((const directory_obj *src,
226 directory_obj *dest));
227 extern nis_result *nis_clone_result __P ((const nis_result *src,
228 nis_result *dest));
230 /* nis_free - nis_freeresult */
231 extern void nis_freeresult __P ((nis_result *result));
232 /* (XXX THE FOLLOWING ARE INTERNAL FUNCTIONS, SHOULD NOT BE USED !!) */
233 extern void nis_free_request __P ((ib_request *req));
234 extern void nis_free_directory __P ((directory_obj *dirobj));
235 extern void nis_free_object __P ((nis_object *obj));
237 /* (XXX INTERNAL FUNCTIONS, SHOULD NOT BE USED !!) */
238 extern nis_name __nis_default_owner __P ((char *));
239 extern nis_name __nis_default_group __P ((char *));
240 extern u_long __nis_default_ttl __P ((char *));
241 extern u_long __nis_default_access __P ((char *, u_long));
242 extern fd_result *__nis_finddirectory __P ((directory_obj *, const_nis_name));
243 extern void __free_fdresult __P ((fd_result *));
244 extern u_long __nis_hash __P ((const void *keyarg, register size_t len));
246 /* NIS+ cache locking */
247 extern int __nis_lock_cache __P ((void));
248 extern int __nis_unlock_cache __P ((void));
250 __END_DECLS
252 #endif /* __RPCSVC_NISLIB_H__ */