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 struct DBusAllocatedSlot
00044 {
00045 dbus_int32_t slot_id;
00046 int refcount;
00047 };
00048
00049 struct DBusDataSlotAllocator
00050 {
00051 DBusAllocatedSlot *allocated_slots;
00052 int n_allocated_slots;
00053 int n_used_slots;
00054 DBusMutex *lock;
00055 };
00056
00057 struct DBusDataSlotList
00058 {
00059 DBusDataSlot *slots;
00060 int n_slots;
00061 };
00062
00063 dbus_bool_t _dbus_data_slot_allocator_init (DBusDataSlotAllocator *allocator);
00064 dbus_bool_t _dbus_data_slot_allocator_alloc (DBusDataSlotAllocator *allocator,
00065 DBusMutex *mutex,
00066 int *slot_id_p);
00067 void _dbus_data_slot_allocator_free (DBusDataSlotAllocator *allocator,
00068 int *slot_id_p);
00069 void _dbus_data_slot_list_init (DBusDataSlotList *list);
00070 dbus_bool_t _dbus_data_slot_list_set (DBusDataSlotAllocator *allocator,
00071 DBusDataSlotList *list,
00072 int slot,
00073 void *data,
00074 DBusFreeFunction free_data_func,
00075 DBusFreeFunction *old_free_func,
00076 void **old_data);
00077 void* _dbus_data_slot_list_get (DBusDataSlotAllocator *allocator,
00078 DBusDataSlotList *list,
00079 int slot);
00080 void _dbus_data_slot_list_free (DBusDataSlotList *list);
00081
00082
00083 DBUS_END_DECLS;
00084
00085 #endif