7 // FIXME: currently I/O is unbuffered
9 #define KNF_TYPE_LOCAL 1
10 #define KNF_TYPE_FTP 2
11 #define KNF_TYPE_HTTP 3
13 typedef struct knetFile_s {
18 // the following are for FTP only
19 int ctrl_fd, pasv_ip[4], pasv_port, max_response, no_reconnect, is_ready;
20 char *response, *retr;
21 int64_t seek_offset; // for lazy seek
23 // the following are for HTTP only
24 char *path, *http_host;
27 #define knet_tell(fp) ((fp)->offset)
28 #define knet_fileno(fp) ((fp)->fd)
34 knetFile *knet_open(const char *fn, const char *mode);
37 This only works with local files.
39 knetFile *knet_dopen(int fd, const char *mode);
42 If ->is_ready==0, this routine updates ->fd; otherwise, it simply
45 off_t knet_read(knetFile *fp, void *buf, off_t len);
48 This routine only sets ->offset and ->is_ready=0. It does not
49 communicate with the FTP server.
51 int knet_seek(knetFile *fp, off_t off, int whence);
52 int knet_close(knetFile *fp);