sshmonitorASubUtils.c#
Note
Click here to check the source code of this file.
This file is a C file (.c) that gathers utility functions for sshmonitorASubCore.c.
Functions
-
void getCacheStatus(aSubRecord *psub, char *tmp_data_cache_path)#
Utility function retrieving the status of the data cache file (by trying to write to it), and putting back the result in the VALU field of the associated aSub record.
- Parameters:
psub – allows to interact with the process variable (pv) fields.
tmp_data_cache_path – specify the path to the data cache.
-
void printFileContent(const char *file_to_print_path)#
Utility function printing the content of a file.
- Parameters:
file_to_print_path – The path to the file to be printed.
-
void executeFullCommandRemotely(char *ssh_opts_and_args, const char *tmp_data_cache_path, char *remote_instruction)#
Utility function allowing to execute a ssh command on a remote (/target) computer.
- Parameters:
ssh_opts_and_args – The ssh options and instructions specified by the user, for the ssh connections.
tmp_data_cache_path – The file path where to store and read back the shell instruction result.
remote_instruction – The shell instruction to execute on the remote (/target) computer.
-
double executeFullCommandWithScalarResultLocally(const char *tmp_data_cache_path, char *local_instruction)#
Utility function allowing to execute a ssh command on the host computer and read back the result as a double.
- Parameters:
tmp_data_cache_path – The file path where to store and read back the shell instruction result.
local_instruction – The shell instruction to execute locally (on the host computer).
- Returns:
The double value returned by the local ssh command, or NAN (Not A Number) if the result is not a double.
-
char *executeFullCommandWithStringResultLocally(const char *tmp_data_cache_path, char *local_instruction)#
Utility function allowing to execute a ssh command on the host computer and read back the as a string.
- Parameters:
tmp_data_cache_path – The file path where to store and read back the instruction result.
local_instruction – The shell instruction to execute locally (on the host computer).
- Returns:
The string value returned by the local ssh command, or an error message if the result is not a string.
-
double executeFullCommandWithScalarResult(char *ssh_opts_and_args, const char *tmp_data_cache_path, char *instruction)#
Utility function allowing to execute a ssh command and read back the result as a double.
- Parameters:
ssh_opts_and_args – The ssh options and arguments specified by the user, for the ssh connections.
tmp_data_cache_path – The file path where to store and read back the shell instruction result.
instruction – The shell instruction to execute on the remote (/target) computer.
- Returns:
The double value returned by the remote ssh command, or NAN (Not A Number) if the result is not a double or if their is any error.
-
char *executeFullCommandWithStringResult(char *ssh_opts_and_args, const char *tmp_data_cache_path, char *instruction)#
Utility function allowing to execute a ssh command and read back the result as a string.
- Parameters:
ssh_opts_and_args – The ssh options and arguments specified by the user, for the ssh connections.
tmp_data_cache_path – The file path where to store and read back the shell instruction result.
instruction – The shell instruction to execute on the remote (/target) computer.
- Returns:
The string returned by the remote ssh command, or an error message if their is any error.
-
double readScalarFromCacheFile(const char *filepath, char *ssh_full_command)#
Utility function allowing to read a double value, stored in a file.
- Parameters:
filepath – The path to the file containing the double value to read.
ssh_full_command – The SSH command resulting to the double value to be read.
- Returns:
The read double value, or NAN (Not A Number) if the read file does not only contain a double.
-
char *readStringFromCacheFile(const char *filepath)#
Utility function allowing to read a string, stored in a file.
- Parameters:
filepath – The path to the file containing the string to read.
- Returns:
The read string.