/* * * Author : GĂ©rald FENOY * * Copyright 2017 GeoLabs SARL. All rights reserved. * * This work was supported by public funds received in the framework of GEOSUD, * a project (ANR-10-EQPX-20) of the program "Investissements d'Avenir" managed * by the French National Research Agency * * 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. */ #ifndef SSHAPI_H #define SSHAPI_H 1 #pragma once #include #include #ifdef HAVE_WINSOCK2_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif #ifdef HAVE_NETINET_IN_H #include #endif #ifdef HAVE_SYS_SELECT_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_ARPA_INET_H #include #endif #ifdef HAVE_SYS_TIME_H #include #endif #include #include #include #include #include #include #include #include #include "service.h" #ifdef __cplusplus extern "C" { #endif #define MAX_PARALLEL_SSH_CON 128 static int nb_sessions; typedef struct { int sock_id; int index; LIBSSH2_SESSION *session; LIBSSH2_SFTP *sftp_session; } SSHCON; ZOO_DLL_EXPORT SSHCON *ssh_connect(maps*); ZOO_DLL_EXPORT bool ssh_copy(maps*,const char*,const char*,int); ZOO_DLL_EXPORT int ssh_get_cnt(maps*); ZOO_DLL_EXPORT int ssh_fetch(maps*,const char*,const char*,int); ZOO_DLL_EXPORT int ssh_exec(maps*,const char*,int); ZOO_DLL_EXPORT bool ssh_close_session(maps*,SSHCON*); ZOO_DLL_EXPORT bool ssh_close(maps*); ZOO_DLL_EXPORT bool addToUploadQueue(maps**,maps*); ZOO_DLL_EXPORT bool runUpload(maps**); #ifdef __cplusplus } #endif #endif