2 * Copyright (c) 2010, Oracle America, Inc.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following
12 * disclaimer in the documentation and/or other materials
13 * provided with the distribution.
14 * * Neither the name of the "Oracle America, Inc." nor the names of its
15 * contributors may be used to endorse or promote products derived
16 * from this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
23 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
25 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 #define _RPCSVC_NIS_H 1
37 #include <rpcsvc/nis_tags.h>
44 * This file is the main include file for NIS clients. It contains
45 * both the client library function defines and the various data
46 * structures used by the NIS service. It includes the file nis_tags.h
47 * which defines the tag values. This allows the tags to change without
48 * having to change the nis.x file.
50 * NOTE : THIS FILE IS NOT GENERATED WITH RPCGEN ! SO YOU HAVE TO
51 * ADD ALL THE CHANGES ON nis_*.x FILES HERE AGAIN !
53 * I have removed all the Solaris internal structs and variables,
54 * because they are not supported, Sun changed them between various
55 * releases and they shouldn't be used in user programs.
60 #ifndef __nis_object_h
61 #define __nis_object_h
63 #define NIS_MAXSTRINGLEN 255
64 #define NIS_MAXNAMELEN 1024
65 #define NIS_MAXATTRNAME 32
66 #define NIS_MAXATTRVAL 2048
67 #define NIS_MAXCOLUMNS 64
68 #define NIS_MAXATTR 16
69 #define NIS_MAXPATH 1024
70 #define NIS_MAXREPLICAS 128
71 #define NIS_MAXLINKS 16
76 #define NIS_PK_DHEXT 4
85 typedef struct nis_attr nis_attr;
87 typedef char *nis_name;
100 NIS_DIRECTORY_OBJ = 2,
107 typedef enum zotypes zotypes;
120 typedef enum nstype nstype;
126 typedef struct oar_mask oar_mask;
133 typedef struct endpoint endpoint;
144 typedef struct nis_server nis_server;
146 struct directory_obj {
150 u_int do_servers_len;
151 nis_server *do_servers_val;
156 oar_mask *do_armask_val;
159 typedef struct directory_obj directory_obj;
164 #define EN_MODIFIED 8
174 typedef struct entry_col entry_col;
180 entry_col *en_cols_val;
183 typedef struct entry_obj entry_obj;
188 u_int gr_members_len;
189 nis_name *gr_members_val;
192 typedef struct group_obj group_obj;
198 nis_attr *li_attrs_val;
202 typedef struct link_obj link_obj;
207 #define TA_SEARCHABLE 8
209 #define TA_MODIFIED 32
217 typedef struct table_col table_col;
225 table_col *ta_cols_val;
229 typedef struct table_obj table_obj;
234 struct directory_obj di_data;
235 struct group_obj gr_data;
236 struct table_obj ta_data;
237 struct entry_obj en_data;
238 struct link_obj li_data;
245 typedef struct objdata objdata;
251 typedef struct nis_oid nis_oid;
263 typedef struct nis_object nis_object;
265 #endif /* if __nis_object_h */
272 NIS_CACHEEXPIRED = 4,
273 NIS_NAMEUNREACHABLE = 5,
291 NIS_NOSUCHTABLE = 23,
292 NIS_TYPEMISMATCH = 24,
293 NIS_LINKNAMEERROR = 25,
295 NIS_TOOMANYATTRS = 27,
297 NIS_BADATTRIBUTE = 29,
298 NIS_NOTSEARCHABLE = 30,
306 NIS_COLDSTART_ERR = 38,
313 NIS_NOFILESPACE = 45,
317 typedef enum nis_error nis_error;
323 nis_object *objects_val;
331 typedef struct nis_result nis_result;
337 nis_object *ns_object_val;
340 typedef struct ns_request ns_request;
346 nis_attr *ibr_srch_val;
351 nis_object *ibr_obj_val;
354 u_int ibr_cbhost_len;
355 nis_server *ibr_cbhost_val;
360 typedef struct ib_request ib_request;
366 typedef struct ping_args ping_args;
379 typedef enum log_entry_t log_entry_t;
388 nis_attr *le_attrs_val;
390 nis_object le_object;
392 typedef struct log_entry log_entry;
398 u_int lr_entries_len;
399 log_entry *lr_entries_val;
402 typedef struct log_result log_result;
409 typedef struct cp_result cp_result;
415 typedef struct nis_tag nis_tag;
423 typedef struct nis_taglist nis_taglist;
430 nis_server *da_cbhost_val;
433 typedef struct dump_args dump_args;
439 typedef struct fd_args fd_args;
453 typedef struct fd_result fd_result;
455 /* Generic client creating flags */
460 /* Testing Access rights for objects */
462 #define NIS_READ_ACC 1
463 #define NIS_MODIFY_ACC 2
464 #define NIS_CREATE_ACC 4
465 #define NIS_DESTROY_ACC 8
466 /* Test macros. a == access rights, m == desired rights. */
467 #define NIS_WORLD(a, m) (((a) & (m)) != 0)
468 #define NIS_GROUP(a, m) (((a) & ((m) << 8)) != 0)
469 #define NIS_OWNER(a, m) (((a) & ((m) << 16)) != 0)
470 #define NIS_NOBODY(a, m) (((a) & ((m) << 24)) != 0)
472 * EOL Alert - The following non-prefixed test macros are
473 * here for backward compatibility, and will be not be present
474 * in future releases - use the NIS_*() macros above.
476 #define WORLD(a, m) (((a) & (m)) != 0)
477 #define GROUP(a, m) (((a) & ((m) << 8)) != 0)
478 #define OWNER(a, m) (((a) & ((m) << 16)) != 0)
479 #define NOBODY(a, m) (((a) & ((m) << 24)) != 0)
481 #define OATYPE(d, n) (((d)->do_armask.do_armask_val+n)->oa_otype)
482 #define OARIGHTS(d, n) (((d)->do_armask.do_armask_val+n)->oa_rights)
483 #define WORLD_DEFAULT (NIS_READ_ACC)
484 #define GROUP_DEFAULT (NIS_READ_ACC << 8)
485 #define OWNER_DEFAULT ((NIS_READ_ACC + NIS_MODIFY_ACC + NIS_CREATE_ACC +\
486 NIS_DESTROY_ACC) << 16)
487 #define DEFAULT_RIGHTS (WORLD_DEFAULT | GROUP_DEFAULT | OWNER_DEFAULT)
489 /* Result manipulation defines ... */
490 #define NIS_RES_NUMOBJ(x) ((x)->objects.objects_len)
491 #define NIS_RES_OBJECT(x) ((x)->objects.objects_val)
492 #define NIS_RES_COOKIE(x) ((x)->cookie)
493 #define NIS_RES_STATUS(x) ((x)->status)
495 /* These defines make getting at the variant part of the object easier. */
496 #define TA_data zo_data.objdata_u.ta_data
497 #define EN_data zo_data.objdata_u.en_data
498 #define DI_data zo_data.objdata_u.di_data
499 #define LI_data zo_data.objdata_u.li_data
500 #define GR_data zo_data.objdata_u.gr_data
502 #define __type_of(o) ((o)->zo_data.zo_type)
504 /* Declarations for the internal subroutines in nislib.c */
505 enum name_pos {SAME_NAME, HIGHER_NAME, LOWER_NAME, NOT_SEQUENTIAL, BAD_NAME};
506 typedef enum name_pos name_pos;
509 * Defines for getting at column data in entry objects. Because RPCGEN
510 * generates some rather wordy structures, we create some defines that
511 * collapse the needed keystrokes to access a particular value using
512 * these definitions they take an nis_object *, and an int and return
513 * a u_char * for Value, and an int for length.
515 #define ENTRY_VAL(obj, col) (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val
516 #define ENTRY_LEN(obj, col) (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len
519 /* Prototypes, and extern declarations for the NIS library functions. */
520 #include <rpcsvc/nislib.h>
526 * This file contains definitions that are only of interest to the actual
527 * service daemon and client stubs. Normal users of NIS will not include
530 * NOTE : This include file is automatically created by a combination
531 * of rpcgen and sed. DO NOT EDIT IT, change the nis.x file instead
532 * and then remake this file.
537 #define NIS_PROG 100300
538 #define NIS_VERSION 3
541 extern nis_result * nis_lookup_3 (ns_request *, CLIENT *) __THROW;
542 extern nis_result * nis_lookup_3_svc (ns_request *, struct svc_req *) __THROW;
544 extern nis_result * nis_add_3 (ns_request *, CLIENT *) __THROW;
545 extern nis_result * nis_add_3_svc (ns_request *, struct svc_req *) __THROW;
547 extern nis_result * nis_modify_3 (ns_request *, CLIENT *) __THROW;
548 extern nis_result * nis_modify_3_svc (ns_request *, struct svc_req *) __THROW;
550 extern nis_result * nis_remove_3 (ns_request *, CLIENT *) __THROW;
551 extern nis_result * nis_remove_3_svc (ns_request *, struct svc_req *) __THROW;
553 extern nis_result * nis_iblist_3 (ib_request *, CLIENT *) __THROW;
554 extern nis_result * nis_iblist_3_svc (ib_request *, struct svc_req *) __THROW;
556 extern nis_result * nis_ibadd_3 (ib_request *, CLIENT *) __THROW;
557 extern nis_result * nis_ibadd_3_svc (ib_request *, struct svc_req *) __THROW;
558 #define NIS_IBMODIFY 7
559 extern nis_result * nis_ibmodify_3 (ib_request *, CLIENT *) __THROW;
560 extern nis_result * nis_ibmodify_3_svc (ib_request *, struct svc_req *)
562 #define NIS_IBREMOVE 8
563 extern nis_result * nis_ibremove_3 (ib_request *, CLIENT *) __THROW;
564 extern nis_result * nis_ibremove_3_svc (ib_request *, struct svc_req *)
566 #define NIS_IBFIRST 9
567 extern nis_result * nis_ibfirst_3 (ib_request *, CLIENT *) __THROW;
568 extern nis_result * nis_ibfirst_3_svc (ib_request *, struct svc_req *)
570 #define NIS_IBNEXT 10
571 extern nis_result * nis_ibnext_3 (ib_request *, CLIENT *) __THROW;
572 extern nis_result * nis_ibnext_3_svc (ib_request *, struct svc_req *) __THROW;
573 #define NIS_FINDDIRECTORY 12
574 extern fd_result * nis_finddirectory_3 (fd_args *, CLIENT *) __THROW;
575 extern fd_result * nis_finddirectory_3_svc (fd_args *,
576 struct svc_req *) __THROW;
577 #define NIS_STATUS 14
578 extern nis_taglist * nis_status_3 (nis_taglist *, CLIENT *) __THROW;
579 extern nis_taglist * nis_status_3_svc (nis_taglist *, struct svc_req *)
581 #define NIS_DUMPLOG 15
582 extern log_result * nis_dumplog_3 (dump_args *, CLIENT *) __THROW;
583 extern log_result * nis_dumplog_3_svc (dump_args *, struct svc_req *) __THROW;
585 extern log_result * nis_dump_3 (dump_args *, CLIENT *) __THROW;
586 extern log_result * nis_dump_3_svc (dump_args *, struct svc_req *) __THROW;
587 #define NIS_CALLBACK 17
588 extern bool_t * nis_callback_3 (netobj *, CLIENT *) __THROW;
589 extern bool_t * nis_callback_3_svc (netobj *, struct svc_req *) __THROW;
590 #define NIS_CPTIME 18
591 extern uint32_t * nis_cptime_3 (nis_name *, CLIENT *) __THROW;
592 extern uint32_t * nis_cptime_3_svc (nis_name *, struct svc_req *) __THROW;
593 #define NIS_CHECKPOINT 19
594 extern cp_result * nis_checkpoint_3 (nis_name *, CLIENT *) __THROW;
595 extern cp_result * nis_checkpoint_3_svc (nis_name *, struct svc_req *)
598 extern void * nis_ping_3 (ping_args *, CLIENT *) __THROW;
599 extern void * nis_ping_3_svc (ping_args *, struct svc_req *) __THROW;
600 #define NIS_SERVSTATE 21
601 extern nis_taglist * nis_servstate_3 (nis_taglist *, CLIENT *) __THROW;
602 extern nis_taglist * nis_servstate_3_svc (nis_taglist *,
603 struct svc_req *) __THROW;
605 extern nis_error * nis_mkdir_3 (nis_name *, CLIENT *) __THROW;
606 extern nis_error * nis_mkdir_3_svc (nis_name *, struct svc_req *) __THROW;
608 extern nis_error * nis_rmdir_3 (nis_name *, CLIENT *) __THROW;
609 extern nis_error * nis_rmdir_3_svc (nis_name *, struct svc_req *) __THROW;
610 #define NIS_UPDKEYS 24
611 extern nis_error * nis_updkeys_3 (nis_name *, CLIENT *) __THROW;
612 extern nis_error * nis_updkeys_3_svc (nis_name *, struct svc_req *) __THROW;
616 #endif /* ! _RPCSVC_NIS_H */