SecretAgentGetSecretsFunc


Description:

[ CCode ( instance_pos = 4.9 ) ]
public delegate void SecretAgentGetSecretsFunc (SecretAgent agent, Connection connection, HashTable<string,HashTable<void*,void*>> secrets, Error error)

Called as a result of a request by NM to retrieve secrets.

When the SecretAgent subclass has finished retrieving secrets and is ready to return them, or to return an error, this function should be called with those secrets or the error.

To easily create the hash table to return the Wi-Fi PSK, you could do something like this:

Creating a secrets hash:

  NMConnection *secrets;
NMSettingWirelessSecurity *s_wsec;
GHashTable *secrets_hash;

secrets = nm_connection_new ();
s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new ();
g_object_set (G_OBJECT (s_wsec),
NM_SETTING_WIRELESS_SECURITY_PSK, "my really cool PSK",
NULL);
nm_connection_add_setting (secrets, NM_SETTING (s_wsec));
secrets_hash = nm_connection_to_hash (secrets, NM_SETTING_HASH_FLAG_ALL);

(call the NMSecretAgentGetSecretsFunc with secrets_hash)

g_object_unref (secrets);
g_hash_table_unref (secrets_hash);

Parameters:

agent

the secret agent object

connection

the connection for which secrets were requested, note that this object will be unrefed after the callback has returned, use @ref/g_object_unref() if you want to use this object after the callback has returned

secrets

the GenericSet containing the requested secrets in the same format as an Connection hash (as created by to_hash for example). Each key in secrets should be the name of a Setting object (like "802-11-wireless-security") and each value should be a GenericSet. The sub-hashes map string:#GValue where the string is the setting property name (like "psk") and the value is the secret

error

if the secrets request failed, give a descriptive error here

user_data

caller-specific data to be passed to the function


Namespace: NM
Package: libnm-glib