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 DBusMutex *
lock;
00061 };
00062
00067 struct DBusDataSlotList
00068 {
00069 DBusDataSlot *
slots;
00070 int n_slots;
00071 };
00072
00073
dbus_bool_t _dbus_data_slot_allocator_init (DBusDataSlotAllocator *allocator);
00074
dbus_bool_t _dbus_data_slot_allocator_alloc (DBusDataSlotAllocator *allocator,
00075 DBusMutex *mutex,
00076
int *slot_id_p);
00077
void _dbus_data_slot_allocator_free (DBusDataSlotAllocator *allocator,
00078
int *slot_id_p);
00079
void _dbus_data_slot_list_init (DBusDataSlotList *list);
00080
dbus_bool_t _dbus_data_slot_list_set (DBusDataSlotAllocator *allocator,
00081 DBusDataSlotList *list,
00082
int slot,
00083
void *data,
00084 DBusFreeFunction free_data_func,
00085 DBusFreeFunction *old_free_func,
00086
void **old_data);
00087
void*
_dbus_data_slot_list_get (DBusDataSlotAllocator *allocator,
00088 DBusDataSlotList *list,
00089
int slot);
00090
void _dbus_data_slot_list_free (DBusDataSlotList *list);
00091
00092
00093
DBUS_END_DECLS;
00094
00095
#endif