Add an accessor for the loader's corruption reason
authorWill Thompson <will.thompson@collabora.co.uk>
Sat, 8 Aug 2009 13:29:12 +0000 (14:29 +0100)
committerColin Walters <walters@verbum.org>
Thu, 28 Jan 2010 22:01:23 +0000 (17:01 -0500)
dbus/dbus-message-internal.h
dbus/dbus-message.c

index 7cd88d5..0134f8d 100644 (file)
@@ -23,6 +23,7 @@
 #ifndef DBUS_MESSAGE_INTERNAL_H
 #define DBUS_MESSAGE_INTERNAL_H
 
+#include <dbus/dbus-marshal-validate.h>
 #include <dbus/dbus-message.h>
 #include <dbus/dbus-resources.h>
 #include <dbus/dbus-list.h>
@@ -62,6 +63,7 @@ void               _dbus_message_loader_putback_message_link  (DBusMessageLoader
                                                                DBusList           *link);
 
 dbus_bool_t        _dbus_message_loader_get_is_corrupted      (DBusMessageLoader  *loader);
+DBusValidity       _dbus_message_loader_get_corruption_reason (DBusMessageLoader  *loader);
 
 void               _dbus_message_loader_set_max_message_size  (DBusMessageLoader  *loader,
                                                                long                size);
index 0b81806..272592e 100644 (file)
@@ -3785,6 +3785,21 @@ _dbus_message_loader_get_is_corrupted (DBusMessageLoader *loader)
 }
 
 /**
+ * Checks what kind of bad data confused the loader.
+ *
+ * @param loader the loader
+ * @returns why the loader is hosed, or DBUS_VALID if it isn't.
+ */
+DBusValidity
+_dbus_message_loader_get_corruption_reason (DBusMessageLoader *loader)
+{
+  _dbus_assert ((loader->corrupted && loader->corruption_reason != DBUS_VALID) ||
+                (!loader->corrupted && loader->corruption_reason == DBUS_VALID));
+
+  return loader->corruption_reason;
+}
+
+/**
  * Sets the maximum size message we allow.
  *
  * @param loader the loader