00001 /** 00002 * @file 00003 * Defines the public interface for searching and iterating over 00004 * range transition rules. 00005 * 00006 * @author Kevin Carr kcarr@tresys.com 00007 * @author Jeremy A. Mowery jmowery@tresys.com 00008 * @author Jason Tang jtang@tresys.com 00009 * 00010 * Copyright (C) 2006-2007 Tresys Technology, LLC 00011 * 00012 * This library is free software; you can redistribute it and/or 00013 * modify it under the terms of the GNU Lesser General Public 00014 * License as published by the Free Software Foundation; either 00015 * version 2.1 of the License, or (at your option) any later version. 00016 * 00017 * This library is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00020 * Lesser General Public License for more details. 00021 * 00022 * You should have received a copy of the GNU Lesser General Public 00023 * License along with this library; if not, write to the Free Software 00024 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00025 */ 00026 00027 #ifndef QPOL_MLSRULE_QUERY_H 00028 #define QPOL_MLSRULE_QUERY_H 00029 00030 #ifdef __cplusplus 00031 extern "C" 00032 { 00033 #endif 00034 00035 #include <qpol/policy.h> 00036 00037 typedef struct qpol_range_trans qpol_range_trans_t; 00038 00039 /** 00040 * Get an iterator over all range transition rules in a policy. 00041 * @param policy Policy from which to get the range transitions. 00042 * @param iter Iterator over items of type qpol_range_trans_t returned. 00043 * The caller is responsible for calling qpol_iterator_destroy() 00044 * to free memory used by this iterator. 00045 * It is important to note that this iterator is only valid as long as 00046 * the policy is unmodifed. 00047 * @returm 0 on success and < 0 on failure; if the call fails, 00048 * errno will be set and *iter will be NULL. 00049 */ 00050 extern int qpol_policy_get_range_trans_iter(const qpol_policy_t * policy, qpol_iterator_t ** iter); 00051 00052 /** 00053 * Get the source type from a range transition rule. 00054 * @param policy Policy from which the rule comes. 00055 * @param rule The rule from which to get the source type. 00056 * @param source Pointer in which to store the source type. 00057 * The caller should not free this pointer. 00058 * @returm 0 on success and < 0 on failure; if the call fails, 00059 * errno will be set and *source will be NULL. 00060 */ 00061 extern int qpol_range_trans_get_source_type(const qpol_policy_t * policy, const qpol_range_trans_t * rule, 00062 const qpol_type_t ** source); 00063 00064 /** 00065 * Get the target type from a range transition rule. 00066 * @param policy Policy from which the rule comes. 00067 * @param rule The rule from which to get the target type. 00068 * @param target Pointer in which to store the target type. 00069 * The caller should not free this pointer. 00070 * @returm 0 on success and < 0 on failure; if the call fails, 00071 * errno will be set and *target will be NULL. 00072 */ 00073 extern int qpol_range_trans_get_target_type(const qpol_policy_t * policy, const qpol_range_trans_t * rule, 00074 const qpol_type_t ** target); 00075 00076 /** 00077 * Get the target class from a range transition rule. 00078 * @param policy Policy from which the rule comes. 00079 * @param rule The rule from which to get the target class. 00080 * @param target Pointer in which to store the target class. 00081 * The caller should not free this pointer. 00082 * @returm 0 on success and < 0 on failure; if the call fails, 00083 * errno will be set and *target will be NULL. 00084 */ 00085 extern int qpol_range_trans_get_target_class(const qpol_policy_t * policy, const qpol_range_trans_t * rule, 00086 const qpol_class_t ** target); 00087 00088 /** 00089 * Get the range from a range transition rule. 00090 * @param policy Policy from which the rule comes. 00091 * @param rule The rule from which to get the range. 00092 * @param range Pointer in which to store the range. 00093 * The caller should not free this pointer. 00094 * @returm 0 on success and < 0 on failure; if the call fails, 00095 * errno will be set and *range will be NULL. 00096 */ 00097 extern int qpol_range_trans_get_range(const qpol_policy_t * policy, const qpol_range_trans_t * rule, 00098 const qpol_mls_range_t ** range); 00099 00100 #ifdef __cplusplus 00101 } 00102 #endif 00103 00104 #endif /* QPOL_MLSRULE_QUERY_H */