2d69ce74b382f45cc83cc1aa39b7799212dcc3bd
[oftp] / src / ftp.h
1 #ifndef FTP_H_
2 #define FTP_H_
3
4 enum {FTP_DIR, FTP_FILE};       /* ftp_dirent type */
5
6 struct ftp_dirent {
7         char *name;
8         int type;
9 };
10
11 struct ftp {
12         int ctl, data;  /* sockets */
13
14         char crecv[256];
15         int num_crecv;
16         char drecv[256];
17         int num_drecv;
18
19         char *cwd;
20         struct ftp_dirent *dent;
21         int num_dent;
22 };
23
24 struct ftp *ftp_alloc(void);
25 void ftp_free(struct ftp *ftp);
26
27 int ftp_connect(struct ftp *ftp, const char *host, int port);
28 void ftp_close(struct ftp *ftp);
29
30 int ftp_sockets(struct ftp *ftp, int *sockv, int maxsize);
31 int ftp_pending(struct ftp *ftp);
32
33 int ftp_handle(struct ftp *ftp, int s);
34
35 int ftp_update(struct ftp *ftp);
36 int ftp_chdir(struct ftp *ftp, const char *dirname);
37
38
39 #endif  /* FTP_H_ */