~ubuntu-branches/ubuntu/quantal/wvdial/quantal

« back to all changes in this revision

Viewing changes to src/wvdialer.h

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2004-10-06 11:05:06 UTC
  • mfrom: (0.1.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20041006110506-138x19fe4q0iu46e
Tags: 1.54.0-1ubuntu1
postinst: Disable command-line configuration to not disturb installation;
the script just exits early, so the postinst code is not completely lost
(Warty bug #2069)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Worldvisions Weaver Software:
3
 
 *   Copyright (C) 1997-2002 Net Integration Technologies, Inc.
4
 
 *
5
 
 * Definition of the WvDialer smart-dialer class.
6
 
 *
7
 
 */
8
 
 
9
 
#ifndef __DIALER_H
10
 
#define __DIALER_H
11
 
 
12
 
#include <termios.h>
13
 
 
14
 
#include "strutils.h"
15
 
#include "wvconf.h"
16
 
#include "wvlog.h"
17
 
#include "wvmodem.h"
18
 
#include "wvpapchap.h"
19
 
#include "wvdialbrain.h"
20
 
#include "wvpipe.h"
21
 
#include "wvstreamclone.h"
22
 
#include "wvdialmon.h"
23
 
 
24
 
#define INBUF_SIZE      1024
25
 
#define DEFAULT_BAUD    57600U
26
 
 
27
 
extern const char wvdial_help_text[];
28
 
extern const char wvdial_version_text[];
29
 
 
30
 
struct OptInfo
31
 
/************/
32
 
{
33
 
    char *      name;
34
 
    WvString *  str_member;
35
 
    int *       int_member;
36
 
    char *      str_default;
37
 
    int         int_default;
38
 
};
39
 
 
40
 
class WvConf;
41
 
 
42
 
class WvDialer : public WvStreamClone
43
 
    /***********************************/
44
 
{
45
 
public:
46
 
   WvDialer( WvConf &_cfg, WvStringList *_sect_list, bool _chat_mode = false );
47
 
   virtual ~WvDialer();
48
 
   
49
 
   WvModemBase *modem;
50
 
   
51
 
   bool dial();
52
 
   void hangup();
53
 
   void execute();
54
 
   
55
 
   bool check_attempts_exceeded(int connect_attempts);
56
 
 
57
 
   void pppd_watch( int w );
58
 
   
59
 
   int         ask_password();
60
 
   
61
 
   enum Status {
62
 
       Idle,
63
 
           ModemError,
64
 
           OtherError,
65
 
           Online,
66
 
           Dial,
67
 
           PreDial1,
68
 
           PreDial2,
69
 
           WaitDial,
70
 
           WaitAnything,
71
 
           WaitPrompt,
72
 
           AutoReconnectDelay
73
 
   };
74
 
 
75
 
   Status status() const
76
 
   { return stat; }
77
 
   
78
 
   virtual bool pre_select(SelectInfo &si);
79
 
   virtual bool isok() const;
80
 
   
81
 
   int    connect_attempts;
82
 
   int    dial_stat;
83
 
   char   *connect_status() const;
84
 
   bool   init_modem();
85
 
   void   unlock_modem();
86
 
   bool   lock_modem();
87
 
   
88
 
   friend class WvDialBrain;
89
 
   
90
 
   struct {
91
 
       WvString         modem;
92
 
       int              baud;
93
 
       WvString         init1;
94
 
       WvString         init2;
95
 
       WvString         init3;
96
 
       WvString         init4;
97
 
       WvString         init5;
98
 
       WvString         init6;
99
 
       WvString         init7;
100
 
       WvString         init8;
101
 
       WvString         init9;
102
 
       WvString         phnum;
103
 
       WvString         phnum1;
104
 
       WvString         phnum2;
105
 
       WvString         phnum3;
106
 
       WvString         phnum4;
107
 
       WvString         dial_prefix;
108
 
       WvString         areacode;
109
 
       WvString         dial_cmd;
110
 
       WvString         login;
111
 
       WvString         login_prompt;
112
 
       WvString         password;
113
 
       WvString         pass_prompt;
114
 
       WvString         where_pppd;
115
 
       WvString         pppd_option;
116
 
       WvString         force_addr;
117
 
       WvString         remote;
118
 
       WvString         default_reply;
119
 
       WvString         country;
120
 
       WvString         provider;
121
 
       WvString         product;
122
 
       WvString         homepage;
123
 
       WvString         dialmessage1;
124
 
       WvString         dialmessage2;
125
 
       WvString         dnstest1, dnstest2;
126
 
       int              carrier_check;
127
 
       int              stupid_mode;
128
 
       int              new_pppd;
129
 
       int              auto_reconnect;
130
 
       int              abort_on_busy;
131
 
       int              abort_on_no_dialtone;
132
 
       int              dial_attempts;
133
 
       int              compuserve;
134
 
       int              tonline;
135
 
       int              auto_dns;
136
 
       int              check_dns;
137
 
       int              check_dfr;
138
 
       int              idle_seconds;
139
 
       int              isdn;
140
 
       int              ask_password;
141
 
       
142
 
   } options;
143
 
   
144
 
   
145
 
   WvDialMon pppd_mon;               // class to analyse messages of pppd
146
 
   
147
 
   
148
 
private:
149
 
   WvDialBrain  *brain;
150
 
   WvConf       &cfg;
151
 
   WvStringList *sect_list;
152
 
   
153
 
   bool         chat_mode;
154
 
   
155
 
   bool         been_online;
156
 
   time_t       connected_at;
157
 
   time_t       auto_reconnect_delay;
158
 
   time_t       auto_reconnect_at;
159
 
   WvPipe       *ppp_pipe;
160
 
   
161
 
   int          phnum_count;
162
 
   int          phnum_max;  
163
 
   
164
 
   WvLog        log;
165
 
   WvLog        err;
166
 
   WvLog        modemrx;
167
 
   
168
 
   Status       stat;
169
 
   
170
 
   time_t       last_rx;
171
 
   time_t       last_execute;
172
 
   int          prompt_tries;
173
 
   WvString     prompt_response;
174
 
   
175
 
   void         load_options();
176
 
   
177
 
   void         async_dial();
178
 
   void         async_waitprompt();
179
 
   
180
 
   void         start_ppp();
181
 
   
182
 
   // The following members are for the wait_for_modem() function.
183
 
   int          wait_for_modem( char *strs[], int timeout, bool neednewline,
184
 
                                bool verbose = true);
185
 
   int          async_wait_for_modem( char * strs[], bool neednewline,
186
 
                                      bool verbose = true);
187
 
   char         buffer[ INBUF_SIZE + 1 ];
188
 
   off_t        offset;
189
 
   void         reset_offset();
190
 
   
191
 
   // Called from WvDialBrain::guess_menu()
192
 
   bool         is_pending() { return( modem->select( 1000 ) ); }
193
 
   
194
 
   // These are used to read the messages of pppd
195
 
   int          pppd_msgfd[2];          // two fd of the pipe
196
 
   WvStream     *pppd_log;              // to read messages of pppd
197
 
   
198
 
   // These are used to pipe the password to pppd
199
 
   int          pppd_passwdfd[2];       // two fd of the pipe
200
 
   
201
 
};
202
 
#endif // __DIALER_H