diff options
Diffstat (limited to 'include/libssh')
-rw-r--r-- | include/libssh/libssh.h | 18 | ||||
-rw-r--r-- | include/libssh/priv.h | 24 |
2 files changed, 36 insertions, 6 deletions
diff --git a/include/libssh/libssh.h b/include/libssh/libssh.h index e5447878..466fb5f0 100644 --- a/include/libssh/libssh.h +++ b/include/libssh/libssh.h @@ -120,6 +120,7 @@ typedef struct ssh_agent_struct* ssh_agent; typedef struct ssh_session_struct* ssh_session; typedef struct ssh_kbdint_struct* ssh_kbdint; typedef struct ssh_scp_struct* ssh_scp; +typedef struct ssh_scp_request_struct* ssh_scp_request; /* Socket type */ #ifdef _WIN32 @@ -336,6 +337,9 @@ LIBSSH_API int channel_request_sftp(ssh_channel channel); LIBSSH_API int channel_request_x11(ssh_channel channel, int single_connection, const char *protocol, const char *cookie, int screen_number); LIBSSH_API ssh_channel channel_accept_x11(ssh_channel channel, int timeout_ms); +LIBSSH_API int channel_forward_listen(ssh_session session, const char *address, int port, int *bound_port); +LIBSSH_API ssh_channel channel_forward_accept(ssh_session session, int timeout_ms); +LIBSSH_API int channel_forward_cancel(ssh_session session, const char *address, int port); LIBSSH_API int channel_write(ssh_channel channel, const void *data, uint32_t len); LIBSSH_API int channel_send_eof(ssh_channel channel); LIBSSH_API int channel_is_eof(ssh_channel channel); @@ -440,6 +444,10 @@ LIBSSH_API int ssh_userauth_kbdint_setanswer(SSH_SESSION *session, unsigned int LIBSSH_API int ssh_init(void); LIBSSH_API int ssh_finalize(void); +/* misc.c */ +LIBSSH_API char *ssh_dirname (const char *path); +LIBSSH_API char *ssh_basename (const char *path); + /* messages.c */ typedef struct ssh_message_struct SSH_MESSAGE; typedef struct ssh_message_struct *ssh_message; @@ -461,12 +469,22 @@ enum { SSH_SCP_READ }; +enum ssh_scp_request_types { + /** A new directory is going to be pulled */ + SSH_SCP_REQUEST_NEWDIR, + /** A new file is going to be pulled */ + SSH_SCP_REQUEST_NEWFILE +}; LIBSSH_API ssh_scp ssh_scp_new(ssh_session session, int mode, const char *location); LIBSSH_API int ssh_scp_init(ssh_scp scp); LIBSSH_API int ssh_scp_close(ssh_scp scp); LIBSSH_API void ssh_scp_free(ssh_scp scp); +LIBSSH_API int ssh_scp_push_directory(ssh_scp scp, const char *dirname, const char *perms); +LIBSSH_API int ssh_scp_leave_directory(ssh_scp scp); LIBSSH_API int ssh_scp_push_file(ssh_scp scp, const char *filename, size_t size, const char *perms); LIBSSH_API int ssh_scp_write(ssh_scp scp, const void *buffer, size_t len); +LIBSSH_API ssh_scp_request ssh_scp_pull_request(ssh_scp scp); +LIBSSH_API int ssh_scp_deny_request(ssh_scp scp, ssh_scp_request request, const char *reason); #ifdef __cplusplus } diff --git a/include/libssh/priv.h b/include/libssh/priv.h index bf348d4e..1cb3f64c 100644 --- a/include/libssh/priv.h +++ b/include/libssh/priv.h @@ -32,19 +32,16 @@ #ifdef _MSC_VER #define snprintf _snprintf +/** Imitate define of inttypes.h */ +#define PRIdS "Id" #else #include <unistd.h> +#define PRIdS "zd" #endif #include "config.h" #include "libssh/libssh.h" -/* Debugging constants */ - -/* Define this if you want to debug crypto systems */ -/* it's usefull when you are debugging the lib */ -/*#define DEBUG_CRYPTO */ - /* some constants */ #define MAX_PACKET_LEN 262144 #define ERROR_BUFFERLEN 1024 @@ -362,6 +359,7 @@ enum ssh_scp_states { SSH_SCP_READ_READING, //File is opened and reading SSH_SCP_ERROR //Something bad happened }; + struct ssh_scp_struct { ssh_session session; int mode; @@ -372,6 +370,16 @@ struct ssh_scp_struct { size_t processed; }; + +struct ssh_scp_request_struct { + ssh_scp scp; + enum ssh_scp_request_types type; + char *name; + char *mode; + size_t size; + int acked; +}; + struct ssh_message_struct; struct ssh_session_struct { @@ -860,6 +868,10 @@ int match_hostname(const char *host, const char *pattern, unsigned int len); void message_handle(SSH_SESSION *session, uint32_t type); int ssh_execute_message_callbacks(SSH_SESSION *session); +/* scp.c */ + +ssh_scp_request ssh_scp_request_new(void); + /* log.c */ #ifndef __FUNCTION__ |