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

Public Member Functions

 set_expired_all_subnets ($flag=1)
 Sets all subnets as (not) expired.
 set_expired_subnets ($subnets, $flag=1)
 Sets subnets as (not) expired.
 set_expired_subnets_of_device ($device_id, $flag=1)
 Sets subnets of device as (not) expired.
 is_any_subnet_of_device_expired ($device_id)
 Check if any of device subnet on that the device is gateway is expired.
 is_mac_unique_in_subnet ($mac, $ip_address_id=NULL, $subnet_id=NULL)
 Check if the MAC address is unique in the subnet.
 get_net_and_mask_of_subnet ($subnet_id=NULL)
 Gets mask and net of subnet.
 get_redirected_ranges ()
 Gets redirected ranges.
 count_all_subnets ($filter_sql= '')
 Function counts all subnets specified by filter.
 get_all_subnets ($limit_from=0, $limit_results=NULL, $order_by= 'id', $order_by_direction= 'ASC', $filter_sql= '')
 Function gets all subnets specified by filter.
 get_clouds_of_subnet ($subnet_id)
 Gets clouds of subnet.
 get_subnet_of_ip_address ($ip_address)
 Function finds subnet to which given ip address belongs to.
 get_subnet_of_user ($user_id)
 Function tries to find subnet of user.
 get_items_of_subnet ($subnet_id)
 Function gets items of subnet to export.
 get_subnet_of_ip_prefix ($ip_prefix)
 Function gets all subnets of the ip prefix.
 get_phones_of_subnet ($subnet_id)
 Function gets phone numbers of users of subnet.
 get_all_subnets_without_allowed_subnets_of_member ($member_id)
 Returns all subnets without allowed subnets of member.
 get_subnet_without_allowed_subnets_of_member_by_ip_address ($member_id, $ip_address)
 Returns subnet by ip address without member's allowed subnets.
 select_list_by_net ()
 Gets list of subnets ordered by net for dropdown.
 check_overlaps_of_subnets ($network_address, $netmask, $subnet_id=NULL)
 Checks of overlaps of subnets.
 get_free_ip_addresses ()
 Returns array of free IP addresses of subnet.
 get_all_subnets_with_owner ()
 Returns all subnets with owner.
 get_members ($subnet_id=NULL)
 Returns all members with at least one ip address in subnet.
 get_all_subnets_by_device ($device_id=NULL, $gateway=FALSE)
 Returns all subnets by device.
 get_all_unique_subnets_by_device ($device_id=NULL)
 Returns all unique subnets by device.
 get_all_dependent_subnets_by_device ($device_id=NULL, $recursive=TRUE)
 Returns all dependent subnets of device.
 get_gateway ($subnet_id=NULL)
 Get gateway of subnet.
 has_gateway ($subnet_id=NULL)
 Check whether subnet has gateway.
 get_subnet_for_connection_request ($ip_address)
 This method is used for determining whether the user is connected from registered connection.
 get_all_subnets_with_gateway ()
 Returns all subnets with existing gateway.
 get_all_dhcp_subnets_without_gateway ()
 Return all subnets on which DHCP is running and has no gateway.

Protected Attributes

 $has_one = array('subnets_owner')
 $has_many = array('ip_addresses', 'allowed_subnets', 'connection_requests')
 $has_and_belongs_to_many = array('clouds')

Member Function Documentation

Subnet_Model::check_overlaps_of_subnets (   $network_address,
  $netmask,
  $subnet_id = NULL 
)

Checks of overlaps of subnets.

Author
Michal Kliment
Parameters
string$network_address
string$netmask
type$subnet_id
Returns
bool
Subnet_Model::count_all_subnets (   $filter_sql = '')

Function counts all subnets specified by filter.

Parameters
array$filter_values
Returns
integer
Subnet_Model::get_all_dependent_subnets_by_device (   $device_id = NULL,
  $recursive = TRUE 
)

Returns all dependent subnets of device.

Author
Michal Kliment
Parameters
type$device_id
Returns
type
Subnet_Model::get_all_dhcp_subnets_without_gateway ( )

Return all subnets on which DHCP is running and has no gateway.

Returns
Mysql_Result
Subnet_Model::get_all_subnets (   $limit_from = 0,
  $limit_results = NULL,
  $order_by = 'id',
  $order_by_direction = 'ASC',
  $filter_sql = '' 
)

Function gets all subnets specified by filter.

Parameters
integer$limit_from
integer$limit_results
string$order_by
string$order_by_direction
array$filter_values
Returns
Mysql_Result
Subnet_Model::get_all_subnets_by_device (   $device_id = NULL,
  $gateway = FALSE 
)

Returns all subnets by device.

Author
Michal Kliment
Parameters
type$device_id
Returns
type
Subnet_Model::get_all_subnets_with_gateway ( )

Returns all subnets with existing gateway.

Author
Michal Kliment
Returns
Mysql_Result
Subnet_Model::get_all_subnets_with_owner ( )

Returns all subnets with owner.

Author
Michal Kliment
Returns
Mysql_Result
Subnet_Model::get_all_subnets_without_allowed_subnets_of_member (   $member_id)

Returns all subnets without allowed subnets of member.

Author
Michal Kliment
Parameters
integer$member_id
Returns
Mysql_Result
Subnet_Model::get_all_unique_subnets_by_device (   $device_id = NULL)

Returns all unique subnets by device.

Author
David Raska
Parameters
type$device_id
Returns
type
Subnet_Model::get_clouds_of_subnet (   $subnet_id)

Gets clouds of subnet.

Parameters
integer$subnet_id
Returns
Mysql_Result
Subnet_Model::get_free_ip_addresses ( )

Returns array of free IP addresses of subnet.

Author
Michal Kliment
Returns
array
Subnet_Model::get_gateway (   $subnet_id = NULL)

Get gateway of subnet.

Author
Michal Kliment klime.nosp@m.nt@f.nosp@m.reene.nosp@m.tis..nosp@m.org
Parameters
type$subnet_id
Returns
type
Subnet_Model::get_items_of_subnet (   $subnet_id)

Function gets items of subnet to export.

Parameters
integer$subnet_id
Returns
Mysql_Result
Subnet_Model::get_members (   $subnet_id = NULL)

Returns all members with at least one ip address in subnet.

Parameters
type$subnet_id
Returns
type
Subnet_Model::get_net_and_mask_of_subnet (   $subnet_id = NULL)

Gets mask and net of subnet.

Parameters
integer$subnet_id
Returns
ORM_Iterator
Subnet_Model::get_phones_of_subnet (   $subnet_id)

Function gets phone numbers of users of subnet.

Author
Sevcik Roman
Parameters
integer$subnet_id
Returns
Mysql_Result
Subnet_Model::get_redirected_ranges ( )

Gets redirected ranges.

Any IP address belonging to these subnet ranges can be redirected.

See Also
Web_interface_Controller
Returns
Mysql_Result
Subnet_Model::get_subnet_for_connection_request (   $ip_address)

This method is used for determining whether the user is connected from registered connection.

If he is the null is returned. If not then subnet from which he is connected is searched. If the user may obtain this IP from the searched subnet the ID of subnet is returned. (but there must not be any connection request on this connection already in tha database)

Author
Ondřej Fibich
Parameters
string$ip_addressIP address from which the connection request is made
Returns
int|null Subnet ID or null if invalid request was made
Subnet_Model::get_subnet_of_ip_address (   $ip_address)

Function finds subnet to which given ip address belongs to.

Parameters
string$ip_address
Returns
Database_Result
Subnet_Model::get_subnet_of_ip_prefix (   $ip_prefix)

Function gets all subnets of the ip prefix.

Author
Lubomir Buben
Parameters
string$ip_prefix
Returns
Mysql_Result
Subnet_Model::get_subnet_of_user (   $user_id)

Function tries to find subnet of user.

Used in devices/add.

Parameters
integer$user_id
Returns
Database_Result
Subnet_Model::get_subnet_without_allowed_subnets_of_member_by_ip_address (   $member_id,
  $ip_address 
)

Returns subnet by ip address without member's allowed subnets.

Author
Michal Kliment
Parameters
integer$member_id
string$ip_address
Returns
Mysql_Result object
Subnet_Model::has_gateway (   $subnet_id = NULL)

Check whether subnet has gateway.

Author
Michal Kliment
Parameters
type$subnet_id
Returns
type
Subnet_Model::is_any_subnet_of_device_expired (   $device_id)

Check if any of device subnet on that the device is gateway is expired.

Parameters
int$device_id
Returns
boolean
Subnet_Model::is_mac_unique_in_subnet (   $mac,
  $ip_address_id = NULL,
  $subnet_id = NULL 
)

Check if the MAC address is unique in the subnet.

Parameters
string$macMAC address
int$ip_address_idIface ID - for edit purposes
int$subnet_idSubnet id [Optional - deafult self ID]
Returns
bool
Subnet_Model::select_list_by_net ( )

Gets list of subnets ordered by net for dropdown.

Author
Ondřej Fibich
Returns
array[string]
Subnet_Model::set_expired_all_subnets (   $flag = 1)

Sets all subnets as (not) expired.

Parameters
int$flagexpired (1) or not (0) [optional]
Subnet_Model::set_expired_subnets (   $subnets,
  $flag = 1 
)

Sets subnets as (not) expired.

Parameters
array | int$subnetsMultiple subnet IDs or a single subnet ID
int$flagexpired (1) or not (0) [optional]
Subnet_Model::set_expired_subnets_of_device (   $device_id,
  $flag = 1 
)

Sets subnets of device as (not) expired.

Author
Michal Kliment klime.nosp@m.nt@f.nosp@m.reene.nosp@m.tis..nosp@m.org
Parameters
type$device_idID of device
type$flagsexpired (1) or not (0) [optional]

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