libftc
src/ftc.h
Vá para a documentação deste arquivo.
00001 /*
00002 ** ftc.h
00003 */
00004 
00005 #ifndef  FTC_H_
00006 #define  FTC_H_
00007 
00008 #if defined(_WIN32) || defined(WIN32) || defined(_WINNT_VER)
00009 #define TEC_WINDOWS
00010 #include <winsock2.h>
00011 #endif
00012 
00013 #include <stdio.h>
00014 #include "ftc_exception.h"
00015 #include "ftc_decl.h"
00016 
00020 struct ftc
00021 {
00033 #if !defined(FTC_DOXYGEN)
00034     TEC_FTC_DECL
00035 #endif
00036     ftc(const char* id, const char id_size, bool writable, const char* host
00037         , unsigned short port, const char* accessKey, const char key_size);
00038 
00042 #if !defined(FTC_DOXYGEN)
00043     TEC_FTC_DECL
00044 #endif
00045     ~ftc();
00046 
00052 #if !defined(FTC_DOXYGEN)
00053     TEC_FTC_DECL
00054 #endif
00055     void open( bool readonly ) ;
00056 
00062 #if !defined(FTC_DOXYGEN)
00063     TEC_FTC_DECL
00064 #endif
00065     bool isOpen() ;
00066 
00070 #if !defined(FTC_DOXYGEN)
00071     TEC_FTC_DECL
00072 #endif
00073     void close() ;
00074 
00080 #if !defined(FTC_DOXYGEN)
00081     TEC_FTC_DECL
00082 #endif
00083     void setPosition( unsigned long long position ) ;
00084 
00091 #if !defined(FTC_DOXYGEN)
00092     TEC_FTC_DECL
00093 #endif
00094     void setSize( unsigned long long size );
00095 
00102 #if !defined(FTC_DOXYGEN)
00103     TEC_FTC_DECL
00104 #endif
00105     void setReadBufferSize( unsigned long long size );
00106 
00112 #if !defined(FTC_DOXYGEN)
00113     TEC_FTC_DECL
00114 #endif
00115     unsigned long long getPosition() ;
00116 
00122 #if !defined(FTC_DOXYGEN)
00123     TEC_FTC_DECL
00124 #endif
00125     unsigned long long getSize() const;
00126 
00132 #if !defined(FTC_DOXYGEN)
00133     TEC_FTC_DECL
00134 #endif
00135     unsigned long long getReadBufferSize() ;
00136 
00146 #if !defined(FTC_DOXYGEN)
00147     TEC_FTC_DECL
00148 #endif
00149     unsigned long long read(char* data, unsigned long long nbytes, unsigned long long position);
00150 
00160 #if !defined(FTC_DOXYGEN)
00161     TEC_FTC_DECL
00162 #endif
00163     unsigned long long write(const char* data, unsigned long long nbytes, unsigned long long position);
00164 
00176 #if !defined(FTC_DOXYGEN)
00177     TEC_FTC_DECL
00178 #endif
00179     unsigned long long transferTo(unsigned long long position, unsigned long long nbytes, FILE* fd, char* buffer);
00180 
00181 private:
00182   ftc(ftc const&);
00183   ftc& operator=(ftc const&);
00184 
00185   const char* hostname;
00186   unsigned short tcp_port;
00187   const char* identifier;
00188   const char identifier_size;
00189 #ifndef TEC_WINDOWS
00190   int sock;
00191 #else
00192   SOCKET sock;
00193 #endif
00194   bool writable;
00195   bool is_open;
00196   const char* access_key;
00197   const char access_key_size;
00198 };
00199 
00200 
00201 #endif