libssh  0.5.4
scp.h
1 /*
2  * This file is part of the SSH Library
3  *
4  * Copyright (c) 2003-2009 by Aris Adamantiadis
5  *
6  * The SSH Library is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation; either version 2.1 of the License, or (at your
9  * option) any later version.
10  *
11  * The SSH Library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14  * License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with the SSH Library; see the file COPYING. If not, write to
18  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
19  * MA 02111-1307, USA.
20  */
21 
22 #ifndef _SCP_H
23 #define _SCP_H
24 
25 enum ssh_scp_states {
26  SSH_SCP_NEW, //Data structure just created
27  SSH_SCP_WRITE_INITED, //Gave our intention to write
28  SSH_SCP_WRITE_WRITING,//File was opened and currently writing
29  SSH_SCP_READ_INITED, //Gave our intention to read
30  SSH_SCP_READ_REQUESTED, //We got a read request
31  SSH_SCP_READ_READING, //File is opened and reading
32  SSH_SCP_ERROR, //Something bad happened
33  SSH_SCP_TERMINATED //Transfer finished
34 };
35 
36 struct ssh_scp_struct {
37  ssh_session session;
38  int mode;
39  int recursive;
40  ssh_channel channel;
41  char *location;
42  enum ssh_scp_states state;
43  size_t filelen;
44  size_t processed;
45  enum ssh_scp_request_types request_type;
46  char *request_name;
47  char *warning;
48  int request_mode;
49 };
50 
51 int ssh_scp_read_string(ssh_scp scp, char *buffer, size_t len);
52 int ssh_scp_integer_mode(const char *mode);
53 char *ssh_scp_string_mode(int mode);
54 int ssh_scp_response(ssh_scp scp, char **response);
55 
56 #endif