Start of processing packets - implemented PING Responce to Netmail

This commit is contained in:
Deon George
2021-07-16 00:54:23 +10:00
parent fe2784f98f
commit a0d3c8d8ab
22 changed files with 1256 additions and 442 deletions

View File

@@ -1,42 +0,0 @@
<?php
namespace App\Traits;
use Illuminate\Support\Arr;
use App\Models\{Node,Zone};
trait GetNode
{
/**
* Get an FTN record
* If the record doesnt exist, we'll create it
*/
protected function get_node(array $address,$create=TRUE)
{
if (! $z=Arr::get($address,'z'))
throw new \Exception('Zone cannot be zero');
$zo = Zone::firstOrCreate(['id'=>$z]);
$no = Node::firstOrNew([
'zone_id'=>$zo->id,
'host_id'=>Arr::get($address,'n'),
'node_id'=>Arr::get($address,'f'),
'point_id'=>Arr::get($address,'p',0)
]);
if (! $no->exists AND $create)
{
$no->active = FALSE;
$no->system = 'AUTO DISCOVERED';
$no->sysop = 'UNKNOWN';
$no->location = '';
$no->baud = 0;
$no->save();
}
return ($no->exists) ? $no : NULL;
}
}