Packet header fixes, correctly identify packets from/to points
This commit is contained in:
parent
987b4040fb
commit
7356bedfa2
@ -81,6 +81,7 @@ class Message extends FTNBase
|
||||
private string $origin; // FTS-0004.001
|
||||
private ?string $echoarea = NULL; // FTS-0004.001
|
||||
private array $zone; // Zone the message belongs to. (src/dst - for netmail)
|
||||
private array $point; // Point the message belongs to (Netmail)
|
||||
private array $netmail; // Netmail details
|
||||
|
||||
private Collection $path; // FTS-0004.001 The message PATH lines
|
||||
@ -98,6 +99,7 @@ class Message extends FTNBase
|
||||
$this->_other = collect();
|
||||
$this->unknown = collect();
|
||||
$this->zone = [];
|
||||
$this->point = [];
|
||||
|
||||
$this->header = unpack($this->unpackheader(self::header),substr($msg,0,self::HEADER_LEN));
|
||||
|
||||
@ -133,14 +135,14 @@ class Message extends FTNBase
|
||||
case 'fz': return Arr::get($this->zone,'src',0);
|
||||
case 'fn': return Arr::get($this->header,'onet');
|
||||
case 'ff': return Arr::get($this->header,'onode');
|
||||
case 'fp': return 0; // @todo
|
||||
case 'fp': return Arr::get($this->point,'src');
|
||||
|
||||
// To Addresses
|
||||
// Echomail doesnt have a zone, so we'll use the source zone
|
||||
case 'tz': return Arr::get($this->zone,$this->echoarea ? 'src' : 'dst',0);
|
||||
case 'tn': return Arr::get($this->header,'dnet');
|
||||
case 'tf': return Arr::get($this->header,'dnode');
|
||||
case 'tp': return 0; // @todo
|
||||
case 'tp': return Arr::get($this->point,'dst');
|
||||
|
||||
case 'fftn':
|
||||
case 'tftn':
|
||||
@ -347,6 +349,7 @@ class Message extends FTNBase
|
||||
}
|
||||
|
||||
$this->zone['src'] = $ftn['z'];
|
||||
$this->point['src'] = $ftn['p'];
|
||||
|
||||
// The message is the rest?
|
||||
} elseif (strlen($v) > $x+1) {
|
||||
@ -369,7 +372,7 @@ class Message extends FTNBase
|
||||
|
||||
// From point: <SOH>"FMPT <point number><CR>
|
||||
if ($t = $this->kludge('FMPT ',$v))
|
||||
$this->_other->push($t);
|
||||
$this->point['src'] = $t;
|
||||
|
||||
/*
|
||||
* The INTL control paragraph shall be used to give information about
|
||||
@ -381,7 +384,24 @@ class Message extends FTNBase
|
||||
elseif ($t = $this->kludge('INTL ',$v)) {
|
||||
$this->netmail['intl'] = $t;
|
||||
|
||||
// INTL kludge is in Netmail, so we'll do some validation:
|
||||
list($this->netmail['dst'],$this->netmail['src']) = explode(' ',$t);
|
||||
|
||||
$src = Address::parseFTN($this->netmail['src']);
|
||||
if (($src['n'] !== $this->fn) || ($src['f'] !== $this->ff)) {
|
||||
Log::error(sprintf('INTL src address [%s] doesnt match packet',$this->netmail['src']));
|
||||
} else {
|
||||
// We'll set our source zone
|
||||
$this->zone['src'] = $src['z'];
|
||||
}
|
||||
|
||||
$dst = Address::parseFTN($this->netmail['dst']);
|
||||
if (($dst['n'] !== $this->tn) || ($dst['f'] !== $this->tf)) {
|
||||
Log::error(sprintf('INTL dst address [%s] doesnt match packet',$this->netmail['dst']));
|
||||
} else {
|
||||
// We'll set our source zone
|
||||
$this->zone['dst'] = $dst['z'];
|
||||
}
|
||||
}
|
||||
|
||||
elseif ($t = $this->kludge('PATH: ',$v))
|
||||
@ -389,7 +409,7 @@ class Message extends FTNBase
|
||||
|
||||
// To Point: <SOH>TOPT <point number><CR>
|
||||
elseif ($t = $this->kludge('TOPT ',$v))
|
||||
$this->_other->push($t);
|
||||
$this->point['dst'] = $t;
|
||||
|
||||
// <SOH>Via <FTN Address> @YYYYMMDD.HHMMSS[.Precise][.Time Zone] <Program Name> <Version> [Serial Number]<CR>
|
||||
elseif ($t = $this->kludge('Via ',$v))
|
||||
|
@ -46,10 +46,10 @@ class Packet extends FTNBase
|
||||
'qozone' => [0x22,'v',2],
|
||||
'qdzone' => [0x24,'v',2],
|
||||
'filler' => [0x26,'v',2], // Reserved (auxnet 2+ - contains Orignet if Origin is a point) fsc-0048.001
|
||||
'capvalid' => [0x28,'v',2], // fsc-0039.004 (Not used 2) (copy of 0x2c)
|
||||
'capvalid' => [0x28,'n',2], // fsc-0039.004 (Not used 2) (copy of 0x2c)
|
||||
'prodcode-hi' => [0x2a,'C',1], // (Not used 2)
|
||||
'prodrev-min' => [0x2b,'C',1], // (Not used 2)
|
||||
'capword' => [0x2c,'v',1], // fsc-0039.001 (Not used 2)
|
||||
'capword' => [0x2c,'v',2], // fsc-0039.001 (Not used 2)
|
||||
'ozone' => [0x2e,'v',2], // Originating Zone (Not used 2)
|
||||
'dzone' => [0x30,'v',2], // Destination Zone (Not used 2)
|
||||
'opoint' => [0x32,'v',2], // Originating Point (Not used 2)
|
||||
@ -98,7 +98,7 @@ class Packet extends FTNBase
|
||||
);
|
||||
|
||||
case 'capability':
|
||||
return Arr::get($this->header,'capword') == Arr::get($this->header,'capword') ? sprintf('%016b',Arr::get($this->header,'capword')) : 'FTS-1';
|
||||
return Arr::get($this->header,'capword') == Arr::get($this->header,'capvalid') ? sprintf('%016b',Arr::get($this->header,'capword')) : 'FTS-1';
|
||||
|
||||
case 'password':
|
||||
return Arr::get($this->header,$key);
|
||||
|
Loading…
Reference in New Issue
Block a user