Luanti 5.19.0-dev
Loading...
Searching...
No Matches
con Namespace Reference

Classes

struct  BufferedPacket
class  Channel
class  Connection
struct  ConnectionCommand
struct  ConnectionEvent
class  ConnectionException
class  ConnectionReceiveThread
class  ConnectionSendThread
class  IConnection
class  IncomingDataCorruption
class  IncomingSplitBuffer
struct  IncomingSplitPacket
class  InvalidIncomingDataException
class  IPeer
class  NotFoundException
struct  OutgoingPacket
class  Peer
class  PeerHandler
class  PeerHelper
class  PeerNotFoundException
class  ProcessedQueued
class  ProcessedSilentlyException
class  ReliablePacketBuffer
class  UDPPeer

Typedefs

typedef std::shared_ptr< ConnectionEvent > ConnectionEventPtr
typedef std::shared_ptr< ConnectionCommand > ConnectionCommandPtr
typedef std::shared_ptr< BufferedPacket > BufferedPacketPtr

Enumerations

enum  rtt_stat_type : int {
  MIN_RTT , MAX_RTT , AVG_RTT , MIN_JITTER ,
  MAX_JITTER , AVG_JITTER
}
enum  rate_stat_type : int {
  CUR_DL_RATE , AVG_DL_RATE , CUR_INC_RATE , AVG_INC_RATE ,
  CUR_LOSS_RATE , AVG_LOSS_RATE
}
enum  ConnectionEventType { CONNEVENT_NONE , CONNEVENT_DATA_RECEIVED , CONNEVENT_PEER_ADDED , CONNEVENT_PEER_REMOVED }
enum  PacketType : u8 {
  PACKET_TYPE_CONTROL = 0 , PACKET_TYPE_ORIGINAL = 1 , PACKET_TYPE_SPLIT = 2 , PACKET_TYPE_RELIABLE = 3 ,
  PACKET_TYPE_MAX
}
enum  ControlType : u8 { CONTROLTYPE_ACK = 0 , CONTROLTYPE_SET_PEER_ID = 1 , CONTROLTYPE_PING = 2 , CONTROLTYPE_DISCO = 3 }
enum  ConnectionCommandType {
  CONNCMD_NONE , CONNCMD_CONNECT , CONNCMD_DISCONNECT , CONNCMD_DISCONNECT_PEER ,
  CONNCMD_SEND , CONNCMD_SEND_TO_ALL , CONCMD_ACK , CONCMD_CREATE_PEER ,
  CONNCMD_RESEND_ONE , CONNCMD_PEER_ID_SET
}

Functions

IConnection * createMTP (bool is_server, UDPSocket &&socket, PeerHandler *handler)
BufferedPacketPtr makePacket (const Address &address, const SharedBuffer< u8 > &data, u32 protocol_id, session_t sender_peer_id, u8 channel)
SharedBuffer< u8 > makeOriginalPacket (const SharedBuffer< u8 > &data)
void makeSplitPacket (const SharedBuffer< u8 > &data, u32 chunksize_max, u16 seqnum, std::list< SharedBuffer< u8 > > *chunks)
void makeAutoSplitPacket (const SharedBuffer< u8 > &data, u32 chunksize_max, u16 &split_seqnum, std::list< SharedBuffer< u8 > > *list)
SharedBuffer< u8 > makeReliablePacket (const SharedBuffer< u8 > &data, u16 seqnum)
bool seqnum_higher (u16 totest, u16 base)
bool seqnum_in_window (u16 seqnum, u16 next, u16 window_size)
float CALC_DTIME (u64 lasttime, u64 curtime)
static session_t readPeerId (const u8 *packetdata)
static u8 readChannel (const u8 *packetdata)

Variables

constexpr u32 MAX_RELIABLE_PACKET_DATA_SIZE = MAX_RELIABLE_WINDOW_SIZE * 512
constexpr u32 MAX_SPLIT_PACKET_PAYLOAD_SIZE

Typedef Documentation

◆ BufferedPacketPtr

typedef std::shared_ptr<BufferedPacket> con::BufferedPacketPtr

◆ ConnectionCommandPtr

typedef std::shared_ptr<ConnectionCommand> con::ConnectionCommandPtr

◆ ConnectionEventPtr

typedef std::shared_ptr<ConnectionEvent> con::ConnectionEventPtr

Enumeration Type Documentation

◆ ConnectionCommandType

Enumerator
CONNCMD_NONE 
CONNCMD_CONNECT 
CONNCMD_DISCONNECT 
CONNCMD_DISCONNECT_PEER 
CONNCMD_SEND 
CONNCMD_SEND_TO_ALL 
CONCMD_ACK 
CONCMD_CREATE_PEER 
CONNCMD_RESEND_ONE 
CONNCMD_PEER_ID_SET 

◆ ConnectionEventType

Enumerator
CONNEVENT_NONE 
CONNEVENT_DATA_RECEIVED 
CONNEVENT_PEER_ADDED 
CONNEVENT_PEER_REMOVED 

◆ ControlType

enum con::ControlType : u8
Enumerator
CONTROLTYPE_ACK 
CONTROLTYPE_SET_PEER_ID 
CONTROLTYPE_PING 
CONTROLTYPE_DISCO 

◆ PacketType

enum con::PacketType : u8
Enumerator
PACKET_TYPE_CONTROL 
PACKET_TYPE_ORIGINAL 
PACKET_TYPE_SPLIT 
PACKET_TYPE_RELIABLE 
PACKET_TYPE_MAX 

◆ rate_stat_type

enum con::rate_stat_type : int
Enumerator
CUR_DL_RATE 
AVG_DL_RATE 
CUR_INC_RATE 
AVG_INC_RATE 
CUR_LOSS_RATE 
AVG_LOSS_RATE 

◆ rtt_stat_type

enum con::rtt_stat_type : int
Enumerator
MIN_RTT 
MAX_RTT 
AVG_RTT 
MIN_JITTER 
MAX_JITTER 
AVG_JITTER 

Function Documentation

◆ CALC_DTIME()

float con::CALC_DTIME ( u64 lasttime,
u64 curtime )
inline

References CALC_DTIME(), MYMAX, and MYMIN.

Referenced by CALC_DTIME(), con::Peer::isTimedOut(), con::ConnectionReceiveThread::run(), and con::ConnectionSendThread::run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createMTP()

IConnection * con::createMTP ( bool is_server,
UDPSocket && socket,
PeerHandler * handler )

References CONNECTION_TIMEOUT, and createMTP().

Referenced by Client::connect(), and createMTP().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ makeAutoSplitPacket()

void con::makeAutoSplitPacket ( const SharedBuffer< u8 > & data,
u32 chunksize_max,
u16 & split_seqnum,
std::list< SharedBuffer< u8 > > * list )

References SharedBuffer< T >::getSize(), makeAutoSplitPacket(), makeOriginalPacket(), and makeSplitPacket().

Referenced by makeAutoSplitPacket(), con::UDPPeer::processReliableSendCommand(), and con::ConnectionSendThread::send().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ makeOriginalPacket()

SharedBuffer< u8 > con::makeOriginalPacket ( const SharedBuffer< u8 > & data)

References SharedBuffer< T >::getSize(), makeOriginalPacket(), PACKET_TYPE_ORIGINAL, and writeU8().

Referenced by makeAutoSplitPacket(), and makeOriginalPacket().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ makePacket()

BufferedPacketPtr con::makePacket ( const Address & address,
const SharedBuffer< u8 > & data,
u32 protocol_id,
session_t sender_peer_id,
u8 channel )

References BASE_HEADER_SIZE, SharedBuffer< T >::getSize(), makePacket(), writeU16(), writeU32(), and writeU8().

Referenced by con::ConnectionReceiveThread::handlePacketType_Reliable(), con::ConnectionReceiveThread::handlePacketType_Split(), makePacket(), con::UDPPeer::processReliableSendCommand(), con::ConnectionSendThread::rawSendAsPacket(), and TestConnection::testHelpers().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ makeReliablePacket()

SharedBuffer< u8 > con::makeReliablePacket ( const SharedBuffer< u8 > & data,
u16 seqnum )

References SharedBuffer< T >::getSize(), makeReliablePacket(), PACKET_TYPE_RELIABLE, writeU16(), and writeU8().

Referenced by makeReliablePacket(), con::UDPPeer::processReliableSendCommand(), con::ConnectionSendThread::rawSendAsPacket(), and TestConnection::testHelpers().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ makeSplitPacket()

void con::makeSplitPacket ( const SharedBuffer< u8 > & data,
u32 chunksize_max,
u16 seqnum,
std::list< SharedBuffer< u8 > > * chunks )

References SharedBuffer< T >::getSize(), makeSplitPacket(), PACKET_TYPE_SPLIT, sanity_check, writeU16(), and writeU8().

Referenced by makeAutoSplitPacket(), and makeSplitPacket().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readChannel()

u8 con::readChannel ( const u8 * packetdata)
inlinestatic

References readChannel(), and readU8().

Referenced by con::ConnectionReceiveThread::checkIncomingBuffers(), readChannel(), con::ConnectionReceiveThread::receive(), and con::ConnectionSendThread::resendReliable().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readPeerId()

session_t con::readPeerId ( const u8 * packetdata)
inlinestatic

References readPeerId(), and readU16().

Referenced by con::ConnectionReceiveThread::checkIncomingBuffers(), readPeerId(), and con::ConnectionReceiveThread::receive().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ seqnum_higher()

bool con::seqnum_higher ( u16 totest,
u16 base )
inline

References seqnum_higher(), and SEQNUM_MAX.

Referenced by con::ConnectionReceiveThread::handlePacketType_Reliable(), and seqnum_higher().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ seqnum_in_window()

bool con::seqnum_in_window ( u16 seqnum,
u16 next,
u16 window_size )
inline

References seqnum_in_window(), and SEQNUM_MAX.

Referenced by con::ConnectionReceiveThread::handlePacketType_Reliable(), con::ReliablePacketBuffer::insert(), and seqnum_in_window().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ MAX_RELIABLE_PACKET_DATA_SIZE

u32 con::MAX_RELIABLE_PACKET_DATA_SIZE = MAX_RELIABLE_WINDOW_SIZE * 512
constexpr

Referenced by con::Connection::Send().

◆ MAX_SPLIT_PACKET_PAYLOAD_SIZE

u32 con::MAX_SPLIT_PACKET_PAYLOAD_SIZE
constexpr
Initial value:
sizeof(u16)
constexpr u32 MAX_RELIABLE_PACKET_DATA_SIZE
Definition internal.h:384

Referenced by con::IncomingSplitBuffer::insert().