Setup to present different mail bundle types

This commit is contained in:
2024-05-28 12:23:59 +10:00
parent 3d43a256ba
commit 364815e8af
6 changed files with 46 additions and 10 deletions

View File

@@ -26,6 +26,9 @@ 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}))?-(.+)';
@@ -242,10 +245,12 @@ 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'=>$code,'type'=>Software::SOFTWARE_TOSSER]);
$o = Software::singleOrNew(['code'=>$this->product,'type'=>Software::SOFTWARE_TOSSER]);
Software::reguard();
return $o;

View File

@@ -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
'capword' => [0x2c,'v',2], // Capability Word fsc-0039.004/fsc-0048.002
'dozone' => [0x2e,'v',2], // Orig Zone
'ddzone' => [0x30,'v',2], // Dest Zone
'opoint' => [0x32,'v',2], // Orig Point
@@ -46,6 +46,7 @@ final class FSC39 extends Packet
];
public const TYPE = '2e';
public const VERS = self::MSG_TYPE2; //|self::MSG_TYPE4;
public function __get($key)
{
@@ -85,10 +86,10 @@ final class FSC39 extends Packet
$this->fftn_p->zone->zone_id, // Orig Zone
$this->tftn_p->zone->zone_id, // Dest Zone
'', // Reserved
Arr::get($this->header,'capvalid',1<<0), // fsc-0039.004 (copy of 0x2c)
static::VERS, // fsc-0039.004 (copy of 0x2c)
((Setup::PRODUCT_ID >> 8) & 0xff), // Product Code Hi
Setup::PRODUCT_VERSION_MIN, // Product Version Minor
1<<0, // Capability Word
static::VERS, // 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

View File

@@ -37,6 +37,20 @@ 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
*/

View File

@@ -11,6 +11,7 @@ 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
{
@@ -36,7 +37,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
'capword' => [0x2c,'v',2], // Capability Word fsc-0039.004/fsc-0048.002
'dozone' => [0x2e,'v',2], // Orig Zone
'ddzone' => [0x30,'v',2], // Dest Zone
'opoint' => [0x32,'v',2], // Orig Point
@@ -45,6 +46,7 @@ final class FSC48 extends Packet
];
public const TYPE = '2+';
public const VERS = self::MSG_TYPE2; //|self::MSG_TYPE4;
public function __get($key)
{
@@ -84,10 +86,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
1<<0, // fsc-0039.004 (copy of 0x2c)
static::VERS, // fsc-0039.004 (copy of 0x2c)
((Setup::PRODUCT_ID >> 8) & 0xff), // Product Code Hi
Setup::PRODUCT_VERSION_MIN, // Product Version Minor
1<<0, // Capability Word
static::VERS, // 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

View File

@@ -38,6 +38,20 @@ 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
*/