llpacketack.h

Go to the documentation of this file.
00001 
00032 #ifndef LL_LLPACKETACK_H
00033 #define LL_LLPACKETACK_H
00034 
00035 #include "llhost.h"
00036 
00037 class LLReliablePacketParams
00038 {
00039 public:
00040         LLHost mHost;
00041         S32 mRetries;
00042         BOOL mPingBasedRetry;
00043         F32 mTimeout;
00044         void (*mCallback)(void **,S32);
00045         void** mCallbackData;
00046         char* mMessageName;
00047 
00048 public:
00049         LLReliablePacketParams()
00050         {
00051                 clear();
00052         };
00053 
00054         ~LLReliablePacketParams() { };
00055 
00056         void clear()
00057         {
00058                 mHost.invalidate();
00059                 mRetries = 0;
00060                 mPingBasedRetry = TRUE;
00061                 mTimeout = 0.f;
00062                 mCallback = NULL;
00063                 mCallbackData = NULL;
00064                 mMessageName = NULL;
00065         };
00066 
00067         void set(
00068                 const LLHost& host,
00069                 S32 retries,
00070                 BOOL ping_based_retry,
00071                 F32 timeout, 
00072                 void (*callback)(void**,S32),
00073                 void** callback_data, char* name)
00074         {
00075                 mHost = host;
00076                 mRetries = retries;
00077                 mPingBasedRetry = ping_based_retry;
00078                 mTimeout = timeout;
00079                 mCallback = callback;
00080                 mCallbackData = callback_data;
00081                 mMessageName = name;
00082         };
00083 };
00084 
00085 class LLReliablePacket
00086 {
00087 public:
00088         LLReliablePacket(
00089                 S32 socket,
00090                 U8* buf_ptr,
00091                 S32 buf_len,
00092                 LLReliablePacketParams* params);
00093         ~LLReliablePacket()
00094         { 
00095                 mCallback = NULL;
00096                 delete [] mBuffer;
00097                 mBuffer = NULL;
00098         };
00099 
00100         friend class LLCircuitData;
00101 protected:
00102         S32 mSocket;
00103         LLHost mHost;
00104         S32 mRetries;
00105         BOOL mPingBasedRetry;
00106         F32 mTimeout;
00107         void (*mCallback)(void**,S32);
00108         void** mCallbackData;
00109         char* mMessageName;
00110 
00111         U8* mBuffer;
00112         S32 mBufferLength;
00113 
00114         TPACKETID mPacketID;
00115 
00116         F64 mExpirationTime;
00117 };
00118 
00119 #endif
00120 

Generated on Thu Jul 1 06:08:55 2010 for Second Life Viewer by  doxygen 1.4.7