dbus-timeout.h
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* dbus-timeout.h DBusTimeout internal interfaces
*
* Copyright (C) 2003 CodeFactory AB
*
* SPDX-License-Identifier: AFL-2.1 OR GPL-2.0-or-later
*
* Licensed under the Academic Free License version 2.1
*
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef DBUS_TIMEOUT_H
#define DBUS_TIMEOUT_H
#include <dbus/dbus-connection.h>
#include <dbus/dbus-internals.h>
DBUS_BEGIN_DECLS
/* Public methods on DBusTimeout are in dbus-connection.h */
typedef struct DBusTimeoutList DBusTimeoutList;
typedef dbus_bool_t (* DBusTimeoutHandler) (void *data);
DBUS_PRIVATE_EXPORT
DBusTimeout* _dbus_timeout_new (int interval,
DBusTimeoutHandler handler,
void *data,
DBusFreeFunction free_data_function);
DBusTimeout* _dbus_timeout_ref (DBusTimeout *timeout);
DBUS_PRIVATE_EXPORT
void _dbus_timeout_unref (DBusTimeout *timeout);
DBUS_PRIVATE_EXPORT
void _dbus_timeout_restart (DBusTimeout *timeout,
int interval);
DBUS_PRIVATE_EXPORT
void _dbus_timeout_disable (DBusTimeout *timeout);
DBusTimeoutList *_dbus_timeout_list_new (void);
void _dbus_timeout_list_free (DBusTimeoutList *timeout_list);
dbus_bool_t _dbus_timeout_list_set_functions (DBusTimeoutList *timeout_list,
DBusAddTimeoutFunction add_function,
DBusRemoveTimeoutFunction remove_function,
DBusTimeoutToggledFunction toggled_function,
void *data,
DBusFreeFunction free_data_function);
dbus_bool_t _dbus_timeout_list_add_timeout (DBusTimeoutList *timeout_list,
DBusTimeout *timeout);
void _dbus_timeout_list_remove_timeout (DBusTimeoutList *timeout_list,
DBusTimeout *timeout);
void _dbus_timeout_list_toggle_timeout (DBusTimeoutList *timeout_list,
DBusTimeout *timeout,
dbus_bool_t enabled);
DBUS_PRIVATE_EXPORT
dbus_bool_t _dbus_timeout_needs_restart (DBusTimeout *timeout);
DBUS_PRIVATE_EXPORT
void _dbus_timeout_restarted (DBusTimeout *timeout);
DBUS_END_DECLS
#endif /* DBUS_TIMEOUT_H */
DBusTimeoutToggledFunction
void(* DBusTimeoutToggledFunction)(DBusTimeout *timeout, void *data)
Called when dbus_timeout_get_enabled() may return a different value than it did before.
Definition dbus-connection.h:120
DBusAddTimeoutFunction
dbus_bool_t(* DBusAddTimeoutFunction)(DBusTimeout *timeout, void *data)
Called when libdbus needs a new timeout to be monitored by the main loop.
Definition dbus-connection.h:113
DBusRemoveTimeoutFunction
void(* DBusRemoveTimeoutFunction)(DBusTimeout *timeout, void *data)
Called when libdbus no longer needs a timeout to be monitored by the main loop.
Definition dbus-connection.h:126
DBUS_BEGIN_DECLS
#define DBUS_BEGIN_DECLS
Macro used prior to declaring functions in the D-Bus header files.
Definition dbus-macros.h:36
DBUS_END_DECLS
#define DBUS_END_DECLS
Macro used after declaring functions in the D-Bus header files.
Definition dbus-macros.h:37
DBusFreeFunction
void(* DBusFreeFunction)(void *memory)
The type of a function which frees a block of memory.
Definition dbus-memory.h:65
_dbus_timeout_list_add_timeout
dbus_bool_t _dbus_timeout_list_add_timeout(DBusTimeoutList *timeout_list, DBusTimeout *timeout)
Adds a new timeout to the timeout list, invoking the application DBusAddTimeoutFunction if appropriat...
Definition dbus-timeout.c:314
_dbus_timeout_list_free
void _dbus_timeout_list_free(DBusTimeoutList *timeout_list)
Frees a DBusTimeoutList.
Definition dbus-timeout.c:217
_dbus_timeout_list_toggle_timeout
void _dbus_timeout_list_toggle_timeout(DBusTimeoutList *timeout_list, DBusTimeout *timeout, dbus_bool_t enabled)
Sets a timeout to the given enabled state, invoking the application's DBusTimeoutToggledFunction if a...
Definition dbus-timeout.c:366
_dbus_timeout_list_new
DBusTimeoutList * _dbus_timeout_list_new(void)
Creates a new timeout list.
Definition dbus-timeout.c:200
_dbus_timeout_unref
void _dbus_timeout_unref(DBusTimeout *timeout)
Decrements the reference count of a DBusTimeout object and finalizes the object if the count reaches ...
Definition dbus-timeout.c:111
_dbus_timeout_list_set_functions
dbus_bool_t _dbus_timeout_list_set_functions(DBusTimeoutList *timeout_list, DBusAddTimeoutFunction add_function, DBusRemoveTimeoutFunction remove_function, DBusTimeoutToggledFunction toggled_function, void *data, DBusFreeFunction free_data_function)
Sets the timeout functions.
Definition dbus-timeout.c:243
_dbus_timeout_disable
void _dbus_timeout_disable(DBusTimeout *timeout)
Disable the timeout.
Definition dbus-timeout.c:161
_dbus_timeout_new
DBusTimeout * _dbus_timeout_new(int interval, DBusTimeoutHandler handler, void *data, DBusFreeFunction free_data_function)
Creates a new DBusTimeout, enabled by default.
Definition dbus-timeout.c:66
_dbus_timeout_restart
void _dbus_timeout_restart(DBusTimeout *timeout, int interval)
Change the timeout interval to be interval milliseconds from now (forgetting when the timeout was ini...
Definition dbus-timeout.c:140
DBusTimeoutHandler
dbus_bool_t(* DBusTimeoutHandler)(void *data)
function to run when the timeout is handled
Definition dbus-timeout.h:43
_dbus_timeout_ref
DBusTimeout * _dbus_timeout_ref(DBusTimeout *timeout)
Increments the reference count of a DBusTimeout object.
Definition dbus-timeout.c:97
_dbus_timeout_restarted
void _dbus_timeout_restarted(DBusTimeout *timeout)
Mark timeout as restarted (setting timestamps is responsibility of the event loop).
Definition dbus-timeout.c:401
_dbus_timeout_list_remove_timeout
void _dbus_timeout_list_remove_timeout(DBusTimeoutList *timeout_list, DBusTimeout *timeout)
Removes a timeout from the timeout list, invoking the application's DBusRemoveTimeoutFunction if appr...
Definition dbus-timeout.c:344
_dbus_timeout_needs_restart
dbus_bool_t _dbus_timeout_needs_restart(DBusTimeout *timeout)
Returns whether a timeout needs restart time counting in the event loop.
Definition dbus-timeout.c:389
dbus_bool_t
dbus_uint32_t dbus_bool_t
A boolean, valid values are TRUE and FALSE.
Definition dbus-types.h:37
DBusTimeoutList
DBusTimeoutList implementation details.
Definition dbus-timeout.c:183
DBusTimeout
Internals of DBusTimeout.
Definition dbus-timeout.c:43