Automatically install wsd if readline dependancy is satisfied.
[wvapps.git] / wvdial / wvdialbrain.h
blob77e38f2924efc78f1f760ee8f5a8d5b0d006df00
1 /*
2 * Worldvisions Weaver Software:
3 * Copyright (C) 1997-2003 Net Integration Technologies, Inc.
5 * Definition of the brains behind the WvDialer class.
7 */
9 #ifndef __WVDIALBRAIN_H
10 #define __WVDIALBRAIN_H
12 #include <termios.h>
14 #include "strutils.h"
15 #include "wvlog.h"
16 #include "wvpipe.h"
17 #include "wvstreamclone.h"
19 class WvDialer;
21 enum BrainTokenType
22 /*****************/
24 TOK_WORD = 0,
25 TOK_NUMBER,
26 TOK_PUNCT
29 struct BrainToken
30 /***************/
32 BrainTokenType type;
33 char * tok_str;
34 char tok_char;
35 BrainToken * next;
38 class WvDialBrain
39 /***************/
41 public:
42 WvDialBrain( WvDialer * a_dialer );
43 ~WvDialBrain();
45 void reset();
47 const char * check_prompt( const char * buffer );
48 const char * guess_menu( char * buf );
49 int saw_first_compuserve_prompt;
51 private:
52 WvDialer * dialer;
54 int sent_login;
55 int prompt_tries;
56 WvString prompt_response;
58 // These functions are called from check_prompt()....
59 bool is_prompt( const char * c,
60 const char * promptstring = NULL,
61 bool dots_wild = false );
62 bool is_login_prompt( const char * buf );
63 bool is_compuserve_prompt( const char * buf );
64 bool is_password_prompt( const char * buf );
65 bool is_welcome_msg( const char * buf );
67 // Menu-string tokenizer....
68 BrainToken * tokenize( char * left, char * right );
69 BrainToken * tokenize( char * str );
70 void token_list_done( BrainToken * token_list );
72 // Called from guess_menu....
73 void guess_menu_guts( BrainToken * token_list );
74 void set_prompt_response( char * str );
77 inline BrainToken * WvDialBrain::tokenize( char * str )
78 /*****************************************************/
80 if( str == NULL )
81 return( NULL );
83 return( tokenize( str, str+strlen( str ) - 1 ) );
86 #endif // __WVDIALBRAIN_H