sessiond-plugin-internal.h moved from libsyscommon 22/323522/2
authorMichal Bloch <m.bloch@samsung.com>
Tue, 29 Apr 2025 11:49:56 +0000 (13:49 +0200)
committerMichal Bloch <m.bloch@samsung.com>
Wed, 30 Apr 2025 21:01:09 +0000 (23:01 +0200)
The internal functions are already provided by sessiond,
in plugin_push.cpp, so this makes sure that the header
is also provided in the same place and avoids creating
a "fake" plugin dependency on libsyscommon.

Change-Id: I54754be8612ca71ac6fb7826a828efdecdc43de2

packaging/sessiond.spec
src/library/CMakeLists.txt
src/library/include/sessiond-plugin-internal.h [new file with mode: 0644]
src/service/src/plugin_push.cpp
tests/plugin_example/empty_plugin.cpp

index 300df5ce31861f9212aed1a98d12d52d538d5635..fa97577fcbb28e1f93fe91a1e4e272d1d7d1f32b 100644 (file)
@@ -96,6 +96,7 @@ popd
 %{_libdir}/libsessiond.so
 %{_libdir}/pkgconfig/libsessiond.pc
 %{_includedir}/sessiond.h
+%{_includedir}/sessiond-plugin-internal.h
 %{_includedir}/sessiond-platform.h
 
 %files -n libsessiond-tests
index de3e26f1b65213cdcda776ae9a0020643322f5b8..a86752435c68f91e63f4c6b8f00ea8b5032e0b3b 100644 (file)
@@ -14,7 +14,7 @@ set_target_properties(
        # TODO: Find a way to fetch the relewant part of "${VERSION}".
        # Setting the CMake project version should help but I were not able to do this quickly.
        SOVERSION 0
-       PUBLIC_HEADER "include/sessiond.h;include/sessiond-platform.h"
+       PUBLIC_HEADER "include/sessiond.h;include/sessiond-platform.h;include/sessiond-plugin-internal.h"
        C_VISIBILITY_PRESET hidden
 )
 
diff --git a/src/library/include/sessiond-plugin-internal.h b/src/library/include/sessiond-plugin-internal.h
new file mode 100644 (file)
index 0000000..56cf03c
--- /dev/null
@@ -0,0 +1,63 @@
+/* MIT License
+ *
+ * Copyright (c) 2025 Samsung Electronics Co., Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is furnished
+ * to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE. */
+
+#pragma once
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Add a subsession (called from plugin)
+ * @param uid user ID to add the subsession to
+ * @param subsession Subsession name to add
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int sessiond_internal_add_subsession(int uid, const char *subsession);
+
+/**
+ * @brief Add a subsession (called from plugin)
+ * @param uid user ID to add the subsession to
+ * @param subsession Subsession name to add
+ * @param size_kB Size limit of the subsession in kilobytes
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int sessiond_internal_add_subsession_fixed_size(int uid, const char *subsession, unsigned size_kB);
+
+/**
+ * @brief Remove a subsession (called from plugin)
+ * @param uid user ID to remove the subsession from
+ * @param subsession Subsession name to remove
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int sessiond_internal_remove_subsession(int uid, const char *subsession);
+
+/**
+ * @brief Switch subsession (called from plugin)
+ * @param uid user ID whose subsession to switch
+ * @param subsession Subsession name to switch to
+ * @return @c 0 on success, otherwise a negative error value
+ */
+int sessiond_internal_switch_subsession(int uid, const char *subsession);
+
+#ifdef __cplusplus
+}
+#endif
index db950adf04986a42426b3299fb77be24df753602..303c72118e083ab62cba53aa8e7e893e67ca318d 100644 (file)
@@ -28,7 +28,7 @@
 #define LOG_TAG "SESSIOND"
 #include <dlog.h>
 
-#include <system/syscommon-internal-sessiond.h>
+#include <sessiond-plugin-internal.h>
 
 #ifndef EXPORT
        #define EXPORT __attribute__((visibility("default")))
index 596255822141d09debd6f06de46ec036f1cb5620..923e8727a541a3615617bd35ef4b854e0635e56e 100644 (file)
@@ -4,7 +4,8 @@
 #include <system/syscommon-plugin-common-interface.h>
 #include <system/syscommon-plugin-sessiond.h>
 #include <system/syscommon-plugin-sessiond-interface.h>
-#include <system/syscommon-internal-sessiond.h>
+
+#include <sessiond-plugin-internal.h>
 
 #undef LOG_TAG
 #define LOG_TAG "SESSIOND_PLUGIN"