1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /* NetworkManager -- Network link manager
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.
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.
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.
18 * Copyright (C) 2013 Red Hat, Inc.
21 #ifndef __NETWORKMANAGER_AUTH_SUBJECT_H__
22 #define __NETWORKMANAGER_AUTH_SUBJECT_H__
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))
32 NM_AUTH_SUBJECT_TYPE_INVALID = 0,
33 NM_AUTH_SUBJECT_TYPE_INTERNAL = 1,
34 NM_AUTH_SUBJECT_TYPE_UNIX_PROCESS = 2,
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"
42 struct _NMAuthSubject {
50 GType nm_auth_subject_get_type (void);
52 NMAuthSubject *nm_auth_subject_new_internal (void);
54 NMAuthSubject *nm_auth_subject_new_unix_process_from_context (GDBusMethodInvocation *context);
56 NMAuthSubject *nm_auth_subject_new_unix_process_from_message (GDBusConnection *connection, GDBusMessage *message);
59 NMAuthSubjectType nm_auth_subject_get_subject_type (NMAuthSubject *subject);
62 gboolean nm_auth_subject_is_internal (NMAuthSubject *subject);
65 gboolean nm_auth_subject_is_unix_process (NMAuthSubject *subject);
67 gulong nm_auth_subject_get_unix_process_pid (NMAuthSubject *subject);
69 const char *nm_auth_subject_get_unix_process_dbus_sender (NMAuthSubject *subject);
72 gulong nm_auth_subject_get_unix_process_uid (NMAuthSubject *subject);
75 const char *nm_auth_subject_to_string (NMAuthSubject *self, char *buf, gsize buf_len);
79 GVariant * nm_auth_subject_unix_process_to_polkit_gvariant (NMAuthSubject *self);
83 #endif /* __NETWORKMANAGER_AUTH_SUBJECT_H__ */