ZOO-Project: sshapi.c File Reference
ZOO-Project
sshapi.c File Reference
#include "sshapi.h"
#include "service_internal.h"

Functions

int waitsocket (int socket_fd, LIBSSH2_SESSION *session)
 Wait until one or more file descriptor has been changed for the socket for a time defined by timeout. More...
 
SSHCONssh_connect (maps *conf)
 Connect to a remote host using SSH protocol. More...
 
int ssh_get_cnt (maps *conf)
 Get the number of opened SSH connections. More...
 
size_t ssh_file_exists (maps *conf, const char *targetPath, int cnt)
 Verify if a file exists on the remote host. More...
 
bool ssh_copy (maps *conf, const char *localPath, const char *targetPath, int cnt)
 Upload a file over an opened SSH connection. More...
 
int ssh_fetch (maps *conf, const char *localPath, const char *targetPath, int cnt)
 Download a file over an opened SSH connection. More...
 
int ssh_exec (maps *conf, const char *command, int cnt)
 Execute a command over an opened SSH connection. More...
 
bool ssh_close_session (maps *conf, SSHCON *con)
 Close an opened SSH connection. More...
 
bool ssh_close (maps *conf)
 Close all the opened SSH connections. More...
 
bool addToUploadQueue (maps **conf, maps *input)
 
int fileMd5Check (maps **conf, const char *localPath, const char *targetPath)
 
bool runUpload (maps **conf)
 

Variables

SSHCONsessions [MAX_PARALLEL_SSH_CON]
 

Function Documentation

bool addToUploadQueue ( maps **  conf,
maps input 
)
int fileMd5Check ( maps **  conf,
const char *  localPath,
const char *  targetPath 
)
bool runUpload ( maps **  conf)
bool ssh_close ( maps conf)

Close all the opened SSH connections.

Parameters
confmaps pointer to the main configuration maps
Returns
true in case of success, false if failure occured
bool ssh_close_session ( maps conf,
SSHCON con 
)

Close an opened SSH connection.

Parameters
confmaps pointer to the main configuration maps
conSSHCON pointer to the SSH connection
Returns
true in case of success, false if failure occured
SSHCON* ssh_connect ( maps conf)

Connect to a remote host using SSH protocol.

Parameters
confmaps The main configuration maps
Returns
the libssh2 sessions pointer or NULL in case any failure occured.
bool ssh_copy ( maps conf,
const char *  localPath,
const char *  targetPath,
int  cnt 
)

Upload a file over an opened SSH connection.

Parameters
confmaps pointer to the main configuration maps
localPathconst char* defining the local path for accessing the file
targetPathconst char* defining the path for storing the file on the remote host
Returns
true in case of success, false if failure occured
int ssh_exec ( maps conf,
const char *  command,
int  cnt 
)

Execute a command over an opened SSH connection.

Parameters
confmaps pointer to the main configuration maps
commandconst char pointer to the command to be executed
Returns
bytecount resulting from the execution of the command
int ssh_fetch ( maps conf,
const char *  localPath,
const char *  targetPath,
int  cnt 
)

Download a file over an opened SSH connection.

Parameters
confmaps pointer to the main configuration maps
localPathconst char* defining the local path for storing the file
targetPathconst char* defining the path for accessing the file on the remote host
Returns
0 in case of success, -1 if failure occured
size_t ssh_file_exists ( maps conf,
const char *  targetPath,
int  cnt 
)

Verify if a file exists on the remote host.

Parameters
confmaps pointer to the main configuration maps
targetPathconst char* defining the path for storing the file on the remote host
Returns
true in case of success, false if failure occured
int ssh_get_cnt ( maps conf)

Get the number of opened SSH connections.

Parameters
confmaps pointer to the main configuration maps
Returns
the number of opened SSH connections
int waitsocket ( int  socket_fd,
LIBSSH2_SESSION *  session 
)

Wait until one or more file descriptor has been changed for the socket for a time defined by timeout.

Parameters
socket_fdint defining the sockket file descriptor
sessionan exeisting LIBSSH2_SESSION

Variable Documentation

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png