Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1193)

Side by Side Diff: net/base/telnet_server.h

Issue 42013: Slight code change to make some global variables const. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/base/ssl_client_socket_nss.cc ('k') | net/http/http_cache.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_BASE_TELNET_SERVER_H_ 5 #ifndef NET_BASE_TELNET_SERVER_H_
6 #define NET_BASE_TELNET_SERVER_H_ 6 #define NET_BASE_TELNET_SERVER_H_
7 7
8 #include "net/base/listen_socket.h" 8 #include "net/base/listen_socket.h"
9 9
10 // Implements the telnet protocol on top of the raw socket interface. 10 // Implements the telnet protocol on top of the raw socket interface.
11 // DidRead calls to the delegate are buffered on a line by line basis. 11 // DidRead calls to the delegate are buffered on a line by line basis.
12 // (for now this means that basic line editing is handled in this object) 12 // (for now this means that basic line editing is handled in this object)
13 class TelnetServer : public ListenSocket { 13 class TelnetServer : public ListenSocket {
14 public: 14 public:
15 static TelnetServer* Listen(std::string ip, int port, 15 static TelnetServer* Listen(std::string ip, int port,
16 ListenSocketDelegate *del); 16 ListenSocketDelegate *del);
17 virtual ~TelnetServer(); 17 virtual ~TelnetServer();
18 18
19 protected: 19 protected:
20 void Listen() { ListenSocket::Listen(); } 20 void Listen() { ListenSocket::Listen(); }
21 virtual void Read(); 21 virtual void Read();
22 virtual void Accept(); 22 virtual void Accept();
23 virtual void SendInternal(const char* bytes, int len); 23 virtual void SendInternal(const char* bytes, int len);
24 24
25 private: 25 private:
26 enum TelnetInputState { 26 enum TelnetInputState {
27 NOT_IN_IAC_OR_ESC_SEQUENCE, // Currently not processing any IAC or ESC sequ ence. 27 // Currently not processing any IAC or ESC sequence.
28 EXPECTING_NEW_LINE, // Received carriage return (CR) expecting new line (LF ). 28 NOT_IN_IAC_OR_ESC_SEQUENCE,
29 EXPECTING_COMMAND, // Processing IAC expecting command. 29 // Received carriage return (CR) expecting new line (LF).
30 EXPECTING_OPTION, // Processing IAC expecting option. 30 EXPECTING_NEW_LINE,
31 SUBNEGOTIATION_EXPECTING_IAC, // Inside subnegoation IAC,SE will end it. 31 // Processing IAC expecting command.
32 SUBNEGOTIATION_EXPECTING_SE, // Ending subnegoation expecting SE. 32 EXPECTING_COMMAND,
33 EXPECTING_FIRST_ESC_CHARACTER, // Processing ESC sequence. 33 // Processing IAC expecting option.
34 EXPECTING_SECOND_ESC_CHARACTER, // Processing ESC sequence with two charact ers 34 EXPECTING_OPTION,
35 EXPECTING_NUMBER_SEMICOLON_OR_END // Processing "ESC [" sequence. 35 // Inside subnegoation IAC,SE will end it.
36 SUBNEGOTIATION_EXPECTING_IAC,
37 // Ending subnegoation expecting SE.
38 SUBNEGOTIATION_EXPECTING_SE,
39 // Processing ESC sequence.
40 EXPECTING_FIRST_ESC_CHARACTER,
41 // Processing ESC sequence with two characters.
42 EXPECTING_SECOND_ESC_CHARACTER,
43 // Processing "ESC [" sequence.
44 EXPECTING_NUMBER_SEMICOLON_OR_END
36 }; 45 };
37 46
38 TelnetServer(SOCKET s, ListenSocketDelegate* del); 47 TelnetServer(SOCKET s, ListenSocketDelegate* del);
39 48
40 // telnet commands 49 // telnet commands
41 void SendIAC(int command, int option); 50 void SendIAC(int command, int option);
42 void StateMachineStep(unsigned char c); 51 void StateMachineStep(unsigned char c);
43 52
44 TelnetInputState input_state_; 53 TelnetInputState input_state_;
45 int iac_command_; // Last command read. 54 int iac_command_; // Last command read.
46 int iac_option_; // Last option read. 55 int iac_option_; // Last option read.
47 std::string command_line_; 56 std::string command_line_;
48 57
49 DISALLOW_EVIL_CONSTRUCTORS(TelnetServer); 58 DISALLOW_EVIL_CONSTRUCTORS(TelnetServer);
50 }; 59 };
51 60
52 #endif // BASE_TELNET_SERVER_H_ 61 #endif // BASE_TELNET_SERVER_H_
53 62
OLDNEW
« no previous file with comments | « net/base/ssl_client_socket_nss.cc ('k') | net/http/http_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698