]> git.donarmstrong.com Git - bamtools.git/blobdiff - src/api/internal/io/BamHttp_p.h
Stablized HTTP access on all platforms. (issue #54, issue #11)
[bamtools.git] / src / api / internal / io / BamHttp_p.h
index e48693e2acd95ad4abbedff32b000e2c47cbb5a9..cbbc95c602ccaf174ba119850abbcc74816392f2 100644 (file)
@@ -2,7 +2,7 @@
 // BamHttp_p.h (c) 2011 Derek Barnett
 // Marth Lab, Department of Biology, Boston College
 // ---------------------------------------------------------------------------
-// Last modified: 7 November 2011 (DB)
+// Last modified: 10 November 2011 (DB)
 // ---------------------------------------------------------------------------
 // Provides reading/writing of BAM files on HTTP server
 // ***************************************************************************
@@ -40,22 +40,25 @@ class BamHttp : public IBamIODevice {
     // IBamIODevice implementation
     public:
         void Close(void);
-        bool IsOpen(void) const ;
+        bool IsOpen(void) const;
         bool IsRandomAccess(void) const;
         bool Open(const IBamIODevice::OpenMode mode);
         int64_t Read(char* data, const unsigned int numBytes);
-        bool Seek(const int64_t& position);
+        bool Seek(const int64_t& position, const int origin = SEEK_SET);
         int64_t Tell(void) const;
         int64_t Write(const char* data, const unsigned int numBytes);
 
     // internal methods
     private:
+        void ClearResponse(void);
         bool ConnectSocket(void);
+        void DisconnectSocket(void);
         bool EnsureSocketConnection(void);
         void ParseUrl(const std::string& url);
         int64_t ReadFromSocket(char* data, const unsigned int numBytes);
         bool ReceiveResponse(void);
-        bool SendRequest(const size_t numBytes = 0);
+        bool SendGetRequest(const size_t numBytes = 0x10000);
+        bool SendHeadRequest(void);
         int64_t WriteToSocket(const char* data, const unsigned int numBytes);
 
     // data members
@@ -78,7 +81,8 @@ class BamHttp : public IBamIODevice {
 
         // file position
         int64_t m_filePosition;
-        int64_t m_endRangeFilePosition;
+        int64_t m_fileEndPosition;
+        int64_t m_rangeEndPosition;
 };
 
 } // namespace Internal