nsINetworkService

Provide network services.

Methods

setWifiTethering(enabled, config, callback)

Enable or disable Wifi Tethering

Parameters

enabled Boolean that indicates whether tethering should be enabled (true) or disabled (false).
config The Wifi Tethering configuration from settings db.
callback Callback function used to report status to WifiManager.

setDhcpServer(enabled, config, callback)

Enable or disable DHCP server

   As for disabling the DHCP server, put this value |null|.  

Parameters

enabled Boolean that indicates enabling or disabling DHCP server.
config Config used to enable the DHCP server. It contains .startIp start of the ip lease range (string) .endIp end of the ip lease range (string) .serverIp ip of the DHCP server (string) .maskLength the length of the subnet mask .ifname the interface name
callback Callback function used to report status.

getNetworkInterfaceStats(networkName, callback)

Retrieve network interface stats.

Parameters

networkName Select the Network interface to request estats.
callback Callback to notify result and provide stats, connectionType and the date when stats are retrieved

setNetworkInterfaceAlarm(networkName, threshold, callback)

Set Alarm of usage per interface

Parameters

networkName Select the Network interface to set an alarm.
threshold Amount of data that will trigger the alarm.
callback Callback to notify the result.

Returns

false if there is no interface registered for the networkType param.

setWifiOperationMode(interfaceName, mode, callback)

Reload Wifi firmware to specific operation mode.

Parameters

interfaceName Wifi Network interface name.
mode AP - Access pointer mode. P2P - Peer to peer connection mode. STA - Station mode.
callback Callback to notify Wifi firmware reload result.

setNetworkProxy(networkInterface)

Set http proxy for specific network

Parameters

networkInterface The network interface which contains the http proxy host/port we want to set.

setUSBTethering(enabled, config, callback)

Set USB tethering.

Parameters

enabled Boolean to indicate we are going to enable or disable usb tethering.
config The usb tethering configuration.
callback Callback function used to report the result enabling/disabling usb tethering.

resetRoutingTable(networkInterface)

Reset routing table.

Parameters

networkInterface The network interface we want remove from the routing table.

setDNS(networkInterface, callback)

Set DNS.

Parameters

networkInterface The network interface which contains the DNS we want to set.
callback Callback to notify the result of setting DNS server.

setDefaultRoute(networkInterface, oldInterface, callback)

Set default route.

Parameters

networkInterface The network interface we want to set to the default route.
oldInterface The previous network interface.
callback Callback to notify the result of setting default route.

removeDefaultRoute(networkInterface)

Remove default route.

Parameters

networkInterface The network interface we want remove from the default route.

addHostRoute(interfaceName, gateway, host)

Add host route.

Parameters

interfaceName Network interface name for the output of the host route.
gateway Gateway ip for the output of the host route.
host Host ip we want to add route for.

Returns

A deferred promise that resolves on success or rejects with a specified reason otherwise.

removeHostRoute(interfaceName, gateway, host)

Remove host route.

Parameters

interfaceName Network interface name for the output of the host route.
gateway Gateway ip for the output of the host route.
host Host ip we want to remove route for.

Returns

A deferred promise that resolves on success or rejects with a specified reason otherwise.

removeHostRoutes(interfaceName)

Remove all host routes.

Parameters

interfaceName The interface name we want remove from the routing table.

addSecondaryRoute(interfaceName, route)

Add route to secondary routing table.

Parameters

interfaceName The network interface for this route.
route The route info should have the following fields: .ip: destination ip address .prefix: destination prefix .gateway: gateway ip address

removeSecondaryRoute(interfaceName, route)

Remove route from secondary routing table.

Parameters

interfaceName The network interface for the route we want to remove.
route The route info should have the following fields: .ip: destination ip address .prefix: destination prefix .gateway: gateway ip address

enableUsbRndis(enable, callback)

Enable or disable usb rndis.

Parameters

enable Boolean to indicate we want enable or disable usb rndis.
callback Callback function to report the result.

updateUpStream(previous, current, callback)

Update upstream.

Parameters

previous The previous internal and external interface.
current The current internal and external interface.
callback Callback function to report the result.

configureInterface(config, callback)

Configure a network interface.

     - ifname:  string  
     - ipaddr:  long  
     - mask:    long  
     - gateway: long  
     - dns1:    long  
     - dns2:    long  

Parameters

config An object containing the detail that we want to configure the interface:
callback Callback to notify the result of configurating network interface.

dhcpRequest(interfaceName, callback)

Issue a DHCP client request.

Parameters

networkInterface The network interface which we wnat to do the DHCP request on.
callback Callback to notify the result of the DHCP request.

enableInterface(interfaceName, callback)

Enable a network interface.

Parameters

networkInterface The network interface name which we want to enable.
callback Callback to notify the result of disabling network interface.

disableInterface(interfaceName, callback)

Disable a network interface.

Parameters

networkInterface The network interface name which we want to disable.
callback Callback to notify the result of disabling network interface.

resetConnections(interfaceName, callback)

Reset all connections

Parameters

networkInterface The network interface name which we want to reset.
callback Callback to notify the result of resetting connections.