libssh  0.11.0
The SSH library
Loading...
Searching...
No Matches
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
24enum 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
35struct 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#ifdef __cplusplus
51extern "C" {
52#endif
53
54int ssh_scp_read_string(ssh_scp scp, char *buffer, size_t len);
55int ssh_scp_integer_mode(const char *mode);
56char *ssh_scp_string_mode(int mode);
57int ssh_scp_response(ssh_scp scp, char **response);
58
59#ifdef __cplusplus
60}
61#endif
62
63#endif
int ssh_scp_read_string(ssh_scp scp, char *buffer, size_t len)
Read a string on a channel, terminated by ' '.
Definition scp.c:747
char * ssh_scp_string_mode(int mode)
Convert a unix mode into a scp string.
Definition scp.c:1168
int ssh_scp_integer_mode(const char *mode)
Convert a scp text mode to an integer.
Definition scp.c:1152