retrieve
[oftp] / src / ftp.h
index d588e56..a09f0f1 100644 (file)
--- a/src/ftp.h
+++ b/src/ftp.h
@@ -1,9 +1,12 @@
 #ifndef FTP_H_
 #define FTP_H_
 
+#include <stdio.h>
+
 enum {FTP_DIR, FTP_FILE};      /* ftp_dirent type */
 
 enum {
+       FTP_TYPE,
        FTP_PWD,
        FTP_CHDIR,
        FTP_CDUP,
@@ -12,7 +15,8 @@ enum {
        FTP_DEL,
        FTP_LIST,
        FTP_RETR,
-       FTP_STORE
+       FTP_STORE,
+       FTP_XFER
 };
 
 enum {
@@ -28,6 +32,7 @@ enum {
 struct ftp_op {
        int op;
        char *arg;
+       void *data;
 
        struct ftp_op *next;
 };
@@ -63,6 +68,16 @@ struct ftp {
        int modified;
 };
 
+struct ftp_transfer {
+       int op;
+       char *rname;
+       FILE *fp;               /* option: file */
+       char *mem;              /* option: darray */
+       long total, count;
+
+       void (*done)(struct ftp*, struct ftp_transfer*);
+};
+
 struct ftp *ftp_alloc(void);
 void ftp_free(struct ftp *ftp);
 
@@ -76,9 +91,11 @@ int ftp_sockets(struct ftp *ftp, int *sockv, int maxsize);
 int ftp_handle(struct ftp *ftp, int s);
 
 int ftp_queue(struct ftp *ftp, int op, const char *arg);
+int ftp_queue_transfer(struct ftp *ftp, struct ftp_transfer *xfer);
 int ftp_waitresp(struct ftp *ftp, long timeout);
 
 int ftp_update(struct ftp *ftp);
+int ftp_type(struct ftp *ftp, const char *type);
 int ftp_pwd(struct ftp *ftp);
 int ftp_chdir(struct ftp *ftp, const char *dirname);
 int ftp_mkdir(struct ftp *ftp, const char *dirname);
@@ -87,6 +104,7 @@ int ftp_delete(struct ftp *ftp, const char *fname);
 int ftp_list(struct ftp *ftp);
 int ftp_retrieve(struct ftp *ftp, const char *fname);
 int ftp_store(struct ftp *ftp, const char *fname);
+int ftp_transfer(struct ftp *ftp, struct ftp_transfer *xfer);
 
 const char *ftp_curdir(struct ftp *ftp);
 int ftp_num_dirent(struct ftp *ftp);