Skip to content

Commit 3cfb400

Browse files
authored
Implement STREAM FORWARD in forwardSession
1 parent 67cb501 commit 3cfb400

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

lib/SAM3.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,4 +174,24 @@ public function acceptSession( string $sessionId ):SAM3 {
174174
return $sam3;
175175
}
176176

177+
public function forwardSession( string $sessionId, int $port, string $host = null ):SAM3 {
178+
$sam3 = new SAM3( $this->samHost, $this->samPort, $this->signatureType );
179+
$sam3->connect();
180+
181+
$commandString = "STREAM FORWARD ID=" . $sessionId . " PORT=" . $port;
182+
183+
if ( !is_null( $host ) ) {
184+
$commandString .= " HOST=" . $host;
185+
}
186+
187+
$commandString .= " SILENT=false";
188+
189+
$reply = $sam3->commandSAM( $commandString );
190+
if ( $reply->getResult() === \PHP_SAM\SAMReply::REPLY_TYPE_OK ) {
191+
$sam3->sessionId = $sessionId;
192+
}
193+
194+
return $sam3;
195+
}
196+
177197
}

0 commit comments

Comments
 (0)