HTTPReader.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #ifndef NULLSOFT_HTTPREADER_H
  2. #define NULLSOFT_HTTPREADER_H
  3. #include "api/service/svcs/svc_fileread.h"
  4. class HttpReader;
  5. class HTTPReader : public svc_fileReader
  6. {
  7. public:
  8. HTTPReader() {}
  9. virtual ~HTTPReader() { close(); }
  10. int isMine( const wchar_t *filename, int mode = SvcFileReader::READ );
  11. int open( const wchar_t *filename, int mode = SvcFileReader::READ );
  12. size_t read( int8_t *buffer, size_t length );
  13. size_t write( const int8_t *buffer, size_t length ) { return 0; }
  14. uint64_t bytesAvailable( uint64_t requested );
  15. void close();
  16. void abort();
  17. uint64_t getLength();
  18. uint64_t getPos();
  19. int canSeek();
  20. int seek( uint64_t position );
  21. int hasHeaders();
  22. const char *getHeader( const char *header );
  23. void setMetaDataCallback( api_readercallback *cb );
  24. int canPrefetch() { return 0; } // no info fetch on HTTP files
  25. /*int remove(const char *filename) { return 0; }
  26. int move(const char *filename, const char *destfilename) { return 0; }*/
  27. protected:
  28. RECVS_DISPATCH;
  29. private:
  30. HttpReader *reader = NULL;
  31. int hasConnected = 0;
  32. char *m_filename = 0;
  33. };
  34. #endif