mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-03 16:49:53 +00:00
RakNetInfo
This commit is contained in:
parent
5700235f80
commit
84cdc3bde1
@ -71,13 +71,16 @@ class MinecraftInterface{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function parsePacket($buffer, $source, $port){
|
private function parsePacket($buffer, $source, $port){
|
||||||
$pid = ord($buf{0});
|
$pid = ord($buffer{0});
|
||||||
$struct = $this->getStruct($pid);
|
if(RakNetInfo::isValid($pid)){
|
||||||
if($struct === false){
|
$packet = new RakNetParser($buffer);
|
||||||
|
@$packet->parse();
|
||||||
|
$this->data[] = array($pid, $packet->data, $buffer, $source, $port);
|
||||||
|
}else{
|
||||||
if(ServerAPI::request()->api->dhandle("server.unknownpacket", array(
|
if(ServerAPI::request()->api->dhandle("server.unknownpacket", array(
|
||||||
"pid" => $pid,
|
"pid" => $pid,
|
||||||
"data" => array(),
|
"data" => array(),
|
||||||
"raw" => $buf,
|
"raw" => $buffer,
|
||||||
"ip" => $source,
|
"ip" => $source,
|
||||||
"port" => $port
|
"port" => $port
|
||||||
)) !== true){
|
)) !== true){
|
||||||
@ -85,10 +88,6 @@ class MinecraftInterface{
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$packet = new RakNetParser($buffer);
|
|
||||||
@$packet->parse();
|
|
||||||
$this->data[] = array($pid, $packet->data, $buffer, $source, $port);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,41 +19,79 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define("RAKNET_STRUCTURE", 5);
|
class RakNetInfo{
|
||||||
define("RAKNET_MAGIC", "\x00\xff\xff\x00\xfe\xfe\xfe\xfe\xfd\xfd\xfd\xfd\x12\x34\x56\x78");
|
const STRUCTURE = 5;
|
||||||
|
const MAGIC = "\x00\xff\xff\x00\xfe\xfe\xfe\xfe\xfd\xfd\xfd\xfd\x12\x34\x56\x78";
|
||||||
|
const UNCONNECTED_PING = 0x01;
|
||||||
|
const UNCONNECTED_PING_OPEN_CONNECTIONS = 0x02;
|
||||||
|
|
||||||
define("RAKNET_UNCONNECTED_PING", 0x01);
|
const OPEN_CONNECTION_REQUEST_1 = 0x05;
|
||||||
define("RAKNET_UNCONNECTED_PING_OPEN_CONNECTIONS", 0x02);
|
const OPEN_CONNECTION_REPLY_1 = 0x06;
|
||||||
|
const OPEN_CONNECTION_REQUEST_2 = 0x07;
|
||||||
|
const OPEN_CONNECTION_REPLY_2 = 0x08;
|
||||||
|
|
||||||
define("RAKNET_OPEN_CONNECTION_REQUEST_1", 0x05);
|
const INCOMPATIBLE_PROTOCOL_VERSION = 0x1a; //CHECK THIS
|
||||||
define("RAKNET_OPEN_CONNECTION_REPLY_1", 0x06);
|
|
||||||
define("RAKNET_OPEN_CONNECTION_REQUEST_2", 0x07);
|
|
||||||
define("RAKNET_OPEN_CONNECTION_REPLY_2", 0x08);
|
|
||||||
|
|
||||||
define("RAKNET_INCOMPATIBLE_PROTOCOL_VERSION", 0x1a); //CHECK THIS
|
const UNCONNECTED_PONG = 0x1c;
|
||||||
|
const ADVERTISE_SYSTEM = 0x1d;
|
||||||
|
|
||||||
define("RAKNET_UNCONNECTED_PONG", 0x1c);
|
const DATA_PACKET_0 = 0x80;
|
||||||
define("RAKNET_ADVERTISE_SYSTEM", 0x1d);
|
const DATA_PACKET_1 = 0x81;
|
||||||
|
const DATA_PACKET_2 = 0x82;
|
||||||
|
const DATA_PACKET_3 = 0x83;
|
||||||
|
const DATA_PACKET_4 = 0x84;
|
||||||
|
const DATA_PACKET_5 = 0x85;
|
||||||
|
const DATA_PACKET_6 = 0x86;
|
||||||
|
const DATA_PACKET_7 = 0x87;
|
||||||
|
const DATA_PACKET_8 = 0x88;
|
||||||
|
const DATA_PACKET_9 = 0x89;
|
||||||
|
const DATA_PACKET_A = 0x8a;
|
||||||
|
const DATA_PACKET_B = 0x8b;
|
||||||
|
const DATA_PACKET_C = 0x8c;
|
||||||
|
const DATA_PACKET_D = 0x8d;
|
||||||
|
const DATA_PACKET_E = 0x8e;
|
||||||
|
const DATA_PACKET_F = 0x8f;
|
||||||
|
|
||||||
define("RAKNET_DATA_PACKET_0", 0x80);
|
const NACK = 0xa0;
|
||||||
define("RAKNET_DATA_PACKET_1", 0x81);
|
const ACK = 0xc0;
|
||||||
define("RAKNET_DATA_PACKET_2", 0x82);
|
|
||||||
define("RAKNET_DATA_PACKET_3", 0x83);
|
|
||||||
define("RAKNET_DATA_PACKET_4", 0x84);
|
|
||||||
define("RAKNET_DATA_PACKET_5", 0x85);
|
|
||||||
define("RAKNET_DATA_PACKET_6", 0x86);
|
|
||||||
define("RAKNET_DATA_PACKET_7", 0x87);
|
|
||||||
define("RAKNET_DATA_PACKET_8", 0x88);
|
|
||||||
define("RAKNET_DATA_PACKET_9", 0x89);
|
|
||||||
define("RAKNET_DATA_PACKET_A", 0x8a);
|
|
||||||
define("RAKNET_DATA_PACKET_B", 0x8b);
|
|
||||||
define("RAKNET_DATA_PACKET_C", 0x8c);
|
|
||||||
define("RAKNET_DATA_PACKET_D", 0x8d);
|
|
||||||
define("RAKNET_DATA_PACKET_E", 0x8e);
|
|
||||||
define("RAKNET_DATA_PACKET_F", 0x8f);
|
|
||||||
|
|
||||||
define("RAKNET_NACK", 0xa0);
|
|
||||||
define("RAKNET_ACK", 0xc0);
|
|
||||||
|
public static function isRakNet($pid){
|
||||||
|
switch((int) $pid){
|
||||||
|
case UNCONNECTED_PING:
|
||||||
|
case UNCONNECTED_PING_OPEN_CONNECTIONS:
|
||||||
|
case OPEN_CONNECTION_REQUEST_1:
|
||||||
|
case OPEN_CONNECTION_REPLY_1:
|
||||||
|
case OPEN_CONNECTION_REQUEST_2:
|
||||||
|
case OPEN_CONNECTION_REPLY_2:
|
||||||
|
case INCOMPATIBLE_PROTOCOL_VERSION:
|
||||||
|
case UNCONNECTED_PONG:
|
||||||
|
case ADVERTISE_SYSTEM:
|
||||||
|
case DATA_PACKET_0:
|
||||||
|
case DATA_PACKET_1:
|
||||||
|
case DATA_PACKET_2:
|
||||||
|
case DATA_PACKET_3:
|
||||||
|
case DATA_PACKET_4:
|
||||||
|
case DATA_PACKET_5:
|
||||||
|
case DATA_PACKET_6:
|
||||||
|
case DATA_PACKET_7:
|
||||||
|
case DATA_PACKET_8:
|
||||||
|
case DATA_PACKET_9:
|
||||||
|
case DATA_PACKET_A:
|
||||||
|
case DATA_PACKET_B:
|
||||||
|
case DATA_PACKET_C:
|
||||||
|
case DATA_PACKET_D:
|
||||||
|
case DATA_PACKET_E:
|
||||||
|
case DATA_PACKET_F:
|
||||||
|
case NACK:
|
||||||
|
case ACK:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class Protocol{
|
class Protocol{
|
||||||
public static $raknet = array(
|
public static $raknet = array(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user