agent-manager: expose NMSecretAgent struct in header for tight coupling with NMAgentManager

NMAgentManager and NMSecretAgent work closely together. In particular,
the NMAgentManager creates and tracks the NMSecretAgents and controls
it.

Move NMSecretAgent struct to the header, so that some fields may become
accessible to NMAgentManager. In particular, we will track secret agents
with a CList, and this CList element can be embedded in the
NMSecretAgent structure.
This commit is contained in:
Thomas Haller 2019-12-23 09:23:19 +01:00
parent 0f32326257
commit 86ba66ee9b
2 changed files with 19 additions and 11 deletions

View file

@ -34,33 +34,28 @@ enum {
static guint signals[LAST_SIGNAL] = { 0 };
typedef struct {
typedef struct _NMSecretAgentPrivate {
CList permissions;
CList requests;
GDBusConnection *dbus_connection;
char *description;
NMAuthSubject *subject;
char *identifier;
char *owner_username;
char *dbus_owner;
GDBusConnection *dbus_connection;
GCancellable *name_owner_cancellable;
CList requests;
NMSecretAgentCapabilities capabilities;
guint name_owner_changed_id;
NMSecretAgentCapabilities capabilities;
bool shutdown_wait_obj_registered:1;
} NMSecretAgentPrivate;
struct _NMSecretAgent {
GObject parent;
NMSecretAgentPrivate _priv;
};
struct _NMSecretAgentClass {
GObjectClass parent;
};
G_DEFINE_TYPE (NMSecretAgent, nm_secret_agent, G_TYPE_OBJECT)
#define NM_SECRET_AGENT_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMSecretAgent, NM_IS_SECRET_AGENT)
#define NM_SECRET_AGENT_GET_PRIVATE(self) _NM_GET_PRIVATE_PTR (self, NMSecretAgent, NM_IS_SECRET_AGENT)
/*****************************************************************************/
@ -765,7 +760,11 @@ nm_secret_agent_new (GDBusMethodInvocation *context,
static void
nm_secret_agent_init (NMSecretAgent *self)
{
NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (self);
NMSecretAgentPrivate *priv;
priv = G_TYPE_INSTANCE_GET_PRIVATE (self, NM_TYPE_SECRET_AGENT, NMSecretAgentPrivate);
self->_priv = priv;
c_list_init (&priv->permissions);
c_list_init (&priv->requests);
@ -814,6 +813,8 @@ nm_secret_agent_class_init (NMSecretAgentClass *config_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (config_class);
g_type_class_add_private (object_class, sizeof (NMSecretAgentPrivate));
object_class->dispose = dispose;
object_class->finalize = finalize;

View file

@ -20,6 +20,13 @@
typedef struct _NMSecretAgentClass NMSecretAgentClass;
typedef struct _NMSecretAgentCallId NMSecretAgentCallId;
struct _NMSecretAgentPrivate;
struct _NMSecretAgent {
GObject parent;
struct _NMSecretAgentPrivate *_priv;
};
GType nm_secret_agent_get_type (void);
NMSecretAgent *nm_secret_agent_new (GDBusMethodInvocation *context,