diff options
author | Jacek Antonelli | 2008-08-15 23:45:02 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:02 -0500 |
commit | d644fc64407dcd14ffcee6a0e9fbe28ee3a4e9bd (patch) | |
tree | 7ed0c2c27d717801238a2e6b5749cd5bf88c3059 /linden/indra/llmessage/llpacketack.h | |
parent | Second Life viewer sources 1.17.3.0 (diff) | |
download | meta-impy-d644fc64407dcd14ffcee6a0e9fbe28ee3a4e9bd.zip meta-impy-d644fc64407dcd14ffcee6a0e9fbe28ee3a4e9bd.tar.gz meta-impy-d644fc64407dcd14ffcee6a0e9fbe28ee3a4e9bd.tar.bz2 meta-impy-d644fc64407dcd14ffcee6a0e9fbe28ee3a4e9bd.tar.xz |
Second Life viewer sources 1.18.0.6
Diffstat (limited to 'linden/indra/llmessage/llpacketack.h')
-rw-r--r-- | linden/indra/llmessage/llpacketack.h | 122 |
1 files changed, 32 insertions, 90 deletions
diff --git a/linden/indra/llmessage/llpacketack.h b/linden/indra/llmessage/llpacketack.h index c86fb0f..33fb5a0 100644 --- a/linden/indra/llmessage/llpacketack.h +++ b/linden/indra/llmessage/llpacketack.h | |||
@@ -29,37 +29,18 @@ | |||
29 | #ifndef LL_LLPACKETACK_H | 29 | #ifndef LL_LLPACKETACK_H |
30 | #define LL_LLPACKETACK_H | 30 | #define LL_LLPACKETACK_H |
31 | 31 | ||
32 | #include <cstring> | ||
33 | #include <stdio.h> | ||
34 | |||
35 | #include "llerror.h" | ||
36 | #include "lltimer.h" | ||
37 | #include "llhost.h" | 32 | #include "llhost.h" |
38 | 33 | ||
39 | //class LLPacketAck | ||
40 | //{ | ||
41 | //public: | ||
42 | // LLHost mHost; | ||
43 | // TPACKETID mPacketID; | ||
44 | //public: | ||
45 | // LLPacketAck(const LLHost &host, TPACKETID packet_id) | ||
46 | // { | ||
47 | // mHost = host; | ||
48 | // mPacketID = packet_id; | ||
49 | // }; | ||
50 | // ~LLPacketAck(){}; | ||
51 | //}; | ||
52 | |||
53 | class LLReliablePacketParams | 34 | class LLReliablePacketParams |
54 | { | 35 | { |
55 | public: | 36 | public: |
56 | LLHost mHost; | 37 | LLHost mHost; |
57 | S32 mRetries; | 38 | S32 mRetries; |
58 | BOOL mPingBasedRetry; | 39 | BOOL mPingBasedRetry; |
59 | F32 mTimeout; | 40 | F32 mTimeout; |
60 | void (*mCallback)(void **,S32); | 41 | void (*mCallback)(void **,S32); |
61 | void **mCallbackData; | 42 | void** mCallbackData; |
62 | char *mMessageName; | 43 | char* mMessageName; |
63 | 44 | ||
64 | public: | 45 | public: |
65 | LLReliablePacketParams() | 46 | LLReliablePacketParams() |
@@ -80,9 +61,13 @@ public: | |||
80 | mMessageName = NULL; | 61 | mMessageName = NULL; |
81 | }; | 62 | }; |
82 | 63 | ||
83 | void set ( const LLHost &host, S32 retries, BOOL ping_based_retry, | 64 | void set( |
84 | F32 timeout, | 65 | const LLHost& host, |
85 | void (*callback)(void **,S32), void **callback_data, char *name ) | 66 | S32 retries, |
67 | BOOL ping_based_retry, | ||
68 | F32 timeout, | ||
69 | void (*callback)(void**,S32), | ||
70 | void** callback_data, char* name) | ||
86 | { | 71 | { |
87 | mHost = host; | 72 | mHost = host; |
88 | mRetries = retries; | 73 | mRetries = retries; |
@@ -97,53 +82,11 @@ public: | |||
97 | class LLReliablePacket | 82 | class LLReliablePacket |
98 | { | 83 | { |
99 | public: | 84 | public: |
100 | LLReliablePacket(S32 socket, U8 *buf_ptr, S32 buf_len, LLReliablePacketParams *params) : | 85 | LLReliablePacket( |
101 | mBuffer(NULL), | 86 | S32 socket, |
102 | mBufferLength(0) | 87 | U8* buf_ptr, |
103 | { | 88 | S32 buf_len, |
104 | if (params) | 89 | LLReliablePacketParams* params); |
105 | { | ||
106 | mHost = params->mHost; | ||
107 | mRetries = params->mRetries; | ||
108 | mPingBasedRetry = params->mPingBasedRetry; | ||
109 | mTimeout = params->mTimeout; | ||
110 | mCallback = params->mCallback; | ||
111 | mCallbackData = params->mCallbackData; | ||
112 | mMessageName = params->mMessageName; | ||
113 | } | ||
114 | else | ||
115 | { | ||
116 | mRetries = 0; | ||
117 | mPingBasedRetry = TRUE; | ||
118 | mTimeout = 0.f; | ||
119 | mCallback = NULL; | ||
120 | mCallbackData = NULL; | ||
121 | mMessageName = NULL; | ||
122 | } | ||
123 | |||
124 | mExpirationTime = (F64)((S64)totalTime())/1000000.0 + mTimeout; | ||
125 | mPacketID = buf_ptr[1] + ((buf_ptr[0] & 0x0f ) * 256); | ||
126 | if (sizeof(TPACKETID) == 4) | ||
127 | { | ||
128 | mPacketID *= 256; | ||
129 | mPacketID += buf_ptr[2]; | ||
130 | mPacketID *= 256; | ||
131 | mPacketID += buf_ptr[3]; | ||
132 | } | ||
133 | |||
134 | mSocket = socket; | ||
135 | if (mRetries) | ||
136 | { | ||
137 | mBuffer = new U8[buf_len]; | ||
138 | if (mBuffer != NULL) | ||
139 | { | ||
140 | memcpy(mBuffer,buf_ptr,buf_len); /*Flawfinder: ignore*/ | ||
141 | mBufferLength = buf_len; | ||
142 | } | ||
143 | |||
144 | } | ||
145 | }; | ||
146 | |||
147 | ~LLReliablePacket() | 90 | ~LLReliablePacket() |
148 | { | 91 | { |
149 | mCallback = NULL; | 92 | mCallback = NULL; |
@@ -153,22 +96,21 @@ public: | |||
153 | 96 | ||
154 | friend class LLCircuitData; | 97 | friend class LLCircuitData; |
155 | protected: | 98 | protected: |
156 | S32 mSocket; | 99 | S32 mSocket; |
157 | LLHost mHost; | 100 | LLHost mHost; |
158 | S32 mRetries; | 101 | S32 mRetries; |
159 | BOOL mPingBasedRetry; | 102 | BOOL mPingBasedRetry; |
160 | F32 mTimeout; | 103 | F32 mTimeout; |
161 | void (*mCallback)(void **,S32); | 104 | void (*mCallback)(void**,S32); |
162 | void **mCallbackData; | 105 | void** mCallbackData; |
163 | char *mMessageName; | 106 | char* mMessageName; |
164 | 107 | ||
165 | U8 *mBuffer; | 108 | U8* mBuffer; |
166 | S32 mBufferLength; | 109 | S32 mBufferLength; |
167 | 110 | ||
168 | TPACKETID mPacketID; | 111 | TPACKETID mPacketID; |
169 | 112 | ||
170 | F64 mExpirationTime; | 113 | F64 mExpirationTime; |
171 | |||
172 | }; | 114 | }; |
173 | 115 | ||
174 | #endif | 116 | #endif |