Revize 2007
Přidáno uživatelem Michal Kliment před více než 11 roky(ů)
freenetis/branches/1.1/application/controllers/json.php | ||
---|---|---|
$ip_address = $this->input->get('ip_address');
|
||
|
||
$ip_address_model = new Ip_address_Model();
|
||
$dhcp_device = $ip_address_model->get_gateway_of_subnet($subnet_id);
|
||
|
||
// find gateway of subnet
|
||
$gateway = $ip_address_model->get_gateway_of_subnet($subnet_id);
|
||
|
||
if ($dhcp_device && $dhcp_device->id && valid::ip($ip_address))
|
||
if ($gateway && $gateway->id && valid::ip($ip_address))
|
||
{
|
||
try
|
||
{
|
||
$snmp = Snmp_Factory::factoryForDevice($dhcp_device->ip_address);
|
||
$mac_address = $snmp->getMacAddressOf($ip_address);
|
||
$snmp = Snmp_Factory::factoryForDevice($gateway->ip_address);
|
||
|
||
// try find MAC address in DHCP
|
||
$mac_address = $snmp->getDHCPMacAddressOf($ip_address);
|
||
|
||
die(json_encode(array
|
||
(
|
||
'state' => 1,
|
||
'mac' => $mac_address
|
||
)));
|
||
}
|
||
// MAC table is not in DHCP
|
||
catch (DHCPMacAddressException $e)
|
||
{
|
||
try
|
||
{
|
||
// try find MAC address in ARP table
|
||
$mac_address = $snmp->getARPMacAddressOf($ip_address);
|
||
|
||
die(json_encode(array
|
||
(
|
||
'state' => 1,
|
||
'mac' => $mac_address
|
||
)));
|
||
}
|
||
catch(Exception $e)
|
||
{
|
||
Log::add_exception($e);
|
||
die(json_encode(array
|
||
(
|
||
'state' => 0,
|
||
'message' => $e->getMessage()
|
||
)));
|
||
}
|
||
}
|
||
catch (Exception $e)
|
||
{
|
||
Log::add_exception($e);
|
||
die(json_encode(array
|
||
(
|
||
'state' => 0,
|
||
$e->getMessage()
|
||
'message' => $e->getMessage()
|
||
)));
|
||
}
|
||
}
|
||
... | ... | |
|
||
echo json_encode($emails);
|
||
}
|
||
|
||
/**
|
||
* Callback AJAX funxtion to get device and iface to which is device connected.
|
||
*
|
||
* @author Michal Kliment
|
||
*/
|
||
public function get_connected_to_device_and_iface()
|
||
{
|
||
$subnet_id = $this->input->get('subnet_id');
|
||
$mac_address = $this->input->get('mac_address');
|
||
|
||
$port_nr = 0;
|
||
|
||
$ip_address_model = new Ip_address_Model();
|
||
|
||
// find gateway of subnet
|
||
$gateway_ip_address = $ip_address_model
|
||
->where(array
|
||
(
|
||
'subnet_id' => $subnet_id,
|
||
'gateway' => 1
|
||
))->find();
|
||
|
||
// IP is on VLAN iface => take physical (parent) interface
|
||
if ($gateway_ip_address->iface->type == Iface_Model::TYPE_VLAN)
|
||
$iface = $gateway_ip_address->iface->ifaces_relationships->current()->parent_iface;
|
||
// IP is on normal iface
|
||
else
|
||
$iface = $gateway_ip_address->iface;
|
||
|
||
$device = $iface->device;
|
||
|
||
$x = 100;
|
||
|
||
while (true)
|
||
{
|
||
$x--;
|
||
|
||
// unending loop protection
|
||
if ($x == 0)
|
||
break;
|
||
|
||
// device is not connected to any device or is not connected to any association device
|
||
if ($iface->get_iface_connected_to_iface() === NULL ||
|
||
$iface->get_iface_connected_to_iface()->device->user->member_id != Member_Model::ASSOCIATION)
|
||
{
|
||
// we end
|
||
break;
|
||
}
|
||
|
||
// take device to which is our device connected
|
||
$device = $iface->get_iface_connected_to_iface()->device;
|
||
|
||
// find IP address of device
|
||
$ip_address = $ip_address_model
|
||
->get_ip_addresses_of_device($device->id)->current();
|
||
|
||
# only for switch
|
||
if ($device->has_ports() && $ip_address)
|
||
{
|
||
$snmp = Snmp_Factory::factoryForDevice($ip_address->ip_address);
|
||
|
||
// try find port number
|
||
$port_nr = $snmp->getPortNumberOf($mac_address);
|
||
|
||
// and try find port in database
|
||
$iface = ORM::factory('iface')
|
||
->where(array
|
||
(
|
||
'type' => Iface_Model::TYPE_PORT,
|
||
'device_id' => $device->id,
|
||
'number' => $port_nr
|
||
))
|
||
->find();
|
||
}
|
||
else
|
||
{
|
||
$found = FALSE;
|
||
|
||
// for each ifaces of device
|
||
foreach ($device->ifaces as $device_iface)
|
||
{
|
||
// take first iface with unending loop detection
|
||
if ($device_iface->get_iface_connected_to_iface()
|
||
&& $device_iface->get_iface_connected_to_iface()->id != $iface->id)
|
||
{
|
||
$iface = $device_iface;
|
||
|
||
$found = TRUE;
|
||
|
||
break;
|
||
}
|
||
}
|
||
|
||
// this device has not any iface to which we can connect
|
||
if (!$found)
|
||
{
|
||
die(json_encode(array
|
||
(
|
||
'state' => 0,
|
||
'message' => __('Error - cannot find device')
|
||
)));
|
||
}
|
||
}
|
||
}
|
||
|
||
// we know port number which is not im db
|
||
if ($device->id && $port_nr && $iface->device_id != $device->id)
|
||
{
|
||
// try create it
|
||
try
|
||
{
|
||
$iface->transaction_start();
|
||
|
||
$iface->clear();
|
||
$iface->type = Iface_Model::TYPE_PORT;
|
||
$iface->device_id = $device->id;
|
||
$iface->number = $port_nr;
|
||
$iface->name = __('Port').' '.$port_nr;
|
||
$iface->save_throwable();
|
||
|
||
$iface->transaction_commit();
|
||
}
|
||
catch (Exception $e)
|
||
{
|
||
$iface->transaction_rollback();
|
||
}
|
||
}
|
||
|
||
// success, return device and iface
|
||
if ($device->id && $iface->id)
|
||
{
|
||
die(json_encode(array
|
||
(
|
||
'state' => 1,
|
||
'device_id' => $device->id,
|
||
'iface_id' => $iface->id
|
||
)));
|
||
}
|
||
// fail
|
||
else
|
||
{
|
||
die(json_encode(array
|
||
(
|
||
'state' => 0,
|
||
'message' => __('Error - cannot find device')
|
||
)));
|
||
}
|
||
}
|
||
}
|
freenetis/branches/1.1/application/helpers/callback.php | ||
---|---|---|
{
|
||
echo $item->connected_to_device_name;
|
||
}
|
||
|
||
if (Controller::instance()->acl_check_view('Ifaces_Controller', 'iface'))
|
||
{
|
||
echo " (". html::anchor(
|
||
'ifaces/show/'.$item->connected_to_iface_id,
|
||
$item->connected_to_iface_name
|
||
).")";
|
||
}
|
||
else
|
||
{
|
||
echo " (".$item->connected_to_iface_name.")";
|
||
}
|
||
}
|
||
else if (Controller::instance()->acl_check_view('Links_Controller', 'link') &&
|
||
isset($item->link_id))
|
||
... | ... | |
{
|
||
echo $connected->connected_to_device_name;
|
||
}
|
||
|
||
if (Controller::instance()->acl_check_view('Ifaces_Controller', 'iface'))
|
||
{
|
||
echo " (". html::anchor(
|
||
'ifaces/show/'.$connected->connected_to_iface_id,
|
||
$connected->connected_to_iface_name
|
||
).")";
|
||
}
|
||
else
|
||
{
|
||
echo " (".$connected->connected_to_iface_name.")";
|
||
}
|
||
}
|
||
else
|
||
{
|
freenetis/branches/1.1/application/i18n/cs_CZ/texts.php | ||
---|---|---|
'error - cannot discount private services' => 'Chyba - nemohu strhnout soukromé služby.',
|
||
'error - cannot edit interface' => 'Chyba - nemohu upravit rozhraní',
|
||
'error - cannot export invoice with no items' => 'Chyba - nelze exportovat fakturu bez položek',
|
||
'error - cannot find device' => 'Chyba - nelze nalézt zařízení',
|
||
'error - cannot load intelligent selection' => 'Chyba - nelze načíst inteligentní výběr',
|
||
'error - cannot update message' => 'Chyba - nelze upravit zprávu.',
|
||
'error - cannot recalculate fees' => 'Chyba - nelze přepočítat příspěvky.',
|
||
... | ... | |
'generate reverse dns files' => 'Generovat zpětné soubory DNS',
|
||
'generate smokeping configuration file' => 'Generovat konfigurační soubor smokepingu',
|
||
'generation of configuration files' => 'Generování konfiguračních souborů',
|
||
'get connected to device and iface' => 'Získej Připojeno k zařízení a rozhraní',
|
||
'good' => 'Dobré',
|
||
'gw' => 'sp',
|
||
'gps' => 'GPS souřadnice',
|
freenetis/branches/1.1/application/libraries/Snmp_Factory.php | ||
---|---|---|
define("SNMP_CLASS_PATH", APPPATH . 'libraries/snmp/');
|
||
|
||
require_once SNMP_CLASS_PATH . 'Abstract_Snmp.php';
|
||
require_once SNMP_CLASS_PATH . 'Mikrotik_Snmp.php';
|
||
require_once SNMP_CLASS_PATH . 'Linux_Snmp.php';
|
||
|
||
/**
|
||
* factory for creating of SNMP handlers.
|
||
... | ... | |
(
|
||
'version' => 2,
|
||
'class' => 'Linux_Snmp'
|
||
),
|
||
'edgecore' => array
|
||
(
|
||
'version' => 2,
|
||
'class' => 'Edgecore_Snmp'
|
||
),
|
||
'signamax' => array
|
||
(
|
||
'version' => 2,
|
||
'class' => 'Signamax_Snmp'
|
||
),
|
||
'signamaxold' => array
|
||
(
|
||
'version' => 2,
|
||
'class' => 'SignamaxOld_Snmp'
|
||
),
|
||
'hp' => array
|
||
(
|
||
'version' => 2,
|
||
'class' => 'HP_Snmp'
|
||
)
|
||
);
|
||
|
||
... | ... | |
{
|
||
if (array_key_exists($driver, self::$DRIVERS))
|
||
{
|
||
require_once SNMP_CLASS_PATH . self::$DRIVERS[$driver]['class'] . '.php';
|
||
return new self::$DRIVERS[$driver]['class'];
|
||
}
|
||
// driver not exists
|
freenetis/branches/1.1/application/libraries/snmp/Abstract_Snmp.php | ||
---|---|---|
*
|
||
* @var int
|
||
*/
|
||
protected $timeout = 1000000;
|
||
protected $timeout = 3000000;
|
||
|
||
/**
|
||
* The number of times to retry if timeouts occur.
|
||
... | ... | |
public abstract function isCompactibleDriverWith($device_ip);
|
||
|
||
/**
|
||
* Obtaint MAC address of a device with the given IP address.
|
||
* This function also must work even if the bridged elements occurs
|
||
* in the network (ARP tabla cannot be used).
|
||
* Obtain MAC address of a device with the given IP address from ARP table.
|
||
*
|
||
* The device IP is DHCP server for the given device IP.
|
||
* @param string $device_ip IP address of the device (we would like to know his MAC)
|
||
* @return string MAC address in format xx:xx:xx:xx:xx:xx
|
||
* @throws Exception On SNMP error or wrong SNMP response
|
||
* @throws InvalidArgumentException On wrong IP address
|
||
*/
|
||
public abstract function getARPMacAddressOf($device_ip);
|
||
|
||
/**
|
||
* Obtain MAC address of a device with the given IP address from DHCP server.
|
||
*
|
||
* @param string $device_ip IP address of the device (we would like to know his MAC)
|
||
* @return string MAC address in format xx:xx:xx:xx:xx:xx
|
||
* @throws Exception On SNMP error or wrong SNMP response
|
||
* @throws InvalidArgumentException On wrong IP address
|
||
*/
|
||
public abstract function getMacAddressOf($device_ip);
|
||
public abstract function getDHCPMacAddressOf($device_ip);
|
||
|
||
/**
|
||
* Obtaint port number with given MAC address.
|
||
*
|
||
* @param string $mac_address MAC address of the device (we would like to know to which port is connected)
|
||
* @return string MAC address in format xx:xx:xx:xx:xx:xx
|
||
* @throws Exception On SNMP error or wrong SNMP response
|
||
* @throws InvalidArgumentException On wrong IP address
|
||
*/
|
||
public abstract function getPortNumberOf($mac_address);
|
||
|
||
/**
|
||
* Gets the current number of microseconds until the first timeout.
|
||
*
|
||
* @return int
|
||
... | ... | |
}
|
||
|
||
}
|
||
|
||
class DHCPMacAddressException extends Exception
|
||
{
|
||
|
||
}
|
freenetis/branches/1.1/application/libraries/snmp/Edgecore_Snmp.php | ||
---|---|---|
<?php defined('SYSPATH') or die('No direct script access.');
|
||
/*
|
||
* This file is part of open source system FreenetIS
|
||
* and it is released under GPLv3 licence.
|
||
*
|
||
* More info about licence can be found:
|
||
* http://www.gnu.org/licenses/gpl-3.0.html
|
||
*
|
||
* More info about project can be found:
|
||
* http://www.freenetis.org/
|
||
*
|
||
*/
|
||
|
||
/**
|
||
* SNMP driver for Edgecore switches (tested on 3528M a 3510MA).
|
||
* This class MUST not be initialized directly, use Snmp_Factory!
|
||
*
|
||
* @author Michal Kliment
|
||
* @see Abstract_Snmp
|
||
*/
|
||
class Edgecore_Snmp extends Abstract_Snmp
|
||
{
|
||
|
||
/**
|
||
* Checks if the driver is compactible with the driver.
|
||
*
|
||
* @param string $device_ip Device IP address
|
||
* @return bool Is compactible?
|
||
*/
|
||
public function isCompactibleDriverWith($device_ip)
|
||
{
|
||
if (!valid::ip($device_ip))
|
||
{
|
||
throw new InvalidArgumentException('Wrong IP address of the device');
|
||
}
|
||
|
||
try
|
||
{
|
||
$this->startErrorHandler();
|
||
$row = snmp2_get(
|
||
$device_ip, $this->comunity, 'iso.3.6.1.2.1.1.1.0',
|
||
$this->timeout, $this->retries
|
||
);
|
||
$this->stopErrorHandler();
|
||
}
|
||
catch (Exception $e)
|
||
{
|
||
return FALSE;
|
||
}
|
||
|
||
// parse result
|
||
$matches = array();
|
||
|
||
if (preg_match('/STRING: "?(.*)"?/', $row, $matches) > 0)
|
||
{
|
||
return (
|
||
$matches[1] == '24/48 L2/L4 IPV4/IPV6 GE Switch' ||
|
||
$matches[1] == 'Edge-Core FE L2 Switch ES3528M' ||
|
||
$matches[1] == 'ES3528M' ||
|
||
$matches[1] == 'ES3510MA'
|
||
);
|
||
}
|
||
else
|
||
{
|
||
return FALSE;
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Obtain MAC address of a device with the given IP address from ARP table.
|
||
*
|
||
* @param string $device_ip IP address of the device (we would like to know his MAC)
|
||
* @return string MAC address in format xx:xx:xx:xx:xx:xx
|
||
* @throws Exception On SNMP error or wrong SNMP response
|
||
* @throws InvalidArgumentException On wrong IP address
|
||
*/
|
||
public function getARPMacAddressOf($device_ip)
|
||
{
|
||
// is not possible
|
||
return FALSE;
|
||
}
|
||
|
||
/**
|
||
* Obtain MAC address of a device with the given IP address from DHCP server.
|
||
*
|
||
* @param string $device_ip IP address of the device (we would like to know his MAC)
|
||
* @return string MAC address in format xx:xx:xx:xx:xx:xx
|
||
* @throws Exception On SNMP error or wrong SNMP response
|
||
* @throws InvalidArgumentException On wrong IP address
|
||
*/
|
||
public function getDHCPMacAddressOf($device_ip)
|
||
{
|
||
// is not possible
|
||
return FALSE;
|
||
}
|
||
|
||
/**
|
||
* Obtaint port number with given MAC address.
|
||
*
|
||
* @param string $mac_address MAC address of the device (we would like to know to which port is connected)
|
||
* @return string MAC address in format xx:xx:xx:xx:xx:xx
|
||
* @throws Exception On SNMP error or wrong SNMP response
|
||
* @throws InvalidArgumentException On wrong IP address
|
||
*/
|
||
public function getPortNumberOf($mac_address)
|
||
{
|
||
if (!valid::mac_address($mac_address))
|
||
{
|
||
throw new InvalidArgumentException('Wrong MAC address of the device');
|
||
}
|
||
|
||
// covert MAC address to decimal format
|
||
$dec_mac_address = implode('.', array_map('hexdec', explode(":", $mac_address)));
|
||
|
||
try
|
||
{
|
||
// obtain
|
||
$this->startErrorHandler();
|
||
$row = snmp2_get(
|
||
$this->deviceIp, $this->comunity,
|
||
'iso.3.6.1.2.1.17.4.3.1.2.' . $dec_mac_address,
|
||
$this->timeout, $this->retries
|
||
);
|
||
$this->stopErrorHandler();
|
||
}
|
||
catch (Exception $e)
|
||
{
|
||
return FALSE;
|
||
}
|
||
|
||
// parse result
|
||
$regex = '/INTEGER: ([0-9]+)/';
|
||
$matches = array();
|
||
|
||
if (preg_match($regex, $row, $matches) > 0)
|
||
{
|
||
return $matches[1];
|
||
}
|
||
else
|
||
{
|
||
throw new Exception('Invalid SMNP output during obtaning of MAC address: ' . $row);
|
||
}
|
||
}
|
||
|
||
}
|
freenetis/branches/1.1/application/libraries/snmp/HP_Snmp.php | ||
---|---|---|
<?php defined('SYSPATH') or die('No direct script access.');
|
||
/*
|
||
* This file is part of open source system FreenetIS
|
||
* and it is released under GPLv3 licence.
|
||
*
|
||
* More info about licence can be found:
|
||
* http://www.gnu.org/licenses/gpl-3.0.html
|
||
*
|
||
* More info about project can be found:
|
||
* http://www.freenetis.org/
|
||
*
|
||
*/
|
||
|
||
/**
|
||
* SNMP driver for HP switches (tested on HP5800).
|
||
* This class MUST not be initialized directly, use Snmp_Factory!
|
||
*
|
||
* @author Michal Kliment
|
||
* @see Abstract_Snmp
|
||
*/
|
||
class HP_Snmp extends Abstract_Snmp
|
||
{
|
||
|
||
/**
|
||
* Checks if the driver is compactible with the driver.
|
||
*
|
||
* @param string $device_ip Device IP address
|
||
* @return bool Is compactible?
|
||
*/
|
||
public function isCompactibleDriverWith($device_ip)
|
||
{
|
||
if (!valid::ip($device_ip))
|
||
{
|
||
throw new InvalidArgumentException('Wrong IP address of the device');
|
||
}
|
||
|
||
try
|
||
{
|
||
$this->startErrorHandler();
|
||
$row = snmp2_get(
|
||
$device_ip, $this->comunity, 'iso.3.6.1.2.1.1.1.0',
|
||
$this->timeout, $this->retries
|
||
);
|
||
$this->stopErrorHandler();
|
||
}
|
||
catch (Exception $e)
|
||
{
|
||
return FALSE;
|
||
}
|
||
|
||
// parse result
|
||
$matches = array();
|
||
|
||
if (preg_match('/STRING: "?(.*)"?/', $row, $matches) > 0)
|
||
{
|
||
return (text::starts_with($matches[1], 'HP '));
|
||
}
|
||
else
|
||
{
|
||
return FALSE;
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Obtain MAC address of a device with the given IP address from ARP table.
|
||
*
|
||
* @param string $device_ip IP address of the device (we would like to know his MAC)
|
||
* @return string MAC address in format xx:xx:xx:xx:xx:xx
|
||
* @throws Exception On SNMP error or wrong SNMP response
|
||
* @throws InvalidArgumentException On wrong IP address
|
||
*/
|
||
public function getARPMacAddressOf($device_ip)
|
||
{
|
||
/**
|
||
* @todo Do it :-)
|
||
*/
|
||
return FALSE;
|
||
}
|
||
|
||
/**
|
||
* Obtain MAC address of a device with the given IP address from DHCP server.
|
||
*
|
||
* @param string $device_ip IP address of the device (we would like to know his MAC)
|
||
* @return string MAC address in format xx:xx:xx:xx:xx:xx
|
||
* @throws Exception On SNMP error or wrong SNMP response
|
||
* @throws InvalidArgumentException On wrong IP address
|
||
*/
|
||
public function getDHCPMacAddressOf($device_ip)
|
||
{
|
||
/**
|
||
* @todo Do it :-)
|
||
*/
|
||
return FALSE;
|
||
}
|
||
|
||
/**
|
||
* Obtaint port number with given MAC address.
|
||
*
|
||
* @param string $mac_address MAC address of the device (we would like to know to which port is connected)
|
||
* @return string MAC address in format xx:xx:xx:xx:xx:xx
|
||
* @throws Exception On SNMP error or wrong SNMP response
|
||
* @throws InvalidArgumentException On wrong IP address
|
||
*/
|
||
public function getPortNumberOf($mac_address)
|
||
{
|
||
if (!valid::mac_address($mac_address))
|
||
{
|
||
throw new InvalidArgumentException('Wrong MAC address of the device');
|
||
}
|
||
|
||
// covert MAC address to decimal format
|
||
$dec_mac_address = implode('.', array_map('hexdec', explode(":", $mac_address)));
|
||
|
||
// obtain whole ARP table
|
||
$this->startErrorHandler();
|
||
$arp_table = snmp2_real_walk(
|
||
$this->deviceIp, $this->comunity, 'iso.3.6.1.2.1.17.7.1.2.2.1.2',
|
||
$this->timeout, $this->retries
|
||
);
|
||
$this->stopErrorHandler();
|
||
|
||
// parse result
|
||
$regex = '/INTEGER: ([0-9]+)/';
|
||
$matches = array();
|
||
|
||
// try find MAC address in ARP table
|
||
foreach ($arp_table as $key => $val)
|
||
{
|
||
if (text::ends_with($key, '.' . $dec_mac_address) &&
|
||
preg_match($regex, $val, $matches))
|
||
{
|
||
return $matches[1];
|
||
}
|
||
}
|
||
}
|
||
|
||
}
|
freenetis/branches/1.1/application/libraries/snmp/Linux_Snmp.php | ||
---|---|---|
class Linux_Snmp extends Abstract_Snmp
|
||
{
|
||
|
||
/**
|
||
* Checks if the driver is compactible with the driver.
|
||
*
|
||
* @param string $device_ip Device IP address
|
||
* @return bool Is compactible?
|
||
*/
|
||
public function isCompactibleDriverWith($device_ip)
|
||
{
|
||
if (!valid::ip($device_ip))
|
||
... | ... | |
}
|
||
|
||
/**
|
||
* @todo it currently using ARP table, so it does not work with bridged
|
||
* clients
|
||
* Obtain MAC address of a device with the given IP address from ARP table.
|
||
*
|
||
* @param string $device_ip IP address of the device (we would like to know his MAC)
|
||
* @return string MAC address in format xx:xx:xx:xx:xx:xx
|
||
* @throws Exception On SNMP error or wrong SNMP response
|
||
* @throws InvalidArgumentException On wrong IP address
|
||
*/
|
||
public function getMacAddressOf($device_ip)
|
||
public function getARPMacAddressOf($device_ip)
|
||
{
|
||
if (!valid::ip($device_ip))
|
||
{
|
||
... | ... | |
. ' not in ARP table on ' . $this->deviceIp);
|
||
}
|
||
|
||
/**
|
||
* Obtain MAC address of a device with the given IP address from DHCP server.
|
||
*
|
||
* @param string $device_ip IP address of the device (we would like to know his MAC)
|
||
* @return string MAC address in format xx:xx:xx:xx:xx:xx
|
||
* @throws Exception On SNMP error or wrong SNMP response
|
||
* @throws InvalidArgumentException On wrong IP address
|
||
*/
|
||
public function getDHCPMacAddressOf($device_ip)
|
||
{
|
||
if (!valid::ip($device_ip))
|
||
{
|
||
throw new InvalidArgumentException('Wrong IP address of the device');
|
||
}
|
||
|
||
try
|
||
{
|
||
// obtain
|
||
$this->startErrorHandler();
|
||
$row = snmp2_get(
|
||
$this->deviceIp, $this->comunity,
|
||
'iso.3.6.1.2.1.9999.1.1.6.4.1.8.' . $device_ip,
|
||
$this->timeout, $this->retries
|
||
);
|
||
$this->stopErrorHandler();
|
||
}
|
||
catch (Exception $e)
|
||
{
|
||
throw new DHCPMacAddressException($e->getTraceAsString());
|
||
}
|
||
|
||
// parse result
|
||
$regex = '/STRING: "(([0-9a-fA-F]{2}\s){5}[0-9a-fA-F]{2})"/';
|
||
$matches = array();
|
||
|
||
if (preg_match($regex, $row, $matches) > 0)
|
||
{
|
||
return mb_strtolower(str_replace(' ', ':', $matches[1]));
|
||
}
|
||
else
|
||
{
|
||
throw new DHCPMacAddressException('Invalid SMNP output during obtaning of MAC address: ' . $row);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Obtaint port number with given MAC address.
|
||
*
|
||
* @param string $mac_address MAC address of the device (we would like to know to which port is connected)
|
||
* @return string MAC address in format xx:xx:xx:xx:xx:xx
|
||
* @throws Exception On SNMP error or wrong SNMP response
|
||
* @throws InvalidArgumentException On wrong IP address
|
||
*/
|
||
public function getPortNumberOf($mac_address)
|
||
{
|
||
// is not possible
|
||
return FALSE;
|
||
}
|
||
|
||
}
|
freenetis/branches/1.1/application/libraries/snmp/Mikrotik_Snmp.php | ||
---|---|---|
class Mikrotik_Snmp extends Abstract_Snmp
|
||
{
|
||
|
||
/**
|
||
* Checks if the driver is compactible with the driver.
|
||
*
|
||
* @param string $device_ip Device IP address
|
||
* @return bool Is compactible?
|
||
*/
|
||
public function isCompactibleDriverWith($device_ip)
|
||
{
|
||
if (!valid::ip($device_ip))
|
||
... | ... | |
if (preg_match('/STRING: "?(.*)"?/', $row, $matches) > 0)
|
||
{
|
||
return (
|
||
text::starts_with($matches[1], 'RouterOS') || // RouterOS > 3.2.3
|
||
$matches[1] == 'router' // RouterOS 3.2.3
|
||
text::starts_with($matches[1], 'RouterOS') // RouterOS > 4.10
|
||
);
|
||
}
|
||
else
|
||
... | ... | |
}
|
||
}
|
||
|
||
public function getMacAddressOf($device_ip)
|
||
/**
|
||
* Obtain MAC address of a device with the given IP address from ARP table.
|
||
*
|
||
* @param string $device_ip IP address of the device (we would like to know his MAC)
|
||
* @return string MAC address in format xx:xx:xx:xx:xx:xx
|
||
* @throws Exception On SNMP error or wrong SNMP response
|
||
* @throws InvalidArgumentException On wrong IP address
|
||
*/
|
||
public function getARPMacAddressOf($device_ip)
|
||
{
|
||
if (!valid::ip($device_ip))
|
||
{
|
||
throw new InvalidArgumentException('Wrong IP address of the device');
|
||
}
|
||
|
||
// obtain
|
||
|
||
// obtain whole ARP table
|
||
$this->startErrorHandler();
|
||
$row = snmp2_get(
|
||
$arp_table = snmp2_real_walk(
|
||
$this->deviceIp, $this->comunity,
|
||
'iso.3.6.1.2.1.9999.1.1.6.4.1.8.' . $device_ip,
|
||
'iso.3.6.1.2.1.4.22.1.2',
|
||
$this->timeout, $this->retries
|
||
);
|
||
$this->stopErrorHandler();
|
||
|
||
// parse result
|
||
$regex = '/STRING: (([0-9a-fA-F]{1,2}:){5}[0-9a-fA-F]{1,2})/';
|
||
$matches = array();
|
||
|
||
// try find MAC address in ARP table
|
||
foreach ($arp_table as $key => $val)
|
||
{
|
||
if (text::ends_with($key, '.' . $device_ip)
|
||
&& preg_match($regex, $val, $matches))
|
||
{
|
||
$pieces = array();
|
||
foreach (explode(':', $matches[1]) as $piece)
|
||
$pieces[] = num::null_fill($piece, 2);
|
||
|
||
return implode(':', $pieces);
|
||
}
|
||
}
|
||
|
||
throw new Exception('Given IP address ' . $device_ip
|
||
. ' not in ARP table on ' . $this->deviceIp);
|
||
}
|
||
|
||
/**
|
||
* Obtain MAC address of a device with the given IP address from DHCP server.
|
||
*
|
||
* @param string $device_ip IP address of the device (we would like to know his MAC)
|
||
* @return string MAC address in format xx:xx:xx:xx:xx:xx
|
||
* @throws Exception On SNMP error or wrong SNMP response
|
||
* @throws InvalidArgumentException On wrong IP address
|
||
*/
|
||
public function getDHCPMacAddressOf($device_ip)
|
||
{
|
||
if (!valid::ip($device_ip))
|
||
{
|
||
throw new InvalidArgumentException('Wrong IP address of the device');
|
||
}
|
||
|
||
try
|
||
{
|
||
// obtain
|
||
$this->startErrorHandler();
|
||
$row = snmp2_get(
|
||
$this->deviceIp, $this->comunity,
|
||
'iso.3.6.1.2.1.9999.1.1.6.4.1.8.' . $device_ip,
|
||
$this->timeout, $this->retries
|
||
);
|
||
$this->stopErrorHandler();
|
||
}
|
||
catch (Exception $e)
|
||
{
|
||
throw new DHCPMacAddressException($e->getTraceAsString());
|
||
}
|
||
|
||
// parse result
|
||
$regex = '/Hex-STRING: (([0-9a-fA-F]{2}\s){5}[0-9a-fA-F]{2})/';
|
||
$matches = array();
|
||
|
||
... | ... | |
}
|
||
else
|
||
{
|
||
throw new Exception('Invalid SMNP output during obtaning of MAC address: ' . $row);
|
||
throw new DHCPMacAddressException('Invalid SMNP output during obtaning of MAC address: ' . $row);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Obtaint port number with given MAC address.
|
||
*
|
||
* @param string $mac_address MAC address of the device (we would like to know to which port is connected)
|
||
* @return string MAC address in format xx:xx:xx:xx:xx:xx
|
||
* @throws Exception On SNMP error or wrong SNMP response
|
||
* @throws InvalidArgumentException On wrong IP address
|
||
*/
|
||
public function getPortNumberOf($mac_address)
|
||
{
|
||
// is not possible
|
||
return FALSE;
|
||
}
|
||
|
||
}
|
freenetis/branches/1.1/application/libraries/snmp/SignamaxOld_Snmp.php | ||
---|---|---|
<?php defined('SYSPATH') or die('No direct script access.');
|
||
/*
|
||
* This file is part of open source system FreenetIS
|
||
* and it is released under GPLv3 licence.
|
||
*
|
||
* More info about licence can be found:
|
||
* http://www.gnu.org/licenses/gpl-3.0.html
|
||
*
|
||
* More info about project can be found:
|
||
* http://www.freenetis.org/
|
||
*
|
||
*/
|
||
|
||
/**
|
||
* SNMP driver for Signamax switches with older firmware versions.
|
||
* This class MUST not be initialized directly, use Snmp_Factory!
|
||
*
|
||
* @author Michal Kliment
|
||
* @see Abstract_Snmp
|
||
*/
|
||
class SignamaxOld_Snmp extends Abstract_Snmp
|
||
{
|
||
|
||
/**
|
||
* Checks if the driver is compactible with the driver.
|
||
*
|
||
* @param string $device_ip Device IP address
|
||
* @return bool Is compactible?
|
||
*/
|
||
public function isCompactibleDriverWith($device_ip)
|
||
{
|
||
if (!valid::ip($device_ip))
|
||
{
|
||
throw new InvalidArgumentException('Wrong IP address of the device');
|
||
}
|
||
|
||
try
|
||
{
|
||
$this->startErrorHandler();
|
||
$row = snmp2_get(
|
||
$device_ip, $this->comunity, 'iso.3.6.1.2.1.1.5.0',
|
||
$this->timeout, $this->retries
|
||
);
|
||
$this->stopErrorHandler();
|
||
}
|
||
catch (Exception $e)
|
||
{
|
||
return FALSE;
|
||
}
|
||
|
||
// parse result
|
||
$matches = array();
|
||
|
||
if (preg_match('/STRING: "?(.*)"?/', $row, $matches) > 0)
|
||
{
|
||
return (
|
||
$matches[1] == '065-7850' ||
|
||
$matches[1] == '065-7710'
|
||
);
|
||
}
|
||
else
|
||
{
|
||
return FALSE;
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Obtain MAC address of a device with the given IP address from ARP table.
|
||
*
|
||
* @param string $device_ip IP address of the device (we would like to know his MAC)
|
||
* @return string MAC address in format xx:xx:xx:xx:xx:xx
|
||
* @throws Exception On SNMP error or wrong SNMP response
|
||
* @throws InvalidArgumentException On wrong IP address
|
||
*/
|
||
public function getARPMacAddressOf($device_ip)
|
||
{
|
||
// is not possible
|
||
return FALSE;
|
||
}
|
||
|
||
/**
|
||
* Obtain MAC address of a device with the given IP address from DHCP server.
|
||
*
|
||
* @param string $device_ip IP address of the device (we would like to know his MAC)
|
||
* @return string MAC address in format xx:xx:xx:xx:xx:xx
|
||
* @throws Exception On SNMP error or wrong SNMP response
|
||
* @throws InvalidArgumentException On wrong IP address
|
||
*/
|
||
public function getDHCPMacAddressOf($device_ip)
|
||
{
|
||
// is not possible
|
||
return FALSE;
|
||
}
|
||
|
||
/**
|
||
* Obtaint port number with given MAC address.
|
||
*
|
||
* @param string $mac_address MAC address of the device (we would like to know to which port is connected)
|
||
* @return string MAC address in format xx:xx:xx:xx:xx:xx
|
||
* @throws Exception On SNMP error or wrong SNMP response
|
||
* @throws InvalidArgumentException On wrong IP address
|
||
*/
|
||
public function getPortNumberOf($mac_address)
|
||
{
|
||
if (!valid::mac_address($mac_address))
|
||
{
|
||
throw new InvalidArgumentException('Wrong MAC address of the device');
|
||
}
|
||
|
||
// covert MAC address to decimal format
|
||
$dec_mac_address = implode('.', array_map('hexdec', explode(":", $mac_address)));
|
||
|
||
try
|
||
{
|
||
// obtain
|
||
$this->startErrorHandler();
|
||
$row = snmp2_get(
|
||
$this->deviceIp, $this->comunity,
|
||
'iso.3.6.1.2.1.17.4.3.1.2.' . $dec_mac_address,
|
||
$this->timeout, $this->retries
|
||
);
|
||
$this->stopErrorHandler();
|
||
}
|
||
catch (Exception $e)
|
||
{
|
||
return FALSE;
|
||
}
|
||
|
||
// parse result
|
||
$regex = '/INTEGER: ([0-9]+)/';
|
||
$matches = array();
|
||
|
||
if (preg_match($regex, $row, $matches) > 0)
|
||
{
|
||
return $matches[1];
|
||
}
|
||
else
|
||
{
|
||
throw new Exception('Invalid SMNP output during obtaning of MAC address: ' . $row);
|
||
}
|
||
}
|
||
|
||
}
|
freenetis/branches/1.1/application/libraries/snmp/Signamax_Snmp.php | ||
---|---|---|
<?php defined('SYSPATH') or die('No direct script access.');
|
||
/*
|
||
* This file is part of open source system FreenetIS
|
||
* and it is released under GPLv3 licence.
|
||
*
|
||
* More info about licence can be found:
|
||
* http://www.gnu.org/licenses/gpl-3.0.html
|
||
*
|
||
* More info about project can be found:
|
||
* http://www.freenetis.org/
|
||
*
|
||
*/
|
||
|
||
/**
|
||
* SNMP driver for Signamax switches with newer firmware versions.
|
||
* This class MUST not be initialized directly, use Snmp_Factory!
|
||
*
|
||
* @author Michal Kliment
|
||
* @see Abstract_Snmp
|
||
*/
|
||
class Signamax_Snmp extends Abstract_Snmp
|
||
{
|
||
|
||
/**
|
||
* Checks if the driver is compactible with the driver.
|
||
*
|
||
* @param string $device_ip Device IP address
|
||
* @return bool Is compactible?
|
||
*/
|
||
public function isCompactibleDriverWith($device_ip)
|
||
{
|
||
if (!valid::ip($device_ip))
|
||
{
|
||
throw new InvalidArgumentException('Wrong IP address of the device');
|
||
}
|
||
|
||
try
|
||
{
|
||
$this->startErrorHandler();
|
||
$row = snmp2_get(
|
||
$device_ip, $this->comunity, 'iso.3.6.1.2.1.1.5.0',
|
||
$this->timeout, $this->retries
|
||
);
|
||
$this->stopErrorHandler();
|
||
}
|
||
catch (Exception $e)
|
||
{
|
||
return FALSE;
|
||
}
|
||
|
||
// parse result
|
||
$matches = array();
|
||
|
||
if (preg_match('/STRING: "?(.*)"?/', $row, $matches) > 0)
|
||
{
|
||
return ($matches[1] == '065-7851' || $matches[1] == '300-7851');
|
||
}
|
||
else
|
||
{
|
||
return FALSE;
|
||
}
|
||
}
|
||
|
||
/**
|
||
* Obtain MAC address of a device with the given IP address from ARP table.
|
||
*
|
||
* @param string $device_ip IP address of the device (we would like to know his MAC)
|
||
* @return string MAC address in format xx:xx:xx:xx:xx:xx
|
||
* @throws Exception On SNMP error or wrong SNMP response
|
||
* @throws InvalidArgumentException On wrong IP address
|
||
*/
|
||
public function getARPMacAddressOf($device_ip)
|
||
{
|
||
// is not possible
|
||
return FALSE;
|
||
}
|
||
|
||
/**
|
||
* Obtain MAC address of a device with the given IP address from DHCP server.
|
||
*
|
||
* @param string $device_ip IP address of the device (we would like to know his MAC)
|
||
* @return string MAC address in format xx:xx:xx:xx:xx:xx
|
||
* @throws Exception On SNMP error or wrong SNMP response
|
||
* @throws InvalidArgumentException On wrong IP address
|
||
*/
|
||
public function getDHCPMacAddressOf($device_ip)
|
||
{
|
||
// is not possible
|
||
return FALSE;
|
||
}
|
||
|
||
/**
|
||
* Obtaint port number with given MAC address.
|
||
*
|
||
* @param string $mac_address MAC address of the device (we would like to know to which port is connected)
|
||
* @return string MAC address in format xx:xx:xx:xx:xx:xx
|
||
* @throws Exception On SNMP error or wrong SNMP response
|
||
* @throws InvalidArgumentException On wrong IP address
|
||
*/
|
||
public function getPortNumberOf($mac_address)
|
||
{
|
||
if (!valid::mac_address($mac_address))
|
||
{
|
||
throw new InvalidArgumentException('Wrong MAC address of the device');
|
||
}
|
||
|
||
// covert MAC address to decimal format
|
||
$dec_mac_address = implode('.', array_map('hexdec', explode(":", $mac_address)));
|
||
|
||
// obtain whole ARP table
|
||
$this->startErrorHandler();
|
||
$arp_table = snmp2_real_walk(
|
||
$this->deviceIp, $this->comunity, 'iso.3.6.1.2.1.17.7.1.2.2.1.2',
|
||
$this->timeout, $this->retries
|
||
);
|
||
$this->stopErrorHandler();
|
||
|
||
// parse result
|
||
$regex = '/INTEGER: ([0-9]+)/';
|
||
$matches = array();
|
||
|
||
// try find MAC address in ARP table
|
||
foreach ($arp_table as $key => $val)
|
||
{
|
||
if (text::ends_with($key, '.' . $dec_mac_address) &&
|
||
preg_match($regex, $val, $matches))
|
||
{
|
||
return $matches[1];
|
||
}
|
||
}
|
||
}
|
||
|
||
}
|
freenetis/branches/1.1/application/models/device.php | ||
---|---|---|
SELECT
|
||
cd.id AS connected_to_device_id,
|
||
cd.name AS connected_to_device_name,
|
||
ci.id AS connected_to_iface_id,
|
||
ci.name AS connected_to_iface_name,
|
||
IFNULL(COUNT(DISTINCT cd.id), 0) AS connected_to_devices_count,
|
||
GROUP_CONCAT(DISTINCT cd.name SEPARATOR ', \\n') AS connected_to_devices
|
||
FROM devices d
|
||
... | ... | |
}
|
||
|
||
/**
|
||
* Test whether device has any ports
|
||
*
|
||
* @author Michal Kliment
|
||
* @param type $device_id
|
||
* @return type
|
||
*/
|
||
public function has_ports($device_id = null)
|
||
{
|
||
if ($device_id === NULL && isset($this) && $this->id)
|
||
{
|
||
$device_id = $this->id;
|
||
}
|
||
|
||
$result = $this->db->query("
|
||
SELECT COUNT(*) AS count
|
||
FROM ifaces i
|
||
WHERE i.device_id = ? AND i.type = ?
|
||
", $device_id, Iface_Model::TYPE_PORT);
|
||
|
||
return ($result && $result->current() && $result->current()->count);
|
||
}
|
||
|
||
/**
|
||
* Returns full export of device as object
|
||
*
|
||
* @author Michal Kliment <kliment@freenetis.org>
|
freenetis/branches/1.1/application/models/iface.php | ||
---|---|---|
SELECT
|
||
i.id, i.id AS iface_id, i.link_id, l.name AS link_name,
|
||
i.mac, i.name, i.comment, i.type, i.number, i.port_mode, l.bitrate,
|
||
ci.id AS connected_to_iface_id, ci.name AS connected_to_iface_name,
|
||
cd.id AS connected_to_device_id, cd.name AS connected_to_device_name,
|
||
COUNT(DISTINCT cd.id) AS connected_to_devices_count,
|
||
GROUP_CONCAT(DISTINCT cd.name SEPARATOR ', \\n') AS connected_to_devices,
|
||
... | ... | |
wi.id, wi.name, wi.mac, wi.link_id, l.name AS link_name,
|
||
l.wireless_ssid, wi.wireless_mode, wi.type,
|
||
cd.id AS connected_to_device_id, cd.name AS connected_to_device_name,
|
||
ci.id AS connected_to_iface_id, ci.name AS connected_to_iface_name,
|
||
COUNT(*) AS connected_to_devices_count,
|
||
GROUP_CONCAT(cd.name SEPARATOR ', \\n') AS connected_to_devices
|
||
FROM ifaces wi
|
freenetis/branches/1.1/application/views/js/base.php | ||
---|---|---|
if (data.html() != null)
|
||
$(element).html(data.html());
|
||
|
||
// jQuery tabs
|
||
$('#tabs, .tabs').tabs();
|
||
|
||
//console.log($(element).html());
|
||
}
|
||
});
|
freenetis/branches/1.1/application/views/js/devices_add.php | ||
---|---|---|
}
|
||
|
||
/**
|
||
* Try find device and iface to which is device connected
|
||
*
|
||
* @author Michal Kliment
|
||
*/
|
||
function get_connected_to_device_and_iface()
|
||
{
|
||
var $this = $(this);
|
||
var $img = $this.find('img');
|
||
var loader = '<?php echo url::base() ?>media/images/icons/animations/ajax-loader.gif';
|
||
|
||
if ($img.attr('src') == loader)
|
||
return false; // waiting
|
||
|
||
var index = $this.parent().prev().prev().find('input[type="text"]').attr('name').substr('mac'.length);
|
||
|
||
var mac_address = $('input[name="mac' + index + '"]').val();
|
||
var subnet_id = $('select[name="subnet' + index + '"]').val();
|
||
|
||
if (mac_address != '' && subnet_id)
|
||
{
|
||
var oldSrc = $this.find('img').attr('src');
|
||
$img.attr('src', loader);
|
||
|
||
$.getJSON('<?php echo url_lang::base() ?>/json/get_connected_to_device_and_iface/', {mac_address:mac_address,subnet_id:subnet_id}, function (data)
|
||
{
|
||
if (data.state)
|
||
{
|
||
$('select[name="connected' + index + '"] option[value="'+data.device_id+'"]').attr("selected", true);
|
||
$('select[name="connected' + index + '"]').trigger('change');
|
||
|
||
$('select[name="connected_iface' + index + '"] option[value="'+data.iface_id+'"]').attr("selected", true);
|
||
$('select[name="connected_iface' + index + '"]').trigger('change');
|
||
}
|
||
else
|
||
{
|
||
alert (data.message);
|
||
}
|
||
});
|
||
|
||
$img.attr('src', oldSrc);
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
/**
|
||
* Opens dialog for specifing of details of link of iface. Data are stored
|
||
* in hidden fields.
|
||
*/
|
||
... | ... | |
*/
|
||
function change_connected(event, iface_id)
|
||
{
|
||
$.ajaxSetup({
|
||
async: false
|
||
});
|
||
|
||
var $eif = $(this).parent().find('select[name^="connected_iface["]');
|
||
var $ety = $(this).parent().parent().find('input[name^="type["]');
|
||
|
||
... | ... | |
|
||
$eif.html(options.join('')).trigger('change');
|
||
});
|
||
|
||
$.ajaxSetup({
|
||
async: true
|
||
});
|
||
}
|
||
|
||
/**
|
||
... | ... | |
*/
|
||
function use_row()
|
||
{
|
||
var mac = $(this).parent().parent().find('input[name^="mac["]').val();
|
||
var subnet = $(this).parent().parent().find('select[name^="subnet["]').val();
|
||
|
||
$(this).parent().parent().find('.get_connected_to_device_and_iface').toggle(mac != '' && subnet != '')
|
||
|
||
$(this).parent().parent().find('input[name^="use["]')
|
||
.attr('checked', true).trigger('change');
|
||
}
|
||
... | ... | |
if (!auto_fill) // auto loading of MAC addresses
|
||
{
|
||
html_buffer.push('<a href="#" title="<?php echo __('Automatically load mac address') ?>" class="device_add_detail_button load_mac" style="display:none">');
|
||
html_buffer.push('<?php echo html::image(array('src' => 'media/images/icons/refresh.gif')) ?>');
|
||
html_buffer.push('<?php echo html::image(array('src' => 'media/images/icons/reload.gif')) ?>');
|
||
html_buffer.push('</a>');
|
||
}
|
||
}
|
||
... | ... | |
html_buffer.push('<?php echo html::image(array('src' => 'media/images/icons/ico_add.gif', 'style' => 'width:10px;height:10px')) ?>');
|
||
html_buffer.push('</a>');
|
||
html_buffer.push('<a href="#" class="device_add_detail_button refresh_ifaces dispNone" title="<?php echo __('Refresh interfaces of device') ?>">');
|
||
html_buffer.push('<?php echo html::image(array('src' => 'media/images/icons/refresh.gif')) ?>');
|
||
html_buffer.push('<?php echo html::image(array('src' => 'media/images/icons/refresh.png')) ?>');
|
||
html_buffer.push('</a>');
|
||
html_buffer.push('<a href="#" class="device_add_detail_button get_connected_to_device_and_iface dispNone" title="<?php echo __('Get Connected to device and iface') ?>">');
|
||
html_buffer.push('<?php echo html::image(array('src' => 'media/images/icons/reload.gif')) ?>');
|
||
html_buffer.push('</a>');
|
||
html_buffer.push('<a href="#" class="device_add_detail_button add_detail_to_link" title="<?php echo __('Add details to link') ?>">');
|
||
html_buffer.push('<?php echo html::image(array('src' => 'media/images/icons/settings.gif')) ?>');
|
||
html_buffer.push('</a><br />');
|
||
... | ... | |
// activate all actions and events
|
||
$('.add_detail_to_iface').click(add_detail_to_iface);
|
||
$('.add_detail_to_ip').click(add_detail_to_ip);
|
||
$('.get_connected_to_device_and_iface').click(get_connected_to_device_and_iface);
|
||
$('.add_detail_to_link').click(add_detail_to_link);
|
||
$('.a_filter_devices').click(filter_devices);
|
||
$('.refresh_ifaces').click(refresh_ifaces);
|
||
... | ... | |
if (data.state)
|
||
{
|
||
$('input[name="mac' + index + '"]').val(data.mac);
|
||
$('input[name="mac' + index + '"]').trigger('change');
|
||
$this.hide();
|
||
}
|
||
else
|
||
... | ... | |
// confirm first part of form after loading
|
||
$('#device_add_form').submit();
|
||
<?php endif ?>
|
||
|
||
|
||
/*$.ajaxSetup({
|
||
async: true
|
||
});*/
|
freenetis/branches/1.1/system/libraries/drivers/Database.php | ||
---|---|---|
// added for suport of GPS -->
|
||
'point' => array('type' => 'string', 'binary' => TRUE),
|
||
'linestring' => array('type' => 'string', 'binary' => TRUE),
|
||
'polygon' => array('type' => 'string', 'binary' => TRUE)
|
||
'polygon' => array('type' => 'string', 'binary' => TRUE),
|
||
'geometry' => array('type' => 'string', 'binary' => TRUE),
|
||
// <-- added for suport of GPS
|
||
);
|
||
|
Také k dispozici: Unified diff
Upravy:
- fixes #651: Automaticke ziskavani Pripojeno k zarizeni a rozhrani u pridavani zarizeni
Novinky:
- SNMP knihovny pro switche EdgeCore, Signamax a HP
- funkce pro zjisteni MAC adresy rozdelena na zjisteni z ARP a DHCP