diff options
author | Havoc Pennington <hp@redhat.com> | 2003-02-26 06:42:57 +0000 |
---|---|---|
committer | Havoc Pennington <hp@redhat.com> | 2003-02-26 06:42:57 +0000 |
commit | 7265423411609c14ddb9e6643463b840afcaa09b (patch) | |
tree | 199b4d4bee1531333292518bf83425eb01ad2fd3 /dbus/dbus-dataslot.h | |
parent | 3781f063a6dfbdeafea6d1c6c8ac10c8b22f8586 (diff) |
2003-02-26 Havoc Pennington <hp@pobox.com>
* dbus/dbus-connection.c
(dbus_connection_send_message_with_reply_and_block): fix crash
where we ref'd the outgoing message instead of the returned reply
* dbus/dbus-transport-unix.c (do_authentication): check read watch
at the end of this function, so if we didn't need to read for
authentication, we reinstall it for receiving messages
* dbus/dbus-message.c (dbus_message_new_reply): allow replies to
a NULL sender for peer-to-peer case
* dbus/dbus-transport-unix.c (check_read_watch): handle
!authenticated case correctly
* glib/dbus-gmain.c: add support for DBusServer
* dbus/dbus-server.c: add data slot support
* glib/dbus-gmain.c (dbus_connection_setup_with_g_main): check
return values and handle errors
* dbus/dbus-dataslot.c: factor out the data slot stuff from
DBusConnection
* Doxyfile.in (INPUT): add glib subdir
* glib/dbus-gmain.c (dbus_connection_setup_with_g_main): rename
setup_with_g_main instead of hookup_with_g_main; write docs
Diffstat (limited to 'dbus/dbus-dataslot.h')
-rw-r--r-- | dbus/dbus-dataslot.h | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/dbus/dbus-dataslot.h b/dbus/dbus-dataslot.h new file mode 100644 index 00000000..4bb6091f --- /dev/null +++ b/dbus/dbus-dataslot.h @@ -0,0 +1,76 @@ +/* -*- mode: C; c-file-style: "gnu" -*- */ +/* dbus-dataslot.h storing data on objects + * + * Copyright (C) 2003 Red Hat, Inc. + * + * Licensed under the Academic Free License version 1.2 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +#ifndef DBUS_DATASLOT_H +#define DBUS_DATASLOT_H + +#include <dbus/dbus-internals.h> + +DBUS_BEGIN_DECLS; + +typedef struct DBusDataSlotAllocator DBusDataSlotAllocator; +typedef struct DBusDataSlotList DBusDataSlotList; + +/** Opaque typedef for DBusDataSlot */ +typedef struct DBusDataSlot DBusDataSlot; +/** DBusDataSlot is used to store application data on the connection */ +struct DBusDataSlot +{ + void *data; /**< The application data */ + DBusFreeFunction free_data_func; /**< Free the application data */ +}; + +struct DBusDataSlotAllocator +{ + int *allocated_slots; /**< Allocated slots */ + int n_allocated_slots; /**< number of slots malloc'd */ + int n_used_slots; /**< number of slots used */ + DBusMutex *lock; /**< thread lock */ +}; + +struct DBusDataSlotList +{ + DBusDataSlot *slots; /**< Data slots */ + int n_slots; /**< Slots we have storage for in data_slots */ +}; + +dbus_bool_t _dbus_data_slot_allocator_init (DBusDataSlotAllocator *allocator); +int _dbus_data_slot_allocator_alloc (DBusDataSlotAllocator *allocator); +void _dbus_data_slot_allocator_free (DBusDataSlotAllocator *allocator, + int slot_id); + +void _dbus_data_slot_list_init (DBusDataSlotList *list); +dbus_bool_t _dbus_data_slot_list_set (DBusDataSlotAllocator *allocator, + DBusDataSlotList *list, + int slot, + void *data, + DBusFreeFunction free_data_func, + DBusFreeFunction *old_free_func, + void **old_data); +void* _dbus_data_slot_list_get (DBusDataSlotAllocator *allocator, + DBusDataSlotList *list, + int slot); +void _dbus_data_slot_list_free (DBusDataSlotList *list); + +DBUS_END_DECLS; + +#endif /* DBUS_DATASLOT_H */ |