2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 * @file FNet_SystemNetConnection.cpp
19 * @brief This is the implementation file for _SystemNetConnection class.
22 * This file contains the implementation of _SystemNetConnection class.
26 #include <net_connection.h>
27 #include <FNetNetConnectionInfo.h>
28 #include <FBaseRtMutexGuard.h>
29 #include <FBaseSysLog.h>
30 #include <FBase_StringConverter.h>
31 #include <FIo_DirectoryImpl.h>
32 #include "FNet_NetTypes.h"
33 #include "FNet_SystemNetConnection.h"
34 #include "FNet_NetConnectionInfoImpl.h"
35 #include "FNet_DefaultSystemNetConnection.h"
36 #include "FNet_PsSystemNetConnection.h"
37 #include "FNet_WifiSystemNetConnection.h"
38 #include "FNet_WifiDirectSystemNetConnection.h"
39 #include "FNet_UsbSystemNetConnection.h"
40 #include "FNet_NetAccountDatabase.h"
41 #include "FNet_NetAccountManagerImpl.h"
42 #include "FNet_NetConnectionEvent.h"
43 #include "FNet_NetConnectionEventArg.h"
44 #include "FNet_NetUtility.h"
47 using namespace Tizen::Base;
48 using namespace Tizen::Base::Collection;
49 using namespace Tizen::Base::Runtime;
50 using namespace Tizen::Io;
52 namespace Tizen { namespace Net {
54 bool _SystemNetConnection::__isInitialized = false;
55 HashMap* _SystemNetConnection::__pPsSystemConnectionMap = null;
56 _DefaultSystemNetConnection* _SystemNetConnection::__pDefaultConnection = null;
57 _WifiSystemNetConnection* _SystemNetConnection::__pWifiConnection = null;
58 _WifiDirectSystemNetConnection* _SystemNetConnection::__pWifiDirectConnection = null;
59 _UsbSystemNetConnection* _SystemNetConnection::__pUsbConnection = null;
61 _SystemNetConnection::_SystemNetConnection(void)
62 : _bearerType(NET_BEARER_NONE)
63 , _connectionState(NET_CONNECTION_STATE_NONE)
64 , _pConnectionInfo(null)
71 _SystemNetConnection::~_SystemNetConnection(void)
76 _SystemNetConnection::Initialize(const String& name)
80 unique_ptr<_NetConnectionInfoImpl> pConnectionInfo(new (std::nothrow) _NetConnectionInfoImpl());
81 SysTryReturnResult(NID_NET, pConnectionInfo != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
83 unique_ptr<ArrayList> pEventList(new (std::nothrow) ArrayList());
84 SysTryReturnResult(NID_NET, pEventList != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
86 r = pEventList->Construct();
87 SysTryReturnResult(NID_NET, r == E_SUCCESS, r, "Propagating.");
89 unique_ptr<Mutex> pLock(new (std::nothrow) Mutex());
90 SysTryReturnResult(NID_NET, pLock != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
92 r = pLock->Create(name);
93 SysTryReturnResult(NID_NET, r == E_SUCCESS, r, "Propagating.");
96 _pConnectionInfo = move(pConnectionInfo);
97 _pEventList = move(pEventList);
104 _SystemNetConnection::Deinitialize(void)
106 _bearerType = NET_BEARER_NONE;
107 _connectionState = NET_CONNECTION_STATE_NONE;
109 _pConnectionInfo.reset(null);
110 _pEventList.reset(null);
116 _SystemNetConnection::AddEvent(_NetConnectionEvent& event)
118 result r = E_SUCCESS;
119 bool isFound = false;
121 SysAssertf(_pEventList != null, "Not yet constructed. Construct() should be called before use.");
123 MutexGuard locked(*_pLock);
125 isFound = _pEventList->Contains(event);
128 r = _pEventList->Add(event);
137 _SystemNetConnection::RemoveEvent(_NetConnectionEvent& event)
139 result r = E_SUCCESS;
140 bool isFound = false;
142 SysAssertf(_pEventList != null, "Not yet constructed. Construct() should be called before use.");
144 MutexGuard locked(*_pLock);
146 isFound = _pEventList->Contains(event);
149 event.SetConnectionState(NET_CONNECTION_STATE_NONE);
150 r = _pEventList->Remove(event, false);
159 _SystemNetConnection::Start(_NetConnectionEvent& event)
161 result r = E_SUCCESS;
163 SysAssertf(_pEventList != null, "Not yet constructed. Construct() should be called before use.");
165 MutexGuard locked(*_pLock);
167 if (_connectionState == NET_CONNECTION_STATE_STARTED)
169 SysLog(NID_NET, "[%ls] is already connected.", _name.GetPointer());
171 if (event.GetConnectionState() != NET_CONNECTION_STATE_STARTED)
173 unique_ptr<_NetConnectionEventArg> pEventArg(new (std::nothrow) _NetConnectionEventArg(_NET_CONNECTION_EVENT_TYPE_STARTED, E_SUCCESS));
174 SysTryReturnResult(NID_NET, pEventArg != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
176 event.SetConnectionState(NET_CONNECTION_STATE_STARTED);
177 r = event.FireAsync(*pEventArg);
178 SysTryReturnResult(NID_NET, r == E_SUCCESS, r, "Propagating.", GetErrorMessage(r));
186 SysLogException(NID_NET, E_INVALID_CONNECTION,
187 "[%s] %ls is NOT connected.", GetErrorMessage(E_INVALID_CONNECTION), _name.GetPointer());
188 r = E_INVALID_CONNECTION;
197 _SystemNetConnection::Stop(_NetConnectionEvent& event, bool waitingEvent)
199 result r = E_SUCCESS;
201 SysAssertf(_pEventList != null, "Not yet constructed. Construct() should be called before use.");
203 MutexGuard locked(*_pLock);
205 if ((event.GetConnectionState() != NET_CONNECTION_STATE_STOPPED) &&
206 (event.GetConnectionState() != NET_CONNECTION_STATE_NONE))
210 unique_ptr<_NetConnectionEventArg> pEventArg(new (std::nothrow) _NetConnectionEventArg(_NET_CONNECTION_EVENT_TYPE_STOPPED, E_SUCCESS));
211 SysTryReturnResult(NID_NET, pEventArg != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
213 event.SetConnectionState(NET_CONNECTION_STATE_STOPPED);
214 r = event.FireAsync(*pEventArg);
215 SysTryReturnResult(NID_NET, r == E_SUCCESS, r, "Propagating.");
229 _SystemNetConnection::HandleStartResponse(result error, void* pData)
231 SysLog(NID_NET, "[%ls] Ignore HandleStartResponse(%s,0x%x).", _name.GetPointer(), GetErrorMessage(error), pData);
235 _SystemNetConnection::HandleStopResponse(void)
237 SysLog(NID_NET, "[%ls] Ignore HandleStopResponse.", _name.GetPointer());
241 _SystemNetConnection::HandleStartEvent(void)
243 _NetConnectionEvent* pEvent = null;
244 _NetConnectionEventArg* pEventArg = null;
246 if (_connectionState == NET_CONNECTION_STATE_STARTED)
248 SysLog(NID_NET, "[%ls] Ignore HandleStartEvent() because this instance is in started state.", _name.GetPointer());
252 SysLog(NID_NET, "[%ls] Notify started event.", _name.GetPointer());
254 MutexGuard locked(*_pLock);
256 unique_ptr<IEnumerator> pEnum(_pEventList->GetEnumeratorN());
259 while (pEnum->MoveNext() == E_SUCCESS)
261 pEvent = dynamic_cast<_NetConnectionEvent*>(pEnum->GetCurrent());
264 if (pEvent->GetConnectionState() == NET_CONNECTION_STATE_STARTING)
266 pEvent->SetConnectionState(NET_CONNECTION_STATE_STARTED);
267 pEventArg = new (std::nothrow) _NetConnectionEventArg(_NET_CONNECTION_EVENT_TYPE_STARTED, E_SUCCESS);
268 if (pEventArg != null)
270 pEvent->FireAsync(*pEventArg);
281 _SystemNetConnection::HandleStopEvent(result error)
283 _NetConnectionEvent* pEvent = null;
284 _NetConnectionEventArg* pEventArg = null;
286 if ((_connectionState == NET_CONNECTION_STATE_NONE) || (_connectionState == NET_CONNECTION_STATE_STOPPED))
288 SysLog(NID_NET, "[%ls] Ignore HandleStopEvent(%s) because this instance is in stopped state.", _name.GetPointer(), GetErrorMessage(error));
292 SysLog(NID_NET, "[%ls] Notify stopped event.", _name.GetPointer());
294 MutexGuard locked(*_pLock);
298 unique_ptr<IEnumerator> pEnum(_pEventList->GetEnumeratorN());
301 while (pEnum->MoveNext() == E_SUCCESS)
303 pEvent = dynamic_cast<_NetConnectionEvent*>(pEnum->GetCurrent());
306 if ((pEvent->GetConnectionState() != NET_CONNECTION_STATE_NONE) &&
307 (pEvent->GetConnectionState() != NET_CONNECTION_STATE_STOPPED))
309 pEvent->SetConnectionState(NET_CONNECTION_STATE_STOPPED);
310 pEventArg = new (std::nothrow) _NetConnectionEventArg(_NET_CONNECTION_EVENT_TYPE_STOPPED, error);
311 if (pEventArg != null)
313 pEvent->FireAsync(*pEventArg);
324 _SystemNetConnection::QueryConnectionState(String& devName) const
326 if (_pConnectionInfo != null)
328 devName = _pConnectionInfo->GetDeviceName();
331 SysLog(NID_NET, "QueryConnectionState() has done with state:%d, devName:%ls", _connectionState, devName.GetPointer());
333 return _connectionState;
337 _SystemNetConnection::GetBearerType(void) const
343 _SystemNetConnection::GetConnectionState(void) const
345 return _connectionState;
349 _SystemNetConnection::GetProxyAddress(void) const
353 if (_pConnectionInfo != null)
355 proxyAddress = _pConnectionInfo->GetProxyAddress();
358 SysLog(NID_NET, "GetProxyAddress() has done with proxy:%ls", proxyAddress.GetPointer());
364 _SystemNetConnection::GetConnectionInfo(NetConnectionInfo& netConnectionInfo)
366 _NetConnectionInfoImpl* pSource = _pConnectionInfo.get();
367 _NetConnectionInfoImpl* pDestnation = _NetConnectionInfoImpl::GetInstance(netConnectionInfo);
369 SysTryReturnVoidResult(NID_NET, ((pSource != null) && (pDestnation != null)), E_INVALID_ARG,
370 "[%s] Invalid argument is used. The impl instance is null. [0x%x] [0x%x]", GetErrorMessage(E_INVALID_ARG), pSource, pDestnation);
372 MutexGuard locked(*_pLock);
374 pDestnation->CopyFrom(pSource);
380 _SystemNetConnection::InitializeNetworkFramework(void)
382 static pthread_once_t onceBlock = PTHREAD_ONCE_INIT;
384 if (!__isInitialized)
387 pthread_once(&onceBlock, InitializeNetworkFrameworkOnce);
388 result r = GetLastResult();
391 onceBlock = PTHREAD_ONCE_INIT;
397 _SystemNetConnection::InitializeNetworkFrameworkOnce(void)
399 result r = E_SUCCESS;
400 NetAccountId accountId = INVALID_HANDLE;
403 __pPsSystemConnectionMap = new (std::nothrow) HashMap();
404 SysTryReturnVoidResult(NID_NET, __pPsSystemConnectionMap != null, E_OUT_OF_MEMORY,
405 "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
407 r = __pPsSystemConnectionMap->Construct();
408 r = TransExceptionsExclusive(r, E_SYSTEM, E_OUT_OF_MEMORY);
409 SysTryReturnVoidResult(NID_NET, r == E_SUCCESS, r,
410 "[%s] A system error has been occurred. Failed to initialize the HashMap.", GetErrorMessage(r));
412 r = _NetAccountDatabase::InitializeRepository();
413 r = TransExceptionsExclusive(r, E_SYSTEM, E_OUT_OF_MEMORY);
414 SysTryReturnVoidResult(NID_NET, r == E_SUCCESS, r,
415 "[%s] A system error has been occurred. Failed to initialize the network database.", GetErrorMessage(r));
417 _NetProfileInfo internetProfileInfo = _NetAccountManagerImpl::GetInternetProfileInfo();
418 _NetProfileInfo mmsProfileInfo = _NetAccountManagerImpl::GetMmsProfileInfo();
421 r = _NetAccountDatabase::GetProfileName(_DEFAULT_PS_ACCOUNT_ID, profileName);
422 if (internetProfileInfo.GetProfileName().IsEmpty())
424 SysLog(NID_NET, "Internet profile is not found.");
426 if (!profileName.IsEmpty())
428 SysLog(NID_NET, "Remove Internet profile from database.");
429 r = _NetAccountDatabase::RemoveAccountByAccountId(_DEFAULT_PS_ACCOUNT_ID);
434 if (internetProfileInfo.GetProfileName() != profileName)
436 SysLog(NID_NET, "Internet profile is changed. [%ls] -> [%ls]", profileName.GetPointer(), internetProfileInfo.GetProfileName().GetPointer());
438 if (!profileName.IsEmpty())
440 r = _NetAccountDatabase::RemoveAccountByAccountId(_DEFAULT_PS_ACCOUNT_ID);
443 r = _NetAccountDatabase::RemoveAccountByProfileName(internetProfileInfo.GetProfileName());
446 accountName.Append(internetProfileInfo.GetProfileDisplayName());
447 accountName.Append(internetProfileInfo.GetProfileName());
449 r = _NetAccountDatabase::AddAccount(accountName, internetProfileInfo.GetProfileName(), _NET_ACCOUNT_OWNER_SYSTEM_INTERNET, accountId);
455 r = _NetAccountDatabase::GetProfileName(_DEFAULT_MMS_ACCOUNT_ID, profileName);
456 if (mmsProfileInfo.GetProfileName().IsEmpty())
458 SysLog(NID_NET, "MMS profile is not found.");
460 if (!profileName.IsEmpty())
462 SysLog(NID_NET, "Remove MMS profile from database.");
463 r = _NetAccountDatabase::RemoveAccountByAccountId(_DEFAULT_MMS_ACCOUNT_ID);
468 if (mmsProfileInfo.GetProfileName() != profileName)
470 SysLog(NID_NET, "MMS profile is changed. [%ls] -> [%ls]", profileName.GetPointer(), mmsProfileInfo.GetProfileName().GetPointer());
472 if (!profileName.IsEmpty())
474 r = _NetAccountDatabase::RemoveAccountByAccountId(_DEFAULT_MMS_ACCOUNT_ID);
477 r = _NetAccountDatabase::RemoveAccountByProfileName(mmsProfileInfo.GetProfileName());
480 accountName.Append(mmsProfileInfo.GetProfileDisplayName());
481 accountName.Append(mmsProfileInfo.GetProfileName());
483 r = _NetAccountDatabase::AddAccount(accountName, mmsProfileInfo.GetProfileName(), _NET_ACCOUNT_OWNER_SYSTEM_MMS, accountId);
487 unique_ptr<IList, _CollectionDeleter> pAccountList(_NetAccountDatabase::GetProfileNamesN());
488 unique_ptr<IList, _CollectionDeleter> pProfileList(_NetAccountManagerImpl::GetAllProfileInfosN());
490 if (pProfileList != null)
492 if (pProfileList->GetCount() > 0)
494 SysLog(NID_NET, "[%d] profiles are found.", pProfileList->GetCount());
496 unique_ptr<IEnumerator> pEnum(pProfileList->GetEnumeratorN());
499 _NetProfileInfo* pProfileInfo = null;
500 while (pEnum->MoveNext() == E_SUCCESS)
502 pProfileInfo = dynamic_cast<_NetProfileInfo*>(pEnum->GetCurrent());
503 if (pProfileInfo != null)
505 if (pAccountList->Contains(pProfileInfo->GetProfileName()))
507 SysLog(NID_NET, "ProfileName[%ls] is already on DB.", pProfileInfo->GetProfileName().GetPointer());
508 pAccountList->Remove(pProfileInfo->GetProfileName(), true);
512 // OSP or Non-default account
514 accountName.Append(pProfileInfo->GetProfileDisplayName());
515 accountName.Append(pProfileInfo->GetProfileName());
517 SysLog(NID_NET, "ProfileName[%ls] is not found on DB, so add it.", pProfileInfo->GetProfileName().GetPointer());
518 r = _NetAccountDatabase::AddAccount(accountName, pProfileInfo->GetProfileName(), _NET_ACCOUNT_OWNER_OTHER, accountId);
526 if (pAccountList != null)
528 if (pAccountList->GetCount() > 0)
530 SysLog(NID_NET, "[%d] zombie accounts are on DB.", pAccountList->GetCount());
532 unique_ptr<IEnumerator> pEnum(pAccountList->GetEnumeratorN());
535 String* pProfileName = null;
536 while (pEnum->MoveNext() == E_SUCCESS)
538 pProfileName = dynamic_cast<String*>(pEnum->GetCurrent());
539 if (pProfileName != null)
541 r = _NetAccountDatabase::RemoveAccountByProfileName(*pProfileName);
549 static const wchar_t _DEFAULT_PS_ACCOUNT_NAME_FOR_EMULATOR[] = L"Tizen_Internet_1";
550 static const wchar_t _DEFAULT_MMS_ACCOUNT_NAME_FOR_EMULATOR[] = L"Tizen_Mms_2";
552 String defaultAccountName;
553 int defaultAccountId;
555 r = _NetAccountDatabase::GetAccountName(_DEFAULT_PS_ACCOUNT_ID, defaultAccountName);
558 SysLog(NID_NET, "Default PS account is not found, so add it now.");
559 r = _NetAccountDatabase::AddAccount(String(_DEFAULT_PS_ACCOUNT_NAME_FOR_EMULATOR),
560 String(_DEFAULT_PS_ACCOUNT_NAME_FOR_EMULATOR), _NET_ACCOUNT_OWNER_SYSTEM_INTERNET, defaultAccountId);
561 r = _NetAccountDatabase::AddAccount(String(_DEFAULT_MMS_ACCOUNT_NAME_FOR_EMULATOR),
562 String(_DEFAULT_MMS_ACCOUNT_NAME_FOR_EMULATOR), _NET_ACCOUNT_OWNER_SYSTEM_MMS, defaultAccountId);
566 __isInitialized = true;
569 _SystemNetConnection*
570 _SystemNetConnection::GetPsInstance(NetAccountId netAccountId)
572 result r = E_SUCCESS;
573 _PsSystemNetConnection* pConnection = null;
576 r = _NetAccountDatabase::GetProfileName(netAccountId, profileName);
577 SysTryReturn(NID_NET, r == E_SUCCESS, null, E_INVALID_ACCOUNT,
578 "[%s] Invalid network account. accountId=%d", GetErrorMessage(E_INVALID_ACCOUNT), netAccountId);
580 Mutex* pLock = _NetUtility::GetLock();
581 MutexGuard locked(*pLock);
583 pConnection = dynamic_cast<_PsSystemNetConnection*>(__pPsSystemConnectionMap->GetValue(profileName));
584 if (pConnection == null)
586 pConnection = new (std::nothrow) _PsSystemNetConnection();
587 SysTryReturn(NID_NET, pConnection != null, null, E_OUT_OF_MEMORY,
588 "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
590 r = pConnection->Construct(profileName);
593 SysLogException(NID_NET, r, "[%s] Propagating.", GetErrorMessage(r));
600 r = __pPsSystemConnectionMap->Add(pConnection->__profileName, *pConnection);
603 SysLogException(NID_NET, r, "[%s] Propagating.", GetErrorMessage(r));
616 _SystemNetConnection*
617 _SystemNetConnection::GetDefaultInstance(void)
619 result r = E_SUCCESS;
621 Mutex* pLock = _NetUtility::GetLock();
622 MutexGuard locked(*pLock);
624 if (__pDefaultConnection == null)
626 unique_ptr<_DefaultSystemNetConnection> pDefaultConnection(new (std::nothrow) _DefaultSystemNetConnection());
627 SysTryReturn(NID_NET, pDefaultConnection != null, null, E_OUT_OF_MEMORY,
628 "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
630 r = pDefaultConnection->Construct();
631 SysTryReturn(NID_NET, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
633 __pDefaultConnection = pDefaultConnection.release();
638 return __pDefaultConnection;
641 _SystemNetConnection*
642 _SystemNetConnection::GetWifiInstance(void)
644 result r = E_SUCCESS;
646 Mutex* pLock = _NetUtility::GetLock();
647 MutexGuard locked(*pLock);
649 if (__pWifiConnection == null)
651 unique_ptr<_WifiSystemNetConnection> pWifiConnection(new (std::nothrow) _WifiSystemNetConnection());
652 SysTryReturn(NID_NET, pWifiConnection != null, null, E_OUT_OF_MEMORY,
653 "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
655 r = pWifiConnection->Construct();
656 SysTryReturn(NID_NET, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
658 __pWifiConnection = pWifiConnection.release();
663 return __pWifiConnection;
666 _SystemNetConnection*
667 _SystemNetConnection::GetWifiDirectInstance(void)
669 result r = E_SUCCESS;
671 Mutex* pLock = _NetUtility::GetLock();
672 MutexGuard locked(*pLock);
674 // ToDo - Should be changed similar with other instance. (After resolving circular dependency.)
675 if (__pWifiDirectConnection == null)
677 __pWifiDirectConnection = new (std::nothrow) _WifiDirectSystemNetConnection();
678 SysTryReturn(NID_NET, __pWifiDirectConnection != null, null, E_OUT_OF_MEMORY,
679 "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
681 r = __pWifiDirectConnection->Construct();
684 SysLogException(NID_NET, r, "[%s] Propagating.", GetErrorMessage(r));
686 delete __pWifiDirectConnection;
687 __pWifiDirectConnection = null;
693 return __pWifiDirectConnection;
696 _SystemNetConnection*
697 _SystemNetConnection::GetUsbInstance(void)
699 result r = E_SUCCESS;
701 Mutex* pLock = _NetUtility::GetLock();
702 MutexGuard locked(*pLock);
704 if (__pUsbConnection == null)
706 unique_ptr<_UsbSystemNetConnection> pUsbConnection(new (std::nothrow) _UsbSystemNetConnection());
707 SysTryReturn(NID_NET, pUsbConnection != null, null, E_OUT_OF_MEMORY,
708 "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
710 r = pUsbConnection->Construct();
711 SysTryReturn(NID_NET, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
713 __pUsbConnection = pUsbConnection.release();
718 return __pUsbConnection;
723 _SystemNetConnection::ConvertError(int ret)
725 result r = E_SUCCESS;
733 case NET_ERR_TIME_OUT:
737 case NET_ERR_NO_SERVICE:
738 r = E_NETWORK_UNAVAILABLE;
741 case NET_ERR_NO_ACTIVE_CONNECTIONS:
742 r = E_SERVICE_UNAVAILABLE;
745 case NET_ERR_CONNECTION_LOGIN_FAILED:
746 case NET_ERR_CONNECTION_AUTH_FAILED:
747 case NET_ERR_CONNECTION_INVALID_KEY:
748 r = E_AUTHENTICATION;
751 case NET_ERR_NOT_SUPPORTED:
752 case NET_ERR_SECURITY_RESTRICTED:
753 r = E_UNSUPPORTED_OPERATION;
756 case NET_ERR_CONNECTION_OUT_OF_RANGE:
757 case NET_ERR_CONNECTION_PIN_MISSING:
758 case NET_ERR_CONNECTION_CONNECT_FAILED:
759 case NET_ERR_OPERATION_ABORTED:
760 case NET_ERR_ACCESS_DENIED:
761 r = E_NETWORK_FAILED;
764 case NET_ERR_CONNECTION_DHCP_FAILED:
768 case NET_ERR_WIFI_DRIVER_FAILURE: