gridsite-gacl.h
Go to the documentation of this file.
00001 /*
00002    Copyright (c) 2002-4, Andrew McNab, University of Manchester
00003    All rights reserved.
00004 
00005    Redistribution and use in source and binary forms, with or
00006    without modification, are permitted provided that the following
00007    conditions are met:
00008 
00009      o Redistributions of source code must retain the above
00010        copyright notice, this list of conditions and the following
00011        disclaimer. 
00012      o Redistributions in binary form must reproduce the above
00013        copyright notice, this list of conditions and the following
00014        disclaimer in the documentation and/or other materials
00015        provided with the distribution. 
00016 
00017    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
00018    CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
00019    INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00020    MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00021    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
00022    BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00023    EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
00024    TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00025    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
00026    ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00027    OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00028    OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00029    POSSIBILITY OF SUCH DAMAGE.
00030 */
00031 
00032 /*---------------------------------------------------------------*
00033  * For more about GridSite: http://www.gridsite.org/             *
00034  *---------------------------------------------------------------*/
00035 
00036 #ifndef HEADER_GACL_H
00037 #define HEADER_GACL_H
00038 
00039 #ifdef __cplusplus
00040 extern "C" {
00041 #endif
00042 
00043 #ifndef GACL_LIB_VERSION
00044 #define GACL_LIB_VERSION "x.x.x"
00045 #endif
00046 
00047 typedef GRSTgaclCred GACLcred;
00048 
00049 typedef int                GACLaction;
00050 typedef unsigned int       GACLperm;
00051 
00052 typedef GRSTgaclEntry  GACLentry;
00053 
00054 typedef GRSTgaclAcl    GACLacl;  
00055 
00056 typedef GRSTgaclUser   GACLuser;
00057 
00058 extern char      *gacl_perm_syms[];
00059 extern GACLperm   gacl_perm_vals[];
00060 
00061 #define GACL_PERM_NONE  GRST_PERM_NONE
00062 #define GACL_PERM_READ  GRST_PERM_READ
00063 #define GACL_PERM_LIST  GRST_PERM_LIST
00064 #define GACL_PERM_WRITE GRST_PERM_WRITE
00065 #define GACL_PERM_ADMIN GRST_PERM_ADMIN
00066 
00067 #define GACLhasNone(perm)  (perm == 0)
00068 #define GACLhasRead(perm)  ((perm & GRST_PERM_READ) != 0)
00069 #define GACLhasList(perm)  ((perm & GRST_PERM_LIST) != 0)
00070 #define GACLhasWrite(perm) ((perm & GRST_PERM_WRITE) != 0)
00071 #define GACLhasAdmin(perm) ((perm & GRST_PERM_ADMIN) != 0)
00072 
00073 #define GACL_ACTION_ALLOW GRST_ACTION_ALLOW
00074 #define GACL_ACTION_DENY  GRST_ACTION_DENY
00075 
00076 #define GACL_ACL_FILE GRST_ACL_FILE
00077 #define GACL_DN_LISTS GRST_DN_LISTS
00078 
00079 #define GACLinit() GRSTgaclInit()
00080 
00081 #define GACLnewCred(x)          GRSTgaclCredNew((x))
00082 /* GACLcred  *GACLnewCred(char *); */
00083 
00084 #define GACLaddToCred(x,y,z)    GRSTgaclCredAddValue((x),(y),(z))
00085 /* int        GACLaddToCred(GACLcred *, char *, char *); */
00086 
00087 #define GACLfreeCred(x)         GRSTgaclCredFree((x))
00088 /* int        GACLfreeCred(GACLcred *); */
00089 
00090 #define GACLaddCred(x,y)        GRSTgaclEntryAddCred((x),(y))
00091 /* int        GACLaddCred(GACLentry *, GACLcred *); */
00092 
00093 #define GACLdelCred(x,y)        GRSTgaclEntryDelCred((x),(y))
00094 /* int        GACLdelCred(GACLentry *, GACLcred *); */
00095 
00096 #define GACLprintCred(x,y)      GRSTgaclCredPrint((x),(y))
00097 /*  int        GACLprintCred(GACLcred *, FILE *); */
00098 
00099 
00100 #define GACLnewEntry()          GRSTgaclEntryNew()
00101 /*  GACLentry *GACLnewEntry(void); */
00102 
00103 #define GACLfreeEntry(x)        GRSTgaclEntryFree((x))
00104 /*  int        GACLfreeEntry(GACLentry *); */
00105 
00106 #define GACLaddEntry(x,y)       GRSTgaclAclAddEntry((x),(y))
00107 /*  int        GACLaddEntry(GACLacl *, GACLentry *); */
00108 
00109 #define GACLprintEntry(x,y)     GRSTgaclEntryPrint((x),(y))
00110 /*  int        GACLprintEntry(GACLentry *, FILE *); */
00111 
00112 
00113 #define GACLprintPerm(x,y)      GRSTgaclPermPrint((x),(y))
00114 /* int        GACLprintPerm(GACLperm, FILE *); */
00115 
00116 #define GACLallowPerm(x,y)      GRSTgaclEntryAllowPerm((x),(y))
00117 /*  int        GACLallowPerm(GACLentry *, GACLperm); */
00118 
00119 #define GACLunallowPerm(x,y)    GRSTgaclEntryUnallowPerm((x),(y))
00120 /* int        GACLunallowPerm(GACLentry *, GACLperm); */
00121 
00122 #define GACLdenyPerm(x,y)       GRSTgaclEntryDenyPerm((x),(y))
00123 /*  int        GACLdenyPerm(GACLentry *, GACLperm); */
00124 
00125 #define GACLundenyPerm(x,y)     GRSTgaclEntryUndenyPerm((x),(y))
00126 /*  int        GACLundenyPerm(GACLentry *, GACLperm); */
00127 
00128 #define GACLpermToChar(x)       GRSTgaclPermToChar((x))
00129 /*  char      *GACLpermToChar(GACLperm); */
00130 
00131 #define GACLcharToPerm(x)       GRSTgaclPermFromChar((x))
00132 /*  GACLperm   GACLcharToPerm(char *); */
00133 
00134 #define GACLnewAcl()            GRSTgaclAclNew()
00135 /*  GACLacl   *GACLnewAcl(void); */
00136 
00137 #define GACLfreeAcl(x)          GRSTgaclAclFree((x))
00138 /*  int        GACLfreeAcl(GACLacl *); */
00139 
00140 #define GACLprintAcl(x,y)       GRSTgaclAclPrint((x),(y))
00141 /*  int        GACLprintAcl(GACLacl *, FILE *); */
00142 
00143 #define GACLsaveAcl(x,y)        GRSTgaclAclSave((y),(x))
00144 /*  int        GACLsaveAcl(char *, GACLacl *); */
00145 
00146 #define GACLloadAcl(x)          GRSTgaclAclLoadFile((x))
00147 /*  GACLacl   *GACLloadAcl(char *); */
00148 
00149 #define GACLfindAclForFile(x)   GRSTgaclFileFindAclname((x))
00150 /*  char      *GACLfindAclForFile(char *); */
00151 
00152 #define GACLloadAclForFile(x)   GRSTgaclAclLoadforFile((x))
00153 /*  GACLacl   *GACLloadAclForFile(char *); */
00154 
00155 #define GACLisAclFile(x)        GRSTgaclFileIsAcl((x))
00156 /*  int        GACLisAclFile(char *); */
00157 
00158 
00159 #define GACLnewUser(x)          GRSTgaclUserNew((x))
00160 /*  GACLuser *GACLnewUser(GACLcred *); */
00161 
00162 #define GACLfreeUser(x)         GRSTgaclUserFree((x))
00163 /*  int       GACLfreeUser(GACLuser *); */
00164 
00165 #define GACLuserAddCred(x,y)    GRSTgaclUserAddCred((x),(y))
00166 /*  int       GACLuserAddCred(GACLuser *, GACLcred *); */
00167 
00168 #define GACLuserHasCred(x,y)    GRSTgaclUserHasCred((x),(y))
00169 /*  int       GACLuserHasCred(GACLuser *, GACLcred *); */
00170 
00171 #define GACLuserFindCredType(x,y) GRSTgaclUserFindCredtype((x),(y))
00172 /*  GACLcred *GACLuserFindCredType(GACLuser *, char *); */
00173 
00174 #define GACLtestDnList(x,y)     GRSTgaclDNlistHasUser((x),(y))
00175 /*  int        GACLtestDnList(char *, GACLuser *); */
00176 
00177 #define GACLtestUserAcl(x,y)    GRSTgaclAclTestUser((x),(y))
00178 /*  GACLperm   GACLtestUserAcl(GACLacl *, GACLuser *); */
00179 
00180 #define GACLtestExclAcl(x,y)    GRSTgaclAclTestexclUser((x),(y))
00181 /*  GACLperm   GACLtestExclAcl(GACLacl *, GACLuser *); */
00182 
00183 
00184 #define GACLurlEncode(x)        GRSThttpUrlEncode((x))
00185 /*  char      *GACLurlEncode(char *); */
00186 
00187 #define GACLmildUrlEncode(x)    GRSThttpUrlMildencode((x))
00188 /*  char      *GACLmildUrlEncode(char *); */
00189 
00190 GRSTgaclEntry *GACLparseEntry(void *cur);
00191 
00192 #ifdef __cplusplus
00193 } // extern "C"
00194 #endif
00195 
00196 #endif // HEADER_GACL_H