]> git.donarmstrong.com Git - samtools.git/blobdiff - knetfile.h
* samtools-0.1.4-21 (r368)
[samtools.git] / knetfile.h
index cadc447726ecbec250f9d7465e36f2ea8ff4b42f..bf45f3df809b8f3ebd54b17c711dd188ab3dbb36 100644 (file)
@@ -16,19 +16,36 @@ typedef struct knetFile_s {
        char *host;
 
        // the following are for FTP only
-       int ctrl_fd, pasv_ip[4], pasv_port, max_response, no_reconnect;
+       int ctrl_fd, pasv_ip[4], pasv_port, max_response, no_reconnect, is_ready;
        char *response, *retr;
+       int64_t seek_offset; // for lazy seek
 } knetFile;
 
 #define knet_tell(fp) ((fp)->offset)
+#define knet_fileno(fp) ((fp)->fd)
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
        knetFile *knet_open(const char *fn, const char *mode);
+
+       /* 
+          This only works with local files.
+        */
+       knetFile *knet_dopen(int fd, const char *mode);
+
+       /*
+         If ->is_ready==0, this routine updates ->fd; otherwise, it simply
+         reads from ->fd.
+        */
        off_t knet_read(knetFile *fp, void *buf, off_t len);
-       off_t knet_seek(knetFile *fp, off_t off, int whence);
+
+       /*
+         This routine only sets ->offset and ->is_ready=0. It does not
+         communicate with the FTP server.
+        */
+       int knet_seek(knetFile *fp, off_t off, int whence);
        int knet_close(knetFile *fp);
 
 #ifdef __cplusplus