diff options
-rw-r--r-- | include/libssh/libssh.h | 7 | ||||
-rw-r--r-- | include/libssh/priv.h | 14 | ||||
-rw-r--r-- | libssh/scp.c | 9 |
3 files changed, 30 insertions, 0 deletions
diff --git a/include/libssh/libssh.h b/include/libssh/libssh.h index 5dca6c12..dcdb4a0e 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 @@ -467,6 +468,12 @@ 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); diff --git a/include/libssh/priv.h b/include/libssh/priv.h index 1ad6b41c..023f4a72 100644 --- a/include/libssh/priv.h +++ b/include/libssh/priv.h @@ -359,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; @@ -369,6 +370,15 @@ 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 ssh_session_struct { @@ -857,6 +867,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__ diff --git a/libssh/scp.c b/libssh/scp.c index 9035c440..e4cb3480 100644 --- a/libssh/scp.c +++ b/libssh/scp.c @@ -266,3 +266,12 @@ int ssh_scp_write(ssh_scp scp, const void *buffer, size_t len){ } return SSH_OK; } + +ssh_scp_request ssh_scp_request_new(void){ + ssh_scp_request r=malloc(sizeof(struct ssh_scp_request_struct)); + if(r==NULL) + return NULL; + ZERO_STRUCTP(r); + return r; +} + |