FreenetIS
 All Classes Namespaces Functions Variables Pages
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | List of all members
Iface_Model Class Reference
Inheritance diagram for Iface_Model:
ORM

Public Member Functions

 __toString ()
 Returns name or MAC address of device.
 is_mac_unique ($iface_id, $mac)
 Checks whether the given new MAC of the given iface is unique in all subnets that are in relation with the iface over his IP addresses.
 count_ifaces_of_device ($device_id)
 Get count of ifaces of device.
 get_all_ifaces ($limit_from=0, $limit_results=20, $order_by= 'id', $order_by_direction= 'asc', $filter_sql= '')
 Function gets all interfaces.
 count_all_ifaces ($filter_sql= '')
 Function counts all interfaces.
 get_all_ifaces_of_device ($device_id, $type=NULL)
 Returns all interfaces of device.
 get_all_vlan_ifaces_of_device ($device_id)
 Returns all VLAN ifaces of device.
 get_all_wireless_ifaces_of_device ($device_id)
 Returns all wireless interfaces of device.
 get_virtual_ap_ifaces_of_parent ($parent_iface_id=NULL)
 Gets ifaces of parent iface which is given by ID.
 select_list_grouped_by_device ($device_id=NULL, $restrict_types=array())
 Gets array of ifaces grouped by device for dropdown.
 count_items_by_mode_and_link ($wmode, $link_id, $iface_id=NULL)
 Counts items by wireless mode and link.
 get_iface_connected_to_iface ($iface=NULL)
 Gets interface connected to interface via link.
 get_ifaces_connected_to_iface ($iface=NULL)
 Gets all interfaces connected to interface via link.
 get_iface_for_connecting_to_iface ($user_id, $type, $gps=array(), $filter_sql= '', $wmode=NULL)
 Tries to find best suitable interface for connecting of a new device of user.
 vlan_exists ($vlan_id)
 Checks whether VLAN exists on ports or VLAN ifaces.
 get_untagged_vlan ()
 Returns untagged VLAN of port (if exists)
 is_in_bridge ()
 Checks whether iface is in bridge.

Static Public Member Functions

static type_has_link ($type)
 Tests if type can have link.
static get_types_has_link ()
 Gets whole array of indicator of available link.
static get_type_has_link_with_medium ($type)
 Gets link mediums types for interface type.
static get_types_has_link_with_medium ($type)
 Gets link mediums for interface type.
static type_has_mac_address ($type)
 Tests if type can have mac address.
static type_has_ip_address ($type)
 Tests if type can have IP address.
static get_types_has_mac_address ()
 Gets whole array of indicator of available MAC.
static get_can_connect_to ($type)
 Gets array of iface type to which the given type of interface may connect.
static get_can_be_child_of ($type)
 Gets array of iface type of which the given interface may be child.
static get_type ($type)
 Returns type of current interface.
static get_types ()
 Returns all types of interfaces.
static get_necessary_types ()
 Returns necessary types of interfaces.
static get_default_name ($type)
 Returns default name of current type of interface.
static get_default_names ()
 Returns all default names of interfaces.
static get_wireless_mode ($mode=NULL)
 Returns mode of current wireless interface.
static get_wireless_modes ()
 Returns all modes of wireless interfaces.
static get_wireless_antenna ($antenna)
 Returns antenna of current wireless interface.
static get_wireless_antennas ()
 Returns all antennas of wireless interfaces.
static get_port_mode ($mode)
 Return human format for given const of mode.
static get_port_modes ()
 Return human format for modes.
static get_port_vlan_types ()
 Return human format for port VLAN types.

Public Attributes

const TYPE_WIRELESS = 1
 Wireless type of iface.
const TYPE_ETHERNET = 2
 Ethernet type of iface.
const TYPE_PORT = 3
 Interface is port (link layer - without MAC)
const TYPE_BRIDGE = 4
 Bridge interface.
const TYPE_VLAN = 5
 Virtual interface.
const TYPE_INTERNAL = 6
 Special type of interface for configuration of switches.
const TYPE_VIRTUAL_AP = 7
 Virtual AP over a wireless iface.
const WIRELESS_MODE_AP = 1
 AP mode of wireless iface.
const WIRELESS_MODE_CLIENT = 2
 Client mode of wireless iface.
const WIRELESS_ANTENNA_DIRECTIONAL = 1
 Directional type of antenna.
const WIRELESS_ANTENNA_OMNIDIRECTIONAL = 2
 Omnidirectional type of antenna.
const WIRELESS_ANTENNA_SECTIONAL = 3
 Sectional type of antenna.
const PORT_MODE_ACCESS = 1
 Const for mode access.
const PORT_MODE_TRUNK = 2
 Const for mode trunk.
const PORT_MODE_HYBRID = 3
 Const for mode hybrid.
const PORT_VLAN_TAGGED = 1
 Const for type tagged.
const PORT_VLAN_UNTAGGED = 2
 Const for type untagged.

Protected Attributes

 $belongs_to = array('link', 'device')
 $has_many

Member Function Documentation

Iface_Model::__toString ( )

Returns name or MAC address of device.

Author
David Raska
Returns
string
Iface_Model::count_all_ifaces (   $filter_sql = '')

Function counts all interfaces.

Returns
integer
Iface_Model::count_ifaces_of_device (   $device_id)

Get count of ifaces of device.

Parameters
integer$device_id
Returns
integer
Iface_Model::count_items_by_mode_and_link (   $wmode,
  $link_id,
  $iface_id = NULL 
)

Counts items by wireless mode and link.

Author
Michal Kliment
Parameters
integer$wmode
integer$link_id
integer$iface_idIf set this interface is avoided [optional]
Returns
boolean
Iface_Model::get_all_ifaces (   $limit_from = 0,
  $limit_results = 20,
  $order_by = 'id',
  $order_by_direction = 'asc',
  $filter_sql = '' 
)

Function gets all interfaces.

Parameters
$limit_from
$limit_results
$order_by
$order_by_direction
Returns
Mysql_Result
Iface_Model::get_all_ifaces_of_device (   $device_id,
  $type = NULL 
)

Returns all interfaces of device.

Author
Michal Kliment
Parameters
int$device_id
mixed$typeArray of types or a single type
Returns
Mysql_Result
Iface_Model::get_all_vlan_ifaces_of_device (   $device_id)

Returns all VLAN ifaces of device.

Author
Michal Kliment
Parameters
type$device_id
Returns
type
Iface_Model::get_all_wireless_ifaces_of_device (   $device_id)

Returns all wireless interfaces of device.

Author
Michal Kliment
Parameters
type$device_id
Returns
type
static Iface_Model::get_can_be_child_of (   $type)
static

Gets array of iface type of which the given interface may be child.

Parameters
type$typeOne of ifaces types
Returns
type
static Iface_Model::get_can_connect_to (   $type)
static

Gets array of iface type to which the given type of interface may connect.

Parameters
integer$typeOne of ifaces types
Returns
array
static Iface_Model::get_default_name (   $type)
static

Returns default name of current type of interface.

Author
Michal Kliment
Parameters
integer$type
Returns
string
static Iface_Model::get_default_names ( )
static

Returns all default names of interfaces.

Author
Michal Kliment
Returns
array
Iface_Model::get_iface_connected_to_iface (   $iface = NULL)

Gets interface connected to interface via link.

Only first founded is returned

Parameters
Iface_Model$iface
Returns
Iface_Model
Iface_Model::get_iface_for_connecting_to_iface (   $user_id,
  $type,
  $gps = array(),
  $filter_sql = '',
  $wmode = NULL 
)

Tries to find best suitable interface for connecting of a new device of user.

Author
Ondrej Fibich
Parameters
integer$user_idUser identificator
integer$typeType of interface for connection
array$gpslocation of device - default member AP [optional]
string$filter_sqlFilter SQL
integer$wmodeWireless mode of interface which try to connect [optional]
Returns
object Suitable iface or null
Iface_Model::get_ifaces_connected_to_iface (   $iface = NULL)

Gets all interfaces connected to interface via link.

Parameters
Iface_Model$iface
Returns
Iface_Model
static Iface_Model::get_necessary_types ( )
static

Returns necessary types of interfaces.

See Also
Devices_Controller::add
Author
Ondrej Fibich
Returns
array
static Iface_Model::get_port_mode (   $mode)
static

Return human format for given const of mode.

Author
Michal Kliment
Parameters
integer$mode
Returns
boolean
static Iface_Model::get_port_modes ( )
static

Return human format for modes.

Author
Michal Kliment
Returns
array
static Iface_Model::get_port_vlan_types ( )
static

Return human format for port VLAN types.

Author
Michal Kliment
Returns
array
static Iface_Model::get_type (   $type)
static

Returns type of current interface.

Author
Michal Kliment
Parameters
integer$type
Returns
string
static Iface_Model::get_type_has_link_with_medium (   $type)
static

Gets link mediums types for interface type.

Parameters
integer$typeIface type
Returns
array Link medium constants
static Iface_Model::get_types ( )
static

Returns all types of interfaces.

Author
Michal Kliment
Returns
array
static Iface_Model::get_types_has_link ( )
static

Gets whole array of indicator of available link.

Returns
array
static Iface_Model::get_types_has_link_with_medium (   $type)
static

Gets link mediums for interface type.

Parameters
array$typeIface type
Returns
array Link medium array with translated names
static Iface_Model::get_types_has_mac_address ( )
static

Gets whole array of indicator of available MAC.

Returns
array
Iface_Model::get_untagged_vlan ( )

Returns untagged VLAN of port (if exists)

Author
Michal Kliment
Returns
null
Iface_Model::get_virtual_ap_ifaces_of_parent (   $parent_iface_id = NULL)

Gets ifaces of parent iface which is given by ID.

Parameters
integer$parent_iface_id
Returns
Mysql_Result
static Iface_Model::get_wireless_antenna (   $antenna)
static

Returns antenna of current wireless interface.

Author
Michal Kliment
Parameters
integer$antenna
Returns
string
static Iface_Model::get_wireless_antennas ( )
static

Returns all antennas of wireless interfaces.

Author
Michal Kliment
Parameters
integer$mode
Returns
string
static Iface_Model::get_wireless_mode (   $mode = NULL)
static

Returns mode of current wireless interface.

Author
Michal Kliment
Parameters
integer$mode
Returns
string
static Iface_Model::get_wireless_modes ( )
static

Returns all modes of wireless interfaces.

Author
Michal Kliment
Parameters
integer$mode
Returns
string
Iface_Model::is_in_bridge ( )

Checks whether iface is in bridge.

Author
Michal Kliment
Returns
boolean
Iface_Model::is_mac_unique (   $iface_id,
  $mac 
)

Checks whether the given new MAC of the given iface is unique in all subnets that are in relation with the iface over his IP addresses.

This function should not be use during adding of an iface!

Parameters
int$iface_id
string$mac
Returns
bool
Iface_Model::select_list_grouped_by_device (   $device_id = NULL,
  $restrict_types = array() 
)

Gets array of ifaces grouped by device for dropdown.

Parameters
integer$device_idOnly iface of one device?
array$restrict_typesArray of allowed types
Author
Ondřej fibich
Returns
array
static Iface_Model::type_has_ip_address (   $type)
static

Tests if type can have IP address.

Author
Ondrej Fibich
Parameters
integer$type
Returns
boolean
static Iface_Model::type_has_link (   $type)
static

Tests if type can have link.

Author
Michal Kliment
Parameters
type$type
Returns
boolean
static Iface_Model::type_has_mac_address (   $type)
static

Tests if type can have mac address.

Author
Michal Kliment
Parameters
integer$type
Returns
boolean
Iface_Model::vlan_exists (   $vlan_id)

Checks whether VLAN exists on ports or VLAN ifaces.

Author
Michal Kliment
Parameters
type$vlan_id
Returns
boolean

Member Data Documentation

Iface_Model::$has_many
protected
Initial value:
array
(
'ifaces_vlans', 'ip_addresses',
'ifaces_relationships',
)

The documentation for this class was generated from the following file: