]> git.donarmstrong.com Git - samtools.git/blob - knetfile.h
* samtools-0.1.4-16 (r360)
[samtools.git] / knetfile.h
1 #ifndef KNETFILE_H
2 #define KNETFILE_H
3
4 #include <stdint.h>
5 #include <fcntl.h>
6
7 // FIXME: currently I/O is unbuffered
8
9 #define KNF_TYPE_LOCAL 1
10 #define KNF_TYPE_FTP   2
11 #define KNF_TYPE_HTTP  3
12
13 typedef struct knetFile_s {
14         int type, fd;
15         int64_t offset;
16         char *host;
17
18         // the following are for FTP only
19         int ctrl_fd, pasv_ip[4], pasv_port, max_response, no_reconnect;
20         char *response, *retr;
21 } knetFile;
22
23 #define knet_tell(fp) ((fp)->offset)
24 #define knet_fileno(fp) ((fp)->fd)
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30         knetFile *knet_open(const char *fn, const char *mode);
31         knetFile *knet_dopen(int fd, const char *mode);
32         off_t knet_read(knetFile *fp, void *buf, off_t len);
33         int knet_seek(knetFile *fp, off_t off, int whence);
34         int knet_close(knetFile *fp);
35
36 #ifdef __cplusplus
37 }
38 #endif
39
40 #endif