new LuCI.network.Protocol()
Methods
- 
    addDevice(device){boolean}
- 
    
    
    Add the given network device to the logical interface. Name Type Description deviceLuCI.network.Protocol | LuCI.network.Device | LuCI.network.WifiDevice | LuCI.network.WifiNetwork | string The object or device name to add to the logical interface. In case the given argument is not a string, it is resolved though the Network.getIfnameOf()function.Returns:Type Description boolean Returns trueif the device name has been added orfalseif any argument was invalid, if the device was already part of the logical interface or if the logical interface is virtual.
- 
    containsDevice(device){boolean}
- 
    
    
    Checks whether this logical interface contains the given device object. Name Type Description deviceLuCI.network.Protocol | LuCI.network.Device | LuCI.network.WifiDevice | LuCI.network.WifiNetwork | string The object or device name to check. In case the given argument is not a string, it is resolved though the Network.getIfnameOf()function.Returns:Type Description boolean Returns truewhen this logical interface contains the given network device orfalseif not.
- 
    abstractdeleteConfiguration(){*|Promise.<*>}
- 
    
    
    Cleanup related configuration entries. This function will be invoked if an interface is about to be removed from the configuration and is responsible for performing any required cleanup tasks, such as unsetting uci entries in related configurations. It should be overwritten by protocol specific subclasses. Returns:Type Description * | Promise.<*> This function may return a promise which is awaited before the rest of the configuration is removed. Any non-promise return value and any resolved promise value is ignored. If the returned promise is rejected, the interface removal will be aborted. 
- 
    deleteDevice(device){boolean}
- 
    
    
    Remove the given network device from the logical interface. Name Type Description deviceLuCI.network.Protocol | LuCI.network.Device | LuCI.network.WifiDevice | LuCI.network.WifiNetwork | string The object or device name to remove from the logical interface. In case the given argument is not a string, it is resolved though the Network.getIfnameOf()function.Returns:Type Description boolean Returns trueif the device name has been added orfalseif any argument was invalid, if the device was already part of the logical interface or if the logical interface is virtual.
- 
    get(opt){null|string|Array.<string>}
- 
    
    
    Read the given UCI option value of this network. Name Type Description optstring The UCI option name to read. Returns:Type Description null | string | Array.<string> Returns the UCI option value or nullif the requested option is not found.
- 
    getDevice(){LuCI.network.Device}
- 
    
    
    Returns the Linux network device associated with this logical interface. Returns:Type Description LuCI.network.Device Returns a Network.Deviceclass instance representing the expected Linux network device according to the configuration.
- 
    getDevices(){null|Array.<LuCI.network.Device>}
- 
    
    
    Returns a list of network sub-devices associated with this logical interface. Returns:Type Description null | Array.<LuCI.network.Device> Returns an array of Network.Deviceclass instances representing the sub-devices attached to this logical interface ornullif the logical interface does not support sub-devices, e.g. because it is virtual and not a bridge.
- 
    getDNS6Addrs(){Array.<string>}
- 
    
    
    Query the IPv6 DNS servers associated with the logical interface. Returns:Type Description Array.<string> Returns an array of IPv6 DNS servers registered by the remote protocol back-end. 
- 
    getDNSAddrs(){Array.<string>}
- 
    
    
    Query the IPv4 DNS servers associated with the logical interface. Returns:Type Description Array.<string> Returns an array of IPv4 DNS servers registered by the remote protocol back-end. 
- 
    getErrors(){Array.<string>}
- 
    
    
    Query interface error messages published in ubusruntime state.Interface errors are emitted by remote protocol handlers if the setup of the underlying logical interface failed, e.g. due to bad configuration or network connectivity issues. This function will translate the found error codes to human readable messages using the descriptions registered by Network.registerErrorCode()and fall back to"Unknown error (%s)"where%sis replaced by the error code in case no translation can be found.Returns:Type Description Array.<string> Returns an array of translated interface error messages. 
- 
    getExpiry(){number}
- 
    
    
    Get the logical interface expiry time in seconds. For protocols that have a concept of a lease, such as DHCP or DHCPv6, this function returns the remaining time in seconds until the lease expires. Returns:Type Description number Returns the number of seconds until the lease expires or -1if it isn't applicable to the associated protocol.
- 
    getGateway6Addr(){string}
- 
    
    
    Query the gateway (nexthop) of the IPv6 default route associated with this logical interface. Returns:Type Description string Returns a string containing the IPv6 nexthop address of the associated default route or nullif no default route was found.
- 
    getGatewayAddr(){string}
- 
    
    
    Query the gateway (nexthop) of the default route associated with this logical interface. Returns:Type Description string Returns a string containing the IPv4 nexthop address of the associated default route or nullif no default route was found.
- 
    abstractgetI18n(){string}
- 
    
    
    Return a human readable description for the protocol, such as Static addressorDHCP client.This function should be overwritten by subclasses. Returns:Type Description string Returns the description string. 
- 
    getIfname(){null|string}
- 
    
    
    Get the associated Linux network device of this network. Returns:Type Description null | string Returns the name of the associated network device or nullif it could not be determined.
- 
    getIP6Addr(){null|string}
- 
    
    
    Query the first (primary) IPv6 address of the logical interface. Returns:Type Description null | string Returns the primary IPv6 address registered by the protocol handler in CIDR notation or nullif no IPv6 addresses were set.
- 
    getIP6Addrs(){Array.<string>}
- 
    
    
    Query all IPv6 addresses of the logical interface. Returns:Type Description Array.<string> Returns an array of IPv6 addresses in CIDR notation which have been registered by the protocol handler. The order of the resulting array follows the order of the addresses in ubusruntime information.
- 
    getIP6Prefix(){null|string}
- 
    
    
    Query the routed IPv6 prefix associated with the logical interface. Returns:Type Description null | string Returns the routed IPv6 prefix registered by the remote protocol handler or nullif no prefix is present.
- 
    getIP6Prefixes(){null|Array.<string>}
- 
    
    
    Query the routed IPv6 prefixes associated with the logical interface. Returns:Type Description null | Array.<string> Returns an array of the routed IPv6 prefixes registered by the remote protocol handler or nullif no prefixes are present.
- 
    getIPAddr(){null|string}
- 
    
    
    Query the first (primary) IPv4 address of the logical interface. Returns:Type Description null | string Returns the primary IPv4 address registered by the protocol handler or nullif no IPv4 addresses were set.
- 
    getIPAddrs(){Array.<string>}
- 
    
    
    Query all IPv4 addresses of the logical interface. Returns:Type Description Array.<string> Returns an array of IPv4 addresses in CIDR notation which have been registered by the protocol handler. The order of the resulting array follows the order of the addresses in ubusruntime information.
- 
    getL2Device(){LuCI.network.Device}
- 
    
    
    Returns the layer 2 Linux network device currently associated with this logical interface. Returns:Type Description LuCI.network.Device Returns a Network.Deviceclass instance representing the Linux network device currently associated with the logical interface.
- 
    getL3Device(){LuCI.network.Device}
- 
    
    
    Returns the layer 3 Linux network device currently associated with this logical interface. Returns:Type Description LuCI.network.Device Returns a Network.Deviceclass instance representing the Linux network device currently associated with the logical interface.
- 
    getMetric(){number}
- 
    
    
    Get the metric value of the logical interface. Returns:Type Description number Returns the current metric value used for device and network routes spawned by the associated logical interface. 
- 
    getName(){string}
- 
    
    
    Get the name of the associated logical interface. Returns:Type Description string Returns the logical interface name, such as lanorwan.
- 
    getNetmask(){null|string}
- 
    
    
    Query the first (primary) IPv4 netmask of the logical interface. Returns:Type Description null | string Returns the netmask of the primary IPv4 address registered by the protocol handler or nullif no IPv4 addresses were set.
- 
    abstractgetPackageName(){string}
- 
    
    
    Gets the name of the package providing the protocol functionality. The package is available via the system default package manager. This is used when a config refers to a protocol handler which is not yet installed. This function should be overwritten by protocol specific subclasses. Returns:Type Description string Returns the name of the package to download, required for the protocol to function, e.g. odhcp6cfor thedhcpv6protocol.
- 
    abstractgetProtocol(){string}
- 
    
    
    Get the name of this network protocol class. This function will be overwritten by subclasses created by Network.registerProtocol().Returns:Type Description string Returns the name of the network protocol implementation, e.g. staticordhcp.
- 
    getType(){null|string}
- 
    
    
    Get the type of the underlying interface. This function actually is a convenience wrapper around proto.get("type")and is mainly used by otherLuCI.networkcode to check whether the interface is declared as bridge in UCI.Returns:Type Description null | string Returns the value of the typeoption of the associated logical interface ornullif notypeoption is set.
- 
    getUptime(){number}
- 
    
    
    Get the uptime of the logical interface. Returns:Type Description number Returns the uptime of the associated interface in seconds. 
- 
    getZoneName(){null|string}
- 
    
    
    Get the requested firewall zone name of the logical interface. Some protocol implementations request a specific firewall zone to trigger inclusion of their resulting network devices into the firewall rule set. Returns:Type Description null | string Returns the requested firewall zone name as published in the ubusruntime information ornullif the remote protocol handler didn't request a zone.
- 
    isAlias(){null|string}
- 
    
    
    Checks whether this interface is an alias interface. Alias interfaces are interfaces layering on top of another interface and are denoted by a special @interfacenamenotation in the underlyingdeviceoption.Returns:Type Description null | string Returns the name of the parent interface if this logical interface is an alias or nullif it is not an alias interface.
- 
    isBridge(){boolean}
- 
    
    
    Checks whether the underlying logical interface is declared as bridge. Returns:Type Description boolean Returns truewhen the interface is declared withoption type bridgeand when the associated protocol implementation is not marked virtual orfalsewhen the logical interface is no bridge.
- 
    abstractisCreateable(ifname){Promise.<void>}
- 
    
    
    Check function for the protocol handler if a new interface is creatable. This function should be overwritten by protocol specific subclasses. Name Type Description ifnamestring The name of the interface to be created. Returns:Type Description Promise.<void> Returns a promise resolving if a new interface is creatable, else rejects with an error message string. 
- 
    isDynamic(){boolean}
- 
    
    
    Checks whether this logical interface is dynamic. A dynamic interface is an interface that has been created at runtime. E.g. as a sub-interface of another interface, but which is not backed by any user configuration. Such dynamic interfaces cannot be edited but only brought down or restarted. Returns:Type Description boolean Returns a boolean indicating whether this interface is dynamic ( true) or not (false).
- 
    isEmpty(){boolean}
- 
    
    
    Checks whether this logical interface is "empty", where empty means that it has no network devices attached. Returns:Type Description boolean Returns trueif this logical interface is empty, elsefalse.
- 
    isFloating(){boolean}
- 
    
    
    Checks whether this protocol is "floating". A "floating" protocol is a protocol which spawns its own interfaces on demand, like a virtual one but which relies on an existing lower level interface to initiate the connection. An example for such a protocol is "pppoe". This function exists for backwards compatibility with older code but should not be used anymore. - Deprecated
- Yes
 
 Returns:Type Description boolean Returns a boolean indicating whether this protocol is floating ( true) or not (false).
- 
    abstractisInstalled(){boolean}
- 
    
    
    Checks whether the protocol functionality is installed. This function exists for compatibility with old code, it always returns true.- Deprecated
- Yes
 
 Returns:Type Description boolean Returns trueif the protocol support is installed, elsefalse.
- 
    isPending(){boolean}
- 
    
    
    Checks whether this logical interface is pending. Returns:Type Description boolean returns truewhen the interface is pending orfalsewhen it is not.
- 
    isUp(){boolean}
- 
    
    
    Checks whether this logical interface is configured and running. Returns:Type Description boolean Returns truewhen the interface is active orfalsewhen it is not.
- 
    isVirtual(){boolean}
- 
    
    
    Checks whether this protocol is "virtual". A "virtual" protocol is a protocol which spawns its own interfaces on demand instead of using existing physical interfaces. Examples for virtual protocols are 6in4whichgrespawn a tunnel network device on startup, examples for non-virtual protocols aredhcporstaticwhich apply IP configuration to existing interfaces.This function should be overwritten by subclasses. Returns:Type Description boolean Returns a boolean indicating whether the underlying protocol spawns dynamic interfaces ( true) or not (false).
- 
    set(opt, val)
- 
    
    
    Set the given UCI option of this network to the given value. Name Type Description optstring The name of the UCI option to set. valnull | string | Array.<string> The value to set or nullto remove the given option from the configuration.