agent: request_new -> flags

Use some flags to modify GetSecrets behavior instead of just the
request_new boolean.
This commit is contained in:
Dan Williams 2011-01-18 14:17:18 -06:00
parent 519b1ea61d
commit 9cf13cc3e1
3 changed files with 42 additions and 9 deletions

View file

@ -41,8 +41,9 @@
in this request.
</tp:docstring>
</arg>
<arg name="request_new" type="b" direction="in">
<arg name="flags" type="u" direction="in" tp:type="NM_SECRET_AGENT_GET_SECRETS_FLAGS">
<tp:docstring>
Flags which modify the behavior of the secrets request.
If true, new secrets are assumed to be invalid or incorrect,
and the agent should ask the user for new secrets. If false,
existing secrets should be retrieved from storage and
@ -59,6 +60,33 @@
</arg>
</method>
<tp:flags name="NM_SECRET_AGENT_GET_SECRETS_FLAGS" value-prefix="NM_SECRET_AGENT_GET_SECRETS_FLAG" type="u">
<tp:docstring>
Flags modifying the behavior of GetSecrets request.
</tp:docstring>
<tp:flag suffix="NONE" value="0x0">
<tp:docstring>
No special behavior; by default no user interaction is allowed and
requests for secrets are fulfilled from persistent storage, or
if no secrets are available an error is returned.
</tp:docstring>
</tp:flag>
<tp:flag suffix="ALLOW_INTERACTION" value="0x1">
<tp:docstring>
Allows the request to interact with the user, possibly prompting
via UI for secrets if any are required, or if none are found in
persistent storage.
</tp:docstring>
</tp:flag>
<tp:flag suffix="REQUEST_NEW" value="0x2">
<tp:docstring>
Explicitly prompt for new secrets from the user. This flag
signals that NetworkManager thinks any existing secrets are
invalid or wrong. This flag implies that interaction is allowed.
</tp:docstring>
</tp:flag>
</tp:flags>
<method name="CancelGetSecrets">
<tp:docstring>
Cancel a pending GetSecrets request for secrets of the given

View file

@ -15,7 +15,7 @@
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
* (C) Copyright 2010 Red Hat, Inc.
* (C) Copyright 2010 - 2011 Red Hat, Inc.
*/
#include <config.h>
@ -33,7 +33,7 @@ static void impl_secret_agent_get_secrets (NMSecretAgent *self,
const char *connection_path,
const char *setting_name,
const char **hints,
gboolean request_new,
guint32 flags,
DBusGMethodInvocation *context);
static void impl_secret_agent_cancel_get_secrets (NMSecretAgent *self,
@ -295,7 +295,7 @@ impl_secret_agent_get_secrets (NMSecretAgent *self,
const char *connection_path,
const char *setting_name,
const char **hints,
gboolean request_new,
guint32 flags,
DBusGMethodInvocation *context)
{
GError *error = NULL;
@ -313,7 +313,7 @@ impl_secret_agent_get_secrets (NMSecretAgent *self,
connection_path,
setting_name,
hints,
request_new,
flags,
get_secrets_cb,
context);
g_object_unref (connection);
@ -522,7 +522,7 @@ nm_secret_agent_get_secrets (NMSecretAgent *self,
NMConnection *connection,
const char *setting_name,
const char **hints,
gboolean request_new,
guint32 flags,
NMSecretAgentGetSecretsFunc callback,
gpointer callback_data)
{
@ -540,7 +540,7 @@ nm_secret_agent_get_secrets (NMSecretAgent *self,
nm_connection_get_path (connection),
setting_name,
hints,
request_new,
flags,
callback,
callback_data);
}

View file

@ -40,6 +40,11 @@ typedef enum {
NM_SECRET_AGENT_ERROR_NO_SECRETS,
} NMSecretAgentError;
enum {
NM_SECRET_AGENT_GET_SECRETS_FLAG_NONE = 0x0,
NM_SECRET_AGENT_GET_SECRETS_FLAG_ALLOW_INTERACTION = 0x1,
NM_SECRET_AGENT_GET_SECRETS_FLAG_REQUEST_NEW = 0x2
};
#define NM_TYPE_SECRET_AGENT (nm_secret_agent_get_type ())
#define NM_SECRET_AGENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SECRET_AGENT, NMSecretAgent))
@ -89,7 +94,7 @@ typedef struct {
const char *connection_path,
const char *setting_name,
const char **hints,
gboolean request_new,
guint32 flags,
NMSecretAgentGetSecretsFunc callback,
gpointer callback_data);
@ -148,7 +153,7 @@ void nm_secret_agent_get_secrets (NMSecretAgent *self,
NMConnection *connection,
const char *setting_name,
const char **hints,
gboolean request_new,
guint32 flags,
NMSecretAgentGetSecretsFunc callback,
gpointer callback_data);