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 void pre_select(SelectInfo
&si
);
80 virtual bool post_select(SelectInfo
&si
);
81 virtual bool isok() const;
85 char *connect_status() const;
88 WvModemBase
*take_modem();
89 void give_modem(WvModemBase
*_modem
);
91 friend class WvDialBrain
;
110 WvString dial_prefix
;
114 WvString login_prompt
;
116 WvString pass_prompt
;
118 WvString pppd_option
;
121 WvString default_reply
;
126 WvString dialmessage1
;
127 WvString dialmessage2
;
128 WvString dnstest1
, dnstest2
;
134 int abort_on_no_dialtone
;
148 WvDialMon pppd_mon
; // class to analyse messages of pppd
154 WvStringList
*sect_list
;
161 time_t auto_reconnect_delay
;
162 time_t auto_reconnect_at
;
177 WvString prompt_response
;
182 void async_waitprompt();
186 // The following members are for the wait_for_modem() function.
187 int wait_for_modem( char *strs
[], int timeout
, bool neednewline
,
188 bool verbose
= true);
189 int async_wait_for_modem( char * strs
[], bool neednewline
,
190 bool verbose
= true);
191 char buffer
[ INBUF_SIZE
+ 1 ];
195 // Called from WvDialBrain::guess_menu()
196 bool is_pending() { return( modem
->select( 1000 ) ); }
198 // These are used to read the messages of pppd
199 int pppd_msgfd
[2]; // two fd of the pipe
200 WvFDStream
*pppd_log
; // to read messages of pppd
202 // These are used to pipe the password to pppd
203 int pppd_passwdfd
[2]; // two fd of the pipe