mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-01-08 21:00:18 +01:00
bfo20738 - Translate DBusValidity into error message
Signed-off-by: Federico Mena Quintero <federico@novell.com>
This commit is contained in:
parent
16a947eedb
commit
099b5e59ea
2 changed files with 73 additions and 0 deletions
|
|
@ -810,6 +810,77 @@ _dbus_validate_path (const DBusString *str,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
const char *
|
||||
_dbus_validity_to_error_message (DBusValidity validity)
|
||||
{
|
||||
switch (validity)
|
||||
{
|
||||
case DBUS_VALIDITY_UNKNOWN_OOM_ERROR: return "Out of memory";
|
||||
case DBUS_INVALID_FOR_UNKNOWN_REASON: return "Unknown reason";
|
||||
case DBUS_VALID_BUT_INCOMPLETE: return "Valid but incomplete";
|
||||
case DBUS_VALIDITY_UNKNOWN: return "Validity unknown";
|
||||
case DBUS_VALID: return "Valid";
|
||||
case DBUS_INVALID_UNKNOWN_TYPECODE: return "Unknown typecode";
|
||||
case DBUS_INVALID_MISSING_ARRAY_ELEMENT_TYPE: return "Missing array element type";
|
||||
case DBUS_INVALID_SIGNATURE_TOO_LONG: return "Signature is too long";
|
||||
case DBUS_INVALID_EXCEEDED_MAXIMUM_ARRAY_RECURSION: return "Exceeded maximum array recursion";
|
||||
case DBUS_INVALID_EXCEEDED_MAXIMUM_STRUCT_RECURSION: return "Exceeded maximum struct recursion";
|
||||
case DBUS_INVALID_STRUCT_ENDED_BUT_NOT_STARTED: return "Struct ended but not started";
|
||||
case DBUS_INVALID_STRUCT_STARTED_BUT_NOT_ENDED: return "Struct started but not ended";
|
||||
case DBUS_INVALID_STRUCT_HAS_NO_FIELDS: return "Struct has no fields";
|
||||
case DBUS_INVALID_ALIGNMENT_PADDING_NOT_NUL: return "Alignment padding not null";
|
||||
case DBUS_INVALID_BOOLEAN_NOT_ZERO_OR_ONE: return "Boolean is not zero or one";
|
||||
case DBUS_INVALID_NOT_ENOUGH_DATA: return "Not enough data";
|
||||
case DBUS_INVALID_TOO_MUCH_DATA: return "Too much data";
|
||||
case DBUS_INVALID_BAD_BYTE_ORDER: return "Bad byte order";
|
||||
case DBUS_INVALID_BAD_PROTOCOL_VERSION: return "Bad protocol version";
|
||||
case DBUS_INVALID_BAD_MESSAGE_TYPE: return "Bad message type";
|
||||
case DBUS_INVALID_BAD_SERIAL: return "Bad serial";
|
||||
case DBUS_INVALID_INSANE_FIELDS_ARRAY_LENGTH: return "Insane fields array length";
|
||||
case DBUS_INVALID_INSANE_BODY_LENGTH: return "Insane body length";
|
||||
case DBUS_INVALID_MESSAGE_TOO_LONG: return "Message too long";
|
||||
case DBUS_INVALID_HEADER_FIELD_CODE: return "Header field code";
|
||||
case DBUS_INVALID_HEADER_FIELD_HAS_WRONG_TYPE: return "Header field has wrong type";
|
||||
case DBUS_INVALID_USES_LOCAL_INTERFACE: return "Uses local interface";
|
||||
case DBUS_INVALID_USES_LOCAL_PATH: return "Uses local path";
|
||||
case DBUS_INVALID_HEADER_FIELD_APPEARS_TWICE: return "Header field appears twice";
|
||||
case DBUS_INVALID_BAD_DESTINATION: return "Bad destination";
|
||||
case DBUS_INVALID_BAD_INTERFACE: return "Bad interface";
|
||||
case DBUS_INVALID_BAD_MEMBER: return "Bad member";
|
||||
case DBUS_INVALID_BAD_ERROR_NAME: return "Bad error name";
|
||||
case DBUS_INVALID_BAD_SENDER: return "Bad sender";
|
||||
case DBUS_INVALID_MISSING_PATH: return "Missing path";
|
||||
case DBUS_INVALID_MISSING_INTERFACE: return "Missing interface";
|
||||
case DBUS_INVALID_MISSING_MEMBER: return "Missing member";
|
||||
case DBUS_INVALID_MISSING_ERROR_NAME: return "Missing error name";
|
||||
case DBUS_INVALID_MISSING_REPLY_SERIAL: return "Missing reply serial";
|
||||
case DBUS_INVALID_LENGTH_OUT_OF_BOUNDS: return "Length out of bounds";
|
||||
case DBUS_INVALID_ARRAY_LENGTH_EXCEEDS_MAXIMUM: return "Array length exceeds maximum";
|
||||
case DBUS_INVALID_BAD_PATH: return "Bad path";
|
||||
case DBUS_INVALID_SIGNATURE_LENGTH_OUT_OF_BOUNDS: return "Signature length out of bounds";
|
||||
case DBUS_INVALID_BAD_UTF8_IN_STRING: return "Bad utf8 in string";
|
||||
case DBUS_INVALID_ARRAY_LENGTH_INCORRECT: return "Array length incorrect";
|
||||
case DBUS_INVALID_VARIANT_SIGNATURE_LENGTH_OUT_OF_BOUNDS: return "Variant signature length out of bounds";
|
||||
case DBUS_INVALID_VARIANT_SIGNATURE_BAD: return "Variant signature bad";
|
||||
case DBUS_INVALID_VARIANT_SIGNATURE_EMPTY: return "Variant signature empty";
|
||||
case DBUS_INVALID_VARIANT_SIGNATURE_SPECIFIES_MULTIPLE_VALUES: return "Variant signature specifies multiple values";
|
||||
case DBUS_INVALID_VARIANT_SIGNATURE_MISSING_NUL: return "Variant signature missing nul";
|
||||
case DBUS_INVALID_STRING_MISSING_NUL: return "String missing nul";
|
||||
case DBUS_INVALID_SIGNATURE_MISSING_NUL: return "Signature missing nul";
|
||||
case DBUS_INVALID_EXCEEDED_MAXIMUM_DICT_ENTRY_RECURSION: return "Exceeded maximum dict entry recursion";
|
||||
case DBUS_INVALID_DICT_ENTRY_ENDED_BUT_NOT_STARTED: return "Dict entry ended but not started";
|
||||
case DBUS_INVALID_DICT_ENTRY_STARTED_BUT_NOT_ENDED: return "Dict entry started but not ended";
|
||||
case DBUS_INVALID_DICT_ENTRY_HAS_NO_FIELDS: return "Dict entry has no fields";
|
||||
case DBUS_INVALID_DICT_ENTRY_HAS_ONLY_ONE_FIELD: return "Dict entry has only one field";
|
||||
case DBUS_INVALID_DICT_ENTRY_HAS_TOO_MANY_FIELDS: return "Dict entry has too many fields";
|
||||
case DBUS_INVALID_DICT_ENTRY_NOT_INSIDE_ARRAY: return "Dict entry not inside array";
|
||||
case DBUS_INVALID_DICT_KEY_MUST_BE_BASIC_TYPE: return "Dict key must be basic type";
|
||||
|
||||
default:
|
||||
return "Invalid";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the given range of the string is a valid interface name
|
||||
* in the D-Bus protocol. This includes a length restriction and an
|
||||
|
|
|
|||
|
|
@ -131,6 +131,8 @@ DBusValidity _dbus_validate_body_with_reason (const DBusString *expected_si
|
|||
int value_pos,
|
||||
int len);
|
||||
|
||||
const char *_dbus_validity_to_error_message (DBusValidity validity);
|
||||
|
||||
dbus_bool_t _dbus_validate_path (const DBusString *str,
|
||||
int start,
|
||||
int len);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue