Add Zmodem/BINKP/EMSI
This commit is contained in:
51
app/Console/Commands/BinkpReceive.php
Normal file
51
app/Console/Commands/BinkpReceive.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use App\Classes\Sock\SocketException;
|
||||
use App\Classes\Sock\SocketServer;
|
||||
|
||||
use App\Classes\Protocol\Binkd as BinkdClass;
|
||||
|
||||
class BinkpReceive extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'binkp:receive';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'BINKP receive';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
Log::info('Listening for BINKP connections...');
|
||||
|
||||
$server = new SocketServer(24554,'0.0.0.0');
|
||||
$server->setConnectionHandler([new BinkdClass,'onConnect']);
|
||||
|
||||
try {
|
||||
$server->listen();
|
||||
|
||||
} catch (SocketException $e) {
|
||||
if ($e->getMessage() == 'Can\'t accept connections: "Success"')
|
||||
Log::debug('Server Terminated');
|
||||
else
|
||||
Log::emergency('Uncaught Message: '.$e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
48
app/Console/Commands/BinkpSend.php
Normal file
48
app/Console/Commands/BinkpSend.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use App\Classes\Protocol\Binkd as BinkdClass;
|
||||
use App\Classes\Sock\SocketClient;
|
||||
use App\Models\Node;
|
||||
|
||||
class BinkpSend extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'binkp:send {ftn : FTN to Send to}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Binkp send';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
* @throws \App\Classes\Sock\SocketException
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
Log::info('Call BINKP send');
|
||||
|
||||
$no = Node::findFTN($this->argument('ftn'));
|
||||
|
||||
$client = SocketClient::create($no->address,$no->port);
|
||||
|
||||
$o = new BinkdClass;
|
||||
$o->session(BinkdClass::SESSION_BINKP,$client,$no);
|
||||
|
||||
Log::info(sprintf('Connection ended: %s',$client->getAddress()),['m'=>__METHOD__]);
|
||||
}
|
||||
}
|
51
app/Console/Commands/EMSIReceive.php
Normal file
51
app/Console/Commands/EMSIReceive.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use App\Classes\Sock\SocketException;
|
||||
use App\Classes\Sock\SocketServer;
|
||||
|
||||
use App\Classes\Protocol\EMSI as EMSIClass;
|
||||
|
||||
class EMSIReceive extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'emsi:receive';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'EMSI receive';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
Log::info('Listening for EMSI connections...');
|
||||
|
||||
$server = new SocketServer(60179,'0.0.0.0');
|
||||
$server->setConnectionHandler([new EMSIClass,'onConnect']);
|
||||
|
||||
try {
|
||||
$server->listen();
|
||||
|
||||
} catch (SocketException $e) {
|
||||
if ($e->getMessage() == 'Can\'t accept connections: "Success"')
|
||||
Log::debug('Server Terminated');
|
||||
else
|
||||
Log::emergency('Uncaught Message: '.$e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
48
app/Console/Commands/EMSISend.php
Normal file
48
app/Console/Commands/EMSISend.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Node;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use App\Classes\Sock\SocketClient;
|
||||
|
||||
use App\Classes\Protocol\EMSI as EMSIClass;
|
||||
|
||||
class EMSISend extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'emsi:send {ftn : FTN to Send to}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'EMSI send';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
* @throws \App\Classes\Sock\SocketException
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
Log::info('Call EMSI send');
|
||||
|
||||
$no = Node::findFTN($this->argument('ftn'));
|
||||
|
||||
$client = SocketClient::create($no->address,$no->port,38400);
|
||||
|
||||
$o = new EMSIClass;
|
||||
$o->session(EMSIClass::SESSION_AUTO,$client,$no);
|
||||
|
||||
Log::info(sprintf('Connection ended: %s',$client->getAddress()),['m'=>__METHOD__]);
|
||||
}
|
||||
}
|
@@ -60,7 +60,11 @@ class ImportPacket extends Command
|
||||
'msgid'=>$o->msgid,
|
||||
]);
|
||||
|
||||
$oo->area = $o->echoarea;
|
||||
if (md5(utf8_decode($eo->message)) == md5($o->message))
|
||||
{
|
||||
$this->warn(sprintf('Duplicate message: %s@%s with id: %s',$o->from,$o->fqfa,$o->msgid));
|
||||
break 2;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@@ -150,4 +154,4 @@ class ImportPacket extends Command
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
50
app/Console/Commands/ZmodemReceive.php
Normal file
50
app/Console/Commands/ZmodemReceive.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use App\Classes\Sock\SocketException;
|
||||
use App\Classes\Sock\SocketServer;
|
||||
use App\Classes\Protocol\Zmodem as ZmodemClass;
|
||||
|
||||
class ZmodemReceive extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'zmodem:receive';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'ZMODEM receive';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
Log::info('Listening for ZMODEM connections...');
|
||||
|
||||
$server = new SocketServer(60177,'0.0.0.0');
|
||||
$server->setConnectionHandler([new ZmodemClass,'onConnect']);
|
||||
|
||||
try {
|
||||
$server->listen();
|
||||
|
||||
} catch (SocketException $e) {
|
||||
if ($e->getMessage() == 'Can\'t accept connections: "Success"')
|
||||
Log::debug('Server Terminated');
|
||||
else
|
||||
Log::emergency('Uncaught Message: '.$e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
45
app/Console/Commands/ZmodemSend.php
Normal file
45
app/Console/Commands/ZmodemSend.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use App\Classes\Protocol;
|
||||
use App\Classes\Sock\SocketClient;
|
||||
use App\Classes\Protocol\Zmodem as ZmodemClass;
|
||||
|
||||
class ZmodemSend extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'zmodem:send {ip}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'ZMODEM send';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
Log::info('Call ZMODEM send');
|
||||
|
||||
[$address,$service_port] = explode(':',$this->argument('ip'),2);
|
||||
$client = SocketClient::create($address,$service_port);
|
||||
|
||||
$o = new ZmodemClass;
|
||||
$o->session(Protocol::SESSION_ZMODEM,$client);
|
||||
|
||||
Log::info(sprintf('Connection ended: %s',$client->getAddress()),['m'=>__METHOD__]);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user