Object Instance luci.ip.cidr
LuCI IP Library / CIDR instances
Functions
| cidr:add (amount, inplace) | Add specified amount of hosts to this instance. |
| cidr:broadcast () | Return CIDR containing the broadcast address of this instance. |
| cidr:contains (addr) | Test whether this instance fully contains the given CIDR instance. |
| cidr:equal (addr) | Test whether the value of the instance is equal to the given address. |
| cidr:higher (addr) | Test whether the value of the instance is higher then the given address. |
| cidr:host () | Return a corresponding CIDR representing the host address of this instance. |
| cidr:is4 () | Test whether the instance is a IPv4 address. |
| cidr:is6 () | Test whether the instance is a IPv6 address. |
| cidr:lower (addr) | Test whether the value of the instance is lower then the given address. |
| cidr:mask (bits) | Return a corresponding CIDR representing the netmask of this instance. |
| cidr:maxhost () | Return CIDR containing the highest available host address within the subnet. |
| cidr:minhost () | Return CIDR containing the lowest available host address within this subnet. |
| cidr:network (bits) | Return a corresponding CIDR representing the network address of this instance. |
| cidr:prefix (mask) | Return the prefix length of this CIDR instance. |
| cidr:string () | Return a corresponding string representation of the instance. |
| cidr:sub (amount, inplace) | Substract specified amount of hosts from this instance. |
Functions
- cidr:add (amount, inplace)
-
Add specified amount of hosts to this instance.
Parameters
- amount: Number of hosts to add to this instance
- inplace: Boolen indicating whether to alter values inplace (optional)
Return value:
CIDR representing the new address or nil on overflow errorSee also:
- cidr:broadcast ()
-
Return CIDR containing the broadcast address of this instance.
Return value:
CIDR instance containing the netmask, always nil for IPv6See also:
- cidr:contains (addr)
-
Test whether this instance fully contains the given CIDR instance.
Parameters
- addr: CIDR instance to test against
Return value:
Boolean indicating whether this instance contains the given CIDR - cidr:equal (addr)
-
Test whether the value of the instance is equal to the given address. This function will throw an exception if the given address is a different family than this instance.
Parameters
- addr: A luci.ip.cidr instance to compare against
Return value:
Boolean indicating whether this instance is equalSee also:
- cidr:higher (addr)
-
Test whether the value of the instance is higher then the given address. This function will throw an exception if the given address has a different family than this instance.
Parameters
- addr: A luci.ip.cidr instance to compare against
Return value:
Boolean indicating whether this instance is higherSee also:
- cidr:host ()
-
Return a corresponding CIDR representing the host address of this instance. This is intended to extract the host address from larger subnet.
Return value:
CIDR instance containing the network addressSee also:
- cidr:is4 ()
-
Test whether the instance is a IPv4 address.
Return value:
Boolean indicating a IPv4 address typeSee also:
- cidr:is6 ()
-
Test whether the instance is a IPv6 address.
Return value:
Boolean indicating a IPv6 address typeSee also:
- cidr:lower (addr)
-
Test whether the value of the instance is lower then the given address. This function will throw an exception if the given address has a different family than this instance.
Parameters
- addr: A luci.ip.cidr instance to compare against
Return value:
Boolean indicating whether this instance is lowerSee also:
- cidr:mask (bits)
-
Return a corresponding CIDR representing the netmask of this instance.
Parameters
- bits: Override prefix length of this instance (optional)
Return value:
CIDR instance containing the netmaskSee also:
- cidr:maxhost ()
-
Return CIDR containing the highest available host address within the subnet.
Return value:
CIDR containing the host address, nil if subnet is too smallSee also:
- cidr:minhost ()
-
Return CIDR containing the lowest available host address within this subnet.
Return value:
CIDR containing the host address, nil if subnet is too smallSee also:
- cidr:network (bits)
-
Return a corresponding CIDR representing the network address of this instance.
Parameters
- bits: Override prefix length of this instance (optional)
Return value:
CIDR instance containing the network addressSee also:
- cidr:prefix (mask)
-
Return the prefix length of this CIDR instance.
Parameters
- mask: Override instance prefix with given netmask (optional)
Return value:
Prefix length in bit - cidr:string ()
- Return a corresponding string representation of the instance. If the prefix length is lower then the maximum possible prefix length for the corresponding address type then the address is returned in CIDR notation, otherwise the prefix will be left out.
- cidr:sub (amount, inplace)
-
Substract specified amount of hosts from this instance.
Parameters
- amount: Number of hosts to substract from this instance
- inplace: Boolen indicating whether to alter values inplace (optional)
Return value:
CIDR representing the new address or nil on underflow errorSee also: