Branch data Line data Source code
1 : : // $Id: RSH.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 rsh_h
6 : : #define rsh_h
7 : :
8 : : #include "Login.h"
9 : : #include "ContentLine.h"
10 : :
11 : : typedef enum {
12 : : RSH_FIRST_NULL, // waiting to see first NUL
13 : : RSH_CLIENT_USER_NAME, // scanning client user name up to NUL
14 : : RSH_SERVER_USER_NAME, // scanning server user name up to NUL
15 : : RSH_INITIAL_CMD, // scanning initial command up to NUL
16 : :
17 : : RSH_LINE_MODE, // switch to line-oriented processing
18 : :
19 : : RSH_PRESUMED_REJECTED, // apparently server said No Way
20 : :
21 : : RSH_UNKNOWN, // we don't know what state we're in
22 : : } rsh_state;
23 : :
24 : : class Rsh_Analyzer;
25 : :
26 : : class Contents_Rsh_Analyzer : public ContentLine_Analyzer {
27 : : public:
28 : : Contents_Rsh_Analyzer(Connection* conn, bool orig, Rsh_Analyzer* analyzer);
29 : : ~Contents_Rsh_Analyzer();
30 : :
31 : 0 : rsh_state RshSaveState() const { return save_state; }
32 : :
33 : : protected:
34 : : virtual void DoDeliver(int len, const u_char* data);
35 : : void BadProlog();
36 : :
37 : : rsh_state state, save_state;
38 : : int num_bytes_to_scan;
39 : :
40 : : Rsh_Analyzer* analyzer;
41 : : };
42 : :
43 [ # # ][ # # ]: 0 : class Rsh_Analyzer : public Login_Analyzer {
44 : : public:
45 : : Rsh_Analyzer(Connection* conn);
46 : :
47 : : virtual void DeliverStream(int len, const u_char* data, bool orig);
48 : :
49 : : void ClientUserName(const char* s);
50 : : void ServerUserName(const char* s);
51 : :
52 : 0 : static Analyzer* InstantiateAnalyzer(Connection* conn)
53 : 0 : { return new Rsh_Analyzer(conn); }
54 : :
55 : 1 : static bool Available()
56 [ - + ][ # # ]: 1 : { return login_failure || login_success || login_input_line || login_output_line; }
[ # # ][ # # ]
57 : :
58 : : Contents_Rsh_Analyzer* contents_orig;
59 : : Contents_Rsh_Analyzer* contents_resp;
60 : : };
61 : :
62 : : #endif
|