device: renew dhcp leases on awake for software devices
[NetworkManager.git] / src / nm-auth-subject.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) 2013 Red Hat, Inc.
19  */
20
21 #ifndef __NETWORKMANAGER_AUTH_SUBJECT_H__
22 #define __NETWORKMANAGER_AUTH_SUBJECT_H__
23
24 #define NM_TYPE_AUTH_SUBJECT            (nm_auth_subject_get_type ())
25 #define NM_AUTH_SUBJECT(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_AUTH_SUBJECT, NMAuthSubject))
26 #define NM_AUTH_SUBJECT_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_AUTH_SUBJECT, NMAuthSubjectClass))
27 #define NM_IS_AUTH_SUBJECT(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_AUTH_SUBJECT))
28 #define NM_IS_AUTH_SUBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_AUTH_SUBJECT))
29 #define NM_AUTH_SUBJECT_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_AUTH_SUBJECT, NMAuthSubjectClass))
30
31 typedef enum {
32         NM_AUTH_SUBJECT_TYPE_INVALID      = 0,
33         NM_AUTH_SUBJECT_TYPE_INTERNAL     = 1,
34         NM_AUTH_SUBJECT_TYPE_UNIX_PROCESS = 2,
35 } NMAuthSubjectType;
36
37 #define NM_AUTH_SUBJECT_SUBJECT_TYPE               "subject-type"
38 #define NM_AUTH_SUBJECT_UNIX_PROCESS_DBUS_SENDER   "unix-process-dbus-sender"
39 #define NM_AUTH_SUBJECT_UNIX_PROCESS_PID           "unix-process-pid"
40 #define NM_AUTH_SUBJECT_UNIX_PROCESS_UID           "unix-process-uid"
41
42 struct _NMAuthSubject {
43         GObject parent;
44 };
45
46 typedef struct {
47         GObjectClass parent;
48 } NMAuthSubjectClass;
49
50 GType nm_auth_subject_get_type (void);
51
52 NMAuthSubject *nm_auth_subject_new_internal (void);
53
54 NMAuthSubject *nm_auth_subject_new_unix_process_from_context (GDBusMethodInvocation *context);
55
56 NMAuthSubject *nm_auth_subject_new_unix_process_from_message (GDBusConnection *connection, GDBusMessage *message);
57
58
59 NMAuthSubjectType nm_auth_subject_get_subject_type (NMAuthSubject *subject);
60
61
62 gboolean nm_auth_subject_is_internal (NMAuthSubject *subject);
63
64
65 gboolean nm_auth_subject_is_unix_process (NMAuthSubject *subject);
66
67 gulong nm_auth_subject_get_unix_process_pid (NMAuthSubject *subject);
68
69 const char *nm_auth_subject_get_unix_process_dbus_sender (NMAuthSubject *subject);
70
71
72 gulong nm_auth_subject_get_unix_process_uid (NMAuthSubject *subject);
73
74
75 const char *nm_auth_subject_to_string (NMAuthSubject *self, char *buf, gsize buf_len);
76
77 #if WITH_POLKIT
78
79 GVariant *  nm_auth_subject_unix_process_to_polkit_gvariant (NMAuthSubject *self);
80
81 #endif
82
83 #endif /* __NETWORKMANAGER_AUTH_SUBJECT_H__ */