llxfer.h

Go to the documentation of this file.
00001 
00032 #ifndef LL_LLXFER_H
00033 #define LL_LLXFER_H
00034 
00035 #include "message.h"
00036 #include "lltimer.h"
00037 
00038 const S32 LL_XFER_LARGE_PAYLOAD = 7680;
00039 
00040 typedef enum ELLXferStatus {
00041         e_LL_XFER_UNINITIALIZED,
00042         e_LL_XFER_REGISTERED,         // a buffer which has been registered as available for a request
00043         e_LL_XFER_PENDING,            // a transfer which has been requested but is waiting for a free slot
00044         e_LL_XFER_IN_PROGRESS,
00045         e_LL_XFER_COMPLETE,
00046         e_LL_XFER_ABORTED,
00047         e_LL_XFER_NONE
00048 } ELLXferStatus;
00049 
00050 class LLXfer
00051 {
00052  private:
00053  protected:
00054         S32 mChunkSize;
00055   
00056  public:
00057         LLXfer *mNext;
00058         U64 mID;
00059         S32 mPacketNum;
00060 
00061         LLHost mRemoteHost;
00062         S32 mXferSize;
00063 
00064         char *mBuffer;
00065         U32 mBufferLength;
00066         U32 mBufferStartOffset;
00067         BOOL mBufferContainsEOF;
00068 
00069         ELLXferStatus mStatus;
00070 
00071         BOOL mWaitingForACK;
00072 
00073         void (*mCallback)(void **,S32,LLExtStat);       
00074         void **mCallbackDataHandle;
00075         S32 mCallbackResult;
00076 
00077         LLTimer ACKTimer;
00078         S32 mRetries;
00079 
00080         static const U32 XFER_FILE;
00081         static const U32 XFER_VFILE;
00082         static const U32 XFER_MEM;
00083 
00084  private:
00085  protected:
00086  public:
00087         LLXfer (S32 chunk_size);
00088         virtual ~LLXfer();
00089 
00090         void init(S32 chunk_size);
00091         virtual void free();
00092 
00093         virtual S32 startSend (U64 xfer_id, const LLHost &remote_host);
00094         virtual void sendPacket(S32 packet_num);
00095         virtual void sendNextPacket();
00096         virtual void resendLastPacket();
00097         virtual S32 processEOF();
00098         virtual S32 startDownload();
00099         virtual S32 receiveData (char *datap, S32 data_size);
00100         virtual void abort(S32);
00101 
00102         virtual S32 suck(S32 start_position);
00103         virtual S32 flush();
00104         
00105         virtual S32 encodePacketNum(S32 packet_num, BOOL is_eof);       
00106         virtual void setXferSize (S32 data_size);
00107         virtual S32  getMaxBufferSize();
00108 
00109         virtual const char *getName();
00110 
00111         virtual U32 getXferTypeTag();
00112 
00113         friend std::ostream& operator<< (std::ostream& os, LLXfer &hh);
00114 
00115 };
00116 
00117 #endif
00118 
00119 
00120 
00121 
00122 

Generated on Thu Jul 1 06:09:47 2010 for Second Life Viewer by  doxygen 1.4.7