1 /*
   2  * CDDL HEADER START
   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 #ifndef _PRIV_H_
  27 #define _PRIV_H_
  28 
  29 #include <sys/priv.h>
  30 
  31 #ifdef  __cplusplus
  32 extern "C" {
  33 #endif
  34 
  35 #define PRIV_STR_PORT           0x00                    /* portable output */
  36 #define PRIV_STR_LIT            0x01                    /* literal output */
  37 #define PRIV_STR_SHORT          0x02                    /* shortest output */
  38 
  39 #define PRIV_ALLSETS            ((priv_ptype_t)0)       /* for priv_set() */
  40 
  41 /*
  42  * library functions prototype.
  43  */
  44 #if     defined(__STDC__)
  45 
  46 extern int setppriv(priv_op_t, priv_ptype_t, const priv_set_t *);
  47 extern int getppriv(priv_ptype_t, priv_set_t *);
  48 extern int setpflags(uint_t, uint_t);
  49 extern uint_t getpflags(uint_t);
  50 extern const priv_impl_info_t *getprivimplinfo(void);
  51 
  52 extern int priv_set(priv_op_t, priv_ptype_t, ...);
  53 extern boolean_t priv_ineffect(const char *);
  54 extern priv_set_t *priv_str_to_set(const char *, const char *, const char **);
  55 extern char *priv_set_to_str(const priv_set_t *, char, int);
  56 
  57 extern int priv_getbyname(const char *);
  58 extern const char *priv_getbynum(int);
  59 extern int priv_getsetbyname(const char *);
  60 extern const char *priv_getsetbynum(int);
  61 extern char *priv_gettext(const char *);
  62 
  63 extern priv_set_t *priv_allocset(void);
  64 extern void priv_freeset(priv_set_t *);
  65 
  66 extern void priv_emptyset(priv_set_t *);
  67 extern void priv_basicset(priv_set_t *);
  68 extern void priv_fillset(priv_set_t *);
  69 extern boolean_t priv_isemptyset(const priv_set_t *);
  70 extern boolean_t priv_isfullset(const priv_set_t *);
  71 extern boolean_t priv_isequalset(const priv_set_t *, const priv_set_t *);
  72 extern boolean_t priv_issubset(const priv_set_t *, const priv_set_t *);
  73 extern void priv_intersect(const priv_set_t *, priv_set_t *);
  74 extern void priv_union(const priv_set_t *, priv_set_t *);
  75 extern void priv_inverse(priv_set_t *);
  76 extern int priv_addset(priv_set_t *, const char *);
  77 extern void priv_copyset(const priv_set_t *, priv_set_t *);
  78 extern int priv_delset(priv_set_t *, const char *);
  79 extern boolean_t priv_ismember(const priv_set_t *, const char *);
  80 
  81 #else   /* Non ANSI */
  82 
  83 extern int setppriv(/* priv_op_t, priv_ptype_t, const priv_set_t * */);
  84 extern int getppriv(/* priv_ptype_t, priv_set_t * */);
  85 extern int setpflags(/* uint_t, uint_t */);
  86 extern uint_t getpflags(/* uint_t */);
  87 extern priv_impl_info_t *getprivimplinfo(/* void */);
  88 
  89 extern int priv_set(/* priv_op_t, priv_ptype_t, ... */);
  90 extern boolean_t priv_ineffect(/* const char * */);
  91 extern priv_set_t *priv_str_to_set(/*
  92                             const char *, const char *, const char ** */);
  93 extern char *priv_set_to_str(/* const priv_set_t *, char, int */);
  94 
  95 extern int priv_getbyname(/* const char * */);
  96 extern char *priv_getbynum(/* int */);
  97 extern int priv_getsetbyname(/* const char * */);
  98 extern char *priv_getsetbynum(/* int */);
  99 extern char *priv_gettext(/* const char * */);
 100 
 101 extern priv_set_t *priv_allocset(/* void */);
 102 extern void priv_freeset(/* priv_set_t * */);
 103 
 104 extern void priv_emptyset(/* priv_set_t * */);
 105 extern void priv_basicset(/* priv_set_t * */);
 106 extern void priv_fillset(/* priv_set_t * */);
 107 extern boolean_t priv_isemptyset(/* const priv_set_t * */);
 108 extern boolean_t priv_isfullset(/* const priv_set_t * */);
 109 extern boolean_t priv_isequalset(/* const priv_set_t *, const priv_set_t * */);
 110 extern boolean_t priv_issubset(/* const priv_set_t *, const priv_set_t * */);
 111 extern void priv_intersect(/* const priv_set_t *, priv_set_t * */);
 112 extern void priv_union(/* const priv_set_t *, priv_set_t * */);
 113 extern void priv_inverse(/* priv_set_t * */);
 114 extern int priv_addset(/* priv_set_t *, const char * */);
 115 extern void priv_copyset(/* const priv_set_t *, priv_set_t * */);
 116 extern int priv_delset(/* priv_set_t *, const char * */);
 117 extern boolean_t priv_ismember(/* const priv_set_t *, const char * */);
 118 
 119 #endif  /* __STDC__ */
 120 
 121 #ifdef  __cplusplus
 122 }
 123 #endif
 124 
 125 #endif  /* _PRIV_H_ */