Compare commits
No commits in common. "48ed6eb8eae4b6bae0ea6c4d7eea332e9b81e4d7" and "643f1197d6a3570b21d734256650ae6d37e9fdfd" have entirely different histories.
48ed6eb8ea
...
643f1197d6
@ -26,9 +26,6 @@ abstract class Packet extends FTNBase implements \Iterator, \Countable
|
||||
protected const PACKED_MSG_LEAD = "\02\00";
|
||||
protected const PACKED_END = "\00\00";
|
||||
|
||||
public const MSG_TYPE2 = 1<<0;
|
||||
public const MSG_TYPE4 = 1<<2;
|
||||
|
||||
// @todo Rename this regex to something more descriptive, ie: FILENAME_REGEX
|
||||
public const regex = '([[:xdigit:]]{4})(?:-(\d{4,10}))?-(.+)';
|
||||
|
||||
@ -245,12 +242,10 @@ abstract class Packet extends FTNBase implements \Iterator, \Countable
|
||||
case 'tftn':
|
||||
return parent::__get($key);
|
||||
|
||||
case 'product':
|
||||
return Arr::get($this->header,'prodcode-hi')<<8|Arr::get($this->header,'prodcode-lo');
|
||||
|
||||
case 'software':
|
||||
$code = Arr::get($this->header,'prodcode-hi')<<8|Arr::get($this->header,'prodcode-lo');
|
||||
Software::unguard();
|
||||
$o = Software::singleOrNew(['code'=>$this->product,'type'=>Software::SOFTWARE_TOSSER]);
|
||||
$o = Software::singleOrNew(['code'=>$code,'type'=>Software::SOFTWARE_TOSSER]);
|
||||
Software::reguard();
|
||||
|
||||
return $o;
|
||||
|
@ -37,7 +37,7 @@ final class FSC39 extends Packet
|
||||
'capvalid' => [0x28,'n',2], // fsc-0039.004 (copy of 0x2c)
|
||||
'prodcode-hi' => [0x2a,'C',1], // Product Code Hi
|
||||
'prodrev-min' => [0x2b,'C',1], // Product Version Minor
|
||||
'capword' => [0x2c,'v',2], // Capability Word fsc-0039.004/fsc-0048.002
|
||||
'capword' => [0x2c,'v',2], // Capability Word
|
||||
'dozone' => [0x2e,'v',2], // Orig Zone
|
||||
'ddzone' => [0x30,'v',2], // Dest Zone
|
||||
'opoint' => [0x32,'v',2], // Orig Point
|
||||
@ -46,7 +46,6 @@ final class FSC39 extends Packet
|
||||
];
|
||||
|
||||
public const TYPE = '2e';
|
||||
public const VERS = self::MSG_TYPE2; //|self::MSG_TYPE4;
|
||||
|
||||
public function __get($key)
|
||||
{
|
||||
@ -86,10 +85,10 @@ final class FSC39 extends Packet
|
||||
$this->fftn_p->zone->zone_id, // Orig Zone
|
||||
$this->tftn_p->zone->zone_id, // Dest Zone
|
||||
'', // Reserved
|
||||
static::VERS, // fsc-0039.004 (copy of 0x2c)
|
||||
Arr::get($this->header,'capvalid',1<<0), // fsc-0039.004 (copy of 0x2c)
|
||||
((Setup::PRODUCT_ID >> 8) & 0xff), // Product Code Hi
|
||||
Setup::PRODUCT_VERSION_MIN, // Product Version Minor
|
||||
static::VERS, // Capability Word
|
||||
1<<0, // Capability Word
|
||||
$this->fftn_p->zone->zone_id, // Orig Zone
|
||||
$this->tftn_p->zone->zone_id, // Dest Zone
|
||||
$this->fftn_p->point_id, // Orig Point
|
||||
|
@ -37,20 +37,6 @@ final class FSC45 extends Packet
|
||||
|
||||
public const TYPE = '2.2';
|
||||
|
||||
public function __get($key)
|
||||
{
|
||||
switch ($key) {
|
||||
case 'product':
|
||||
return Arr::get($this->header,'prodcode');
|
||||
|
||||
case 'software_ver':
|
||||
return Arr::get($this->header,'prodrev-maj');
|
||||
|
||||
default:
|
||||
return parent::__get($key);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create our message packet header
|
||||
*/
|
||||
|
@ -11,7 +11,6 @@ use App\Models\Setup;
|
||||
* FSC-0048 http://ftsc.org/docs/fsc-0048.002
|
||||
*
|
||||
* Commonly known as Type 2+ packets, based on FSC-0039 with improved support for FTS-0001
|
||||
* @note: These packets will be detected as FSC-0039 packets unless it is addressed to a point
|
||||
*/
|
||||
final class FSC48 extends Packet
|
||||
{
|
||||
@ -37,7 +36,7 @@ final class FSC48 extends Packet
|
||||
'capvalid' => [0x28,'n',2], // fsc-0039.004 (copy of 0x2c)
|
||||
'prodcode-hi' => [0x2a,'C',1], // Product Code Hi
|
||||
'prodrev-min' => [0x2b,'C',1], // Product Version Minor
|
||||
'capword' => [0x2c,'v',2], // Capability Word fsc-0039.004/fsc-0048.002
|
||||
'capword' => [0x2c,'v',2], // Capability Word
|
||||
'dozone' => [0x2e,'v',2], // Orig Zone
|
||||
'ddzone' => [0x30,'v',2], // Dest Zone
|
||||
'opoint' => [0x32,'v',2], // Orig Point
|
||||
@ -46,7 +45,6 @@ final class FSC48 extends Packet
|
||||
];
|
||||
|
||||
public const TYPE = '2+';
|
||||
public const VERS = self::MSG_TYPE2; //|self::MSG_TYPE4;
|
||||
|
||||
public function __get($key)
|
||||
{
|
||||
@ -86,10 +84,10 @@ final class FSC48 extends Packet
|
||||
$this->fftn_p->zone->zone_id, // Orig Zone
|
||||
$this->tftn_p->zone->zone_id, // Dest Zone
|
||||
$this->fftn_p->point_id ? $this->fftn_p->host_id : 0x00, // Aux Net
|
||||
static::VERS, // fsc-0039.004 (copy of 0x2c)
|
||||
1<<0, // fsc-0039.004 (copy of 0x2c)
|
||||
((Setup::PRODUCT_ID >> 8) & 0xff), // Product Code Hi
|
||||
Setup::PRODUCT_VERSION_MIN, // Product Version Minor
|
||||
static::VERS, // Capability Word
|
||||
1<<0, // Capability Word
|
||||
$this->fftn_p->zone->zone_id, // Orig Zone
|
||||
$this->tftn_p->zone->zone_id, // Dest Zone
|
||||
$this->fftn_p->point_id, // Orig Point
|
||||
|
@ -38,20 +38,6 @@ final class FTS1 extends Packet
|
||||
|
||||
public const TYPE = '2';
|
||||
|
||||
public function __get($key)
|
||||
{
|
||||
switch ($key) {
|
||||
case 'product':
|
||||
return Arr::get($this->header,'prodcode');
|
||||
|
||||
case 'software_ver':
|
||||
return 'N/A';
|
||||
|
||||
default:
|
||||
return parent::__get($key);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create our message packet header
|
||||
*/
|
||||
|
37
app/Console/Commands/ANSIDecode.php
Normal file
37
app/Console/Commands/ANSIDecode.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
use App\Classes\ANSI;
|
||||
|
||||
class ANSIDecode extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'ansi:decode'
|
||||
.' {file : ANS file to decode}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Decode ANS file from custom binary';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle(): int
|
||||
{
|
||||
echo ANSI::ansi($this->argument('file'));
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
42
app/Console/Commands/ANSIEncode.php
Normal file
42
app/Console/Commands/ANSIEncode.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
use App\Classes\ANSI;
|
||||
|
||||
class ANSIEncode extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'ansi:encode'
|
||||
.' {file : ANS file to encode}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Encode ANS file to custom binary';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle(): int
|
||||
{
|
||||
foreach (ANSI::binary($this->argument('file')) as $line) {
|
||||
foreach (str_split(bin2hex($line),2) as $y)
|
||||
echo hex2bin($y);
|
||||
|
||||
echo "\r";
|
||||
}
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Debug;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
use App\Classes\File\Send;
|
||||
use App\Classes\File\Send\Dynamic;
|
||||
use App\Models\Address;
|
||||
use App\Models\Dynamic as DynamicModel;
|
||||
|
||||
class DynamicItem extends Command
|
||||
{
|
||||
protected $signature = 'debug:dynamic:item'
|
||||
.' {name : Dynamic Item}'
|
||||
.' {ftn : FTN Address}';
|
||||
|
||||
protected $description = 'Generate a dynamic item';
|
||||
|
||||
public function handle(): int
|
||||
{
|
||||
$do = DynamicModel::where('name',$this->argument('name'))->single();
|
||||
|
||||
if (! $do)
|
||||
throw new \Exception(sprintf('Dynamic Item [%s] doesnt exist?',$this->argument('name')));
|
||||
|
||||
$ao = Address::findFTN($this->argument('ftn'));
|
||||
|
||||
$d = new Dynamic($do,$ao,Send::T_FILE);
|
||||
|
||||
$d->open();
|
||||
echo $d->read($d->size);
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
@ -1,67 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Debug;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
use App\Models\Address;
|
||||
|
||||
class PacketDump extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'debug:packet:dump'.
|
||||
' {type : Type of packet, netmail|echomail }'.
|
||||
' {ftn : FTN}'.
|
||||
' {file? : filename}'.
|
||||
' {--dump : Dump packet}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Create an outgoing FTN packet';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function handle(): int
|
||||
{
|
||||
$ao = Address::findFTN($this->argument('ftn'));
|
||||
|
||||
switch (strtolower($this->argument('type'))) {
|
||||
case 'netmail':
|
||||
$pkt = $ao->getNetmail();
|
||||
break;
|
||||
|
||||
case 'echomail':
|
||||
$pkt = $ao->getEchomail();
|
||||
break;
|
||||
|
||||
default:
|
||||
$this->error('Unknown type: '.$this->argument('type'));
|
||||
throw new \Exception('Unknown type: '.$this->argument('type'));
|
||||
}
|
||||
|
||||
if ($this->option('dump')) {
|
||||
$this->info('Item Name:'.$pkt->name);
|
||||
$this->info('Item Type:'.get_class($pkt));
|
||||
$this->info('Dump:');
|
||||
echo hex_dump($pkt);
|
||||
|
||||
} else {
|
||||
$f = fopen($this->argument('file'),'w+');
|
||||
fputs($f,(string)$pkt);
|
||||
fclose($f);
|
||||
}
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
@ -55,12 +55,12 @@ class PacketInfo extends Command
|
||||
$this->alert(sprintf('File Name: %s',$x));
|
||||
|
||||
$this->info(sprintf('Packet Type : %s (%s)',$pkt->type,get_class($pkt)));
|
||||
$this->info(sprintf('From : %s to %s',$pkt->fftn->ftn,$pkt->tftn ? $pkt->tftn->ftn : $pkt->tftn_t));
|
||||
$this->info(sprintf('From : %s to %s',$pkt->fftn->ftn,$pkt->tftn->ftn));
|
||||
$this->info(sprintf('Dated : %s (%s) [%s]',$pkt->date,$pkt->date->timestamp,$pkt->date->tz->toOffsetName()));
|
||||
$this->info(sprintf('Password : %s (%s)',$pkt->password ?: '-',$pkt->password ? 'SET' : 'NOT set'));
|
||||
$this->info(sprintf('Messages : %d',$pkt->count()));
|
||||
$this->info(sprintf('Tosser : %d (%s) version %s (%x)',$pkt->software->code,$pkt->software->name,$pkt->software_ver,$pkt->product));
|
||||
$this->info(sprintf('Capabilities: %s',$pkt->capability));
|
||||
$this->info(sprintf('Tosser : %d (%s) version %s',$pkt->software->code,$pkt->software->name,$pkt->software_ver));
|
||||
$this->info(sprintf('Capabilities: %x',$pkt->capability));
|
||||
$this->info(sprintf('Has Errors : %s',$pkt->errors->count() ? 'YES' : 'No'));
|
||||
$this->info(sprintf('Messages : %d',$pkt->count()));
|
||||
|
||||
|
@ -71,7 +71,7 @@
|
||||
|
||||
<div id="collapse_item_{{ $loop->parent->index }}_{{ $loop->index }}" class="accordion-collapse collapse @if($loop->parent->first)show @endif" aria-labelledby="packet" data-bs-parent="#accordion_packet">
|
||||
<div class="accordion-body">
|
||||
<p>Packet <strong class="highlight">{{ $file }}</strong> (type <strong class="highlight">{{ $result->type }}</strong>) is from <strong class="highlight">{{ $result->fftn->ftn }}</strong> to <strong class="highlight">{{ $result->tftn->ftn }}</strong>, dated <strong class="highlight">{{ $result->date }}</strong>.</p>
|
||||
<p>Packet <strong class="highlight">{{ $file }}</strong> (type <strong class="highlight">{{ $result->type }}</strong>) is from <strong class="highlight">{{ $result->fftn }}</strong> to <strong class="highlight">{{ $result->tftn }}</strong>, dated <strong class="highlight">{{ $result->date }}</strong>.</p>
|
||||
<p>This packet has <strong class="highlight">{{ $result->messages->count() }}</strong> messages and <strong class="highlight">{{ $result->password ? 'DOES' : 'does NOT' }}</strong> have a password.</p>
|
||||
<p>Tosser: <strong class="highlight">{{ $result->software->code }}</strong> (<strong class="highlight">{{ $result->software->name }}</strong>), version <strong class="highlight">{{ $result->software_ver }}</strong>. Capabilities: <strong class="highlight">{{ $result->capability }}</strong>.</p>
|
||||
@if ($result->messages->count() > 1)
|
||||
|
Loading…
Reference in New Issue
Block a user