diff options
Diffstat (limited to 'src/protocoltelnet.h')
-rw-r--r-- | src/protocoltelnet.h | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/src/protocoltelnet.h b/src/protocoltelnet.h new file mode 100644 index 0000000..4b2fb32 --- /dev/null +++ b/src/protocoltelnet.h | |||
@@ -0,0 +1,77 @@ | |||
1 | #ifndef PROTOCOLTELNET_H | ||
2 | #define PROTOCOLTELNET_H | ||
3 | |||
4 | #include "protocol.h" | ||
5 | #include "flexbuf.h" | ||
6 | |||
7 | #define ESC "\x1B" /**< A telnet escape code. */ | ||
8 | |||
9 | /** Handles all specialized protocol actions related to the telnet protocol. | ||
10 | * This includes setting modes, non-scrollable regions, and so on. | ||
11 | *@author Mike Buland | ||
12 | */ | ||
13 | class ProtocolTelnet : public Protocol | ||
14 | { | ||
15 | public: | ||
16 | ProtocolTelnet(); | ||
17 | ~ProtocolTelnet(); | ||
18 | |||
19 | bool onNewData(); | ||
20 | bool onNewConnection(); | ||
21 | |||
22 | char *getLine( bool bFullOnly = true ); | ||
23 | char *peekLine( bool bFullOnly = true ); | ||
24 | |||
25 | void setEcho( bool bEchoOn = true ); | ||
26 | |||
27 | enum | ||
28 | { | ||
29 | termUnInited, | ||
30 | termRaw, | ||
31 | termUnknown, | ||
32 | termVT220, | ||
33 | termXTerm | ||
34 | }; | ||
35 | |||
36 | enum | ||
37 | { | ||
38 | SE = 240, // SE: End of subnegotiation parameters. | ||
39 | NOP = 241, // NOP: No operation | ||
40 | DM = 242, // DM: Data mark. Indicates the position of a Synch event within the data stream. This should always be accompanied by a TCP urgent notification. | ||
41 | BRK = 243, // BRK: Break. Indicates that the "break" or "attention" key was hit. | ||
42 | IP = 244, // IP: Suspend, interrupt or abort the process to which the NVT is connected. | ||
43 | AO = 245, // AO: Abort output. Allows the current process to run to completion but do not send its output to the user. | ||
44 | AYT = 246, // AYT: Are you there. Send back to the NVT some visible evidence that the AYT was received. | ||
45 | EC = 247, // EC: Erase character. The receiver should delete the last preceding undeleted character from the data stream. | ||
46 | EL = 248, // EL: Erase line. Delete characters from the data stream back to but not including the previous CRLF. | ||
47 | GA = 249, // GA: Go ahead. Used, under certain circumstances, to tell the other end that it can transmit. | ||
48 | SB = 250, // SB: Subnegotiation of the indicated option follows. | ||
49 | WILL = 251, // WILL: Indicates the desire to begin performing, or confirmation that you are now performing, the indicated option. | ||
50 | WONT = 252, // WONT: Indicates the refusal to perform, or continue performing, the indicated option. | ||
51 | DO = 253, // DO: Indicates the request that the other party perform, or confirmation that you are expecting the other party to perform, the indicated option. | ||
52 | DONT = 254, // DONT: Indicates the demand that the other party stop performing, or confirmation that you are no longer expecting the other party to perform, the indicated option. | ||
53 | IAC = 255 // IAC: Interpret as command | ||
54 | }; | ||
55 | |||
56 | enum | ||
57 | { | ||
58 | ECHO = 1, // Explain who'll echo | ||
59 | SUPPRESSGA = 3, // Suppress Go Ahead | ||
60 | TERMTYPE = 24, // Terminal Type | ||
61 | NAWS = 31, // Window size | ||
62 | TERMSPEED = 32, // Terminal Speed | ||
63 | LINEMODE = 34 // Linemode | ||
64 | }; | ||
65 | |||
66 | private: | ||
67 | int nTermType; | ||
68 | |||
69 | int nTermWidth; | ||
70 | int nTermHeight; | ||
71 | |||
72 | FlexBuf fbEdited; | ||
73 | |||
74 | bool bEchoOn; | ||
75 | }; | ||
76 | |||
77 | #endif | ||