1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
4 This file is part of systemd.
6 Copyright (C) 2014 David Herrmann <dh.herrmann@gmail.com>
8 systemd is free software; you can redistribute it and/or modify it
9 under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 2.1 of the License, or
11 (at your option) any later version.
13 systemd is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
18 You should have received a copy of the GNU Lesser General Public License
19 along with systemd; If not, see <http://www.gnu.org/licenses/>.
31 #include <systemd/sd-bus.h>
32 #include <systemd/sd-event.h>
35 typedef struct idev_data idev_data;
37 typedef struct idev_event idev_event;
38 typedef struct idev_device idev_device;
39 typedef struct idev_session idev_session;
40 typedef struct idev_context idev_context;
73 IDEV_EVENT_DEVICE_ADD,
74 IDEV_EVENT_DEVICE_REMOVE,
75 IDEV_EVENT_DEVICE_DATA,
84 } device_add, device_remove;
93 typedef int (*idev_event_fn) (idev_session *s, void *userdata, idev_event *ev);
99 void idev_device_enable(idev_device *d);
100 void idev_device_disable(idev_device *d);
107 IDEV_SESSION_CUSTOM = (1 << 0),
108 IDEV_SESSION_MANAGED = (1 << 1),
111 int idev_session_new(idev_session **out,
115 idev_event_fn event_fn,
117 idev_session *idev_session_free(idev_session *s);
119 DEFINE_TRIVIAL_CLEANUP_FUNC(idev_session*, idev_session_free);
121 bool idev_session_is_enabled(idev_session *s);
122 void idev_session_enable(idev_session *s);
123 void idev_session_disable(idev_session *s);
129 int idev_context_new(idev_context **out, sd_event *event, sd_bus *sysbus);
130 idev_context *idev_context_ref(idev_context *c);
131 idev_context *idev_context_unref(idev_context *c);
133 DEFINE_TRIVIAL_CLEANUP_FUNC(idev_context*, idev_context_unref);