2 * Worldvisions Weaver Software:
3 * Copyright (C) 1997-2003 Net Integration Technologies, Inc.
5 * Definition of the WvDialer smart-dialer class.
15 #include "wvconfemu.h"
18 #include "wvpapchap.h"
19 #include "wvdialbrain.h"
21 #include "wvstreamclone.h"
22 #include "wvdialmon.h"
24 #define INBUF_SIZE 1024
25 #define DEFAULT_BAUD 57600U
27 extern const char wvdial_help_text
[];
28 extern const char wvdial_version_text
[];
34 WvString
* str_member
;
42 class WvDialer
: public WvStreamClone
43 /***********************************/
46 WvDialer( WvConf
&_cfg
, WvStringList
*_sect_list
, bool _chat_mode
= false );
53 bool check_attempts_exceeded(int connect_attempts
);
55 void pppd_watch( int w
);
76 time_t auto_reconnect_time() const
77 { return (auto_reconnect_at
- time(NULL
)); }
79 virtual bool pre_select(SelectInfo
&si
);
80 virtual bool isok() const;
84 char *connect_status() const;
87 WvModemBase
*take_modem();
88 void give_modem(WvModemBase
*_modem
);
90 friend class WvDialBrain
;
109 WvString dial_prefix
;
113 WvString login_prompt
;
115 WvString pass_prompt
;
117 WvString pppd_option
;
120 WvString default_reply
;
125 WvString dialmessage1
;
126 WvString dialmessage2
;
127 WvString dnstest1
, dnstest2
;
133 int abort_on_no_dialtone
;
147 WvDialMon pppd_mon
; // class to analyse messages of pppd
153 WvStringList
*sect_list
;
160 time_t auto_reconnect_delay
;
161 time_t auto_reconnect_at
;
176 WvString prompt_response
;
181 void async_waitprompt();
185 // The following members are for the wait_for_modem() function.
186 int wait_for_modem( char *strs
[], int timeout
, bool neednewline
,
187 bool verbose
= true);
188 int async_wait_for_modem( char * strs
[], bool neednewline
,
189 bool verbose
= true);
190 char buffer
[ INBUF_SIZE
+ 1 ];
194 // Called from WvDialBrain::guess_menu()
195 bool is_pending() { return( modem
->select( 1000 ) ); }
197 // These are used to read the messages of pppd
198 int pppd_msgfd
[2]; // two fd of the pipe
199 WvFDStream
*pppd_log
; // to read messages of pppd
201 // These are used to pipe the password to pppd
202 int pppd_passwdfd
[2]; // two fd of the pipe