00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef DBUS_DATASLOT_H
00024 #define DBUS_DATASLOT_H
00025
00026 #include <dbus/dbus-internals.h>
00027
00028 DBUS_BEGIN_DECLS
00029
00030 typedef struct DBusDataSlotAllocator DBusDataSlotAllocator;
00031 typedef struct DBusDataSlotList DBusDataSlotList;
00032
00034 typedef struct DBusDataSlot DBusDataSlot;
00036 struct DBusDataSlot
00037 {
00038 void *data;
00039 DBusFreeFunction free_data_func;
00040 };
00041
00042 typedef struct DBusAllocatedSlot DBusAllocatedSlot;
00043
00046 struct DBusAllocatedSlot
00047 {
00048 dbus_int32_t slot_id;
00049 int refcount;
00050 };
00051
00055 struct DBusDataSlotAllocator
00056 {
00057 DBusAllocatedSlot *allocated_slots;
00058 int n_allocated_slots;
00059 int n_used_slots;
00060 DBusGlobalLock lock;
00061 };
00062
00063 #define _DBUS_DATA_SLOT_ALLOCATOR_INIT(x) { NULL, 0, 0, x }
00064
00069 struct DBusDataSlotList
00070 {
00071 DBusDataSlot *slots;
00072 int n_slots;
00073 };
00074
00075 dbus_bool_t _dbus_data_slot_allocator_init (DBusDataSlotAllocator *allocator,
00076 DBusGlobalLock lock);
00077 dbus_bool_t _dbus_data_slot_allocator_alloc (DBusDataSlotAllocator *allocator,
00078 int *slot_id_p);
00079 void _dbus_data_slot_allocator_free (DBusDataSlotAllocator *allocator,
00080 int *slot_id_p);
00081 void _dbus_data_slot_list_init (DBusDataSlotList *list);
00082 dbus_bool_t _dbus_data_slot_list_set (DBusDataSlotAllocator *allocator,
00083 DBusDataSlotList *list,
00084 int slot,
00085 void *data,
00086 DBusFreeFunction free_data_func,
00087 DBusFreeFunction *old_free_func,
00088 void **old_data);
00089 void* _dbus_data_slot_list_get (DBusDataSlotAllocator *allocator,
00090 DBusDataSlotList *list,
00091 int slot);
00092 void _dbus_data_slot_list_clear (DBusDataSlotList *list);
00093 void _dbus_data_slot_list_free (DBusDataSlotList *list);
00094
00095
00096 DBUS_END_DECLS
00097
00098 #endif