Upgraded Net_Routeros to dev version
This commit is contained in:
@@ -9,6 +9,6 @@
|
|||||||
"phpseclib/phpseclib": "^3.0",
|
"phpseclib/phpseclib": "^3.0",
|
||||||
"stomp-php/stomp-php": "^5",
|
"stomp-php/stomp-php": "^5",
|
||||||
"phpmailer/phpmailer": "^6.9",
|
"phpmailer/phpmailer": "^6.9",
|
||||||
"pear2/net_routeros": "*@beta"
|
"pear2/net_routeros": "dev-develop@dev"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,31 +1,37 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use PEAR2\Net\RouterOS;
|
use PEAR2\Net\RouterOS;
|
||||||
|
use PEAR2\Net\Transmitter\NetworkStream;
|
||||||
|
|
||||||
require __DIR__."/mfRouteros_Item.php";
|
require __DIR__."/mfRouteros_Item.php";
|
||||||
|
|
||||||
class mfRouteros extends mfBaseModel {
|
class mfRouteros {
|
||||||
|
|
||||||
private $hostname;
|
private $hostname;
|
||||||
|
private $port;
|
||||||
|
private $use_ssl;
|
||||||
private $username;
|
private $username;
|
||||||
private $password;
|
private $password;
|
||||||
private $ros = false;
|
private $ros = false;
|
||||||
|
|
||||||
protected function init() {
|
public function __construct($hostname, $username, $password, $port = 8729, $use_ssl = true) {
|
||||||
if(defined("MFROS_HOSTNAME")) {
|
$this->hostname = $hostname;
|
||||||
$this->hostname(MFROS_HOSTNAME);
|
$this->username = $username;
|
||||||
}
|
$this->password = $password;
|
||||||
if(defined("MFROS_USERNAME")) {
|
|
||||||
$this->username(MFROS_USERNAME);
|
$this->port = $port;
|
||||||
}
|
$this->use_ssl = $use_ssl;
|
||||||
if(defined("MFROS_PASSWORD")) {
|
|
||||||
$this->password(MFROS_PASSWORD);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function _connect() {
|
private function _connect() {
|
||||||
$this->ros = new RouterOS\Client($this->hostname,$this->username,$this->password,8729,false,3);
|
$crypto = NetworkStream::CRYPTO_OFF;
|
||||||
|
if($this->use_ssl) {
|
||||||
|
$crypto = NetworkStream::CRYPTO_TLS;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->ros = new RouterOS\Client($this->hostname,$this->username,$this->password,$this->port,false,3, $crypto);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get($table, $filter = array()) {
|
public function get($table, $filter = array()) {
|
||||||
if(!$this->ros) $this->_connect();
|
if(!$this->ros) $this->_connect();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user