#include <stdio.h>#include <stdlib.h>#include <fcntl.h>#include <unistd.h>#include <signal.h>#include <string.h>#include <errno.h>#include <sys/types.h>#include <sys/resource.h>#include <sys/wait.h>#include <sys/socket.h>#include <ngc/core/ngcb.h>#include <ngc/core/ngcbSocket.h>Classes | |
| struct | ngcb_exec_cache |
Macros | |
| #define | _GNU_SOURCE |
| #define | _REENTRANT |
| #define | ngcbEXEC_ID "ngcbExecSrv:_ngcbEXEC_" |
| #define | ngcbEXEC_VERSION 2 |
| #define | TERM_CHAR '\016' |
| #define | CONT_CHAR '\n' |
| #define | ERR_CHAR '\v' |
| #define | DEBUG_CHAR '\r' |
| #define | ngcbEXEC_CONNECT_TMO 20 |
| #define | ngcbEXEC_CACHE_SIZE 32 |
Functions | |
| int | ngcbExecDaemon (int bg) |
| void | ngcbExecReply (int fd, int success, const char *reply) |
| void | ngcbExecShell (const char *shell) |
| int | ngcbExecInit (const char *host, int *version, char *erms) |
| int | ngcbExecutor (int argc, char **argv) |
| int | ngcbExecVersion (const char *host, char *erms) |
| int | ngcbExec (const char *host, int *pid, const char *cmd, char *reply, char *erms) |
| int | ngcbExecDbg (const char *host, int *pid, const char *cmd, char *reply, int port, char *erms) |
| int | ngcbExecXt (const char *host, int *pid, const char *cmd, char *reply, const char *geom, char *erms) |
| int | ngcbKill (const char *host, int pid, char *erms) |
| int | ngcbRemoteFileOpen (const char *host, const char *fileName, size_t *size, char *erms) |
| void | ngcbRemoteFileClose (int fd) |
| int | ngcbRemoteFileDelete (const char *host, const char *fileName, char *erms) |
| #define _GNU_SOURCE |
| #define _REENTRANT |
| #define CONT_CHAR '\n' |
continue processing
| #define DEBUG_CHAR '\r' |
enable debug channel
| #define ERR_CHAR '\v' |
error abort
| #define ngcbEXEC_CACHE_SIZE 32 |
Maximum size of exec-connection cache
| #define ngcbEXEC_CONNECT_TMO 20 |
Connect timeout in seconds (-1 = no timeout)
| #define ngcbEXEC_ID "ngcbExecSrv:_ngcbEXEC_" |
Remote daemon id
| #define ngcbEXEC_VERSION 2 |
Remote daemon version
| #define TERM_CHAR '\016' |
message termination
| int ngcbExec | ( | const char * | host, |
| int * | pid, | ||
| const char * | cmd, | ||
| char * | reply, | ||
| char * | erms ) |
Execute a command on a host. The process id is returned (in pid). If the reply buffer passed to ngcbExec() is not NULL, then the process, which shall be started via these functions, should return a reply string with ngcbExecReply() after startup. A file descriptor to be used for ngcbExecReply() is automatically passed via the option [-fd n]. Processes, which do not handle this option, must be executed with the reply buffer set to NULL.
| int ngcbExecDaemon | ( | int | bg | ) |
Daemon process for remote process execution.
| int ngcbExecDbg | ( | const char * | host, |
| int * | pid, | ||
| const char * | cmd, | ||
| char * | reply, | ||
| int | port, | ||
| char * | erms ) |
Same as ngcbExec() but enables debugging on given port
| int ngcbExecInit | ( | const char * | host, |
| int * | version, | ||
| char * | erms ) |
Launch remote execution daemon on host. This function is automatically executed when ngcbExec()/ngcbKill() is called for the first time. The daemon will automatically die when the calling process exits.
| void ngcbExecReply | ( | int | fd, |
| int | success, | ||
| const char * | reply ) |
Send reply message to calling application. Setting success to 1 indicates a succesful process start.
| void ngcbExecShell | ( | const char * | shell | ) |
Override default shell to be used for exec daemon remote execution
| int ngcbExecutor | ( | int | argc, |
| char ** | argv ) |
Retrieve remote execution handle from the command line options. The function returns a handle to be used for the ngcbExecReply().
| int ngcbExecVersion | ( | const char * | host, |
| char * | erms ) |
Return the version of the remote exec daemon or -1 if the version cannot be retrieved.
| int ngcbExecXt | ( | const char * | host, |
| int * | pid, | ||
| const char * | cmd, | ||
| char * | reply, | ||
| const char * | geom, | ||
| char * | erms ) |
Same as ngcbExec() but executes the command in a new terminal
| int ngcbKill | ( | const char * | host, |
| int | pid, | ||
| char * | erms ) |
Send kill signal to process with process-id pid on the host given in hostName.
| void ngcbRemoteFileClose | ( | int | fd | ) |
Close a file-connection which has been opened with the ngcbRemoteFileOpen() function.
| int ngcbRemoteFileDelete | ( | const char * | host, |
| const char * | fileName, | ||
| char * | erms ) |
Delete a file residing on the given host.
| int ngcbRemoteFileOpen | ( | const char * | host, |
| const char * | fileName, | ||
| size_t * | size, | ||
| char * | erms ) |
Return a read-only file descriptor to a file residing on host. The size returns the size of the file in bytes.