So eehhh we have this new [currently beta] packet. I try to implement this;
/modules/prism_packets.php;
plugins/test.php;
I think these changes should be sufficient to let PRISM send a JRR. But after loooonnggg investigation it doesn't. Why? I don't know. It's packing, it's doing writeUDP if I var_dump the packet;
/modules/prism_hosts.php
I get this;
Looks all good to me. But... When I tcpdump activity on the InSim port I never see this packet actually being send to LFS.. Why? I have no clue.
Assistance is of course welcome
// edit it actually sends something.. But it seems to contain only one byte...
/modules/prism_packets.php;
<?php
define('ISP_JRR', 58); // 58 - instruction : reply to a join request (allow / disallow)
$ISP = array(ISP_NONE => 'ISP_NONE', ISP_ISI => 'ISP_ISI', ISP_VER => 'ISP_VER', ISP_TINY => 'ISP_TINY', ISP_SMALL => 'ISP_SMALL', ISP_STA => 'ISP_STA', ISP_SCH => 'ISP_SCH', ISP_SFP => 'ISP_SFP', ISP_SCC => 'ISP_SCC', ISP_CPP => 'ISP_CPP', ISP_ISM => 'ISP_ISM', ISP_MSO => 'ISP_MSO', ISP_III => 'ISP_III', ISP_MST => 'ISP_MST', ISP_MTC => 'ISP_MTC', ISP_MOD => 'ISP_MOD', ISP_VTN => 'ISP_VTN', ISP_RST => 'ISP_RST', ISP_NCN => 'ISP_NCN', ISP_MTC => 'ISP_MTC', ISP_CNL => 'ISP_CNL', ISP_CPR => 'ISP_CPR', ISP_NPL => 'ISP_NPL', ISP_PLP => 'ISP_PLP', ISP_PLL => 'ISP_PLL', ISP_LAP => 'ISP_LAP', ISP_SPX => 'ISP_SPX', ISP_PIT => 'ISP_PIT', ISP_PSF => 'ISP_PSF', ISP_PLA => 'ISP_PLA', ISP_CCH => 'ISP_CCH', ISP_PEN => 'ISP_PEN', ISP_TOC => 'ISP_TOC', ISP_FLG => 'ISP_FLG', ISP_PFL => 'ISP_PFL', ISP_FIN => 'ISP_FIN', ISP_RES => 'ISP_RES', ISP_REO => 'ISP_REO', ISP_NLP => 'ISP_NLP', ISP_MCI => 'ISP_MCI', ISP_MSX => 'ISP_MSX', ISP_MSL => 'ISP_MSL', ISP_CRS => 'ISP_CRS', ISP_BFN => 'ISP_BFN', ISP_AXI => 'ISP_AXI', ISP_AXO => 'ISP_AXO', ISP_BTN => 'ISP_BTN', ISP_BTC => 'ISP_BTC', ISP_BTT => 'ISP_BTT', ISP_RIP => 'ISP_RIP', ISP_SSH => 'ISP_SSH', ISP_CON => 'ISP_CON', ISP_OBH => 'ISP_OBH', ISP_HLV => 'ISP_HLV', ISP_PLC => 'ISP_PLC', ISP_AXM => 'ISP_AXM', ISP_ACR => 'ISP_ACR', ISP_HCP => 'ISP_HCP', ISP_NCI => 'ISP_NCI', ISP_JRR => 'ISP_JRR');
?>
<?php
class IS_JRR extends Struct // Join Request Reply - send one of these back to LFS in response to a join request
{
const PACK = 'CCxCCCxxC';
const UNPACK = 'CSize/CType/CReqI/CPLID/CUCID/CJRRAction/xSp2/xSp3/CStartPos';
protected $Size = 16; # 16
protected $Type = ISP_JRR; # ISP_JRR
public $ReqI; # 0
public $PLID; # ZERO when this is a reply to a join request - SET to move a car
public $UCID; # set when this is a reply to a join request - ignored when moving a car
public $JRRAction; # 1 - allow / 0 - reject (should send message to user)
protected $Sp2;
protected $Sp3;
public $StartPos; # 0 : use default start point / Flags = 0x80 : set start point
}; function IS_JRR() { return new IS_JRR; }
// Values for JRRAction byte
define('JRR_REJECT', 0); // 0 - reject (should send message to user)
define('JRR_SPAWN', 1); // 1 - allow
define('JRR_2', 2); // 2
define('JRR_3', 3); // 3
define('JRR_RESET', 4); // 4 - reset car with repair
define('JRR_RESET_NO_REPAIR', 5); // 5 - reset car without repair
define('JRR_6', 6); // 6
define('JRR_7', 7); // 7
$JRR = array(JRR_REJECT => 'JRR_REJECT', JRR_SPAWN => 'JRR_SPAWN', JRR_2 => 'JRR_2', JRR_3 => 'JRR_3', JRR_RESET => 'JRR_RESET', JRR_RESET_NO_REPAIR => 'JRR_RESET_NO_REPAIR', JRR_6 => 'JRR_6', JRR_7 => 'JRR_7');
?>
<?php
if ($NPL->NumP == 0) // join request, we need to do something else
{
echo "hey a join request -.-";
IS_JRR()->PLID(0)->UCID($NPL->UCID)->JRRAction(0)->StartPos(0)->Send($hostID);
}
?>
/modules/prism_hosts.php
<?php
case ISP_JRR:
var_dump($packetClass);
console("> ${TYPEs[$packetClass->Type]} Packet to {$hostId}.");
?>
hey a join request -.-object(IS_JRR)#37 (9) {
["Size":protected]=>
int(16)
["Type":protected]=>
&int(58)
["ReqI"]=>
NULL
["PLID"]=>
int(0)
["UCID"]=>
int(2)
["JRRAction"]=>
int(0)
["Sp2":protected]=>
NULL
["Sp3":protected]=>
NULL
["StartPos"]=>
int(0)
}
> IS_JRR Packet to test.
Looks all good to me. But... When I tcpdump activity on the InSim port I never see this packet actually being send to LFS.. Why? I have no clue.
Assistance is of course welcome
// edit it actually sends something.. But it seems to contain only one byte...