libexplain  1.4.D001
libexplain/have_permission.h
Go to the documentation of this file.
00001 /*
00002  * libexplain - Explain errno values returned by libc functions
00003  * Copyright (C) 2008, 2009, 2013 Peter Miller
00004  * Written by Peter Miller <pmiller@opensource.org.au>
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU Lesser General Public License as
00008  * published by the Free Software Foundation; either version 3 of the
00009  * License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public License
00017  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00018  */
00019 
00020 #ifndef LIBEXPLAIN_HAVE_PERMISSION_H
00021 #define LIBEXPLAIN_HAVE_PERMISSION_H
00022 
00023 #include <libexplain/string_buffer.h>
00024 
00025 struct stat; /* forward */
00026 
00027 typedef struct explain_have_identity_t explain_have_identity_t;
00028 struct explain_have_identity_t
00029 {
00030     int uid;
00031     int gid;
00032 };
00033 
00041 void explain_have_identity_init(explain_have_identity_t *id);
00042 
00054 int explain_have_read_permission(const struct stat *st,
00055     const explain_have_identity_t *hip);
00056 
00071 int explain_explain_read_permission(explain_string_buffer_t *sb,
00072     const struct stat *st, const explain_have_identity_t *hip);
00073 
00086 int explain_have_write_permission(const struct stat *st,
00087     const explain_have_identity_t *hip);
00088 
00103 int explain_explain_write_permission(explain_string_buffer_t *sb,
00104     const struct stat *st, const explain_have_identity_t *hip);
00105 
00118 int explain_have_execute_permission(const struct stat *st,
00119     const explain_have_identity_t *hip);
00120 
00135 int explain_explain_execute_permission(explain_string_buffer_t *sb,
00136     const struct stat *st, const explain_have_identity_t *hip);
00137 
00150 int explain_have_search_permission(const struct stat *st,
00151     const explain_have_identity_t *hip);
00152 
00167 int explain_explain_search_permission(explain_string_buffer_t *sb,
00168     const struct stat *st, const explain_have_identity_t *hip);
00169 
00182 int explain_have_inode_permission(const struct stat *st,
00183     const explain_have_identity_t *hip);
00184 
00194 const char *explain_have_identity_kind_of_uid(
00195     const explain_have_identity_t *hip);
00196 
00206 const char *explain_have_identity_kind_of_gid(
00207     const explain_have_identity_t *hip);
00208 
00209 #endif /* LIBEXPLAIN_HAVE_PERMISSION_H */
00210 /* vim: set ts=8 sw=4 et : */