1 /* -*- mode: C; c-file-style: "gnu" -*- */
2 /* policy.h Policies for what a connection can do
4 * Copyright (C) 2003 Red Hat, Inc.
6 * Licensed under the Academic Free License version 1.2
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 #include <dbus/dbus.h>
28 #include <dbus/dbus-string.h>
34 BUS_POLICY_RULE_RECEIVE,
44 BusPolicyRuleType type;
46 unsigned int allow : 1; /**< #TRUE if this allows, #FALSE if it denies */
52 /* either can be NULL meaning "any" */
59 /* either can be NULL meaning "any" */
66 /* can be NULL meaning "any" */
85 BusPolicyRule* bus_policy_rule_new (BusPolicyRuleType type,
87 void bus_policy_rule_ref (BusPolicyRule *rule);
88 void bus_policy_rule_unref (BusPolicyRule *rule);
90 BusPolicy* bus_policy_new (void);
91 void bus_policy_ref (BusPolicy *policy);
92 void bus_policy_unref (BusPolicy *policy);
93 dbus_bool_t bus_policy_check_can_send (BusPolicy *policy,
94 BusRegistry *registry,
95 DBusConnection *receiver,
96 DBusMessage *message);
97 dbus_bool_t bus_policy_check_can_receive (BusPolicy *policy,
98 BusRegistry *registry,
99 DBusConnection *sender,
100 DBusMessage *message);
101 dbus_bool_t bus_policy_check_can_own (BusPolicy *policy,
102 DBusConnection *connection,
103 const DBusString *service_name);
104 dbus_bool_t bus_policy_append_rule (BusPolicy *policy,
105 BusPolicyRule *rule);
106 void bus_policy_optimize (BusPolicy *policy);
108 #endif /* BUS_POLICY_H */