// \file
//
// This file is part of RakNet Copyright 2003 Jenkins Software LLC
//
// Usage of RakNet is subject to the appropriate license agreement.
#include "RakNetDefines.h"
#include "RakPeer.h"
#include "RakNetTypes.h"
#include "WSAStartupSingleton.h"
#ifdef _WIN32
#elif defined(_PS3) || defined(__PS3__) || defined(SN_TARGET_PS3)
#else
#define closesocket close
#include <unistd.h>
#endif
#if defined(new)
#pragma push_macro("new")
#undef new
#define RMO_NEW_UNDEF_ALLOCATING_QUEUE
#endif
#include <time.h>
#include <ctype.h> // toupper
#include <string.h>
#include "GetTime.h"
#include "MessageIdentifiers.h"
#include "DS_HuffmanEncodingTree.h"
#include "Rand.h"
#include "PluginInterface2.h"
#include "StringCompressor.h"
#include "StringTable.h"
#include "NetworkIDObject.h"
#include "RakNetTypes.h"
#include "SHA1.h"
#include "RakSleep.h"
#include "RouterInterface.h"
#include "RakAssert.h"
#include "RakNetVersion.h"
#include "NetworkIDManager.h"
#include "DataBlockEncryptor.h"
#include "gettimeofday.h"
#include "SignaledEvent.h"
#include "SuperFastHash.h"
RAK_THREAD_DECLARATION(UpdateNetworkLoop);
RAK_THREAD_DECLARATION(RecvFromLoop);
RAK_THREAD_DECLARATION(UDTConnect);
#define REMOTE_SYSTEM_LOOKUP_HASH_MULTIPLE 8
#if !defined ( __APPLE__ ) && !defined ( __APPLE_CC__ )
#include <stdlib.h> // malloc
#endif
#if defined(_XBOX) || defined(X360)
#elif defined(_WIN32)
//
#else
/*
#include <alloca.h> // Console 2
#include <stdlib.h>
extern bool _extern_Console2LoadModules(void);
extern int _extern_Console2GetConnectionStatus(void);
extern int _extern_Console2GetLobbyStatus(void);
//extern bool Console2StartupFluff(unsigned int *);
extern void Console2ShutdownFluff(void);
//extern unsigned int Console2ActivateConnection(unsigned int, void *);
//extern bool Console2BlockOnEstablished(void);
extern void Console2GetIPAndPort(unsigned int, char *, unsigned short *, unsigned int );
//extern void Console2DeactivateConnection(unsigned int, unsigned int);
*/
#endif
static const int NUM_MTU_SIZES=3;
#if defined(_XBOX) || defined(X360)
#elif __PC__
static const int mtuSizes[NUM_MTU_SIZES]={1200, 1200, 576};
#else
static const int mtuSizes[NUM_MTU_SIZES]={MAXIMUM_MTU_SIZE, 1200, 576};
#endif
#include "RakAlloca.h"
// Note to self - if I change this it might affect RECIPIENT_OFFLINE_MESSAGE_INTERVAL in Natpunchthrough.cpp
//static const int MAX_OPEN_CONNECTION_REQUESTS=8;
//static const int TIME_BETWEEN_OPEN_CONNECTION_REQUESTS=500;
#ifdef _MSC_VER
#pragma warning( push )
#endif
using namespace RakNet;
static RakNetRandom rnr;
struct RakPeerAndIndex
{
SOCKET s;
unsigned short remotePortRakNetWasStartedOn_PS3;
RakPeer *rakPeer;
};
// On a Little-endian machine the RSA key and message are mangled, but we're
// trying to be friendly to the little endians, so we do byte order
// mangling on Big-Endian machines. Note that this mangling is independent
// of the byte order used on the network (which also defaults to little-end).
#ifdef HOST_ENDIAN_IS_BIG
void __inline BSWAPCPY(unsigned char *dest, unsigned char *source, int bytesize)
{
#ifdef _DEBUG
RakAssert( (bytesize % 4 == 0)&&(bytesize)&& "Something is wrong with your exponent or modulus size.");
#endif
int i;
for (i=0; i<bytesize; i+=4)
{
dest[i] = source[i+3];
dest[i+1] = source[i+2];
dest[i+2] = source[i+1];
dest[i+3] = source[i];
}
}
void __inline BSWAPSELF(unsigned char *source, int bytesize)
{
#ifdef _DEBUG
RakAssert( (bytesize % 4 == 0)&&(bytesize)&& "Something is wrong with your exponent or modulus size.");
#endif
int i;
unsigned char a, b;
for (i=0; i<bytesize; i+=4)
{
a = source[i];
b = source[i+1];
source[i] = source[i+3];
source[i+1] = source[i+2];
source[i+2] = b;
source[i+3] = a;
}
}
#endif
static const unsigned int SYN_COOKIE_OLD_RANDOM_NUMBER_DURATION = 10000;
static const unsigned int MAX_OFFLINE_DATA_LENGTH=400; // I set this because I limit ID_CONNECTION_REQUEST to 512 bytes, and the password is appended to that packet.
// Used to distinguish between offline messages with data, and messages from the reliability layer
// Should be different than any message that could result from messages from the reliability layer
#pragma warning(disable:4309) // 'initializing' : truncation of constant value
// Make sure highest bit is 0, so isValid in DatagramHeaderFormat is false
static const char OFFLINE_MESSAGE_DATA_ID[16]={0x00,0xFF,0xFF,0x00,0xFE,0xFE,0xFE,0xFE,0xFD,0xFD,0xFD,0xFD,0x12,0x34,0x56,0x78};
//#define _DO_PRINTF
// UPDATE_THREAD_POLL_TIME is how often the update thread will poll to see
// if receive wasn't called within UPDATE_THREAD_UPDATE_TIME. If it wasn't called within that time,
// the updating thread will activate and take over network communication until Receive is called again.
//static const unsigned int UPDATE_THREAD_UPDATE_TIME=30;
//static const unsigned int UPDATE_THREAD_POLL_TIME=30;
//#define _TEST_AES
struct PacketFollowedByData
{
Packet p;
unsigned char data[1];
};
Packet *RakPeer::AllocPacket(unsigned dataSize, const char *file, unsigned int line)
{
// Crashes when dataSize is 4 bytes - not sure why
// unsigned char *data = (unsigned char *) rakMalloc_Ex(sizeof(PacketFollowedByData)+dataSize, file, line);
// Packet *p = &((PacketFollowedByData *)data)->p;
// p->data=((PacketFollowedByData *)data)->data;
// p->length=dataSize;
// p->bitSize=BYTES_TO_BITS(dataSize);
// p->deleteData=false;
// p->guid=UNASSIGNED_RAKNET_GUID;
// return p;
Packet *p;
packetAllocationPoolMutex.Lock();
p = packetAllocationPool.Allocate(file,line);
packetAllocationPoolMutex.Unlock();
p = new ((void*)p) Packet;
p->data=(unsigned char*) rakMalloc_Ex(dataSize,file,line);
p->length=dataSize;
p->bitSize=BYTES_TO_BITS(dataSize);
p->deleteData=true;
p->guid=UNASSIGNED_RAKNET_GUID;
return p;
}
Packet *RakPeer::AllocPacket(unsigned dataSize, unsigned char *data, const char *file, unsigned int line)
{
// Packet *p = (Packet *)rakMalloc_Ex(sizeof(Packet), file, line);
Packet *p;
packetAllocationPoolMutex.Lock();
p = packetAllocationPool.Allocate(file,line);
packetAllocationPoolMutex.Unlock();
p = new ((void*)p) Packet;
p->data=data;
p->length=dataSize;
p->bitSize=BYTES_TO_BITS(dataSize);
p->deleteData=true;
p->guid=UNASSIGNED_RAKNET_GUID;
return p;
}
// --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Constructor
// --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
RakPeer::RakPeer()
{
StringCompressor::AddReference();
RakNet::StringTable::AddReference();
WSAStartupSingleton::AddRef();
#if !defined(_XBOX) && !defined(_WIN32_WCE) && !defined(X360)
usingSecurity = false;
#endif
memset( frequencyTable, 0, sizeof( unsigned int ) * 256 );
rawBytesSent = rawBytesReceived = compressedBytesSent = compressedBytesReceived = 0;
outputTree = inputTree = 0;
defaultMTUSize = mtuSizes[NUM_MTU_SIZES-1];
trackFrequencyTable = false;
maximumIncomingConnections = 0;
maximumNumberOfPeers = 0;
//remoteSystemListSize=0;
remoteSystemList = 0;
remoteSystemLookup=0;
bytesSentPerSecond = bytesReceivedPerSecond = 0;
endThreads = true;
isMainLoopThreadActive = false;
isRecvFromLoopThreadActive = false;
// isRecvfromThreadActive=false;
#if defined(GET_TIME_SPIKE_LIMIT) && GET_TIME_SPIKE_LIMIT>0
occasionalPing = true;
#else
occasionalPing = false;
#end
没有合适的资源?快使用搜索试试~ 我知道了~
2014年给某家公司开发一套基于集群的后台日志分析系统.zip
共562个文件
h:271个
cpp:122个
o:113个
需积分: 0 0 下载量 121 浏览量
2024-01-17
11:50:15
上传
评论
收藏 10.87MB ZIP 举报
温馨提示
2014年给某家公司开发一套基于集群的后台日志分析系统,操作系统linux,开发语言c++。程序分为三部分,我保存的是属于自己开发的控制server,另外还有日志server和媒体处理server。另外还有一套基于php的xmlweb展示系统。数据库不在项目内,无法本地运行 软件开发设计:应用软件开发、系统软件开发、移动应用开发、网站开发C++、Java、python、web、C#等语言的项目开发与学习资料 硬件与设备:单片机、EDA、proteus、RTOS、包括计算机硬件、服务器、网络设备、存储设备、移动设备等 操作系统:LInux、树莓派、安卓开发、微机操作系统、网络操作系统、分布式操作系统等。此外,还有嵌入式操作系统、智能操作系统等。 网络与通信:数据传输、信号处理、网络协议、网络与通信硬件、网络安全网络与通信是一个非常广泛的领域,它涉及到计算机科学、电子工程、数学等多个学科的知识。 云计算与大数据:包括云计算平台、大数据分析、人工智能、机器学习等,云计算是一种基于互联网的计算方式,通过这种方式,共享的软硬件资源和信息可以按需提供给计算机和其他设备。
资源推荐
资源详情
资源评论
收起资源包目录
2014年给某家公司开发一套基于集群的后台日志分析系统.zip (562个子文件)
libraknet.so.0.0.0 1.5MB
libxml.so.0.0.0 98KB
libraknet.a 4.63MB
libsqlapiu.a 1.69MB
libsqlapi.a 1.62MB
libxml.a 212KB
cmake_install.cmake 1KB
CMakeDirectoryInformation.cmake 613B
setting.conf 82B
controls 1.27MB
controls-new 1.24MB
RakPeer.cpp 287KB
ReliabilityLayer.cpp 133KB
rdlmalloc.cpp 130KB
ReplicaManager3.cpp 81KB
ReplicaManager2.cpp 74KB
ReplicaManager.cpp 47KB
BigInt.cpp 47KB
Router2.cpp 43KB
SocketLayer.cpp 40KB
BitStream.cpp 32KB
FileListTransfer.cpp 32KB
BitStream_NoTemplate.cpp 30KB
RakString.cpp 29KB
TCPInterface.cpp 29KB
CCRakNetUDT.cpp 27KB
DS_Table.cpp 27KB
Gen_RPC8.cpp 25KB
LightweightDatabaseServer.cpp 24KB
NatPunchthroughClient.cpp 24KB
main.cpp 23KB
AutoRPC.cpp 23KB
TeamBalancer.cpp 23KB
rijndael.cpp 22KB
ConnectionGraph.cpp 21KB
FileList.cpp 21KB
raknet_serv.cpp 21KB
UDPProxyCoordinator.cpp 18KB
NatPunchthroughServer.cpp 18KB
ReadyEvent.cpp 17KB
UDPForwarder.cpp 15KB
EmailSender.cpp 14KB
PacketLogger.cpp 14KB
FullyConnectedMesh2.cpp 13KB
RakNetCommandParser.cpp 12KB
PacketizedTCP.cpp 12KB
MessageFilter.cpp 11KB
Router.cpp 11KB
ConsoleServer.cpp 10KB
UDPProxyClient.cpp 10KB
TableSerializer.cpp 10KB
RakNetTypes.cpp 9KB
DS_HuffmanEncodingTree.cpp 9KB
TelnetTransport.cpp 9KB
Rand.cpp 9KB
pure_log.cpp 9KB
VariableDeltaSerializer.cpp 9KB
StringCompressor.cpp 9KB
NatTypeDetectionServer.cpp 8KB
AsynchronousFileIO.cpp 8KB
RakMemoryOverride.cpp 7KB
LogCommandParser.cpp 7KB
NetworkIDObject.cpp 7KB
DirectoryDeltaTransfer.cpp 7KB
testxml3.cpp 7KB
HTTPConnection.cpp 7KB
SHA1.cpp 7KB
GridSectorizer.cpp 6KB
RakNetStatistics.cpp 6KB
DataBlockEncryptor.cpp 6KB
GetTime.cpp 6KB
ServerClientTest.cpp 6KB
ServerClientTest.cpp 6KB
NetworkIDManager.cpp 5KB
UDPProxyServer.cpp 5KB
ConnectionGraph2.cpp 5KB
RakNetTransport.cpp 5KB
CommandParserInterface.cpp 5KB
testxml2.cpp 5KB
RSACrypt.cpp 5KB
NatTypeDetectionClient.cpp 5KB
VariadicSQLParser.cpp 4KB
RPCMap.cpp 4KB
_FindFirst.cpp 4KB
RakNetworkFactory.cpp 4KB
RPC4Plugin.cpp 4KB
raknet_client.cpp 4KB
LightweightDatabaseClient.cpp 4KB
testxml.cpp 4KB
FunctionThread.cpp 4KB
FileOperations.cpp 3KB
DS_ByteQueue.cpp 3KB
SignaledEvent.cpp 3KB
DS_BytePool.cpp 3KB
RakNetTransport2.cpp 3KB
StringTable.cpp 3KB
mysqlop.cpp 3KB
NatTypeDetectionCommon.cpp 3KB
SuperFastHash.cpp 3KB
SystemAddressList.cpp 3KB
共 562 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
妄北y
- 粉丝: 2w+
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 技术资料分享二阶RC滤波试验很好的技术资料.zip
- 技术资料分享多核处理器构架的高速JPEG解码算法很好的技术资料.zip
- 技术资料分享第24章 性能和资源占用很好的技术资料.zip
- 技术资料分享第23章 LCD驱动API函数很好的技术资料.zip
- 技术资料分享第22章 LCD驱动程序很好的技术资料.zip
- 技术资料分享第21章 高层次配置很好的技术资料.zip
- 技术资料分享第20章 底层配置很好的技术资料.zip
- 技术资料分享第19章 与时间相关的函数很好的技术资料.zip
- 技术资料分享第18章 输入设备很好的技术资料.zip
- 技术资料分享第17章 Shift-JIS支持很好的技术资料.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功