device: renew dhcp leases on awake for software devices
[NetworkManager.git] / src / nm-auth-manager.h
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /* NetworkManager -- Network link manager
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  *
18  * Copyright (C) 2014 Red Hat, Inc.
19  */
20
21 #ifndef NM_AUTH_MANAGER_H
22 #define NM_AUTH_MANAGER_H
23
24
25 #include "nm-default.h"
26 #include "nm-auth-subject.h"
27
28 G_BEGIN_DECLS
29
30
31 #define NM_TYPE_AUTH_MANAGER            (nm_auth_manager_get_type ())
32 #define NM_AUTH_MANAGER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_AUTH_MANAGER, NMAuthManager))
33 #define NM_AUTH_MANAGER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  NM_TYPE_AUTH_MANAGER, NMAuthManagerClass))
34 #define NM_IS_AUTH_MANAGER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_AUTH_MANAGER))
35 #define NM_IS_AUTH_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  NM_TYPE_AUTH_MANAGER))
36 #define NM_AUTH_MANAGER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  NM_TYPE_AUTH_MANAGER, NMAuthManagerClass))
37
38
39 #define NM_AUTH_MANAGER_POLKIT_ENABLED "polkit-enabled"
40
41 #define NM_AUTH_MANAGER_SIGNAL_CHANGED "changed"
42
43 typedef struct {
44         GObject parent;
45 } NMAuthManager;
46
47 typedef struct {
48         GObjectClass parent;
49 } NMAuthManagerClass;
50
51 GType nm_auth_manager_get_type (void);
52
53 NMAuthManager *nm_auth_manager_setup (gboolean polkit_enabled);
54 NMAuthManager *nm_auth_manager_get (void);
55
56 gboolean nm_auth_manager_get_polkit_enabled (NMAuthManager *self);
57
58 #if WITH_POLKIT
59
60 void nm_auth_manager_polkit_authority_check_authorization (NMAuthManager *self,
61                                                            NMAuthSubject *subject,
62                                                            const char *action_id,
63                                                            gboolean allow_user_interaction,
64                                                            GCancellable *cancellable,
65                                                            GAsyncReadyCallback callback,
66                                                            gpointer user_data);
67 gboolean nm_auth_manager_polkit_authority_check_authorization_finish (NMAuthManager *self,
68                                                                       GAsyncResult *res,
69                                                                       gboolean *out_is_authorized,
70                                                                       gboolean *out_is_challenge,
71                                                                       GError **error);
72
73 #endif
74
75 G_END_DECLS
76
77 #endif /* NM_AUTH_MANAGER_H */
78