Getting out of IAC mode
This commit is contained in:
parent
dd04872c1d
commit
ae9445aa33
@ -943,82 +943,87 @@ final class EMSI extends BaseProtocol implements CRCInterface,ZmodemInterface
|
||||
$iaccmd = NULL;
|
||||
// Peek for the next 2 chars
|
||||
do {
|
||||
$iac = $this->client->read(10,1,MSG_PEEK);
|
||||
Log::debug(sprintf('%s: - IAC LOOP',self::LOGKEY),['iac'=>ord($iac),'cmd'=>$iaccmd]);
|
||||
try {
|
||||
$iac = $this->client->read(1,1,MSG_PEEK);
|
||||
Log::debug(sprintf('%s: - IAC LOOP',self::LOGKEY),['iac'=>ord($iac),'cmd'=>$iaccmd]);
|
||||
|
||||
switch (ord($iac)) {
|
||||
// Binary Mode
|
||||
case 0x00:
|
||||
if ($iaccmd === 0xfb) {
|
||||
Log::debug(sprintf('%s: - IAC WILL BINARY [%02x]',self::LOGKEY,ord($iac)));
|
||||
switch (ord($iac)) {
|
||||
// Binary Mode
|
||||
case 0x00:
|
||||
if ($iaccmd === 0xfb) {
|
||||
Log::debug(sprintf('%s: - IAC WILL BINARY [%02x]',self::LOGKEY,ord($iac)));
|
||||
|
||||
// Config with DO
|
||||
//$this->client->send(chr(0xff).chr(0xfd).$iac,10);
|
||||
// Config with DO
|
||||
//$this->client->send(chr(0xff).chr(0xfd).$iac,10);
|
||||
|
||||
} elseif ($iaccmd === 0xfd) {
|
||||
Log::debug(sprintf('%s: - IAC DO BINARY [%02x]',self::LOGKEY,ord($iac)));
|
||||
} elseif ($iaccmd === 0xfd) {
|
||||
Log::debug(sprintf('%s: - IAC DO BINARY [%02x]',self::LOGKEY,ord($iac)));
|
||||
|
||||
// Config with WILL
|
||||
if ($this->client->iac_bin) {
|
||||
$this->client->send(chr(0xff).chr(0xfb).$iac,10);
|
||||
$this->client->iac_bin = true;
|
||||
// Config with WILL
|
||||
if ($this->client->iac_bin) {
|
||||
$this->client->send(chr(0xff).chr(0xfb).$iac,10);
|
||||
$this->client->iac_bin = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$iaccmd = NULL;
|
||||
break;
|
||||
$iaccmd = NULL;
|
||||
break;
|
||||
|
||||
// Suppress Go Ahead
|
||||
case 0x03:
|
||||
if ($iaccmd === 0xfb) {
|
||||
Log::debug(sprintf('%s: - IAC WILL SUPPRESS-GO-AHEAD [%02x]',self::LOGKEY,ord($iac)));
|
||||
// Suppress Go Ahead
|
||||
case 0x03:
|
||||
if ($iaccmd === 0xfb) {
|
||||
Log::debug(sprintf('%s: - IAC WILL SUPPRESS-GO-AHEAD [%02x]',self::LOGKEY,ord($iac)));
|
||||
|
||||
// Config with DO
|
||||
//$this->client->send(chr(0xff).chr(0xfd).$iac,10);
|
||||
// Config with DO
|
||||
//$this->client->send(chr(0xff).chr(0xfd).$iac,10);
|
||||
|
||||
} elseif ($iaccmd === 0xfd) {
|
||||
Log::debug(sprintf('%s: - IAC DO SUPPRESS-GO-AHEAD [%02x]',self::LOGKEY,ord($iac)));
|
||||
} elseif ($iaccmd === 0xfd) {
|
||||
Log::debug(sprintf('%s: - IAC DO SUPPRESS-GO-AHEAD [%02x]',self::LOGKEY,ord($iac)));
|
||||
|
||||
// Config with WILL
|
||||
$this->client->send(chr(0xff).chr(0xfb).$iac,10);
|
||||
}
|
||||
// Config with WILL
|
||||
$this->client->send(chr(0xff).chr(0xfb).$iac,10);
|
||||
}
|
||||
|
||||
$iaccmd = NULL;
|
||||
break;
|
||||
$iaccmd = NULL;
|
||||
break;
|
||||
|
||||
// Will
|
||||
case 0xfb:
|
||||
Log::debug(sprintf('%s: - IAC WILL [%02x]',self::LOGKEY,ord($iac)));
|
||||
$iaccmd = ord($iac);
|
||||
break;
|
||||
// Will
|
||||
case 0xfb:
|
||||
Log::debug(sprintf('%s: - IAC WILL [%02x]',self::LOGKEY,ord($iac)));
|
||||
$iaccmd = ord($iac);
|
||||
break;
|
||||
|
||||
// Do
|
||||
case 0xfd:
|
||||
Log::debug(sprintf('%s: - IAC DO [%02x]',self::LOGKEY,ord($iac)));
|
||||
$iaccmd = ord($iac);
|
||||
break;
|
||||
// Do
|
||||
case 0xfd:
|
||||
Log::debug(sprintf('%s: - IAC DO [%02x]',self::LOGKEY,ord($iac)));
|
||||
$iaccmd = ord($iac);
|
||||
break;
|
||||
|
||||
// IAC
|
||||
case 0xff:
|
||||
Log::debug(sprintf('%s: - IAC [%02x]',self::LOGKEY,ord($iac)));
|
||||
$iaccmd = ord($iac);
|
||||
break;
|
||||
// IAC
|
||||
case 0xff:
|
||||
Log::debug(sprintf('%s: - IAC [%02x]',self::LOGKEY,ord($iac)));
|
||||
$iaccmd = ord($iac);
|
||||
break;
|
||||
|
||||
default:
|
||||
Log::debug(sprintf('%s: - IAC Unhandled [%02x]',self::LOGKEY,ord($iac)),['iac'=>$iac,'iaccmd'=>$iaccmd,'ch'=>ord($iac)]);
|
||||
default:
|
||||
Log::debug(sprintf('%s: - IAC Unhandled [%02x]',self::LOGKEY,ord($iac)),['iac'=>$iac,'iaccmd'=>$iaccmd,'ch'=>ord($iac)]);
|
||||
|
||||
$ch = ord($iac);
|
||||
$iac = NULL;
|
||||
$ch = ord($iac);
|
||||
$iac = NULL;
|
||||
}
|
||||
|
||||
if ($iaccmd) {
|
||||
$iac = ord($this->client->read_ch(10));
|
||||
$ch = NULL;
|
||||
|
||||
} elseif (is_null($ch)) {
|
||||
$ch = ord($this->client->read_ch(10));
|
||||
}
|
||||
|
||||
} catch (SocketException $e) {
|
||||
Log::debug(sprintf('%s:! SocketException: %s',self::LOGKEY,$e->getMessage()),['class'=>get_class($e),'code'=>$e->getCode()]);
|
||||
$iac = NULL;
|
||||
}
|
||||
|
||||
if ($iaccmd) {
|
||||
$iac = ord($this->client->read_ch(10));
|
||||
$ch = NULL;
|
||||
|
||||
} elseif (is_null($ch)) {
|
||||
$ch = ord($this->client->read_ch(10));
|
||||
}
|
||||
|
||||
} while (! is_null($iac));
|
||||
|
||||
Log::debug(sprintf('%s:- Leaving IAC with [%02x]',self::LOGKEY,$ch),['ch'=>serialize($ch)]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user