device: renew dhcp leases on awake for software devices
[NetworkManager.git] / src / nm-session-monitor.h
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /* This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 2 of the License, or
5  * (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License along
13  * with this program; if not, write to the Free Software Foundation, Inc.,
14  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
15  *
16  * (C) Copyright 2008 - 2010 Red Hat, Inc.
17  * Author: David Zeuthen <davidz@redhat.com>
18  * Author: Dan Williams <dcbw@redhat.com>
19  */
20
21 #ifndef __NETWORKMANAGER_SESSION_MONITOR_H__
22 #define __NETWORKMANAGER_SESSION_MONITOR_H__
23
24
25 #include "nm-default.h"
26
27 G_BEGIN_DECLS
28
29 #define NM_TYPE_SESSION_MONITOR         (nm_session_monitor_get_type ())
30 #define NM_SESSION_MONITOR(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), NM_TYPE_SESSION_MONITOR, NMSessionMonitor))
31 #define NM_SESSION_MONITOR_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), NM_TYPE_SESSION_MONITOR, NMSessionMonitorClass))
32 #define NM_SESSION_MONITOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NM_TYPE_SESSION_MONITOR, NMSessionMonitorClass))
33 #define NM_IS_SESSION_MONITOR(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), NM_TYPE_SESSION_MONITOR))
34 #define NM_IS_SESSION_MONITOR_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), NM_TYPE_SESSION_MONITOR))
35
36 #define NM_SESSION_MONITOR_CHANGED "changed"
37
38 typedef struct _NMSessionMonitorClass    NMSessionMonitorClass;
39
40 typedef void (*NMSessionCallback) (NMSessionMonitor *monitor, gpointer user_data);
41
42 GType             nm_session_monitor_get_type       (void) G_GNUC_CONST;
43
44 NMSessionMonitor *nm_session_monitor_get (void);
45
46 gulong            nm_session_monitor_connect        (NMSessionMonitor *self,
47                                                      NMSessionCallback callback,
48                                                      gpointer user_data);
49 void              nm_session_monitor_disconnect     (NMSessionMonitor *self,
50                                                      gulong handler_id);
51
52 gboolean          nm_session_monitor_uid_to_user    (uid_t uid, const char **out_user);
53 gboolean          nm_session_monitor_user_to_uid    (const char *user, uid_t *out_uid);
54 gboolean          nm_session_monitor_session_exists (NMSessionMonitor *self,
55                                                      uid_t uid,
56                                                      gboolean active);
57
58 G_END_DECLS
59
60 #endif /* __NETWORKMANAGER_SESSION_MONITOR_H__ */
61