blob: eeb1d2d0ce5cc2d195486d46d11b8ae7a244f3bd [file] [log] [blame]
Emeric Vigier2f625822012-08-06 11:09:52 -04001/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
2/* signals.h Bus signal connection implementation
3 *
4 * Copyright (C) 2003 Red Hat, Inc.
5 *
6 * Licensed under the Academic Free License version 2.1
7 *
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.
12 *
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.
17 *
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 *
22 */
23
24#ifndef BUS_SIGNALS_H
25#define BUS_SIGNALS_H
26
27#include <dbus/dbus.h>
28#include <dbus/dbus-string.h>
29#include <dbus/dbus-sysdeps.h>
30#include "connection.h"
31
32typedef enum
33{
34 BUS_MATCH_MESSAGE_TYPE = 1 << 0,
35 BUS_MATCH_INTERFACE = 1 << 1,
36 BUS_MATCH_MEMBER = 1 << 2,
37 BUS_MATCH_SENDER = 1 << 3,
38 BUS_MATCH_DESTINATION = 1 << 4,
39 BUS_MATCH_PATH = 1 << 5,
40 BUS_MATCH_ARGS = 1 << 6
41} BusMatchFlags;
42
43BusMatchRule* bus_match_rule_new (DBusConnection *matches_go_to);
44BusMatchRule* bus_match_rule_ref (BusMatchRule *rule);
45void bus_match_rule_unref (BusMatchRule *rule);
46
47dbus_bool_t bus_match_rule_set_message_type (BusMatchRule *rule,
48 int type);
49dbus_bool_t bus_match_rule_set_interface (BusMatchRule *rule,
50 const char *interface);
51dbus_bool_t bus_match_rule_set_member (BusMatchRule *rule,
52 const char *member);
53dbus_bool_t bus_match_rule_set_sender (BusMatchRule *rule,
54 const char *sender);
55dbus_bool_t bus_match_rule_set_destination (BusMatchRule *rule,
56 const char *destination);
57dbus_bool_t bus_match_rule_set_path (BusMatchRule *rule,
58 const char *path);
59dbus_bool_t bus_match_rule_set_arg (BusMatchRule *rule,
60 int arg,
61 const DBusString *value,
62 dbus_bool_t is_path);
63
64BusMatchRule* bus_match_rule_parse (DBusConnection *matches_go_to,
65 const DBusString *rule_text,
66 DBusError *error);
67
68BusMatchmaker* bus_matchmaker_new (void);
69BusMatchmaker* bus_matchmaker_ref (BusMatchmaker *matchmaker);
70void bus_matchmaker_unref (BusMatchmaker *matchmaker);
71
72dbus_bool_t bus_matchmaker_add_rule (BusMatchmaker *matchmaker,
73 BusMatchRule *rule);
74dbus_bool_t bus_matchmaker_remove_rule_by_value (BusMatchmaker *matchmaker,
75 BusMatchRule *value,
76 DBusError *error);
77void bus_matchmaker_remove_rule (BusMatchmaker *matchmaker,
78 BusMatchRule *rule);
79void bus_matchmaker_disconnected (BusMatchmaker *matchmaker,
80 DBusConnection *connection);
81dbus_bool_t bus_matchmaker_get_recipients (BusMatchmaker *matchmaker,
82 BusConnections *connections,
83 DBusConnection *sender,
84 DBusConnection *addressed_recipient,
85 DBusMessage *message,
86 DBusList **recipients_p);
87
88#endif /* BUS_SIGNALS_H */