diff --git a/raknet/MTUSize.h b/raknet/MTUSize.h new file mode 100644 index 0000000..0dc2e3e --- /dev/null +++ b/raknet/MTUSize.h @@ -0,0 +1,40 @@ +/// \file +/// \brief \b [Internal] Defines the default maximum transfer unit. +/// +/// 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 DEFAULT_MTU_SIZE + +/// The MTU size to use if RakPeer::SetMTUSize() is not called. +/// \remarks I think many people forget to call RakPeer::SetMTUSize() so I'm setting this to 1500 by default for efficiency. +/// \li \em 17914 16 Mbit/Sec Token Ring +/// \li \em 4464 4 Mbits/Sec Token Ring +/// \li \em 4352 FDDI +/// \li \em 1500. The largest Ethernet packet size \b recommended. This is the typical setting for non-PPPoE, non-VPN connections. The default value for NETGEAR routers, adapters and switches. +/// \li \em 1492. The size PPPoE prefers. +/// \li \em 1472. Maximum size to use for pinging. (Bigger packets are fragmented.) +/// \li \em 1468. The size DHCP prefers. +/// \li \em 1460. Usable by AOL if you don't have large email attachments, etc. +/// \li \em 1430. The size VPN and PPTP prefer. +/// \li \em 1400. Maximum size for AOL DSL. +/// \li \em 576. Typical value to connect to dial-up ISPs. +#ifdef _COMPATIBILITY_1 +#define DEFAULT_MTU_SIZE 1264 +#else +#define DEFAULT_MTU_SIZE 576 +#endif + +#endif + diff --git a/raknet/RakPeer.cpp b/raknet/RakPeer.cpp index 9576aab..f4185d6 100644 --- a/raknet/RakPeer.cpp +++ b/raknet/RakPeer.cpp @@ -7,6 +7,7 @@ RakPeer::RakPeer() { + MTUSize = DEFAULT_MTU_SIZE; maximumIncomingConnections = 0; maximumNumberOfPeers = 0; endThreads = true; @@ -350,9 +351,16 @@ void RakPeer::vftable_A8() // TODO: RakPeer::vftable_A8() (saco W: 10038860) (server W: 450360 L: 8070050) (bot W: 4042A0 L: 807514E) } -void RakPeer::vftable_AC() +// -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +// Description: +// Returns the current MTU size +// +// Returns: +// The MTU sized specified in SetMTUSize +// -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +int RakPeer::GetMTUSize( void ) const { - // TODO: RakPeer::vftable_AC() (saco W: 100388B0) (server W: 4503B0 L: 806DD50) (bot W: 4042F0 L: 807519E) + return MTUSize; } void RakPeer::vftable_B0() diff --git a/raknet/RakPeer.h b/raknet/RakPeer.h index f5d2b2e..2595c89 100644 --- a/raknet/RakPeer.h +++ b/raknet/RakPeer.h @@ -5,6 +5,7 @@ #include "Export.h" #include "RakPeerInterface.h" +#include "ReliabilityLayer.h" #include "RPCNode.h" #include "RPCMap.h" @@ -122,7 +123,11 @@ public: void vftable_A0(); void vftable_A4(); void vftable_A8(); - void vftable_AC(); + + /// Returns the current MTU size + /// \return The current MTU size + int GetMTUSize( void ) const; + void vftable_B0(); void vftable_B4(); void vftable_B8(); @@ -169,8 +174,11 @@ protected: char incomingPassword[256]; unsigned char incomingPasswordLength; - RPCMap rpcMap; // Can't use StrPtrHash because runtime insertions will screw up the indices + char _gap334[1230]; + RPCMap rpcMap; // Can't use StrPtrHash because runtime insertions will screw up the indices + int MTUSize; + bool trackFrequencyTable; }; #endif diff --git a/raknet/RakPeerInterface.h b/raknet/RakPeerInterface.h index 76062b5..0dfc954 100644 --- a/raknet/RakPeerInterface.h +++ b/raknet/RakPeerInterface.h @@ -119,7 +119,11 @@ public: virtual void vftable_A0()=0; virtual void vftable_A4()=0; virtual void vftable_A8()=0; - virtual void vftable_AC()=0; + + /// Returns the current MTU size + /// \return The current MTU size + virtual int GetMTUSize( void ) const=0; + virtual void vftable_B0()=0; virtual void vftable_B4()=0; virtual void vftable_B8()=0; diff --git a/raknet/ReliabilityLayer.h b/raknet/ReliabilityLayer.h index 3526c0a..26d9198 100644 --- a/raknet/ReliabilityLayer.h +++ b/raknet/ReliabilityLayer.h @@ -4,6 +4,7 @@ #define __RELIABILITY_LAYER_H #include "SocketLayer.h" +#include "MTUSize.h" class ReliabilityLayer {