+ m_IsOnline = Net_Unknown;
+
+ // first do quick checks to determine what kind of network devices do we
+ // have
+ int netDeviceType = CheckProcNet();
+ if ( netDeviceType == NetDevice_Unknown )
+ {
+ // nothing found, try ifconfig too
+ netDeviceType = CheckIfconfig();
+ }
+
+ switch ( netDeviceType )
+ {
+ case NetDevice_None:
+ // no network devices, no connection
+ m_IsOnline = Net_No;
+ break;
+
+ case NetDevice_LAN:
+ // we still do ping to confirm that we're connected but we only do
+ // it once and hope that the purpose of the network card (i.e.
+ // whether it used for connecting to the Internet or just to a
+ // LAN) won't change during the program lifetime
+ if ( m_connCard == Net_Unknown )
+ {
+ m_connCard = CheckConnectAndPing();
+ }
+ m_IsOnline = m_connCard;
+ break;
+
+ case NetDevice_Unknown:
+ // try to ping just in case
+ m_IsOnline = CheckConnectAndPing();
+ break;
+
+ case NetDevice_LAN + NetDevice_Modem:
+ case NetDevice_Modem:
+ // assume we're connected
+ m_IsOnline = Net_Connected;
+ break;
+
+ default:
+ wxFAIL_MSG(wxT("Unexpected netDeviceType"));
+ }
+}
+
+bool wxDialUpManagerImpl::IsAlwaysOnline() const
+{
+ wxDialUpManagerImpl *self = wxConstCast(this, wxDialUpManagerImpl);
+
+ int netDeviceType = self->CheckProcNet();
+ if ( netDeviceType == NetDevice_Unknown )
+ {
+ // nothing found, try ifconfig too
+ netDeviceType = self->CheckIfconfig();
+ }
+
+ if ( netDeviceType == NetDevice_Unknown )
+ {
+ // this is the only thing we can do unfortunately...
+ self->HangUp();
+ return IsOnline();
+ }
+ else
+ {
+ // we are only permanently online if we have a network card
+ return (netDeviceType & NetDevice_LAN) != 0;
+ }
+}