1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
/* vim:set et sts=4: */
/* IBus - The Input Bus
* Copyright (C) 2008-2009 Huang Peng <shawn.p.huang@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __MATCH_RULE_H_
#define __MATCH_RULE_H_
#include <glib-object.h>
typedef struct _BusMatchRule BusMatchRule;
typedef enum {
MATCH_TYPE = 1 << 0,
MATCH_INTERFACE = 1 << 1,
MATCH_MEMBER = 1 << 2,
MATCH_SENDER = 1 << 3,
MATCH_DESTINATION = 1 << 4,
MATCH_PATH = 1 << 5,
MATCH_ARGS = 1 << 6,
} BusMatchFlags;
struct _BusMatchRule {
gint refcount;
gint flags;
gint message_type;
gchar *interface;
gchar *member;
gchar *sender;
gchar *destination;
gchar *path;
GArray *args;
};
G_BEGIN_DECLS
BusMatchRule *bus_match_rule_new (const gchar *text);
BusMatchRule *bus_match_rule_ref (BusMatchRule *rule);
void bus_match_rule_unref (BusMatchRule *rule);
void bus_match_rule_free (BusMatchRule *rule);
gboolean bus_match_rule_set_message_type
(BusMatchRule *rule,
gint type);
gboolean bus_match_rule_set_sender (BusMatchRule *rule,
const gchar *sender);
gboolean bus_match_rule_set_interface
(BusMatchRule *rule,
const gchar *interface);
gboolean bus_match_rule_set_member (BusMatchRule *rule,
const gchar *member);
gboolean bus_match_rule_set_path (BusMatchRule *rule,
const gchar *path);
gboolean bus_match_rule_set_destination
(BusMatchRule *rule,
const gchar *dest);
gboolean bus_match_rule_set_arg (BusMatchRule *rule,
guint arg_i,
const gchar *arg);
gboolean bus_match_rule_match (BusMatchRule *rule,
DBusMessage *message);
gboolean bus_match_rule_is_equal (BusMatchRule *a,
BusMatchRule *b);
G_END_DECLS
#endif
|