<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>policy.h Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.2.15 --> <center> <a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="modules.html">Modules</a> <a class="qindex" href="annotated.html">Data Structures</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Data Fields</a> <a class="qindex" href="pages.html">Related Pages</a> </center> <hr><h1>policy.h</h1><div class="fragment"><pre>00001 <font class="comment">/* -*- mode: C; c-file-style: "gnu" -*- */</font> 00002 <font class="comment">/* policy.h Bus security policy</font> 00003 <font class="comment"> *</font> 00004 <font class="comment"> * Copyright (C) 2003 Red Hat, Inc.</font> 00005 <font class="comment"> *</font> 00006 <font class="comment"> * Licensed under the Academic Free License version 1.2</font> 00007 <font class="comment"> * </font> 00008 <font class="comment"> * This program is free software; you can redistribute it and/or modify</font> 00009 <font class="comment"> * it under the terms of the GNU General Public License as published by</font> 00010 <font class="comment"> * the Free Software Foundation; either version 2 of the License, or</font> 00011 <font class="comment"> * (at your option) any later version.</font> 00012 <font class="comment"> *</font> 00013 <font class="comment"> * This program is distributed in the hope that it will be useful,</font> 00014 <font class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</font> 00015 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</font> 00016 <font class="comment"> * GNU General Public License for more details.</font> 00017 <font class="comment"> * </font> 00018 <font class="comment"> * You should have received a copy of the GNU General Public License</font> 00019 <font class="comment"> * along with this program; if not, write to the Free Software</font> 00020 <font class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</font> 00021 <font class="comment"> *</font> 00022 <font class="comment"> */</font> 00023 00024 <font class="preprocessor">#ifndef BUS_POLICY_H</font> 00025 <font class="preprocessor"></font><font class="preprocessor">#define BUS_POLICY_H</font> 00026 <font class="preprocessor"></font> 00027 <font class="preprocessor">#include <dbus/dbus.h></font> 00028 <font class="preprocessor">#include <dbus/dbus-string.h></font> 00029 <font class="preprocessor">#include <dbus/dbus-sysdeps.h></font> 00030 <font class="preprocessor">#include "bus.h"</font> 00031 00032 <font class="keyword">typedef</font> <font class="keyword">enum</font> 00033 { 00034 BUS_POLICY_RULE_SEND, 00035 BUS_POLICY_RULE_RECEIVE, 00036 BUS_POLICY_RULE_OWN, 00037 BUS_POLICY_RULE_USER, 00038 BUS_POLICY_RULE_GROUP 00039 } BusPolicyRuleType; 00040 00042 <font class="preprocessor">#define BUS_POLICY_RULE_IS_PER_CLIENT(rule) (!((rule)->type == BUS_POLICY_RULE_USER || \</font> 00043 <font class="preprocessor"> (rule)->type == BUS_POLICY_RULE_GROUP))</font> 00044 <font class="preprocessor"></font> 00045 <font class="keyword">struct </font>BusPolicyRule 00046 { 00047 <font class="keywordtype">int</font> refcount; 00048 00049 BusPolicyRuleType type; 00050 00051 <font class="keywordtype">unsigned</font> <font class="keywordtype">int</font> allow : 1; 00053 <font class="keyword">union</font> 00054 <font class="keyword"> </font>{ 00055 <font class="keyword">struct</font> 00056 <font class="keyword"> </font>{ 00057 <font class="comment">/* message type can be DBUS_MESSAGE_TYPE_INVALID meaning "any" */</font> 00058 <font class="keywordtype">int</font> message_type; 00059 <font class="comment">/* any of these can be NULL meaning "any" */</font> 00060 <font class="keywordtype">char</font> *path; 00061 <font class="keywordtype">char</font> *interface; 00062 <font class="keywordtype">char</font> *member; 00063 <font class="keywordtype">char</font> *error; 00064 <font class="keywordtype">char</font> *destination; 00065 } send; 00066 00067 <font class="keyword">struct</font> 00068 <font class="keyword"> </font>{ 00069 <font class="comment">/* message type can be DBUS_MESSAGE_TYPE_INVALID meaning "any" */</font> 00070 <font class="keywordtype">int</font> message_type; 00071 <font class="comment">/* any of these can be NULL meaning "any" */</font> 00072 <font class="keywordtype">char</font> *path; 00073 <font class="keywordtype">char</font> *interface; 00074 <font class="keywordtype">char</font> *member; 00075 <font class="keywordtype">char</font> *error; 00076 <font class="keywordtype">char</font> *origin; 00077 <font class="keywordtype">unsigned</font> <font class="keywordtype">int</font> eavesdrop : 1; 00078 } receive; 00079 00080 <font class="keyword">struct</font> 00081 <font class="keyword"> </font>{ 00082 <font class="comment">/* can be NULL meaning "any" */</font> 00083 <font class="keywordtype">char</font> *service_name; 00084 } own; 00085 00086 <font class="keyword">struct</font> 00087 <font class="keyword"> </font>{ 00088 <font class="comment">/* can be DBUS_UID_UNSET meaning "any" */</font> 00089 dbus_uid_t uid; 00090 } user; 00091 00092 <font class="keyword">struct</font> 00093 <font class="keyword"> </font>{ 00094 <font class="comment">/* can be DBUS_GID_UNSET meaning "any" */</font> 00095 dbus_gid_t gid; 00096 } group; 00097 00098 } d; 00099 }; 00100 00101 BusPolicyRule* bus_policy_rule_new (BusPolicyRuleType type, 00102 dbus_bool_t allow); 00103 <font class="keywordtype">void</font> bus_policy_rule_ref (BusPolicyRule *rule); 00104 <font class="keywordtype">void</font> bus_policy_rule_unref (BusPolicyRule *rule); 00105 00106 BusPolicy* bus_policy_new (<font class="keywordtype">void</font>); 00107 <font class="keywordtype">void</font> bus_policy_ref (BusPolicy *policy); 00108 <font class="keywordtype">void</font> bus_policy_unref (BusPolicy *policy); 00109 BusClientPolicy* bus_policy_create_client_policy (BusPolicy *policy, 00110 <a class="code" href="structDBusConnection.html">DBusConnection</a> *connection, 00111 <a class="code" href="structDBusError.html">DBusError</a> *error); 00112 dbus_bool_t bus_policy_allow_user (BusPolicy *policy, 00113 <a class="code" href="structDBusUserDatabase.html">DBusUserDatabase</a> *user_database, 00114 <font class="keywordtype">unsigned</font> <font class="keywordtype">long</font> uid); 00115 dbus_bool_t bus_policy_append_default_rule (BusPolicy *policy, 00116 BusPolicyRule *rule); 00117 dbus_bool_t bus_policy_append_mandatory_rule (BusPolicy *policy, 00118 BusPolicyRule *rule); 00119 dbus_bool_t bus_policy_append_user_rule (BusPolicy *policy, 00120 dbus_uid_t uid, 00121 BusPolicyRule *rule); 00122 dbus_bool_t bus_policy_append_group_rule (BusPolicy *policy, 00123 dbus_gid_t gid, 00124 BusPolicyRule *rule); 00125 dbus_bool_t bus_policy_merge (BusPolicy *policy, 00126 BusPolicy *to_absorb); 00127 00128 BusClientPolicy* bus_client_policy_new (<font class="keywordtype">void</font>); 00129 <font class="keywordtype">void</font> bus_client_policy_ref (BusClientPolicy *policy); 00130 <font class="keywordtype">void</font> bus_client_policy_unref (BusClientPolicy *policy); 00131 dbus_bool_t bus_client_policy_check_can_send (BusClientPolicy *policy, 00132 BusRegistry *registry, 00133 <a class="code" href="structDBusConnection.html">DBusConnection</a> *receiver, 00134 <a class="code" href="structDBusMessage.html">DBusMessage</a> *message); 00135 dbus_bool_t bus_client_policy_check_can_receive (BusClientPolicy *policy, 00136 BusRegistry *registry, 00137 <a class="code" href="structDBusConnection.html">DBusConnection</a> *sender, 00138 <a class="code" href="structDBusConnection.html">DBusConnection</a> *addressed_recipient, 00139 <a class="code" href="structDBusConnection.html">DBusConnection</a> *proposed_recipient, 00140 <a class="code" href="structDBusMessage.html">DBusMessage</a> *message); 00141 dbus_bool_t bus_client_policy_check_can_own (BusClientPolicy *policy, 00142 <a class="code" href="structDBusConnection.html">DBusConnection</a> *connection, 00143 <font class="keyword">const</font> <a class="code" href="structDBusString.html">DBusString</a> *service_name); 00144 dbus_bool_t bus_client_policy_append_rule (BusClientPolicy *policy, 00145 BusPolicyRule *rule); 00146 <font class="keywordtype">void</font> bus_client_policy_optimize (BusClientPolicy *policy); 00147 00148 00149 <font class="preprocessor">#endif </font><font class="comment">/* BUS_POLICY_H */</font> </pre></div><hr><address align="right"><small>Generated on Mon Sep 29 21:31:02 2003 for D-BUS by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.2.15 </small></address> </body> </html>