aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llmessage/llpacketack.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/llmessage/llpacketack.cpp84
1 files changed, 84 insertions, 0 deletions
diff --git a/linden/indra/llmessage/llpacketack.cpp b/linden/indra/llmessage/llpacketack.cpp
new file mode 100644
index 0000000..27d9916
--- /dev/null
+++ b/linden/indra/llmessage/llpacketack.cpp
@@ -0,0 +1,84 @@
1/**
2 * @file llpacketack.cpp
3 * @author Phoenix
4 * @date 2007-05-09
5 * @brief Implementation of the LLReliablePacket.
6 *
7 * Copyright (c) 2007-2007, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlife.com/developers/opensource/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlife.com/developers/opensource/flossexception
21 *
22 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above,
24 * and agree to abide by those obligations.
25 *
26 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
27 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
28 * COMPLETENESS OR PERFORMANCE.
29 */
30
31#include "linden_common.h"
32#include "llpacketack.h"
33
34#if !LL_WINDOWS
35#include <netinet/in.h>
36#else
37#include "winsock2.h"
38#endif
39
40#include "message.h"
41
42LLReliablePacket::LLReliablePacket(
43 S32 socket,
44 U8* buf_ptr,
45 S32 buf_len,
46 LLReliablePacketParams* params) :
47 mBuffer(NULL),
48 mBufferLength(0)
49{
50 if (params)
51 {
52 mHost = params->mHost;
53 mRetries = params->mRetries;
54 mPingBasedRetry = params->mPingBasedRetry;
55 mTimeout = params->mTimeout;
56 mCallback = params->mCallback;
57 mCallbackData = params->mCallbackData;
58 mMessageName = params->mMessageName;
59 }
60 else
61 {
62 mRetries = 0;
63 mPingBasedRetry = TRUE;
64 mTimeout = 0.f;
65 mCallback = NULL;
66 mCallbackData = NULL;
67 mMessageName = NULL;
68 }
69
70 mExpirationTime = (F64)((S64)totalTime())/1000000.0 + mTimeout;
71 mPacketID = ntohl(*((U32*)(&buf_ptr[PHL_PACKET_ID])));
72
73 mSocket = socket;
74 if (mRetries)
75 {
76 mBuffer = new U8[buf_len];
77 if (mBuffer != NULL)
78 {
79 memcpy(mBuffer,buf_ptr,buf_len); /*Flawfinder: ignore*/
80 mBufferLength = buf_len;
81 }
82
83 }
84}