00001 /* 00002 * This file is part of the SSH Library 00003 * 00004 * Copyright (c) 2003-2009 by Aris Adamantiadis 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00019 */ 00020 00021 #ifndef _SCP_H 00022 #define _SCP_H 00023 00024 enum ssh_scp_states { 00025 SSH_SCP_NEW, //Data structure just created 00026 SSH_SCP_WRITE_INITED, //Gave our intention to write 00027 SSH_SCP_WRITE_WRITING,//File was opened and currently writing 00028 SSH_SCP_READ_INITED, //Gave our intention to read 00029 SSH_SCP_READ_REQUESTED, //We got a read request 00030 SSH_SCP_READ_READING, //File is opened and reading 00031 SSH_SCP_ERROR, //Something bad happened 00032 SSH_SCP_TERMINATED //Transfer finished 00033 }; 00034 00035 struct ssh_scp_struct { 00036 ssh_session session; 00037 int mode; 00038 int recursive; 00039 ssh_channel channel; 00040 char *location; 00041 enum ssh_scp_states state; 00042 uint64_t filelen; 00043 uint64_t processed; 00044 enum ssh_scp_request_types request_type; 00045 char *request_name; 00046 char *warning; 00047 int request_mode; 00048 }; 00049 00050 int ssh_scp_read_string(ssh_scp scp, char *buffer, size_t len); 00051 int ssh_scp_integer_mode(const char *mode); 00052 char *ssh_scp_string_mode(int mode); 00053 int ssh_scp_response(ssh_scp scp, char **response); 00054 00055 #endif