RakLibInterface
in package
implements
ServerEventListener, AdvancedNetworkInterface
Interfaces, Classes, Traits and Enums
- ServerEventListener
- AdvancedNetworkInterface
- Advanced network interfaces have some additional capabilities, such as being able to ban addresses and process raw packets.
Table of Contents
- MCPE_RAKNET_PACKET_ID = "\xfe"
- MCPE_RAKNET_PROTOCOL_VERSION = 10
- Sometimes this gets changed when the MCPE-layer protocol gets broken to the point where old and new can't communicate. It's important that we check this to avoid catastrophes.
- $broadcaster : PacketBroadcaster
- $eventReceiver : RakLibToUserThreadMessageReceiver
- $interface : UserToRakLibThreadMessageSender
- $network : Network
- $rakLib : RakLibServer
- $rakServerId : int
- $server : Server
- $sessions : array<string|int, NetworkSession>
- $sleeper : SleeperNotifier
- __construct() : mixed
- addRawPacketFilter() : void
- Adds a regex filter for raw packets to this network interface. This filter should be used to check validity of raw packets before relaying them to the main thread.
- blockAddress() : void
- Prevents packets received from the IP address getting processed for the given timeout.
- close() : void
- onBandwidthStatsUpdate() : void
- onClientConnect() : void
- onClientDisconnect() : void
- onPacketAck() : void
- onPacketReceive() : void
- onPingMeasure() : void
- onRawPacketReceive() : void
- putPacket() : void
- sendRawPacket() : void
- Sends a raw payload to the network interface, bypassing any sessions.
- setName() : void
- setNetwork() : void
- setPacketLimit() : void
- setPortCheck() : void
- shutdown() : void
- start() : void
- tick() : void
- unblockAddress() : void
- Unblocks a previously-blocked address.
Constants
MCPE_RAKNET_PACKET_ID
private
mixed
MCPE_RAKNET_PACKET_ID
= "\xfe"
MCPE_RAKNET_PROTOCOL_VERSION
Sometimes this gets changed when the MCPE-layer protocol gets broken to the point where old and new can't communicate. It's important that we check this to avoid catastrophes.
private
mixed
MCPE_RAKNET_PROTOCOL_VERSION
= 10
Properties
$broadcaster
private
PacketBroadcaster
$broadcaster
$eventReceiver
private
RakLibToUserThreadMessageReceiver
$eventReceiver
$interface
private
UserToRakLibThreadMessageSender
$interface
$network
private
Network
$network
$rakLib
private
RakLibServer
$rakLib
$rakServerId
private
int
$rakServerId
$server
private
Server
$server
$sessions
private
array<string|int, NetworkSession>
$sessions
= []
$sleeper
private
SleeperNotifier
$sleeper
Methods
__construct()
public
__construct(Server $server, string $ip, int $port, bool $ipV6) : mixed
Parameters
- $server : Server
- $ip : string
- $port : int
- $ipV6 : bool
Return values
mixed —addRawPacketFilter()
Adds a regex filter for raw packets to this network interface. This filter should be used to check validity of raw packets before relaying them to the main thread.
public
addRawPacketFilter(string $regex) : void
Parameters
- $regex : string
Return values
void —blockAddress()
Prevents packets received from the IP address getting processed for the given timeout.
public
blockAddress(string $address[, int $timeout = 300 ]) : void
Parameters
- $address : string
- $timeout : int = 300
-
Seconds
Return values
void —close()
public
close(int $sessionId) : void
Parameters
- $sessionId : int
Return values
void —onBandwidthStatsUpdate()
public
onBandwidthStatsUpdate(int $bytesSentDiff, int $bytesReceivedDiff) : void
Parameters
- $bytesSentDiff : int
- $bytesReceivedDiff : int
Return values
void —onClientConnect()
public
onClientConnect(int $sessionId, string $address, int $port, int $clientID) : void
Parameters
- $sessionId : int
- $address : string
- $port : int
- $clientID : int
Return values
void —onClientDisconnect()
public
onClientDisconnect(int $sessionId, string $reason) : void
Parameters
- $sessionId : int
- $reason : string
Return values
void —onPacketAck()
public
onPacketAck(int $sessionId, int $identifierACK) : void
Parameters
- $sessionId : int
- $identifierACK : int
Return values
void —onPacketReceive()
public
onPacketReceive(int $sessionId, string $packet) : void
Parameters
- $sessionId : int
- $packet : string
Return values
void —onPingMeasure()
public
onPingMeasure(int $sessionId, int $pingMS) : void
Parameters
- $sessionId : int
- $pingMS : int
Return values
void —onRawPacketReceive()
public
onRawPacketReceive(string $address, int $port, string $payload) : void
Parameters
- $address : string
- $port : int
- $payload : string
Return values
void —putPacket()
public
putPacket(int $sessionId, string $payload[, bool $immediate = true ]) : void
Parameters
- $sessionId : int
- $payload : string
- $immediate : bool = true
Return values
void —sendRawPacket()
Sends a raw payload to the network interface, bypassing any sessions.
public
sendRawPacket(string $address, int $port, string $payload) : void
Parameters
- $address : string
- $port : int
- $payload : string
Return values
void —setName()
public
setName(string $name) : void
Parameters
- $name : string
Return values
void —setNetwork()
public
setNetwork(Network $network) : void
Parameters
- $network : Network
Return values
void —setPacketLimit()
public
setPacketLimit(int $limit) : void
Parameters
- $limit : int
Return values
void —setPortCheck()
public
setPortCheck(bool $name) : void
Parameters
- $name : bool
Return values
void —shutdown()
public
shutdown() : void
Return values
void —start()
public
start() : void
Return values
void —tick()
public
tick() : void
Return values
void —unblockAddress()
Unblocks a previously-blocked address.
public
unblockAddress(string $address) : void
Parameters
- $address : string