libssh 0.12.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
24#include "config.h"
25
26#include <stddef.h>
27#include <stdint.h>
28
29#include "libssh/libssh.h"
30
31enum ssh_scp_states {
32 SSH_SCP_NEW, //Data structure just created
33 SSH_SCP_WRITE_INITED, //Gave our intention to write
34 SSH_SCP_WRITE_WRITING,//File was opened and currently writing
35 SSH_SCP_READ_INITED, //Gave our intention to read
36 SSH_SCP_READ_REQUESTED, //We got a read request
37 SSH_SCP_READ_READING, //File is opened and reading
38 SSH_SCP_ERROR, //Something bad happened
39 SSH_SCP_TERMINATED //Transfer finished
40};
41
42struct ssh_scp_struct {
43 ssh_session session;
44 int mode;
45 int recursive;
46 ssh_channel channel;
47 char *location;
48 enum ssh_scp_states state;
49 uint64_t filelen;
50 uint64_t processed;
51 enum ssh_scp_request_types request_type;
52 char *request_name;
53 char *warning;
54 int request_mode;
55};
56
57#ifdef __cplusplus
58extern "C" {
59#endif
60
61int ssh_scp_read_string(ssh_scp scp, char *buffer, size_t len);
62int ssh_scp_integer_mode(const char *mode);
63char *ssh_scp_string_mode(int mode);
64int ssh_scp_response(ssh_scp scp, char **response);
65
66#ifdef __cplusplus
67}
68#endif
69
70#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:759
char * ssh_scp_string_mode(int mode)
Convert a unix mode into a scp string.
Definition scp.c:1196
int ssh_scp_integer_mode(const char *mode)
Convert a scp text mode to an integer.
Definition scp.c:1180