2010-12-10 12:38:19 -06:00
|
|
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
|
|
|
|
/* NetworkManager -- Network link manager
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
|
*
|
2011-01-26 18:36:08 -06:00
|
|
|
* Copyright (C) 2010 - 2011 Red Hat, Inc.
|
2010-12-10 12:38:19 -06:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef NM_AGENT_MANAGER_H
|
|
|
|
|
#define NM_AGENT_MANAGER_H
|
|
|
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
|
#include <glib-object.h>
|
2010-12-13 13:11:51 -06:00
|
|
|
#include <nm-connection.h>
|
2011-03-29 22:53:22 -05:00
|
|
|
#include "nm-settings-flags.h"
|
2011-06-28 15:48:12 +02:00
|
|
|
#include "nm-secret-agent.h"
|
2010-12-13 13:11:51 -06:00
|
|
|
|
2010-12-10 12:38:19 -06:00
|
|
|
#define NM_TYPE_AGENT_MANAGER (nm_agent_manager_get_type ())
|
|
|
|
|
#define NM_AGENT_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_AGENT_MANAGER, NMAgentManager))
|
|
|
|
|
#define NM_AGENT_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_AGENT_MANAGER, NMAgentManagerClass))
|
|
|
|
|
#define NM_IS_AGENT_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_AGENT_MANAGER))
|
2012-07-27 13:15:54 +02:00
|
|
|
#define NM_IS_AGENT_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_AGENT_MANAGER))
|
2010-12-10 12:38:19 -06:00
|
|
|
#define NM_AGENT_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_AGENT_MANAGER, NMAgentManagerClass))
|
|
|
|
|
|
2012-02-08 12:56:52 -05:00
|
|
|
typedef enum {
|
2012-03-09 09:39:58 -05:00
|
|
|
NM_AGENT_MANAGER_ERROR_SENDER_UNKNOWN = 0, /*< nick=SenderUnknown >*/
|
|
|
|
|
NM_AGENT_MANAGER_ERROR_PERMISSION_DENIED, /*< nick=PermissionDenied >*/
|
|
|
|
|
NM_AGENT_MANAGER_ERROR_SESSION_NOT_FOUND, /*< nick=SessionNotFound >*/
|
|
|
|
|
NM_AGENT_MANAGER_ERROR_INVALID_IDENTIFIER, /*< nick=InvalidIdentifier >*/
|
|
|
|
|
NM_AGENT_MANAGER_ERROR_NOT_REGISTERED, /*< nick=NotRegistered >*/
|
|
|
|
|
NM_AGENT_MANAGER_ERROR_INTERNAL_ERROR, /*< nick=InternalError >*/
|
|
|
|
|
NM_AGENT_MANAGER_ERROR_NO_SECRETS /*< nick=NoSecrets >*/
|
2012-02-08 12:56:52 -05:00
|
|
|
} NMAgentManagerError;
|
|
|
|
|
|
2010-12-10 12:38:19 -06:00
|
|
|
typedef struct {
|
|
|
|
|
GObject parent;
|
|
|
|
|
} NMAgentManager;
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
GObjectClass parent;
|
2011-06-28 15:48:12 +02:00
|
|
|
|
|
|
|
|
/* Signals */
|
|
|
|
|
void (*agent_registered) (NMAgentManager *agent_mgr, NMSecretAgent *agent);
|
2010-12-10 12:38:19 -06:00
|
|
|
} NMAgentManagerClass;
|
|
|
|
|
|
|
|
|
|
GType nm_agent_manager_get_type (void);
|
|
|
|
|
|
2011-01-27 10:41:02 -06:00
|
|
|
NMAgentManager *nm_agent_manager_get (void);
|
2010-12-13 13:11:51 -06:00
|
|
|
|
2011-02-02 12:17:58 -06:00
|
|
|
/* If no agent fulfilled the secrets request, agent_dbus_owner will be NULL */
|
2010-12-13 13:11:51 -06:00
|
|
|
typedef void (*NMAgentSecretsResultFunc) (NMAgentManager *manager,
|
|
|
|
|
guint32 call_id,
|
2011-02-02 12:17:58 -06:00
|
|
|
const char *agent_dbus_owner,
|
2011-03-31 18:39:09 -05:00
|
|
|
const char *agent_uname,
|
2011-02-02 16:19:15 -06:00
|
|
|
gboolean agent_has_modify,
|
2011-01-26 13:32:25 -06:00
|
|
|
const char *setting_name,
|
2011-03-29 22:53:22 -05:00
|
|
|
NMSettingsGetSecretsFlags flags,
|
2011-01-27 10:41:02 -06:00
|
|
|
GHashTable *secrets,
|
2010-12-13 13:11:51 -06:00
|
|
|
GError *error,
|
|
|
|
|
gpointer user_data,
|
2011-01-27 10:41:02 -06:00
|
|
|
gpointer other_data2,
|
|
|
|
|
gpointer other_data3);
|
2010-12-13 13:11:51 -06:00
|
|
|
|
|
|
|
|
guint32 nm_agent_manager_get_secrets (NMAgentManager *manager,
|
|
|
|
|
NMConnection *connection,
|
2013-11-05 14:36:38 -05:00
|
|
|
NMAuthSubject *subject,
|
2011-01-27 10:41:02 -06:00
|
|
|
GHashTable *existing_secrets,
|
2010-12-13 13:11:51 -06:00
|
|
|
const char *setting_name,
|
2011-03-29 22:53:22 -05:00
|
|
|
NMSettingsGetSecretsFlags flags,
|
2013-06-19 17:51:09 -05:00
|
|
|
const char **hints,
|
2010-12-13 13:11:51 -06:00
|
|
|
NMAgentSecretsResultFunc callback,
|
|
|
|
|
gpointer callback_data,
|
|
|
|
|
gpointer other_data2,
|
|
|
|
|
gpointer other_data3);
|
|
|
|
|
|
|
|
|
|
void nm_agent_manager_cancel_secrets (NMAgentManager *manager,
|
|
|
|
|
guint32 request_id);
|
2010-12-10 12:38:19 -06:00
|
|
|
|
2011-01-31 23:10:33 -06:00
|
|
|
guint32 nm_agent_manager_save_secrets (NMAgentManager *manager,
|
|
|
|
|
NMConnection *connection,
|
2013-11-05 14:36:38 -05:00
|
|
|
NMAuthSubject *subject);
|
2011-01-31 23:10:33 -06:00
|
|
|
|
2011-01-31 23:33:46 -06:00
|
|
|
guint32 nm_agent_manager_delete_secrets (NMAgentManager *manager,
|
2013-11-05 14:36:38 -05:00
|
|
|
NMConnection *connection);
|
2011-01-31 23:33:46 -06:00
|
|
|
|
2011-07-01 14:36:01 -05:00
|
|
|
NMSecretAgent *nm_agent_manager_get_agent_by_user (NMAgentManager *manager,
|
|
|
|
|
const char *username);
|
|
|
|
|
|
2013-06-20 23:07:49 -05:00
|
|
|
gboolean nm_agent_manager_all_agents_have_capability (NMAgentManager *manager,
|
2013-11-05 14:36:38 -05:00
|
|
|
NMAuthSubject *subject,
|
2013-06-20 23:07:49 -05:00
|
|
|
NMSecretAgentCapabilities capability);
|
|
|
|
|
|
2010-12-10 12:38:19 -06:00
|
|
|
#endif /* NM_AGENT_MANAGER_H */
|