aboutsummaryrefslogtreecommitdiff
path: root/src/mm-auth-provider.h
diff options
context:
space:
mode:
authorDan Williams <dan@ioncontrol.co>2025-04-29 20:54:36 -0500
committerDan Williams <dan@ioncontrol.co>2025-05-08 20:08:06 -0500
commitef5cee3ab578c2fde8ca6cc636f10acfdb79f123 (patch)
tree02510944a5782a9c4047234b747fdc02dd8f31c8 /src/mm-auth-provider.h
parent7262b46a82642b7232ef922b827d77626a93eec0 (diff)
auth-provider: move auth provider logic into each class
Rather than make all of them rely on MMBaseModem for it. This lets us disentangle dependencies for easier unit testing. For interfaces, rather than casting directly to MMBaseModem use intermediate interfaces (MMIfaceAuth and MMIfaceOpLock) that tests can fake out. Signed-off-by: Dan Williams <dan@ioncontrol.co>
Diffstat (limited to 'src/mm-auth-provider.h')
-rw-r--r--src/mm-auth-provider.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/mm-auth-provider.h b/src/mm-auth-provider.h
index 6065c806..2167cd59 100644
--- a/src/mm-auth-provider.h
+++ b/src/mm-auth-provider.h
@@ -56,4 +56,39 @@ gboolean mm_auth_provider_authorize_finish (MMAuthProvider *self,
GAsyncResult *res,
GError **error);
+/*****************************************************************************/
+/* Auth interface
+ *
+ * Implemented by objects (mainly MMBaseModem) that provide authorization
+ * capability to other interfaces (MMIfaceModem) since GLib interfaces don't
+ * have private data to store the singletone.
+ */
+
+#define MM_TYPE_IFACE_AUTH mm_iface_auth_get_type ()
+G_DECLARE_INTERFACE (MMIfaceAuth, mm_iface_auth, MM, IFACE_AUTH, GObject)
+
+struct _MMIfaceAuthInterface {
+ GTypeInterface g_iface;
+
+ void (* authorize) (MMIfaceAuth *self,
+ GDBusMethodInvocation *invocation,
+ const gchar *authorization,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+ gboolean (* authorize_finish) (MMIfaceAuth *self,
+ GAsyncResult *res,
+ GError **error);
+};
+
+void mm_iface_auth_authorize (MMIfaceAuth *self,
+ GDBusMethodInvocation *invocation,
+ const gchar *authorization,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+gboolean mm_iface_auth_authorize_finish (MMIfaceAuth *self,
+ GAsyncResult *res,
+ GError **error);
+
#endif /* MM_AUTH_PROVIDER_H */