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
24 #define knet_tell(fp) ((fp)->offset)
25 #define knet_fileno(fp) ((fp)->fd)
31 knetFile *knet_open(const char *fn, const char *mode);
34 This only works with local files.
36 knetFile *knet_dopen(int fd, const char *mode);
39 If ->is_ready==0, this routine updates ->fd; otherwise, it simply
42 off_t knet_read(knetFile *fp, void *buf, off_t len);
45 This routine only sets ->offset and ->is_ready=0. It does not
46 communicate with the FTP server.
48 int knet_seek(knetFile *fp, off_t off, int whence);
49 int knet_close(knetFile *fp);