libkeepalive
keepalive-object.h
Go to the documentation of this file.
1 /****************************************************************************************
2 **
3 ** Copyright (c) 2020 Jolla Ltd.
4  * Copyright (c) 2020 Open Mobile Platform LLC.
5 **
6 ** Author: Simo Piiroinen <simo.piiroinen@jollamobile.com>
7 **
8 ** All rights reserved.
9 **
10 ** This file is part of nemo-keepalive package.
11 **
12 ** You may use this file under the terms of the GNU Lesser General
13 ** Public License version 2.1 as published by the Free Software Foundation
14 ** and appearing in the file license.lgpl included in the packaging
15 ** of this file.
16 **
17 ** This library is free software; you can redistribute it and/or
18 ** modify it under the terms of the GNU Lesser General Public
19 ** License version 2.1 as published by the Free Software Foundation
20 ** and appearing in the file license.lgpl included in the packaging
21 ** of this file.
22 **
23 ** This library is distributed in the hope that it will be useful,
24 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
25 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26 ** Lesser General Public License for more details.
27 **
28 ****************************************************************************************/
29 
35 #ifndef KEEPALIVE_OBJECT_H_
36 #define KEEPALIVE_OBJECT_H_
37 
38 # include <stdarg.h>
39 # include <stdbool.h>
40 
41 # include <glib.h>
42 
43 # include <dbus/dbus.h>
44 
45 # ifdef __cplusplus
46 extern "C" {
47 # endif
48 
49 /* ========================================================================= *
50  * Types
51  * ========================================================================= */
52 
108 
110 {
112  const char *kao_identity;
113 
116 
119 
122 
125 
127  pthread_mutex_t kao_mutex;
128 
139  GDestroyNotify kao_shutdown_locked_cb;
140 
147  GDestroyNotify kao_delete_cb;
148 };
149 
150 /* ========================================================================= *
151  * Functions
152  * ========================================================================= */
153 
161 void keepalive_object_ctor (keepalive_object_t *self, const char *identity, GDestroyNotify shutdown_locked_cb, GDestroyNotify delete_cb);
162 
168 
180 
189 
204 
219 
228 
237 
249 
263 void keepalive_object_timer_start_locked (keepalive_object_t *self, guint *timer_id, guint interval, GSourceFunc notify_cb);
264 
273 
281 
301 void keepalive_object_ipc_start_locked_va (keepalive_object_t *self, DBusPendingCall **where, DBusPendingCallNotifyFunction notify_cb, DBusConnection *connection, const char *service, const char *object, const char *interface, const char *method, int arg_type, va_list va);
302 
310 void keepalive_object_ipc_cancel_locked(keepalive_object_t *self, DBusPendingCall **where);
311 
323 bool keepalive_object_ipc_finish_locked(keepalive_object_t *self, DBusPendingCall **where, DBusPendingCall *what);
324 
339 void keepalive_object_iowatch_start_locked(keepalive_object_t *self, guint *iowatch_id, int fd, GIOCondition cnd, GIOFunc io_cb);
340 
349 
350 # ifdef __cplusplus
351 };
352 # endif
353 
354 #endif /* KEEPALIVE_OBJECT_H_ */
keepalive_object_ref_external_locked
void * keepalive_object_ref_external_locked(keepalive_object_t *self)
keepalive_object_timer_start_locked
void keepalive_object_timer_start_locked(keepalive_object_t *self, guint *timer_id, guint interval, GSourceFunc notify_cb)
keepalive_object_t::kao_refcount_external
unsigned kao_refcount_external
Definition: keepalive-object.h:115
keepalive_object_timer_stop_locked
void keepalive_object_timer_stop_locked(keepalive_object_t *self, guint *timer_id)
keepalive_object_in_shutdown_locked
bool keepalive_object_in_shutdown_locked(keepalive_object_t *self)
keepalive_object_t::kao_identity
const char * kao_identity
Definition: keepalive-object.h:112
keepalive_object_ctor
void keepalive_object_ctor(keepalive_object_t *self, const char *identity, GDestroyNotify shutdown_locked_cb, GDestroyNotify delete_cb)
keepalive_object_t
Definition: keepalive-object.h:110
keepalive_object_unlock
void keepalive_object_unlock(keepalive_object_t *self)
keepalive_object_unref_external_locked
void keepalive_object_unref_external_locked(keepalive_object_t *self)
keepalive_object_t::kao_mutex
pthread_mutex_t kao_mutex
Definition: keepalive-object.h:127
keepalive_object_t::kao_shutdown_id
guint kao_shutdown_id
Definition: keepalive-object.h:124
keepalive_object_t::kao_in_shutdown
bool kao_in_shutdown
Definition: keepalive-object.h:121
keepalive_object_ipc_cancel_locked
void keepalive_object_ipc_cancel_locked(keepalive_object_t *self, DBusPendingCall **where)
keepalive_object_ipc_finish_locked
bool keepalive_object_ipc_finish_locked(keepalive_object_t *self, DBusPendingCall **where, DBusPendingCall *what)
keepalive_object_iowatch_start_locked
void keepalive_object_iowatch_start_locked(keepalive_object_t *self, guint *iowatch_id, int fd, GIOCondition cnd, GIOFunc io_cb)
keepalive_object_lock
void keepalive_object_lock(keepalive_object_t *self)
keepalive_object_ref_internal_locked
void * keepalive_object_ref_internal_locked(keepalive_object_t *self)
keepalive_object_unref_internal_cb
void keepalive_object_unref_internal_cb(void *aptr)
keepalive_object_t::kao_refcount_internal
unsigned kao_refcount_internal
Definition: keepalive-object.h:118
keepalive_object_unref_internal_locked
void keepalive_object_unref_internal_locked(keepalive_object_t *self)
keepalive_object_t::kao_delete_cb
GDestroyNotify kao_delete_cb
Definition: keepalive-object.h:147
keepalive_object_iowatch_stop_locked
void keepalive_object_iowatch_stop_locked(keepalive_object_t *self, guint *iowatch_id)
keepalive_object_t::kao_shutdown_locked_cb
GDestroyNotify kao_shutdown_locked_cb
Definition: keepalive-object.h:139
keepalive_object_ipc_start_locked_va
void keepalive_object_ipc_start_locked_va(keepalive_object_t *self, DBusPendingCall **where, DBusPendingCallNotifyFunction notify_cb, DBusConnection *connection, const char *service, const char *object, const char *interface, const char *method, int arg_type, va_list va)
keepalive_object_dtor
void keepalive_object_dtor(keepalive_object_t *self)