[Feature][T108] provide sys interfaces
Only Configure: No
Affected branch: GSW_V1453
Affected module: sys
Self-test: yes
Doc Update: no
Change-Id: Iecea2cd4991c0380924ab4d2512aca8b36768fe9
diff --git a/mbtk/include/gsw/gsw_sys_interface.h b/mbtk/include/gsw/gsw_sys_interface.h
new file mode 100755
index 0000000..a7f22cf
--- /dev/null
+++ b/mbtk/include/gsw/gsw_sys_interface.h
@@ -0,0 +1,53 @@
+/**
+* @file : gsw_sys_interface.h
+* @date : 2025-6-11
+* @copyright Copyright(C) 2022,Gosuncnwelink
+*/
+#ifndef __GSW_SYS_INTERFACE__H__
+#define __GSW_SYS_INTERFACE__H__
+
+/*********************************************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <pthread.h>
+#include <stddef.h>
+#include "gsw_hal_errcode.h"
+
+
+/**
+* @brief start or restart ftp server
+* @param [in] cfg the ftp server config file
+* @retval GSW_HAL_SUCCESS is success\other is fail
+*/
+int gsw_sys_svr_ftp_start(const char *cfg);
+
+/**
+* @brief stop ftp server
+* @retval GSW_HAL_SUCCESS is success\other is fail
+*/
+int gsw_sys_svr_ftp_stop(void);
+
+/**
+* @brief start or restart sshserver
+* @param [in] cfg the sshserver config file
+* @retval GSW_HAL_SUCCESS is success\other is fail
+*/
+int gsw_sys_svr_ssh_start(const char *cfg);
+
+/**
+* @brief stop sshserver
+* @retval GSW_HAL_SUCCESS is success\other is fail
+*/
+int gsw_sys_svr_ssh_stop(void);
+
+/**
+* @brief restart syslog server
+* @param [in] log_lvl, range [emerg alert crit err warning notice info debug]
+* @retval GSW_HAL_SUCCESS is success\other is fail
+*/
+int gsw_sys_svr_syslog_restart(const char *log_lvl);
+
+
+#endif //__GSW_SYS_INTERFACE__H_
diff --git a/mbtk/libgsw_lib/gsw_sys_interface.c b/mbtk/libgsw_lib/gsw_sys_interface.c
new file mode 100755
index 0000000..b21e4df
--- /dev/null
+++ b/mbtk/libgsw_lib/gsw_sys_interface.c
@@ -0,0 +1,46 @@
+#include "gsw_sys_interface.h"
+
+int gsw_sys_svr_ftp_start(const char *cfg)
+{
+ int ret = GSW_HAL_SUCCESS;
+ (void)cfg;
+ ret = system("/etc/init.d/vsftpd start");
+ if(ret != 0)
+ return GSW_HAL_NORMAL_FAIL;
+
+ return GSW_HAL_SUCCESS;
+}
+
+int gsw_sys_svr_ftp_stop()
+{
+ int ret = GSW_HAL_SUCCESS;
+ ret = system("/etc/init.d/vsftpd stop");
+ return ret;
+}
+
+int gsw_sys_svr_ssh_start(const char *cfg)
+{
+ int ret= GSW_HAL_SUCCESS;
+ ret = system("/etc/init.d/sshd restart");
+ if(ret != 0)
+ return GSW_HAL_NORMAL_FAIL;
+ return GSW_HAL_SUCCESS;
+}
+
+int gsw_sys_svr_ssh_stop()
+{
+ int ret = GSW_HAL_SUCCESS;
+ ret = system("/etc/init.d/sshd stop");
+ if(ret != 0)
+ return GSW_HAL_NORMAL_FAIL;
+
+ return GSW_HAL_SUCCESS;
+}
+
+int gsw_sys_svr_syslog_restart(const char *log_lvl)
+{
+ (void)log_lvl;
+ return GSW_HAL_NORMAL_FAIL;
+}
+
+