diff options
Diffstat (limited to 'linden/indra/llmessage/llxfer.h')
-rw-r--r-- | linden/indra/llmessage/llxfer.h | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/linden/indra/llmessage/llxfer.h b/linden/indra/llmessage/llxfer.h new file mode 100644 index 0000000..b070c87 --- /dev/null +++ b/linden/indra/llmessage/llxfer.h | |||
@@ -0,0 +1,117 @@ | |||
1 | /** | ||
2 | * @file llxfer.h | ||
3 | * @brief definition of LLXfer class for a single xfer | ||
4 | * | ||
5 | * Copyright (c) 2001-2007, Linden Research, Inc. | ||
6 | * | ||
7 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
8 | * to you under the terms of the GNU General Public License, version 2.0 | ||
9 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
10 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
11 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
12 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
13 | * | ||
14 | * There are special exceptions to the terms and conditions of the GPL as | ||
15 | * it is applied to this Source Code. View the full text of the exception | ||
16 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
17 | * online at http://secondlife.com/developers/opensource/flossexception | ||
18 | * | ||
19 | * By copying, modifying or distributing this software, you acknowledge | ||
20 | * that you have read and understood your obligations described above, | ||
21 | * and agree to abide by those obligations. | ||
22 | * | ||
23 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
24 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
25 | * COMPLETENESS OR PERFORMANCE. | ||
26 | */ | ||
27 | |||
28 | #ifndef LL_LLXFER_H | ||
29 | #define LL_LLXFER_H | ||
30 | |||
31 | #include "message.h" | ||
32 | #include "lltimer.h" | ||
33 | |||
34 | const S32 LL_XFER_LARGE_PAYLOAD = 7680; | ||
35 | |||
36 | typedef enum ELLXferStatus { | ||
37 | e_LL_XFER_UNINITIALIZED, | ||
38 | e_LL_XFER_REGISTERED, // a buffer which has been registered as available for a request | ||
39 | e_LL_XFER_PENDING, // a transfer which has been requested but is waiting for a free slot | ||
40 | e_LL_XFER_IN_PROGRESS, | ||
41 | e_LL_XFER_COMPLETE, | ||
42 | e_LL_XFER_ABORTED, | ||
43 | e_LL_XFER_NONE | ||
44 | } ELLXferStatus; | ||
45 | |||
46 | class LLXfer | ||
47 | { | ||
48 | private: | ||
49 | protected: | ||
50 | S32 mChunkSize; | ||
51 | |||
52 | public: | ||
53 | LLXfer *mNext; | ||
54 | U64 mID; | ||
55 | S32 mPacketNum; | ||
56 | |||
57 | LLHost mRemoteHost; | ||
58 | S32 mXferSize; | ||
59 | |||
60 | char *mBuffer; | ||
61 | U32 mBufferLength; | ||
62 | U32 mBufferStartOffset; | ||
63 | BOOL mBufferContainsEOF; | ||
64 | |||
65 | ELLXferStatus mStatus; | ||
66 | |||
67 | BOOL mWaitingForACK; | ||
68 | |||
69 | void (*mCallback)(void **,S32); | ||
70 | void **mCallbackDataHandle; | ||
71 | S32 mCallbackResult; | ||
72 | |||
73 | LLTimer ACKTimer; | ||
74 | S32 mRetries; | ||
75 | |||
76 | static const U32 XFER_FILE; | ||
77 | static const U32 XFER_VFILE; | ||
78 | static const U32 XFER_MEM; | ||
79 | |||
80 | private: | ||
81 | protected: | ||
82 | public: | ||
83 | LLXfer (S32 chunk_size); | ||
84 | virtual ~LLXfer(); | ||
85 | |||
86 | void init(S32 chunk_size); | ||
87 | virtual void free(); | ||
88 | |||
89 | virtual S32 startSend (U64 xfer_id, const LLHost &remote_host); | ||
90 | virtual void sendPacket(S32 packet_num); | ||
91 | virtual void sendNextPacket(); | ||
92 | virtual void resendLastPacket(); | ||
93 | virtual S32 processEOF(); | ||
94 | virtual S32 startDownload(); | ||
95 | virtual S32 receiveData (char *datap, S32 data_size); | ||
96 | virtual void abort(S32); | ||
97 | |||
98 | virtual S32 suck(S32 start_position); | ||
99 | virtual S32 flush(); | ||
100 | |||
101 | virtual S32 encodePacketNum(S32 packet_num, BOOL is_eof); | ||
102 | virtual void setXferSize (S32 data_size); | ||
103 | virtual S32 getMaxBufferSize(); | ||
104 | |||
105 | virtual const char *getName(); | ||
106 | |||
107 | virtual U32 getXferTypeTag(); | ||
108 | |||
109 | friend std::ostream& operator<< (std::ostream& os, LLXfer &hh); | ||
110 | |||
111 | }; | ||
112 | |||
113 | #endif | ||
114 | |||
115 | |||
116 | |||
117 | |||