Some some optimizations for x86-64 strcmp.
[glibc.git] / nis / rpcsvc / nis.h
blob0495457239a7bbf8e1916b830105b1739d40d386
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 or with the express written consent of
8 * Sun Microsystems, Inc.
10 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
11 * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
12 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
14 * Sun RPC is provided with no support and without any obligation on the
15 * part of Sun Microsystems, Inc. to assist in its use, correction,
16 * modification or enhancement.
18 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
19 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
20 * OR ANY PART THEREOF.
22 * In no event will Sun Microsystems, Inc. be liable for any lost revenue
23 * or profits or other special, indirect and consequential damages, even if
24 * Sun has been advised of the possibility of such damages.
26 * Sun Microsystems, Inc.
27 * 2550 Garcia Avenue
28 * Mountain View, California 94043
31 #ifndef _RPCSVC_NIS_H
32 #define _RPCSVC_NIS_H 1
34 #include <features.h>
35 #include <rpc/rpc.h>
36 #include <rpcsvc/nis_tags.h>
38 __BEGIN_DECLS
41 * nis.h
43 * This file is the main include file for NIS clients. It contains
44 * both the client library function defines and the various data
45 * structures used by the NIS service. It includes the file nis_tags.h
46 * which defines the tag values. This allows the tags to change without
47 * having to change the nis.x file.
49 * NOTE : THIS FILE IS NOT GENERATED WITH RPCGEN ! SO YOU HAVE TO
50 * ADD ALL THE CHANGES ON nis_*.x FILES HERE AGAIN !
52 * I have removed all the Solaris internal structs and variables,
53 * because they are not supported, Sun changed them between various
54 * releases and they shouldn't be used in user programs.
55 * <kukuk@suse.de>
59 #ifndef __nis_object_h
60 #define __nis_object_h
62 #define NIS_MAXSTRINGLEN 255
63 #define NIS_MAXNAMELEN 1024
64 #define NIS_MAXATTRNAME 32
65 #define NIS_MAXATTRVAL 2048
66 #define NIS_MAXCOLUMNS 64
67 #define NIS_MAXATTR 16
68 #define NIS_MAXPATH 1024
69 #define NIS_MAXREPLICAS 128
70 #define NIS_MAXLINKS 16
71 #define NIS_PK_NONE 0
72 #define NIS_PK_DH 1
73 #define NIS_PK_RSA 2
74 #define NIS_PK_KERB 3
75 #define NIS_PK_DHEXT 4
77 struct nis_attr {
78 char *zattr_ndx;
79 struct {
80 u_int zattr_val_len;
81 char *zattr_val_val;
82 } zattr_val;
84 typedef struct nis_attr nis_attr;
86 typedef char *nis_name;
88 enum zotypes {
89 BOGUS_OBJ = 0,
90 NO_OBJ = 1,
91 DIRECTORY_OBJ = 2,
92 GROUP_OBJ = 3,
93 TABLE_OBJ = 4,
94 ENTRY_OBJ = 5,
95 LINK_OBJ = 6,
96 PRIVATE_OBJ = 7,
97 NIS_BOGUS_OBJ = 0,
98 NIS_NO_OBJ = 1,
99 NIS_DIRECTORY_OBJ = 2,
100 NIS_GROUP_OBJ = 3,
101 NIS_TABLE_OBJ = 4,
102 NIS_ENTRY_OBJ = 5,
103 NIS_LINK_OBJ = 6,
104 NIS_PRIVATE_OBJ = 7
106 typedef enum zotypes zotypes;
108 enum nstype {
109 UNKNOWN = 0,
110 NIS = 1,
111 SUNYP = 2,
112 IVY = 3,
113 DNS = 4,
114 X500 = 5,
115 DNANS = 6,
116 XCHS = 7,
117 CDS = 8,
119 typedef enum nstype nstype;
121 struct oar_mask {
122 uint32_t oa_rights;
123 zotypes oa_otype;
125 typedef struct oar_mask oar_mask;
127 struct endpoint {
128 char *uaddr;
129 char *family;
130 char *proto;
132 typedef struct endpoint endpoint;
134 struct nis_server {
135 nis_name name;
136 struct {
137 u_int ep_len;
138 endpoint *ep_val;
139 } ep;
140 uint32_t key_type;
141 netobj pkey;
143 typedef struct nis_server nis_server;
145 struct directory_obj {
146 nis_name do_name;
147 nstype do_type;
148 struct {
149 u_int do_servers_len;
150 nis_server *do_servers_val;
151 } do_servers;
152 uint32_t do_ttl;
153 struct {
154 u_int do_armask_len;
155 oar_mask *do_armask_val;
156 } do_armask;
158 typedef struct directory_obj directory_obj;
160 #define EN_BINARY 1
161 #define EN_CRYPT 2
162 #define EN_XDR 4
163 #define EN_MODIFIED 8
164 #define EN_ASN1 64
166 struct entry_col {
167 uint32_t ec_flags;
168 struct {
169 u_int ec_value_len;
170 char *ec_value_val;
171 } ec_value;
173 typedef struct entry_col entry_col;
175 struct entry_obj {
176 char *en_type;
177 struct {
178 u_int en_cols_len;
179 entry_col *en_cols_val;
180 } en_cols;
182 typedef struct entry_obj entry_obj;
184 struct group_obj {
185 uint32_t gr_flags;
186 struct {
187 u_int gr_members_len;
188 nis_name *gr_members_val;
189 } gr_members;
191 typedef struct group_obj group_obj;
193 struct link_obj {
194 zotypes li_rtype;
195 struct {
196 u_int li_attrs_len;
197 nis_attr *li_attrs_val;
198 } li_attrs;
199 nis_name li_name;
201 typedef struct link_obj link_obj;
203 #define TA_BINARY 1
204 #define TA_CRYPT 2
205 #define TA_XDR 4
206 #define TA_SEARCHABLE 8
207 #define TA_CASE 16
208 #define TA_MODIFIED 32
209 #define TA_ASN1 64
211 struct table_col {
212 char *tc_name;
213 uint32_t tc_flags;
214 uint32_t tc_rights;
216 typedef struct table_col table_col;
218 struct table_obj {
219 char *ta_type;
220 int ta_maxcol;
221 u_char ta_sep;
222 struct {
223 u_int ta_cols_len;
224 table_col *ta_cols_val;
225 } ta_cols;
226 char *ta_path;
228 typedef struct table_obj table_obj;
230 struct objdata {
231 zotypes zo_type;
232 union {
233 struct directory_obj di_data;
234 struct group_obj gr_data;
235 struct table_obj ta_data;
236 struct entry_obj en_data;
237 struct link_obj li_data;
238 struct {
239 u_int po_data_len;
240 char *po_data_val;
241 } po_data;
242 } objdata_u;
244 typedef struct objdata objdata;
246 struct nis_oid {
247 uint32_t ctime;
248 uint32_t mtime;
250 typedef struct nis_oid nis_oid;
252 struct nis_object {
253 nis_oid zo_oid;
254 nis_name zo_name;
255 nis_name zo_owner;
256 nis_name zo_group;
257 nis_name zo_domain;
258 uint32_t zo_access;
259 uint32_t zo_ttl;
260 objdata zo_data;
262 typedef struct nis_object nis_object;
264 #endif /* if __nis_object_h */
266 enum nis_error {
267 NIS_SUCCESS = 0,
268 NIS_S_SUCCESS = 1,
269 NIS_NOTFOUND = 2,
270 NIS_S_NOTFOUND = 3,
271 NIS_CACHEEXPIRED = 4,
272 NIS_NAMEUNREACHABLE = 5,
273 NIS_UNKNOWNOBJ = 6,
274 NIS_TRYAGAIN = 7,
275 NIS_SYSTEMERROR = 8,
276 NIS_CHAINBROKEN = 9,
277 NIS_PERMISSION = 10,
278 NIS_NOTOWNER = 11,
279 NIS_NOT_ME = 12,
280 NIS_NOMEMORY = 13,
281 NIS_NAMEEXISTS = 14,
282 NIS_NOTMASTER = 15,
283 NIS_INVALIDOBJ = 16,
284 NIS_BADNAME = 17,
285 NIS_NOCALLBACK = 18,
286 NIS_CBRESULTS = 19,
287 NIS_NOSUCHNAME = 20,
288 NIS_NOTUNIQUE = 21,
289 NIS_IBMODERROR = 22,
290 NIS_NOSUCHTABLE = 23,
291 NIS_TYPEMISMATCH = 24,
292 NIS_LINKNAMEERROR = 25,
293 NIS_PARTIAL = 26,
294 NIS_TOOMANYATTRS = 27,
295 NIS_RPCERROR = 28,
296 NIS_BADATTRIBUTE = 29,
297 NIS_NOTSEARCHABLE = 30,
298 NIS_CBERROR = 31,
299 NIS_FOREIGNNS = 32,
300 NIS_BADOBJECT = 33,
301 NIS_NOTSAMEOBJ = 34,
302 NIS_MODFAIL = 35,
303 NIS_BADREQUEST = 36,
304 NIS_NOTEMPTY = 37,
305 NIS_COLDSTART_ERR = 38,
306 NIS_RESYNC = 39,
307 NIS_FAIL = 40,
308 NIS_UNAVAIL = 41,
309 NIS_RES2BIG = 42,
310 NIS_SRVAUTH = 43,
311 NIS_CLNTAUTH = 44,
312 NIS_NOFILESPACE = 45,
313 NIS_NOPROC = 46,
314 NIS_DUMPLATER = 47,
316 typedef enum nis_error nis_error;
318 struct nis_result {
319 nis_error status;
320 struct {
321 u_int objects_len;
322 nis_object *objects_val;
323 } objects;
324 netobj cookie;
325 uint32_t zticks;
326 uint32_t dticks;
327 uint32_t aticks;
328 uint32_t cticks;
330 typedef struct nis_result nis_result;
332 struct ns_request {
333 nis_name ns_name;
334 struct {
335 u_int ns_object_len;
336 nis_object *ns_object_val;
337 } ns_object;
339 typedef struct ns_request ns_request;
341 struct ib_request {
342 nis_name ibr_name;
343 struct {
344 u_int ibr_srch_len;
345 nis_attr *ibr_srch_val;
346 } ibr_srch;
347 uint32_t ibr_flags;
348 struct {
349 u_int ibr_obj_len;
350 nis_object *ibr_obj_val;
351 } ibr_obj;
352 struct {
353 u_int ibr_cbhost_len;
354 nis_server *ibr_cbhost_val;
355 } ibr_cbhost;
356 u_int ibr_bufsize;
357 netobj ibr_cookie;
359 typedef struct ib_request ib_request;
361 struct ping_args {
362 nis_name dir;
363 uint32_t stamp;
365 typedef struct ping_args ping_args;
367 enum log_entry_t {
368 LOG_NOP = 0,
369 ADD_NAME = 1,
370 REM_NAME = 2,
371 MOD_NAME_OLD = 3,
372 MOD_NAME_NEW = 4,
373 ADD_IBASE = 5,
374 REM_IBASE = 6,
375 MOD_IBASE = 7,
376 UPD_STAMP = 8,
378 typedef enum log_entry_t log_entry_t;
380 struct log_entry {
381 uint32_t le_time;
382 log_entry_t le_type;
383 nis_name le_princp;
384 nis_name le_name;
385 struct {
386 u_int le_attrs_len;
387 nis_attr *le_attrs_val;
388 } le_attrs;
389 nis_object le_object;
391 typedef struct log_entry log_entry;
393 struct log_result {
394 nis_error lr_status;
395 netobj lr_cookie;
396 struct {
397 u_int lr_entries_len;
398 log_entry *lr_entries_val;
399 } lr_entries;
401 typedef struct log_result log_result;
403 struct cp_result {
404 nis_error cp_status;
405 uint32_t cp_zticks;
406 uint32_t cp_dticks;
408 typedef struct cp_result cp_result;
410 struct nis_tag {
411 uint32_t tag_type;
412 char *tag_val;
414 typedef struct nis_tag nis_tag;
416 struct nis_taglist {
417 struct {
418 u_int tags_len;
419 nis_tag *tags_val;
420 } tags;
422 typedef struct nis_taglist nis_taglist;
424 struct dump_args {
425 nis_name da_dir;
426 uint32_t da_time;
427 struct {
428 u_int da_cbhost_len;
429 nis_server *da_cbhost_val;
430 } da_cbhost;
432 typedef struct dump_args dump_args;
434 struct fd_args {
435 nis_name dir_name;
436 nis_name requester;
438 typedef struct fd_args fd_args;
440 struct fd_result {
441 nis_error status;
442 nis_name source;
443 struct {
444 u_int dir_data_len;
445 char *dir_data_val;
446 } dir_data;
447 struct {
448 u_int signature_len;
449 char *signature_val;
450 } signature;
452 typedef struct fd_result fd_result;
454 /* Generic client creating flags */
455 #define ZMH_VC 1
456 #define ZMH_DG 2
457 #define ZMH_AUTH 4
459 /* Testing Access rights for objects */
461 #define NIS_READ_ACC 1
462 #define NIS_MODIFY_ACC 2
463 #define NIS_CREATE_ACC 4
464 #define NIS_DESTROY_ACC 8
465 /* Test macros. a == access rights, m == desired rights. */
466 #define NIS_WORLD(a, m) (((a) & (m)) != 0)
467 #define NIS_GROUP(a, m) (((a) & ((m) << 8)) != 0)
468 #define NIS_OWNER(a, m) (((a) & ((m) << 16)) != 0)
469 #define NIS_NOBODY(a, m) (((a) & ((m) << 24)) != 0)
471 * EOL Alert - The following non-prefixed test macros are
472 * here for backward compatability, and will be not be present
473 * in future releases - use the NIS_*() macros above.
475 #define WORLD(a, m) (((a) & (m)) != 0)
476 #define GROUP(a, m) (((a) & ((m) << 8)) != 0)
477 #define OWNER(a, m) (((a) & ((m) << 16)) != 0)
478 #define NOBODY(a, m) (((a) & ((m) << 24)) != 0)
480 #define OATYPE(d, n) (((d)->do_armask.do_armask_val+n)->oa_otype)
481 #define OARIGHTS(d, n) (((d)->do_armask.do_armask_val+n)->oa_rights)
482 #define WORLD_DEFAULT (NIS_READ_ACC)
483 #define GROUP_DEFAULT (NIS_READ_ACC << 8)
484 #define OWNER_DEFAULT ((NIS_READ_ACC + NIS_MODIFY_ACC + NIS_CREATE_ACC +\
485 NIS_DESTROY_ACC) << 16)
486 #define DEFAULT_RIGHTS (WORLD_DEFAULT | GROUP_DEFAULT | OWNER_DEFAULT)
488 /* Result manipulation defines ... */
489 #define NIS_RES_NUMOBJ(x) ((x)->objects.objects_len)
490 #define NIS_RES_OBJECT(x) ((x)->objects.objects_val)
491 #define NIS_RES_COOKIE(x) ((x)->cookie)
492 #define NIS_RES_STATUS(x) ((x)->status)
494 /* These defines make getting at the variant part of the object easier. */
495 #define TA_data zo_data.objdata_u.ta_data
496 #define EN_data zo_data.objdata_u.en_data
497 #define DI_data zo_data.objdata_u.di_data
498 #define LI_data zo_data.objdata_u.li_data
499 #define GR_data zo_data.objdata_u.gr_data
501 #define __type_of(o) ((o)->zo_data.zo_type)
503 /* Declarations for the internal subroutines in nislib.c */
504 enum name_pos {SAME_NAME, HIGHER_NAME, LOWER_NAME, NOT_SEQUENTIAL, BAD_NAME};
505 typedef enum name_pos name_pos;
508 * Defines for getting at column data in entry objects. Because RPCGEN
509 * generates some rather wordy structures, we create some defines that
510 * collapse the needed keystrokes to access a particular value using
511 * these definitions they take an nis_object *, and an int and return
512 * a u_char * for Value, and an int for length.
514 #define ENTRY_VAL(obj, col) (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val
515 #define ENTRY_LEN(obj, col) (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len
518 /* Prototypes, and extern declarations for the NIS library functions. */
519 #include <rpcsvc/nislib.h>
520 #endif
523 * nis_3.h
525 * This file contains definitions that are only of interest to the actual
526 * service daemon and client stubs. Normal users of NIS will not include
527 * this file.
529 * NOTE : This include file is automatically created by a combination
530 * of rpcgen and sed. DO NOT EDIT IT, change the nis.x file instead
531 * and then remake this file.
533 #ifndef __nis_3_h
534 #define __nis_3_h
536 #define NIS_PROG 100300
537 #define NIS_VERSION 3
539 #define NIS_LOOKUP 1
540 extern nis_result * nis_lookup_3 (ns_request *, CLIENT *) __THROW;
541 extern nis_result * nis_lookup_3_svc (ns_request *, struct svc_req *) __THROW;
542 #define NIS_ADD 2
543 extern nis_result * nis_add_3 (ns_request *, CLIENT *) __THROW;
544 extern nis_result * nis_add_3_svc (ns_request *, struct svc_req *) __THROW;
545 #define NIS_MODIFY 3
546 extern nis_result * nis_modify_3 (ns_request *, CLIENT *) __THROW;
547 extern nis_result * nis_modify_3_svc (ns_request *, struct svc_req *) __THROW;
548 #define NIS_REMOVE 4
549 extern nis_result * nis_remove_3 (ns_request *, CLIENT *) __THROW;
550 extern nis_result * nis_remove_3_svc (ns_request *, struct svc_req *) __THROW;
551 #define NIS_IBLIST 5
552 extern nis_result * nis_iblist_3 (ib_request *, CLIENT *) __THROW;
553 extern nis_result * nis_iblist_3_svc (ib_request *, struct svc_req *) __THROW;
554 #define NIS_IBADD 6
555 extern nis_result * nis_ibadd_3 (ib_request *, CLIENT *) __THROW;
556 extern nis_result * nis_ibadd_3_svc (ib_request *, struct svc_req *) __THROW;
557 #define NIS_IBMODIFY 7
558 extern nis_result * nis_ibmodify_3 (ib_request *, CLIENT *) __THROW;
559 extern nis_result * nis_ibmodify_3_svc (ib_request *, struct svc_req *)
560 __THROW;
561 #define NIS_IBREMOVE 8
562 extern nis_result * nis_ibremove_3 (ib_request *, CLIENT *) __THROW;
563 extern nis_result * nis_ibremove_3_svc (ib_request *, struct svc_req *)
564 __THROW;
565 #define NIS_IBFIRST 9
566 extern nis_result * nis_ibfirst_3 (ib_request *, CLIENT *) __THROW;
567 extern nis_result * nis_ibfirst_3_svc (ib_request *, struct svc_req *)
568 __THROW;
569 #define NIS_IBNEXT 10
570 extern nis_result * nis_ibnext_3 (ib_request *, CLIENT *) __THROW;
571 extern nis_result * nis_ibnext_3_svc (ib_request *, struct svc_req *) __THROW;
572 #define NIS_FINDDIRECTORY 12
573 extern fd_result * nis_finddirectory_3 (fd_args *, CLIENT *) __THROW;
574 extern fd_result * nis_finddirectory_3_svc (fd_args *,
575 struct svc_req *) __THROW;
576 #define NIS_STATUS 14
577 extern nis_taglist * nis_status_3 (nis_taglist *, CLIENT *) __THROW;
578 extern nis_taglist * nis_status_3_svc (nis_taglist *, struct svc_req *)
579 __THROW;
580 #define NIS_DUMPLOG 15
581 extern log_result * nis_dumplog_3 (dump_args *, CLIENT *) __THROW;
582 extern log_result * nis_dumplog_3_svc (dump_args *, struct svc_req *) __THROW;
583 #define NIS_DUMP 16
584 extern log_result * nis_dump_3 (dump_args *, CLIENT *) __THROW;
585 extern log_result * nis_dump_3_svc (dump_args *, struct svc_req *) __THROW;
586 #define NIS_CALLBACK 17
587 extern bool_t * nis_callback_3 (netobj *, CLIENT *) __THROW;
588 extern bool_t * nis_callback_3_svc (netobj *, struct svc_req *) __THROW;
589 #define NIS_CPTIME 18
590 extern uint32_t * nis_cptime_3 (nis_name *, CLIENT *) __THROW;
591 extern uint32_t * nis_cptime_3_svc (nis_name *, struct svc_req *) __THROW;
592 #define NIS_CHECKPOINT 19
593 extern cp_result * nis_checkpoint_3 (nis_name *, CLIENT *) __THROW;
594 extern cp_result * nis_checkpoint_3_svc (nis_name *, struct svc_req *)
595 __THROW;
596 #define NIS_PING 20
597 extern void * nis_ping_3 (ping_args *, CLIENT *) __THROW;
598 extern void * nis_ping_3_svc (ping_args *, struct svc_req *) __THROW;
599 #define NIS_SERVSTATE 21
600 extern nis_taglist * nis_servstate_3 (nis_taglist *, CLIENT *) __THROW;
601 extern nis_taglist * nis_servstate_3_svc (nis_taglist *,
602 struct svc_req *) __THROW;
603 #define NIS_MKDIR 22
604 extern nis_error * nis_mkdir_3 (nis_name *, CLIENT *) __THROW;
605 extern nis_error * nis_mkdir_3_svc (nis_name *, struct svc_req *) __THROW;
606 #define NIS_RMDIR 23
607 extern nis_error * nis_rmdir_3 (nis_name *, CLIENT *) __THROW;
608 extern nis_error * nis_rmdir_3_svc (nis_name *, struct svc_req *) __THROW;
609 #define NIS_UPDKEYS 24
610 extern nis_error * nis_updkeys_3 (nis_name *, CLIENT *) __THROW;
611 extern nis_error * nis_updkeys_3_svc (nis_name *, struct svc_req *) __THROW;
613 __END_DECLS
615 #endif /* ! _RPCSVC_NIS_H */