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