+class wxDialProcess : public wxProcess
+{
+public:
+ wxDialProcess(wxDialUpManagerImpl *dupman)
+ {
+ m_DupMan = dupman;
+ }
+ void Disconnect(void) { m_DupMan = NULL; }
+ virtual void OnTerminate(int WXUNUSED(pid), int WXUNUSED(status))
+ {
+ if(m_DupMan)
+ {
+ m_DupMan->m_DialProcess = NULL;
+ m_DupMan->CheckStatus(TRUE);
+ }
+ }
+private:
+ wxDialUpManagerImpl *m_DupMan;
+};
+
+
+wxDialUpManagerImpl::wxDialUpManagerImpl()
+{
+ /* The isOnline flag can have the following values internally:
+ 0 : not connected
+ 1 : connected
+ -1 : unknown/undefined status
+ */
+ m_IsOnline = -1;
+ m_DialProcess = NULL;
+ m_timer = NULL;
+ m_CanUseIfconfig = -1; // unknown
+ m_CanUsePing = -1; // unknown
+ m_BeaconHost = WXDIALUP_MANAGER_DEFAULT_BEACONHOST;
+ m_BeaconPort = 80;
+
+#ifdef __SGI__
+ m_ConnectCommand = _T("/usr/etc/ppp");
+#elif defined(__LINUX__)
+ // default values for Debian/GNU linux
+ m_ConnectCommand = _T("pon");
+ m_HangUpCommand = _T("poff");
+#endif
+
+ wxChar * dial = wxGetenv(_T("WXDIALUP_DIALCMD"));
+ wxChar * hup = wxGetenv(_T("WXDIALUP_HUPCMD"));
+ SetConnectCommand(dial ? wxString(dial) : m_ConnectCommand,
+ hup ? wxString(hup) : m_HangUpCommand);
+}
+
+wxDialUpManagerImpl::~wxDialUpManagerImpl()
+{
+ if(m_timer) delete m_timer;
+ if(m_DialProcess)
+ {
+ m_DialProcess->Disconnect();
+ m_DialProcess->Detach();
+ }
+}
+