aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2009-08-23 22:04:51 +0200
committerAris Adamantiadis <aris@0xbadc0de.be>2009-08-23 22:04:51 +0200
commit385b640d1dabddb06e389e633c622fb1c7cc664e (patch)
tree4470d6ba5a4bb6333500a1c91d0cf98a7cf6e87d /include
parentd4bc6fa954f11b1da0c8881c2826ac4a60f8c41e (diff)
downloadlibssh-385b640d1dabddb06e389e633c622fb1c7cc664e.tar.gz
libssh-385b640d1dabddb06e389e633c622fb1c7cc664e.tar.xz
libssh-385b640d1dabddb06e389e633c622fb1c7cc664e.zip
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 !!
Diffstat (limited to 'include')
-rw-r--r--include/libssh/libssh.h9
-rw-r--r--include/libssh/priv.h17
2 files changed, 10 insertions, 16 deletions
diff --git a/include/libssh/libssh.h b/include/libssh/libssh.h
index 466fb5f0..9707ba88 100644
--- a/include/libssh/libssh.h
+++ b/include/libssh/libssh.h
@@ -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
}
diff --git a/include/libssh/priv.h b/include/libssh/priv.h
index 1cb3f64c..83a004c4 100644
--- a/include/libssh/priv.h
+++ b/include/libssh/priv.h
@@ -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 */