// Purpose: Network related wxWidgets classes and functions
// Author: Karsten Ballüder
// Modified by:
// Created: 03.10.99
// RCS-ID: $Id$
// Copyright: (c) Karsten Ballüder
// Purpose: Network related wxWidgets classes and functions
// Author: Karsten Ballüder
// Modified by:
// Created: 03.10.99
// RCS-ID: $Id$
// Copyright: (c) Karsten Ballüder
-DEFINE_EVENT_TYPE(wxEVT_DIALUP_CONNECTED)
-DEFINE_EVENT_TYPE(wxEVT_DIALUP_DISCONNECTED)
+wxDEFINE_EVENT( wxEVT_DIALUP_CONNECTED, wxDialUpEvent )
+wxDEFINE_EVENT( wxEVT_DIALUP_DISCONNECTED, wxDialUpEvent )
// ----------------------------------------------------------------------------
// A class which groups functions dealing with connecting to the network from a
// ----------------------------------------------------------------------------
// A class which groups functions dealing with connecting to the network from a
/** The simplest way to initiate a dial up: this function dials the given
ISP (exact meaning of the parameter depends on the platform), returns
/** The simplest way to initiate a dial up: this function dials the given
ISP (exact meaning of the parameter depends on the platform), returns
// this just means that a RAS connection exists, under Unix we check that
// the "well-known host" (as specified by SetWellKnownHost) is reachable
virtual bool IsOnline() const
// this just means that a RAS connection exists, under Unix we check that
// the "well-known host" (as specified by SetWellKnownHost) is reachable
virtual bool IsOnline() const
// so, in general, the user should be allowed to override it. This function
// allows to forcefully set the online status - whatever our internal
// algorithm may think about it.
// so, in general, the user should be allowed to override it. This function
// allows to forcefully set the online status - whatever our internal
// algorithm may think about it.
virtual bool EnableAutoCheckOnlineStatus(size_t nSeconds);
// disable automatic check for connection status change - notice that the
virtual bool EnableAutoCheckOnlineStatus(size_t nSeconds);
// disable automatic check for connection status change - notice that the
- if(m_IsOnline == Net_Connected)
- return FALSE;
- m_ISPname = isp;
- wxString cmd;
- if(m_ConnectCommand.Find(wxT("%s")))
- cmd.Printf(m_ConnectCommand,m_ISPname.c_str());
- else
- cmd = m_ConnectCommand;
+ if(m_IsOnline == Net_Connected)
+ return false;
+ m_ISPname = isp;
+ wxString cmd;
+ if(m_ConnectCommand.Find(wxT("%s")))
+ cmd.Printf(m_ConnectCommand,m_ISPname.c_str());
+ else
+ cmd = m_ConnectCommand;
- if ( async )
- {
- m_DialProcess = new wxDialProcess(this);
- m_DialPId = (int)wxExecute(cmd, FALSE, m_DialProcess);
- if(m_DialPId == 0)
- {
- delete m_DialProcess;
- m_DialProcess = NULL;
- return FALSE;
- }
- else
- return TRUE;
- }
- else
- return wxExecute(cmd, /* sync */ TRUE) == 0;
+ if ( async )
+ {
+ m_DialProcess = new wxDialProcess(this);
+ m_DialPId = (int)wxExecute(cmd, false, m_DialProcess);
+ if(m_DialPId == 0)
+ {
+ delete m_DialProcess;
+ m_DialProcess = NULL;
+ return false;
+ }
+ else
+ return true;
+ }
+ else
+ return wxExecute(cmd, /* sync */ true) == 0;
- if(m_IsOnline == Net_No)
- return FALSE;
- if(IsDialing())
- {
- wxLogError(_("Already dialling ISP."));
- return FALSE;
- }
- wxString cmd;
- if(m_HangUpCommand.Find(wxT("%s")))
- cmd.Printf(m_HangUpCommand,m_ISPname.c_str(), m_DialProcess);
- else
- cmd = m_HangUpCommand;
- return wxExecute(cmd, /* sync */ TRUE) == 0;
+ if(m_IsOnline == Net_No)
+ return false;
+ if(IsDialing())
+ {
+ wxLogError(_("Already dialling ISP."));
+ return false;
+ }
+ wxString cmd;
+ if(m_HangUpCommand.Find(wxT("%s")))
+ cmd.Printf(m_HangUpCommand,m_ISPname.c_str(), m_DialProcess);
+ else
+ cmd = m_HangUpCommand;
+ return wxExecute(cmd, /* sync */ true) == 0;
_T("/sbin"), // Linux, FreeBSD, Darwin
_T("/usr/sbin"), // SunOS, Solaris, AIX, HP-UX
_T("/usr/etc"), // IRIX
_T("/sbin"), // Linux, FreeBSD, Darwin
_T("/usr/sbin"), // SunOS, Solaris, AIX, HP-UX
_T("/usr/etc"), // IRIX
wxASSERT_MSG( m_IfconfigPath.length(),
_T("can't use ifconfig if it wasn't found") );
wxASSERT_MSG( m_IfconfigPath.length(),
_T("can't use ifconfig if it wasn't found") );
so we could let ifconfig write directly to the tmpfile, but
this does not work. That should be faster, as it doesn´t call
the shell first. I have no idea why. :-( (KB) */
so we could let ifconfig write directly to the tmpfile, but
this does not work. That should be faster, as it doesn´t call
the shell first. I have no idea why. :-( (KB) */
|| strstr(output.fn_str(),"pl"); // plip
hasLAN = strstr(output.fn_str(), "eth") != NULL;
#elif defined(__SGI__) // IRIX
|| strstr(output.fn_str(),"pl"); // plip
hasLAN = strstr(output.fn_str(), "eth") != NULL;
#elif defined(__SGI__) // IRIX
- wxLogNull ln; // suppress all error messages
- wxASSERT(m_PingPath.length());
- wxString cmd;
- cmd << m_PingPath << wxT(' ');
+ wxLogNull ln; // suppress all error messages
+ wxASSERT(m_PingPath.length());
+ wxString cmd;
+ cmd << m_PingPath << wxT(' ');
- // nothing to add to ping command
-#elif defined(__LINUX__) || defined (__BSD__) || defined( __VMS )
- cmd << wxT("-c 1 "); // only ping once
+ // nothing to add to ping command
+#elif defined(__AIX__) || \
+ defined (__BSD__) || \
+ defined(__LINUX__) || \
+ defined(__OSF__) || \
+ defined(__SGI__) || \
+ defined(__VMS)
+ cmd << wxT("-c 1 "); // only ping once