1 /* -*- mode: C; c-file-style: "gnu" -*- */
2 /* dbus-message-private.h header shared between dbus-message.c and dbus-message-util.c
4 * Copyright (C) 2005 Red Hat Inc.
6 * Licensed under the Academic Free License version 2.1
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #ifndef DBUS_MESSAGE_PRIVATE_H
24 #define DBUS_MESSAGE_PRIVATE_H
26 #include <dbus/dbus-message.h>
27 #include <dbus/dbus-message-internal.h>
28 #include <dbus/dbus-string.h>
29 #include <dbus/dbus-dataslot.h>
30 #include <dbus/dbus-marshal-header.h>
35 * @addtogroup DBusMessageInternals
40 * @typedef DBusMessageLoader
42 * The DBusMessageLoader object encapsulates the process of converting
43 * a byte stream into a series of DBusMessage. It buffers the incoming
44 * bytes as efficiently as possible, and generates a queue of
45 * messages. DBusMessageLoader is typically used as part of a
46 * DBusTransport implementation. The DBusTransport then hands off
47 * the loaded messages to a DBusConnection, making the messages
48 * visible to the application.
50 * @todo write tests for break-loader that a) randomly delete header
51 * fields and b) set string fields to zero-length and other funky
57 * Implementation details of DBusMessageLoader.
58 * All members are private.
60 struct DBusMessageLoader
62 int refcount; /**< Reference count. */
64 DBusString data; /**< Buffered data */
66 DBusList *messages; /**< Complete messages. */
68 long max_message_size; /**< Maximum size of a message */
70 unsigned int buffer_outstanding : 1; /**< Someone is using the buffer to read */
72 unsigned int corrupted : 1; /**< We got broken data, and are no longer working */
74 DBusValidity corruption_reason; /**< why we were corrupted */
78 /** How many bits are in the changed_stamp used to validate iterators */
79 #define CHANGED_STAMP_BITS 21
82 * @brief Internals of DBusMessage
84 * Object representing a message received from or to be sent to
85 * another application. This is an opaque object, all members
90 DBusAtomic refcount; /**< Reference count */
92 DBusHeader header; /**< Header network data and associated cache */
94 DBusString body; /**< Body network data. */
96 char byte_order; /**< Message byte order. */
98 unsigned int locked : 1; /**< Message being sent, no modifications allowed. */
100 #ifndef DBUS_DISABLE_CHECKS
101 unsigned int in_cache : 1; /**< Has been "freed" since it's in the cache (this is a debug feature) */
104 DBusList *size_counters; /**< 0-N DBusCounter used to track message size. */
105 long size_counter_delta; /**< Size we incremented the size counters by. */
107 dbus_uint32_t changed_stamp : CHANGED_STAMP_BITS; /**< Incremented when iterators are invalidated. */
109 DBusDataSlotList slot_list; /**< Data stored by allocated integer ID */
111 #ifndef DBUS_DISABLE_CHECKS
112 int generation; /**< _dbus_current_generation when message was created */
116 dbus_bool_t _dbus_message_iter_get_args_valist (DBusMessageIter *iter,
125 #endif /* DBUS_MESSAGE_H */