dbus/dbus dbus-errors.h,1.20,1.21 dbus-message.c,1.104,1.105 dbus-message.h,1.43,1.44
Havoc Pennington
hp@pdx.freedesktop.org
Thu, 09 Oct 2003 19:42:23 -0700
- Previous message: dbus/bus bus.c,1.39,1.40 config-parser.c,1.22,1.23 dispatch.c,1.51,1.52 policy.c,1.14,1.15 signals.c,1.2,1.3
- Next message: dbus/tools dbus-send.c,1.6,1.7
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvs/dbus/dbus/dbus
In directory pdx:/tmp/cvs-serv16249/dbus
Modified Files:
dbus-errors.h dbus-message.c dbus-message.h
Log Message:
2003-10-09 Havoc Pennington <hp@redhat.com>
Make matching rules theoretically work (add parser).
* bus/bus.c (bus_context_check_security_policy): fix up to handle
the case where destination is explicitly specified as bus driver
and someone else is eavesdropping.
* bus/policy.c (bus_client_policy_check_can_receive): fix up
definition of eavesdropping and assertion
* tools/dbus-send.c (main): use dbus_message_type_from_string
* bus/signals.c (bus_match_rule_parse): implement
* dbus/dbus-message.c (dbus_message_type_from_string): new
* dbus/dbus-errors.h (DBUS_ERROR_MATCH_RULE_INVALID): add
Index: dbus-errors.h
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-errors.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- dbus-errors.h 30 Sep 2003 02:32:52 -0000 1.20
+++ dbus-errors.h 10 Oct 2003 02:42:20 -0000 1.21
@@ -73,6 +73,7 @@
#define DBUS_ERROR_UNKNOWN_METHOD "org.freedesktop.DBus.Error.UnknownMethod"
#define DBUS_ERROR_TIMED_OUT "org.freedesktop.DBus.Error.TimedOut"
#define DBUS_ERROR_MATCH_RULE_NOT_FOUND "org.freedesktop.DBus.Error.MatchRuleNotFound"
+#define DBUS_ERROR_MATCH_RULE_INVALID "org.freedesktop.DBus.Error.MatchRuleInvalid"
#define DBUS_ERROR_SPAWN_EXEC_FAILED "org.freedesktop.DBus.Error.Spawn.ExecFailed"
#define DBUS_ERROR_SPAWN_FORK_FAILED "org.freedesktop.DBus.Error.Spawn.ForkFailed"
#define DBUS_ERROR_SPAWN_CHILD_EXITED "org.freedesktop.DBus.Error.Spawn.ChildExited"
Index: dbus-message.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-message.c,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -d -r1.104 -r1.105
--- dbus-message.c 30 Sep 2003 02:32:53 -0000 1.104
+++ dbus-message.c 10 Oct 2003 02:42:20 -0000 1.105
@@ -5416,6 +5416,34 @@
return res;
}
+/**
+ * Utility function to convert a machine-readable (not translated)
+ * string into a D-BUS message type.
+ *
+ * @code
+ * "method_call" -> DBUS_MESSAGE_TYPE_METHOD_CALL
+ * "method_return" -> DBUS_MESSAGE_TYPE_METHOD_RETURN
+ * "signal" -> DBUS_MESSAGE_TYPE_SIGNAL
+ * "error" -> DBUS_MESSAGE_TYPE_ERROR
+ * anything else -> DBUS_MESSAGE_TYPE_INVALID
+ * @endcode
+ *
+ */
+int
+dbus_message_type_from_string (const char *type_str)
+{
+ if (strcmp (type_str, "method_call") == 0)
+ return DBUS_MESSAGE_TYPE_METHOD_CALL;
+ if (strcmp (type_str, "method_return") == 0)
+ return DBUS_MESSAGE_TYPE_METHOD_RETURN;
+ else if (strcmp (type_str, "signal") == 0)
+ return DBUS_MESSAGE_TYPE_SIGNAL;
+ else if (strcmp (type_str, "error") == 0)
+ return DBUS_MESSAGE_TYPE_ERROR;
+ else
+ return DBUS_MESSAGE_TYPE_INVALID;
+}
+
/** @} */
#ifdef DBUS_BUILD_TESTS
#include "dbus-test.h"
Index: dbus-message.h
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-message.h,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- dbus-message.h 30 Sep 2003 02:32:53 -0000 1.43
+++ dbus-message.h 10 Oct 2003 02:42:21 -0000 1.44
@@ -275,6 +275,8 @@
void* dbus_message_get_data (DBusMessage *message,
dbus_int32_t slot);
+int dbus_message_type_from_string (const char *type_str);
+
DBUS_END_DECLS;
#endif /* DBUS_MESSAGE_H */
- Previous message: dbus/bus bus.c,1.39,1.40 config-parser.c,1.22,1.23 dispatch.c,1.51,1.52 policy.c,1.14,1.15 signals.c,1.2,1.3
- Next message: dbus/tools dbus-send.c,1.6,1.7
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]