PageRenderTime 57ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/aarch64-linux-gnu/libc/usr/include/rpcsvc/nislib.h

https://gitlab.com/infected_/linaro_aarch64-linux-android-5.3.x
C Header | 286 lines | 139 code | 22 blank | 125 comment | 1 complexity | 08f20808c580b529b1d21a8f871ddba9 MD5 | raw file
  1. /* Copyright (C) 1997-2015 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, see
  14. <http://www.gnu.org/licenses/>. */
  15. #ifndef __RPCSVC_NISLIB_H__
  16. #define __RPCSVC_NISLIB_H__
  17. #include <features.h>
  18. __BEGIN_DECLS
  19. typedef const char *const_nis_name;
  20. /* nis_names: These functions are used to locate and manipulate all NIS+
  21. * objects except the NIS+ entry objects.
  22. *
  23. * nis_lookup (name, flags) resolves a NIS+ name and returns a copy of
  24. * that object from a NIS+ server.
  25. * const nis_name name: name of the object to be resolved
  26. * unsigned int flags: logically ORing zero or more flags (FOLLOW_LINKS,
  27. * HARD_LOOKUP, [NO_CACHE], MASTER_ONLY, EXPAND_NAME)
  28. *
  29. * nis_add (name, obj) adds objects to the NIS+ namespace.
  30. * const nis_name name: fully qualified NIS+ name.
  31. * const nis_object *obj: object members zo_name and zo_domain will be
  32. * constructed from name.
  33. *
  34. * nis_remove (name, obj) removes objects from the NIS+ namespace.
  35. * const nis_name name: fully qualified NIS+ name.
  36. * const nis_object *obj: if not NULL, it is assumed to point to a copy
  37. * of the object being removed. In this case, if
  38. * the object on the server does not have the same
  39. * object identifier as the object being passed,
  40. * the operation will fail with the NIS_NOTSAMEOBJ
  41. * error.
  42. *
  43. * nis_modify (name, obj) can change specific attributes of an object
  44. * that already exists in the namespace.
  45. */
  46. extern nis_result *nis_lookup (const_nis_name name, unsigned int flags)
  47. __THROW;
  48. extern nis_result *nis_add (const_nis_name name, const nis_object *obj)
  49. __THROW;
  50. extern nis_result *nis_remove (const_nis_name name,
  51. const nis_object *obj) __THROW;
  52. extern nis_result *nis_modify (const_nis_name name,
  53. const nis_object *obj) __THROW;
  54. /* nis_tables: These functions are used to search and modify NIS+ tables.
  55. *
  56. * nis_list (table_name, flags, callback(table_name, obj, userdata), userdata)
  57. * search a table in the NIS+ namespace.
  58. * const nis_name table_name: indexed name ([xx=yy],table.dir)
  59. * unsigned int flags: logically ORing one or more flags (FOLLOW_LINKS,
  60. * [FOLLOW_PATH], HARD_LOOKUP, [ALL_RESULTS], [NO_CACHE],
  61. * MASTER_ONLY, EXPAND_NAME, RETURN_RESULT)
  62. * callback(): callback is an optional pointer to a function that will
  63. * process the ENTRY type objects that are returned from the
  64. * search. If this pointer is NULL, then all entries that match
  65. * the search criteria are returned in the nis_result structure,
  66. * otherwise this function will be called once for each
  67. * entry returned.
  68. * void *userdata: passed to callback function along with the returned
  69. * entry object.
  70. *
  71. * nis_add_entry (table_name, obj, flags) will add the NIS+ object to the
  72. * NIS+ table_name.
  73. * const nis_name table_name
  74. * const nis_object *obj
  75. * unsigned int flags: 0, ADD_OVERWRITE, RETURN_RESULT
  76. *
  77. * nis_modify_entry (name, obj, flags) modifies an object identified by name.
  78. * const nis_name name: object identifier
  79. * const nis_object *obj: should point to an entry with the EN_MODIFIED
  80. * flag set in each column that contains new
  81. * information.
  82. * unsigned int flags: 0, MOD_SAMEOBJ, RETURN_RESULT
  83. *
  84. * nis_remove_entry (table_name, obj, flags) removes a set of entries
  85. * identified by table_name from the table.
  86. * const nis_name table_name: indexed NIS+ name
  87. * const nis_object *obj: if obj is non-null, it is presumed to point to
  88. * a cached copy of the entry. When the removal is
  89. * attempted, and the object that would be removed
  90. * is not the same as the cached object pointed to
  91. * by object then the operation will fail with an
  92. * NIS_NOTSAMEOBJ error
  93. * unsigned int flags: 0, REM_MULTIPLE
  94. *
  95. * nis_first_entry (table_name) fetches entries from a table one at a time.
  96. * const nis_name table_name
  97. *
  98. * nis_next_entry (table_name, cookie) retrieves the "next" entry from a
  99. * table specified by table_name.
  100. * const nis_name table_name:
  101. * const netobj *cookie: The value of cookie from the nis_result structure
  102. * form the previous call.
  103. */
  104. extern nis_result *nis_list (const_nis_name __name, unsigned int __flags,
  105. int (*__callback)(const_nis_name __table_name,
  106. const nis_object *__obj,
  107. const void *__userdata),
  108. const void *__userdata) __THROW;
  109. extern nis_result *nis_add_entry (const_nis_name __table_name,
  110. const nis_object *__obj,
  111. unsigned int __flags) __THROW;
  112. extern nis_result *nis_modify_entry (const_nis_name __name,
  113. const nis_object *__obj,
  114. unsigned int __flags) __THROW;
  115. extern nis_result *nis_remove_entry (const_nis_name __table_name,
  116. const nis_object *__obj,
  117. unsigned int __flags) __THROW;
  118. extern nis_result *nis_first_entry (const_nis_name __table_name) __THROW;
  119. extern nis_result *nis_next_entry (const_nis_name __table_name,
  120. const netobj *__cookie) __THROW;
  121. /*
  122. ** nis_server
  123. */
  124. extern nis_error nis_mkdir (const_nis_name __dirname,
  125. const nis_server *__machine) __THROW;
  126. extern nis_error nis_rmdir (const_nis_name __dirname,
  127. const nis_server *__machine) __THROW;
  128. extern nis_error nis_servstate (const nis_server *__machine,
  129. const nis_tag *__tags, int __numtags,
  130. nis_tag **__result) __THROW;
  131. extern nis_error nis_stats (const nis_server *__machine,
  132. const nis_tag *__tags, int __numtags,
  133. nis_tag **__result) __THROW;
  134. extern void nis_freetags (nis_tag *__tags, int __numtags) __THROW;
  135. extern nis_server **nis_getservlist (const_nis_name __dirname) __THROW;
  136. extern void nis_freeservlist (nis_server **__machines) __THROW;
  137. /*
  138. ** nis_subr
  139. */
  140. extern nis_name nis_leaf_of (const_nis_name __name) __THROW;
  141. extern nis_name nis_leaf_of_r (const_nis_name __name, char *__buffer,
  142. size_t __buflen) __THROW;
  143. extern nis_name nis_name_of (const_nis_name __name) __THROW;
  144. extern nis_name nis_name_of_r (const_nis_name __name, char *__buffer,
  145. size_t __buflen) __THROW;
  146. extern nis_name nis_domain_of (const_nis_name __name) __THROW;
  147. extern nis_name nis_domain_of_r (const_nis_name __name, char *__buffer,
  148. size_t __buflen) __THROW;
  149. extern nis_name *nis_getnames (const_nis_name __name) __THROW;
  150. extern void nis_freenames (nis_name *__namelist) __THROW;
  151. extern name_pos nis_dir_cmp (const_nis_name __n1, const_nis_name __n2) __THROW;
  152. extern nis_object *nis_clone_object (const nis_object *__src,
  153. nis_object *__dest) __THROW;
  154. extern void nis_destroy_object (nis_object *__obj) __THROW;
  155. extern void nis_print_object (const nis_object *__obj) __THROW;
  156. /*
  157. ** nis_local_names
  158. */
  159. extern nis_name nis_local_group (void) __THROW;
  160. extern nis_name nis_local_directory (void) __THROW;
  161. extern nis_name nis_local_principal (void) __THROW;
  162. extern nis_name nis_local_host (void) __THROW;
  163. /*
  164. ** nis_error
  165. */
  166. extern const char *nis_sperrno (const nis_error __status) __THROW;
  167. extern void nis_perror (const nis_error __status, const char *__label) __THROW;
  168. extern void nis_lerror (const nis_error __status, const char *__label) __THROW;
  169. extern char *nis_sperror (const nis_error status, const char *__label) __THROW;
  170. extern char *nis_sperror_r (const nis_error __status, const char *__label,
  171. char *__buffer, size_t __buflen) __THROW;
  172. /*
  173. ** nis_groups
  174. */
  175. extern bool_t nis_ismember (const_nis_name __principal,
  176. const_nis_name __group) __THROW;
  177. extern nis_error nis_addmember (const_nis_name __member,
  178. const_nis_name __group) __THROW;
  179. extern nis_error nis_removemember (const_nis_name __member,
  180. const_nis_name __group) __THROW;
  181. extern nis_error nis_creategroup (const_nis_name __group,
  182. unsigned int __flags) __THROW;
  183. extern nis_error nis_destroygroup (const_nis_name __group) __THROW;
  184. extern void nis_print_group_entry (const_nis_name __group) __THROW;
  185. extern nis_error nis_verifygroup (const_nis_name __group) __THROW;
  186. /*
  187. ** nis_ping
  188. */
  189. extern void nis_ping (const_nis_name __dirname, uint32_t __utime,
  190. const nis_object *__dirobj) __THROW;
  191. extern nis_result *nis_checkpoint (const_nis_name __dirname) __THROW;
  192. /*
  193. ** nis_print (XXX INTERNAL FUNCTIONS, SHOULD NOT BE USED !!)
  194. */
  195. extern void nis_print_result (const nis_result *__result) __THROW;
  196. extern void nis_print_rights (unsigned int __rights) __THROW;
  197. extern void nis_print_directory (const directory_obj *__dirobj) __THROW;
  198. extern void nis_print_group (const group_obj *__grpobj) __THROW;
  199. extern void nis_print_table (const table_obj *__tblobj) __THROW;
  200. extern void nis_print_link (const link_obj *__lnkobj) __THROW;
  201. extern void nis_print_entry (const entry_obj *__enobj) __THROW;
  202. /*
  203. ** nis_file (XXX INTERNAL FUNCTIONS, SHOULD NOT BE USED !!)
  204. */
  205. extern directory_obj *readColdStartFile (void) __THROW;
  206. extern bool_t writeColdStartFile (const directory_obj *__dirobj) __THROW;
  207. extern nis_object *nis_read_obj (const char *__obj) __THROW;
  208. extern bool_t nis_write_obj (const char *__file, const nis_object *__obj) __THROW;
  209. /*
  210. ** nis_clone - (XXX INTERNAL FUNCTIONS, SHOULD NOT BE USED !!)
  211. */
  212. extern directory_obj *nis_clone_directory (const directory_obj *__src,
  213. directory_obj *__dest) __THROW;
  214. extern nis_result *nis_clone_result (const nis_result *__src,
  215. nis_result *__dest) __THROW;
  216. /* nis_free - nis_freeresult */
  217. extern void nis_freeresult (nis_result *__result) __THROW;
  218. /* (XXX THE FOLLOWING ARE INTERNAL FUNCTIONS, SHOULD NOT BE USED !!) */
  219. extern void nis_free_request (ib_request *__req) __THROW;
  220. extern void nis_free_directory (directory_obj *__dirobj) __THROW;
  221. extern void nis_free_object (nis_object *__obj) __THROW;
  222. /* (XXX INTERNAL FUNCTIONS, SHOULD NOT BE USED !!) */
  223. extern nis_name __nis_default_owner (char *) __THROW;
  224. extern nis_name __nis_default_group (char *) __THROW;
  225. extern uint32_t __nis_default_ttl (char *) __THROW;
  226. extern unsigned int __nis_default_access (char *, unsigned int) __THROW;
  227. extern fd_result *__nis_finddirectory (directory_obj *, const_nis_name) __THROW;
  228. extern void __free_fdresult (fd_result *) __THROW;
  229. extern uint32_t __nis_hash (const void *__keyarg, size_t __len) __THROW;
  230. /* NIS+ cache locking */
  231. extern int __nis_lock_cache (void) __THROW;
  232. extern int __nis_unlock_cache (void) __THROW;
  233. /* (XXX INTERNAL FUNCTIONS, ONLY FOR rpc.nisd AND glibc !!) */
  234. #if defined (NIS_INTERNAL) || defined (_LIBC)
  235. struct dir_binding
  236. {
  237. CLIENT *clnt; /* RPC CLIENT handle */
  238. nis_server *server_val; /* List of servers */
  239. unsigned int server_len; /* # of servers */
  240. unsigned int server_used; /* Which server we are bind in the moment ? */
  241. unsigned int current_ep; /* Which endpoint of the server are in use? */
  242. unsigned int trys; /* How many server have we tried ? */
  243. unsigned int class; /* From which class is server_val ? */
  244. bool_t master_only; /* Is only binded to the master */
  245. bool_t use_auth; /* Do we use AUTH ? */
  246. bool_t use_udp; /* Do we use UDP ? */
  247. struct sockaddr_in addr; /* Server's IP address */
  248. int socket; /* Server's local socket */
  249. };
  250. typedef struct dir_binding dir_binding;
  251. extern nis_error __nisbind_create (dir_binding *, const nis_server *,
  252. unsigned int, unsigned int, unsigned int,
  253. unsigned int) __THROW;
  254. extern nis_error __nisbind_connect (dir_binding *) __THROW;
  255. extern nis_error __nisbind_next (dir_binding *) __THROW;
  256. extern void __nisbind_destroy (dir_binding *) __THROW;
  257. extern nis_error __nisfind_server (const_nis_name, int, directory_obj **,
  258. dir_binding *, unsigned int) __THROW;
  259. #endif
  260. __END_DECLS
  261. #endif /* __RPCSVC_NISLIB_H__ */