1 #ifndef HEADER_CURL_SSH_H
2 #define HEADER_CURL_SSH_H
3 /***************************************************************************
4  *                                  _   _ ____  _
5  *  Project                     ___| | | |  _ \| |
6  *                             / __| | | | |_) | |
7  *                            | (__| |_| |  _ <| |___
8  *                             \___|\___/|_| \_\_____|
9  *
10  * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
11  *
12  * This software is licensed as described in the file COPYING, which
13  * you should have received as part of this distribution. The terms
14  * are also available at http://curl.haxx.se/docs/copyright.html.
15  *
16  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17  * copies of the Software, and permit persons to whom the Software is
18  * furnished to do so, under the terms of the COPYING file.
19  *
20  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21  * KIND, either express or implied.
22  *
23  * $Id: ssh.h,v 1.17 2008-12-22 18:46:12 giva Exp $
24  ***************************************************************************/
25 
26 #ifdef USE_LIBSSH2
27 
28 #if !defined(LIBSSH2_VERSION_NUM) || (LIBSSH2_VERSION_NUM < 0x001000)
29 #  error "SCP/SFTP protocols require libssh2 0.16 or later"
30 #endif
31 
32 #if (LIBSSH2_VERSION_NUM >= 0x001300)
33 /* libssh2 0.19 was the planned release version for a while before it was
34    decided to instead become 1.0. Thus >= 0x001300 should still work fine
35    for snapshots done during the 0.19 days as well as things released once
36    it was bumped to 1.0 */
37 #  define HAVE_LIBSSH2_SESSION_BLOCK_DIRECTIONS 1
38 #else
39 #  undef HAVE_LIBSSH2_SESSION_BLOCK_DIRECTIONS
40 #endif
41 
42 #if (LIBSSH2_VERSION_NUM >= 0x010000)
43 /* libssh2_sftp_seek64() has only ever been provided by libssh2 1.0 or
44    later */
45 #  define HAVE_LIBSSH2_SFTP_SEEK64 1
46 #else
47 #  undef HAVE_LIBSSH2_SFTP_SEEK64
48 #endif
49 
50 
51 extern const struct Curl_handler Curl_handler_scp;
52 extern const struct Curl_handler Curl_handler_sftp;
53 
54 ssize_t Curl_scp_send(struct connectdata *conn, int sockindex,
55                       const void *mem, size_t len);
56 ssize_t Curl_scp_recv(struct connectdata *conn, int sockindex,
57                       char *mem, size_t len);
58 
59 ssize_t Curl_sftp_send(struct connectdata *conn, int sockindex,
60                        const void *mem, size_t len);
61 ssize_t Curl_sftp_recv(struct connectdata *conn, int sockindex,
62                        char *mem, size_t len);
63 
64 #define Curl_ssh_enabled(conn,prot) (conn->protocol & prot)
65 
66 #else /* USE_LIBSSH2 */
67 #define Curl_ssh_enabled(x,y) 0
68 #define Curl_scp_send(a,b,c,d) 0
69 #define Curl_sftp_send(a,b,c,d) 0
70 #define Curl_scp_recv(a,b,c,d) 0
71 #define Curl_sftp_recv(a,b,c,d) 0
72 
73 #endif /* USE_LIBSSH2 */
74 
75 #endif /* HEADER_CURL_SSH_H */
76