SA-MP/raknet/RakNetStatistics.h
2023-11-26 23:36:18 +08:00

146 lines
4.6 KiB
C

/// \file
/// \brief A structure that holds all statistical data returned by RakNet.
///
/// This file is part of RakNet Copyright 2003 Kevin Jenkins.
///
/// Usage of RakNet is subject to the appropriate license agreement.
/// Creative Commons Licensees are subject to the
/// license found at
/// http://creativecommons.org/licenses/by-nc/2.5/
/// Single application licensees are subject to the license found at
/// http://www.rakkarsoft.com/SingleApplicationLicense.html
/// Custom license users are subject to the terms therein.
/// GPL license users are subject to the GNU General Public
/// License as published by the Free
/// Software Foundation; either version 2 of the License, or (at your
/// option) any later version.
#ifndef __RAK_NET_STATISTICS_H
#define __RAK_NET_STATISTICS_H
#include "PacketPriority.h"
#include "Export.h"
#include "NetworkTypes.h"
typedef unsigned long long uint64_t;
/*
RakNetStatisticsStruct sizes
saco 296u
server W 312u L 296u
npc W 296u L 296u
*/
/// \brief Network Statisics Usage
///
/// Store Statistics information related to network usage
struct RAK_DLL_EXPORT RakNetStatisticsStruct
{
// TODO: RakNetStatisticsStruct
/// Number of Messages in the send Buffer (high, medium, low priority)
unsigned messageSendBuffer[ NUMBER_OF_PRIORITIES ];
/// Number of messages sent (high, medium, low priority)
unsigned messagesSent[ NUMBER_OF_PRIORITIES ];
char _gap20[16];
/// Number of data bits used for user messages
uint64_t messageDataBitsSent[ NUMBER_OF_PRIORITIES ];
/// Number of total bits used for user messages, including headers
uint64_t messageTotalBitsSent[ NUMBER_OF_PRIORITIES ];
/// Number of packets sent containing only acknowledgements
unsigned packetsContainingOnlyAcknowlegements;
/// Number of acknowledgements sent
unsigned acknowlegementsSent;
/// Number of acknowledgements waiting to be sent
unsigned acknowlegementsPending;
#if defined(_WIN32) && defined(SAMPSRV)
unsigned field_7C;
#endif
/// Number of acknowledgements bits sent
uint64_t acknowlegementBitsSent;
/// Number of packets containing only acknowledgements and resends
unsigned packetsContainingOnlyAcknowlegementsAndResends;
/// Number of messages resent
unsigned messageResends;
/// Number of bits resent of actual data
uint64_t messageDataBitsResent;
/// Total number of bits resent, including headers
uint64_t messagesTotalBitsResent;
/// Number of messages waiting for ack (// TODO - rename this)
unsigned messagesOnResendQueue;
/// Number of messages not split for sending
unsigned numberOfUnsplitMessages;
/// Number of messages split for sending
unsigned numberOfSplitMessages;
/// Total number of splits done for sending
unsigned totalSplits;
/// Total packets sent
unsigned packetsSent;
#if defined(_WIN32) && defined(SAMPSRV)
unsigned field_B4;
#endif
/// Number of bits added by encryption
uint64_t encryptionBitsSent;
/// total bits sent
uint64_t totalBitsSent;
/// Number of sequenced messages arrived out of order
unsigned sequencedMessagesOutOfOrder;
/// Number of sequenced messages arrived in order
unsigned sequencedMessagesInOrder;
/// Number of ordered messages arrived out of order
unsigned orderedMessagesOutOfOrder;
/// Number of ordered messages arrived in order
unsigned orderedMessagesInOrder;
/// Packets with a good CRC received
unsigned packetsReceived;
/// Packets with a bad CRC received
unsigned packetsWithBadCRCReceived;
/// Bits with a good CRC received
uint64_t bitsReceived;
/// Bits with a bad CRC received
uint64_t bitsWithBadCRCReceived;
/// Number of acknowledgement messages received for packets we are resending
unsigned acknowlegementsReceived;
/// Number of acknowledgement messages received for packets we are not resending
unsigned duplicateAcknowlegementsReceived;
/// Number of data messages (anything other than an ack) received that are valid and not duplicate
unsigned messagesReceived;
/// Number of data messages (anything other than an ack) received that are invalid
unsigned invalidMessagesReceived;
/// Number of data messages (anything other than an ack) received that are duplicate
unsigned duplicateMessagesReceived;
/// Number of messages waiting for reassembly
unsigned messagesWaitingForReassembly;
/// Number of messages in reliability output queue
unsigned internalOutputQueueSize;
#if defined(_WIN32) && defined(SAMPSRV)
unsigned field_10C;
#endif
/// Current bits per second
double bitsPerSecond;
/// connection start time
RakNetTime connectionStartTime;
char _gap110[25];
};
void StatisticsToString( RakNetStatisticsStruct *s, char *buffer, int verbosityLevel );
#endif