Resource limits related code
[D-Bus secret internal implementation details]

DBusCounter and other stuff related to resource limits. More...

Functions

DBusCounter_dbus_counter_new (void)
 Creates a new DBusCounter.
DBusCounter_dbus_counter_ref (DBusCounter *counter)
 Increments refcount of the counter.
void _dbus_counter_unref (DBusCounter *counter)
 Decrements refcount of the counter and possibly finalizes the counter.
void _dbus_counter_adjust (DBusCounter *counter, long delta)
 Adjusts the value of the counter by the given delta which may be positive or negative.
long _dbus_counter_get_value (DBusCounter *counter)
 Gets the current value of the counter.
void _dbus_counter_set_notify (DBusCounter *counter, long guard_value, DBusCounterNotifyFunction function, void *user_data)
 Sets the notify function for this counter; the notify function is called whenever the counter's value crosses the guard value in either direction (moving up, or moving down).

Detailed Description

DBusCounter and other stuff related to resource limits.

Types and functions related to tracking resource limits, such as the maximum amount of memory a connection can use for messages, etc.


Function Documentation

void _dbus_counter_adjust ( DBusCounter counter,
long  delta 
)

Adjusts the value of the counter by the given delta which may be positive or negative.

Calls the notify function from _dbus_counter_set_notify() if that function has been specified.

Parameters:
counter the counter
delta value to add to the counter's current value

Definition at line 141 of file dbus-resources.c.

References DBusCounter::notify_data, DBusCounter::notify_function, DBusCounter::notify_guard_value, NULL, and DBusCounter::value.

Referenced by _dbus_message_add_size_counter_link(), and _dbus_message_remove_size_counter().

long _dbus_counter_get_value ( DBusCounter counter  ) 

Gets the current value of the counter.

Parameters:
counter the counter
Returns:
its current value

Definition at line 168 of file dbus-resources.c.

References DBusCounter::value.

Referenced by _dbus_transport_get_dispatch_status(), and dbus_connection_get_outgoing_size().

DBusCounter* _dbus_counter_new ( void   ) 

Creates a new DBusCounter.

DBusCounter is used to count usage of some resource such as memory.

Returns:
new counter or NULL on failure

Definition at line 77 of file dbus-resources.c.

References dbus_new, DBusCounter::notify_data, DBusCounter::notify_function, DBusCounter::notify_guard_value, NULL, DBusCounter::refcount, and DBusCounter::value.

Referenced by _dbus_connection_new_for_transport(), and _dbus_transport_init_base().

DBusCounter* _dbus_counter_ref ( DBusCounter counter  ) 

Increments refcount of the counter.

Parameters:
counter the counter
Returns:
the counter

Definition at line 102 of file dbus-resources.c.

References _dbus_assert, and DBusCounter::refcount.

Referenced by _dbus_message_add_size_counter().

void _dbus_counter_set_notify ( DBusCounter counter,
long  guard_value,
DBusCounterNotifyFunction  function,
void *  user_data 
)

Sets the notify function for this counter; the notify function is called whenever the counter's value crosses the guard value in either direction (moving up, or moving down).

Parameters:
counter the counter
guard_value the value we're notified if the counter crosses
function function to call in order to notify
user_data data to pass to the function

Definition at line 184 of file dbus-resources.c.

References DBusCounter::notify_data, DBusCounter::notify_function, and DBusCounter::notify_guard_value.

Referenced by _dbus_transport_finalize_base(), _dbus_transport_init_base(), and _dbus_transport_set_max_received_size().

void _dbus_counter_unref ( DBusCounter counter  ) 

Decrements refcount of the counter and possibly finalizes the counter.

Parameters:
counter the counter

Definition at line 118 of file dbus-resources.c.

References _dbus_assert, dbus_free(), and DBusCounter::refcount.

Referenced by _dbus_connection_new_for_transport(), _dbus_message_remove_size_counter(), _dbus_transport_finalize_base(), _dbus_transport_init_base(), and dbus_connection_free_preallocated_send().


Generated on Fri Sep 21 18:12:15 2007 for D-Bus by  doxygen 1.5.1