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) 2010 Red Hat, Inc.
21 #ifndef __NETWORKMANAGER_MANAGER_AUTH_H__
22 #define __NETWORKMANAGER_MANAGER_AUTH_H__
24 #include <nm-connection.h>
25 #include "nm-default.h"
27 #define NM_AUTH_PERMISSION_ENABLE_DISABLE_NETWORK "org.freedesktop.NetworkManager.enable-disable-network"
28 #define NM_AUTH_PERMISSION_SLEEP_WAKE "org.freedesktop.NetworkManager.sleep-wake"
29 #define NM_AUTH_PERMISSION_ENABLE_DISABLE_WIFI "org.freedesktop.NetworkManager.enable-disable-wifi"
30 #define NM_AUTH_PERMISSION_ENABLE_DISABLE_WWAN "org.freedesktop.NetworkManager.enable-disable-wwan"
31 #define NM_AUTH_PERMISSION_ENABLE_DISABLE_WIMAX "org.freedesktop.NetworkManager.enable-disable-wimax"
32 #define NM_AUTH_PERMISSION_NETWORK_CONTROL "org.freedesktop.NetworkManager.network-control"
33 #define NM_AUTH_PERMISSION_WIFI_SHARE_PROTECTED "org.freedesktop.NetworkManager.wifi.share.protected"
34 #define NM_AUTH_PERMISSION_WIFI_SHARE_OPEN "org.freedesktop.NetworkManager.wifi.share.open"
35 #define NM_AUTH_PERMISSION_SETTINGS_MODIFY_SYSTEM "org.freedesktop.NetworkManager.settings.modify.system"
36 #define NM_AUTH_PERMISSION_SETTINGS_MODIFY_OWN "org.freedesktop.NetworkManager.settings.modify.own"
37 #define NM_AUTH_PERMISSION_SETTINGS_MODIFY_HOSTNAME "org.freedesktop.NetworkManager.settings.modify.hostname"
38 #define NM_AUTH_PERMISSION_SETTINGS_MODIFY_GLOBAL_DNS "org.freedesktop.NetworkManager.settings.modify.global-dns"
41 typedef struct NMAuthChain NMAuthChain;
44 NM_AUTH_CALL_RESULT_UNKNOWN,
45 NM_AUTH_CALL_RESULT_YES,
46 NM_AUTH_CALL_RESULT_AUTH,
47 NM_AUTH_CALL_RESULT_NO,
50 typedef void (*NMAuthChainResultFunc) (NMAuthChain *chain,
52 GDBusMethodInvocation *context,
55 NMAuthChain *nm_auth_chain_new_context (GDBusMethodInvocation *context,
56 NMAuthChainResultFunc done_func,
59 NMAuthChain *nm_auth_chain_new_subject (NMAuthSubject *subject,
60 GDBusMethodInvocation *context,
61 NMAuthChainResultFunc done_func,
64 gpointer nm_auth_chain_get_data (NMAuthChain *chain, const char *tag);
66 gpointer nm_auth_chain_steal_data (NMAuthChain *chain, const char *tag);
68 void nm_auth_chain_set_data (NMAuthChain *chain,
71 GDestroyNotify data_destroy);
73 void nm_auth_chain_set_data_ulong (NMAuthChain *chain,
77 gulong nm_auth_chain_get_data_ulong (NMAuthChain *chain, const char *tag);
79 NMAuthCallResult nm_auth_chain_get_result (NMAuthChain *chain,
80 const char *permission);
82 void nm_auth_chain_add_call (NMAuthChain *chain,
83 const char *permission,
84 gboolean allow_interaction);
86 void nm_auth_chain_unref (NMAuthChain *chain);
88 /* Caller must free returned error description */
89 gboolean nm_auth_is_subject_in_acl (NMConnection *connection,
90 NMAuthSubject *subect,
91 char **out_error_desc);
93 NMAuthSubject *nm_auth_chain_get_subject (NMAuthChain *self);
95 #endif /* __NETWORKMANAGER_MANAGER_AUTH_H__ */