Home | History | Annotate | Download | only in cros

Lines Matching refs:Network

32 // NetworkLibraryImpl manages a series of classes that describe network devices
38 // Network: a network service ("network").
39 // network_map_: canonical map<path,Network*> for all visible networks.
41 // ethernet_: EthernetNetwork* to the active ethernet network in network_map_.
42 // WirelessNetwork: a Wifi or Cellular Network.
44 // active_wifi_: WifiNetwork* to the active wifi network in network_map_.
50 // network_unique_id_map_: map<unique_id,Network*> for visible networks.
51 // remembered_network_map_: a canonical map<path,Network*> for all networks
56 // network_manager_monitor_: a handle to the libcros network Manager handler.
62 // rebuilds the network lists without destroying existing Network structures,
68 // AddNetworkObserver: Adds an observer for a specific network.
69 // NetworkObserverList: A monitor and list of observers of a network.
70 // network_monitor_: a handle to the libcros network Service handler.
90 // Only send network change notifications to observers once every 50ms.
292 // Flimflam network technology options.
324 const char* kErrorNeedHomeNetwork = "need-home-network";
620 // Network.
1024 // Network
1026 void Network::SetName(const std::string& name) {
1032 bool Network::ParseValue(int index, const Value* value) {
1039 << "Network with mismatched type: " << service_path_
1107 void Network::ParseInfo(const DictionaryValue* info) {
1117 VLOG(1) << "Network: " << name()
1124 void Network::SetValueProperty(const char* prop, Value* val) {
1132 void Network::ClearProperty(const char* prop) {
1139 void Network::SetStringProperty(
1147 void Network::SetOrClearStringProperty(const char* prop,
1159 void Network::SetBooleanProperty(const char* prop, bool b, bool* dest) {
1166 void Network::SetIntegerProperty(const char* prop, int i, int* dest) {
1173 void Network::SetAutoConnect(bool auto_connect) {
1177 std::string Network::GetStateString() const {
1202 std::string Network::GetErrorString() const {
1237 void Network::InitIPAddress() {
1263 // Note: shadows Network::name_ property.
1312 return Network::ParseValue(index, value);
1319 Network::ParseInfo(info);
1402 return Network::ParseValue(index, value);
1843 // Does not change network name when it was already set by WiFi.HexSSID.
1922 Network::ParseInfo(info);
2329 // Returns IP address for the active network.
2331 const Network* result = active_network();
2335 result = ethernet_; // Use non active ethernet addr if no active network.
2396 virtual Network* FindNetworkByPath(const std::string& path) const {
2404 Network* network = FindNetworkByPath(path);
2405 if (network &&
2406 (network->type() == TYPE_WIFI || network->type() == TYPE_CELLULAR))
2407 return static_cast<WirelessNetwork*>(network);
2412 Network* network = FindNetworkByPath(path);
2413 if (network && network->type() == TYPE_WIFI)
2414 return static_cast<WifiNetwork*>(network);
2420 Network* network = FindNetworkByPath(path);
2421 if (network && network->type() == TYPE_CELLULAR)
2422 return static_cast<CellularNetwork*>(network);
2428 Network* network = FindNetworkByPath(path);
2429 if (network && network->type() == TYPE_VPN)
2430 return static_cast<VirtualNetwork*>(network);
2434 virtual Network* FindNetworkFromRemembered(
2435 const Network* remembered) const {
2577 // TODO(dpolukhin): Notify observers about network registration status
2641 Network* network = networklib->FindNetworkByPath(path);
2642 if (!network) {
2643 LOG(ERROR) << "No network for path: " << path;
2649 << network->name()
2655 network->set_state(STATE_FAILURE);
2656 network->set_error(ERROR_BAD_PASSPHRASE);
2662 VLOG(1) << "Connected to service: " << network->name();
2665 if (network->type() == TYPE_WIFI) {
2666 WifiNetwork* wifi = static_cast<WifiNetwork *>(network);
2673 } else if (network->type() == TYPE_CELLULAR) {
2674 networklib->active_cellular_ = static_cast<CellularNetwork *>(network);
2675 } else if (network->type() == TYPE_VPN) {
2676 networklib->active_virtual_ = static_cast<VirtualNetwork *>(network);
2678 LOG(ERROR) << "Network of unexpected type: " << network->type();
2681 // If we succeed, this network will be remembered; request an update.
2686 networklib->NotifyUserConnectionInitiated(network);
2690 void CallConnectToNetwork(Network* network) {
2691 DCHECK(network);
2692 if (!EnsureCrosLoaded() || !network)
2697 network->set_connecting(true);
2699 RequestNetworkServiceConnect(network->service_path().c_str(),
2704 // This will happen if a network resets or gets out of range.
2711 // Use this to connect to a wifi network by service path.
2715 LOG(WARNING) << "Attempt to connect to non existing network: "
2722 // Use this to connect to an unlisted wifi network.
2754 Network* network =
2756 DCHECK(network->type() == TYPE_WIFI);
2758 static_cast<WifiNetwork*>(network));
2765 LOG(WARNING) << "Wifi network name does not match ConnectData: "
2829 Network* network =
2831 DCHECK(network->type() == TYPE_VPN);
2833 static_cast<VirtualNetwork*>(network));
2842 LOG(WARNING) << "Virtual network name does not match ConnectData: "
2859 virtual void DisconnectFromNetwork(const Network* network) {
2860 DCHECK(network);
2861 if (!EnsureCrosLoaded() || !network)
2863 VLOG(1) << "Disconnect from network: " << network->service_path();
2864 if (chromeos::DisconnectFromNetwork(network->service_path().c_str())) {
2866 Network* found_network = FindNetworkByPath(network->service_path());
2925 virtual const Network* active_network() const {
2927 // network is (i.e. don't assume priority of network types).
2928 Network* result = NULL;
2942 virtual const Network* connected_network() const {
2944 // network is (i.e. don't assume priority of network types).
2945 Network* result = NULL;
2981 // If network device is already enabled/disabled, then don't do anything.
3039 typedef std::map<std::string, Network*> NetworkMap;
3126 // Currently we ignore the network manager state.
3243 // Network no longer exists.
3260 // Remembered network no longer exists.
3299 // Network technology functions.
3342 // Network list management functions.
3346 // networks to a list or setting an active network so that we do not show them
3351 void UpdateActiveNetwork(Network* network) {
3352 ConnectionType type(network->type());
3358 ethernet_ = static_cast<EthernetNetwork*>(network);
3363 if (active_wifi_ == NULL && network->connecting_or_connected())
3364 active_wifi_ = static_cast<WifiNetwork*>(network);
3369 if (active_cellular_ == NULL && network->connecting_or_connected())
3370 active_cellular_ = static_cast<CellularNetwork*>(network);
3374 if (active_virtual_ == NULL && network->connecting_or_connected())
3375 active_virtual_ = static_cast<VirtualNetwork*>(network);
3379 void AddNetwork(Network* network) {
3381 network_map_.insert(std::make_pair(network->service_path(), network));
3382 DCHECK(result.second); // Should only get called with new network.
3383 VLOG(2) << "Adding Network: " << network->service_path()
3384 << " (" << network->name() << ")";
3385 ConnectionType type(network->type());
3388 wifi_networks_.push_back(static_cast<WifiNetwork*>(network));
3391 cellular_networks_.push_back(static_cast<CellularNetwork*>(network));
3393 virtual_networks_.push_back(static_cast<VirtualNetwork*>(network));
3395 // Do not set the active network here. Wait until we parse the network.
3399 // for an existing network, e.g. an error occurred while fetching a network.
3407 Network* network = found->second;
3409 if (!network->unique_id().empty())
3410 network_unique_id_map_.erase(network->unique_id());
3411 ConnectionType type(network->type());
3413 if (network == ethernet_) {
3415 LOG(ERROR) << "Deleting active ethernet network: " << service_path;
3420 wifi_networks_.begin(), wifi_networks_.end(), network);
3423 if (network == active_wifi_) {
3425 LOG(ERROR) << "Deleting active wifi network: " << service_path;
3430 cellular_networks_.begin(), cellular_networks_.end(), network);
3433 if (network == active_cellular_) {
3435 LOG(ERROR) << "Deleting active cellular network: " << service_path;
3447 virtual_networks_.begin(), virtual_networks_.end(), network);
3450 if (network == active_virtual_) {
3452 LOG(ERROR) << "Deleting active virtual network: " << service_path;
3456 delete network;
3463 DCHECK(result.second); // Should only get called with new network.
3470 LOG(WARNING) << "Attempt to delete non-existant remembered network: "
3474 Network* remembered_network = found->second;
3481 Network* network = FindNetworkFromRemembered(remembered_network);
3482 if (network && network->type() == TYPE_WIFI) {
3484 WifiNetwork* wifi = static_cast<WifiNetwork*>(network);
3487 // Network is not in visible list.
3488 VLOG(2) << "Remembered Network not found: "
3494 // Update all network lists, and request associated service updates.
3503 // wifi_scanning_ will remain false unless we request a network update.
3511 // If we find the network in "old", add it immediately to the map
3519 // Always request network updates.
3521 // rely on watched network updates and only request updates here for
3523 // Use update_request map to store network priority.
3538 // Request updates for watched networks. Does not affect network lists.
3575 // If we find the network in "old", add it immediately to the map
3580 Network* network = found->second;
3581 if (network->type() == TYPE_WIFI) {
3582 WifiNetwork* wifi = static_cast<WifiNetwork*>(network);
3601 Network* CreateNewNetwork(ConnectionType type,
3622 return new Network(service_path, type);
3627 Network* ParseNetwork(const std::string& service_path,
3629 Network* network = FindNetworkByPath(service_path);
3630 if (!network) {
3632 network = CreateNewNetwork(type, service_path);
3633 AddNetwork(network);
3637 if (!network->unique_id().empty())
3638 network_unique_id_map_.erase(network->unique_id());
3640 network->ParseInfo(info); // virtual.
3642 if (!network->unique_id().empty())
3643 network_unique_id_map_[network->unique_id()] = network;
3645 UpdateActiveNetwork(network);
3647 // Find and erase entry in update_requests, and set network priority.
3650 network->priority_order_ = found2->second;
3662 VLOG(1) << "ParseNetwork: " << network->name();
3664 return network;
3667 // Returns NULL if |service_path| refers to a network that is not a
3669 Network* ParseRememberedNetwork(const std::string& service_path,
3671 Network* network;
3674 network = found->second;
3678 network = CreateNewNetwork(type, service_path);
3679 WifiNetwork* wifi = static_cast<WifiNetwork*>(network);
3682 VLOG(1) << "Ignoring remembered network: " << service_path
3687 network->ParseInfo(info); // virtual.
3688 VLOG(1) << "ParseRememberedNetwork: " << network->name();
3690 return network;
3808 // If network device is already enabled/disabled, then don't do anything.
3855 void NotifyNetworkChanged(Network* network) {
3856 VLOG(2) << "Network changed: " << network->name();
3857 DCHECK(network);
3859 network->service_path());
3863 OnNetworkChanged(this, network));
3867 network->service_path();
3900 void NotifyUserConnectionInitiated(const Network* network) {
3903 OnConnectionInitiated(this, network));
3964 Network* network = FindNetworkByPath(path);
3965 if (network) {
3966 VLOG(2) << "UpdateNetworkStatus: " << network->name() << "." << key;
3969 if (!network->ParseValue(index, value)) {
3973 NotifyNetworkChanged(network);
4045 // Now, update any matching cellular network's cached data
4049 // If the network needs a new plan, then there's no data.
4067 VLOG(1) << "Requesting initial network manager info from libcros.";
4221 // Network manager observer list
4233 // Network observer map
4236 // Network device observer map.
4239 // For monitoring network manager status changes.
4242 // For monitoring data plan changes to the connected cellular network.
4245 // Network login observer.
4263 // A network service path based map of all CellularDataPlanVectors.
4266 // The ethernet network.
4272 // The current connected (or connecting) wifi network.
4281 // The current connected (or connecting) cellular network.
4287 // The current connected (or connecting) virtual network.
4293 // The current available network devices. Bitwise flag of ConnectionTypes.
4296 // The current enabled network devices. Bitwise flag of ConnectionTypes.
4299 // The current connected network devices. Bitwise flag of ConnectionTypes.
4308 // True if access network library is locked.
4314 // Delayed task to notify a network change.
4421 virtual Network* FindNetworkByPath(
4429 virtual Network* FindNetworkFromRemembered(
4430 const Network* remembered) const { return NULL; }
4450 virtual void ConnectToWifiNetwork(WifiNetwork* network) {}
4457 virtual void ConnectToCellularNetwork(CellularNetwork* network) {}
4458 virtual void ConnectToVirtualNetwork(VirtualNetwork* network) {}
4467 virtual void DisconnectFromNetwork(const Network* network) {}
4477 virtual const Network* active_network() const { return NULL; }
4478 virtual const Network* connected_network() const { return NULL; }