зеркало из https://github.com/mozilla/gecko-dev.git
Merge b2g-inbound to m-c. a=merge
This commit is contained in:
Коммит
b453e4c4f2
|
@ -19,7 +19,7 @@
|
|||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="2d2475b521351e200136e463358e6c8e91957702"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="db50c8d84054c0286c3ea355feae32ee4a51c82c"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="2d2475b521351e200136e463358e6c8e91957702"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="db50c8d84054c0286c3ea355feae32ee4a51c82c"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="71f5a35e3bc1801847413cff1f14fc3b5cd991ca"/>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="7945ca73e687be5edbc7b928dc7fe3a208242144">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="2d2475b521351e200136e463358e6c8e91957702"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="db50c8d84054c0286c3ea355feae32ee4a51c82c"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="2d2475b521351e200136e463358e6c8e91957702"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="db50c8d84054c0286c3ea355feae32ee4a51c82c"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
</project>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="2d2475b521351e200136e463358e6c8e91957702"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="db50c8d84054c0286c3ea355feae32ee4a51c82c"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="71f5a35e3bc1801847413cff1f14fc3b5cd991ca"/>
|
||||
|
|
|
@ -4,6 +4,6 @@
|
|||
"remote": "",
|
||||
"branch": ""
|
||||
},
|
||||
"revision": "8d2554880efe6011591aa8055e3cc8989559ce0a",
|
||||
"revision": "08746241e68aef919d4c8105be87cd3936531ca2",
|
||||
"repo_path": "/integration/gaia-central"
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="2d2475b521351e200136e463358e6c8e91957702"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="db50c8d84054c0286c3ea355feae32ee4a51c82c"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="2d2475b521351e200136e463358e6c8e91957702"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="db50c8d84054c0286c3ea355feae32ee4a51c82c"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="2d2475b521351e200136e463358e6c8e91957702"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="db50c8d84054c0286c3ea355feae32ee4a51c82c"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="71f5a35e3bc1801847413cff1f14fc3b5cd991ca"/>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="2d2475b521351e200136e463358e6c8e91957702"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="db50c8d84054c0286c3ea355feae32ee4a51c82c"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
|
|
|
@ -10,6 +10,7 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
|||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/FileUtils.jsm");
|
||||
Cu.import("resource://gre/modules/systemlibs.js");
|
||||
Cu.import("resource://gre/modules/Promise.jsm");
|
||||
|
||||
const NETWORKMANAGER_CONTRACTID = "@mozilla.org/network/manager;1";
|
||||
const NETWORKMANAGER_CID =
|
||||
|
@ -326,7 +327,7 @@ NetworkManager.prototype = {
|
|||
// Add host route for data calls
|
||||
if (this.isNetworkTypeMobile(network.type)) {
|
||||
gNetworkService.removeHostRoutes(network.name);
|
||||
gNetworkService.addHostRoute(network);
|
||||
this.setHostRoutes(network);
|
||||
}
|
||||
// Dun type is a special case where we add the default route to a
|
||||
// secondary table.
|
||||
|
@ -363,7 +364,7 @@ NetworkManager.prototype = {
|
|||
#ifdef MOZ_B2G_RIL
|
||||
// Remove host route for data calls
|
||||
if (this.isNetworkTypeMobile(network.type)) {
|
||||
gNetworkService.removeHostRoute(network);
|
||||
this.removeHostRoutes(network);
|
||||
}
|
||||
// Remove extra host route. For example, mms proxy or mmsc.
|
||||
this.removeExtraHostRoute(network);
|
||||
|
@ -467,60 +468,129 @@ NetworkManager.prototype = {
|
|||
this.isNetworkTypeSecondaryMobile(type));
|
||||
},
|
||||
|
||||
setExtraHostRoute: function(network) {
|
||||
if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS) {
|
||||
if (!(network instanceof Ci.nsIRilNetworkInterface)) {
|
||||
debug("Network for MMS must be an instance of nsIRilNetworkInterface");
|
||||
return;
|
||||
setHostRoutes: function(network) {
|
||||
let hosts = network.getDnses().concat(network.httpProxyHost);
|
||||
let gateways = network.getGateways();
|
||||
let promises = [];
|
||||
|
||||
for (let i = 0; i < hosts.length; i++) {
|
||||
let host = hosts[i];
|
||||
let gateway = this.selectGateway(gateways, host);
|
||||
if (gateway && host) {
|
||||
promises.push(gNetworkService.addHostRoute(network.name, gateway, host));
|
||||
}
|
||||
|
||||
network = network.QueryInterface(Ci.nsIRilNetworkInterface);
|
||||
|
||||
debug("Adding mmsproxy and/or mmsc route for " + network.name);
|
||||
|
||||
let hostToResolve = network.mmsProxy;
|
||||
// Workaround an xpconnect issue with undefined string objects.
|
||||
// See bug 808220
|
||||
if (!hostToResolve || hostToResolve === "undefined") {
|
||||
hostToResolve = network.mmsc;
|
||||
}
|
||||
|
||||
let mmsHosts = this.resolveHostname([hostToResolve]);
|
||||
if (mmsHosts.length == 0) {
|
||||
debug("No valid hostnames can be added. Stop adding host route.");
|
||||
return;
|
||||
}
|
||||
|
||||
gNetworkService.addHostRouteWithResolve(network, mmsHosts);
|
||||
}
|
||||
|
||||
return Promise.all(promises);
|
||||
},
|
||||
|
||||
removeHostRoutes: function(network) {
|
||||
let hosts = network.getDnses().concat(network.httpProxyHost);
|
||||
let gateways = network.getGateways();
|
||||
let promises = [];
|
||||
|
||||
for (let i = 0; i < hosts.length; i++) {
|
||||
let host = hosts[i];
|
||||
let gateway = this.selectGateway(gateways, host);
|
||||
if (gateway && host) {
|
||||
promises.push(gNetworkService.removeHostRoute(network.name, gateway, host));
|
||||
}
|
||||
}
|
||||
|
||||
return Promise.all(promises);
|
||||
},
|
||||
|
||||
selectGateway: function(gateways, host) {
|
||||
for (let i = 0; i < gateways.length; i++) {
|
||||
let gateway = gateways[i];
|
||||
if (gateway.match(this.REGEXP_IPV4) && host.match(this.REGEXP_IPV4) ||
|
||||
gateway.indexOf(":") != -1 && host.indexOf(":") != -1) {
|
||||
return gateway;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
setExtraHostRoute: function(network) {
|
||||
if (network.type != Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
if (!(network instanceof Ci.nsIRilNetworkInterface)) {
|
||||
let errorMsg = "Network for MMS must be an instance of " +
|
||||
"nsIRilNetworkInterface";
|
||||
debug(errorMsg);
|
||||
return Promise.reject(errorMsg);
|
||||
}
|
||||
|
||||
network = network.QueryInterface(Ci.nsIRilNetworkInterface);
|
||||
|
||||
debug("Adding mmsproxy and/or mmsc route for " + network.name);
|
||||
|
||||
let hostToResolve = network.mmsProxy;
|
||||
// Workaround an xpconnect issue with undefined string objects.
|
||||
// See bug 808220
|
||||
if (!hostToResolve || hostToResolve === "undefined") {
|
||||
hostToResolve = network.mmsc;
|
||||
}
|
||||
|
||||
let mmsHosts = this.resolveHostname([hostToResolve]);
|
||||
if (mmsHosts.length == 0) {
|
||||
let errorMsg = "No valid hostnames can be added. Stop adding host route.";
|
||||
debug(errorMsg);
|
||||
return Promise.reject(errorMsg);
|
||||
}
|
||||
|
||||
let gateways = network.getGateways();
|
||||
let promises = [];
|
||||
for (let i = 0; i < mmsHosts.length; i++) {
|
||||
let gateway = this.selectGateway(gateways, mmsHosts[i]);
|
||||
if (gateway) {
|
||||
promises.push(gNetworkService.addHostRoute(network.name, gateway,
|
||||
mmsHosts[i]));
|
||||
}
|
||||
}
|
||||
return Promise.all(promises);
|
||||
},
|
||||
|
||||
removeExtraHostRoute: function(network) {
|
||||
if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS) {
|
||||
if (!(network instanceof Ci.nsIRilNetworkInterface)) {
|
||||
debug("Network for MMS must be an instance of nsIRilNetworkInterface");
|
||||
return;
|
||||
}
|
||||
|
||||
network = network.QueryInterface(Ci.nsIRilNetworkInterface);
|
||||
|
||||
debug("Removing mmsproxy and/or mmsc route for " + network.name);
|
||||
|
||||
let hostToResolve = network.mmsProxy;
|
||||
// Workaround an xpconnect issue with undefined string objects.
|
||||
// See bug 808220
|
||||
if (!hostToResolve || hostToResolve === "undefined") {
|
||||
hostToResolve = network.mmsc;
|
||||
}
|
||||
|
||||
let mmsHosts = this.resolveHostname([hostToResolve]);
|
||||
if (mmsHosts.length == 0) {
|
||||
debug("No valid hostnames can be removed. Stop removing host route.");
|
||||
return;
|
||||
}
|
||||
|
||||
gNetworkService.removeHostRouteWithResolve(network, mmsHosts);
|
||||
if (network.type != Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
if (!(network instanceof Ci.nsIRilNetworkInterface)) {
|
||||
let errorMsg = "Network for MMS must be an instance of " +
|
||||
"nsIRilNetworkInterface";
|
||||
debug(errorMsg);
|
||||
return Promise.reject(errorMsg);
|
||||
}
|
||||
|
||||
network = network.QueryInterface(Ci.nsIRilNetworkInterface);
|
||||
|
||||
debug("Removing mmsproxy and/or mmsc route for " + network.name);
|
||||
|
||||
let hostToResolve = network.mmsProxy;
|
||||
// Workaround an xpconnect issue with undefined string objects.
|
||||
// See bug 808220
|
||||
if (!hostToResolve || hostToResolve === "undefined") {
|
||||
hostToResolve = network.mmsc;
|
||||
}
|
||||
|
||||
let mmsHosts = this.resolveHostname([hostToResolve]);
|
||||
if (mmsHosts.length == 0) {
|
||||
let errorMsg = "No valid hostnames can be removed. Stop removing host route.";
|
||||
debug(errorMsg);
|
||||
return Promise.reject(errorMsg);
|
||||
}
|
||||
|
||||
let gateways = network.getGateways();
|
||||
let promises = [];
|
||||
for (let i = 0; i < mmsHosts.length; i++) {
|
||||
let gateway = this.selectGateway(gateways, mmsHosts[i]);
|
||||
if (gateway) {
|
||||
promises.push(gNetworkService.removeHostRoute(network.name, gateway,
|
||||
mmsHosts[i]));
|
||||
}
|
||||
}
|
||||
return Promise.all(promises);
|
||||
},
|
||||
|
||||
setSecondaryDefaultRoute: function(network) {
|
||||
|
|
|
@ -10,6 +10,7 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
|||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
Cu.import("resource://gre/modules/FileUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Promise.jsm");
|
||||
|
||||
const NETWORKSERVICE_CONTRACTID = "@mozilla.org/network/service;1";
|
||||
const NETWORKSERVICE_CID = Components.ID("{baec696c-c78d-42db-8b44-603f8fbfafb4}");
|
||||
|
@ -315,30 +316,33 @@ NetworkService.prototype = {
|
|||
this.controlMessage(options);
|
||||
},
|
||||
|
||||
addHostRoute: function(network) {
|
||||
if(DEBUG) debug("Going to add host route on " + network.name);
|
||||
let gateways = network.getGateways();
|
||||
let dnses = network.getDnses();
|
||||
_setHostRoute: function(doAdd, interfaceName, gateway, host) {
|
||||
let command = doAdd ? "addHostRoute" : "removeHostRoute";
|
||||
|
||||
if (DEBUG) debug(command + " " + host + " on " + interfaceName);
|
||||
let deferred = Promise.defer();
|
||||
let options = {
|
||||
cmd: "addHostRoute",
|
||||
ifname: network.name,
|
||||
gateways: gateways,
|
||||
hostnames: dnses.concat(network.httpProxyHost)
|
||||
cmd: command,
|
||||
ifname: interfaceName,
|
||||
gateway: gateway,
|
||||
ip: host
|
||||
};
|
||||
this.controlMessage(options);
|
||||
this.controlMessage(options, function(data) {
|
||||
if (data.error) {
|
||||
deferred.reject(data.reason);
|
||||
return;
|
||||
}
|
||||
deferred.resolve();
|
||||
});
|
||||
return deferred.promise;
|
||||
},
|
||||
|
||||
removeHostRoute: function(network) {
|
||||
if(DEBUG) debug("Going to remove host route on " + network.name);
|
||||
let gateways = network.getGateways();
|
||||
let dnses = network.getDnses();
|
||||
let options = {
|
||||
cmd: "removeHostRoute",
|
||||
ifname: network.name,
|
||||
gateways: gateways,
|
||||
hostnames: dnses.concat(network.httpProxyHost)
|
||||
};
|
||||
this.controlMessage(options);
|
||||
addHostRoute: function(interfaceName, gateway, host) {
|
||||
return this._setHostRoute(true, interfaceName, gateway, host);
|
||||
},
|
||||
|
||||
removeHostRoute: function(interfaceName, gateway, host) {
|
||||
return this._setHostRoute(false, interfaceName, gateway, host);
|
||||
},
|
||||
|
||||
removeHostRoutes: function(ifname) {
|
||||
|
@ -350,30 +354,6 @@ NetworkService.prototype = {
|
|||
this.controlMessage(options);
|
||||
},
|
||||
|
||||
addHostRouteWithResolve: function(network, hosts) {
|
||||
if(DEBUG) debug("Going to add host route after dns resolution on " + network.name);
|
||||
let gateways = network.getGateways();
|
||||
let options = {
|
||||
cmd: "addHostRoute",
|
||||
ifname: network.name,
|
||||
gateways: gateways,
|
||||
hostnames: hosts
|
||||
};
|
||||
this.controlMessage(options);
|
||||
},
|
||||
|
||||
removeHostRouteWithResolve: function(network, hosts) {
|
||||
if(DEBUG) debug("Going to remove host route after dns resolution on " + network.name);
|
||||
let gateways = network.getGateways();
|
||||
let options = {
|
||||
cmd: "removeHostRoute",
|
||||
ifname: network.name,
|
||||
gateways: gateways,
|
||||
hostnames: hosts
|
||||
};
|
||||
this.controlMessage(options);
|
||||
},
|
||||
|
||||
addSecondaryRoute: function(ifname, route) {
|
||||
if(DEBUG) debug("Going to add route to secondary table on " + ifname);
|
||||
let options = {
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
#include <limits>
|
||||
#include "mozilla/dom/network/NetUtils.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h> // struct addrinfo
|
||||
#include <sys/socket.h> // getaddrinfo(), freeaddrinfo()
|
||||
#include <netdb.h>
|
||||
|
@ -76,6 +78,8 @@ static const char* NETD_MESSAGE_DELIMIT = " ";
|
|||
|
||||
static const uint32_t BUF_SIZE = 1024;
|
||||
|
||||
static const int32_t SUCCESS = 0;
|
||||
|
||||
static uint32_t SDK_VERSION;
|
||||
|
||||
struct IFProperties {
|
||||
|
@ -349,24 +353,6 @@ static int getIpType(const char *aIp) {
|
|||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to find the best match gateway. For now, return
|
||||
* the gateway that matches the address family passed.
|
||||
*/
|
||||
static uint32_t selectGateway(nsTArray<nsString>& gateways, int addrFamily)
|
||||
{
|
||||
uint32_t length = gateways.Length();
|
||||
|
||||
for (uint32_t i = 0; i < length; i++) {
|
||||
NS_ConvertUTF16toUTF8 autoGateway(gateways[i]);
|
||||
if ((getIpType(autoGateway.get()) == AF_INET && addrFamily == AF_INET) ||
|
||||
(getIpType(autoGateway.get()) == AF_INET6 && addrFamily == AF_INET6)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return length; // invalid index.
|
||||
}
|
||||
|
||||
static void postMessage(NetworkResultOptions& aResult)
|
||||
{
|
||||
MOZ_ASSERT(gNetworkUtils);
|
||||
|
@ -1046,7 +1032,7 @@ NetworkUtils::~NetworkUtils()
|
|||
|
||||
void NetworkUtils::ExecuteCommand(NetworkParams aOptions)
|
||||
{
|
||||
typedef bool (NetworkUtils::*CommandHandler)(NetworkParams&);
|
||||
typedef int32_t (NetworkUtils::*CommandHandler)(NetworkParams&);
|
||||
|
||||
const static struct {
|
||||
const char* mCommandName;
|
||||
|
@ -1095,13 +1081,22 @@ void NetworkUtils::ExecuteCommand(NetworkParams aOptions)
|
|||
}
|
||||
|
||||
// Command matches! Dispatch to the handler.
|
||||
(this->*handler)(aOptions);
|
||||
int32_t ret = 0;
|
||||
ret = (this->*handler)(aOptions);
|
||||
|
||||
if (!aOptions.mIsAsync) {
|
||||
// The requested command is synchronous, which implies the actual result
|
||||
// from netd is not important to the client. So, just notify the
|
||||
// registered callback.
|
||||
NetworkResultOptions result;
|
||||
result.mError = ret == SUCCESS ? false : true;
|
||||
result.mResultCode = ret;
|
||||
if (ret != SUCCESS) {
|
||||
// The returned value is sometimes negative, make sure we pass a positive
|
||||
// error number to strerror.
|
||||
result.mReason = NS_ConvertUTF8toUTF16(strerror(abs(ret)));
|
||||
}
|
||||
|
||||
result.mRet = true;
|
||||
postMessage(aOptions, result);
|
||||
}
|
||||
|
@ -1188,7 +1183,7 @@ void NetworkUtils::onNetdMessage(NetdCommand* aCommand)
|
|||
/**
|
||||
* Start/Stop DHCP server.
|
||||
*/
|
||||
bool NetworkUtils::setDhcpServer(NetworkParams& aOptions)
|
||||
int32_t NetworkUtils::setDhcpServer(NetworkParams& aOptions)
|
||||
{
|
||||
if (aOptions.mEnabled) {
|
||||
aOptions.mWifiStartIp = aOptions.mStartIp;
|
||||
|
@ -1201,13 +1196,13 @@ bool NetworkUtils::setDhcpServer(NetworkParams& aOptions)
|
|||
} else {
|
||||
RUN_CHAIN(aOptions, sStopDhcpServerChain, setDhcpServerFail)
|
||||
}
|
||||
return true;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set DNS servers for given network interface.
|
||||
*/
|
||||
bool NetworkUtils::setDNS(NetworkParams& aOptions)
|
||||
int32_t NetworkUtils::setDNS(NetworkParams& aOptions)
|
||||
{
|
||||
uint32_t length = aOptions.mDnses.Length();
|
||||
|
||||
|
@ -1241,13 +1236,13 @@ bool NetworkUtils::setDNS(NetworkParams& aOptions)
|
|||
RUN_CHAIN(aOptions, sSetDnsChain, setDnsFail)
|
||||
}
|
||||
|
||||
return true;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set default route and DNS servers for given network interface.
|
||||
*/
|
||||
bool NetworkUtils::setDefaultRouteAndDNS(NetworkParams& aOptions)
|
||||
int32_t NetworkUtils::setDefaultRouteAndDNS(NetworkParams& aOptions)
|
||||
{
|
||||
NS_ConvertUTF16toUTF8 autoIfname(aOptions.mIfname);
|
||||
|
||||
|
@ -1284,7 +1279,7 @@ bool NetworkUtils::setDefaultRouteAndDNS(NetworkParams& aOptions)
|
|||
|
||||
int type = getIpType(gateway);
|
||||
if (type != AF_INET && type != AF_INET6) {
|
||||
return false;
|
||||
return EAFNOSUPPORT;
|
||||
}
|
||||
|
||||
if (type == AF_INET6) {
|
||||
|
@ -1295,13 +1290,13 @@ bool NetworkUtils::setDefaultRouteAndDNS(NetworkParams& aOptions)
|
|||
}
|
||||
|
||||
setDNS(aOptions);
|
||||
return true;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove default route for given network interface.
|
||||
*/
|
||||
bool NetworkUtils::removeDefaultRoute(NetworkParams& aOptions)
|
||||
int32_t NetworkUtils::removeDefaultRoute(NetworkParams& aOptions)
|
||||
{
|
||||
uint32_t length = aOptions.mGateways.Length();
|
||||
for (uint32_t i = 0; i < length; i++) {
|
||||
|
@ -1309,7 +1304,7 @@ bool NetworkUtils::removeDefaultRoute(NetworkParams& aOptions)
|
|||
|
||||
int type = getIpType(autoGateway.get());
|
||||
if (type != AF_INET && type != AF_INET6) {
|
||||
return false;
|
||||
return EAFNOSUPPORT;
|
||||
}
|
||||
|
||||
mNetUtils->do_ifc_remove_route(GET_CHAR(mIfname),
|
||||
|
@ -1317,86 +1312,73 @@ bool NetworkUtils::removeDefaultRoute(NetworkParams& aOptions)
|
|||
0, autoGateway.get());
|
||||
}
|
||||
|
||||
return true;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add host route for given network interface.
|
||||
*/
|
||||
bool NetworkUtils::addHostRoute(NetworkParams& aOptions)
|
||||
int32_t NetworkUtils::addHostRoute(NetworkParams& aOptions)
|
||||
{
|
||||
NS_ConvertUTF16toUTF8 autoIfname(aOptions.mIfname);
|
||||
NS_ConvertUTF16toUTF8 autoHostname(aOptions.mIp);
|
||||
NS_ConvertUTF16toUTF8 autoGateway(aOptions.mGateway);
|
||||
int type, prefix;
|
||||
|
||||
uint32_t length = aOptions.mHostnames.Length();
|
||||
for (uint32_t i = 0; i < length; i++) {
|
||||
NS_ConvertUTF16toUTF8 autoHostname(aOptions.mHostnames[i]);
|
||||
|
||||
type = getIpType(autoHostname.get());
|
||||
if (type != AF_INET && type != AF_INET6) {
|
||||
continue;
|
||||
}
|
||||
|
||||
uint32_t index = selectGateway(aOptions.mGateways, type);
|
||||
if (index >= aOptions.mGateways.Length()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
NS_ConvertUTF16toUTF8 autoGateway(aOptions.mGateways[index]);
|
||||
prefix = type == AF_INET ? 32 : 128;
|
||||
mNetUtils->do_ifc_add_route(autoIfname.get(), autoHostname.get(), prefix,
|
||||
autoGateway.get());
|
||||
type = getIpType(autoHostname.get());
|
||||
if (type != AF_INET && type != AF_INET6) {
|
||||
return EAFNOSUPPORT;
|
||||
}
|
||||
return true;
|
||||
|
||||
if (type != getIpType(autoGateway.get())) {
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
prefix = type == AF_INET ? 32 : 128;
|
||||
return mNetUtils->do_ifc_add_route(autoIfname.get(), autoHostname.get(),
|
||||
prefix, autoGateway.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove host route for given network interface.
|
||||
*/
|
||||
bool NetworkUtils::removeHostRoute(NetworkParams& aOptions)
|
||||
int32_t NetworkUtils::removeHostRoute(NetworkParams& aOptions)
|
||||
{
|
||||
NS_ConvertUTF16toUTF8 autoIfname(aOptions.mIfname);
|
||||
NS_ConvertUTF16toUTF8 autoHostname(aOptions.mIp);
|
||||
NS_ConvertUTF16toUTF8 autoGateway(aOptions.mGateway);
|
||||
int type, prefix;
|
||||
|
||||
uint32_t length = aOptions.mHostnames.Length();
|
||||
for (uint32_t i = 0; i < length; i++) {
|
||||
NS_ConvertUTF16toUTF8 autoHostname(aOptions.mHostnames[i]);
|
||||
|
||||
type = getIpType(autoHostname.get());
|
||||
if (type != AF_INET && type != AF_INET6) {
|
||||
continue;
|
||||
}
|
||||
|
||||
uint32_t index = selectGateway(aOptions.mGateways, type);
|
||||
if (index >= aOptions.mGateways.Length()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
NS_ConvertUTF16toUTF8 autoGateway(aOptions.mGateways[index]);
|
||||
prefix = type == AF_INET ? 32 : 128;
|
||||
mNetUtils->do_ifc_remove_route(autoIfname.get(), autoHostname.get(), prefix,
|
||||
autoGateway.get());
|
||||
type = getIpType(autoHostname.get());
|
||||
if (type != AF_INET && type != AF_INET6) {
|
||||
return EAFNOSUPPORT;
|
||||
}
|
||||
return true;
|
||||
|
||||
if (type != getIpType(autoGateway.get())) {
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
prefix = type == AF_INET ? 32 : 128;
|
||||
return mNetUtils->do_ifc_remove_route(autoIfname.get(), autoHostname.get(),
|
||||
prefix, autoGateway.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the routes associated with the named interface.
|
||||
*/
|
||||
bool NetworkUtils::removeHostRoutes(NetworkParams& aOptions)
|
||||
int32_t NetworkUtils::removeHostRoutes(NetworkParams& aOptions)
|
||||
{
|
||||
mNetUtils->do_ifc_remove_host_routes(GET_CHAR(mIfname));
|
||||
return true;
|
||||
return mNetUtils->do_ifc_remove_host_routes(GET_CHAR(mIfname));
|
||||
}
|
||||
|
||||
bool NetworkUtils::removeNetworkRoute(NetworkParams& aOptions)
|
||||
int32_t NetworkUtils::removeNetworkRoute(NetworkParams& aOptions)
|
||||
{
|
||||
NS_ConvertUTF16toUTF8 autoIfname(aOptions.mIfname);
|
||||
NS_ConvertUTF16toUTF8 autoIp(aOptions.mIp);
|
||||
|
||||
int type = getIpType(autoIp.get());
|
||||
if (type != AF_INET && type != AF_INET6) {
|
||||
return false;
|
||||
return EAFNOSUPPORT;
|
||||
}
|
||||
|
||||
uint32_t prefixLength = GET_FIELD(mPrefixLength);
|
||||
|
@ -1405,7 +1387,7 @@ bool NetworkUtils::removeNetworkRoute(NetworkParams& aOptions)
|
|||
// Calculate subnet.
|
||||
struct in6_addr in6;
|
||||
if (inet_pton(AF_INET6, autoIp.get(), &in6) != 1) {
|
||||
return false;
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
uint32_t p, i, p1, mask;
|
||||
|
@ -1420,7 +1402,7 @@ bool NetworkUtils::removeNetworkRoute(NetworkParams& aOptions)
|
|||
|
||||
char subnetStr[INET6_ADDRSTRLEN];
|
||||
if (!inet_ntop(AF_INET6, &in6, subnetStr, sizeof subnetStr)) {
|
||||
return false;
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
// Remove default route.
|
||||
|
@ -1428,7 +1410,7 @@ bool NetworkUtils::removeNetworkRoute(NetworkParams& aOptions)
|
|||
|
||||
// Remove subnet route.
|
||||
mNetUtils->do_ifc_remove_route(autoIfname.get(), subnetStr, prefixLength, NULL);
|
||||
return true;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/* type == AF_INET */
|
||||
|
@ -1442,10 +1424,10 @@ bool NetworkUtils::removeNetworkRoute(NetworkParams& aOptions)
|
|||
|
||||
mNetUtils->do_ifc_remove_default_route(autoIfname.get());
|
||||
mNetUtils->do_ifc_remove_route(autoIfname.get(), dst, prefixLength, gateway);
|
||||
return true;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
bool NetworkUtils::addSecondaryRoute(NetworkParams& aOptions)
|
||||
int32_t NetworkUtils::addSecondaryRoute(NetworkParams& aOptions)
|
||||
{
|
||||
char command[MAX_COMMAND_SIZE];
|
||||
snprintf(command, MAX_COMMAND_SIZE - 1,
|
||||
|
@ -1456,10 +1438,10 @@ bool NetworkUtils::addSecondaryRoute(NetworkParams& aOptions)
|
|||
GET_CHAR(mGateway));
|
||||
|
||||
doCommand(command, nullptr, nullptr);
|
||||
return true;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
bool NetworkUtils::removeSecondaryRoute(NetworkParams& aOptions)
|
||||
int32_t NetworkUtils::removeSecondaryRoute(NetworkParams& aOptions)
|
||||
{
|
||||
char command[MAX_COMMAND_SIZE];
|
||||
snprintf(command, MAX_COMMAND_SIZE - 1,
|
||||
|
@ -1470,44 +1452,44 @@ bool NetworkUtils::removeSecondaryRoute(NetworkParams& aOptions)
|
|||
GET_CHAR(mGateway));
|
||||
|
||||
doCommand(command, nullptr, nullptr);
|
||||
return true;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
bool NetworkUtils::setNetworkInterfaceAlarm(NetworkParams& aOptions)
|
||||
int32_t NetworkUtils::setNetworkInterfaceAlarm(NetworkParams& aOptions)
|
||||
{
|
||||
DEBUG("setNetworkInterfaceAlarms: %s", GET_CHAR(mIfname));
|
||||
RUN_CHAIN(aOptions, sNetworkInterfaceSetAlarmChain, networkInterfaceAlarmFail);
|
||||
return true;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
bool NetworkUtils::enableNetworkInterfaceAlarm(NetworkParams& aOptions)
|
||||
int32_t NetworkUtils::enableNetworkInterfaceAlarm(NetworkParams& aOptions)
|
||||
{
|
||||
DEBUG("enableNetworkInterfaceAlarm: %s", GET_CHAR(mIfname));
|
||||
RUN_CHAIN(aOptions, sNetworkInterfaceEnableAlarmChain, networkInterfaceAlarmFail);
|
||||
return true;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
bool NetworkUtils::disableNetworkInterfaceAlarm(NetworkParams& aOptions)
|
||||
int32_t NetworkUtils::disableNetworkInterfaceAlarm(NetworkParams& aOptions)
|
||||
{
|
||||
DEBUG("disableNetworkInterfaceAlarms: %s", GET_CHAR(mIfname));
|
||||
RUN_CHAIN(aOptions, sNetworkInterfaceDisableAlarmChain, networkInterfaceAlarmFail);
|
||||
return true;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* handling main thread's reload Wifi firmware request
|
||||
*/
|
||||
bool NetworkUtils::setWifiOperationMode(NetworkParams& aOptions)
|
||||
int32_t NetworkUtils::setWifiOperationMode(NetworkParams& aOptions)
|
||||
{
|
||||
DEBUG("setWifiOperationMode: %s %s", GET_CHAR(mIfname), GET_CHAR(mMode));
|
||||
RUN_CHAIN(aOptions, sWifiOperationModeChain, wifiOperationModeFail);
|
||||
return true;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* handling main thread's enable/disable WiFi Tethering request
|
||||
*/
|
||||
bool NetworkUtils::setWifiTethering(NetworkParams& aOptions)
|
||||
int32_t NetworkUtils::setWifiTethering(NetworkParams& aOptions)
|
||||
{
|
||||
bool enable = aOptions.mEnable;
|
||||
IFProperties interfaceProperties;
|
||||
|
@ -1536,10 +1518,10 @@ bool NetworkUtils::setWifiTethering(NetworkParams& aOptions)
|
|||
GET_CHAR(mInternalIfname), GET_CHAR(mExternalIfname));
|
||||
RUN_CHAIN(aOptions, sWifiDisableChain, wifiTetheringFail)
|
||||
}
|
||||
return true;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
bool NetworkUtils::setUSBTethering(NetworkParams& aOptions)
|
||||
int32_t NetworkUtils::setUSBTethering(NetworkParams& aOptions)
|
||||
{
|
||||
bool enable = aOptions.mEnable;
|
||||
IFProperties interfaceProperties;
|
||||
|
@ -1568,7 +1550,7 @@ bool NetworkUtils::setUSBTethering(NetworkParams& aOptions)
|
|||
GET_CHAR(mInternalIfname), GET_CHAR(mExternalIfname));
|
||||
RUN_CHAIN(aOptions, sUSBDisableChain, usbTetheringFail)
|
||||
}
|
||||
return true;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
void NetworkUtils::escapeQuote(nsCString& aString)
|
||||
|
@ -1612,7 +1594,7 @@ void NetworkUtils::checkUsbRndisState(NetworkParams& aOptions)
|
|||
/**
|
||||
* Modify usb function's property to turn on USB RNDIS function
|
||||
*/
|
||||
bool NetworkUtils::enableUsbRndis(NetworkParams& aOptions)
|
||||
int32_t NetworkUtils::enableUsbRndis(NetworkParams& aOptions)
|
||||
{
|
||||
bool report = aOptions.mReport;
|
||||
|
||||
|
@ -1670,16 +1652,16 @@ bool NetworkUtils::enableUsbRndis(NetworkParams& aOptions)
|
|||
usleep(USB_FUNCTION_RETRY_INTERVAL * 1000);
|
||||
checkUsbRndisState(aOptions);
|
||||
}
|
||||
return true;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* handling upstream interface change event.
|
||||
*/
|
||||
bool NetworkUtils::updateUpStream(NetworkParams& aOptions)
|
||||
int32_t NetworkUtils::updateUpStream(NetworkParams& aOptions)
|
||||
{
|
||||
RUN_CHAIN(aOptions, sUpdateUpStreamChain, updateUpStreamFail)
|
||||
return true;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
void NetworkUtils::sendBroadcastMessage(uint32_t code, char* reason)
|
||||
|
|
|
@ -34,7 +34,6 @@ public:
|
|||
mDomain = aOther.mDomain;
|
||||
mGateway = aOther.mGateway;
|
||||
mGateways = aOther.mGateways;
|
||||
mHostnames = aOther.mHostnames;
|
||||
mId = aOther.mId;
|
||||
mIfname = aOther.mIfname;
|
||||
mPrefixLength = aOther.mPrefixLength;
|
||||
|
@ -107,14 +106,13 @@ public:
|
|||
COPY_OPT_STRING_FIELD(mDomain, EmptyString())
|
||||
COPY_OPT_STRING_FIELD(mGateway, EmptyString())
|
||||
COPY_SEQUENCE_FIELD(mGateways, nsString)
|
||||
COPY_SEQUENCE_FIELD(mHostnames, nsString)
|
||||
COPY_OPT_STRING_FIELD(mIfname, EmptyString())
|
||||
COPY_OPT_STRING_FIELD(mIp, EmptyString())
|
||||
COPY_OPT_FIELD(mPrefixLength, 0)
|
||||
COPY_OPT_STRING_FIELD(mOldIfname, EmptyString())
|
||||
COPY_OPT_STRING_FIELD(mMode, EmptyString())
|
||||
COPY_OPT_FIELD(mReport, false)
|
||||
COPY_OPT_FIELD(mIsAsync, true)
|
||||
COPY_OPT_FIELD(mIsAsync, false)
|
||||
COPY_OPT_FIELD(mEnabled, false)
|
||||
COPY_OPT_STRING_FIELD(mWifictrlinterfacename, EmptyString())
|
||||
COPY_OPT_STRING_FIELD(mInternalIfname, EmptyString())
|
||||
|
@ -154,7 +152,6 @@ public:
|
|||
nsString mDomain;
|
||||
nsString mGateway;
|
||||
nsTArray<nsString> mGateways;
|
||||
nsTArray<nsString> mHostnames;
|
||||
nsString mIfname;
|
||||
nsString mIp;
|
||||
uint32_t mPrefixLength;
|
||||
|
@ -253,24 +250,24 @@ private:
|
|||
/**
|
||||
* Commands supported by NetworkUtils.
|
||||
*/
|
||||
bool setDNS(NetworkParams& aOptions);
|
||||
bool setDefaultRouteAndDNS(NetworkParams& aOptions);
|
||||
bool addHostRoute(NetworkParams& aOptions);
|
||||
bool removeDefaultRoute(NetworkParams& aOptions);
|
||||
bool removeHostRoute(NetworkParams& aOptions);
|
||||
bool removeHostRoutes(NetworkParams& aOptions);
|
||||
bool removeNetworkRoute(NetworkParams& aOptions);
|
||||
bool addSecondaryRoute(NetworkParams& aOptions);
|
||||
bool removeSecondaryRoute(NetworkParams& aOptions);
|
||||
bool setNetworkInterfaceAlarm(NetworkParams& aOptions);
|
||||
bool enableNetworkInterfaceAlarm(NetworkParams& aOptions);
|
||||
bool disableNetworkInterfaceAlarm(NetworkParams& aOptions);
|
||||
bool setWifiOperationMode(NetworkParams& aOptions);
|
||||
bool setDhcpServer(NetworkParams& aOptions);
|
||||
bool setWifiTethering(NetworkParams& aOptions);
|
||||
bool setUSBTethering(NetworkParams& aOptions);
|
||||
bool enableUsbRndis(NetworkParams& aOptions);
|
||||
bool updateUpStream(NetworkParams& aOptions);
|
||||
int32_t setDNS(NetworkParams& aOptions);
|
||||
int32_t setDefaultRouteAndDNS(NetworkParams& aOptions);
|
||||
int32_t addHostRoute(NetworkParams& aOptions);
|
||||
int32_t removeDefaultRoute(NetworkParams& aOptions);
|
||||
int32_t removeHostRoute(NetworkParams& aOptions);
|
||||
int32_t removeHostRoutes(NetworkParams& aOptions);
|
||||
int32_t removeNetworkRoute(NetworkParams& aOptions);
|
||||
int32_t addSecondaryRoute(NetworkParams& aOptions);
|
||||
int32_t removeSecondaryRoute(NetworkParams& aOptions);
|
||||
int32_t setNetworkInterfaceAlarm(NetworkParams& aOptions);
|
||||
int32_t enableNetworkInterfaceAlarm(NetworkParams& aOptions);
|
||||
int32_t disableNetworkInterfaceAlarm(NetworkParams& aOptions);
|
||||
int32_t setWifiOperationMode(NetworkParams& aOptions);
|
||||
int32_t setDhcpServer(NetworkParams& aOptions);
|
||||
int32_t setWifiTethering(NetworkParams& aOptions);
|
||||
int32_t setUSBTethering(NetworkParams& aOptions);
|
||||
int32_t enableUsbRndis(NetworkParams& aOptions);
|
||||
int32_t updateUpStream(NetworkParams& aOptions);
|
||||
|
||||
/**
|
||||
* function pointer array holds all netd commands should be executed
|
||||
|
|
|
@ -104,7 +104,7 @@ interface nsIUpdateUpStreamCallback : nsISupports
|
|||
/**
|
||||
* Provide network services.
|
||||
*/
|
||||
[scriptable, uuid(f96461fa-e844-45d2-a6c3-8cd23ab0916b)]
|
||||
[scriptable, uuid(ddb38428-0cf2-4c6a-a3c9-5e2f00fc54db)]
|
||||
interface nsINetworkService : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -254,18 +254,34 @@ interface nsINetworkService : nsISupports
|
|||
/**
|
||||
* Add host route.
|
||||
*
|
||||
* @param networkInterface
|
||||
* The network interface we want to add to the host route.
|
||||
* @param interfaceName
|
||||
* Network interface name for the output of the host route.
|
||||
* @param gateway
|
||||
* Gateway ip for the output of the host route.
|
||||
* @param host
|
||||
* Host ip we want to add route for.
|
||||
*
|
||||
* @return A deferred promise that resolves on success or rejects with a
|
||||
* specified reason otherwise.
|
||||
*/
|
||||
void addHostRoute(in nsINetworkInterface networkInterface);
|
||||
jsval addHostRoute(in DOMString interfaceName, in DOMString gateway,
|
||||
in DOMString host);
|
||||
|
||||
/**
|
||||
* Remove host route.
|
||||
*
|
||||
* @param network
|
||||
* The network interface we want to remove from the host route.
|
||||
* @param interfaceName
|
||||
* Network interface name for the output of the host route.
|
||||
* @param gateway
|
||||
* Gateway ip for the output of the host route.
|
||||
* @param host
|
||||
* Host ip we want to remove route for.
|
||||
*
|
||||
* @return A deferred promise that resolves on success or rejects with a
|
||||
* specified reason otherwise.
|
||||
*/
|
||||
void removeHostRoute(in nsINetworkInterface network);
|
||||
jsval removeHostRoute(in DOMString interfaceName, in DOMString gateway,
|
||||
in DOMString host);
|
||||
|
||||
/**
|
||||
* Remove all host routes.
|
||||
|
@ -275,26 +291,6 @@ interface nsINetworkService : nsISupports
|
|||
*/
|
||||
void removeHostRoutes(in DOMString interfaceName);
|
||||
|
||||
/**
|
||||
* Add host route with resolve.
|
||||
*
|
||||
* @param network
|
||||
* The network interface we want to add to the host route.
|
||||
* @param hosts
|
||||
* The array of host names we want to add.
|
||||
*/
|
||||
void addHostRouteWithResolve(in nsINetworkInterface network, in jsval hosts);
|
||||
|
||||
/**
|
||||
* Remove host route with resolve.
|
||||
*
|
||||
* @param network
|
||||
* The network interface we want to remove from the host route.
|
||||
* @param hosts
|
||||
* The array of host names we want to remove.
|
||||
*/
|
||||
void removeHostRouteWithResolve(in nsINetworkInterface network, in jsval hosts);
|
||||
|
||||
/**
|
||||
* Add route to secondary routing table.
|
||||
*
|
||||
|
|
|
@ -19,9 +19,7 @@ dictionary NetworkCommandOptions
|
|||
sequence<DOMString> dnses; // for "setDNS", "setDefaultRouteAndDNS".
|
||||
DOMString oldIfname; // for "setDefaultRouteAndDNS".
|
||||
DOMString gateway; // for "addSecondaryRoute", "removeSecondaryRoute".
|
||||
sequence<DOMString> gateways; // for "setDefaultRouteAndDNS", "removeDefaultRoute",
|
||||
// "addHostRoute", "removeHostRoute".
|
||||
sequence<DOMString> hostnames; // for "addHostRoute", "removeHostRoute".
|
||||
sequence<DOMString> gateways; // for "setDefaultRouteAndDNS", "removeDefaultRoute".
|
||||
DOMString mode; // for "setWifiOperationMode".
|
||||
boolean report; // for "setWifiOperationMode".
|
||||
boolean isAsync; // for "setWifiOperationMode".
|
||||
|
|
Загрузка…
Ссылка в новой задаче