Implementation of ssh_scp_pull_request

Still needed: code in ssh_scp_init,
implementation of ssh_scp_read
ssh_scp_request_get_filename,
ssh_scp_request_get_size,
ssh_scp_request_get_mode,
ssh_scp_deny_request
ssh_scp_accept_request
!!
This commit is contained in:
Aris Adamantiadis
2009-08-23 22:04:51 +02:00
parent d4bc6fa954
commit 385b640d1d
3 changed files with 113 additions and 22 deletions

View File

@@ -120,7 +120,6 @@ 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
@@ -471,10 +470,11 @@ enum {
enum ssh_scp_request_types {
/** A new directory is going to be pulled */
SSH_SCP_REQUEST_NEWDIR,
SSH_SCP_REQUEST_NEWDIR=1,
/** 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);
@@ -483,8 +483,9 @@ LIBSSH_API int ssh_scp_push_directory(ssh_scp scp, const char *dirname, const ch
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);
LIBSSH_API int ssh_scp_pull_request(ssh_scp scp);
LIBSSH_API int ssh_scp_deny_request(ssh_scp scp, const char *reason);
LIBSSH_API int ssh_scp_accept_request(ssh_scp scp);
#ifdef __cplusplus
}

View File

@@ -356,6 +356,7 @@ enum ssh_scp_states {
SSH_SCP_WRITE_INITED, //Gave our intention to write
SSH_SCP_WRITE_WRITING,//File was opened and currently writing
SSH_SCP_READ_INITED, //Gave our intention to read
SSH_SCP_READ_REQUESTED, //We got a read request
SSH_SCP_READ_READING, //File is opened and reading
SSH_SCP_ERROR //Something bad happened
};
@@ -368,16 +369,9 @@ struct ssh_scp_struct {
enum ssh_scp_states state;
size_t filelen;
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;
enum ssh_scp_request_types request_type;
char *request_name;
char *request_mode;
};
struct ssh_message_struct;
@@ -869,8 +863,7 @@ 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);
int ssh_scp_read_string(ssh_scp scp, char *buffer, size_t len);
/* log.c */