Add functions that use a private connection. 06/296206/1 accepted/tizen_6.5_unified tizen_6.5 accepted/tizen/6.5/unified/20230807.014206
authorMateusz Moscicki <m.moscicki2@partner.samsung.com>
Mon, 10 Jul 2023 14:34:25 +0000 (16:34 +0200)
committerMateusz Moscicki <m.moscicki2@partner.samsung.com>
Mon, 17 Jul 2023 13:50:42 +0000 (15:50 +0200)
At the moment only the functions that libstorage uses are prepared.
Currently only functoins are added that are called by libstorage during
the dotnet-launcher preparation.

Change-Id: Ifb341aa0cbd1c841491f16b317bed1d68655010b

src/libgdbus/libgdbus.c
src/libgdbus/libgdbus.h

index 917b98ffb06de8150d7678e0a26dbf7d6f9c65d6..303a44ae9b1660bb3b43d74da91440f57441bac6 100644 (file)
@@ -244,6 +244,7 @@ static dbus_handle_s *_gdbus_get_connection_private(GBusType bus_type)
 
        if (!dh->conn) {
                dh->conn = _get_bus_private(bus_type);
+               dh->priv = TRUE;
                dh->bus_type = bus_type;
                if (!dh->conn)
                        goto err;
@@ -2052,7 +2053,8 @@ int gdbus_flush_sync(dbus_handle_h handle)
        return ret;
 }
 
-int gdbus_call_sync_with_reply(const char *dest,
+int gdbus_priv_call_sync_with_reply(dbus_handle_h handle,
+                                               const char *dest,
                                                const char *path,
                                                const char *iface,
                                                const char *method,
@@ -2062,21 +2064,20 @@ int gdbus_call_sync_with_reply(const char *dest,
        GError *err = NULL;
        GVariant *reply = NULL;
        int ret = 0;
-       dbus_handle_s *dh = NULL;
+       dcl_gdbus();
 
-       if (!dest || !path || !iface || !method) {
-               _E("wrong parameters dest(%s) path(%s) iface(%s) method(%s)", dest, path, iface, method);
+       if (!dh) {
+               _E("dbus handle is NULL");
                if (param)
                        g_variant_unref(param);
                return -EINVAL;
        }
 
-       dh = _gdbus_get_default_connection();
-       if (!dh) {
-               _E("failed to get default connection, bustype:%d", (int)gdbus_get_default_bus_type());
+       if (!dest || !path || !iface || !method) {
+               _E("wrong parameters dest(%s) path(%s) iface(%s) method(%s)", dest, path, iface, method);
                if (param)
                        g_variant_unref(param);
-               return -ECOMM;
+               return -EINVAL;
        }
 
        reply = g_dbus_connection_call_sync(dh->conn,
@@ -2109,6 +2110,30 @@ int gdbus_call_sync_with_reply(const char *dest,
        return ret;
 }
 
+int gdbus_call_sync_with_reply(const char *dest,
+                                               const char *path,
+                                               const char *iface,
+                                               const char *method,
+                                               GVariant *param,
+                                               GVariant **out_reply)
+{
+       dbus_handle_s *dh = _gdbus_get_default_connection();
+       if (!dh) {
+               _E("failed to get default connection, bustype:%d", (int)gdbus_get_default_bus_type());
+               if (param)
+                       g_variant_unref(param);
+               return -ECOMM;
+       }
+
+       return gdbus_priv_call_sync_with_reply(dh,
+                                              dest,
+                                              path,
+                                              iface,
+                                              method,
+                                              param,
+                                              out_reply);
+}
+
 int gdbus_call_sync_with_reply_timeout(const char *dest, const char *path,
        const char *iface, const char *method, GVariant *param, GVariant **out_reply, int timeout)
 {
@@ -2523,6 +2548,7 @@ err:
        if (param)
                g_variant_unref(param);
        return ret;
+
 }
 
 int gdbus_call_pairs_async_with_reply(const char *dest,
index 85e2ed004880e30530ffdf9b432f49e684599386..43b943bb777c44b1fc53cc42de061a8656979059 100644 (file)
@@ -86,6 +86,8 @@ typedef struct {
 dbus_handle_h gdbus_get_connection     (GBusType bus_type,
                                                gboolean priv);
 
+int gdbus_free_connection(dbus_handle_h handle);
+
 int gdbus_request_name         (dbus_handle_h handle,
                                                const char *bus_name,
                                                GBusNameAcquiredCallback acquired_handler,
@@ -144,6 +146,14 @@ int gdbus_call_sync_with_reply             (const char *dest,
                                                                GVariant *param,
                                                                GVariant **out_reply);
 
+int gdbus_priv_call_sync_with_reply            (dbus_handle_h handle,
+                                                               const char *dest,
+                                                               const char *path,
+                                                               const char *iface,
+                                                               const char *method,
+                                                               GVariant *param,
+                                                               GVariant **out_reply);
+
 int gdbus_call_sync_with_reply_timeout (const char *dest,
                                                                const char *path,
                                                                const char *iface,