dbus-marshal-byteswap: Byte-swap Unix fd indexes if needed
[platform/upstream/dbus.git] / dbus / dbus-signals.h
1 /*
2  * dbus-signals.h
3  *
4  *  Created on: Feb 26, 2014
5  *      Author: r.pajak
6  */
7
8 #ifndef DBUS_SIGNALS_H_
9 #define DBUS_SIGNALS_H_
10
11 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
12 /* signals.h  Bus signal connection implementation
13  *
14  * Copyright (C) 2003  Red Hat, Inc.
15  *
16  * Licensed under the Academic Free License version 2.1
17  *
18  * This program is free software; you can redistribute it and/or modify
19  * it under the terms of the GNU General Public License as published by
20  * the Free Software Foundation; either version 2 of the License, or
21  * (at your option) any later version.
22  *
23  * This program is distributed in the hope that it will be useful,
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26  * GNU General Public License for more details.
27  *
28  * You should have received a copy of the GNU General Public License
29  * along with this program; if not, write to the Free Software
30  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
31  *
32  */
33
34 #include <dbus/dbus.h>
35 #include <dbus/dbus-string.h>
36 #include <dbus/dbus-sysdeps.h>
37 #include <dbus/dbus-transport.h>
38
39 typedef struct Matchmaker    Matchmaker;
40 typedef struct MatchRule     MatchRule;
41
42 #ifndef MATCH_ARG_NAMESPACE
43 #define MATCH_ARG_NAMESPACE   0x4000000u
44 #endif
45 #ifndef MATCH_ARG_IS_PATH
46 #define MATCH_ARG_IS_PATH  0x8000000u
47 #endif
48
49 typedef enum
50 {
51   MATCH_MESSAGE_TYPE            = 1 << 0,
52   MATCH_INTERFACE               = 1 << 1,
53   MATCH_MEMBER                  = 1 << 2,
54   MATCH_SENDER                  = 1 << 3,
55   MATCH_DESTINATION             = 1 << 4,
56   MATCH_PATH                    = 1 << 5,
57   MATCH_ARGS                    = 1 << 6,
58   MATCH_PATH_NAMESPACE          = 1 << 7,
59   MATCH_CLIENT_IS_EAVESDROPPING = 1 << 8
60 } MatchFlags;
61
62 void  match_rule_unref (MatchRule   *rule);
63 void  match_rule_set_cookie (MatchRule *rule, dbus_uint64_t cookie);
64 dbus_uint64_t match_rule_get_cookie (MatchRule *rule);
65
66 /* Calling this methods a client declares that it is creating a rule which
67  * needs to eavesdrop (e.g., dbus-monitor), any other created rules not
68  * setting themselves as eavesdropping won't receive any message not addressed
69  * to them, when eavedrop is enabled in the policy.  On the other hand, when
70  * eavedrop is not enabled in policy, this method won't have any effect */
71 //void bus_match_rule_set_client_is_eavesdropping (BusMatchRule     *rule,
72 //                                                 dbus_bool_t is_eavesdropping);
73
74 DBusList ** matchmaker_get_rules (Matchmaker *matchmaker,
75                           int            message_type,
76                           const char    *interface,
77                           dbus_bool_t    create);
78
79 MatchRule* match_rule_parse (DBusConnection   *matches_go_to,
80                                     const DBusString *rule_text,
81                                     DBusError        *error);
82
83 dbus_bool_t match_rule_equal_lib (MatchRule *a, MatchRule *b);
84
85
86 Matchmaker* matchmaker_new   (void);
87
88 dbus_bool_t matchmaker_add_rule             (Matchmaker   *matchmaker,
89                                                  MatchRule    *rule);
90 DBusList* matchmaker_get_rules_list (Matchmaker   *matchmaker,
91                                      MatchRule    *rule);
92 dbus_bool_t matchmaker_remove_rule_by_value (Matchmaker   *matchmaker,
93                                                  MatchRule    *value,
94                                                  DBusError       *error);
95 void        free_matchmaker                     (Matchmaker *matchmaker);
96
97 dbus_bool_t match_rule_matches (DBusTransport *transport,
98                     MatchRule    *rule,
99                     DBusMessage     *message,
100                     MatchFlags    already_matched);
101
102 #ifdef DBUS_ENABLE_VERBOSE_MODE
103 char* match_rule_to_string (MatchRule *rule);
104 #endif
105
106 int          _match_rule_get_message_type   (MatchRule *rule);
107 const char * _match_rule_get_interface      (MatchRule *rule);
108 const char * _match_rule_get_member         (MatchRule *rule);
109 const char * _match_rule_get_sender         (MatchRule *rule);
110 const char * _match_rule_get_destination    (MatchRule *rule);
111 const char * _match_rule_get_path           (MatchRule *rule);
112 const char * _match_rule_get_path_namespace (MatchRule *rule);
113 int          _match_rule_get_args_len       (MatchRule *rule);
114 const char * _match_rule_get_args           (MatchRule *rule, int i);
115 unsigned int _match_rule_get_arg_lens       (MatchRule *rule, int i);
116
117 #endif /* DBUS_SIGNALS_H_ */