Branch data Line data Source code
1 : : // $Id: Rlogin.h 6219 2008-10-01 05:39:07Z vern $
2 : : //
3 : : // See the file "COPYING" in the main distribution directory for copyright.
4 : :
5 : : #ifndef rlogin_h
6 : : #define rlogin_h
7 : :
8 : : #include "Login.h"
9 : : #include "ContentLine.h"
10 : :
11 : : typedef enum {
12 : : RLOGIN_FIRST_NULL, // waiting to see first NUL
13 : : RLOGIN_CLIENT_USER_NAME, // scanning client user name up to NUL
14 : : RLOGIN_SERVER_USER_NAME, // scanning server user name up to NUL
15 : : RLOGIN_TERMINAL_TYPE, // scanning terminal type & speed
16 : :
17 : : RLOGIN_SERVER_ACK, // waiting to see NUL from server to ack client
18 : :
19 : : RLOGIN_IN_BAND_CONTROL_FF2, // waiting to see the second FF
20 : :
21 : : RLOGIN_WINDOW_CHANGE_S1, // waiting to see the first 's'
22 : : RLOGIN_WINDOW_CHANGE_S2, // waiting to see the second 's'
23 : : RLOGIN_WINDOW_CHANGE_REMAINDER, // remaining "bytes_to_scan" bytes
24 : :
25 : : RLOGIN_LINE_MODE, // switch to line-oriented processing
26 : :
27 : : RLOGIN_PRESUMED_REJECTED, // apparently server said No Way
28 : :
29 : : RLOGIN_UNKNOWN, // we don't know what state we're in
30 : : } rlogin_state;
31 : :
32 : : class Rlogin_Analyzer;
33 : :
34 : : class Contents_Rlogin_Analyzer : public ContentLine_Analyzer {
35 : : public:
36 : : Contents_Rlogin_Analyzer(Connection* conn, bool orig,
37 : : Rlogin_Analyzer* analyzer);
38 : : ~Contents_Rlogin_Analyzer();
39 : :
40 : 0 : void SetPeer(Contents_Rlogin_Analyzer* arg_peer)
41 : 0 : { peer = arg_peer; }
42 : :
43 : : rlogin_state RloginState() const
44 : : { return state; }
45 : :
46 : : protected:
47 : : void DoDeliver(int len, const u_char* data);
48 : : void BadProlog();
49 : :
50 : : rlogin_state state, save_state;
51 : : int num_bytes_to_scan;
52 : :
53 : : Contents_Rlogin_Analyzer* peer;
54 : : Rlogin_Analyzer* analyzer;
55 : : };
56 : :
57 [ # # ][ # # ]: 0 : class Rlogin_Analyzer : public Login_Analyzer {
58 : : public:
59 : : Rlogin_Analyzer(Connection* conn);
60 : :
61 : : void ClientUserName(const char* s);
62 : : void ServerUserName(const char* s);
63 : : void TerminalType(const char* s);
64 : :
65 : 0 : static Analyzer* InstantiateAnalyzer(Connection* conn)
66 : 0 : { return new Rlogin_Analyzer(conn); }
67 : :
68 : 1 : static bool Available()
69 : : {
70 : : return login_failure || login_success ||
71 [ - + ][ # # ]: 1 : login_input_line || login_output_line;
[ # # ][ # # ]
72 : : }
73 : : };
74 : :
75 : : #endif
|