00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef DBUS_MARSHAL_HEADER_H
00025 #define DBUS_MARSHAL_HEADER_H
00026
00027 #include <config.h>
00028 #include <dbus/dbus-marshal-basic.h>
00029 #include <dbus/dbus-marshal-validate.h>
00030
00031 #ifndef PACKAGE
00032 #error "config.h not included here"
00033 #endif
00034
00035 typedef struct DBusHeader DBusHeader;
00036 typedef struct DBusHeaderField DBusHeaderField;
00037
00038 #define _DBUS_HEADER_FIELD_VALUE_UNKNOWN -1
00039 #define _DBUS_HEADER_FIELD_VALUE_NONEXISTENT -2
00040
00044 struct DBusHeaderField
00045 {
00046 int value_pos;
00047 };
00048
00052 struct DBusHeader
00053 {
00054 DBusString data;
00059 DBusHeaderField fields[DBUS_HEADER_FIELD_LAST + 1];
00063 dbus_uint32_t padding : 3;
00064 dbus_uint32_t byte_order : 8;
00065 };
00066
00067 dbus_bool_t _dbus_header_init (DBusHeader *header,
00068 int byte_order);
00069 void _dbus_header_free (DBusHeader *header);
00070 void _dbus_header_reinit (DBusHeader *header,
00071 int byte_order);
00072 dbus_bool_t _dbus_header_create (DBusHeader *header,
00073 int type,
00074 const char *destination,
00075 const char *path,
00076 const char *interface,
00077 const char *member,
00078 const char *error_name);
00079 dbus_bool_t _dbus_header_copy (const DBusHeader *header,
00080 DBusHeader *dest);
00081 int _dbus_header_get_message_type (DBusHeader *header);
00082 void _dbus_header_set_serial (DBusHeader *header,
00083 dbus_uint32_t serial);
00084 dbus_uint32_t _dbus_header_get_serial (DBusHeader *header);
00085 void _dbus_header_update_lengths (DBusHeader *header,
00086 int body_len);
00087 dbus_bool_t _dbus_header_set_field_basic (DBusHeader *header,
00088 int field,
00089 int type,
00090 const void *value);
00091 dbus_bool_t _dbus_header_get_field_basic (DBusHeader *header,
00092 int field,
00093 int type,
00094 void *value);
00095 dbus_bool_t _dbus_header_get_field_raw (DBusHeader *header,
00096 int field,
00097 const DBusString **str,
00098 int *pos);
00099 dbus_bool_t _dbus_header_delete_field (DBusHeader *header,
00100 int field);
00101 void _dbus_header_toggle_flag (DBusHeader *header,
00102 dbus_uint32_t flag,
00103 dbus_bool_t value);
00104 dbus_bool_t _dbus_header_get_flag (DBusHeader *header,
00105 dbus_uint32_t flag);
00106 dbus_bool_t _dbus_header_ensure_signature (DBusHeader *header,
00107 DBusString **type_str,
00108 int *type_pos);
00109 dbus_bool_t _dbus_header_have_message_untrusted (int max_message_length,
00110 DBusValidity *validity,
00111 int *byte_order,
00112 int *fields_array_len,
00113 int *header_len,
00114 int *body_len,
00115 const DBusString *str,
00116 int start,
00117 int len);
00118 dbus_bool_t _dbus_header_load (DBusHeader *header,
00119 DBusValidationMode mode,
00120 DBusValidity *validity,
00121 int byte_order,
00122 int fields_array_len,
00123 int header_len,
00124 int body_len,
00125 const DBusString *str,
00126 int start,
00127 int len);
00128 void _dbus_header_byteswap (DBusHeader *header,
00129 int new_order);
00130
00131
00132
00133 #endif